Skip to content

Commit

Permalink
Fix editing and saving of configs on the Config Management page
Browse files Browse the repository at this point in the history
  • Loading branch information
rgallettonf committed Jun 10, 2024
1 parent 1906044 commit 10a304d
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ export class ZacWrapperService extends ZacWrapperServiceClass {
}
}
}
saveParams.data = this.redefineObject(saveParams.data);
for (const prop in saveParams.data) {
if (Array.isArray(saveParams.data[prop]) && saveParams.data[prop].length == 0) {
delete saveParams.data[prop];
Expand Down Expand Up @@ -812,6 +813,26 @@ export class ZacWrapperService extends ZacWrapperServiceClass {
});
}

redefineObject(obj) {
for (let prop in obj) {
if (Array.isArray(obj[prop]) && obj[prop].length==0) {
delete obj[prop];
} else {
if (typeof obj[prop] === "string" && obj[prop].trim().length==0) {
delete obj[prop];
} else {
if (typeof obj[prop] === "object") {
obj[prop] = this.redefineObject(obj[prop]);
if (Object.keys(obj[prop]).length==0) {
delete obj[prop];
}
}
}
}
}
return obj;
}

saveZitiSubData(params: any, returnTo: any) {
const controllerDomain = this.settingsService?.settings?.selectedEdgeController || '';
const serviceUrl = `${controllerDomain}/edge/management/v1`;
Expand Down

0 comments on commit 10a304d

Please sign in to comment.