[pve-devel] [PATCH manager 6/7] ui: add necessary fields for influxdb http api
Dominik Csapak
d.csapak at proxmox.com
Wed Dec 2 10:21:11 CET 2020
and en/disable them accordingly to the selected mode
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/dc/MetricServerView.js | 101 ++++++++++++++++++++++++++--
1 file changed, 96 insertions(+), 5 deletions(-)
diff --git a/www/manager6/dc/MetricServerView.js b/www/manager6/dc/MetricServerView.js
index e30ea14e..dfec8c03 100644
--- a/www/manager6/dc/MetricServerView.js
+++ b/www/manager6/dc/MetricServerView.js
@@ -174,6 +174,13 @@ Ext.define('PVE.dc.InfluxDBEdit', {
subject: 'InfluxDB',
+ cbindData: function() {
+ let me = this;
+ me.callParent();
+ me.tokenEmptyText = me.isCreate ? '' : gettext('unchanged');
+ return {};
+ },
+
items: [
{
xtype: 'inputpanel',
@@ -209,6 +216,41 @@ Ext.define('PVE.dc.InfluxDBEdit', {
fieldLabel: gettext('Server'),
allowBlank: false,
},
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'port',
+ fieldLabel: gettext('Port'),
+ value: 8089,
+ minValue: 1,
+ maximum: 65536,
+ allowBlank: false,
+ },
+ {
+ xtype: 'proxmoxKVComboBox',
+ name: 'influxdbproto',
+ fieldLabel: gettext('Protocol'),
+ value: '__default__',
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ comboItems: [
+ ['__default__', 'UDP'],
+ ['http', 'HTTP'],
+ ['https', 'HTTPS'],
+ ],
+ listeners: {
+ change: function(field, value) {
+ let me = this;
+ let isUdp = value !== 'http' && value !== 'https';
+ me.up('inputpanel').down('field[name=organization]').setDisabled(isUdp);
+ me.up('inputpanel').down('field[name=bucket]').setDisabled(isUdp);
+ me.up('inputpanel').down('field[name=token]').setDisabled(isUdp);
+ me.up('inputpanel').down('field[name=mtu]').setDisabled(!isUdp);
+ me.up('inputpanel').down('field[name=timeout]').setDisabled(isUdp);
+ me.up('inputpanel').down('field[name=max-body-size]').setDisabled(isUdp);
+ },
+ },
+ },
],
column2: [
@@ -220,18 +262,67 @@ Ext.define('PVE.dc.InfluxDBEdit', {
uncheckedValue: 0,
checked: true,
},
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'organization',
+ fieldLabel: gettext('Organization'),
+ emptyText: 'proxmox',
+ disabled: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ },
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'bucket',
+ fieldLabel: gettext('Bucket'),
+ emptyText: 'proxmox',
+ disabled: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ },
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'token',
+ fieldLabel: gettext('Token'),
+ disabled: true,
+ allowBlank: true,
+ deleteEmpty: false,
+ submitEmpty: false,
+ cbind: {
+ disabled: '{!isCreate}',
+ emptyText: '{tokenEmptyText}',
+ },
+ },
+ ],
+
+ advancedColumn1: [
{
xtype: 'proxmoxintegerfield',
- name: 'port',
- fieldLabel: gettext('Port'),
- value: 8089,
+ name: 'timeout',
+ fieldLabel: gettext('Timeout (s)'),
+ disabled: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
minValue: 1,
- maximum: 65536,
- allowBlank: false,
+ emptyText: 1,
},
],
advancedColumn2: [
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'max-body-size',
+ fieldLabel: gettext('Batch Size (b)'),
+ minValue: 1,
+ emptyText: '25000000',
+ submitEmpty: false,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ },
{
xtype: 'proxmoxintegerfield',
name: 'mtu',
--
2.20.1
More information about the pve-devel
mailing list