open-nomad/ui/app/components/policy-editor.hbs
Phil Renaud ce0ffdd077
[ui] Policies UI (#13976)
Co-authored-by: Mike Nomitch <mail@mikenomitch.com>
2022-12-06 12:45:36 -05:00

61 lines
1.1 KiB
Handlebars

<form class="edit-policy" autocomplete="off" {{on "submit" this.save}}>
{{#if @policy.isNew }}
<label>
<span>
Policy Name
</span>
<Input
data-test-policy-name-input
@type="text"
@value={{@policy.name}}
class="input"
{{autofocus}}
/>
</label>
{{/if}}
<div class="boxed-section">
<div class="boxed-section-head">
Policy Definition
</div>
<div class="boxed-section-body is-full-bleed">
<div
class="policy-editor"
data-test-policy-editor
{{code-mirror
screenReaderLabel="Policy definition"
theme="hashi"
mode="ruby"
content=@policy.rules
onUpdate=this.updatePolicyRules
autofocus=(not @policy.isNew)
extraKeys=(hash Cmd-Enter=this.save)
}} />
</div>
</div>
<div>
<label>
<span>
Description (optional)
</span>
<Input
data-test-policy-description
@value={{@policy.description}}
class="input"
/>
</label>
</div>
<footer>
{{#if (can "update policy")}}
<button
class="button is-primary"
type="submit"
>
Save Policy
</button>
{{/if}}
</footer>
</form>