2020-07-09 20:19:07 +00:00
{{ # if this .parseError }}
2018-08-21 19:07:45 +00:00
<div data-test-parse-error class="notification is-danger">
<h3 class="title is-4" data-test-parse-error-title>Parse Error</h3>
2020-07-09 20:19:07 +00:00
<p data-test-parse-error-message> {{ this .parseError }} </p>
2018-08-21 19:07:45 +00:00
</div>
{{ / if }}
2020-07-09 20:19:07 +00:00
{{ # if this .planError }}
2018-08-21 19:07:45 +00:00
<div data-test-plan-error class="notification is-danger">
<h3 class="title is-4" data-test-plan-error-title>Plan Error</h3>
2020-07-09 20:19:07 +00:00
<p data-test-plan-error-message> {{ this .planError }} </p>
2018-08-21 19:07:45 +00:00
</div>
{{ / if }}
2020-07-09 20:19:07 +00:00
{{ # if this .runError }}
2018-08-21 19:07:45 +00:00
<div data-test-run-error class="notification is-danger">
<h3 class="title is-4" data-test-run-error-title>Run Error</h3>
2020-07-09 20:19:07 +00:00
<p data-test-run-error-message> {{ this .runError }} </p>
2018-08-21 19:07:45 +00:00
</div>
{{ / if }}
2020-07-09 20:19:07 +00:00
{{ # if ( eq this .stage "editor" ) }}
2022-11-02 14:34:10 +00:00
<header class="run-job-header">
<h1 class="title is-3">Run a job</h1>
2023-02-02 15:37:40 +00:00
<p>
Paste or author HCL or JSON to submit to your cluster, or select from a list of templates. A plan will be requested before the job is submitted. You can also attach a job spec by uploading a job file or dragging & dropping a file to the editor.
</p>
2022-11-02 14:34:10 +00:00
</header>
2018-08-21 19:07:45 +00:00
<div class="boxed-section">
<div class="boxed-section-head">
Job Definition
2020-07-09 20:19:07 +00:00
{{ # if this .cancelable }}
2022-03-08 17:28:36 +00:00
<button
class="button is-light is-compact pull-right"
onclick= {{ action this .onCancel }}
data-test-cancel-editing
type="button"
>Cancel</button>
2018-08-21 23:45:53 +00:00
{{ / if }}
2018-08-21 19:07:45 +00:00
</div>
<div class="boxed-section-body is-full-bleed">
2022-07-04 20:47:58 +00:00
<div
2018-08-21 19:07:45 +00:00
data-test-editor
2022-07-04 20:47:58 +00:00
{{ code-mirror
screenReaderLabel="Job definition"
content=this.job._newDefinition
2018-08-21 19:07:45 +00:00
theme="hashi"
2022-07-04 20:47:58 +00:00
onUpdate=this.updateCode
mode="javascript"
2022-03-08 17:28:36 +00:00
}}
/>
2018-08-21 19:07:45 +00:00
</div>
</div>
2022-11-02 14:34:10 +00:00
2023-02-02 15:37:40 +00:00
<div class="is-associative buttonset">
<Hds::Button
{{ on "click" ( perform this .plan ) }}
2022-03-08 17:28:36 +00:00
disabled= {{ or this .plan .isRunning ( not this .job ._newDefinition ) }}
data-test-plan
2023-02-02 15:37:40 +00:00
@text="Plan"
/>
2023-02-06 16:17:12 +00:00
{{ # if this .job .isNew }}
<Hds::ButtonSet>
<label class="job-spec-upload hds-button hds-button--color-secondary hds-button--size-medium">
<div class="hds-button__text">Upload file</div>
<input type="file" onchange= {{ action this .uploadJobSpec }} accept=".hcl,.json,.nomad" />
</label>
{{ # if ( can "write variable" path = "*" namespace = "*" ) }}
<Hds::Button @icon="file-plus" @text="Save as template" @color="tertiary" @route="jobs.run.templates.new" {{ on "click" this .handleSaveAsTemplate }} data-test-save-as-template />
<Hds::Button @icon="file-text" @text="Choose from a template" @color="tertiary" @route="jobs.run.templates" data-test-choose-template />
{{ / if }}
</Hds::ButtonSet>
{{ / if }}
2018-08-21 19:07:45 +00:00
</div>
{{ / if }}
2020-07-09 20:19:07 +00:00
{{ # if ( eq this .stage "plan" ) }}
{{ # if this .showPlanMessage }}
2018-08-21 19:07:45 +00:00
<div class="notification is-info">
<div class="columns">
<div class="column">
<h3 class="title is-4" data-test-plan-help-title>Job Plan</h3>
2022-03-08 17:28:36 +00:00
<p data-test-plan-help-message>This is the impact running this job
will have on your cluster.</p>
2018-08-21 19:07:45 +00:00
</div>
<div class="column is-centered is-minimum">
2023-02-02 15:37:40 +00:00
<Hds::Button @text="Okay" {{ on "click" ( toggle-action "showPlanMessage" this ) }} data-test-plan-help-dismiss />
2018-08-21 19:07:45 +00:00
</div>
</div>
</div>
{{ / if }}
<div class="boxed-section">
<div class="boxed-section-head">Job Plan</div>
<div class="boxed-section-body is-dark">
2022-03-08 17:28:36 +00:00
<JobDiff
data-test-plan-output
@diff= {{ this .planOutput .diff }}
@verbose= {{ false }}
/>
2018-08-21 19:07:45 +00:00
</div>
</div>
2022-03-08 17:28:36 +00:00
<div
class="boxed-section
{{ if this .planOutput .failedTGAllocs 'is-warning' 'is-primary' }} "
data-test-dry-run-message
>
2018-08-21 19:07:45 +00:00
<div class="boxed-section-head" data-test-dry-run-title>Scheduler dry-run</div>
<div class="boxed-section-body" data-test-dry-run-body>
2020-07-09 20:19:07 +00:00
{{ # if this .planOutput .failedTGAllocs }}
{{ # each this .planOutput .failedTGAllocs as | placementFailure | }}
2020-06-01 19:03:56 +00:00
<PlacementFailure @failedTGAlloc= {{ placementFailure }} />
2018-08-21 19:07:45 +00:00
{{ / each }}
{{ else }}
All tasks successfully allocated.
{{ / if }}
</div>
</div>
2022-03-08 17:28:36 +00:00
{{ # if
(and
this.planOutput.preemptions.isFulfilled this.planOutput.preemptions.length
)
}}
2019-04-16 19:13:33 +00:00
<div class="boxed-section is-warning" data-test-preemptions>
<div class="boxed-section-head" data-test-preemptions-title>
2022-03-08 17:28:36 +00:00
Preemptions (if you choose to run this job, these allocations will be
stopped)
2019-04-16 19:13:33 +00:00
</div>
<div class="boxed-section-body" data-test-preemptions-body>
2020-06-01 19:03:56 +00:00
<ListTable
2020-07-09 20:19:07 +00:00
@source= {{ this .planOutput .preemptions }}
2022-03-08 17:28:36 +00:00
@class="allocations is-isolated"
as |t|
>
2020-06-01 19:03:56 +00:00
<t.head>
2019-04-16 19:13:33 +00:00
<th class="is-narrow"></th>
<th>ID</th>
<th>Task Group</th>
<th>Created</th>
<th>Modified</th>
<th>Status</th>
<th>Version</th>
<th>Node</th>
2020-02-11 04:51:59 +00:00
<th>Volume</th>
2019-04-16 19:13:33 +00:00
<th>CPU</th>
<th>Memory</th>
2020-06-01 19:03:56 +00:00
</t.head>
<t.body as |row|>
<AllocationRow @allocation= {{ row .model }} @context="job" />
</t.body>
</ListTable>
2019-04-16 19:13:33 +00:00
</div>
</div>
{{ / if }}
2023-02-02 15:37:40 +00:00
<Hds::ButtonSet class="is-associative">
2023-02-06 16:17:12 +00:00
<Hds::Button @text="Run" {{ on "click" ( perform this .submit ) }} disabled= {{ this .submit .isRunning }} data-test-run />
<Hds::Button @color="secondary" @text="Cancel" {{ on "click" this .reset }} disabled= {{ this .submit .isRunning }} data-test-cancel />
2023-02-02 15:37:40 +00:00
</Hds::ButtonSet>
2018-08-21 19:07:45 +00:00
{{ / if }}