ui: add tooltip to datastore in maintenance mode

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2022-04-26 06:23:35 +00:00 committed by Thomas Lamprecht
parent 1b7479c968
commit f732942089

View File

@ -127,9 +127,26 @@ Ext.define('PBS.store.NavigationStore', {
}, },
}); });
Ext.define('CustomTreeListItem', {
extend: 'Ext.list.TreeItem',
xtype: 'qtiptreelistitem',
updateNode: function(node, oldNode) {
const qtip = node ? node.get('qtip') : null;
this.callParent([node, oldNode]);
if (qtip) {
this.element.dom.setAttribute('data-qtip', qtip);
} else {
this.element.dom.removeAttribute('data-qtip');
}
},
});
Ext.define('PBS.view.main.NavigationTree', { Ext.define('PBS.view.main.NavigationTree', {
extend: 'Ext.list.Tree', extend: 'Ext.list.Tree',
xtype: 'navigationtree', xtype: 'navigationtree',
defaults: {
xtype: 'qtiptreelistitem',
},
controller: { controller: {
xclass: 'Ext.app.ViewController', xclass: 'Ext.app.ViewController',
@ -236,14 +253,17 @@ Ext.define('PBS.view.main.NavigationTree', {
j++; j++;
} }
let iconCls = 'fa fa-database'; let [qtip, iconCls] = ['', 'fa fa-database'];
const maintenance = records[i].data.maintenance; const maintenance = records[i].data.maintenance;
if (maintenance) { if (maintenance) {
const [type, message] = PBS.Utils.parseMaintenanceMode(maintenance);
qtip = `${type}${message ? ': ' + message : ''}`;
iconCls = 'fa fa-database pmx-tree-icon-custom maintenance'; iconCls = 'fa fa-database pmx-tree-icon-custom maintenance';
} }
const child = { const child = {
text: name, text: name,
qtip,
path: `DataStore-${name}`, path: `DataStore-${name}`,
iconCls, iconCls,
leaf: true, leaf: true,