github.com/hernad/nomad@v1.6.112/ui/app/templates/components/job-editor/edit.hbs (about) 1 {{! 2 Copyright (c) HashiCorp, Inc. 3 SPDX-License-Identifier: MPL-2.0 4 ~}} 5 6 <div class="boxed-section"> 7 <div class="boxed-section-head"> 8 Job Definition 9 {{#if @data.cancelable}} 10 <div class="pull-right" style="display: flex"> 11 <span class="header-toggle"> 12 <Hds::Form::Toggle::Field 13 {{keyboard-shortcut label="Toggle word wrap" action=(action @fns.onToggleWrap) pattern=(array "w" "w") menuLevel=true }} 14 checked={{@data.shouldWrap}} 15 {{on "change" @fns.onToggleWrap}} 16 as |F|> 17 <F.Label>Word Wrap</F.Label> 18 </Hds::Form::Toggle::Field> 19 </span> 20 <Tooltip 21 @condition={{unless @data.hasSpecification true false}} 22 @isFullText={{true}} 23 @text="A jobspec file was not submitted when this job was run. You can still view and edit the expanded JSON format." 24 > 25 <div 26 class="job-definition-select 27 {{unless @data.hasSpecification ' disabled'}}" 28 data-test-select={{@data.view}} 29 > 30 <button 31 class="button is-small is-borderless 32 {{if (eq @data.view 'job-spec') 'is-active'}}" 33 type="button" 34 {{on "click" (fn @fns.onSelect "job-spec")}} 35 > 36 Job Spec 37 </button> 38 <button 39 class="button is-small is-borderless 40 {{if (eq @data.view 'full-definition') 'is-active'}}" 41 type="button" 42 {{on "click" (fn @fns.onSelect "full-definition")}} 43 data-test-select-full 44 > 45 Full Definition 46 </button> 47 </div> 48 </Tooltip> 49 <button 50 class="button is-light is-compact pull-right" 51 onclick={{@fns.onCancel}} 52 type="button" 53 data-test-cancel-editing 54 > 55 Cancel 56 </button> 57 </div> 58 {{/if}} 59 </div> 60 <div class="boxed-section-body is-full-bleed"> 61 <div 62 data-test-editor 63 {{code-mirror 64 screenReaderLabel="Job definition" 65 content=@data.job._newDefinition 66 theme="hashi" 67 onUpdate=@fns.onUpdate 68 mode=(if (eq @data.format "json") "javascript" "ruby") 69 lineWrapping=@data.shouldWrap 70 }} 71 ></div> 72 </div> 73 {{#if (eq @data.view "job-spec")}} 74 <div class="boxed-section" style="margin-top: 10px"> 75 <div class="boxed-section-head"> 76 Edit HCL Variable Values 77 </div> 78 <div class="boxed-section-body is-full-bleed"> 79 <div 80 class="json-viewer is-variable-editor" 81 data-test-variable-editor 82 {{code-mirror 83 autofocus=false 84 screenReaderLabel="HLC Variables for Job Spec" 85 content=@data.job._newDefinitionVariables 86 theme="hashi" 87 onUpdate=@fns.onUpdate 88 type="hclVariables" 89 mode="ruby" 90 lineWrapping=@data.shouldWrap 91 }} 92 ></div> 93 </div> 94 </div> 95 {{/if}} 96 </div> 97 <Hds::ButtonSet class="is-associative buttonset sticky pull-left"> 98 <Hds::Button 99 {{on "click" (perform @fns.onPlan)}} 100 disabled={{or @fns.onPlan.isRunning (not @data.job._newDefinition)}} 101 data-test-plan 102 @text="Plan" 103 /> 104 {{#if @data.job.isNew}} 105 <Hds::Button 106 @text="Save as template" 107 @color="secondary" 108 @route="jobs.run.templates.new" 109 {{on "click" @fns.onSaveAs}} 110 data-test-save-as-template 111 /> 112 {{/if}} 113 <Hds::Button 114 @text="Save as .nomad.hcl" 115 @color="secondary" 116 {{on "click" @fns.onSaveFile}} 117 118 /> 119 </Hds::ButtonSet>