Variable form and css classes

This commit is contained in:
Phil Renaud
2022-08-29 14:35:43 -04:00
parent 88b820f0ca
commit 9b415c96b4
13 changed files with 30 additions and 30 deletions

View File

@@ -1,17 +1,17 @@
{{did-update this.onViewChange @view}}
{{did-insert this.establishKeyValues}}
<form class="new-secure-variables" autocomplete="off" {{on "submit" this.save}}>
<form class="new-variables" autocomplete="off" {{on "submit" this.save}}>
{{#if @model.isNew}}
<div class="related-entities related-entities-hint">
<p>Prefix your path with <code>nomad/jobs/</code> to automatically make your secure variable accessible to a specified job, task group, or task.<br />
<p>Prefix your path with <code>nomad/jobs/</code> to automatically make your variable accessible to a specified job, task group, or task.<br />
Format: <code>nomad/jobs/&lt;jobname&gt;</code>, <code>nomad/jobs/&lt;jobname&gt;/&lt;groupname&gt;</code>, <code>nomad/jobs/&lt;jobname&gt;/&lt;groupname&gt;/&lt;taskname&gt;</code></p>
</div>
{{/if}}
{{#if this.hasConflict}}
<div class="notification conflict is-danger">
<h3 class="title is-4">Heads up! Your Secure Variable has a conflict.</h3>
<h3 class="title is-4">Heads up! Your variable has a conflict.</h3>
<p>This might be because someone else tried saving in the time since you've had it open.</p>
{{#if this.conflictingVariable.modifyTime}}
<span class="tooltip" aria-label="{{format-ts this.conflictingVariable.modifyTime}}">
@@ -46,7 +46,7 @@
/>
{{#if this.duplicatePathWarning}}
<p class="duplicate-path-error help is-danger">
There is already a Secure Variable located at
There is already a variable located at
{{this.path}}
.
<br />
@@ -55,13 +55,13 @@
@route="variables.variable.edit"
@model={{this.duplicatePathWarning.path}}
>
edit the existing Secure Variable
edit the existing variable
</LinkTo>
.
</p>
{{/if}}
</label>
<SecureVariableForm::NamespaceFilter
<VariableForm::NamespaceFilter
@data={{hash
disabled=(not @model.isNew)
selection=this.variableNamespace
@@ -108,7 +108,7 @@
{{on "input" (fn this.validateKey entry)}}
/>
</label>
<SecureVariableForm::InputGroup @entry={{entry}} />
<VariableForm::InputGroup @entry={{entry}} />
{{#if (eq entry this.keyValues.lastObject)}}
<button
class="add-more button is-info is-inverted"
@@ -137,7 +137,7 @@
{{/if}}
{{#if (and this.shouldShowLinkedEntities @model.isNew)}}
<SecureVariableForm::RelatedEntities
<VariableForm::RelatedEntities
@new={{true}}
@job={{@model.pathLinkedEntities.job}}
@group={{@model.pathLinkedEntities.group}}

View File

@@ -19,7 +19,7 @@ const EMPTY_KV = {
warnings: EmberObject.create(),
};
export default class SecureVariableFormComponent extends Component {
export default class VariableFormComponent extends Component {
@service flashMessages;
@service router;
@service store;

View File

@@ -46,5 +46,5 @@
@import './components/tooltip';
@import './components/two-step-button';
@import './components/evaluations';
@import './components/secure-variables';
@import './components/variables';
@import './components/keyboard-shortcuts-modal';

View File

@@ -21,7 +21,7 @@
}
}
.new-secure-variables {
.new-variables {
& > div {
margin-bottom: 1rem;
}

View File

@@ -1,9 +1,9 @@
{{page-title "New Secure Variable"}}
{{page-title "New Variable"}}
<Breadcrumb @crumb={{hash label="New" args=(array "variables.new")}} />
<section class="section">
<h1 class="title variable-title">
Create a Secure Variable
Create a Variable
<Toggle
data-test-memory-toggle
@isActive={{eq this.view "json"}}
@@ -12,7 +12,7 @@
>JSON</Toggle>
</h1>
<SecureVariableForm
<VariableForm
@model={{this.model}}
@path={{this.path}}
@existingVariables={{this.existingVariables}}

View File

@@ -1,4 +1,4 @@
{{page-title "Edit Secure Variable"}}
{{page-title "Edit Variable"}}
<h1 class="title variable-title">
<LinkTo class="back-link" @route="variables.variable.index">
@@ -19,7 +19,7 @@
</h1>
<SecureVariableForm
<VariableForm
@model={{this.model}}
@existingVariables={{this.existingVariables}}
@view={{this.view}}

View File

@@ -49,7 +49,7 @@
</h1>
{{#if this.shouldShowLinkedEntities}}
<SecureVariableForm::RelatedEntities
<VariableForm::RelatedEntities
@job={{this.model.pathLinkedEntities.job}}
@group={{this.model.pathLinkedEntities.group}}
@task={{this.model.pathLinkedEntities.task}}

View File

@@ -12,7 +12,7 @@ import {
clickTrigger,
} from 'ember-power-select/test-support/helpers';
module('Integration | Component | secure-variable-form', function (hooks) {
module('Integration | Component | variable-form', function (hooks) {
setupRenderingTest(hooks);
setupMirage(hooks);
setupCodeMirror(hooks);
@@ -25,7 +25,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
keyValues: [{ key: '', value: '' }],
})
);
await render(hbs`<SecureVariableForm @model={{this.mockedModel}} />`);
await render(hbs`<VariableForm @model={{this.mockedModel}} />`);
await componentA11yAudit(this.element, assert);
});
@@ -38,7 +38,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
);
assert.expect(7);
await render(hbs`<SecureVariableForm @model={{this.mockedModel}} />`);
await render(hbs`<VariableForm @model={{this.mockedModel}} />`);
assert.equal(
findAll('div.key-value').length,
1,
@@ -106,7 +106,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
assert.expect(6);
await render(hbs`<SecureVariableForm @model={{this.mockedModel}} />`);
await render(hbs`<VariableForm @model={{this.mockedModel}} />`);
await click('.key-value button.add-more'); // add a second variable
findAll('input.value-input').forEach((input, iter) => {
@@ -163,7 +163,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
keyValues,
})
);
await render(hbs`<SecureVariableForm @model={{this.mockedModel}} />`);
await render(hbs`<VariableForm @model={{this.mockedModel}} />`);
assert.equal(
findAll('div.key-value').length,
5,
@@ -206,7 +206,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
});
variable.isNew = false;
this.set('variable', variable);
await render(hbs`<SecureVariableForm @model={{this.variable}} />`);
await render(hbs`<VariableForm @model={{this.variable}} />`);
assert.dom('input.path-input').hasValue('/baz/bat', 'Path is set');
assert
.dom('input.path-input')
@@ -215,7 +215,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
variable.isNew = true;
variable.path = '';
this.set('variable', variable);
await render(hbs`<SecureVariableForm @model={{this.variable}} />`);
await render(hbs`<VariableForm @model={{this.variable}} />`);
assert
.dom('input.path-input')
.isNotDisabled('New variable is not in disabled state');
@@ -244,7 +244,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
this.set('existingVariables', server.db.variables.toArray());
await render(
hbs`<SecureVariableForm @model={{this.mockedModel}} @existingVariables={{this.existingVariables}} />`
hbs`<VariableForm @model={{this.mockedModel}} @existingVariables={{this.existingVariables}} />`
);
await typeIn('.path-input', 'foo/bar');
@@ -278,7 +278,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
})
);
await render(hbs`<SecureVariableForm @model={{this.mockedModel}} />`);
await render(hbs`<VariableForm @model={{this.mockedModel}} />`);
await typeIn('.key-value label:nth-child(1) input', 'superSecret');
assert.dom('.key-value-error').doesNotExist();
@@ -297,7 +297,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
})
);
await render(hbs`<SecureVariableForm @model={{this.mockedModel}} />`);
await render(hbs`<VariableForm @model={{this.mockedModel}} />`);
await click('.key-value button.add-more');
@@ -332,7 +332,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
this.set('view', 'table');
await render(
hbs`<SecureVariableForm @model={{this.mockedModel}} @existingVariables={{this.existingVariables}} @view={{this.view}} />`
hbs`<VariableForm @model={{this.mockedModel}} @existingVariables={{this.existingVariables}} @view={{this.view}} />`
);
assert.dom('.key-value').exists();
assert.dom('.CodeMirror').doesNotExist();
@@ -359,7 +359,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
this.set('view', 'json');
await render(
hbs`<SecureVariableForm @model={{this.mockedModel}} @view={{this.view}} />`
hbs`<VariableForm @model={{this.mockedModel}} @view={{this.view}} />`
);
await percySnapshot(assert);
@@ -406,7 +406,7 @@ module('Integration | Component | secure-variable-form', function (hooks) {
this.set('view', 'json');
await render(
hbs`<SecureVariableForm @model={{this.mockedModel}} @view={{this.view}} />`
hbs`<VariableForm @model={{this.mockedModel}} @view={{this.view}} />`
);
codeFillable('[data-test-json-editor]').get()(