mirror of
git://git.proxmox.com/git/proxmox-backup.git
synced 2025-02-12 21:58:01 +03:00
ui: add window/InfluxDbEdit
contains both windows for HTTP and UDP Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
173b479b08
commit
3d6b21bf05
@ -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 \
|
||||
|
218
www/window/InfluxDbEdit.js
Normal file
218
www/window/InfluxDbEdit.js
Normal file
@ -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/metrics/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/metrics/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);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user