vault/ui/app/components/mount/secrets-engine-form.hbs
Vault Automation e30d937d03
Backport [UI] Ember Data Migration - Core Addon - Search Select into ce/main (#14952)
* no-op commit

* backports 2a98c83

* fixes conflicts

---------

Co-authored-by: Jordan Reimer <zofskeez@gmail.com>
Co-authored-by: Jordan Reimer <jordan.reimer@hashicorp.com>
2026-05-22 09:58:00 -06:00

164 lines
No EOL
6.1 KiB
Handlebars

{{!
Copyright IBM Corp. 2016, 2025
SPDX-License-Identifier: BUSL-1.1
}}
<div>
<Page::Header>
<:breadcrumbs>
<Page::Breadcrumbs @breadcrumbs={{this.breadcrumbs}} />
</:breadcrumbs>
</Page::Header>
<MessageError @errorMessage={{this.errorMessage}} />
<form {{on "submit" (perform this.mountBackend)}} class="has-top-padding-m has-bottom-padding-s">
{{! Plugin registration type (built-in vs external) }}
<Hds::Form::RadioCard::Group @name="plugin-type" class="has-bottom-margin-m" as |RadioGroup|>
<RadioGroup.Legend>Plugin registration type</RadioGroup.Legend>
{{#each this.pluginTypeOptions as |option|}}
<RadioGroup.RadioCard
@checked={{eq this.pluginRegistrationType option.type}}
{{on "change" (fn this.setPluginType option.type)}}
@disabled={{option.disabled}}
data-test-radio-card={{option.dataTestAttr}}
as |Card|
>
<Card.Icon @name={{option.icon}} />
<Card.Label>{{option.label}}</Card.Label>
{{#if option.showBadge}}
<Card.Badge @text="Enterprise" data-test-badge="external-enterprise" />
{{/if}}
<Card.Description>{{option.description}}</Card.Description>
{{#if option.showAlert}}
<Card.Generic>
<Hds::Alert @type="compact" @color="neutral" class="has-top-padding-xs" data-test-inline-alert as |A|>
<A.Description>No external plugins for this engine are currently registered in your plugin catalog.</A.Description>
</Hds::Alert>
</Card.Generic>
{{/if}}
</RadioGroup.RadioCard>
{{/each}}
</Hds::Form::RadioCard::Group>
{{! Plugin version selection (only shows for external plugins) }}
{{#if this.shouldShowPluginVersionField}}
<div class="field" data-test-field="config.plugin_version">
<Hds::Form::Select::Field
@isRequired={{true}}
name="plugin-version"
data-test-select="plugin-version"
@value={{this.selectedPluginVersion}}
{{on "change" this.onPluginVersionChange}}
as |F|
>
<F.Label>Plugin version</F.Label>
<F.HelperText data-test-help-text="config.plugin_version">
Specifies the semantic version of the plugin to use, e.g. "v1.0.0".
{{#if @model.hasUnversionedPlugins}}
Un-versioned plugins are not supported, they must be enabled via CLI.
{{/if}}
{{#if this.pinnedVersionForCurrentPlugin}}
{{this.pinnedVersionForCurrentPlugin}}
is pinned for this plugin.
{{/if}}
</F.HelperText>
<F.Options>
{{#each this.filteredVersionOptions as |version|}}
<option value={{version}} data-test-version-option={{version}}>
{{version}}
{{#if (eq version this.pinnedVersionForCurrentPlugin)}}
(pinned)
{{/if}}
</option>
{{/each}}
</F.Options>
{{#if (get this.formValidations "config.plugin_version.errors.length")}}
<F.Error>
{{#each (get this.formValidations "config.plugin_version.errors") as |error|}}
{{error}}
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::Select::Field>
{{! Warning when selected version differs from pinned version }}
{{#if this.shouldShowPinWarning}}
<Hds::Alert @type="inline" @color="warning" class="has-top-margin-s" as |A|>
<A.Title>Version differs from pinned</A.Title>
<A.Description>
You have selected
{{this.selectedPluginVersion}}, but version
{{this.pinnedVersionForCurrentPlugin}}
is pinned for this plugin. Enabling the engine with this version will override the pinned version for this
mount.
</A.Description>
</Hds::Alert>
{{/if}}
</div>
{{/if}}
<FormFieldGroups
@model={{@model.form}}
@groupName="formFieldGroups"
@renderGroup="default"
@modelValidations={{this.formValidations}}
@onKeyUp={{this.onKeyUp}}
/>
<FormFieldGroups @model={{@model.form}} @renderGroup="Method Options" @groupName="formFieldGroups">
<SearchSelect
@id="oidc-key"
@fallbackComponent="input-search"
@options={{@model.oidcKeys}}
@inputValue={{@model.form.data.config.identity_token_key}}
@selectLimit="1"
@placeholder={{if
@model.oidcKeys
"Search for an existing OIDC key, or type a new key name to create it."
"Input a key name"
}}
@onChange={{this.handleIdentityTokenKeyChange}}
@onCreate={{this.onCreateOidcKey}}
data-test-field="config.identity_token_key"
/>
</FormFieldGroups>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<Hds::Button
@text="Enable engine"
@icon={{if this.mountBackend.isRunning "loading"}}
type="submit"
data-test-submit
disabled={{this.mountBackend.isRunning}}
/>
</div>
<div class="control">
<Hds::Button @text="Back" @color="secondary" {{on "click" this.goBack}} data-test-back-button />
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" class="has-top-padding-s" @message={{this.invalidFormAlert}} />
</div>
{{/if}}
</div>
</form>
</div>
{{#if this.oidcKeyForm}}
<Hds::Modal id="oidc-key-modal" @onClose={{fn (mut this.oidcKeyForm) null}} as |M|>
<M.Header data-test-modal-title>Create new key</M.Header>
<M.Body>
<p class="has-bottom-margin-s" data-test-modal-subtext>
This key will be created in the OIDC key path.
</p>
<Oidc::KeyForm
@onSave={{fn (mut this.oidcKeyForm) null}}
@form={{this.oidcKeyForm}}
@onCancel={{fn (mut this.oidcKeyForm) null}}
@isModalForm={{true}}
/>
</M.Body>
</Hds::Modal>
{{/if}}