mirror of https://github.com/rancher/ui.git
Centralize state icons and colors (rancher/rancher#1487)
This commit is contained in:
parent
98e0a63b9a
commit
d321ae4b80
|
|
@ -9,14 +9,6 @@ var ApiKey = Resource.extend({
|
|||
ApiKey.reopenClass({
|
||||
pollTransitioningDelay: 1000,
|
||||
pollTransitioningInterval: 5000,
|
||||
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'requested': {icon: 'ss-tag', color: 'text-info'},
|
||||
}
|
||||
});
|
||||
|
||||
export default ApiKey;
|
||||
|
|
|
|||
|
|
@ -75,15 +75,6 @@ Container.reopenClass({
|
|||
|
||||
return data;
|
||||
},
|
||||
|
||||
stateMap: {
|
||||
'running': {icon: 'ss-record', color: 'text-success'},
|
||||
'stopped': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'unhealthy': {icon: 'ss-notifications', color: 'text-danger'},
|
||||
'initializing': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
},
|
||||
});
|
||||
|
||||
export default Container;
|
||||
|
|
|
|||
|
|
@ -55,17 +55,8 @@ var DnsServiceController = Cattle.LegacyTransitioningResourceController.extend({
|
|||
|
||||
DnsServiceController.reopenClass({
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'registering': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-compass', color: 'text-success'},
|
||||
'updating-active': {icon: 'ss-tag', color: 'text-success'},
|
||||
'updating-inactive':{icon: 'ss-tag', color: 'text-danger'},
|
||||
'deactivating': {icon: 'ss-down', color: 'text-danger'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'degraded': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -93,12 +93,7 @@ var Environment = Resource.extend({
|
|||
|
||||
Environment.reopenClass({
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-globe', color: 'text-success'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'degraded': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -55,17 +55,7 @@ var ExternalServiceController = Cattle.LegacyTransitioningResourceController.ext
|
|||
|
||||
ExternalServiceController.reopenClass({
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'registering': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-cloud', color: 'text-success'},
|
||||
'updating-active': {icon: 'ss-tag', color: 'text-success'},
|
||||
'updating-inactive':{icon: 'ss-tag', color: 'text-danger'},
|
||||
'deactivating': {icon: 'ss-down', color: 'text-danger'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'degraded': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -126,20 +126,7 @@ Host.reopenClass({
|
|||
},
|
||||
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'registering': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-database', color: 'text-success'},
|
||||
'reconnecting': {icon: 'fa fa-circle-o-notch fa-spin', color: 'text-danger'},
|
||||
'updating-active': {icon: 'ss-database', color: 'text-success'},
|
||||
'updating-inactive':{icon: 'ss-alert', color: 'text-danger'},
|
||||
'deactivating': {icon: 'ss-down', color: 'text-danger'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'purging': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'restoring': {icon: 'ss-medicalcross', color: 'text-danger'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -36,15 +36,7 @@ var LoadBalancerController = Cattle.LegacyTransitioningResourceController.extend
|
|||
|
||||
LoadBalancerController.reopenClass({
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-fork', color: 'text-success'},
|
||||
'updating-active': {icon: 'ss-fork', color: 'text-success'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'purging': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'restoring': {icon: 'ss-medicalcross', color: 'text-danger'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -45,14 +45,7 @@ var LoadBalancerServiceController = Cattle.LegacyTransitioningResourceController
|
|||
|
||||
LoadBalancerServiceController.reopenClass({
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'registering': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-fork', color: 'text-success'},
|
||||
'deactivating': {icon: 'ss-down', color: 'text-danger'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -52,14 +52,8 @@ Machine.reopenClass({
|
|||
},
|
||||
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-success'},
|
||||
'creating': {icon: 'ss-tag', color: 'text-success'},
|
||||
'created': {icon: 'ss-tag', color: 'text-success'},
|
||||
'bootstrapping': {icon: 'ss-tag', color: 'text-success'},
|
||||
'active': {icon: 'ss-tag', color: 'text-success'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'updating': {icon: 'ss-tag', color: 'text-success'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,32 @@ import Util from 'ui/utils/util';
|
|||
import Resource from 'ember-api-store/models/resource';
|
||||
import { normalizeType } from 'ember-api-store/utils/normalize';
|
||||
|
||||
const defaultStateMap = {
|
||||
'activating': {icon: 'ss-tag', color: 'text-info' },
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'created': {icon: 'ss-tag', color: 'text-info' },
|
||||
'creating': {icon: 'ss-tag', color: 'text-info' },
|
||||
'deactivating': {icon: 'fa fa-adjust', color: 'text-info' },
|
||||
'degraded': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger' },
|
||||
'initializing': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger' },
|
||||
'purging': {icon: 'ss-tornado', color: 'text-info' },
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger' },
|
||||
'removing': {icon: 'ss-trash', color: 'text-info' },
|
||||
'requested': {icon: 'ss-tag', color: 'text-info' },
|
||||
'registering': {icon: 'ss-tag', color: 'text-info' },
|
||||
'restoring': {icon: 'ss-medicalcross', color: 'text-info' },
|
||||
'running': {icon: 'ss-record', color: 'text-success'},
|
||||
'starting': {icon: 'fa fa-adjust', color: 'text-info' },
|
||||
'stopped': {icon: 'fa fa-circle', color: 'text-danger' },
|
||||
'stopping': {icon: 'fa fa-adjust', color: 'text-info' },
|
||||
'unhealthy': {icon: 'ss-notifications', color: 'text-danger' },
|
||||
'updating': {icon: 'ss-tag', color: 'text-info' },
|
||||
'updating-active': {icon: 'ss-tag', color: 'text-info' },
|
||||
'updating-inactive':{icon: 'ss-tag', color: 'text-info' },
|
||||
};
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
endpoint: Ember.inject.service(),
|
||||
|
||||
|
|
@ -60,6 +86,11 @@ export default Ember.Mixin.create({
|
|||
}
|
||||
}
|
||||
|
||||
if ( defaultStateMap[key] && defaultStateMap[key].icon )
|
||||
{
|
||||
return defaultStateMap[key].icon;
|
||||
}
|
||||
|
||||
return this.constructor.defaultStateIcon;
|
||||
}
|
||||
}.property('state','transitioning'),
|
||||
|
|
@ -79,6 +110,11 @@ export default Ember.Mixin.create({
|
|||
}
|
||||
}
|
||||
|
||||
if ( defaultStateMap[key] && defaultStateMap[key].color )
|
||||
{
|
||||
return defaultStateMap[key].color;
|
||||
}
|
||||
|
||||
return this.constructor.defaultStateColor;
|
||||
}.property('state','transitioning'),
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,4 @@ var Mount = Resource.extend({
|
|||
}.property('instanceId'),
|
||||
});
|
||||
|
||||
Mount.reopenClass({
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle',color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'}
|
||||
},
|
||||
});
|
||||
|
||||
export default Mount;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ var NetworkController = Cattle.LegacyTransitioningResourceController.extend();
|
|||
NetworkController.reopenClass({
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-headphones', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'requested': {icon: 'ss-tag', color: 'text-info'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,4 @@ var Port = Resource.extend({
|
|||
}.property('_publicIpState','_publicIp','publicIpAddressId'),
|
||||
});
|
||||
|
||||
Port.reopenClass({
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle',color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'}
|
||||
},
|
||||
});
|
||||
|
||||
export default Port;
|
||||
|
|
|
|||
|
|
@ -56,22 +56,6 @@ Project.reopenClass({
|
|||
headers: {
|
||||
[C.HEADER.PROJECT]: undefined, // Requests for projects use the user's scope, not the project
|
||||
},
|
||||
|
||||
stateMap: {
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'deactivating': {icon: 'fa fa-adjust', color: 'text-danger'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'purging': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'registering': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'requested': {icon: 'ss-ticket', color: 'text-danger'},
|
||||
'restoring': {icon: 'ss-medicalcross', color: 'text-danger'},
|
||||
'updating-active': {icon: 'ss-record', color: 'text-success'},
|
||||
'updating-inactive':{icon: 'ss-alert', color: 'text-danger'},
|
||||
}
|
||||
});
|
||||
|
||||
export default Project;
|
||||
|
|
|
|||
|
|
@ -35,14 +35,6 @@ var Registry = Resource.extend({
|
|||
|
||||
Registry.reopenClass({
|
||||
alwaysInclude: ['credentials'],
|
||||
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'requested': {icon: 'ss-tag', color: 'text-info'},
|
||||
}
|
||||
});
|
||||
|
||||
export default Registry;
|
||||
|
|
|
|||
|
|
@ -44,14 +44,4 @@ var RegistryController = Cattle.LegacyTransitioningResourceController.extend({
|
|||
}.property('actions.{update,activate,deactivate,restore,remove,purge}'),
|
||||
});
|
||||
|
||||
RegistryController.reopenClass({
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'requested': {icon: 'ss-tag', color: 'text-info'},
|
||||
}
|
||||
});
|
||||
|
||||
export default RegistryController;
|
||||
|
|
|
|||
|
|
@ -189,17 +189,7 @@ Service.reopenClass({
|
|||
},
|
||||
|
||||
stateMap: {
|
||||
'requested': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'registering': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'activating': {icon: 'ss-tag', color: 'text-danger'},
|
||||
'active': {icon: activeIcon, color: 'text-success'},
|
||||
'updating-active': {icon: 'ss-tag', color: 'text-success'},
|
||||
'updating-inactive':{icon: 'ss-tag', color: 'text-danger'},
|
||||
'deactivating': {icon: 'ss-down', color: 'text-danger'},
|
||||
'inactive': {icon: 'fa fa-circle', color: 'text-danger'},
|
||||
'removing': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'degraded': {icon: 'ss-notifications', color: 'text-warning'},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,6 @@ var Volume = Resource.extend({
|
|||
|
||||
Volume.reopenClass({
|
||||
alwaysInclude: ['mounts'],
|
||||
|
||||
stateMap: {
|
||||
'active': {icon: 'ss-record', color: 'text-success'},
|
||||
'inactive': {icon: 'fa fa-circle',color: 'text-danger'},
|
||||
'removed': {icon: 'ss-trash', color: 'text-danger'},
|
||||
'purged': {icon: 'ss-tornado', color: 'text-danger'}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
export default Volume;
|
||||
|
|
|
|||
Loading…
Reference in New Issue