From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3AC98616AA for ; Thu, 3 Dec 2020 11:35:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BA7832776E for ; Thu, 3 Dec 2020 11:34:38 +0100 (CET) Received: from kvmformation1.odiso.net (globalOdiso.M6Lille.odiso.net [89.248.211.242]) by firstgate.proxmox.com (Proxmox) with ESMTP id 586BD27579 for ; Thu, 3 Dec 2020 11:34:29 +0100 (CET) Received: by kvmformation1.odiso.net (Postfix, from userid 0) id 3C2D8169171; Thu, 3 Dec 2020 11:34:27 +0100 (CET) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Thu, 3 Dec 2020 11:34:25 +0100 Message-Id: <20201203103425.2452093-19-aderumier@odiso.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201203103425.2452093-1-aderumier@odiso.com> References: <20201203103425.2452093-1-aderumier@odiso.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.204 Adjusted score from AWL reputation of From: address HEADER_FROM_DIFFERENT_DOMAINS 0.25 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods KHOP_HELO_FCRDNS 0.399 Relay HELO differs from its IP's reverse DNS NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [rec.data] Subject: [pve-devel] [PATCH v9 pve-manager 18/18] sdn: add pending state column with hover tip X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 10:35:10 -0000 Signed-off-by: Alexandre Derumier --- www/manager6/Utils.js | 71 +++++++++++++++++++----------- www/manager6/sdn/ControllerView.js | 17 +++---- www/manager6/sdn/SubnetView.js | 12 ++++- www/manager6/sdn/VnetView.js | 8 ++++ www/manager6/sdn/ZoneView.js | 27 +++--------- 5 files changed, 75 insertions(+), 60 deletions(-) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 89706c32..5a6267fe 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -176,32 +176,51 @@ Ext.define('PVE.Utils', { utilities: { }, render_sdn_pending: function(rec,value,key, index) { - if (rec.data.state === 'deleted') { - if (value === undefined) { - return ' '; - } else { - return '
'+ value +'
'; - } - - } else if (rec.data.state === 'new') { - if(index === undefined) { - value = rec.data.pending[key]; - } - if (value === undefined || value === null) { - value = ' '; - } - return '
' + value + '
'; - } else if (rec.data.state === 'changed') { - if (value === undefined || value === null) { - value = '
'; - } - if (rec.data.pending[key] === undefined || rec.data.pending[key] === null) { - rec.data.pending[key] = value; - } - return '
'+ value +'
' + '
' + rec.data.pending[key] + '
'; - } else { - return value; - } + if (rec.data.state === undefined || rec.data.state === null) { + return value; + } + + if (rec.data.state === 'deleted') { + if (value === undefined) { + return ' '; + } else { + return '
'+ value +'
'; + } + } else { + + if (rec.data.pending[key] !== undefined && rec.data.pending[key] !== null) { + if (rec.data.pending[key] === 'deleted') { + return ' '; + } else { + return rec.data.pending[key]; + } + } else { + return value; + } + } + return value; + }, + + render_sdn_pending_state: function(rec,value) { + + if (value === undefined || value === null) { + return ' '; + } + + let icon = ``; + + if (value === 'deleted') { + return '' + icon + value + ''; + } + + let tip = 'Pending apply:
'; + + for (const [key, keyvalue] of Object.entries(rec.data.pending)) { + if (((rec.data[key] !== undefined && rec.data.pending[key] !== rec.data[key]) || rec.data[key] === undefined)) { + tip = tip + `${key}: ${keyvalue}
`; + } + } + return ''+ icon + value + ''; }, render_ceph_health: function(healthObj) { diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js index 10c9c446..7981eba9 100644 --- a/www/manager6/sdn/ControllerView.js +++ b/www/manager6/sdn/ControllerView.js @@ -143,19 +143,12 @@ Ext.define('PVE.sdn.ControllerView', { } }, { - header: gettext('Pending'), - flex: 3, - dataIndex: 'pending', + header: gettext('State'), + width: 100, + dataIndex: 'state', renderer: function(value, metaData, rec) { - if(value !== undefined ) { - delete value.controller; - delete value.type; - if(!Ext.Object.isEmpty(value)){ - return JSON.stringify(value); - } - } - return ''; - } + return PVE.Utils.render_sdn_pending_state(rec, value); + } } ], listeners: { diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js index bff047fb..9a85bbbc 100644 --- a/www/manager6/sdn/SubnetView.js +++ b/www/manager6/sdn/SubnetView.js @@ -129,8 +129,16 @@ Ext.define('PVE.sdn.SubnetView', { dataIndex: 'dnszoneprefix', renderer: function(value, metaData, rec) { return PVE.Utils.render_sdn_pending(rec, value, 'dnszoneprefix'); - } - }, + } + }, + { + header: gettext('State'), + width: 100, + dataIndex: 'state', + renderer: function(value, metaData, rec) { + return PVE.Utils.render_sdn_pending_state(rec, value); + } + } ], listeners: { diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js index da0234dd..a38a9c9a 100644 --- a/www/manager6/sdn/VnetView.js +++ b/www/manager6/sdn/VnetView.js @@ -124,6 +124,14 @@ Ext.define('PVE.sdn.VnetView', { renderer: function(value, metaData, rec) { return PVE.Utils.render_sdn_pending(rec, value, 'vlanaware'); } + }, + { + header: gettext('State'), + width: 100, + dataIndex: 'state', + renderer: function(value, metaData, rec) { + return PVE.Utils.render_sdn_pending_state(rec, value); + } } ], listeners: { diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js index ae44f95f..0d4ce9ac 100644 --- a/www/manager6/sdn/ZoneView.js +++ b/www/manager6/sdn/ZoneView.js @@ -179,27 +179,14 @@ Ext.define('PVE.sdn.ZoneView', { return PVE.Utils.render_sdn_pending(rec, value, 'reversedns'); } }, - { - header: gettext('Pending'), - flex: 3, - dataIndex: 'pending', + { + header: gettext('State'), + width: 100, + dataIndex: 'state', renderer: function(value, metaData, rec) { - if(value !== undefined ) { - delete value.nodes; - delete value.zone; - delete value.type; - delete value.mtu; - delete value.ipam; - delete value.dns; - delete value.reversedns; - delete value.dnszone; - if(!Ext.Object.isEmpty(value)){ - return JSON.stringify(value); - } - } - return ''; - } - }, + return PVE.Utils.render_sdn_pending_state(rec, value); + } + } ], listeners: { activate: reload, -- 2.20.1