github.com/hernad/nomad@v1.6.112/ui/app/templates/variables/variable/index.hbs (about) 1 {{! 2 Copyright (c) HashiCorp, Inc. 3 SPDX-License-Identifier: MPL-2.0 4 ~}} 5 6 <h1 class="variable-title title with-flex"> 7 <div> 8 <FlightIcon @name="file-text" /> 9 {{this.model.path}} 10 <CopyButton 11 @inset={{true}} 12 @compact={{true}} 13 @clipboardText={{this.model.path}} 14 /> 15 16 <Toggle 17 {{keyboard-shortcut 18 label="Toggle View (JSON/List)" 19 pattern=(array "j") 20 action=(action this.toggleView) 21 }} 22 data-test-memory-toggle 23 @isActive={{eq this.view "json"}} 24 @onToggle={{action this.toggleView}} 25 title="JSON" 26 >JSON</Toggle> 27 </div> 28 <div> 29 {{#unless this.isDeleting}} 30 {{#if (can "write variable" path=this.model.path namespace=this.model.namespace)}} 31 <div class="two-step-button"> 32 <LinkTo 33 {{autofocus}} 34 data-test-edit-button 35 class="button is-info is-inverted is-small" 36 @model={{this.model}} 37 @route="variables.variable.edit" 38 @query={{hash view=this.view}} 39 > 40 Edit 41 </LinkTo> 42 </div> 43 {{/if}} 44 {{/unless}} 45 {{#if (can "destroy variable" path=this.model.path namespace=this.model.namespace)}} 46 <TwoStepButton 47 data-test-delete-button 48 @alignRight={{true}} 49 @idleText="Delete" 50 @cancelText="Cancel" 51 @confirmText="Yes, delete" 52 @confirmationMessage="Are you sure you want to delete this variable and all its items?" 53 @awaitingConfirmation={{this.deleteVariableFile.isRunning}} 54 @onConfirm={{perform this.deleteVariableFile}} 55 @onPrompt={{this.onDeletePrompt}} 56 @onCancel={{this.onDeleteCancel}} 57 /> 58 {{/if}} 59 </div> 60 </h1> 61 62 {{#if this.shouldShowLinkedEntities}} 63 <VariableForm::RelatedEntities 64 @job={{this.model.pathLinkedEntities.job}} 65 @group={{this.model.pathLinkedEntities.group}} 66 @task={{this.model.pathLinkedEntities.task}} 67 @namespace={{this.model.namespace}} 68 /> 69 {{/if}} 70 71 {{#if (eq this.view "json")}} 72 <div class="boxed-section"> 73 <div class="boxed-section-head"> 74 Key/Value Data 75 <CopyButton 76 class="pull-right" 77 @compact={{true}} 78 @border={{true}} 79 @clipboardText={{stringify-object this.model.items}} 80 /> 81 </div> 82 <div class="boxed-section-body is-full-bleed"> 83 <JsonViewer @json={{this.model.items}} /> 84 </div> 85 </div> 86 {{else}} 87 <ListTable class="variable-items" @source={{this.sortedKeyValues}} @sortProperty={{this.sortProperty}} @sortDescending={{this.sortDescending}} as |t|> 88 <t.head> 89 <t.sort-by @prop="key">Key</t.sort-by> 90 <t.sort-by @prop="value">Value</t.sort-by> 91 </t.head> 92 <t.body as |row|> 93 <tr data-test-var={{row.model.key}}> 94 <td> 95 {{row.model.key}} 96 </td> 97 <td colspan="3" class="value-cell"> 98 <div> 99 <CopyButton 100 @compact={{true}} 101 @clipboardText={{row.model.value}} 102 /> 103 <button 104 class="show-hide-values button is-borderless is-compact" 105 type="button" 106 {{on "click" (action this.toggleRowVisibility row.model)}} 107 {{keyboard-shortcut 108 label="Toggle Variable Visibility" 109 pattern=(array "v") 110 action=(action this.toggleRowVisibility row.model) 111 }} 112 113 > 114 <FlightIcon 115 @name={{if row.model.isVisible "eye" "eye-off"}} 116 @title={{if row.model.isVisible "Hide Value" "Show Value"}} 117 /> 118 </button> 119 120 {{#if row.model.isVisible}} 121 <code>{{row.model.value}}</code> 122 {{else}} 123 ******** 124 {{/if}} 125 </div> 126 </td> 127 </tr> 128 </t.body> 129 </ListTable> 130 {{/if}}