use states instead of result
This commit is contained in:
parent
f6975e5b02
commit
395918a406
|
@ -9,6 +9,9 @@ Handlebars.registerHelper 'tipsy', (text, tip) ->
|
||||||
Handlebars.registerHelper 't', (key) ->
|
Handlebars.registerHelper 't', (key) ->
|
||||||
safe I18n.t(key)
|
safe I18n.t(key)
|
||||||
|
|
||||||
|
Ember.registerBoundHelper 'capitalize', (value, options) ->
|
||||||
|
safe $.capitalize(value)
|
||||||
|
|
||||||
Ember.registerBoundHelper 'formatTime', (value, options) ->
|
Ember.registerBoundHelper 'formatTime', (value, options) ->
|
||||||
safe Travis.Helpers.timeAgoInWords(value) || '-'
|
safe Travis.Helpers.timeAgoInWords(value) || '-'
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,13 @@ require 'travis/log'
|
||||||
require 'config/emoij'
|
require 'config/emoij'
|
||||||
|
|
||||||
@Travis.Helpers =
|
@Travis.Helpers =
|
||||||
|
COLORS:
|
||||||
|
default: 'yellow'
|
||||||
|
passed: 'green'
|
||||||
|
failed: 'red'
|
||||||
|
errored: 'gray'
|
||||||
|
canceled: 'gray'
|
||||||
|
|
||||||
compact: (object) ->
|
compact: (object) ->
|
||||||
result = {}
|
result = {}
|
||||||
(result[key] = value unless $.isEmpty(value)) for key, value of object || {}
|
(result[key] = value unless $.isEmpty(value)) for key, value of object || {}
|
||||||
|
@ -10,8 +17,8 @@ require 'config/emoij'
|
||||||
safe: (string) ->
|
safe: (string) ->
|
||||||
new Handlebars.SafeString(string)
|
new Handlebars.SafeString(string)
|
||||||
|
|
||||||
colorForResult: (result) ->
|
colorForState: (state) ->
|
||||||
(if result is 0 then 'green' else (if result is 1 then 'red' else null))
|
Travis.Helpers.COLORS[state] || Travis.Helpers.COLORS['default']
|
||||||
|
|
||||||
formatCommit: (sha, branch) ->
|
formatCommit: (sha, branch) ->
|
||||||
Travis.Helpers.formatSha(sha) + if branch then " (#{branch})" else ''
|
Travis.Helpers.formatSha(sha) + if branch then " (#{branch})" else ''
|
||||||
|
|
|
@ -9,7 +9,6 @@ require 'travis/model'
|
||||||
number: DS.attr('number')
|
number: DS.attr('number')
|
||||||
branch: DS.attr('string')
|
branch: DS.attr('string')
|
||||||
message: DS.attr('string')
|
message: DS.attr('string')
|
||||||
result: DS.attr('number')
|
|
||||||
_duration: DS.attr('number', key: 'duration')
|
_duration: DS.attr('number', key: 'duration')
|
||||||
startedAt: DS.attr('string', key: 'started_at')
|
startedAt: DS.attr('string', key: 'started_at')
|
||||||
finishedAt: DS.attr('string', key: 'finished_at')
|
finishedAt: DS.attr('string', key: 'finished_at')
|
||||||
|
@ -61,7 +60,7 @@ require 'travis/model'
|
||||||
Travis.ajax.post '/requests', build_id: @get('id')
|
Travis.ajax.post '/requests', build_id: @get('id')
|
||||||
|
|
||||||
isAttributeLoaded: (key) ->
|
isAttributeLoaded: (key) ->
|
||||||
if ['_duration', 'finishedAt', 'result'].contains(key) && !@get('finished')
|
if ['_duration', 'finishedAt', 'state'].contains(key) && !@get('finished')
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@_super(key)
|
@_super(key)
|
||||||
|
|
|
@ -11,9 +11,9 @@ require 'travis/model'
|
||||||
@get('event')
|
@get('event')
|
||||||
).property('event')
|
).property('event')
|
||||||
|
|
||||||
result: (->
|
state: (->
|
||||||
@get('data.data.result')
|
@get('data.data.state')
|
||||||
).property('data.data.result')
|
).property('data.data.state')
|
||||||
|
|
||||||
message: (->
|
message: (->
|
||||||
@get('data.data.message')
|
@get('data.data.message')
|
||||||
|
|
|
@ -9,7 +9,6 @@ require 'travis/model'
|
||||||
queue: DS.attr('string')
|
queue: DS.attr('string')
|
||||||
state: DS.attr('string')
|
state: DS.attr('string')
|
||||||
number: DS.attr('string')
|
number: DS.attr('string')
|
||||||
result: DS.attr('number')
|
|
||||||
startedAt: DS.attr('string')
|
startedAt: DS.attr('string')
|
||||||
finishedAt: DS.attr('string')
|
finishedAt: DS.attr('string')
|
||||||
allowFailure: DS.attr('boolean', key: 'allow_failure')
|
allowFailure: DS.attr('boolean', key: 'allow_failure')
|
||||||
|
@ -83,7 +82,7 @@ require 'travis/model'
|
||||||
).observes('state')
|
).observes('state')
|
||||||
|
|
||||||
isAttributeLoaded: (key) ->
|
isAttributeLoaded: (key) ->
|
||||||
if ['finishedAt', 'result'].contains(key) && !@get('finished')
|
if ['finishedAt', 'state'].contains(key) && !@get('finished')
|
||||||
return true
|
return true
|
||||||
else if key == 'startedAt' && @get('state') == 'created'
|
else if key == 'startedAt' && @get('state') == 'created'
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -6,7 +6,7 @@ require 'travis/model'
|
||||||
description: DS.attr('string')
|
description: DS.attr('string')
|
||||||
lastBuildId: DS.attr('number')
|
lastBuildId: DS.attr('number')
|
||||||
lastBuildNumber: DS.attr('string')
|
lastBuildNumber: DS.attr('string')
|
||||||
lastBuildResult: DS.attr('number')
|
lastBuildState: DS.attr('string')
|
||||||
lastBuildStartedAt: DS.attr('string')
|
lastBuildStartedAt: DS.attr('string')
|
||||||
lastBuildFinishedAt: DS.attr('string')
|
lastBuildFinishedAt: DS.attr('string')
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
<a {{action showBuild repo this href=true}}>{{number}}</a>
|
<a {{action showBuild repo this href=true}}>{{number}}</a>
|
||||||
{{/with}}
|
{{/with}}
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt>{{t builds.state}}</dt>
|
||||||
|
<dd class="state">{{capitalize build.state}}</dd>
|
||||||
<dt class="finished_at_label">{{t builds.finished_at}}</dt>
|
<dt class="finished_at_label">{{t builds.finished_at}}</dt>
|
||||||
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime build.finishedAt}}</dd>
|
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime build.finishedAt}}</dd>
|
||||||
<dt>{{t builds.duration}}</dt>
|
<dt>{{t builds.duration}}</dt>
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
<td class="event">
|
<td class="event">
|
||||||
{{event.event_}}
|
{{event.event_}}
|
||||||
</td>
|
</td>
|
||||||
<td class="result">
|
<td class="state">
|
||||||
{{event.result}}
|
{{event.state}}
|
||||||
</td>
|
</td>
|
||||||
<td class="message">
|
<td class="message">
|
||||||
{{event.message}}
|
{{event.message}}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
<a {{action showJob repo job href=true}}>{{job.number}}</a>
|
<a {{action showJob repo job href=true}}>{{job.number}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt>{{t jobs.state}}</dt>
|
||||||
|
<dd class="state">{{capitalize job.state}}</dd>
|
||||||
<dt class="finished_at_label">{{t jobs.finished_at}}</dt>
|
<dt class="finished_at_label">{{t jobs.finished_at}}</dt>
|
||||||
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime job.finishedAt}}</dd>
|
<dd class="finished_at timeago" {{bindAttr title="finishedAt"}}>{{formatTime job.finishedAt}}</dd>
|
||||||
<dt>{{t jobs.duration}}</dt>
|
<dt>{{t jobs.duration}}</dt>
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
commitBinding: 'build.commit'
|
commitBinding: 'build.commit'
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForResult(@get('build.result'))
|
Travis.Helpers.colorForState(@get('build.state'))
|
||||||
).property('build.result')
|
).property('build.state')
|
||||||
|
|
||||||
urlBuild: (->
|
urlBuild: (->
|
||||||
Travis.Urls.build(@get('repo.slug'), @get('build.id'))
|
Travis.Urls.build(@get('repo.slug'), @get('build.id'))
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
).property('build.isLoaded')
|
).property('build.isLoaded')
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForResult(@get('build.result'))
|
Travis.Helpers.colorForState(@get('build.state'))
|
||||||
).property('build.result')
|
).property('build.state')
|
||||||
|
|
||||||
urlBuild: (->
|
urlBuild: (->
|
||||||
Travis.Urls.build(@get('repo.slug'), @get('build.id'))
|
Travis.Urls.build(@get('repo.slug'), @get('build.id'))
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
jobBinding: 'context'
|
jobBinding: 'context'
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForResult(@get('job.result'))
|
Travis.Helpers.colorForState(@get('job.state'))
|
||||||
).property('job.result')
|
).property('job.state')
|
||||||
|
|
||||||
urlJob: (->
|
urlJob: (->
|
||||||
Travis.Urls.job(@get('repo.slug'), @get('job.id'))
|
Travis.Urls.job(@get('repo.slug'), @get('job.id'))
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
currentItemBinding: 'job'
|
currentItemBinding: 'job'
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForResult(@get('job.result'))
|
Travis.Helpers.colorForState(@get('job.state'))
|
||||||
).property('job.result')
|
).property('job.state')
|
||||||
|
|
||||||
urlJob: (->
|
urlJob: (->
|
||||||
Travis.Urls.job(@get('repo.slug'), @get('job.id'))
|
Travis.Urls.job(@get('repo.slug'), @get('job.id'))
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
selectedBinding: 'repo.selected'
|
selectedBinding: 'repo.selected'
|
||||||
|
|
||||||
color: (->
|
color: (->
|
||||||
Travis.Helpers.colorForResult(@get('repo.lastBuildResult'))
|
Travis.Helpers.colorForState(@get('repo.lastBuildState'))
|
||||||
).property('repo.lastBuildResult')
|
).property('repo.lastBuildState')
|
||||||
|
|
||||||
urlRepo: (->
|
urlRepo: (->
|
||||||
Travis.Urls.repo(@get('repo.slug'))
|
Travis.Urls.repo(@get('repo.slug'))
|
||||||
|
|
|
@ -149,9 +149,6 @@
|
||||||
).property('hasPermissions')
|
).property('hasPermissions')
|
||||||
|
|
||||||
canCancelJob: (->
|
canCancelJob: (->
|
||||||
console.log @get('isJobTab')
|
|
||||||
console.log @get('job.canCancel')
|
|
||||||
console.log @get('hasPermission')
|
|
||||||
@get('isJobTab') && @get('job.canCancel') && @get('hasPermission')
|
@get('isJobTab') && @get('job.canCancel') && @get('hasPermission')
|
||||||
).property('job.state', 'hasPushPermissions', 'tab')
|
).property('job.state', 'hasPushPermissions', 'tab')
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,6 @@ $color-bg-tools-pane: $slate-blue-3
|
||||||
$color-bg-right: $slate-blue-3
|
$color-bg-right: $slate-blue-3
|
||||||
$color-bg-sidebar-box: $white
|
$color-bg-sidebar-box: $white
|
||||||
|
|
||||||
$color-bg-job: $yellow-light-2
|
|
||||||
$color-bg-job-highlight: $yellow-light-1
|
|
||||||
$color-bg-job-passed: $green-light-3
|
|
||||||
$color-bg-job-passed-highlight: $green-light-1
|
|
||||||
$color-bg-job-failed: $red-light-3
|
|
||||||
$color-bg-job-failed-highlight: $red-light-1
|
|
||||||
|
|
||||||
$color-border-normal: $gray-medium-3
|
$color-border-normal: $gray-medium-3
|
||||||
$color-border-light: $gray-light-1
|
$color-border-light: $gray-light-1
|
||||||
$color-border-log: $gray-light-1
|
$color-border-log: $gray-light-1
|
||||||
|
@ -94,11 +87,22 @@ $color-text-status-failed: $red
|
||||||
$color-bg-status-failed: $red-lighter
|
$color-bg-status-failed: $red-lighter
|
||||||
$color-text-status-pending: $color-link
|
$color-text-status-pending: $color-link
|
||||||
$color-bg-status-pending: $yellow-lighter
|
$color-bg-status-pending: $yellow-lighter
|
||||||
|
$color-text-status-gray: $color-link
|
||||||
|
$color-bg-status-gray: $gray-medium-2
|
||||||
|
|
||||||
$color-bg-status-waiting: $green-lighter
|
$color-bg-status-waiting: $green-lighter
|
||||||
$color-bg-status-errored: $red-lighter
|
$color-bg-status-errored: $red-lighter
|
||||||
$color-bg-status-stopped: $gray-medium-1
|
$color-bg-status-stopped: $gray-medium-1
|
||||||
|
|
||||||
|
$color-bg-job: $yellow-light-2
|
||||||
|
$color-bg-job-highlight: $yellow-light-1
|
||||||
|
$color-bg-job-passed: $green-light-3
|
||||||
|
$color-bg-job-passed-highlight: $green-light-1
|
||||||
|
$color-bg-job-failed: $red-light-3
|
||||||
|
$color-bg-job-failed-highlight: $red-light-1
|
||||||
|
$color-bg-job-gray: $gray-light-4
|
||||||
|
$color-bg-job-gray-highlight: $gray-light-3
|
||||||
|
|
||||||
$color-bg-list-info: $yellow-light-2
|
$color-bg-list-info: $yellow-light-2
|
||||||
$color-text-list-info: $slate-yellow-1
|
$color-text-list-info: $slate-yellow-1
|
||||||
$color-shadow-list-info: $slate-yellow-2
|
$color-shadow-list-info: $slate-yellow-2
|
||||||
|
|
|
@ -30,6 +30,14 @@
|
||||||
a
|
a
|
||||||
color: $color-text-status-failed
|
color: $color-text-status-failed
|
||||||
|
|
||||||
|
#repos .gray,
|
||||||
|
.gray #summary .number,
|
||||||
|
.list .gray .number
|
||||||
|
.status
|
||||||
|
background-color: $color-bg-status-gray
|
||||||
|
a
|
||||||
|
color: $color-text-status-gray
|
||||||
|
|
||||||
table.list
|
table.list
|
||||||
tbody
|
tbody
|
||||||
td
|
td
|
||||||
|
@ -54,6 +62,14 @@ table.list
|
||||||
.number a
|
.number a
|
||||||
color: $color-text-status-failed
|
color: $color-text-status-failed
|
||||||
|
|
||||||
|
.gray
|
||||||
|
td
|
||||||
|
background-color: $color-bg-job-gray
|
||||||
|
&:hover td
|
||||||
|
background-color: $color-bg-job-gray-highlight
|
||||||
|
.number a
|
||||||
|
color: $color-text-status-gray
|
||||||
|
|
||||||
#workers
|
#workers
|
||||||
.status
|
.status
|
||||||
background-color: $color-bg-status-waiting
|
background-color: $color-bg-status-waiting
|
||||||
|
|
Loading…
Reference in New Issue
Block a user