08d97a19ca
* ui: Toggle for `read-only` view (#16279) * ui: model update for specification * style: add styling for select * style: add styling for select * refact: add spec to view * refact: update component API * test: refactor for new UI state * refact: clean conditional * refact: update component API for prop * chore: correct naming * chore: remove `fn` helper Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com> * update `default` Mirage scenario (#16496) * chore: update mirage scenario: * ui: conditionally render toggle button (#16497) * chore: update css variable name (#16498) --------- Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com> * ui: Display JSON view of variables associated to job specification (#16570) * chore: move fixture to util * chore: update tests: * ui: display variables table * chore: add mirage fixture (#16572) * ui: regex for job spec parse (#16668) * ui: remove variable table (#16670) * ui: notify user if specification has variables (#16671) * ui: regex for job spec parse * chore: deprecate variable references * chore: update mirage * ui: add notification * test: add test coverage for parse method (#16590) * refact: `JobEditor` reactive query parameters (#16710) * refact: add query parameter * refact: move toggle action to controller * ui: remove toggle behavior in `JobEditor` (#16711) * refact: rename logic for select * chore: instantiate qp in route * refact: uniform alerts (#16715) * style: buffer between alert and header * refact: extract alerts into a component * chore: update tests for qp * chore: defensive logic for app controller * refact: move `edit` state to controller (#16725) * refact: move edit state to controller * refact: handle edit state (#16731) * refact: handle edit state * ui: warning message (#16732) * ui: warning message * ui: enable editing of HCL vars in the UI (#16734) * enable editing of HCL vars * refact: default qp logic * refact: alert condition * refact: Pass `variables` as string (#16849) * ui: Toggle for `read-only` view (#16279) * ui: model update for specification * style: add styling for select * style: add styling for select * refact: add spec to view * refact: update component API * test: refactor for new UI state * refact: clean conditional * refact: update component API for prop * chore: correct naming * chore: remove `fn` helper Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com> * update `default` Mirage scenario (#16496) * chore: update mirage scenario: * ui: conditionally render toggle button (#16497) * chore: update css variable name (#16498) --------- Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com> * refact: `JobEditor` reactive query parameters (#16710) * refact: add query parameter * refact: move toggle action to controller * ui: remove toggle behavior in `JobEditor` (#16711) * refact: rename logic for select * chore: instantiate qp in route * refact: uniform alerts (#16715) * style: buffer between alert and header * refact: extract alerts into a component * chore: update tests for qp * chore: defensive logic for app controller * refact: move `edit` state to controller (#16725) * refact: move edit state to controller * refact: handle edit state (#16731) * refact: handle edit state * ui: warning message (#16732) * ui: warning message * ui: enable editing of HCL vars in the UI (#16734) * enable editing of HCL vars * refact: default qp logic * refact: alert condition * refact: variables as string * style: revert styling change --------- Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com> * bug: correctly edit variables (#16989) * ui: visualize variables (#16987) * ui: fetchRawSpecification * refact: integrate new model method * test: fetchRaw unit * styling: enable height on cm * chore: update copy * feat: visual variables * chore: conditional render info txt * refact: add mirage endpoint * refact: update test for new schema * refact: job submit flow (#17015) * refact: job update logic * chore: remove dead code * bug: update `job.run` and `job.update` adapter methods (#17055) * refact: update adapter * chore: update api usage * styling: UX requests (#17064) * refact: update adapter * chore: update api usage * styling: disable toggle w text * styling: stick button * style: space out alerts * chore: autofocus on first editor * bug: dismiss alert * chore: add jsdoc and assertion check * chore: update mirage for Vercel (#17054) * chore: mirage logic for vercel deploy * chore: update test for mirage change * refact: API refactoring (#17083) * refact: udpate for req schema * refact: update for variable flags and literal * bug: visualize job model not derived state * chore: update copy * chore: fix incorrect copy * chore: deprecate variables derived state * chore: update copy * feat: enable toggle on edit * chore: prettify * refact: move conditional --------- Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com>
119 lines
3.5 KiB
Handlebars
119 lines
3.5 KiB
Handlebars
<div class="boxed-section">
|
|
<div class="boxed-section-head">
|
|
Job Definition
|
|
{{#if @data.cancelable}}
|
|
<div class="pull-right" style="display: flex">
|
|
<Tooltip
|
|
@condition={{unless @data.hasSpecification true false}}
|
|
@isFullText={{true}}
|
|
@text="A jobspec file was not submitted when this job was run. You can still view and edit the expanded JSON format."
|
|
>
|
|
<div
|
|
class="job-definition-select
|
|
{{unless @data.hasSpecification ' disabled'}}"
|
|
data-test-select={{@data.view}}
|
|
>
|
|
<button
|
|
class="button is-small is-borderless
|
|
{{if (eq @data.view 'job-spec') 'is-active'}}"
|
|
type="button"
|
|
{{on "click" (fn @fns.onSelect "job-spec")}}
|
|
>
|
|
Job Spec
|
|
</button>
|
|
<button
|
|
class="button is-small is-borderless
|
|
{{if (eq @data.view 'full-definition') 'is-active'}}"
|
|
type="button"
|
|
{{on "click" (fn @fns.onSelect "full-definition")}}
|
|
data-test-select-full
|
|
>
|
|
Full Definition
|
|
</button>
|
|
</div>
|
|
</Tooltip>
|
|
<button
|
|
class="button is-light is-compact pull-right"
|
|
onclick={{@fns.onCancel}}
|
|
type="button"
|
|
data-test-cancel-editing
|
|
>
|
|
Cancel
|
|
</button>
|
|
</div>
|
|
{{/if}}
|
|
</div>
|
|
<div class="boxed-section-body is-full-bleed">
|
|
<div
|
|
data-test-editor
|
|
{{code-mirror
|
|
screenReaderLabel="Job definition"
|
|
content=@data.job._newDefinition
|
|
theme="hashi"
|
|
onUpdate=@fns.onUpdate
|
|
mode=(if (eq @data.format "json") "javascript" "ruby")
|
|
}}
|
|
></div>
|
|
</div>
|
|
{{#if (eq @data.view "job-spec")}}
|
|
<div class="boxed-section" style="margin-top: 10px">
|
|
<div class="boxed-section-head">
|
|
Edit HCL Variable Values
|
|
</div>
|
|
<div class="boxed-section-body is-full-bleed">
|
|
<div
|
|
class="json-viewer is-variable-editor"
|
|
data-test-variable-editor
|
|
{{code-mirror
|
|
autofocus=false
|
|
screenReaderLabel="HLC Variables for Job Spec"
|
|
content=@data.job._newDefinitionVariables
|
|
theme="hashi"
|
|
onUpdate=@fns.onUpdate
|
|
type="hclVariables"
|
|
mode="ruby"
|
|
}}
|
|
></div>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
</div>
|
|
<div class="is-associative buttonset sticky">
|
|
<Hds::Button
|
|
{{on "click" (perform @fns.onPlan)}}
|
|
disabled={{or @fns.onPlan.isRunning (not @data.job._newDefinition)}}
|
|
data-test-plan
|
|
@text="Plan"
|
|
/>
|
|
{{#if @data.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 @fns.onUpload}}
|
|
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" @fns.onSaveAs}}
|
|
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}}
|
|
</div> |