ui: datastore content: eslint fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-09-02 09:15:53 +02:00
parent 423df9b1f4
commit c6e07769e9
1 changed files with 24 additions and 24 deletions

View File

@ -6,17 +6,16 @@ Ext.define('pbs-data-store-snapshots', {
{ {
name: 'backup-time', name: 'backup-time',
type: 'date', type: 'date',
dateFormat: 'timestamp' dateFormat: 'timestamp',
}, },
'files', 'files',
'owner', 'owner',
'verification', 'verification',
{ name: 'size', type: 'int', allowNull: true, }, { name: 'size', type: 'int', allowNull: true },
{ {
name: 'crypt-mode', name: 'crypt-mode',
type: 'boolean', type: 'boolean',
calculate: function(data) { calculate: function(data) {
let encrypted = 0;
let crypt = { let crypt = {
none: 0, none: 0,
mixed: 0, mixed: 0,
@ -24,7 +23,6 @@ Ext.define('pbs-data-store-snapshots', {
encrypt: 0, encrypt: 0,
count: 0, count: 0,
}; };
let signed = 0;
data.files.forEach(file => { data.files.forEach(file => {
if (file.filename === 'index.json.blob') return; // is never encrypted if (file.filename === 'index.json.blob') return; // is never encrypted
let mode = PBS.Utils.cryptmap.indexOf(file['crypt-mode']); let mode = PBS.Utils.cryptmap.indexOf(file['crypt-mode']);
@ -35,14 +33,14 @@ Ext.define('pbs-data-store-snapshots', {
}); });
return PBS.Utils.calculateCryptMode(crypt); return PBS.Utils.calculateCryptMode(crypt);
} },
}, },
{ {
name: 'matchesFilter', name: 'matchesFilter',
type: 'boolean', type: 'boolean',
defaultValue: true, defaultValue: true,
}, },
] ],
}); });
Ext.define('PBS.DataStoreContent', { Ext.define('PBS.DataStoreContent', {
@ -70,7 +68,7 @@ Ext.define('PBS.DataStoreContent', {
view.getStore().setSorters([ view.getStore().setSorters([
'backup-group', 'backup-group',
'text', 'text',
'backup-time' 'backup-time',
]); ]);
Proxmox.Utils.monStoreErrors(view, this.store); Proxmox.Utils.monStoreErrors(view, this.store);
this.reload(); // initial load this.reload(); // initial load
@ -88,7 +86,7 @@ Ext.define('PBS.DataStoreContent', {
this.store.setProxy({ this.store.setProxy({
type: 'proxmox', type: 'proxmox',
timeout: 300*1000, // 5 minutes, we should make that api call faster timeout: 300*1000, // 5 minutes, we should make that api call faster
url: url url: url,
}); });
this.store.load(); this.store.load();
@ -124,7 +122,7 @@ Ext.define('PBS.DataStoreContent', {
expanded: false, expanded: false,
backup_type: item.data["backup-type"], backup_type: item.data["backup-type"],
backup_id: item.data["backup-id"], backup_id: item.data["backup-id"],
children: [] children: [],
}; };
} }
@ -163,7 +161,7 @@ Ext.define('PBS.DataStoreContent', {
} }
return false; return false;
}, },
after: () => {}, after: Ext.emptyFn,
}); });
for (const item of records) { for (const item of records) {
@ -244,7 +242,7 @@ Ext.define('PBS.DataStoreContent', {
view.setRootNode({ view.setRootNode({
expanded: true, expanded: true,
children: children children: children,
}); });
if (selected !== undefined) { if (selected !== undefined) {
@ -264,13 +262,13 @@ Ext.define('PBS.DataStoreContent', {
Proxmox.Utils.setErrorMask(view, false); Proxmox.Utils.setErrorMask(view, false);
if (view.getStore().getFilters().length > 0) { if (view.getStore().getFilters().length > 0) {
let searchBox = me.lookup("searchbox"); let searchBox = me.lookup("searchbox");
let searchvalue = searchBox.getValue();; let searchvalue = searchBox.getValue();
me.search(searchBox, searchvalue); me.search(searchBox, searchvalue);
} }
}, },
onPrune: function(view, rI, cI, item, e, rec) { onPrune: function(view, rI, cI, item, e, rec) {
var view = this.getView(); view = this.getView();
if (!(rec && rec.data)) return; if (!(rec && rec.data)) return;
let data = rec.data; let data = rec.data;
@ -329,7 +327,7 @@ Ext.define('PBS.DataStoreContent', {
onForget: function(view, rI, cI, item, e, rec) { onForget: function(view, rI, cI, item, e, rec) {
let me = this; let me = this;
var view = this.getView(); view = this.getView();
if (!(rec && rec.data)) return; if (!(rec && rec.data)) return;
let data = rec.data; let data = rec.data;
@ -384,7 +382,8 @@ 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`, window.location.origin); let url = new URL(`/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);
} }
@ -447,7 +446,7 @@ Ext.define('PBS.DataStoreContent', {
store.beginUpdate(); store.beginUpdate();
store.getRoot().cascadeBy({ store.getRoot().cascadeBy({
before: function(item) { before: function(item) {
if(me.filter(item, value)) { if (me.filter(item, value)) {
item.set('matchesFilter', true); item.set('matchesFilter', true);
if (item.parentNode && item.parentNode.id !== 'root') { if (item.parentNode && item.parentNode.id !== 'root') {
item.parentNode.childmatches = true; item.parentNode.childmatches = true;
@ -485,6 +484,7 @@ Ext.define('PBS.DataStoreContent', {
if (verify && verify.lastFailed) { if (verify && verify.lastFailed) {
return 'proxmox-invalid-row'; return 'proxmox-invalid-row';
} }
return null;
}, },
}, },
@ -493,7 +493,7 @@ Ext.define('PBS.DataStoreContent', {
xtype: 'treecolumn', xtype: 'treecolumn',
header: gettext("Backup Group"), header: gettext("Backup Group"),
dataIndex: 'text', dataIndex: 'text',
flex: 1 flex: 1,
}, },
{ {
header: gettext('Actions'), header: gettext('Actions'),
@ -540,9 +540,9 @@ Ext.define('PBS.DataStoreContent', {
data.filename && data.filename &&
data.filename.endsWith('pxar.didx') && data.filename.endsWith('pxar.didx') &&
data['crypt-mode'] < 3); data['crypt-mode'] < 3);
} },
}, },
] ],
}, },
{ {
xtype: 'datecolumn', xtype: 'datecolumn',
@ -550,7 +550,7 @@ Ext.define('PBS.DataStoreContent', {
sortable: true, sortable: true,
dataIndex: 'backup-time', dataIndex: 'backup-time',
format: 'Y-m-d H:i:s', format: 'Y-m-d H:i:s',
width: 150 width: 150,
}, },
{ {
header: gettext("Size"), header: gettext("Size"),
@ -596,8 +596,8 @@ Ext.define('PBS.DataStoreContent', {
if (iconCls) { if (iconCls) {
iconTxt = `<i class="fa fa-fw fa-${iconCls}"></i> `; iconTxt = `<i class="fa fa-fw fa-${iconCls}"></i> `;
} }
return (iconTxt + PBS.Utils.cryptText[v]) || Proxmox.Utils.unknownText return (iconTxt + PBS.Utils.cryptText[v]) || Proxmox.Utils.unknownText;
} },
}, },
{ {
header: gettext('Verify State'), header: gettext('Verify State'),
@ -697,7 +697,7 @@ Ext.define('PBS.DataStoreContent', {
this.triggers.clear.setVisible(false); this.triggers.clear.setVisible(false);
this.setValue(''); this.setValue('');
}, },
} },
}, },
listeners: { listeners: {
change: { change: {
@ -705,6 +705,6 @@ Ext.define('PBS.DataStoreContent', {
buffer: 500, buffer: 500,
}, },
}, },
} },
], ],
}); });