travis-web/app/components/status-icon.coffee
2016-01-05 12:56:26 +01:00

50 lines
1.0 KiB
CoffeeScript

`import Ember from 'ember'`
StatusIconComponent = Ember.Component.extend
tagName: 'span'
classNames: ['status-icon', 'icon']
classNameBindings: ['status']
attributeBindings: ['label:aria-label','label:title']
label: (->
"Job #{@get('status')}"
).property('status')
hasPassed: (->
@get('status') == 'passed' || @get('status') == 'accepted'
).property('status')
hasFailed: (->
@get('status') == 'failed' || @get('status') == 'rejected'
).property('status')
hasErrored: (->
@get('status') == 'errored'
).property('status')
wasCanceled: (->
@get('status') == 'canceled'
).property('status')
isRunning: (->
@get('status') == 'started' ||
@get('status') == 'queued' ||
@get('status') == 'booting' ||
@get('status') == 'received' ||
@get('status') == 'created'
).property('status')
isEmpty: (->
unless @get('status')
true
else
if @get('status') == ''
true
else
false
).property('status')
`export default StatusIconComponent`