Quick crude and hackish version of running jobs

This commit is contained in:
Piotr Sarnacki 2015-03-18 15:34:37 +01:00
parent 69d6f9e8a1
commit 55fd558eb0
4 changed files with 69 additions and 43 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

@ -4,46 +4,52 @@
{{view 'repos-list-tabs'}}
<div class="tab">
{{#if isLoaded}}
{{#collection 'repos-list' content=this}}
{{#with view.repo as repo}}
<div class="slug-and-status">
<span class="status"></span>
{{#if repo.slug}}
{{#link-to "repo" repo class="slug"}}{{repo.slug}}{{/link-to}}
{{/if}}
</div>
{{#with repo.lastBuildHash as lastBuild}}
{{#if repo.slug}}
{{#if lastBuild.id}}
{{#link-to "build" repo lastBuild.id
class="last_build"}}{{lastBuild.number}}{{/link-to}}
{{/if}}
{{#if showRunningJobs}}
<div class="tab">
Running jobs will go here
</div>
{{else}}
<div class="tab">
{{#if isLoaded}}
{{#collection 'repos-list' content=this}}
{{#with view.repo as repo}}
<div class="slug-and-status">
<span class="status"></span>
{{#if repo.slug}}
{{#link-to "repo" repo class="slug"}}{{repo.slug}}{{/link-to}}
{{/if}}
</div>
{{#with repo.lastBuildHash as lastBuild}}
{{#if repo.slug}}
{{#if lastBuild.id}}
{{#link-to "build" repo lastBuild.id
class="last_build"}}{{lastBuild.number}}{{/link-to}}
{{/if}}
{{/if}}
{{/with}}
{{#if repo.lastBuildHash.number }}
<p class="summary">
<span class="duration_label">Duration:</span>
<abbr class="duration" {{bind-attr title="lastBuildStartedAt"}}>
{{format-duration repo.lastBuildDuration}}
</abbr>
</p>
<p class="summary">
<span class="finished-icon"></span><span class="finished_at_label">Finished:</span>
<abbr class="finished_at timeago" {{bind-attr title="lastBuildFinishedAt"}}>
{{format-time repo.lastBuildFinishedAt}}
</abbr>
</p>
{{/if}}
<div class="indicator"><span></span></div>
{{/with}}
{{#if repo.lastBuildHash.number }}
<p class="summary">
<span class="duration_label">Duration:</span>
<abbr class="duration" {{bind-attr title="lastBuildStartedAt"}}>
{{format-duration repo.lastBuildDuration}}
</abbr>
</p>
<p class="summary">
<span class="finished-icon"></span><span class="finished_at_label">Finished:</span>
<abbr class="finished_at timeago" {{bind-attr title="lastBuildFinishedAt"}}>
{{format-time repo.lastBuildFinishedAt}}
</abbr>
</p>
{{/if}}
<div class="indicator"><span></span></div>
{{/with}}
{{else}}
<p class="empty">{{noReposMessage}}</p>
{{/collection}}
{{else}}
<p class="empty">{{noReposMessage}}</p>
{{/collection}}
{{else}}
<span class="sync-spinner sync-spinner--grey"><i></i><i></i><i></i></span>
{{/if}}
</div>
<span class="sync-spinner sync-spinner--grey"><i></i><i></i><i></i></span>
{{/if}}
</div>
{{/if}}

View File

@ -1,6 +1,6 @@
<ul class="tabs">
<li id="tab_owned" {{bind-attr class="view.classOwned"}}>
<h5>{{#link-to "main.repositories"}}My Repositories{{/link-to}}</h5>
<h5><a href="#" {{action "showMyRepositories"}}>My Repositories</a></h5>
</li>
{{#unless config.pro}}
@ -9,10 +9,11 @@
</li>
{{/unless}}
<li id="tab_search" {{bind-attr class="view.classSearch"}}>
<h5>Search</h5>
<li id="tab_running" {{bind-attr class="view.classRunning"}}>
<h5><a href="#" {{action "showRunningJobs"}}>Run</a></h5>
</li>
<li id="tab_new" {{bind-attr class="view.classNew"}}>
<h5>{{#link-to "profile" trackEvent="add-repository-from-list" title="Add New Repository"}}+{{/link-to}}</h5>
</li>

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'