diff --git a/ui/app/components/mount-backend-form.js b/ui/app/components/mount-backend-form.js
index 89bf91ecf3..fafd5a4a61 100644
--- a/ui/app/components/mount-backend-form.js
+++ b/ui/app/components/mount-backend-form.js
@@ -1,12 +1,11 @@
-import Ember from 'ember';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
-import { action, setProperties } from '@ember/object';
+import { action } from '@ember/object';
import { task } from 'ember-concurrency';
-import { methods } from 'vault/helpers/mountable-auth-methods';
-import { engines, KMIP, TRANSFORM, KEYMGMT } from 'vault/helpers/mountable-secret-engines';
import { waitFor } from '@ember/test-waiters';
+import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends';
+import { methods } from 'vault/helpers/mountable-auth-methods';
/**
* @module MountBackendForm
@@ -20,105 +19,77 @@ import { waitFor } from '@ember/test-waiters';
*
*/
-const METHODS = methods();
-const ENGINES = engines();
-
export default class MountBackendForm extends Component {
@service store;
@service wizard;
@service flashMessages;
- @service version;
-
- get mountType() {
- return this.args.mountType || 'auth';
- }
-
- @tracked mountModel = null;
- @tracked showEnable = false;
// validation related properties
@tracked modelValidations = null;
@tracked invalidFormAlert = null;
- @tracked mountIssue = false;
-
- @tracked errors = '';
@tracked errorMessage = '';
- constructor() {
- super(...arguments);
- const type = this.args.mountType || 'auth';
- const modelType = type === 'secret' ? 'secret-engine' : 'auth-method';
- const model = this.store.createRecord(modelType);
- model.set('config', this.store.createRecord('mount-config'));
- this.mountModel = model;
- }
-
- get mountTypes() {
- return this.mountType === 'secret' ? this.engines : METHODS;
- }
-
- get engines() {
- if (this.version.isEnterprise) {
- return ENGINES.concat([KMIP, TRANSFORM, KEYMGMT]);
- }
- return ENGINES;
- }
-
willDestroy() {
// if unsaved, we want to unload so it doesn't show up in the auth mount list
super.willDestroy(...arguments);
- this.mountModel.rollbackAttributes();
+ this.args.mountModel.rollbackAttributes();
}
checkPathChange(type) {
- const mount = this.mountModel;
+ if (!type) return;
+ const mount = this.args.mountModel;
const currentPath = mount.path;
- const list = this.mountTypes;
- // if the current path matches a type (meaning the user hasn't altered it),
+ const mountTypes =
+ this.args.mountType === 'secret' ? supportedSecretBackends() : methods().map((auth) => auth.type);
+ // if the current path has not been altered by user,
// change it here to match the new type
- const isUnchanged = list.findBy('type', currentPath);
- if (!currentPath || isUnchanged) {
+ if (!currentPath || mountTypes.includes(currentPath)) {
mount.path = type;
}
}
checkModelValidity(model) {
const { isValid, state, invalidFormMessage } = model.validate();
- setProperties(this, {
- modelValidations: state,
- invalidFormAlert: invalidFormMessage,
- });
-
+ this.modelValidations = state;
+ this.invalidFormAlert = invalidFormMessage;
return isValid;
}
+ async showWarningsForKvv2() {
+ try {
+ const capabilities = await this.store.findRecord('capabilities', `${this.args.mountModel.path}/config`);
+ if (!capabilities?.canUpdate) {
+ // config error is not thrown from secret-engine adapter, so handling here
+ this.flashMessages.warning(
+ 'You do not have access to the config endpoint. The secret engine was mounted, but the configuration settings were not saved.'
+ );
+ // remove the config data from the model otherwise it will persist in the store even though network request failed.
+ [
+ this.args.mountModel.maxVersions,
+ this.args.mountModel.casRequired,
+ this.args.mountModel.deleteVersionAfter,
+ ] = [0, false, 0];
+ }
+ } catch (e) {
+ // Show different warning if we're not sure the config saved
+ this.flashMessages.warning(
+ 'You may not have access to the config endpoint. The secret engine was mounted, but the configuration settings may not be saved.'
+ );
+ }
+ return;
+ }
+
@task
@waitFor
*mountBackend(event) {
event.preventDefault();
- const mountModel = this.mountModel;
+ const mountModel = this.args.mountModel;
const { type, path } = mountModel;
// only submit form if validations pass
if (!this.checkModelValidity(mountModel)) {
return;
}
- let capabilities = null;
- try {
- capabilities = yield this.store.findRecord('capabilities', `${path}/config`);
- } catch (err) {
- if (Ember.testing) {
- //captures mount-backend-form component test
- yield mountModel.save();
- let mountType = this.mountType;
- mountType = mountType === 'secret' ? `${mountType}s engine` : `${mountType} method`;
- this.flashMessages.success(`Successfully mounted the ${type} ${mountType} at ${path}.`);
- yield this.args.onMountSuccess(type, path);
- return;
- } else {
- throw err;
- }
- }
const changedAttrKeys = Object.keys(mountModel.changedAttributes());
const updatesConfig =
@@ -130,7 +101,6 @@ export default class MountBackendForm extends Component {
yield mountModel.save();
} catch (err) {
if (err.httpStatus === 403) {
- this.mountIssue = true;
this.flashMessages.danger(
'You do not have access to the sys/mounts endpoint. The secret engine was not mounted.'
);
@@ -141,7 +111,7 @@ export default class MountBackendForm extends Component {
if (typeof e === 'object') return e.title || e.message || JSON.stringify(e);
return e;
});
- this.errors = errors;
+ this.errorMessage = errors;
} else if (err.message) {
this.errorMessage = err.message;
} else {
@@ -149,46 +119,39 @@ export default class MountBackendForm extends Component {
}
return;
}
- // mountModel must be after the save
- if (mountModel.isV2KV && updatesConfig && !capabilities.get('canUpdate')) {
- // config error is not thrown from secret-engine adapter, so handling here
- this.flashMessages.warning(
- 'You do not have access to the config endpoint. The secret engine was mounted, but the configuration settings were not saved.'
- );
- // remove the config data from the model otherwise it will save it even if the network request failed.
- [this.mountModel.maxVersions, this.mountModel.casRequired, this.mountModel.deleteVersionAfter] = [
- 0,
- false,
- 0,
- ];
+ if (mountModel.isV2KV && updatesConfig) {
+ yield this.showWarningsForKvv2();
}
- let mountType = this.mountType;
- mountType = mountType === 'secret' ? `${mountType}s engine` : `${mountType} method`;
- this.flashMessages.success(`Successfully mounted the ${type} ${mountType} at ${path}.`);
+ this.flashMessages.success(
+ `Successfully mounted the ${type} ${
+ this.mountType === 'secret' ? 'secrets engine' : 'auth method'
+ } at ${path}.`
+ );
yield this.args.onMountSuccess(type, path);
return;
}
@action
onKeyUp(name, value) {
- this.mountModel.set(name, value);
+ this.args.mountModel[name] = value;
}
@action
onTypeChange(path, value) {
if (path === 'type') {
this.wizard.set('componentState', value);
- this.checkPathChange(value);
}
}
@action
- toggleShowEnable(value) {
- this.showEnable = value;
- if (value === true && this.wizard.featureState === 'idle') {
- this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', this.mountModel.type);
- } else {
- this.wizard.transitionFeatureMachine(this.wizard.featureState, 'RESET', this.mountModel.type);
+ setMountType(value) {
+ this.args.mountModel.type = value;
+ this.checkPathChange(value);
+ if (value) {
+ this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', this.args.mountModel.type);
+ } else if (this.wizard.featureState === 'idle') {
+ // resets wizard
+ this.wizard.transitionFeatureMachine(this.wizard.featureState, 'RESET', this.args.mountModel.type);
}
}
}
diff --git a/ui/app/components/mount-backend/type-form.hbs b/ui/app/components/mount-backend/type-form.hbs
new file mode 100644
index 0000000000..758ec8d2e4
--- /dev/null
+++ b/ui/app/components/mount-backend/type-form.hbs
@@ -0,0 +1,37 @@
+{{#each (array "generic" "cloud" "infra") as |category|}}
+
+
+ {{#each (filter-by "category" category this.mountTypes) as |type|}}
+
+ {{/each}}
+
+{{/each}}
+
+
+
\ No newline at end of file
diff --git a/ui/app/components/mount-backend/type-form.js b/ui/app/components/mount-backend/type-form.js
new file mode 100644
index 0000000000..d66d31ebc3
--- /dev/null
+++ b/ui/app/components/mount-backend/type-form.js
@@ -0,0 +1,32 @@
+import Component from '@glimmer/component';
+import { inject as service } from '@ember/service';
+import { methods } from 'vault/helpers/mountable-auth-methods';
+import { allEngines, mountableEngines } from 'vault/helpers/mountable-secret-engines';
+import { tracked } from '@glimmer/tracking';
+
+/**
+ *
+ * @module MountBackendTypeForm
+ * MountBackendTypeForm components are used to display type options for
+ * mounting either an auth method or secret engine.
+ *
+ * @example
+ * ```js
+ *
+ * ```
+ * @param {CallableFunction} setMountType - function will recieve the mount type string. Should update the model type value
+ * @param {string} [mountType=auth] - mount type can be `auth` or `secret`
+ */
+
+export default class MountBackendTypeForm extends Component {
+ @service version;
+ @tracked selection;
+
+ get secretEngines() {
+ return this.version.isEnterprise ? allEngines() : mountableEngines();
+ }
+
+ get mountTypes() {
+ return this.args.mountType === 'secret' ? this.secretEngines : methods();
+ }
+}
diff --git a/ui/app/components/wizard/mounts-wizard.js b/ui/app/components/wizard/mounts-wizard.js
index 3113d86db0..afb8d8de2c 100644
--- a/ui/app/components/wizard/mounts-wizard.js
+++ b/ui/app/components/wizard/mounts-wizard.js
@@ -2,7 +2,7 @@ import { inject as service } from '@ember/service';
import { alias, equal } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
-import { engines } from 'vault/helpers/mountable-secret-engines';
+import { mountableEngines } from 'vault/helpers/mountable-secret-engines';
import { methods } from 'vault/helpers/mountable-auth-methods';
import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends';
const supportedSecrets = supportedSecretBackends();
@@ -36,7 +36,7 @@ export default Component.extend({
}),
mountName: computed('currentMachine', 'mountSubtype', function () {
if (this.currentMachine === 'secrets') {
- var secret = engines().find((engine) => {
+ const secret = mountableEngines().find((engine) => {
return engine.type === this.mountSubtype;
});
if (secret) {
diff --git a/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js b/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js
index cf18cd432b..4b2c306c36 100644
--- a/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js
+++ b/ui/app/controllers/vault/cluster/settings/mount-secret-backend.js
@@ -1,30 +1,34 @@
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends';
+import { allEngines } from 'vault/helpers/mountable-secret-engines';
+import { action } from '@ember/object';
const SUPPORTED_BACKENDS = supportedSecretBackends();
-export default Controller.extend({
- wizard: service(),
- actions: {
- onMountSuccess: function (type, path) {
- let transition;
- if (SUPPORTED_BACKENDS.includes(type)) {
- if (type === 'kmip') {
- transition = this.transitionToRoute('vault.cluster.secrets.backend.kmip.scopes', path);
- } else if (type === 'keymgmt') {
- transition = this.transitionToRoute('vault.cluster.secrets.backend.index', path, {
- queryParams: { tab: 'provider' },
- });
- } else {
- transition = this.transitionToRoute('vault.cluster.secrets.backend.index', path);
- }
+export default class MountSecretBackendController extends Controller {
+ @service wizard;
+ @service router;
+
+ @action
+ onMountSuccess(type, path) {
+ let transition;
+ if (SUPPORTED_BACKENDS.includes(type)) {
+ const engineInfo = allEngines().findBy('type', type);
+ if (engineInfo?.engineRoute) {
+ transition = this.router.transitionTo(
+ `vault.cluster.secrets.backend.${engineInfo.engineRoute}`,
+ path
+ );
} else {
- transition = this.transitionToRoute('vault.cluster.secrets.backends');
+ const queryParams = engineInfo?.routeQueryParams || {};
+ transition = this.router.transitionTo('vault.cluster.secrets.backend.index', path, { queryParams });
}
- return transition.followRedirects().then(() => {
- this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', type);
- });
- },
- },
-});
+ } else {
+ transition = this.router.transitionTo('vault.cluster.secrets.backends');
+ }
+ return transition.followRedirects().then(() => {
+ this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', type);
+ });
+ }
+}
diff --git a/ui/app/helpers/mountable-secret-engines.js b/ui/app/helpers/mountable-secret-engines.js
index f05c1e47ba..20e1692055 100644
--- a/ui/app/helpers/mountable-secret-engines.js
+++ b/ui/app/helpers/mountable-secret-engines.js
@@ -1,129 +1,117 @@
import { helper as buildHelper } from '@ember/component/helper';
-export const KMIP = {
- displayName: 'KMIP',
- value: 'kmip',
- type: 'kmip',
- category: 'generic',
- requiredFeature: 'KMIP',
-};
-
-export const TRANSFORM = {
- displayName: 'Transform',
- value: 'transform',
- type: 'transform',
- category: 'generic',
- requiredFeature: 'Transform Secrets Engine',
-};
-
-export const KEYMGMT = {
- displayName: 'Key Management',
- value: 'keymgmt',
- type: 'keymgmt',
- glyph: 'key',
- category: 'cloud',
- requiredFeature: 'Key Management Secrets Engine',
-};
+const ENTERPRISE_SECRET_ENGINES = [
+ {
+ displayName: 'KMIP',
+ type: 'kmip',
+ engineRoute: 'kmip.scopes',
+ category: 'generic',
+ requiredFeature: 'KMIP',
+ },
+ {
+ displayName: 'Transform',
+ type: 'transform',
+ category: 'generic',
+ requiredFeature: 'Transform Secrets Engine',
+ },
+ {
+ displayName: 'Key Management',
+ type: 'keymgmt',
+ glyph: 'key',
+ category: 'cloud',
+ requiredFeature: 'Key Management Secrets Engine',
+ routeQueryParams: { tab: 'provider' },
+ },
+];
const MOUNTABLE_SECRET_ENGINES = [
{
displayName: 'Active Directory',
- value: 'ad',
type: 'ad',
category: 'cloud',
},
{
displayName: 'AliCloud',
- value: 'alicloud',
type: 'alicloud',
category: 'cloud',
},
{
displayName: 'AWS',
- value: 'aws',
type: 'aws',
category: 'cloud',
glyph: 'aws-color',
},
{
displayName: 'Azure',
- value: 'azure',
type: 'azure',
category: 'cloud',
glyph: 'azure-color',
},
{
displayName: 'Consul',
- value: 'consul',
type: 'consul',
category: 'infra',
},
{
displayName: 'Databases',
- value: 'database',
type: 'database',
category: 'infra',
},
{
displayName: 'Google Cloud',
- value: 'gcp',
type: 'gcp',
category: 'cloud',
glyph: 'gcp-color',
},
{
displayName: 'Google Cloud KMS',
- value: 'gcpkms',
type: 'gcpkms',
category: 'cloud',
glyph: 'gcp-color',
},
{
displayName: 'KV',
- value: 'kv',
type: 'kv',
category: 'generic',
},
{
displayName: 'Nomad',
- value: 'nomad',
type: 'nomad',
category: 'infra',
},
{
displayName: 'PKI Certificates',
- value: 'pki',
type: 'pki',
category: 'generic',
},
{
displayName: 'RabbitMQ',
- value: 'rabbitmq',
type: 'rabbitmq',
category: 'infra',
},
{
displayName: 'SSH',
- value: 'ssh',
type: 'ssh',
category: 'generic',
},
{
displayName: 'Transit',
- value: 'transit',
type: 'transit',
category: 'generic',
},
{
displayName: 'TOTP',
- value: 'totp',
type: 'totp',
category: 'generic',
},
];
-export function engines() {
+export function mountableEngines() {
return MOUNTABLE_SECRET_ENGINES.slice();
}
-export default buildHelper(engines);
+export function allEngines() {
+ return [...MOUNTABLE_SECRET_ENGINES, ...ENTERPRISE_SECRET_ENGINES];
+}
+
+export default buildHelper(mountableEngines);
diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js
index 66bb3e5b2b..640296c8f8 100644
--- a/ui/app/models/secret-engine.js
+++ b/ui/app/models/secret-engine.js
@@ -95,43 +95,56 @@ export default SecretEngineModel.extend({
}),
formFieldGroups: computed('engineType', function () {
- const type = this.engineType;
- let defaultGroup;
- // KV has specific config options it adds on the enable engine. https://www.vaultproject.io/api/secret/kv/kv-v2#configure-the-kv-engine
- if (type === 'kv') {
- defaultGroup = { default: ['path', 'maxVersions', 'casRequired', 'deleteVersionAfter'] };
- } else {
- defaultGroup = { default: ['path'] };
- }
- const optionsGroup = {
- 'Method Options': ['description', 'config.listingVisibility', 'local', 'sealWrap'],
- };
- // no ttl options for keymgmt
- const ttl = type !== 'keymgmt' ? 'defaultLeaseTtl,maxLeaseTtl,' : '';
- optionsGroup['Method Options'].push(
- `config.{${ttl}auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`
- );
+ let defaultFields = ['path'];
+ let optionFields;
+ const CORE_OPTIONS = ['description', 'config.listingVisibility', 'local', 'sealWrap'];
- if (type === 'kv' || type === 'generic') {
- optionsGroup['Method Options'].unshift('version');
+ switch (this.engineType) {
+ case 'kv':
+ defaultFields = ['path', 'maxVersions', 'casRequired', 'deleteVersionAfter'];
+ optionFields = [
+ 'version',
+ ...CORE_OPTIONS,
+ `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`,
+ ];
+ break;
+ case 'generic':
+ optionFields = [
+ 'version',
+ ...CORE_OPTIONS,
+ `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`,
+ ];
+ break;
+ case 'database':
+ // Highlight TTLs in default
+ defaultFields = ['path', 'config.{defaultLeaseTtl}', 'config.{maxLeaseTtl}'];
+ optionFields = [
+ ...CORE_OPTIONS,
+ 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
+ ];
+ break;
+ case 'keymgmt':
+ // no ttl options for keymgmt
+ optionFields = [
+ ...CORE_OPTIONS,
+ 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
+ ];
+ break;
+ default:
+ defaultFields = ['path'];
+ optionFields = [
+ ...CORE_OPTIONS,
+ `config.{defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}`,
+ ];
+ break;
}
- if (type === 'database') {
- // For the Database Secret Engine we want to highlight the defaultLeaseTtl and maxLeaseTtl, removing them from the options object
- defaultGroup.default.push('config.{defaultLeaseTtl}', 'config.{maxLeaseTtl}');
- return [
- defaultGroup,
- {
- 'Method Options': [
- 'description',
- 'config.listingVisibility',
- 'local',
- 'sealWrap',
- 'config.{auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
- ],
- },
- ];
- }
- return [defaultGroup, optionsGroup];
+
+ return [
+ { default: defaultFields },
+ {
+ 'Method Options': optionFields,
+ },
+ ];
}),
attrs: computed('formFields', function () {
diff --git a/ui/app/routes/vault/cluster/secrets/backend/list.js b/ui/app/routes/vault/cluster/secrets/backend/list.js
index 952e11a996..b753d7d56b 100644
--- a/ui/app/routes/vault/cluster/secrets/backend/list.js
+++ b/ui/app/routes/vault/cluster/secrets/backend/list.js
@@ -2,6 +2,7 @@ import { set } from '@ember/object';
import { hash, all } from 'rsvp';
import Route from '@ember/routing/route';
import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends';
+import { allEngines } from 'vault/helpers/mountable-secret-engines';
import { inject as service } from '@ember/service';
import { normalizePath } from 'vault/utils/path-encoding-helpers';
@@ -11,6 +12,7 @@ export default Route.extend({
store: service(),
templateName: 'vault/cluster/secrets/backend/list',
pathHelp: service('path-help'),
+ router: service(),
// By default assume user doesn't have permissions
noMetadataPermissions: true,
@@ -62,11 +64,16 @@ export default Route.extend({
const { tab } = this.paramsFor('vault.cluster.secrets.backend.list-root');
const secretEngine = this.store.peekRecord('secret-engine', backend);
const type = secretEngine && secretEngine.get('engineType');
+ const engineRoute = allEngines().findBy('type', type)?.engineRoute;
+
if (!type || !SUPPORTED_BACKENDS.includes(type)) {
- return this.transitionTo('vault.cluster.secrets');
+ return this.router.transitionTo('vault.cluster.secrets');
}
if (this.routeName === 'vault.cluster.secrets.backend.list' && !secret.endsWith('/')) {
- return this.replaceWith('vault.cluster.secrets.backend.list', secret + '/');
+ return this.router.replaceWith('vault.cluster.secrets.backend.list', secret + '/');
+ }
+ if (engineRoute) {
+ return this.router.transitionTo(`vault.cluster.secrets.backend.${engineRoute}`, backend);
}
const modelType = this.getModelType(backend, tab);
return this.pathHelp.getNewModel(modelType, backend).then(() => {
diff --git a/ui/app/routes/vault/cluster/settings/auth/enable.js b/ui/app/routes/vault/cluster/settings/auth/enable.js
new file mode 100644
index 0000000000..dd04991e86
--- /dev/null
+++ b/ui/app/routes/vault/cluster/settings/auth/enable.js
@@ -0,0 +1,17 @@
+import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
+
+export default class VaultClusterSettingsAuthEnableRoute extends Route {
+ @service store;
+
+ beforeModel() {
+ // Unload to prevent naming collisions when we mount a new engine
+ this.store.unloadAll('auth-method');
+ }
+
+ model() {
+ const authMethod = this.store.createRecord('auth-method');
+ authMethod.set('config', this.store.createRecord('mount-config'));
+ return authMethod;
+ }
+}
diff --git a/ui/app/routes/vault/cluster/settings/mount-secret-backend.js b/ui/app/routes/vault/cluster/settings/mount-secret-backend.js
index e711b4b140..1cb8188a2d 100644
--- a/ui/app/routes/vault/cluster/settings/mount-secret-backend.js
+++ b/ui/app/routes/vault/cluster/settings/mount-secret-backend.js
@@ -1,16 +1,17 @@
import Route from '@ember/routing/route';
-import UnloadModelRoute from 'vault/mixins/unload-model-route';
-import UnsavedModelRoute from 'vault/mixins/unsaved-model-route';
import { inject as service } from '@ember/service';
-export default Route.extend(UnloadModelRoute, UnsavedModelRoute, {
- store: service(),
- // intentionally blank - we don't want a model until one is
- // created via the form in the controller
- model() {
- return {};
- },
- activate() {
+export default class VaultClusterSettingsMountSecretBackendRoute extends Route {
+ @service store;
+
+ beforeModel() {
+ // Unload to prevent naming collisions when we mount a new engine
this.store.unloadAll('secret-engine');
- },
-});
+ }
+
+ model() {
+ const secretEngine = this.store.createRecord('secret-engine');
+ secretEngine.set('config', this.store.createRecord('mount-config'));
+ return secretEngine;
+ }
+}
diff --git a/ui/app/templates/components/mount-backend-form.hbs b/ui/app/templates/components/mount-backend-form.hbs
index 9f9ce2bff7..8c7a1adb67 100644
--- a/ui/app/templates/components/mount-backend-form.hbs
+++ b/ui/app/templates/components/mount-backend-form.hbs
@@ -2,100 +2,66 @@
{{#if this.showEnable}}
- {{#let (find-by "type" this.mountModel.type this.mountTypes) as |typeInfo|}}
+ {{#let (find-by "type" @mountModel.type @mountTypes) as |typeInfo|}}
- {{#if (eq this.mountType "auth")}}
- {{concat "Enable " typeInfo.displayName " Authentication Method"}}
- {{else}}
+ {{#if (eq @mountType "secret")}}
{{concat "Enable " typeInfo.displayName " Secrets Engine"}}
+ {{else}}
+ {{concat "Enable " typeInfo.displayName " Authentication Method"}}
{{/if}}
{{/let}}
- {{else if (eq this.mountType "auth")}}
- Enable an Authentication Method
- {{else}}
+ {{else if (eq @mountType "secret")}}
Enable a Secrets Engine
+ {{else}}
+ Enable an Authentication Method
{{/if}}
-