-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix editing and saving of configs on the Config Management page #361
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: mattermost-ziti-webhook | ||
on: | ||
create: | ||
delete: | ||
issues: | ||
issue_comment: | ||
pull_request_review: | ||
pull_request_review_comment: | ||
pull_request: | ||
push: | ||
fork: | ||
release: | ||
|
||
jobs: | ||
mattermost-ziti-webhook: | ||
runs-on: ubuntu-latest | ||
name: POST Webhook | ||
if: github.repository_owner == 'openziti' && github.actor != 'dependabot[bot]' | ||
env: | ||
ZITI_LOG: 99 | ||
ZITI_NODEJS_LOG: 99 | ||
steps: | ||
- uses: openziti/ziti-webhook-action@main | ||
with: | ||
ziti-id: ${{ secrets.ZITI_MATTERMOST_IDENTITY }} | ||
webhook-url: ${{ secrets.ZITI_MATTERMOST_WEBHOOK_URL }} | ||
webhook-secret: ${{ secrets.ZITI_MATTERMOSTI_WEBHOOK_SECRET }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]; | ||
|
@@ -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]; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's no 'else' here. feels like a console.log or ... anything ? would be good here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are numbers covered? or just left the same? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Should be left the same |
||
} | ||
} | ||
} | ||
return obj; | ||
} | ||
|
||
saveZitiSubData(params: any, returnTo: any) { | ||
const controllerDomain = this.settingsService?.settings?.selectedEdgeController || ''; | ||
const serviceUrl = `${controllerDomain}/edge/management/v1`; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redefineObject
seems like a strange name to me. it feels more like aresetObject
to me, but maybe that's my weak js-foo?