ui: update group notes: fix obj access and rewrite to async
eslint is configured to not allow using quoted object keys if they could be just passed in dot notation, e.g., wrong: `group["comment"]` good: `group.comment` It's not a big problem but eslint fails the build with the wrong one, so this needs to be fixed anyway.. Also, rewrite to async, shorter and less indentation Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
b3477d286f
commit
8866cbccc8
|
@ -125,27 +125,24 @@ Ext.define('PBS.DataStoreContent', {
|
|||
return groups;
|
||||
},
|
||||
|
||||
updateGroupNotes: function(view) {
|
||||
Proxmox.Utils.API2Request({
|
||||
updateGroupNotes: async function(view) {
|
||||
try {
|
||||
let { result: { data: groups } } = await Proxmox.Async.api2({
|
||||
url: `/api2/extjs/admin/datastore/${view.datastore}/groups`,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
let groups = response.result.data;
|
||||
});
|
||||
let map = {};
|
||||
for (const group of groups) {
|
||||
map[`${group["backup-type"]}/${group["backup-id"]}`] = group["comment"];
|
||||
map[`${group["backup-type"]}/${group["backup-id"]}`] = group.comment;
|
||||
}
|
||||
view.getRootNode().cascade(node => {
|
||||
if (node.parentNode && node.parentNode.id === 'root') {
|
||||
node.set(
|
||||
'comment',
|
||||
map[`${node.data.backup_type}/${node.data.backup_id}`],
|
||||
{ dirty: false },
|
||||
);
|
||||
let group = `${node.data.backup_type}/${node.data.backup_id}`;
|
||||
node.set('comment', map[group], { dirty: false });
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
console.debug(err);
|
||||
}
|
||||
},
|
||||
|
||||
onLoad: function(store, records, success, operation) {
|
||||
|
|
Loading…
Reference in New Issue