open-nomad/ui/app/components/metadata-kv.hbs
Phil Renaud 11de45d17b
[ui] Copyable server and client attribute values (#16548)
* Copyable server and client attribute values

* Changelog
2023-03-22 15:05:01 -04:00

69 lines
1.9 KiB
Handlebars

<tr data-test-attributes-section>
{{#if this.editing}}
<td colspan="2">
<MetadataEditor
@kv={{hash key=this.prefixedKey value=this.value}}
@onEdit={{this.onEdit}}
@constantKey={{true}}
@autofocusValue={{true}}
>
<button
data-test-update-metadata
disabled={{or (not @key) (not @value)}}
type="submit"
class="button is-primary"
{{on "click" (queue
(action @onKVSave (hash key=this.prefixedKey value=this.value))
(action (mut this.editing) false)
)}}
>
Update {{this.prefixedKey}}
</button>
<button
data-test-delete-metadata
type="button"
class="button is-danger"
{{on "click" (queue
(action @onKVSave (hash key=this.prefixedKey value=null))
(action (mut this.editing) false)
)}}
>
Delete Property
</button>
<button
data-test-cancel-metadata
type="button"
class="button"
{{on "click"
(queue
(action (mut this.editing) false)
(action (mut this.value) @value)
)
}}
>
Cancel
</button>
</MetadataEditor>
</td>
{{else}}
<td data-test-key>
{{#if @prefix}}<span class="is-faded" data-test-prefix>{{@prefix}}.</span>{{/if}}
{{~@key}}
</td>
<td title="{{@value}}">
<CopyButton
@inset={{true}}
@compact={{true}}
@clipboardText={{@value}}
/>
<span data-test-value>{{@value}}</span>
{{#if @editable}}
<button class="button is-light is-compact edit-existing-metadata-button" type="button"
{{on "click" (action (mut this.editing) true)}}
>Edit</button>
{{/if}}
</td>
{{/if}}
</tr>