fixed user services states strings

This commit is contained in:
Adolfo Gómez 2014-03-07 10:05:06 +00:00
parent 1189554a20
commit e05ae6e3eb
2 changed files with 39 additions and 2 deletions

View File

@ -94,7 +94,7 @@ class AssignedService(DetailHandler):
{'revision': {'title': _('Revision')}}, {'revision': {'title': _('Revision')}},
{'unique_id': {'title': 'Unique ID'}}, {'unique_id': {'title': 'Unique ID'}},
{'friendly_name': {'title': _('Friendly name')}}, {'friendly_name': {'title': _('Friendly name')}},
{'state': {'title': _('State'), 'type': 'dict', 'dict': State.dictionary()}}, {'state': {'title': _('State')}},
{'owner': {'title': _('Owner')}}, {'owner': {'title': _('Owner')}},
] ]
@ -147,7 +147,7 @@ class CachedService(AssignedService):
{'revision': {'title': _('Revision')}}, {'revision': {'title': _('Revision')}},
{'unique_id': {'title': 'Unique ID'}}, {'unique_id': {'title': 'Unique ID'}},
{'friendly_name': {'title': _('Friendly name')}}, {'friendly_name': {'title': _('Friendly name')}},
{'state': {'title': _('State'), 'type': 'dict', 'dict': State.dictionary()}}, {'state': {'title': _('State')}},
{'cache_level': {'title': _('Cache level')}}, {'cache_level': {'title': _('Cache level')}},
] ]

View File

@ -75,6 +75,40 @@ gui.servicesPools.link = function(event) {
} }
}); });
}; };
// Fill "State" for cached and assigned services
var fillState = function(data) {
$.each(data, function(index, value){
if(value.state == 'U') {
if( value.os_state != '' && value.os_state != 'U')
value.state = gettext('Waiting OS');
else
value.state = gettext('Ready');
return;
}
if(value.state == 'R'){
value.state = gettext('Waiting for removal');
return;
}
if(value.state == 'M'){
value.state = gettext('Removing');
return;
}
if(value.state == 'S'){
value.state = gettext('Removed');
return;
}
if(value.state == 'E'){
value.state = gettext('Error');
return;
}
if(value.state == 'P'){
value.state = gettext('Generating');
return;
}
value.state = gettext('Unknown');
});
};
// Fills up the list of available services // Fills up the list of available services
api.providers.allServices(function(services){ api.providers.allServices(function(services){
@ -156,6 +190,9 @@ gui.servicesPools.link = function(event) {
container : 'cache-placeholder_tbl', container : 'cache-placeholder_tbl',
buttons : [ 'delete', 'xls' ], buttons : [ 'delete', 'xls' ],
rowSelect : 'single', rowSelect : 'single',
onData: function(data) {
fillState(data);
},
onRowSelect : function(selected) { onRowSelect : function(selected) {
var cached = selected[0]; var cached = selected[0];
if( prevCacheLogTbl ) { if( prevCacheLogTbl ) {