ui: tape/DriveStatus: fix updating pointer+click handler on info widget
we can only do this after it is rendered, the element does not exist before Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
30a0809553
commit
825dfe7e0d
@ -469,17 +469,38 @@ Ext.define('PBS.TapeManagement.DriveInfoPanel', {
|
|||||||
|
|
||||||
let vm = me.getViewModel();
|
let vm = me.getViewModel();
|
||||||
vm.set('drive', record.data);
|
vm.set('drive', record.data);
|
||||||
|
vm.notify();
|
||||||
|
me.updatePointer();
|
||||||
|
},
|
||||||
|
|
||||||
|
updatePointer: function() {
|
||||||
|
let me = this;
|
||||||
let stateWidget = me.down('pmxInfoWidget[reference=statewidget]');
|
let stateWidget = me.down('pmxInfoWidget[reference=statewidget]');
|
||||||
let stateEl = stateWidget.getEl();
|
let stateEl = stateWidget.getEl();
|
||||||
stateEl.removeListener('click', me.clickState);
|
if (!stateEl) {
|
||||||
if (record.data.state) {
|
setTimeout(function() {
|
||||||
stateEl.on('click', me.clickState, me);
|
me.updatePointer();
|
||||||
|
}, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let vm = me.getViewModel();
|
||||||
|
let drive = vm.get('drive');
|
||||||
|
|
||||||
|
if (drive.state) {
|
||||||
stateEl.addCls('info-pointer');
|
stateEl.addCls('info-pointer');
|
||||||
} else {
|
} else {
|
||||||
stateEl.removeCls('info-pointer');
|
stateEl.removeCls('info-pointer');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
vm.notify();
|
listeners: {
|
||||||
|
afterrender: function() {
|
||||||
|
let me = this;
|
||||||
|
let stateWidget = me.down('pmxInfoWidget[reference=statewidget]');
|
||||||
|
let stateEl = stateWidget.getEl();
|
||||||
|
stateEl.on('click', me.clickState, me);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
@ -488,12 +509,12 @@ Ext.define('PBS.TapeManagement.DriveInfoPanel', {
|
|||||||
throw "no drive given";
|
throw "no drive given";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
me.callParent();
|
||||||
|
|
||||||
let tapeStore = Ext.ComponentQuery.query('navigationtree')[0].tapestore;
|
let tapeStore = Ext.ComponentQuery.query('navigationtree')[0].tapestore;
|
||||||
me.mon(tapeStore, 'load', me.updateData, me);
|
me.mon(tapeStore, 'load', me.updateData, me);
|
||||||
if (tapeStore.isLoaded()) {
|
if (tapeStore.isLoaded()) {
|
||||||
me.updateData(tapeStore);
|
me.updateData(tapeStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
me.callParent();
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user