[pve-devel] applied: [PATCH widget-toolkit 2/3] node network: refactor bond mode array generation
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jul 10 12:44:16 CEST 2019
On 7/10/19 11:30 AM, Dominik Csapak wrote:
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> Utils.js | 23 +++++++++++++++++++++++
> form/BondModeSelector.js | 30 +++++++++++++++---------------
> 2 files changed, 38 insertions(+), 15 deletions(-)
>
> diff --git a/Utils.js b/Utils.js
> index 7a78fda..929de6e 100644
> --- a/Utils.js
> +++ b/Utils.js
> @@ -99,6 +99,29 @@ Ext.define('Proxmox.Utils', { utilities: {
> return data;
> },
>
> + bond_mode_gettext_map: {
> + '802.3ad': 'LACP (802.3ad)',
> + 'lacp-balance-slb': 'LACP (balance-slb)',
> + 'lacp-balance-tcp': 'LACP (balance-tcp)',
> + },
> +
> + render_bond_mode: function(value) {
> + var val = Proxmox.Utils.bond_mode_gettext_map[value];
> + if (!val) {
> + val = value || '';
> + }
> + return val;
> + },
> +
> + bond_mode_array: function(modes) {
> + var arr = [];
> + var i;
> + for (i = 0; i < modes.length; i++) {
> + arr.push([modes[i], Proxmox.Utils.render_bond_mode(modes[i])]);
> + }
> + return arr;
> + },
> +
applied, with followup below, thanks!
----8<----
diff --git a/Utils.js b/Utils.js
index 929de6e..9b62bf6 100644
--- a/Utils.js
+++ b/Utils.js
@@ -105,21 +105,10 @@ Ext.define('Proxmox.Utils', { utilities: {
'lacp-balance-tcp': 'LACP (balance-tcp)',
},
- render_bond_mode: function(value) {
- var val = Proxmox.Utils.bond_mode_gettext_map[value];
- if (!val) {
- val = value || '';
- }
- return val;
- },
+ render_bond_mode: value => Proxmox.Utils.bond_mode_gettext_map[value] || value || '',
bond_mode_array: function(modes) {
- var arr = [];
- var i;
- for (i = 0; i < modes.length; i++) {
- arr.push([modes[i], Proxmox.Utils.render_bond_mode(modes[i])]);
- }
- return arr;
+ return modes.map(mode => [mode, Proxmox.Utils.render_bond_mode(mode)]);
},
getNoSubKeyHtml: function(url) {
--
More information about the pve-devel
mailing list