add make owner page sorta kinda work
This commit is contained in:
parent
1760168d45
commit
4ac5841a6d
20
app/components/owner-repo-tile.coffee
Normal file
20
app/components/owner-repo-tile.coffee
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
`import Ember from 'ember'`
|
||||||
|
|
||||||
|
OwnerRepoTileComponent = Ember.Component.extend
|
||||||
|
|
||||||
|
tagName: 'li'
|
||||||
|
classNames: ['tile', 'tile--small', 'row']
|
||||||
|
classNameBindings: ['repo.default_branch.last_build.state']
|
||||||
|
|
||||||
|
ownerName: (->
|
||||||
|
@get('repo.slug').split(/\//)[0]
|
||||||
|
).property('repo.slug')
|
||||||
|
|
||||||
|
repoName: (->
|
||||||
|
@get('repo.slug').split(/\//)[1]
|
||||||
|
).property('repo.slug')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`export default OwnerRepoTileComponent`
|
|
@ -16,7 +16,29 @@ Controller = Ember.Controller.extend
|
||||||
).property()
|
).property()
|
||||||
|
|
||||||
owner: (->
|
owner: (->
|
||||||
@get('model')
|
data = @get('model')
|
||||||
|
console.log(data)
|
||||||
|
|
||||||
|
{
|
||||||
|
login: data.login
|
||||||
|
name: data.name
|
||||||
|
isSyncing: data.is_syncing
|
||||||
|
avatarUrl: data.avatar_url
|
||||||
|
syncedAt: data.synced_at
|
||||||
|
}
|
||||||
|
|
||||||
|
).property('model')
|
||||||
|
|
||||||
|
repos: (->
|
||||||
|
data = @get('model')
|
||||||
|
|
||||||
|
repos = data.repositories.filter (item, index) ->
|
||||||
|
if item.active && item.default_branch.last_build != null
|
||||||
|
item.active
|
||||||
|
|
||||||
|
console.log(repos)
|
||||||
|
repos
|
||||||
|
|
||||||
).property('model')
|
).property('model')
|
||||||
|
|
||||||
`export default Controller`
|
`export default Controller`
|
||||||
|
|
|
@ -9,10 +9,8 @@ Route = TravisRoute.extend
|
||||||
model: (params) ->
|
model: (params) ->
|
||||||
owner = {}
|
owner = {}
|
||||||
|
|
||||||
$.get("https://api.travis-ci.org/v3/owner/#{params.owner}?include=user.repositories,organization.repositories").then( (data) ->
|
$.get("https://api-staging.travis-ci.org/v3/owner/#{params.owner}?include=user.repositories,organization.repositories,build.commit").then( (data) ->
|
||||||
owner = data
|
data
|
||||||
|
|
||||||
owner
|
|
||||||
)
|
)
|
||||||
|
|
||||||
`export default Route`
|
`export default Route`
|
||||||
|
|
30
app/templates/components/owner-repo-tile.hbs
Normal file
30
app/templates/components/owner-repo-tile.hbs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{{#if repo.private }}
|
||||||
|
<div class="tile-lock"><span class="icon icon-lock"></span></div>
|
||||||
|
{{/if}}
|
||||||
|
<div class="tile-status">
|
||||||
|
<span {{bind-attr class=":icon :icon-status repo.default_branch.last_build.state"}}></span>
|
||||||
|
<span {{bind-attr class=":icon :request-kind repo.default_branch.last_build.event_type"}}></span>
|
||||||
|
</div>
|
||||||
|
<div class="tile-main tile-header column medium-3">
|
||||||
|
<h3>{{ownerName}}</h3>
|
||||||
|
<h2>{{#link-to "repo" ownerName repoName }}{{repoName}}{{/link-to}}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="tile-single column medium-9 end">
|
||||||
|
{{#if repo.default_branch.last_build}}
|
||||||
|
<p class="tile-job build-status column medium-3 small-6"><span class="icon icon-hash"></span>
|
||||||
|
{{#link-to "build" ownerName repoName repo.default_branch.last_build.number}}
|
||||||
|
{{!-- {{repo.last_build.number}} {{repo.last_build.state}} --}}
|
||||||
|
{{repo.default_branch.last_build.number}} {{repo.default_branch.last_build.state}}
|
||||||
|
{{/link-to}}</p>
|
||||||
|
<p class="tile-commit column medium-3 small-6">
|
||||||
|
<span class="icon icon-github"></span><a {{bind-attr href="repo.default_branch.last_build.commit.compare_url"}}>{{format-sha repo.default_branch.last_build.commit.sha}}</a></p>
|
||||||
|
<p class="tile-timeago column medium-3 small-6">
|
||||||
|
<span class="icon icon-clock"></span>
|
||||||
|
{{format-duration repo.default_branch.last_build.duration}}</p>
|
||||||
|
<p class="tile-timeago column medium-2 small-6">
|
||||||
|
<span class="icon icon-cal"></span>
|
||||||
|
{{format-time repo.default_branch.last_build.finished_at}}</p>
|
||||||
|
{{else}}
|
||||||
|
<p>there is no build</p>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="sync-button">
|
<div class="sync-button">
|
||||||
{{#if owner.is_syncing }}
|
{{#if owner.isSyncing }}
|
||||||
<p>
|
<p>
|
||||||
<button class="button" disabled="disabled">
|
<button class="button" disabled="disabled">
|
||||||
<span class="sync-spinner"><i></i><i></i><i></i></span>Syncing
|
<span class="sync-spinner"><i></i><i></i><i></i></span>Syncing
|
||||||
|
@ -10,6 +10,6 @@
|
||||||
<button {{action sync}} class="button">
|
<button {{action sync}} class="button">
|
||||||
<span class="icon icon-sync"></span>Sync account</button>
|
<span class="icon icon-sync"></span>Sync account</button>
|
||||||
</p>
|
</p>
|
||||||
<p class="sync-last">last synced {{format-time owner.synced_at}}</p>
|
<p class="sync-last">last synced {{format-time owner.syncedAt}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
<header class="owner-header row">
|
<header class="owner-header row">
|
||||||
<section class="columns small-10 medium-5">
|
<section class="columns small-10 medium-5">
|
||||||
<div class="owner-avatar">
|
<div class="owner-avatar">
|
||||||
<img {{bind-attr src="avatarURL"}} alt="">
|
<img {{bind-attr src="owner.avatarUrl"}} alt="" width="125" height="125">
|
||||||
</div>
|
</div>
|
||||||
<div class="owner-info">
|
<div class="owner-info">
|
||||||
<h1 class="owner-title">{{owner.name}}</h1>
|
<h1 class="owner-title">{{owner.name}}</h1>
|
||||||
{{!-- TODO: only sync btn if user part of org --}}
|
|
||||||
<p class="owner-handle"><a {{bind-attr href="githubProfile"}} title=""><span class="icon icon--github-circle"></span> {{owner.login}}</a></p>
|
<p class="owner-handle"><a {{bind-attr href="githubProfile"}} title=""><span class="icon icon--github-circle"></span> {{owner.login}}</a></p>
|
||||||
{{owner-sync-button owner=owner}}
|
{{owner-sync-button owner=owner}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
|
@ -27,32 +28,9 @@
|
||||||
|
|
||||||
<section role="tabpanel">
|
<section role="tabpanel">
|
||||||
<ul class="owner-tiles">
|
<ul class="owner-tiles">
|
||||||
<li {{bind-attr class=":tile :tile--small :row repo.last_build.state :passed"}}>
|
{{#each repo in repos}}
|
||||||
{{#if repo.private }}
|
{{owner-repo-tile repo=repo}}
|
||||||
<div class="tile-lock"><span class="icon icon-lock"></span></div>
|
{{/each}}
|
||||||
{{/if}}
|
|
||||||
<div class="tile-status">
|
|
||||||
<span {{bind-attr class=":icon :icon-status repo.last_build.state :passed"}}></span>
|
|
||||||
<span {{bind-attr class=":icon :request-kind repo.last_build.state :push"}}></span>
|
|
||||||
</div>
|
|
||||||
<div class="tile-main tile-header column medium-3">
|
|
||||||
<h3>owner</h3>
|
|
||||||
<h2>{{#link-to "repo" repo.owner.login repo.name}}repo namerepo namerepo namerepo namerepo namerepo namerepo name{{/link-to}}</h2>
|
|
||||||
</div>
|
|
||||||
<div class="tile-single column medium-9 end">
|
|
||||||
<p class="tile-job build-status column medium-3 small-6"><span class="icon icon-hash"></span>
|
|
||||||
{{#link-to "build" repo.owner.login repo.name repo.last_build.id}}
|
|
||||||
{{!-- {{repo.last_build.number}} {{repo.last_build.state}} --}}
|
|
||||||
1234 passed
|
|
||||||
{{/link-to}}</p>
|
|
||||||
<p class="tile-commit column medium-3 small-6">
|
|
||||||
<span class="icon icon-github"></span><a href="#">394348a</a></p>
|
|
||||||
<p class="tile-timeago column medium-3 small-6">
|
|
||||||
<span class="icon icon-clock"></span>ran for 3 min 23 sec</p>
|
|
||||||
<p class="tile-timeago column medium-2 small-6">
|
|
||||||
<span class="icon icon-cal"></span>3 days ago{{!-- {{format-time repo.last_build.finished_at}} --}}</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
17
tests/unit/components/owner-repo-tile-test.coffee
Normal file
17
tests/unit/components/owner-repo-tile-test.coffee
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
`import { test, moduleForComponent } from 'ember-qunit'`
|
||||||
|
|
||||||
|
moduleForComponent 'owner-repo-tile', 'OwnerRepoTileComponent', {
|
||||||
|
# specify the other units that are required for this test
|
||||||
|
# needs: ['component:foo', 'helper:bar']
|
||||||
|
}
|
||||||
|
|
||||||
|
test 'it renders', ->
|
||||||
|
expect 2
|
||||||
|
|
||||||
|
# creates the component instance
|
||||||
|
component = @subject()
|
||||||
|
equal component._state, 'preRender'
|
||||||
|
|
||||||
|
# appends the component to the page
|
||||||
|
@append()
|
||||||
|
equal component._state, 'inDOM'
|
Loading…
Reference in New Issue
Block a user