fix #5836: ui: translate systemd states in ServiceView

Signed-off-by: Timothy Nicholson <t.nicholson@proxmox.com>
This commit is contained in:
Timothy Nicholson 2024-11-11 14:17:15 +01:00 committed by Thomas Lamprecht
parent a351d3d36d
commit 4ca542b811
2 changed files with 18 additions and 8 deletions

View File

@ -305,6 +305,18 @@ utilities: {
return Ext.htmlEncode(username);
},
systemdStates: {
'enabled': gettext('enabled'),
'disabled': gettext('disabled'),
'running': gettext('running'),
'dead': gettext('dead'),
'not-found': gettext('not installed'),
'static': gettext('static'),
'reload': gettext('reload'),
'start': gettext('starting'),
'stop': gettext('stopping'),
},
getStoredAuth: function() {
let storedAuth = JSON.parse(window.localStorage.getItem('ProxmoxUser'));
return storedAuth || {};

View File

@ -202,14 +202,8 @@ Ext.define('Proxmox.node.ServiceView', {
sortable: true,
dataIndex: 'state',
renderer: (value, meta, rec) => {
const unitState = rec.get('unit-state');
if (unitState === 'masked') {
return gettext('disabled');
} else if (unitState === 'not-found') {
return gettext('not installed');
} else {
return value;
}
const state = rec.get('state');
return Proxmox.Utils.systemdStates[state] ?? state;
},
},
{
@ -225,6 +219,10 @@ Ext.define('Proxmox.node.ServiceView', {
sortable: true,
hidden: !Ext.Array.contains(['PVEAuthCookie', 'PBSAuthCookie'], Proxmox?.Setup?.auth_cookie_name),
dataIndex: 'unit-state',
renderer: (value, meta, rec) => {
const unitState = rec.get('unit-state');
return Proxmox.Utils.systemdStates[unitState] ?? unitState;
},
},
{
header: gettext('Description'),