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 3330975099 for ; Thu, 2 Jun 2022 14:18:50 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 40A9745E0 for ; Thu, 2 Jun 2022 14:18:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS id A3039444B for ; Thu, 2 Jun 2022 14:18:13 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7B41A439D5 for ; Thu, 2 Jun 2022 14:18:13 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Thu, 2 Jun 2022 14:18:10 +0200 Message-Id: <20220602121811.3472729-8-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220602121811.3472729-1-d.csapak@proxmox.com> References: <20220602121811.3472729-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.060 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [values.host] Subject: [pbs-devel] [PATCH proxmox-backup v7 7/8] ui: add window/InfluxDbEdit X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2022 12:18:50 -0000 contains both windows for HTTP and UDP Signed-off-by: Dominik Csapak --- www/Makefile | 1 + www/window/InfluxDbEdit.js | 218 +++++++++++++++++++++++++++++++++++++ 2 files changed, 219 insertions(+) create mode 100644 www/window/InfluxDbEdit.js diff --git a/www/Makefile b/www/Makefile index 311f4753..3a36daba 100644 --- a/www/Makefile +++ b/www/Makefile @@ -82,6 +82,7 @@ JSSRC= \ window/VerifyJobEdit.js \ window/VerifyAll.js \ window/ZFSCreate.js \ + window/InfluxDbEdit.js \ dashboard/DataStoreStatistics.js \ dashboard/LongestTasks.js \ dashboard/RunningTasks.js \ diff --git a/www/window/InfluxDbEdit.js b/www/window/InfluxDbEdit.js new file mode 100644 index 00000000..4ac9fff3 --- /dev/null +++ b/www/window/InfluxDbEdit.js @@ -0,0 +1,218 @@ +Ext.define('PBS.window.InfluxDbHttpEdit', { + extend: 'Proxmox.window.Edit', + mixins: ['Proxmox.Mixin.CBind'], + + subject: 'InfluxDB (HTTP)', + + cbindData: function() { + let me = this; + me.isCreate = !me.serverid; + me.serverid = me.serverid || ""; + me.url = `/api2/extjs/config/metricserver/influxdb-http/${me.serverid}`; + me.tokenEmptyText = me.isCreate ? '' : gettext('unchanged'); + me.method = me.isCreate ? 'POST' : 'PUT'; + if (!me.isCreate) { + me.subject = `${me.subject}: ${me.serverid}`; + } + return {}; + }, + + items: [ + { + xtype: 'inputpanel', + + column1: [ + { + xtype: 'pmxDisplayEditField', + name: 'name', + fieldLabel: gettext('Name'), + allowBlank: false, + cbind: { + editable: '{isCreate}', + value: '{serverid}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'url', + fieldLabel: gettext('URL'), + allowBlank: false, + }, + ], + + column2: [ + { + xtype: 'checkbox', + name: 'enable', + fieldLabel: gettext('Enabled'), + inputValue: 1, + uncheckedValue: 0, + checked: true, + }, + { + xtype: 'proxmoxtextfield', + name: 'organization', + fieldLabel: gettext('Organization'), + emptyText: 'proxmox', + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'bucket', + fieldLabel: gettext('Bucket'), + emptyText: 'proxmox', + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'token', + fieldLabel: gettext('Token'), + allowBlank: true, + deleteEmpty: false, + submitEmpty: false, + cbind: { + emptyText: '{tokenEmptyText}', + }, + }, + ], + + columnB: [ + { + xtype: 'proxmoxtextfield', + name: 'comment', + fieldLabel: gettext('Comment'), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], + + advancedColumn1: [ + { + xtype: 'proxmoxintegerfield', + name: 'max-body-size', + fieldLabel: gettext('Batch Size (b)'), + minValue: 1, + emptyText: '25000000', + submitEmpty: false, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], + }, + ], +}); + +Ext.define('PBS.window.InfluxDbUdpEdit', { + extend: 'Proxmox.window.Edit', + mixins: ['Proxmox.Mixin.CBind'], + + subject: 'InfluxDB (UDP)', + + cbindData: function() { + let me = this; + me.isCreate = !me.serverid; + me.serverid = me.serverid || ""; + me.url = `/api2/extjs/config/metricserver/influxdb-udp/${me.serverid}`; + me.method = me.isCreate ? 'POST' : 'PUT'; + if (!me.isCreate) { + me.subject = `${me.subject}: ${me.serverid}`; + } + return {}; + }, + + items: [ + { + xtype: 'inputpanel', + + onGetValues: function(values) { + values.host += `:${values.port}`; + delete values.port; + return values; + }, + + column1: [ + { + xtype: 'pmxDisplayEditField', + name: 'name', + fieldLabel: gettext('Name'), + allowBlank: false, + cbind: { + editable: '{isCreate}', + value: '{serverid}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'host', + fieldLabel: gettext('Host'), + allowBlank: false, + }, + ], + + column2: [ + { + xtype: 'checkbox', + name: 'enable', + fieldLabel: gettext('Enabled'), + inputValue: 1, + uncheckedValue: 0, + checked: true, + }, + { + xtype: 'proxmoxintegerfield', + name: 'port', + minValue: 1, + maxValue: 65535, + fieldLabel: gettext('Port'), + allowBlank: false, + }, + ], + + columnB: [ + { + xtype: 'proxmoxtextfield', + name: 'comment', + fieldLabel: gettext('Comment'), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], + + advancedColumn1: [ + { + xtype: 'proxmoxintegerfield', + name: 'mtu', + fieldLabel: 'MTU', + minValue: 1, + emptyText: '1500', + submitEmpty: false, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], + }, + ], + + initComponent: function() { + let me = this; + me.callParent(); + + me.load({ + success: function(response, options) { + let values = response.result.data; + let [_match, host, port] = /^(.*):(\d+)$/.exec(values.host) || []; + values.host = host; + values.port = port; + me.setValues(values); + }, + }); + }, +}); -- 2.30.2