github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/templates/components/job-editor.hbs (about) 1 {{#if this.parseError}} 2 <div data-test-parse-error class="notification is-danger"> 3 <h3 class="title is-4" data-test-parse-error-title>Parse Error</h3> 4 <p data-test-parse-error-message>{{this.parseError}}</p> 5 </div> 6 {{/if}} 7 {{#if this.planError}} 8 <div data-test-plan-error class="notification is-danger"> 9 <h3 class="title is-4" data-test-plan-error-title>Plan Error</h3> 10 <p data-test-plan-error-message>{{this.planError}}</p> 11 </div> 12 {{/if}} 13 {{#if this.runError}} 14 <div data-test-run-error class="notification is-danger"> 15 <h3 class="title is-4" data-test-run-error-title>Run Error</h3> 16 <p data-test-run-error-message>{{this.runError}}</p> 17 </div> 18 {{/if}} 19 20 {{#if (eq this.stage "editor")}} 21 22 <header class="run-job-header"> 23 <h1 class="title is-3">Run a job</h1> 24 <p>Paste or author HCL or JSON to submit to your cluster. 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> 25 <label class="job-spec-upload"> 26 <input type="file" onchange={{action this.uploadJobSpec}} accept=".hcl,.json,.nomad" /> 27 <span class="button">Upload a job spec file</span> 28 </label> 29 </header> 30 31 <div class="boxed-section"> 32 <div class="boxed-section-head"> 33 Job Definition 34 {{#if this.cancelable}} 35 <button 36 class="button is-light is-compact pull-right" 37 onclick={{action this.onCancel}} 38 data-test-cancel-editing 39 type="button" 40 >Cancel</button> 41 {{/if}} 42 </div> 43 <div class="boxed-section-body is-full-bleed"> 44 <div 45 data-test-editor 46 {{code-mirror 47 screenReaderLabel="Job definition" 48 content=this.job._newDefinition 49 theme="hashi" 50 onUpdate=this.updateCode 51 mode="javascript" 52 }} 53 /> 54 </div> 55 </div> 56 57 <div class="content is-associative"> 58 <button 59 class="button is-primary {{if this.plan.isRunning 'is-loading'}}" 60 type="button" 61 onclick={{perform this.plan}} 62 disabled={{or this.plan.isRunning (not this.job._newDefinition)}} 63 data-test-plan 64 >Plan</button> 65 </div> 66 {{/if}} 67 68 {{#if (eq this.stage "plan")}} 69 {{#if this.showPlanMessage}} 70 <div class="notification is-info"> 71 <div class="columns"> 72 <div class="column"> 73 <h3 class="title is-4" data-test-plan-help-title>Job Plan</h3> 74 <p data-test-plan-help-message>This is the impact running this job 75 will have on your cluster.</p> 76 </div> 77 <div class="column is-centered is-minimum"> 78 <button 79 class="button is-info" 80 onclick={{toggle-action "showPlanMessage" this}} 81 data-test-plan-help-dismiss 82 type="button" 83 >Okay</button> 84 </div> 85 </div> 86 </div> 87 {{/if}} 88 <div class="boxed-section"> 89 <div class="boxed-section-head">Job Plan</div> 90 <div class="boxed-section-body is-dark"> 91 <JobDiff 92 data-test-plan-output 93 @diff={{this.planOutput.diff}} 94 @verbose={{false}} 95 /> 96 </div> 97 </div> 98 <div 99 class="boxed-section 100 {{if this.planOutput.failedTGAllocs 'is-warning' 'is-primary'}}" 101 data-test-dry-run-message 102 > 103 <div class="boxed-section-head" data-test-dry-run-title>Scheduler dry-run</div> 104 <div class="boxed-section-body" data-test-dry-run-body> 105 {{#if this.planOutput.failedTGAllocs}} 106 {{#each this.planOutput.failedTGAllocs as |placementFailure|}} 107 <PlacementFailure @failedTGAlloc={{placementFailure}} /> 108 {{/each}} 109 {{else}} 110 All tasks successfully allocated. 111 {{/if}} 112 </div> 113 </div> 114 {{#if 115 (and 116 this.planOutput.preemptions.isFulfilled this.planOutput.preemptions.length 117 ) 118 }} 119 <div class="boxed-section is-warning" data-test-preemptions> 120 <div class="boxed-section-head" data-test-preemptions-title> 121 Preemptions (if you choose to run this job, these allocations will be 122 stopped) 123 </div> 124 <div class="boxed-section-body" data-test-preemptions-body> 125 <ListTable 126 @source={{this.planOutput.preemptions}} 127 @class="allocations is-isolated" 128 as |t| 129 > 130 <t.head> 131 <th class="is-narrow"></th> 132 <th>ID</th> 133 <th>Task Group</th> 134 <th>Created</th> 135 <th>Modified</th> 136 <th>Status</th> 137 <th>Version</th> 138 <th>Node</th> 139 <th>Volume</th> 140 <th>CPU</th> 141 <th>Memory</th> 142 </t.head> 143 <t.body as |row|> 144 <AllocationRow @allocation={{row.model}} @context="job" /> 145 </t.body> 146 </ListTable> 147 </div> 148 </div> 149 {{/if}} 150 <div class="content is-associative"> 151 <button 152 class="button is-primary {{if this.submit.isRunning 'is-loading'}}" 153 type="button" 154 onclick={{perform this.submit}} 155 disabled={{this.submit.isRunning}} 156 data-test-run 157 >Run</button> 158 <button 159 class="button is-light" 160 type="button" 161 onclick={{action this.reset}} 162 data-test-cancel 163 >Cancel</button> 164 </div> 165 {{/if}}