Repository navigation
ui - add an export domain button to download the domain as json - #3575
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
Collaborator
|
What's the use case for users to have the capability to download the domain data as json through the UI instead of just using zms-cli? |
Contributor
Author
|
It's what #1382 asked for: a button on the domain page that downloads the domain as json. It's mainly for people who work in the UI and don't have zms-cli set up but want a quick snapshot of a domain's full config, for a backup or for review. |
The domain pages had no way to get a full copy of a domain's
configuration from the UI. ZMS already returns every role, group,
policy, service and entity of a domain through the signed domain
api (GET /domain/{name}/signed), so the UI can offer it as a
download without adding anything to ZMS.
- server: new domain-export fetchr service that calls getJWSDomain,
decodes the base64url payload and returns the DomainData object.
A payload that cannot be decoded is reported as a 500 instead of
throwing inside the callback.
- client: new exportDomain(domainName) api call.
- DomainDetails: new Export Domain button that saves the domain
data as <domain>.json, pretty printed. A failed export is shown
in a dismissable alert.
Tests cover the fetchr service (success, ZMS error and bad
payload), the client api call, and the download and error paths
of the button. The domain page snapshots now include the button.
Fixes AthenZ#1382
Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
NopeCharon
force-pushed
the
ui-export-domain-json
branch
from
November 2, 2026 07:57
187402f to
39c0782
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1382.
The domain pages had no way to get a full copy of a domain's configuration from the UI. ZMS already returns every role, group, policy, service and entity of a domain through the signed domain API (
GET /domain/{name}/signed), so the UI can offer it as a download without any ZMS change.Changes:
server/handlers/api.js: a newdomain-exportfetchr service callsgetJWSDomain, decodes the base64url payload and returns theDomainDataobject. If the payload can't be decoded, the service returns a 500 instead of throwing inside the callback.api.js: a newexportDomain(domainName)call.DomainDetails: a new Export Domain button next to "More Details" on the domain pages. It saves the domain data as a pretty-printed<domain>.json. If the export fails, the error appears in a dismissable alert.Tests:
handlers/api.test.js: covers the fetchr service for success, a ZMS error and a payload that can't be decoded.api.test.js: covers the client call.DomainDetails.test.js: checks the downloaded file's name, type and content, and checks the error alert.Without the source changes, the new tests fail. I ran the jest suites for
api,handlers/api,DomainDetailsand allpages/domain/[domain]pages, and checked the changed files with prettier (ci-lint).Contribution Checklist:
Attach Screenshots (Optional)