From eedee3e53d10545c9253dcfded363c3de3f21f45 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Mon, 29 Aug 2022 14:45:49 -0400 Subject: [PATCH] Mostly user-facing renames and a few test renames --- ui/app/components/variable-form.js | 10 ++++------ .../variable-form/related-entities.hbs | 2 +- ui/app/controllers/variables/variable/index.js | 2 +- ui/app/templates/variables.hbs | 2 +- ui/app/templates/variables/index.hbs | 10 +++++----- ui/app/templates/variables/path.hbs | 8 ++++---- ui/app/templates/variables/variable.hbs | 2 +- ui/app/utils/path-tree.js | 4 ++-- ui/mirage/config.js | 4 ++-- ui/mirage/factories/token.js | 18 +++++++++--------- ...ure-variables-test.js => variables-test.js} | 0 ui/tests/unit/utils/path-tree-test.js | 6 +++--- 12 files changed, 33 insertions(+), 35 deletions(-) rename ui/tests/acceptance/{secure-variables-test.js => variables-test.js} (100%) diff --git a/ui/app/components/variable-form.js b/ui/app/components/variable-form.js index c7bfcb49d..ac63df84e 100644 --- a/ui/app/components/variable-form.js +++ b/ui/app/components/variable-form.js @@ -200,7 +200,7 @@ export default class VariableFormComponent extends Component { await this.args.model.save({ adapterOptions: { overwrite } }); this.flashMessages.add({ - title: 'Secure Variable saved', + title: 'Variable saved', message: `${this.path} successfully saved`, type: 'success', destroyOnClick: false, @@ -302,15 +302,13 @@ export default class VariableFormComponent extends Component { throw new Error('Invalid JSON'); } - // "myString" is valid JSON, but it's not a valid Secure Variable. - // Ditto for an array of objects. We expect a single object to be a Secure Variable. + // "myString" is valid JSON, but it's not a valid Variable. + // Ditto for an array of objects. We expect a single object to be a Variable. const hasFormatErrors = JSON.parse(value) instanceof Array || typeof JSON.parse(value) !== 'object'; if (hasFormatErrors) { - throw new Error( - 'A Secure Variable must be formatted as a single JSON object' - ); + throw new Error('A Variable must be formatted as a single JSON object'); } set(this, 'JSONError', null); diff --git a/ui/app/components/variable-form/related-entities.hbs b/ui/app/components/variable-form/related-entities.hbs index c6f32669b..76c5c86b6 100644 --- a/ui/app/components/variable-form/related-entities.hbs +++ b/ui/app/components/variable-form/related-entities.hbs @@ -1,7 +1,7 @@
@@ -18,7 +18,7 @@ class="button is-primary" data-test-create-var > - Create Secure Variable + Create Variable {{else}} {{/if}} @@ -46,11 +46,11 @@
{{#if (eq this.namespaceSelection "*")}}

- No Secure Variables + No Variables

{{#if (can "write variable" path="*" namespace=this.namespaceSelection)}}

- Get started by creating a new secure variable + Get started by creating a new variable

{{/if}} {{else}} diff --git a/ui/app/templates/variables/path.hbs b/ui/app/templates/variables/path.hbs index f4838b423..a6bb424f0 100644 --- a/ui/app/templates/variables/path.hbs +++ b/ui/app/templates/variables/path.hbs @@ -1,4 +1,4 @@ -{{page-title "Secure Variables: " this.absolutePath}} +{{page-title "Variables: " this.absolutePath}} {{#each this.breadcrumbs as |crumb|}} {{/each}} @@ -21,7 +21,7 @@ @query={{hash path=(concat this.absolutePath "/")}} class="button is-primary" > - Create Secure Variable + Create Variable {{else}} {{/if}}
@@ -50,7 +50,7 @@ Path /{{this.absolutePath}} contains no variables

- To get started, create a new secure variable here, or go back to the Secure Variables root directory. + To get started, create a new variable here, or go back to the Variables root directory.

{{else}}

diff --git a/ui/app/templates/variables/variable.hbs b/ui/app/templates/variables/variable.hbs index 7eea2143a..88ba26409 100644 --- a/ui/app/templates/variables/variable.hbs +++ b/ui/app/templates/variables/variable.hbs @@ -1,4 +1,4 @@ -{{page-title "Secure Variables: " this.model.path}} +{{page-title "Variables: " this.model.path}} {{#each this.breadcrumbs as |crumb|}} {{/each}} diff --git a/ui/app/utils/path-tree.js b/ui/app/utils/path-tree.js index ea9db0a36..fc907289f 100644 --- a/ui/app/utils/path-tree.js +++ b/ui/app/utils/path-tree.js @@ -10,9 +10,9 @@ import { trimPath } from '../helpers/trim-path'; /** * @typedef {Object} VariableFile * @property {string} path - the folder path containing our "file", relative to parent - * @property {string} name - the secure variable "file" name + * @property {string} name - the variable "file" name * @property {string} absoluteFilePath - the folder path containing our "file", absolute - * @property {VariableModel} variable - the secure variable itself + * @property {VariableModel} variable - the variable itself */ /** diff --git a/ui/mirage/config.js b/ui/mirage/config.js index f285708fe..c73582084 100644 --- a/ui/mirage/config.js +++ b/ui/mirage/config.js @@ -837,7 +837,7 @@ export default function () { } ); - //#region Secure Variables + //#region Variables this.get('/vars', function (schema, { queryParams: { namespace } }) { if (namespace && namespace !== '*') { @@ -883,7 +883,7 @@ export default function () { return ''; }); - //#endregion Secure Variables + //#endregion Variables } function filterKeys(object, ...keys) { diff --git a/ui/mirage/factories/token.js b/ui/mirage/factories/token.js index 59a3fa393..575463c9b 100644 --- a/ui/mirage/factories/token.js +++ b/ui/mirage/factories/token.js @@ -28,7 +28,7 @@ export default Factory.extend({ token.update({ policyIds }); - // Create a special policy with secure variables rules in place + // Create a special policy with variables rules in place if (token.id === '53cur3-v4r14bl35') { const variableMakerPolicy = { id: 'Variable Maker', @@ -37,8 +37,8 @@ export default Factory.extend({ namespace "*" { policy = "read" capabilities = ["list-jobs", "alloc-exec", "read-logs"] - secure_variables { - # Base access is to all abilities for all secure variables + variables { + # Base access is to all abilities for all variables path "*" { capabilities = ["list", "read", "destroy", "create"] } @@ -78,8 +78,8 @@ node { namespace "*" { policy = "read" capabilities = ["list-jobs", "alloc-exec", "read-logs"] - secure_variables { - # Base access is to all abilities for all secure variables + variables { + # Base access is to all abilities for all variables path "*" { capabilities = ["list"] } @@ -89,8 +89,8 @@ namespace "*" { namespace "namespace-1" { policy = "read" capabilities = ["list-jobs", "alloc-exec", "read-logs"] - secure_variables { - # Base access is to all abilities for all secure variables + variables { + # Base access is to all abilities for all variables path "*" { capabilities = ["list", "read", "destroy", "create"] } @@ -100,8 +100,8 @@ namespace "namespace-1" { namespace "namespace-2" { policy = "read" capabilities = ["list-jobs", "alloc-exec", "read-logs"] - secure_variables { - # Base access is to all abilities for all secure variables + variables { + # Base access is to all abilities for all variables path "blue/*" { capabilities = ["list", "read", "destroy", "create"] } diff --git a/ui/tests/acceptance/secure-variables-test.js b/ui/tests/acceptance/variables-test.js similarity index 100% rename from ui/tests/acceptance/secure-variables-test.js rename to ui/tests/acceptance/variables-test.js diff --git a/ui/tests/unit/utils/path-tree-test.js b/ui/tests/unit/utils/path-tree-test.js index 1a51bf469..3060ae6b4 100644 --- a/ui/tests/unit/utils/path-tree-test.js +++ b/ui/tests/unit/utils/path-tree-test.js @@ -61,17 +61,17 @@ module('Unit | Utility | path-tree', function () { assert.equal( Object.keys(tree.findPath('a/b').files).length, 4, - 'Multiple files are listed at a found non-terminal compacted path with many secure variables' + 'Multiple files are listed at a found non-terminal compacted path with many variables' ); assert.equal( Object.keys(tree.findPath('a/b/c/doberman').files).length, 1, - 'One file listed at a found compacted path with a single secure variable' + 'One file listed at a found compacted path with a single variable' ); assert.equal( Object.keys(tree.findPath('a/b/c/dachshund').files).length, 2, - 'Multiple files listed at a found terminal compacted path with many secure variables' + 'Multiple files listed at a found terminal compacted path with many variables' ); }); });