mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Read-based checks for viewing templates and write-based checks for saving them (#23458)
This commit is contained in:
3
.changelog/23458.txt
Normal file
3
.changelog/23458.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
ui: Fix an issue where access to Job Templates in the UI was restricted to variable.write access
|
||||
```
|
||||
@@ -16,7 +16,7 @@
|
||||
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>
|
||||
|
||||
{{#if (can "write variable" path="*" namespace="*")}}
|
||||
{{#if (can "read variable" path="nomad/job-templates/*" namespace="*")}}
|
||||
<Hds::ButtonSet>
|
||||
<label
|
||||
class="job-spec-upload hds-button hds-button--color-secondary hds-button--size-medium"
|
||||
|
||||
@@ -101,14 +101,16 @@
|
||||
data-test-plan
|
||||
@text="Plan"
|
||||
/>
|
||||
{{#if @data.job.isNew}}
|
||||
<Hds::Button
|
||||
@text="Save as template"
|
||||
@color="secondary"
|
||||
@route="jobs.run.templates.new"
|
||||
{{on "click" @fns.onSaveAs}}
|
||||
data-test-save-as-template
|
||||
/>
|
||||
{{#if (can "write variable" path="nomad/job-templates/*" namespace="*")}}
|
||||
{{#if @data.job.isNew}}
|
||||
<Hds::Button
|
||||
@text="Save as template"
|
||||
@color="secondary"
|
||||
@route="jobs.run.templates.new"
|
||||
{{on "click" @fns.onSaveAs}}
|
||||
data-test-save-as-template
|
||||
/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<Hds::Button
|
||||
@text="Save as .nomad.hcl"
|
||||
|
||||
@@ -20,8 +20,11 @@
|
||||
<:body as |B|>
|
||||
<B.Tr>
|
||||
<B.Td>
|
||||
{{#if B.data.isDefaultJobTemplate}}
|
||||
{{format-template-label B.data.path}}
|
||||
{{#if (or
|
||||
B.data.isDefaultJobTemplate
|
||||
(not (can "write variable" path="nomad/job-templates/*" namespace="*"))
|
||||
)}}
|
||||
{{format-template-label B.data.path}}
|
||||
{{else}}
|
||||
<LinkTo @route="jobs.run.templates.template" @model={{concat B.data.path "@" B.data.namespace}} data-test-edit-template={{B.data.path}}>
|
||||
{{format-template-label B.data.path}}
|
||||
|
||||
Reference in New Issue
Block a user