Skip to content
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

[ui] Read from localStorage to display a copyable access token and secret #22105

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/22105.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Adds a copyable token accessor/secret on the settings page when signed in
```
28 changes: 28 additions & 0 deletions ui/packages/consul-ui/app/templates/settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ as |item|}}
<A.Title>Local Storage</A.Title>
<A.Description>These settings are immediately saved to local storage and persisted through browser usage.</A.Description>
</Hds::Alert>

<DataSource
@src={{uri "settings://consul:token"}}
@onchange={{action (mut token) value="data"}}
@onerror={{action (mut error) value="error"}}
/>
{{#if error}}
<Hds::Alert @type="inline" @color="highlight" class="mb-3 mt-2" @icon="token" as |A|>
<A.Title>Error loading token</A.Title>
<A.Description>
{{error.message}}
</A.Description>
</Hds::Alert>
{{/if}}
{{#if token}}
<Hds::Alert @type="inline" @color="highlight" class="mb-3 mt-2" @icon="token" as |A|>
<A.Title>Your Access Token</A.Title>
<A.Description>
<Hds::Form::MaskedInput::Field readonly @isContentMasked={{false}} @hasCopyButton={{true}} @value={{token.AccessorID}} as |F|>
<F.Label>Accessor ID</F.Label>
</Hds::Form::MaskedInput::Field>
<Hds::Form::MaskedInput::Field readonly @hasCopyButton={{true}} @value={{token.SecretID}} as |F|>
<F.Label>Secret ID</F.Label>
</Hds::Form::MaskedInput::Field>
</A.Description>
</Hds::Alert>
{{/if}}

<form>
{{#if (not (env 'CONSUL_UI_DISABLE_REALTIME'))}}
<Disclosure as |disclosure|>
Expand Down