[ui] A few variables-ui-related bugfixes (#17319)
* A few variable-adding bugfixes * Disable Delete button if only one KV is left, and remove entity warnings on Add More
This commit is contained in:
parent
86e04a4c6c
commit
294aa4bfe7
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
ui: fixed a handful of UX-related bugs during variable editing
|
||||
```
|
|
@ -14,6 +14,17 @@
|
|||
Format: <code>nomad/jobs/<jobname></code>, <code>nomad/jobs/<jobname>/<groupname></code>, <code>nomad/jobs/<jobname>/<groupname>/<taskname></code></p>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
{{#if this.shouldShowLinkedEntities}}
|
||||
<VariableForm::RelatedEntities
|
||||
@new={{true}}
|
||||
@job={{@model.pathLinkedEntities.job}}
|
||||
@group={{@model.pathLinkedEntities.group}}
|
||||
@task={{@model.pathLinkedEntities.task}}
|
||||
@namespace={{this.variableNamespace}}
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
|
||||
{{#if this.hasConflict}}
|
||||
|
@ -137,6 +148,7 @@
|
|||
class="delete-row button is-danger is-inverted"
|
||||
type="button"
|
||||
{{on "click" (action this.deleteRow entry)}}
|
||||
disabled={{eq this.keyValues.length 1}}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
|
@ -150,16 +162,6 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (and this.shouldShowLinkedEntities @model.isNew)}}
|
||||
<VariableForm::RelatedEntities
|
||||
@new={{true}}
|
||||
@job={{@model.pathLinkedEntities.job}}
|
||||
@group={{@model.pathLinkedEntities.group}}
|
||||
@task={{@model.pathLinkedEntities.task}}
|
||||
@namespace={{this.variableNamespace}}
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<footer>
|
||||
{{#unless this.isJSONView}}
|
||||
{{#unless this.isJobTemplateVariable}}
|
||||
|
|
|
@ -140,7 +140,9 @@ export default class VariableFormComponent extends Component {
|
|||
let existingVariable = existingVariables
|
||||
.without(this.args.model)
|
||||
.find(
|
||||
(v) => v.path === pathValue && v.namespace === this.variableNamespace
|
||||
(v) =>
|
||||
v.path === pathValue &&
|
||||
(v.namespace === this.variableNamespace || !this.variableNamespace)
|
||||
);
|
||||
if (existingVariable) {
|
||||
return {
|
||||
|
@ -180,7 +182,10 @@ export default class VariableFormComponent extends Component {
|
|||
}
|
||||
|
||||
@action appendRow() {
|
||||
this.keyValues.pushObject(copy(EMPTY_KV));
|
||||
// Clear our any entity errors
|
||||
let newRow = copy(EMPTY_KV);
|
||||
newRow.warnings = EmberObject.create();
|
||||
this.keyValues.pushObject(newRow);
|
||||
}
|
||||
|
||||
@action deleteRow(row) {
|
||||
|
@ -372,7 +377,8 @@ export default class VariableFormComponent extends Component {
|
|||
return (
|
||||
this.args.model.pathLinkedEntities?.job ||
|
||||
this.args.model.pathLinkedEntities?.group ||
|
||||
this.args.model.pathLinkedEntities?.task
|
||||
this.args.model.pathLinkedEntities?.task ||
|
||||
trimPath([this.path]) === 'nomad/jobs'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
{{else if @group}}
|
||||
group <LinkTo @route="jobs.job.task-group" @models={{array (concat @job "@" @namespace) @group}}>{{@group}} <FlightIcon @name="external-link" /></LinkTo>
|
||||
{{else if @job}}
|
||||
job <LinkTo @route="jobs.job" @model={{concat @job "@" @namespace}}>{{@job}} <FlightIcon @name="external-link" /></LinkTo><
|
||||
job <LinkTo @route="jobs.job" @model={{concat @job "@" @namespace}}>{{@job}} <FlightIcon @name="external-link" /></LinkTo>
|
||||
{{else}}
|
||||
all nomad jobs in this namespace
|
||||
{{/if}}
|
||||
</span>
|
||||
</p>
|
||||
|
|
|
@ -82,7 +82,8 @@ export default class VariablesVariableIndexController extends Controller {
|
|||
return (
|
||||
this.model.pathLinkedEntities?.job ||
|
||||
this.model.pathLinkedEntities?.group ||
|
||||
this.model.pathLinkedEntities?.task
|
||||
this.model.pathLinkedEntities?.task ||
|
||||
this.model.path === 'nomad/jobs'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue