ui: task: improve rendering of backup/prune worker entries

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-26 13:37:57 +02:00
parent a6fbbd03c8
commit 06c3dc8a8e

View File

@ -25,13 +25,27 @@ Ext.define('PBS.Utils', {
return path.indexOf(PBS.Utils.dataStorePrefix) === 0; return path.indexOf(PBS.Utils.dataStorePrefix) === 0;
}, },
render_datastore_worker_id: function(id, what) {
const result = id.match(/^(\S+)_([^_\s]+)_([^_\s]+)$/);
if (result) {
let datastore = result[1], type = result[2], id = result[3];
return `Datastore ${datastore} - ${what} ${type}/${id}`;
}
return what;
},
constructor: function() { constructor: function() {
var me = this; var me = this;
// do whatever you want here // do whatever you want here
Proxmox.Utils.override_task_descriptions({ Proxmox.Utils.override_task_descriptions({
garbage_collection: ['Datastore', gettext('Garbage collect') ], garbage_collection: ['Datastore', gettext('Garbage collect') ],
backup: [ '', gettext('Backup') ], prune: (type, id) => {
return PBS.Utils.render_datastore_worker_id(id, gettext('Prune'));
},
backup: (type, id) => {
return PBS.Utils.render_datastore_worker_id(id, gettext('Backup'));
},
reader: [ '', gettext('Read datastore objects') ], // FIXME: better one reader: [ '', gettext('Read datastore objects') ], // FIXME: better one
}); });
} }