github.com/hernad/nomad@v1.6.112/ui/app/templates/policies/policy.hbs (about) 1 {{! 2 Copyright (c) HashiCorp, Inc. 3 SPDX-License-Identifier: MPL-2.0 4 ~}} 5 6 <Breadcrumb @crumb={{hash label=this.policy.name args=(array "policies.policy" this.policy.name)}} /> 7 {{page-title "Policy"}} 8 <section class="section"> 9 <h1 class="title with-flex" data-test-title> 10 <div> 11 {{this.policy.name}} 12 </div> 13 {{#if (can "destroy policy")}} 14 <div> 15 <TwoStepButton 16 data-test-delete-button 17 @idleText="Delete policy" 18 @cancelText="Cancel" 19 @confirmText="Yes, delete" 20 @confirmationMessage="Are you sure?" 21 @awaitingConfirmation={{this.deletePolicy.isRunning}} 22 @onConfirm={{perform this.deletePolicy}} 23 @onPrompt={{this.onDeletePrompt}} 24 @onCancel={{this.onDeleteCancel}} 25 /> 26 </div> 27 {{/if}} 28 </h1> 29 <PolicyEditor 30 @policy={{this.policy}} 31 /> 32 33 {{#if (can "list token")}} 34 <hr /> 35 36 <h2 class="title"> 37 Tokens 38 </h2> 39 40 {{#if (can "write token")}} 41 <div class="token-operations"> 42 <div class="boxed-section"> 43 <div class="boxed-section-head"> 44 <h3>Create a Test Token</h3> 45 </div> 46 <div class="boxed-section-body"> 47 <p class="is-info">Create a test token that expires in 10 minutes for testing purposes.</p> 48 <label> 49 <button 50 type="button" 51 class="button is-info is-outlined create-test-token" 52 data-test-create-test-token 53 {{on "click" (perform this.createTestToken)}} 54 >Create Test Token</button> 55 </label> 56 </div> 57 </div> 58 <div class="boxed-section"> 59 <div class="boxed-section-head"> 60 <h3>Create Tokens from the Nomad CLI</h3> 61 </div> 62 <div class="boxed-section-body"> 63 <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/docs/commands" target="_blank" rel="noopener noreferrer">Nomad CLI <FlightIcon @name="external-link" /></a> with the following: 64 <pre> 65 <code>{{this.newTokenString}}</code> 66 <CopyButton 67 data-test-copy-button 68 @clipboardText={{this.newTokenString}} 69 @compact={{true}} 70 > 71 </CopyButton> 72 </pre> 73 </p> 74 </div> 75 </div> 76 </div> 77 {{/if}} 78 79 {{#if this.tokens.length}} 80 <ListTable 81 @source={{this.tokens}} 82 @class="tokens no-mobile-condense" as |t|> 83 <t.head> 84 <th>Name</th> 85 <th>Created</th> 86 <th>Expires</th> 87 {{#if (can "destroy token")}} 88 <th>Delete</th> 89 {{/if}} 90 </t.head> 91 <t.body as |row|> 92 <tr data-test-policy-token-row> 93 <td data-test-token-name> 94 <Tooltip @text={{row.model.id}}> 95 {{row.model.name}} 96 </Tooltip> 97 </td> 98 <td> 99 {{moment-from-now row.model.createTime interval=1000}} 100 </td> 101 <td> 102 {{#if row.model.expirationTime}} 103 <Tooltip @text={{row.model.expirationTime}}> 104 <span data-test-token-expiration-time class="{{if row.model.isExpired "has-text-danger"}}">{{moment-from-now row.model.expirationTime interval=1000}}</span> 105 </Tooltip> 106 {{else}} 107 <span class="has-text-grey">Never</span> 108 {{/if}} 109 </td> 110 {{#if (can "destroy token")}} 111 <td class="is-200px"> 112 <TwoStepButton 113 data-test-delete-token-button 114 @idleText="Delete" 115 @cancelText="Cancel" 116 @confirmText="Yes, delete" 117 @confirmationMessage="Are you sure?" 118 @awaitingConfirmation={{row.model.isPendingDeletion}} 119 @onConfirm={{perform this.deleteToken row.model}} 120 @inlineText={{true}} 121 @classes={{hash 122 idleButton="is-danger is-outlined" 123 confirmButton="is-danger" 124 }} 125 /> 126 </td> 127 {{/if}} 128 </tr> 129 </t.body> 130 </ListTable> 131 {{else}} 132 <div class="empty-message"> 133 <h3 data-test-empty-policies-list-headline class="empty-message-headline"> 134 No Tokens 135 </h3> 136 <p class="empty-message-body"> 137 No tokens are using this policy. 138 </p> 139 </div> 140 {{/if}} 141 {{/if}} 142 143 </section> 144 145 {{outlet}}