Merge branch 'running-jobs-in-left-sidebar' into to-the-left

This commit is contained in:
Lisa Passing 2015-03-18 15:51:50 +01:00
commit 3291355808
4 changed files with 82 additions and 52 deletions

View File

@ -7,6 +7,13 @@ Controller = Ember.ArrayController.extend
activate: (name) ->
@activate(name)
showRunningJobs: ->
@activate('running')
showMyRepositories: ->
@activate('owned')
tabOrIsLoadedDidChange: (->
@possiblyRedirectToGettingStartedPage()
).observes('isLoaded', 'tab', 'length')
@ -57,6 +64,8 @@ Controller = Ember.ArrayController.extend
viewOwned: ->
@set('content', @get('userRepos'))
viewRunning: ->
userRepos: (->
if login = @get('currentUser.login')
Repo.accessibleBy(@store, login)
@ -91,4 +100,8 @@ Controller = Ember.ArrayController.extend
'Could not find any repos'
).property('tab')
showRunningJobs: (->
@get('tab') == 'running'
).property('tab')
`export default Controller`

View File

@ -6,52 +6,63 @@
{{view 'repos-list-tabs'}}
<div class="tabbody sidebar-list">
{{#if showRunningJobs}}
<div class="tabbody sidebar-list">
{{render "runningJobs"}}
{{#if isLoaded}}
{{#collection 'repos-list' content=this}}
{{#with view.repo as repo}}
<div {{bind-attr class=":tile :tile--sidebar repo.lastBuildState"}}>
<h2 class="tile-title">
{{#if repo.slug}}
<span {{bind-attr class=":icon :icon--job repo.lastBuildState"}}></span>
{{#link-to "repo" repo class="slug"}}{{repo.slug}}{{/link-to}}
{{/if}}
</h2>
{{#with repo.lastBuildHash as lastBuild}}
{{#if repo.slug}}
{{#if lastBuild.id}}
<p class="tile-title float-right">
<span class="icon icon--hash"></span>
{{#link-to "build" repo lastBuild.id
class="last_build"}}{{lastBuild.number}}{{/link-to}}
</p>
{{render "queue"}}
</div>
{{else}}
<div class="tabbody sidebar-list">
{{#if isLoaded}}
{{#collection 'repos-list' content=this}}
{{#with view.repo as repo}}
<div {{bind-attr class=":tile :tile--sidebar repo.lastBuildState"}}>
<h2 class="tile-title">
{{#if repo.slug}}
<span {{bind-attr class=":icon :icon--job repo.lastBuildState"}}></span>
{{#link-to "repo" repo class="slug"}}{{repo.slug}}{{/link-to}}
{{/if}}
{{/if}}
{{/with}}
<p>
<span class="icon icon--clock"></span>
Duration:
<abbr class="duration" {{bind-attr title="lastBuildStartedAt"}}>
{{format-duration repo.lastBuildDuration}}
</abbr>
</p>
<p>
<span class="icon icon--cal"></span>
Finished:
<abbr clas s="finished_at timeago" {{bind-attr title="lastBuildFinishedAt"}}>
{{format-time repo.lastBuildFinishedAt}}
</abbr>
</p>
</div>
{{/with}}
{{else}}
<p class="empty">{{noReposMessage}}</p>
{{/collection}}
</h2>
{{#with repo.lastBuildHash as lastBuild}}
{{#if repo.slug}}
{{#if lastBuild.id}}
<p class="tile-title float-right">
<span class="icon icon--hash"></span>
{{#link-to "build" repo lastBuild.id
class="last_build"}}{{lastBuild.number}}{{/link-to}}
</p>
{{/if}}
{{/if}}
{{/with}}
{{#if repo.lastBuildHash.number }}
<p>
<span class="icon icon--clock"></span>
Duration:
<abbr class="duration" {{bind-attr title="lastBuildStartedAt"}}>
{{format-duration repo.lastBuildDuration}}
</abbr>
</p>
<p>
<span class="icon icon--cal"></span>
Finished:
<abbr class="finished_at timeago" {{bind-attr title="lastBuildFinishedAt"}}>
{{format-time repo.lastBuildFinishedAt}}
</abbr>
</p>
</div>
{{/with}}
{{else}}
<p class="empty">{{noReposMessage}}</p>
{{/collection}}
{{else}}
<div class="spinner-container">
<span class="sync-spinner sync-spinner--grey"><i></i><i></i><i></i></span>
</div>
{{/if}}
</div>
{{/if}}
{{else}}
<div class="spinner-container">
<span class="sync-spinner sync-spinner--grey"><i></i><i></i><i></i></span>
</div>
{{/if}}
</div>

View File

@ -1,19 +1,19 @@
<div class="tabnav tabnav--sidebar" role="tablist">
<ul class="tab tabs--sidebar">
<li id="tab_owned" {{bind-attr class="view.classOwned"}}>
{{#link-to "main.repositories"}}My Repositories{{/link-to}}
<a href="#" {{action "showMyRepositories"}}>My Repositories</a>
</li>
{{#unless config.pro}}
<li id="tab_recent" {{bind-attr class="view.classRecent"}}>
{{!-- <li id="tab_recent" {{bind-attr class="view.classRecent"}}>
{{#link-to "main.recent"}}Recent{{/link-to}}
</li> --}}
<li id="tab_running" {{bind-attr class="view.classRunning"}}>
<a href="#" {{action "showRunningJobs"}}>Running</a>
</li>
{{/unless}}
{{!-- <li id="tab_search" {{bind-attr class="view.classSearch"}}>
<h5>Search</h5>
</li> --}}
<li id="tab_new" {{bind-attr class="view.classNew :float-right"}}>
{{#link-to "profile" trackEvent="add-repository-from-list" title="Add New Repository"}}
<span class="icon icon--plus"></span>

View File

@ -12,6 +12,12 @@ View = Ember.View.extend
'hidden'
).property('tab')
classRunning: (->
classes = []
classes.push('active') if @get('tab') == 'running'
classes.join(' ')
).property('tab')
classOwned: (->
classes = []
classes.push('active') if @get('tab') == 'owned'