Update secret backend partial to components (#11768)
* Update secret backend partial to components * Added jsdoc to components
This commit is contained in:
parent
f1d88b8c58
commit
a517fe35a1
|
@ -0,0 +1,42 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
/**
|
||||
* @module ConfigureAwsSecretComponent
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* <ConfigureAwsSecret
|
||||
@model={{model}}
|
||||
@tab={{tab}}
|
||||
@accessKey={{accessKey}}
|
||||
@secretKey={{secretKey}}
|
||||
@region={{region}}
|
||||
@iamEndpoint={{iamEndpoint}}
|
||||
@stsEndpoint={{stsEndpoint}}
|
||||
@saveAWSRoot={{action "save" "saveAWSRoot"}}
|
||||
@saveAWSLease={{action "save" "saveAWSLease"}} />
|
||||
* ```
|
||||
*
|
||||
* @param {object} model - aws secret engine model
|
||||
* @param {string} tab - current tab selection
|
||||
* @param {string} accessKey - AWS access key
|
||||
* @param {string} secretKey - AWS secret key
|
||||
* @param {string} region - AWS region
|
||||
* @param {string} iamEndpoint - IAM endpoint
|
||||
* @param {string} stsEndpoint - Sts endpoint
|
||||
* @param {Function} saveAWSRoot - parent action which saves AWS root credentials
|
||||
* @param {Function} saveAWSLease - parent action which updates AWS lease information
|
||||
*
|
||||
*/
|
||||
export default class ConfigureAwsSecretComponent extends Component {
|
||||
@action
|
||||
saveRootCreds(data) {
|
||||
this.args.saveAWSRoot(data);
|
||||
}
|
||||
|
||||
@action
|
||||
saveLease(data) {
|
||||
this.args.saveAWSLease(data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
/**
|
||||
* @module ConfigureSshSecretComponent
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* <ConfigureSshSecret
|
||||
@model={{model}}
|
||||
@configured={{configured}}
|
||||
@saveConfig={{action "saveConfig"}} />
|
||||
* ```
|
||||
*
|
||||
* @param {string} model - ssh secret engine model
|
||||
* @param {Function} saveConfig - parent action which updates the configuration
|
||||
*
|
||||
*/
|
||||
export default class ConfigureSshSecretComponent extends Component {
|
||||
@action
|
||||
saveConfig(data) {
|
||||
this.args.saveConfig(data);
|
||||
}
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
<div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless">
|
||||
<nav class="tabs">
|
||||
<ul>
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{model.id}} @query={{hash tab=''}} @tagName="li">
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{model.id}} @query={{hash tab=''}} data-test-aws-link="root-creds">
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{@model.id}} @query={{hash tab=''}} @tagName="li">
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{@model.id}} @query={{hash tab=''}} data-test-aws-link="root-creds">
|
||||
Dynamic IAM root credentials
|
||||
</LinkTo>
|
||||
</LinkTo>
|
||||
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{model.id}} @query={{hash tab='leases'}} @tagName="li">
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{model.id}} @query={{hash tab='leases'}} data-test-aws-link="leases">
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{@model.id}} @query={{hash tab='leases'}} @tagName="li">
|
||||
<LinkTo @route="vault.cluster.settings.configure-secret-backend" @model={{@model.id}} @query={{hash tab='leases'}} data-test-aws-link="leases">
|
||||
Leases
|
||||
</LinkTo>
|
||||
</LinkTo>
|
||||
|
@ -16,20 +16,20 @@
|
|||
</nav>
|
||||
</div>
|
||||
|
||||
{{#if (eq tab "leases")}}
|
||||
{{#if (eq @tab "leases")}}
|
||||
<form
|
||||
{{action "save" "saveAWSLease" (hash lease=model.lease lease_max=model.leaseMax) on="submit"}}
|
||||
onsubmit={{action "saveLease" (hash lease=@model.lease lease_max=@model.leaseMax) }}
|
||||
data-test-aws-leases-form="true"
|
||||
>
|
||||
<div class="box is-fullwidth is-shadowless is-marginless">
|
||||
<NamespaceReminder @mode="saved" @noun="configuration" />
|
||||
<MessageError @model={{model}} />
|
||||
<MessageError @model={{@model}} />
|
||||
<p class="has-text-grey-dark">
|
||||
If you do not supply lease settings, we will use the default values in AWS.
|
||||
</p>
|
||||
</div>
|
||||
<TtlPicker @labelText="Lease" @initialValue={{model.lease}} @onChange={{action (mut model.lease)}} />
|
||||
<TtlPicker @labelText="Maximum Lease" @initialValue={{model.leaseMax}} @onChange={{action (mut model.leaseMax)}} />
|
||||
<TtlPicker @labelText="Lease" @initialValue={{@model.lease}} @onChange={{action (mut @model.lease)}} />
|
||||
<TtlPicker @labelText="Maximum Lease" @initialValue={{@model.leaseMax}} @onChange={{action (mut @model.leaseMax)}} />
|
||||
<div class="box is-bottomless is-fullwidth">
|
||||
<button data-test-aws-input="lease-save" type="submit" class="button is-primary">
|
||||
Save
|
||||
|
@ -38,7 +38,7 @@
|
|||
</form>
|
||||
{{else}}
|
||||
<form
|
||||
{{action "save" "saveAWSRoot" (hash access_key=accessKey iam_endpoint=iamEndpoint sts_endpoint=stsEndpoint secret_key=secretKey region=region) on="submit"}}
|
||||
onsubmit={{action "saveRootCreds" (hash access_key=@accessKey iam_endpoint=@iamEndpoint sts_endpoint=@stsEndpoint secret_key=@secretKey region=@region)}}
|
||||
data-test-aws-root-creds-form="true"
|
||||
>
|
||||
<div class="box is-fullwidth is-shadowless is-marginless">
|
||||
|
@ -53,7 +53,7 @@
|
|||
Access key
|
||||
</label>
|
||||
<div class="control">
|
||||
<Input @type="text" @id="access" @name="access" class="input" @autocomplete="off" @spellcheck="false" @value={{accessKey}} data-test-aws-input="accessKey" />
|
||||
<Input @type="text" @id="access" @name="access" class="input" @autocomplete="off" @spellcheck="false" @value={{@accessKey}} data-test-aws-input="accessKey" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
|||
Secret key
|
||||
</label>
|
||||
<div class="control">
|
||||
<Input @type="password" @id="secret" @name="secret" class="input" @value={{secretKey}} data-test-aws-input="secretKey" />
|
||||
<Input @type="password" @id="secret" @name="secret" class="input" @value={{@secretKey}} data-test-aws-input="secretKey" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
<select
|
||||
name="region"
|
||||
id="region"
|
||||
onchange={{action (mut region) value="target.value"}}
|
||||
onchange={{action (mut @region) value="target.value"}}
|
||||
data-test-input="region"
|
||||
>
|
||||
<option value=""></option>
|
||||
|
@ -94,7 +94,7 @@
|
|||
IAM endpoint
|
||||
</label>
|
||||
<div class="control">
|
||||
<Input @type="text" @id="iam" @name="iam" class="input" @value={{iamEndpoint}} />
|
||||
<Input @type="text" @id="iam" @name="iam" class="input" @value={{@iamEndpoint}} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -102,7 +102,7 @@
|
|||
STS endpoint
|
||||
</label>
|
||||
<div class="control">
|
||||
<Input @type="text" @id="sts" @name="sts" class="input" @value={{stsEndpoint}} />
|
||||
<Input @type="text" @id="sts" @name="sts" class="input" @value={{@stsEndpoint}} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
{{#if configured}}
|
||||
{{#if @configured}}
|
||||
<div class="box is-fullwidth is-sideless is-marginless">
|
||||
<div class="field">
|
||||
<label for="publicKey" class="is-label">
|
||||
|
@ -8,7 +8,7 @@
|
|||
<MaskedInput
|
||||
@name="publickey"
|
||||
@id="publicKey"
|
||||
@value={{model.publicKey}}
|
||||
@value={{@model.publicKey}}
|
||||
@displayOnly={{true}}
|
||||
@allowCopy={{true}}
|
||||
data-test-ssh-input="public-key"
|
||||
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
<div class="field is-grouped-split box is-fullwidth is-bottomless">
|
||||
<div class="control">
|
||||
<CopyButton @clipboardText={{model.publicKey}} @class="button is-primary" @buttonType="button" @success={{action (set-flash-message "Public Key copied!")}}>
|
||||
<CopyButton @clipboardText={{@model.publicKey}} @class="button is-primary" @buttonType="button" @success={{action (set-flash-message "Public Key copied!")}}>
|
||||
Copy
|
||||
</CopyButton>
|
||||
</div>
|
||||
|
@ -33,7 +33,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<form {{action "saveConfig" on="submit"}} data-test-ssh-configure-form="true">
|
||||
<form onsubmit={{action "saveConfig"}} data-test-ssh-configure-form="true">
|
||||
<div class="box is-fullwidth is-sideless is-marginless">
|
||||
<NamespaceReminder @mode="save" @noun="configuration" />
|
||||
<div class="field">
|
||||
|
@ -41,7 +41,7 @@
|
|||
Private key
|
||||
</label>
|
||||
<div class="control">
|
||||
<Textarea @name="privateKey" @id="privateKey" class="input" @value={{model.privateKey}} />
|
||||
<Textarea @name="privateKey" @id="privateKey" class="input" @value={{@model.privateKey}} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -49,15 +49,15 @@
|
|||
Public key
|
||||
</label>
|
||||
<div class="control">
|
||||
<Textarea @name="publicKey" @id="publicKey" class="input" @value={{model.publicKey}} />
|
||||
<Textarea @name="publicKey" @id="publicKey" class="input" @value={{@model.publicKey}} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="b-checkbox">
|
||||
<input type="checkbox"
|
||||
id="generateSigningKey"
|
||||
class="styled"
|
||||
checked={{model.generateSigningKey}}
|
||||
onchange={{action (mut model.generateSigningKey) value="target.checked"}}
|
||||
checked={{@model.generateSigningKey}}
|
||||
onchange={{action (mut @model.generateSigningKey) value="target.checked"}}
|
||||
data-test-ssh-input={{generateSigningKey}}
|
||||
/>
|
||||
<label for="generateSigningKey" class="is-label">
|
|
@ -20,5 +20,24 @@
|
|||
</ToolbarActions>
|
||||
</Toolbar>
|
||||
|
||||
{{partial (concat "partials/secret-backend-settings/" model.type)}}
|
||||
{{#if (eq model.type "aws")}}
|
||||
<ConfigureAwsSecret
|
||||
@model={{model}}
|
||||
@tab={{tab}}
|
||||
@accessKey={{accessKey}}
|
||||
@secretKey={{secretKey}}
|
||||
@region={{region}}
|
||||
@iamEndpoint={{iamEndpoint}}
|
||||
@stsEndpoint={{stsEndpoint}}
|
||||
@saveAWSRoot={{action "save" "saveAWSRoot"}}
|
||||
@saveAWSLease={{action "save" "saveAWSLease"}} />
|
||||
{{else if (eq model.type "pki")}}
|
||||
<ConfigurePkiSecret />
|
||||
{{else if (eq model.type "ssh")}}
|
||||
<ConfigureSshSecret
|
||||
@model={{model}}
|
||||
@configured={{configured}}
|
||||
@saveConfig={{action "saveConfig"}} />
|
||||
{{/if}}
|
||||
|
||||
{{outlet}}
|
||||
|
|
Loading…
Reference in New Issue