open-nomad/ui/app/templates/components/job-dispatch.hbs
Phil Renaud c8455d34d4 Edit Secure Variables as JSON (#13461)
* Toying with insert and update helpers before translation func

* Working prototype that lets you switch between json and tabular

* No longer add the bonus items row in json mode

* Trimmed the ivy from the codemirror (#13503)

* Trimmed the ivy from the codemirror

* editedJSONItems removal

* De-debugger

* Replaced other instances of IvyCodeMirror throughout the app (#13528)

* Replaced other instances of IvyCodeMirror throughout the app

* PR requests for codemirror modifier

* Screen reader setting as param

* Trying a simpler codemirror test helper

* Lint removal

* Screen Reader Label added for a11y

* JSONViewer cleanup

* JSON editor added to /new and all variables stringified before save or translate

* Give users a foothold when editing an empty item in JSON mode

* Copy the empty KV

* No duplicate keys in KV

* Better handling of cursor snapping in json edit field

* Catch formatting errors on the fly

* Basic tests for JSON to Table and Table to JSON in form
2022-07-11 13:34:06 -04:00

76 lines
2.6 KiB
Handlebars

{{#if this.errors}}
<div data-test-dispatch-error class="notification is-danger">
<h3 class="title is-4" data-test-parse-error-title>Dispatch Error</h3>
<ul>
{{#each this.errors as |error|}}
<li>{{error}}</li>
{{/each}}
</ul>
</div>
{{/if}}
<form action="#" onsubmit="return false">
<h1 class="title">Dispatch an instance of '{{@job.name}}'</h1>
{{#each this.metaFields as |meta|}}
<div class="columns">
<div class="column is-6">
<div data-test-meta-field="{{ if meta.required "required" "optional" }}" class="field">
<label data-test-meta-field-label class="label {{if meta.error "has-text-danger"}}" for="{{meta.name}}">
{{meta.title}} {{#if meta.required}}*{{/if}}
</label>
<div class="control">
<input
data-test-meta-field-input
id="{{meta.name}}"
class="input {{if meta.error "is-danger"}}"
type="text"
value={{meta.value}}
oninput={{action (mut meta.value) value="target.value"}}
required={{meta.required}} >
<p class="help {{if meta.error "has-text-danger"}}">
{{#if meta.required}}Required{{else}}Optional{{/if}}
Meta Param
<span class="badge is-light is-faded">
<code>{{ meta.name }}</code>
</span>
</p>
</div>
</div>
</div>
</div>
{{/each}}
<div class="boxed-section {{if this.payloadHasError "is-danger"}}">
<div data-test-payload-head class="boxed-section-head">
Payload {{#if this.payloadRequired}}*{{/if}}
</div>
{{#if this.hasPayload}}
<div class="boxed-section-body is-full-bleed">
<div
data-test-payload-editor
{{code-mirror
theme="hashi"
onUpdate=(action (mut this.payload))
mode="javascript"
screenReaderLabel="Payload definition"
}}
/>
</div>
{{else}}
<div class="boxed-section-body">
<div data-test-empty-payload-message class="empty-message">
<h3 class="empty-message-headline">Payload Disabled</h3>
<p class="empty-message-body">Payload is disabled for this job.</p>
</div>
</div>
{{/if}}
</div>
<div>
<button data-test-dispatch-button class="button is-primary" type="button" onclick={{action "dispatch"}}>Dispatch</button>
<button data-test-cancel-button class="button is-white" type="button" onclick={{action "cancel"}}>Cancel</button>
</div>
</form>