From e05ae6e3ebeb29912beaa57bd7f7df5679696dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez?= Date: Fri, 7 Mar 2014 10:05:06 +0000 Subject: [PATCH] fixed user services states strings --- server/src/uds/REST/methods/user_services.py | 4 +- .../uds/static/adm/js/gui-d-servicespools.js | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/server/src/uds/REST/methods/user_services.py b/server/src/uds/REST/methods/user_services.py index 52beadf8..30014246 100644 --- a/server/src/uds/REST/methods/user_services.py +++ b/server/src/uds/REST/methods/user_services.py @@ -94,7 +94,7 @@ class AssignedService(DetailHandler): {'revision': {'title': _('Revision')}}, {'unique_id': {'title': 'Unique ID'}}, {'friendly_name': {'title': _('Friendly name')}}, - {'state': {'title': _('State'), 'type': 'dict', 'dict': State.dictionary()}}, + {'state': {'title': _('State')}}, {'owner': {'title': _('Owner')}}, ] @@ -147,7 +147,7 @@ class CachedService(AssignedService): {'revision': {'title': _('Revision')}}, {'unique_id': {'title': 'Unique ID'}}, {'friendly_name': {'title': _('Friendly name')}}, - {'state': {'title': _('State'), 'type': 'dict', 'dict': State.dictionary()}}, + {'state': {'title': _('State')}}, {'cache_level': {'title': _('Cache level')}}, ] diff --git a/server/src/uds/static/adm/js/gui-d-servicespools.js b/server/src/uds/static/adm/js/gui-d-servicespools.js index e974d1fe..791e33fb 100644 --- a/server/src/uds/static/adm/js/gui-d-servicespools.js +++ b/server/src/uds/static/adm/js/gui-d-servicespools.js @@ -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 api.providers.allServices(function(services){ @@ -156,6 +190,9 @@ gui.servicesPools.link = function(event) { container : 'cache-placeholder_tbl', buttons : [ 'delete', 'xls' ], rowSelect : 'single', + onData: function(data) { + fillState(data); + }, onRowSelect : function(selected) { var cached = selected[0]; if( prevCacheLogTbl ) {