github.com/outbrain/consul@v1.4.5/ui-v2/app/templates/dc/kv/-form.hbs (about) 1 <form> 2 <fieldset> 3 {{#if create }} 4 <label class="type-text{{if item.error.Key ' has-error'}}"> 5 <span>Key or folder</span> 6 <input autofocus="autofocus" type="text" value={{left-trim item.Key parent.Key}} name="additional" oninput={{action 'change'}} placeholder="Key or folder" /> 7 <em>To create a folder, end a key with <code>/</code></em> 8 </label> 9 {{/if}} 10 {{#if (or (eq (left-trim item.Key parent.Key) '') (not-eq (last item.Key) '/')) }} 11 <div> 12 <div class="type-toggle"> 13 <label> 14 <input type="checkbox" name="json" checked={{if json 'checked' }} onchange={{action 'change'}} /> 15 <span>Code</span> 16 </label> 17 </div> 18 <label class="type-text{{if item.error.Value ' has-error'}}"> 19 <span>Value</span> 20 {{#if json}} 21 {{ code-editor value=(atob item.Value) onkeyup=(action 'change') }} 22 {{else}} 23 <textarea autofocus={{not create}} name="value" oninput={{action 'change'}}>{{atob item.Value}}</textarea> 24 {{/if}} 25 </label> 26 </div> 27 {{/if}} 28 </fieldset> 29 {{!TODO This has a <div> around it in acls, remove or add for consistency }} 30 {{#if create }} 31 {{! we only need to check for an empty keyname here as ember munges autofocus, once we have autofocus back revisit this}} 32 <button type="submit" {{ action "create" item parent}} disabled={{if (or item.isPristine item.isInvalid (eq (left-trim item.Key parent.Key) '')) 'disabled'}}>Save</button> 33 {{ else }} 34 <button type="submit" {{ action "update" item parent}} disabled={{if item.isInvalid 'disabled'}}>Save</button> 35 <button type="reset" {{ action "cancel" item parent}}>Cancel changes</button> 36 {{#confirmation-dialog message='Are you sure you want to delete this key?'}} 37 {{#block-slot 'action' as |confirm|}} 38 <button data-test-delete type="button" class="type-delete" {{action confirm 'delete' item parent}}>Delete</button> 39 {{/block-slot}} 40 {{#block-slot 'dialog' as |execute cancel message|}} 41 {{delete-confirmation message=message execute=execute cancel=cancel}} 42 {{/block-slot}} 43 {{/confirmation-dialog}} 44 {{/if}} 45 </form> 46