handle localized status

This commit is contained in:
ziirish 2018-01-09 16:07:30 +01:00
parent 328afb8c56
commit d298af8efa
No known key found for this signature in database
GPG key ID: 72DB229A64B54E46
3 changed files with 5 additions and 3 deletions

View file

@ -986,7 +986,7 @@ class ClientRunningStatus(Resource):
)
parser.add_argument('clientName', help='Client name')
running_fields = ns.model('ClientRunningStatus', {
'state': fields.String(required=True, description='Running state'),
'state': fields.LocalizedString(required=True, description='Running state'),
'percent': fields.Integer(
required=False,
description='Backup progress in percent',

View file

@ -195,7 +195,7 @@ var refresh_status = function( is_running ) {
var _content = '<span class="'+__icons[status.state]+'" aria-hidden="true"></span> ';
if (status.state == 'running') {
_client_running = true;
_content += __translate[status.state]+' - '+status.phase;
_content += status.state+' - '+status.phase;
if (status.percent > 0) {
_content += ' ('+status.percent+'%)';
}

View file

@ -18,6 +18,8 @@ var __translate = {
"server crashed": "{{ _('server crashed') }}",
"running": "{{ _('running') }}",
"idle": "{{ _('idle') }}",
"never": "{{ _('never') }}",
"now": "{{ _('now') }}",
};
/***
@ -95,7 +97,7 @@ var _clients_table = $('#table-clients').DataTable( {
render: function ( data, type, row ) {
var result = data.state;
if (data.state == "{{ _('running') }}" && data.static) {
result = __translate[data.state]+' - '+data.phase;
result = data.state+' - '+data.phase;
if (data.percent > 0) {
result += ' ('+data.percent+'%)';
}