be632db682
* runs ember-cli-update to 4.4.0 * updates yarn.lock * updates dependencies causing runtime errors (#17135) * Inject Store Service When Accessed Implicitly (#17345) * adds codemod for injecting store service * adds custom babylon parser with decorators-legacy plugin for jscodeshift transforms * updates inject-store-service codemod to only look for .extend object expressions and adds recast options * runs inject-store-service codemod on js files * replace query-params helper with hash (#17404) * Updates/removes dependencies throwing errors in Ember 4.4 (#17396) * updates ember-responsive to latest * updates ember-composable-helpers to latest and uses includes helper since contains was removed * updates ember-concurrency to latest * updates ember-cli-clipboard to latest * temporary workaround for toolbar-link component throwing errors for using params arg with LinkTo * adds missing store injection to auth configure route * fixes issue with string-list component throwing error for accessing prop in same computation * fixes non-iterable query params issue in mfa methods controller * refactors field-to-attrs to handle belongsTo rather than fragments * converts mount-config fragment to belongsTo on auth-method model * removes ember-api-actions and adds tune method to auth-method adapter * converts cluster replication attributes from fragment to relationship * updates ember-data, removes ember-data-fragments and updates yarn to latest * removes fragments from secret-engine model * removes fragment from test-form-model * removes commented out code * minor change to inject-store-service codemod and runs again on js files * Remove LinkTo positional params (#17421) * updates ember-cli-page-object to latest version * update toolbar-link to support link-to args and not positional params * adds replace arg to toolbar-link component * Clean up js lint errors (#17426) * replaces assert.equal to assert.strictEqual * update eslint no-console to error and disables invididual intended uses of console * cleans up hbs lint warnings (#17432) * Upgrade bug and test fixes (#17500) * updates inject-service codemod to take arg for service name and runs for flashMessages service * fixes hbs lint error after merging main * fixes flash messages * updates more deps * bug fixes * test fixes * updates ember-cli-content-security-policy and prevents default form submission throwing errors * more bug and test fixes * removes commented out code * fixes issue with code-mirror modifier sending change event on setup causing same computation error * Upgrade Clean Up (#17543) * updates deprecation workflow and filter * cleans up build errors, removes unused ivy-codemirror and sass and updates ember-cli-sass and node-sass to latest * fixes control groups test that was skipped after upgrade * updates control group service tests * addresses review feedback * updates control group service handleError method to use router.currentURL rather that transition.intent.url * adds changelog entry
267 lines
9.2 KiB
Handlebars
267 lines
9.2 KiB
Handlebars
{{#if (eq @mode "create")}}
|
|
<form
|
|
class={{if @showAdvancedMode "advanced-edit" "simple-edit"}}
|
|
onsubmit={{action "createOrUpdateKey" @mode}}
|
|
aria-label="secret create form"
|
|
{{did-insert this.setup @secretData @model @mode}}
|
|
>
|
|
<div class="field box is-fullwidth is-sideless is-marginless">
|
|
<NamespaceReminder @mode="create" @noun="secret" />
|
|
<MessageError @model={{@modelForData}} @errorMessage={{this.error}} />
|
|
<label class="is-label" for="kv-key">Path for this secret</label>
|
|
<p class="control is-expanded">
|
|
<Input
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
data-test-secret-path="true"
|
|
id="kv-key"
|
|
class="input {{if (get this.validationMessages 'path') 'has-error-border'}}"
|
|
@value={{get @modelForData @modelForData.pathAttr}}
|
|
{{on "keyup" (perform this.waitForKeyUp "path" value="target.value")}}
|
|
/>
|
|
</p>
|
|
{{#if (get this.validationMessages "path")}}
|
|
<AlertInline
|
|
@type="danger"
|
|
@message={{get this.validationMessages "path"}}
|
|
@paddingTop={{true}}
|
|
@isMarginless={{true}}
|
|
/>
|
|
{{/if}}
|
|
{{#if @modelForData.isFolder}}
|
|
<p class="help is-danger">
|
|
The secret path may not end in
|
|
<code>/</code>
|
|
</p>
|
|
{{/if}}
|
|
{{#if this.pathWhiteSpaceWarning}}
|
|
<div class="has-top-margin-m">
|
|
<AlertBanner
|
|
@type="warning"
|
|
@message="Your secret path contains whitespace. If this is desired, you'll need to encode it with %20 in API calls."
|
|
@marginTop={{true}}
|
|
data-test-whitespace-warning
|
|
/>
|
|
</div>
|
|
{{/if}}
|
|
</div>
|
|
{{#if @showAdvancedMode}}
|
|
<div class="form-section">
|
|
<JsonEditor
|
|
@title={{if @isV2 "Version Data" "Secret Data"}}
|
|
@value={{this.codemirrorString}}
|
|
@valueUpdated={{action "codemirrorUpdated"}}
|
|
@onFocusOut={{action "formatJSON"}}
|
|
/>
|
|
</div>
|
|
{{else}}
|
|
<div class="form-section">
|
|
<label class="title is-5">
|
|
Secret data
|
|
</label>
|
|
{{#each @secretData as |secret index|}}
|
|
<div class="info-table-row">
|
|
<div class="column is-one-quarter info-table-row-edit">
|
|
<Input
|
|
data-test-secret-key={{true}}
|
|
@value={{secret.name}}
|
|
placeholder="key"
|
|
{{on "change" (action "handleChange")}}
|
|
class="input"
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
/>
|
|
</div>
|
|
<div class="column info-table-row-edit">
|
|
<MaskedInput
|
|
@name={{secret.name}}
|
|
@onKeyDown={{action "handleKeyDown"}}
|
|
@onChange={{action "handleChange"}}
|
|
@value={{secret.value}}
|
|
data-test-secret-value="true"
|
|
/>
|
|
</div>
|
|
<div class="column is-narrow info-table-row-edit">
|
|
{{#if (eq @secretData.length (inc index))}}
|
|
<button
|
|
type="button"
|
|
{{action "addRow"}}
|
|
class="button is-outlined is-primary"
|
|
data-test-secret-add-row="true"
|
|
>
|
|
Add
|
|
</button>
|
|
{{else}}
|
|
<button
|
|
class="button has-text-grey is-expanded is-icon"
|
|
type="button"
|
|
{{on "click" (fn this.deleteRow secret.name)}}
|
|
aria-label="Delete row"
|
|
>
|
|
<Icon @name="trash" class="has-text-grey-light" />
|
|
</button>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
{{#if this.validationMessages.key}}
|
|
<AlertInline
|
|
@type="danger"
|
|
@message={{this.validationMessages.key}}
|
|
@paddingTop={{true}}
|
|
@isMarginless={{true}}
|
|
/>
|
|
{{/if}}
|
|
{{/each}}
|
|
</div>
|
|
{{/if}}
|
|
{{! must have UPDATE permissions to add secret metadata. Create only will not work }}
|
|
{{#if (and @isV2 @canUpdateSecretMetadata)}}
|
|
<ToggleButton
|
|
@isOpen={{this.showMetadata}}
|
|
@openLabel="Hide secret metadata"
|
|
@closedLabel="Show secret metadata"
|
|
@onClick={{fn (mut this.showMetadata)}}
|
|
class="is-block"
|
|
data-test-show-metadata-toggle
|
|
/>
|
|
{{#if this.showMetadata}}
|
|
<SecretEditMetadata
|
|
@model={{@model}}
|
|
@mode="create"
|
|
@updateValidationErrorCount={{action "updateValidationErrorCount"}}
|
|
/>
|
|
{{/if}}
|
|
{{/if}}
|
|
<div class="field is-grouped box is-fullwidth is-bottomless">
|
|
<div class="control">
|
|
<button
|
|
type="submit"
|
|
disabled={{or @buttonDisabled this.validationErrorCount this.error}}
|
|
class="button is-primary"
|
|
data-test-secret-save={{true}}
|
|
>
|
|
Save
|
|
</button>
|
|
</div>
|
|
<div class="control">
|
|
<SecretLink @mode="list" @secret={{@model.parentKey}} class="button">
|
|
Cancel
|
|
</SecretLink>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{/if}}
|
|
|
|
{{#if (eq @mode "edit")}}
|
|
{{! no metadata option because metadata is version agnostic }}
|
|
<form
|
|
onsubmit={{action "createOrUpdateKey" "edit"}}
|
|
aria-label="secret edit form"
|
|
{{did-insert this.setup @secretData @model @mode}}
|
|
>
|
|
<div class="box is-sideless is-fullwidth is-marginless padding-top">
|
|
<MessageError @model={{@modelForData}} @errorMessage={{this.error}} />
|
|
{{#if (eq @canReadSecretData false)}}
|
|
<AlertBanner
|
|
@type="warning"
|
|
@message="You do not have read permissions. If a secret exists here creating a new secret will overwrite it."
|
|
data-test-warning-no-read-permissions
|
|
/>
|
|
{{/if}}
|
|
<NamespaceReminder @mode="edit" @noun="secret" />
|
|
{{#if this.isCreateNewVersionFromOldVersion}}
|
|
<div class="form-section">
|
|
<AlertBanner
|
|
@type="warning"
|
|
@class="is-marginless"
|
|
@message="You are creating a new version based on data from Version {{@model.selectedVersion.version}}. The current version for {{@model.id}} is Version {{@model.currentVersion}}."
|
|
/>
|
|
</div>
|
|
{{/if}}
|
|
{{#if @showAdvancedMode}}
|
|
<div class="form-section">
|
|
<JsonEditor
|
|
@title={{if @isV2 "Version Data" "Secret Data"}}
|
|
@value={{this.codemirrorString}}
|
|
@valueUpdated={{action "codemirrorUpdated"}}
|
|
@onFocusOut={{action "formatJSON"}}
|
|
/>
|
|
</div>
|
|
{{else}}
|
|
<div class="form-section">
|
|
<label class="title is-5">
|
|
{{#if @isV2}}
|
|
Version data
|
|
{{else}}
|
|
Secret data
|
|
{{/if}}
|
|
</label>
|
|
{{#each @secretData as |secret index|}}
|
|
<div class="columns is-variable has-no-shadow">
|
|
<div class="column is-one-quarter">
|
|
<Input
|
|
data-test-secret-key={{true}}
|
|
@value={{secret.name}}
|
|
placeholder="key"
|
|
{{on "change" (action "handleChange")}}
|
|
class="input"
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
/>
|
|
</div>
|
|
<div class="column">
|
|
<MaskedInput
|
|
@name={{secret.name}}
|
|
@onKeyDown={{action "handleKeyDown"}}
|
|
@onChange={{action "handleChange"}}
|
|
@value={{secret.value}}
|
|
data-test-secret-value="true"
|
|
/>
|
|
</div>
|
|
<div class="column is-narrow">
|
|
{{#if (eq @secretData.length (inc index))}}
|
|
<button
|
|
type="button"
|
|
{{action "addRow"}}
|
|
class="button is-outlined is-primary"
|
|
data-test-secret-add-row="true"
|
|
>
|
|
Add
|
|
</button>
|
|
{{else}}
|
|
<button
|
|
class="button has-text-grey is-expanded is-icon"
|
|
type="button"
|
|
{{action "deleteRow" secret.name}}
|
|
aria-label="Delete row"
|
|
>
|
|
<Icon @name="trash" class="has-text-grey-light" />
|
|
</button>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
{{/each}}
|
|
</div>
|
|
{{/if}}
|
|
</div>
|
|
<div class="field is-grouped is-grouped-split is-fullwidth box is-bottomless">
|
|
<div class="field is-grouped">
|
|
<div class="control">
|
|
<button
|
|
data-test-secret-save
|
|
type="submit"
|
|
disabled={{or @buttonDisabled this.validationErrorCount}}
|
|
class="button is-primary"
|
|
>
|
|
Save
|
|
</button>
|
|
</div>
|
|
<div class="control">
|
|
<SecretLink @mode="show" @secret={{@model.id}} @queryParams={{hash version=@modelForData.version}} class="button">
|
|
Cancel
|
|
</SecretLink>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{/if}} |