ui: datastore content: rework rendering protection state

avoid that there's the same icon rendered twice, once clickable and
once as status. Also indicate the protection with a literal text and
by highlighting the single shield with green, if protected.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-11-22 11:21:23 +01:00
parent 154d01b042
commit 50a39bbc1f

View File

@ -717,11 +717,10 @@ Ext.define('PBS.DataStoreContent', {
header: gettext("Backup Group"),
dataIndex: 'text',
renderer: (value, meta, record) => {
let protect = "";
if (record.data.protected) {
protect = ` <i class="fa fa-shield"></i>`;
return `${value} (${gettext('protected')})`;
}
return value + protect;
return value;
},
flex: 1,
},
@ -795,7 +794,13 @@ Ext.define('PBS.DataStoreContent', {
{
handler: 'onProtectionChange',
getTip: (v, m, rec) => Ext.String.format(gettext("Change protection of '{0}'"), v),
getClass: (v, m, rec) => !rec.data.leaf && rec.parentNode.id !== 'root' ? 'fa fa-shield' : 'pmx-hidden',
getClass: (v, m, rec) => {
if (!rec.data.leaf && rec.parentNode.id !== 'root') {
let extraCls = rec.data.protected ? 'good' : 'faded';
return `fa fa-shield ${extraCls}`;
}
return 'pmx-hidden';
},
isActionDisabled: (v, r, c, i, rec) => !!rec.data.leaf || rec.parentNode.id === 'root',
},
{