Files
nomad/ui/app/templates/administration/roles/role.hbs
Aimee Ukasick a30cb2f137 Update UI, code comment, and README links to docs, tutorials (#26429)
* Update UI, code comment, and README links to docs, tutorials

* fix typo in ephemeral disks learn more link url

* feedback on typo

Co-authored-by: Tim Gross <tgross@hashicorp.com>

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2025-08-06 09:40:23 -05:00

133 lines
4.2 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}
<Breadcrumb @crumb={{hash label=this.role.name args=(array "administration.roles.role" this.role.id)}} />
{{page-title "Role"}}
<section class="section">
<Hds::PageHeader as |PH|>
<PH.Title data-test-title>
{{this.role.name}}
</PH.Title>
{{#if (can "destroy role")}}
<PH.Actions>
<TwoStepButton
data-test-delete-role
@alignRight={{true}}
@idleText="Delete Role"
@cancelText="Cancel"
@confirmText="Yes, Delete Role"
@confirmationMessage="Are you sure?"
@awaitingConfirmation={{this.deleteRole.isRunning}}
@disabled={{this.deleteRole.isRunning}}
@onConfirm={{perform this.deleteRole}}
/>
</PH.Actions>
{{/if}}
</Hds::PageHeader>
<RoleEditor
@role={{this.role}}
@policies={{this.policies}}
/>
{{#if (can "list token")}}
<hr />
<h2 class="title">
Tokens
</h2>
{{#if (can "write token")}}
<div class="token-operations">
<div class="boxed-section">
<div class="boxed-section-head">
<h3>Create a Test Token</h3>
</div>
<div class="boxed-section-body">
<p class="is-info">Create a test token that expires in 10 minutes for testing purposes.</p>
<label>
<Hds::Button @text="Create Test Token" @color="secondary"
data-test-create-test-token
class="create-test-token"
{{on "click" (perform this.createTestToken)}}
/>
</label>
</div>
</div>
<div class="boxed-section">
<div class="boxed-section-head">
<h3>Create Tokens from the Nomad CLI</h3>
</div>
<div class="boxed-section-body">
<p>When you're ready to create more tokens, you can do so via the <a class="external-link" href="https://developer.hashicorp.com/nomad/commands" target="_blank" rel="noopener noreferrer">Nomad CLI <Hds::Icon @name="external-link" @isInline={{true}} /></a> with the following:
<pre>
<code>{{this.newTokenString}}</code>
<CopyButton
data-test-copy-button
@clipboardText={{this.newTokenString}}
@compact={{true}}
>
</CopyButton>
</pre>
</p>
</div>
</div>
</div>
{{/if}}
{{#if this.tokens.length}}
<ListTable
@source={{this.tokens}}
@class="tokens no-mobile-condense" as |t|>
<t.head>
<th>Name</th>
<th>Created</th>
<th>Expires</th>
{{#if (can "destroy token")}}
<th>Delete</th>
{{/if}}
</t.head>
<t.body as |row|>
<tr data-test-role-token-row>
<td data-test-token-name>
<Tooltip @text={{row.model.id}}>
{{row.model.name}}
</Tooltip>
</td>
<td>
{{moment-from-now row.model.createTime interval=1000}}
</td>
<td>
{{#if row.model.expirationTime}}
<Tooltip @text={{row.model.expirationTime}}>
<span data-test-token-expiration-time class="{{if row.model.isExpired "has-text-danger"}}">{{moment-from-now row.model.expirationTime interval=1000}}</span>
</Tooltip>
{{else}}
<span>Never</span>
{{/if}}
</td>
{{#if (can "destroy token")}}
<td class="is-200px">
<Hds::Button @text="Delete Token" @color="critical"
data-test-delete-token-button
{{on "click" (perform this.deleteToken row.model)}}
/>
</td>
{{/if}}
</tr>
</t.body>
</ListTable>
{{else}}
<div class="empty-message">
<h3 data-test-empty-role-list-headline class="empty-message-headline">
No Tokens
</h3>
<p class="empty-message-body">
No tokens are using this role.
</p>
</div>
{{/if}}
{{/if}}
</section>