Show appropriate message when the repository has no builds
This commit is contained in:
parent
8fab8448c2
commit
63559f4c4c
|
@ -8,8 +8,8 @@ Travis.BuildController = Ember.Controller.extend
|
|||
currentItemBinding: 'build'
|
||||
|
||||
loading: (->
|
||||
!@get('build.isLoaded')
|
||||
).property('build.isLoaded')
|
||||
@get('build.isLoading')
|
||||
).property('build.isLoading')
|
||||
|
||||
urlGithubCommit: (->
|
||||
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))
|
||||
|
|
|
@ -3,9 +3,9 @@ Travis.RepoController = Travis.Controller.extend
|
|||
needs: ['repos', 'currentUser']
|
||||
currentUserBinding: 'controllers.currentUser'
|
||||
|
||||
isError: (-> @get('content.isError') ).property('content.isError')
|
||||
slug: (-> @get('content.slug') ).property('content.slug')
|
||||
isLoading: (-> @get('content.isLoading') ).property('content.isLoading')
|
||||
isError: (-> @get('repo.isError') ).property('repo.isError')
|
||||
slug: (-> @get('repo.slug') ).property('repo.slug')
|
||||
isLoading: (-> @get('repo.isLoading') ).property('repo.isLoading')
|
||||
|
||||
init: ->
|
||||
@_super.apply this, arguments
|
||||
|
|
|
@ -20,7 +20,7 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
Travis.LimitedArray.create
|
||||
content: Em.ArrayProxy.extend(Em.SortableMixin).create(
|
||||
sortProperties: ['sortOrder']
|
||||
content: Travis.Repo.find()
|
||||
content: Travis.Repo.withLastBuild()
|
||||
isLoadedBinding: 'content.isLoaded'
|
||||
)
|
||||
limit: 30
|
||||
|
|
|
@ -116,6 +116,9 @@ require 'travis/model'
|
|||
search: (query) ->
|
||||
@find(search: query, orderBy: 'name')
|
||||
|
||||
withLastBuild: ->
|
||||
@filter( (repo) -> repo.get('lastBuildId') )
|
||||
|
||||
bySlug: (slug) ->
|
||||
repo = $.select(@find().toArray(), (repo) -> repo.get('slug') == slug)
|
||||
if repo.length > 0 then repo else @find(slug: slug)
|
||||
|
|
|
@ -1,57 +1,61 @@
|
|||
{{#if loading}}
|
||||
<span>Loading</span>
|
||||
{{else}}
|
||||
<dl id="summary">
|
||||
<div class="left">
|
||||
<dt>{{t builds.name}}</dt>
|
||||
<dd class="number">
|
||||
<span class="status"></span>
|
||||
{{#if build.id}}
|
||||
{{#if build.repo.slug}}
|
||||
{{#linkTo build repo build}}{{build.number}}{{/linkTo}}
|
||||
{{#if build}}
|
||||
<dl id="summary">
|
||||
<div class="left">
|
||||
<dt>{{t builds.name}}</dt>
|
||||
<dd class="number">
|
||||
<span class="status"></span>
|
||||
{{#if build.id}}
|
||||
{{#if build.repo.slug}}
|
||||
{{#linkTo build repo build}}{{build.number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</dd>
|
||||
<dt>{{t builds.state}}</dt>
|
||||
<dd class="state">{{capitalize build.state}}</dd>
|
||||
<dt class="finished_at_label">{{t builds.finished_at}}</dt>
|
||||
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime build.finishedAt}}</dd>
|
||||
<dt>{{t builds.duration}}</dt>
|
||||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration build.duration}}</dd>
|
||||
</div>
|
||||
|
||||
{{#if commit}}
|
||||
<div class="right">
|
||||
<dt>{{t builds.commit}}</dt>
|
||||
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit build.commit}}</a></dd>
|
||||
{{#if commit.compareUrl}}
|
||||
<dt>{{t builds.compare}}</dt>
|
||||
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom build.commit.compareUrl}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t builds.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{build.commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t builds.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{build.commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</dd>
|
||||
<dt>{{t builds.state}}</dt>
|
||||
<dd class="state">{{capitalize build.state}}</dd>
|
||||
<dt class="finished_at_label">{{t builds.finished_at}}</dt>
|
||||
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime build.finishedAt}}</dd>
|
||||
<dt>{{t builds.duration}}</dt>
|
||||
<dd class="duration" {{bindAttr title="startedAt"}}>{{formatDuration build.duration}}</dd>
|
||||
</div>
|
||||
|
||||
{{#if commit}}
|
||||
<div class="right">
|
||||
<dt>{{t builds.commit}}</dt>
|
||||
<dd class="commit"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit build.commit}}</a></dd>
|
||||
{{#if commit.compareUrl}}
|
||||
<dt>{{t builds.compare}}</dt>
|
||||
<dd class="compare"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom build.commit.compareUrl}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.authorName}}
|
||||
<dt>{{t builds.author}}</dt>
|
||||
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{build.commit.authorName}}</a></dd>
|
||||
{{/if}}
|
||||
{{#if commit.committerName}}
|
||||
<dt>{{t builds.committer}}</dt>
|
||||
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{build.commit.committerName}}</a></dd>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<dt>{{t builds.message}}</dt>
|
||||
<dd class="message">{{formatMessage build.commit.message}}</dd>
|
||||
|
||||
{{#unless isMatrix}}
|
||||
<dt>{{t builds.config}}</dt>
|
||||
<dd class="config">{{formatConfig build.config}}</dd>
|
||||
{{/unless}}
|
||||
</dl>
|
||||
|
||||
{{#if build.isMatrix}}
|
||||
{{view Travis.JobsView jobsBinding="build.requiredJobs" required="true"}}
|
||||
{{view Travis.JobsView jobsBinding="build.allowedFailureJobs"}}
|
||||
{{else}}
|
||||
{{view Travis.LogView jobBinding="job"}}
|
||||
{{/if}}
|
||||
|
||||
<dt>{{t builds.message}}</dt>
|
||||
<dd class="message">{{formatMessage build.commit.message}}</dd>
|
||||
|
||||
{{#unless isMatrix}}
|
||||
<dt>{{t builds.config}}</dt>
|
||||
<dd class="config">{{formatConfig build.config}}</dd>
|
||||
{{/unless}}
|
||||
</dl>
|
||||
|
||||
{{#if build.isMatrix}}
|
||||
{{view Travis.JobsView jobsBinding="build.requiredJobs" required="true"}}
|
||||
{{view Travis.JobsView jobsBinding="build.allowedFailureJobs"}}
|
||||
{{else}}
|
||||
{{view Travis.LogView jobBinding="job"}}
|
||||
There are no builds for this repository.
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -2,7 +2,6 @@ Travis.reopen
|
|||
RepoView: Travis.View.extend
|
||||
templateName: 'repos/show'
|
||||
|
||||
repoBinding: 'controllers.repo'
|
||||
reposBinding: 'controllers.repos'
|
||||
|
||||
classNameBindings: ['controller.isLoading:loading']
|
||||
|
|
Loading…
Reference in New Issue
Block a user