mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-12 01:42:09 +00:00
apt repos: make enable/disable text selection dependent
the size hack is copied over from pve-manager's qemu/HardwareView Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
af48de6bf8
commit
bb64cd0341
@ -70,7 +70,10 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
|
|||||||
'-',
|
'-',
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxButton',
|
xtype: 'proxmoxButton',
|
||||||
text: gettext('Enable') + '/' + gettext('Disable'),
|
text: gettext('Enable'),
|
||||||
|
defaultText: gettext('Enable'),
|
||||||
|
altText: gettext('Disable'),
|
||||||
|
id: 'repoEnableButton',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
handler: function(button, event, record) {
|
handler: function(button, event, record) {
|
||||||
let me = this;
|
let me = this;
|
||||||
@ -99,6 +102,18 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
listeners: {
|
||||||
|
render: function(btn) {
|
||||||
|
// HACK: calculate the max button width on first render to avoid toolbar glitches
|
||||||
|
let defSize = btn.getSize().width;
|
||||||
|
|
||||||
|
btn.setText(btn.altText);
|
||||||
|
let altSize = btn.getSize().width;
|
||||||
|
|
||||||
|
btn.setText(btn.defaultText);
|
||||||
|
btn.setSize({ width: altSize > defSize ? altSize : defSize });
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -279,6 +294,19 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
|
|||||||
|
|
||||||
me.callParent();
|
me.callParent();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
listeners: {
|
||||||
|
selectionchange: function() {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (me.onSelectionChange) {
|
||||||
|
let sm = me.getSelectionModel();
|
||||||
|
let rec = sm.getSelection()[0];
|
||||||
|
|
||||||
|
me.onSelectionChange(rec, sm);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.define('Proxmox.node.APTRepositories', {
|
Ext.define('Proxmox.node.APTRepositories', {
|
||||||
@ -351,6 +379,13 @@ Ext.define('Proxmox.node.APTRepositories', {
|
|||||||
nodename: '{nodename}',
|
nodename: '{nodename}',
|
||||||
},
|
},
|
||||||
majorUpgradeAllowed: false, // TODO get release information from an API call?
|
majorUpgradeAllowed: false, // TODO get release information from an API call?
|
||||||
|
onSelectionChange: function(rec, sm) {
|
||||||
|
let me = this;
|
||||||
|
if (rec) {
|
||||||
|
let btn = me.up('proxmoxNodeAPTRepositories').down('#repoEnableButton');
|
||||||
|
btn.setText(rec.get('Enabled') ? gettext('Disable') : gettext('Enable'));
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user