mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 05:52:32 +00:00
ui snapshot tree: express formulas more concisely
Use arrow functions to bring them in a more simple boolean expression style. Further, we can reuse the "isSnapshot" formula in the "canRollback" and "canRemove" ones. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
9a6b894fcc
commit
b9c780c5a8
@ -18,26 +18,12 @@ Ext.define('PVE.guest.SnapshotTree', {
|
|||||||
load_delay: 3000,
|
load_delay: 3000,
|
||||||
},
|
},
|
||||||
formulas: {
|
formulas: {
|
||||||
canSnapshot: function(get) {
|
canSnapshot: (get) => get('snapshotAllowed') && get('snapshotFeature'),
|
||||||
return get('snapshotAllowed') && get('snapshotFeature');
|
canRollback: (get) => get('rollbackAllowed') && get('isSnapshot'),
|
||||||
},
|
canRemove: (get) => get('snapshotAllowed') && get('isSnapshot'),
|
||||||
canRollback: function(get) {
|
isSnapshot: (get) => get('selected') && get('selected') !== 'current',
|
||||||
return get('rollbackAllowed') &&
|
buttonText: (get) => gettext(get('snapshotAllowed') ? 'Edit' : 'View'),
|
||||||
get('selected') && get('selected') !== 'current';
|
showMemory: (get) => get('type') === 'qemu',
|
||||||
},
|
|
||||||
canRemove: function(get) {
|
|
||||||
return get('snapshotAllowed') &&
|
|
||||||
get('selected') && get('selected') !== 'current';
|
|
||||||
},
|
|
||||||
isSnapshot: function(get) {
|
|
||||||
return get('selected') && get('selected') !== 'current';
|
|
||||||
},
|
|
||||||
buttonText: function(get) {
|
|
||||||
return get('snapshotAllowed') ? gettext('Edit') : gettext('View');
|
|
||||||
},
|
|
||||||
showMemory: function(get) {
|
|
||||||
return get('type') === 'qemu';
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user