ui: tape: refactor renderDriveState to Utils

we will use this later again

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-03-02 12:19:37 +01:00 committed by Dietmar Maurer
parent 8bf5769382
commit 9d5b426a6d
2 changed files with 17 additions and 17 deletions

View File

@ -603,6 +603,22 @@ Ext.define('PBS.Utils', {
}).show(); }).show();
}, },
renderDriveState: function(value, md) {
if (!value) {
return gettext('Idle');
}
let icon = '<i class="fa fa-spinner fa-pulse fa-fw"></i>';
if (value.startsWith("UPID")) {
let upid = Proxmox.Utils.parse_task_upid(value);
md.tdCls = "pointer";
return `${icon} ${upid.desc}`;
}
return `${icon} ${value}`;
},
}); });
Ext.define('PBS.Async', { Ext.define('PBS.Async', {

View File

@ -469,22 +469,6 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
return status; return status;
}, },
renderState: function(value, md, record) {
if (!value) {
return gettext('Idle');
}
let icon = '<i class="fa fa-spinner fa-pulse fa-fw"></i>';
if (value.startsWith("UPID")) {
let upid = Proxmox.Utils.parse_task_upid(value);
md.tdCls = "pointer";
return `${icon} ${upid.desc}`;
}
return `${icon} ${value}`;
},
control: { control: {
'grid[reference=drives]': { 'grid[reference=drives]': {
cellclick: function(table, td, ci, rec, tr, ri, e) { cellclick: function(table, td, ci, rec, tr, ri, e) {
@ -689,7 +673,7 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
text: gettext('State'), text: gettext('State'),
dataIndex: 'state', dataIndex: 'state',
flex: 3, flex: 3,
renderer: 'renderState', renderer: PBS.Utils.renderDriveState,
}, },
{ {
text: gettext("Vendor"), text: gettext("Vendor"),