From 19458d754e069b36978e2c87e467495cc8112b7c Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 6 Mar 2024 12:21:00 +0100 Subject: [PATCH] ui: metrics: don't send digest when creating a new influxdbupd host we accidentally always tried to load an existing config, even when creating a new entry. This returned the list of all configured ones plus the digest (which gets set by the edit window). When the digest is set, the edit window will send it along, but that does not exist for the create api call, so it failed. To fix it, guard the load behind the `serverid` property, which is only set when we edit an existing entry. Signed-off-by: Dominik Csapak --- www/window/InfluxDbEdit.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/www/window/InfluxDbEdit.js b/www/window/InfluxDbEdit.js index e4467737..b1927d6a 100644 --- a/www/window/InfluxDbEdit.js +++ b/www/window/InfluxDbEdit.js @@ -205,14 +205,16 @@ Ext.define('PBS.window.InfluxDbUdpEdit', { 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); - }, - }); + if (me.serverid) { + 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); + }, + }); + } }, });