* [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks
@ 2024-03-06 11:20 Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH widget-toolkit 1/1] realms: don't send type and delete on creation Dominik Csapak
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:20 UTC (permalink / raw)
To: pbs-devel
since a bit, i believe commit
bae2cf75 (schema: AllOf/OneOf: actually perform additional_properties() check)
in proxmox-schema, sending additional properties not defined for an api
call is forbidden and leads to an error.
Sadly, the gui did not adhere strictly to the api definition and
sometimes sent more data that what was defined, now resulting in various
api errors when using the gui.
This series fixes those that i found (there are probably some that i
missed).
I did not include the whole detail why in every commit, but if that's
preferred just holler and i add a sentence or two to every commmit.
the first patch in proxmox-backup is just indentation cleanup and not
really related, so could be applied independently.
proxmox-widget-toolkit:
Dominik Csapak (1):
realms: don't send type and delete on creation
src/window/AuthEditLDAP.js | 8 ++++----
src/window/AuthEditOpenId.js | 10 ----------
2 files changed, 4 insertions(+), 14 deletions(-)
proxmox-backup:
Dominik Csapak (6):
ui: prune job edit: indent fix
ui: metrics: don't send digest when creating a new influxdbupd host
ui: tape backup job: don't send delete value on creation
ui: prune: fix sending invalid parameters
ui: sync job: don't send delete value on creation
ui: verify job: don't send delete value on creation
www/datastore/Content.js | 1 +
www/panel/PrunePanel.js | 2 +-
www/tape/window/TapeBackupJob.js | 14 ++++++++++++++
www/window/InfluxDbEdit.js | 20 +++++++++++---------
www/window/PruneJobEdit.js | 11 ++++++++---
www/window/SyncJobEdit.js | 14 +++++++++++++-
www/window/VerifyJobEdit.js | 4 +++-
7 files changed, 51 insertions(+), 15 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH widget-toolkit 1/1] realms: don't send type and delete on creation
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
@ 2024-03-06 11:20 ` Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH proxmox-backup 1/6] ui: prune job edit: indent fix Dominik Csapak
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:20 UTC (permalink / raw)
To: pbs-devel
those are not valid properties for pbs, which is currently the only user
of these panels/windows.
Sending these parameters will result in the api call failing.
When we want to reuse these panels for other products, we'll have to
make them a bit more flexible/generic anyway.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/window/AuthEditLDAP.js | 8 ++++----
src/window/AuthEditOpenId.js | 10 ----------
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/window/AuthEditLDAP.js b/src/window/AuthEditLDAP.js
index eb9700a..0494d3f 100644
--- a/src/window/AuthEditLDAP.js
+++ b/src/window/AuthEditLDAP.js
@@ -32,10 +32,6 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
onlineHelp: 'user-realms-ldap',
onGetValues: function(values) {
- if (this.isCreate) {
- values.type = this.type;
- }
-
if (values.anonymous_search) {
if (!values.delete) {
values.delete = [];
@@ -51,6 +47,10 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
values.delete.push("password");
}
+ if (this.isCreate) {
+ delete values.delete;
+ }
+
delete values.anonymous_search;
return values;
diff --git a/src/window/AuthEditOpenId.js b/src/window/AuthEditOpenId.js
index ca84958..b9648f7 100644
--- a/src/window/AuthEditOpenId.js
+++ b/src/window/AuthEditOpenId.js
@@ -5,16 +5,6 @@ Ext.define('Proxmox.panel.OpenIDInputPanel', {
type: 'openid',
- onGetValues: function(values) {
- let me = this;
-
- if (me.isCreate) {
- values.type = me.type;
- }
-
- return values;
- },
-
columnT: [
{
xtype: 'textfield',
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 1/6] ui: prune job edit: indent fix
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH widget-toolkit 1/1] realms: don't send type and delete on creation Dominik Csapak
@ 2024-03-06 11:20 ` Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 2/6] ui: metrics: don't send digest when creating a new influxdbupd host Dominik Csapak
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:20 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/window/PruneJobEdit.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/www/window/PruneJobEdit.js b/www/window/PruneJobEdit.js
index 84159a9d..b2259bb9 100644
--- a/www/window/PruneJobEdit.js
+++ b/www/window/PruneJobEdit.js
@@ -116,8 +116,8 @@ Ext.define('PBS.window.PruneJobEdit', {
name: 'schedule',
emptyText: gettext('none (disabled)'),
cbind: {
- deleteEmpty: '{!isCreate}',
- value: '{scheduleValue}',
+ deleteEmpty: '{!isCreate}',
+ value: '{scheduleValue}',
},
},
{
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 2/6] ui: metrics: don't send digest when creating a new influxdbupd host
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH widget-toolkit 1/1] realms: don't send type and delete on creation Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH proxmox-backup 1/6] ui: prune job edit: indent fix Dominik Csapak
@ 2024-03-06 11:21 ` Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 3/6] ui: tape backup job: don't send delete value on creation Dominik Csapak
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:21 UTC (permalink / raw)
To: pbs-devel
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 <d.csapak@proxmox.com>
---
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);
+ },
+ });
+ }
},
});
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 3/6] ui: tape backup job: don't send delete value on creation
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
` (2 preceding siblings ...)
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 2/6] ui: metrics: don't send digest when creating a new influxdbupd host Dominik Csapak
@ 2024-03-06 11:21 ` Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 4/6] ui: prune: fix sending invalid parameters Dominik Csapak
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:21 UTC (permalink / raw)
To: pbs-devel
this is not a valid parameter for the create call. To do that in the
onGetValues method, we have to pass the 'isCreate' value through to the
input panels via cbind.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/tape/window/TapeBackupJob.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/www/tape/window/TapeBackupJob.js b/www/tape/window/TapeBackupJob.js
index 2b18e0e0..abbbaa0b 100644
--- a/www/tape/window/TapeBackupJob.js
+++ b/www/tape/window/TapeBackupJob.js
@@ -61,8 +61,16 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
Proxmox.Utils.assemble_field_data(values, { "delete": 'eject-media' });
}
PBS.Utils.delete_if_default(values, 'notify-user');
+
+ if (me.isCreate) {
+ delete values.delete;
+ }
+
return values;
},
+ cbind: {
+ isCreate: '{isCreate}', // pass it through
+ },
column1: [
{
xtype: 'pmxDisplayEditField',
@@ -184,8 +192,14 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
delete values['group-filter'];
values.delete = 'group-filter';
}
+ if (this.isCreate) {
+ delete values.delete;
+ }
return values;
},
+ cbind: {
+ isCreate: '{isCreate}', // pass it through
+ },
title: gettext('Group Filter'),
items: [
{
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 4/6] ui: prune: fix sending invalid parameters
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
` (3 preceding siblings ...)
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 3/6] ui: tape backup job: don't send delete value on creation Dominik Csapak
@ 2024-03-06 11:21 ` Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 5/6] ui: sync job: don't send delete value on creation Dominik Csapak
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:21 UTC (permalink / raw)
To: pbs-devel
the prune input panel is used in various contexts (add/editing a
prunejob, adding a datastore, executing a prune). These different api
calls don't all take the same parameters, so we have to correctly set
the `isCreate` to not send a `delete` paramter for those request if
there was an empty field.
Also set 'max-depth:0' only when recursive was not set *and* we can
set 'recursive', because for creating a datastore that is not supported
by the api, and for the prune job editing we override the whole
onGetValues anyway so that's not an issue there.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/datastore/Content.js | 1 +
www/panel/PrunePanel.js | 2 +-
www/window/PruneJobEdit.js | 7 ++++++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index 87317ec1..fa0b7d2c 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -479,6 +479,7 @@ Ext.define('PBS.DataStoreContent', {
ns,
dryrun: true,
canRecurse: true,
+ isCreate: true,
},
],
});
diff --git a/www/panel/PrunePanel.js b/www/panel/PrunePanel.js
index 59c28a8e..7ccdb1de 100644
--- a/www/panel/PrunePanel.js
+++ b/www/panel/PrunePanel.js
@@ -27,7 +27,7 @@ Ext.define('PBS.panel.PruneInputPanel', {
if (me.ns && me.ns !== '') {
values.ns = me.ns;
}
- if (!values.recursive) {
+ if (!values.recursive && me.canRecurse) {
values['max-depth'] = 0;
}
delete values.recursive;
diff --git a/www/window/PruneJobEdit.js b/www/window/PruneJobEdit.js
index b2259bb9..b804fdb4 100644
--- a/www/window/PruneJobEdit.js
+++ b/www/window/PruneJobEdit.js
@@ -105,7 +105,9 @@ Ext.define('PBS.window.PruneJobEdit', {
xtype: 'pbsNamespaceMaxDepthReduced',
name: 'max-depth',
fieldLabel: gettext('Max. Depth'),
- deleteEmpty: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
},
],
@@ -133,6 +135,9 @@ Ext.define('PBS.window.PruneJobEdit', {
columnB: [
{
xtype: 'pbsPruneInputPanel',
+ cbind: {
+ isCreate: '{isCreate}',
+ },
getValues: () => ({}), // let that handle our inputpanel here
},
{
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 5/6] ui: sync job: don't send delete value on creation
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
` (4 preceding siblings ...)
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 4/6] ui: prune: fix sending invalid parameters Dominik Csapak
@ 2024-03-06 11:21 ` Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 6/6] ui: verify " Dominik Csapak
2024-03-07 9:32 ` [pbs-devel] applied-series: [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Thomas Lamprecht
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:21 UTC (permalink / raw)
To: pbs-devel
since that's not a valid api parameter there
we have to pass the `isCreate` value through to the inputpanel, we even
used it there already but it was never set.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/window/SyncJobEdit.js | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/www/window/SyncJobEdit.js b/www/window/SyncJobEdit.js
index c11103eb..e06fdd81 100644
--- a/www/window/SyncJobEdit.js
+++ b/www/window/SyncJobEdit.js
@@ -80,6 +80,9 @@ Ext.define('PBS.window.SyncJobEdit', {
}
return values;
},
+ cbind: {
+ isCreate: '{isCreate}', // pass it through
+ },
column1: [
{
xtype: 'pmxDisplayEditField',
@@ -266,7 +269,9 @@ Ext.define('PBS.window.SyncJobEdit', {
xtype: 'pbsNamespaceMaxDepthReduced',
name: 'max-depth',
fieldLabel: gettext('Max. Depth'),
- deleteEmpty: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
},
{
fieldLabel: gettext('Remove vanished'),
@@ -321,6 +326,7 @@ Ext.define('PBS.window.SyncJobEdit', {
{
xtype: 'inputpanel',
onGetValues: function(values) {
+ let me = this;
PBS.Utils.delete_if_default(values, 'group-filter');
if (Ext.isArray(values['group-filter'])) {
if (values['group-filter'].length === 0) {
@@ -331,8 +337,14 @@ Ext.define('PBS.window.SyncJobEdit', {
values['group-filter'] = [...new Set(values['group-filter'])];
}
}
+ if (me.isCreate) {
+ delete values.delete;
+ }
return values;
},
+ cbind: {
+ isCreate: '{isCreate}', // pass it through
+ },
title: gettext('Group Filter'),
items: [
{
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 6/6] ui: verify job: don't send delete value on creation
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
` (5 preceding siblings ...)
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 5/6] ui: sync job: don't send delete value on creation Dominik Csapak
@ 2024-03-06 11:21 ` Dominik Csapak
2024-03-07 9:32 ` [pbs-devel] applied-series: [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Thomas Lamprecht
7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2024-03-06 11:21 UTC (permalink / raw)
To: pbs-devel
the conditional `deleteEmpty` was missing only for max-depth
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/window/VerifyJobEdit.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/www/window/VerifyJobEdit.js b/www/window/VerifyJobEdit.js
index 7899dcd4..55490025 100644
--- a/www/window/VerifyJobEdit.js
+++ b/www/window/VerifyJobEdit.js
@@ -86,7 +86,9 @@ Ext.define('PBS.window.VerifyJobEdit', {
xtype: 'pbsNamespaceMaxDepth',
name: 'max-depth',
fieldLabel: gettext('Max. Depth'),
- deleteEmpty: true,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
},
],
--
2.39.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [pbs-devel] applied-series: [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
` (6 preceding siblings ...)
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 6/6] ui: verify " Dominik Csapak
@ 2024-03-07 9:32 ` Thomas Lamprecht
7 siblings, 0 replies; 9+ messages in thread
From: Thomas Lamprecht @ 2024-03-07 9:32 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Dominik Csapak
Am 06/03/2024 um 12:20 schrieb Dominik Csapak:
> since a bit, i believe commit
> bae2cf75 (schema: AllOf/OneOf: actually perform additional_properties() check)
>
> in proxmox-schema, sending additional properties not defined for an api
> call is forbidden and leads to an error.
>
> Sadly, the gui did not adhere strictly to the api definition and
> sometimes sent more data that what was defined, now resulting in various
> api errors when using the gui.
>
> This series fixes those that i found (there are probably some that i
> missed).
>
> I did not include the whole detail why in every commit, but if that's
> preferred just holler and i add a sentence or two to every commmit.
>
> the first patch in proxmox-backup is just indentation cleanup and not
> really related, so could be applied independently.
>
> proxmox-widget-toolkit:
>
> Dominik Csapak (1):
> realms: don't send type and delete on creation
>
> src/window/AuthEditLDAP.js | 8 ++++----
> src/window/AuthEditOpenId.js | 10 ----------
> 2 files changed, 4 insertions(+), 14 deletions(-)
>
> proxmox-backup:
>
> Dominik Csapak (6):
> ui: prune job edit: indent fix
> ui: metrics: don't send digest when creating a new influxdbupd host
> ui: tape backup job: don't send delete value on creation
> ui: prune: fix sending invalid parameters
> ui: sync job: don't send delete value on creation
> ui: verify job: don't send delete value on creation
>
> www/datastore/Content.js | 1 +
> www/panel/PrunePanel.js | 2 +-
> www/tape/window/TapeBackupJob.js | 14 ++++++++++++++
> www/window/InfluxDbEdit.js | 20 +++++++++++---------
> www/window/PruneJobEdit.js | 11 ++++++++---
> www/window/SyncJobEdit.js | 14 +++++++++++++-
> www/window/VerifyJobEdit.js | 4 +++-
> 7 files changed, 51 insertions(+), 15 deletions(-)
>
applied-series, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-03-07 9:32 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-06 11:20 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH widget-toolkit 1/1] realms: don't send type and delete on creation Dominik Csapak
2024-03-06 11:20 ` [pbs-devel] [PATCH proxmox-backup 1/6] ui: prune job edit: indent fix Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 2/6] ui: metrics: don't send digest when creating a new influxdbupd host Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 3/6] ui: tape backup job: don't send delete value on creation Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 4/6] ui: prune: fix sending invalid parameters Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 5/6] ui: sync job: don't send delete value on creation Dominik Csapak
2024-03-06 11:21 ` [pbs-devel] [PATCH proxmox-backup 6/6] ui: verify " Dominik Csapak
2024-03-07 9:32 ` [pbs-devel] applied-series: [PATCH widget-toolkit/proxmox-backup] adapt to stricter api parameter checks Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox