ui: traffic-control view: various code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-11-20 21:54:53 +01:00
parent 07a579c632
commit ba80611324
1 changed files with 12 additions and 14 deletions

View File

@ -28,7 +28,7 @@ Ext.define('PBS.config.TrafficControlView', {
title: gettext('Traffic Control'), title: gettext('Traffic Control'),
// tools: [PBS.Utils.get_help_tool("backup-remote")], // tools: [PBS.Utils.get_help_tool("backup-remote")], // TODO!
controller: { controller: {
xclass: 'Ext.app.ViewController', xclass: 'Ext.app.ViewController',
@ -36,15 +36,14 @@ Ext.define('PBS.config.TrafficControlView', {
addRemote: function() { addRemote: function() {
let me = this; let me = this;
Ext.create('PBS.window.TrafficControlEdit', { Ext.create('PBS.window.TrafficControlEdit', {
autoShow: true,
listeners: { listeners: {
destroy: function() { destroy: () => me.reload(),
me.reload();
}, },
}, });
}).show();
}, },
editRemote: function() { editTrafficControl: function() {
let me = this; let me = this;
let view = me.getView(); let view = me.getView();
let selection = view.getSelection(); let selection = view.getSelection();
@ -52,12 +51,11 @@ Ext.define('PBS.config.TrafficControlView', {
Ext.create('PBS.window.TrafficControlEdit', { Ext.create('PBS.window.TrafficControlEdit', {
name: selection[0].data.name, name: selection[0].data.name,
autoShow: true,
listeners: { listeners: {
destroy: function() { destroy: () => me.reload(),
me.reload();
}, },
}, });
}).show();
}, },
render_bandwidth: v => v ? Proxmox.Utils.autoscale_size_unit(v) + '/s' : '', render_bandwidth: v => v ? Proxmox.Utils.autoscale_size_unit(v) + '/s' : '',
@ -71,7 +69,7 @@ Ext.define('PBS.config.TrafficControlView', {
listeners: { listeners: {
activate: 'reload', activate: 'reload',
itemdblclick: 'editRemote', itemdblclick: 'editTrafficControl',
}, },
store: { store: {
@ -98,7 +96,7 @@ Ext.define('PBS.config.TrafficControlView', {
{ {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
text: gettext('Edit'), text: gettext('Edit'),
handler: 'editRemote', handler: 'editTrafficControl',
disabled: true, disabled: true,
}, },
{ {