Mostly user-facing renames and a few test renames

This commit is contained in:
Phil Renaud 2022-08-29 14:45:49 -04:00
parent 2b4996e070
commit eedee3e53d
12 changed files with 33 additions and 35 deletions

View file

@ -200,7 +200,7 @@ export default class VariableFormComponent extends Component {
await this.args.model.save({ adapterOptions: { overwrite } }); await this.args.model.save({ adapterOptions: { overwrite } });
this.flashMessages.add({ this.flashMessages.add({
title: 'Secure Variable saved', title: 'Variable saved',
message: `${this.path} successfully saved`, message: `${this.path} successfully saved`,
type: 'success', type: 'success',
destroyOnClick: false, destroyOnClick: false,
@ -302,15 +302,13 @@ export default class VariableFormComponent extends Component {
throw new Error('Invalid JSON'); throw new Error('Invalid JSON');
} }
// "myString" is valid JSON, but it's not a valid 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 Secure Variable. // Ditto for an array of objects. We expect a single object to be a Variable.
const hasFormatErrors = const hasFormatErrors =
JSON.parse(value) instanceof Array || JSON.parse(value) instanceof Array ||
typeof JSON.parse(value) !== 'object'; typeof JSON.parse(value) !== 'object';
if (hasFormatErrors) { if (hasFormatErrors) {
throw new Error( throw new Error('A Variable must be formatted as a single JSON object');
'A Secure Variable must be formatted as a single JSON object'
);
} }
set(this, 'JSONError', null); set(this, 'JSONError', null);

View file

@ -1,7 +1,7 @@
<p class="related-entities notification"> <p class="related-entities notification">
<FlightIcon @name="info-fill" @color="var(--blue)" /> <FlightIcon @name="info-fill" @color="var(--blue)" />
<span> <span>
This secure variable {{#if @new}}will be{{else}}is{{/if}} accessible by This variable {{#if @new}}will be{{else}}is{{/if}} accessible by
{{#if @task}} {{#if @task}}
task <strong>{{@task}}</strong> in group <LinkTo @route="jobs.job.task-group" @models={{array (concat @job "@" @namespace) @group}}>{{@group}} <FlightIcon @name="external-link" /></LinkTo> task <strong>{{@task}}</strong> in group <LinkTo @route="jobs.job.task-group" @models={{array (concat @job "@" @namespace) @group}}>{{@group}} <FlightIcon @name="external-link" /></LinkTo>
{{else if @group}} {{else if @group}}

View file

@ -40,7 +40,7 @@ export default class VariablesVariableIndexController extends Controller {
this.router.transitionTo('variables'); this.router.transitionTo('variables');
} }
this.flashMessages.add({ this.flashMessages.add({
title: 'Secure Variable deleted', title: 'Variable deleted',
message: `${this.model.path} successfully deleted`, message: `${this.model.path} successfully deleted`,
type: 'success', type: 'success',
destroyOnClick: false, destroyOnClick: false,

View file

@ -1,4 +1,4 @@
<Breadcrumb @crumb={{hash label="Secure Variables" args=(array "variables.index")}} /> <Breadcrumb @crumb={{hash label="Variables" args=(array "variables.index")}} />
<PageLayout> <PageLayout>
{{outlet}} {{outlet}}
</PageLayout> </PageLayout>

View file

@ -1,4 +1,4 @@
{{page-title "Secure Variables"}} {{page-title "Variables"}}
<section class="section"> <section class="section">
<div class="toolbar"> <div class="toolbar">
<div class="toolbar-item is-right-aligned is-mobile-full-width"> <div class="toolbar-item is-right-aligned is-mobile-full-width">
@ -18,7 +18,7 @@
class="button is-primary" class="button is-primary"
data-test-create-var data-test-create-var
> >
Create Secure Variable Create Variable
</LinkTo> </LinkTo>
{{else}} {{else}}
<button <button
@ -28,7 +28,7 @@
type="button" type="button"
data-test-disabled-create-var data-test-disabled-create-var
> >
Create Secure Variable Create Variable
</button> </button>
{{/if}} {{/if}}
@ -46,11 +46,11 @@
<div class="empty-message"> <div class="empty-message">
{{#if (eq this.namespaceSelection "*")}} {{#if (eq this.namespaceSelection "*")}}
<h3 data-test-empty-variables-list-headline class="empty-message-headline"> <h3 data-test-empty-variables-list-headline class="empty-message-headline">
No Secure Variables No Variables
</h3> </h3>
{{#if (can "write variable" path="*" namespace=this.namespaceSelection)}} {{#if (can "write variable" path="*" namespace=this.namespaceSelection)}}
<p class="empty-message-body"> <p class="empty-message-body">
Get started by <LinkTo @route="variables.new">creating a new secure variable</LinkTo> Get started by <LinkTo @route="variables.new">creating a new variable</LinkTo>
</p> </p>
{{/if}} {{/if}}
{{else}} {{else}}

View file

@ -1,4 +1,4 @@
{{page-title "Secure Variables: " this.absolutePath}} {{page-title "Variables: " this.absolutePath}}
{{#each this.breadcrumbs as |crumb|}} {{#each this.breadcrumbs as |crumb|}}
<Breadcrumb @crumb={{crumb}} /> <Breadcrumb @crumb={{crumb}} />
{{/each}} {{/each}}
@ -21,7 +21,7 @@
@query={{hash path=(concat this.absolutePath "/")}} @query={{hash path=(concat this.absolutePath "/")}}
class="button is-primary" class="button is-primary"
> >
Create Secure Variable Create Variable
</LinkTo> </LinkTo>
{{else}} {{else}}
<button <button
@ -30,7 +30,7 @@
disabled disabled
type="button" type="button"
> >
Create Secure Variable Create Variable
</button> </button>
{{/if}} {{/if}}
</div> </div>
@ -50,7 +50,7 @@
Path /{{this.absolutePath}} contains no variables Path /{{this.absolutePath}} contains no variables
</h3> </h3>
<p class="empty-message-body"> <p class="empty-message-body">
To get started, <LinkTo @route="variables.new" @query={{hash path=(concat this.absolutePath "/")}}>create a new secure variable here</LinkTo>, or <LinkTo @route="variables">go back to the Secure Variables root directory</LinkTo>. To get started, <LinkTo @route="variables.new" @query={{hash path=(concat this.absolutePath "/")}}>create a new variable here</LinkTo>, or <LinkTo @route="variables">go back to the Variables root directory</LinkTo>.
</p> </p>
{{else}} {{else}}
<h3 data-test-no-matching-variables-list-headline class="empty-message-headline"> <h3 data-test-no-matching-variables-list-headline class="empty-message-headline">

View file

@ -1,4 +1,4 @@
{{page-title "Secure Variables: " this.model.path}} {{page-title "Variables: " this.model.path}}
{{#each this.breadcrumbs as |crumb|}} {{#each this.breadcrumbs as |crumb|}}
<Breadcrumb @crumb={{crumb}} /> <Breadcrumb @crumb={{crumb}} />
{{/each}} {{/each}}

View file

@ -10,9 +10,9 @@ import { trimPath } from '../helpers/trim-path';
/** /**
* @typedef {Object} VariableFile * @typedef {Object} VariableFile
* @property {string} path - the folder path containing our "file", relative to parent * @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 {string} absoluteFilePath - the folder path containing our "file", absolute
* @property {VariableModel} variable - the secure variable itself * @property {VariableModel} variable - the variable itself
*/ */
/** /**

View file

@ -837,7 +837,7 @@ export default function () {
} }
); );
//#region Secure Variables //#region Variables
this.get('/vars', function (schema, { queryParams: { namespace } }) { this.get('/vars', function (schema, { queryParams: { namespace } }) {
if (namespace && namespace !== '*') { if (namespace && namespace !== '*') {
@ -883,7 +883,7 @@ export default function () {
return ''; return '';
}); });
//#endregion Secure Variables //#endregion Variables
} }
function filterKeys(object, ...keys) { function filterKeys(object, ...keys) {

View file

@ -28,7 +28,7 @@ export default Factory.extend({
token.update({ policyIds }); 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') { if (token.id === '53cur3-v4r14bl35') {
const variableMakerPolicy = { const variableMakerPolicy = {
id: 'Variable Maker', id: 'Variable Maker',
@ -37,8 +37,8 @@ export default Factory.extend({
namespace "*" { namespace "*" {
policy = "read" policy = "read"
capabilities = ["list-jobs", "alloc-exec", "read-logs"] capabilities = ["list-jobs", "alloc-exec", "read-logs"]
secure_variables { variables {
# Base access is to all abilities for all secure variables # Base access is to all abilities for all variables
path "*" { path "*" {
capabilities = ["list", "read", "destroy", "create"] capabilities = ["list", "read", "destroy", "create"]
} }
@ -78,8 +78,8 @@ node {
namespace "*" { namespace "*" {
policy = "read" policy = "read"
capabilities = ["list-jobs", "alloc-exec", "read-logs"] capabilities = ["list-jobs", "alloc-exec", "read-logs"]
secure_variables { variables {
# Base access is to all abilities for all secure variables # Base access is to all abilities for all variables
path "*" { path "*" {
capabilities = ["list"] capabilities = ["list"]
} }
@ -89,8 +89,8 @@ namespace "*" {
namespace "namespace-1" { namespace "namespace-1" {
policy = "read" policy = "read"
capabilities = ["list-jobs", "alloc-exec", "read-logs"] capabilities = ["list-jobs", "alloc-exec", "read-logs"]
secure_variables { variables {
# Base access is to all abilities for all secure variables # Base access is to all abilities for all variables
path "*" { path "*" {
capabilities = ["list", "read", "destroy", "create"] capabilities = ["list", "read", "destroy", "create"]
} }
@ -100,8 +100,8 @@ namespace "namespace-1" {
namespace "namespace-2" { namespace "namespace-2" {
policy = "read" policy = "read"
capabilities = ["list-jobs", "alloc-exec", "read-logs"] capabilities = ["list-jobs", "alloc-exec", "read-logs"]
secure_variables { variables {
# Base access is to all abilities for all secure variables # Base access is to all abilities for all variables
path "blue/*" { path "blue/*" {
capabilities = ["list", "read", "destroy", "create"] capabilities = ["list", "read", "destroy", "create"]
} }

View file

@ -61,17 +61,17 @@ module('Unit | Utility | path-tree', function () {
assert.equal( assert.equal(
Object.keys(tree.findPath('a/b').files).length, Object.keys(tree.findPath('a/b').files).length,
4, 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( assert.equal(
Object.keys(tree.findPath('a/b/c/doberman').files).length, Object.keys(tree.findPath('a/b/c/doberman').files).length,
1, 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( assert.equal(
Object.keys(tree.findPath('a/b/c/dachshund').files).length, Object.keys(tree.findPath('a/b/c/dachshund').files).length,
2, 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'
); );
}); });
}); });