ui: content: code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-12 09:19:08 +02:00
parent 7e8b24bd8c
commit fbca018229

View File

@ -731,8 +731,10 @@ Ext.define('PBS.DataStoreContent', {
let atag = document.createElement('a'); let atag = document.createElement('a');
params['file-name'] = file; params['file-name'] = file;
atag.download = filename; atag.download = filename;
let url = new URL(`/api2/json/admin/datastore/${view.datastore}/download-decoded`, let url = new URL(
window.location.origin); `/api2/json/admin/datastore/${view.datastore}/download-decoded`,
window.location.origin,
);
for (const [key, value] of Object.entries(params)) { for (const [key, value] of Object.entries(params)) {
url.searchParams.append(key, value); url.searchParams.append(key, value);
} }
@ -740,7 +742,8 @@ Ext.define('PBS.DataStoreContent', {
atag.click(); atag.click();
}, },
openPxarBrowser: function(tv, rI, Ci, item, e, rec) { // opens either a namespace or a pxar file-browser
openBrowser: function(tv, rI, Ci, item, e, rec) {
let me = this; let me = this;
let view = me.getView(); let view = me.getView();
@ -969,7 +972,7 @@ Ext.define('PBS.DataStoreContent', {
isActionDisabled: (v, r, c, i, rec) => rec.data.ty !== 'file' || rec.data['crypt-mode'] > 2, isActionDisabled: (v, r, c, i, rec) => rec.data.ty !== 'file' || rec.data['crypt-mode'] > 2,
}, },
{ {
handler: 'openPxarBrowser', handler: 'openBrowser',
tooltip: gettext('Browse'), tooltip: gettext('Browse'),
getClass: (v, m, { data }) => { getClass: (v, m, { data }) => {
if ( if (
@ -1130,13 +1133,12 @@ Ext.define('PBS.DataStoreContent', {
}, },
listeners: { listeners: {
dblclick: function(view, el, row, col, ev, rec) { dblclick: function(view, el, row, col, ev, rec) {
let data = rec.data || {}; let verify = rec?.data?.verification;
let verify = data.verification; if (verify?.upid && rec.parentNode?.id !== 'root') {
if (verify && verify.upid && rec.parentNode.id !== 'root') { Ext.create('Proxmox.window.TaskViewer', {
let win = Ext.create('Proxmox.window.TaskViewer', { autoShow: true,
upid: verify.upid, upid: verify.upid,
}); });
win.show();
} }
}, },
}, },