1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00
OpenSTF/res/app/components/stf/device/state-classes-service.js
2016-11-23 06:45:36 +05:30

41 lines
1.2 KiB
JavaScript

module.exports = function StateClassesService() {
var service = {}
service.stateButton = function(state) {
var stateClasses = {
using: 'state-using btn-primary',
busy: 'state-busy btn-warning',
available: 'state-available btn-primary-outline',
ready: 'state-ready btn-primary-outline',
present: 'state-present btn-primary-outline',
preparing: 'state-preparing btn-primary-outline btn-success-outline',
unauthorized: 'state-unauthorized btn-danger-outline',
offline: 'state-offline btn-warning-outline',
automation: 'state-automation btn-info'
}[state]
if (typeof stateClasses === 'undefined') {
stateClasses = 'btn-default-outline'
}
return stateClasses
}
service.stateColor = function(state) {
var stateClasses = {
using: 'state-using',
busy: 'state-busy',
available: 'state-available',
ready: 'state-ready',
present: 'state-present',
preparing: 'state-preparing',
unauthorized: 'state-unauthorized',
offline: 'state-offline',
automation: 'state-automation'
}[state]
if (typeof stateClasses === 'undefined') {
stateClasses = ''
}
return stateClasses
}
return service
}