diff --git a/ui/.storybook/preview-head.html b/ui/.storybook/preview-head.html index 9c353e54b153..13cafd050917 100644 --- a/ui/.storybook/preview-head.html +++ b/ui/.storybook/preview-head.html @@ -1,4 +1,6 @@ - + + + diff --git a/ui/app/app.js b/ui/app/app.js index 8b963f8e10cb..a215b634c98a 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -8,10 +8,27 @@ defineModifier(); let App; +/* eslint-disable ember/avoid-leaking-state-in-ember-objects */ App = Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver, + engines: { + replication: { + dependencies: { + services: [ + 'auth', + 'flash-messages', + 'namespace', + 'replication-mode', + 'router', + 'store', + 'version', + 'wizard', + ], + }, + }, + }, }); loadInitializers(App, config.modulePrefix); diff --git a/ui/app/components/empty-state.js b/ui/app/components/empty-state.js deleted file mode 100644 index 04e6c3d213c7..000000000000 --- a/ui/app/components/empty-state.js +++ /dev/null @@ -1,6 +0,0 @@ -import OuterHTML from './outer-html'; - -export default OuterHTML.extend({ - title: null, - message: null, -}); diff --git a/ui/app/components/info-table-row.js b/ui/app/components/info-table-row.js deleted file mode 100644 index 1be591196dc0..000000000000 --- a/ui/app/components/info-table-row.js +++ /dev/null @@ -1,34 +0,0 @@ -import { typeOf } from '@ember/utils'; -import { computed } from '@ember/object'; -import { or } from '@ember/object/computed'; -import Component from '@ember/component'; - -export default Component.extend({ - 'data-test-component': 'info-table-row', - classNames: ['info-table-row'], - isVisible: or('alwaysRender', 'value'), - - /* - * @param boolean - * indicates if the component content should be always be rendered. - * when false, the value of `value` will be used to determine if the component should render - */ - alwaysRender: false, - - /* - * @param string - * the display name for the value - * - */ - label: null, - - /* - * - * the value of the data passed in - by default the content of the component will only show if there is a value - */ - value: null, - - valueIsBoolean: computed('value', function() { - return typeOf(this.get('value')) === 'boolean'; - }), -}); diff --git a/ui/app/components/popup-menu.js b/ui/app/components/popup-menu.js deleted file mode 100644 index 3f263270c4e2..000000000000 --- a/ui/app/components/popup-menu.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: 'span', -}); diff --git a/ui/app/controllers/vault/cluster/replication/mode/secondaries/add.js b/ui/app/controllers/vault/cluster/replication/mode/secondaries/add.js deleted file mode 100644 index 01da58dffbe3..000000000000 --- a/ui/app/controllers/vault/cluster/replication/mode/secondaries/add.js +++ /dev/null @@ -1,3 +0,0 @@ -import ReplicationController from '../../../replication'; - -export default ReplicationController.extend(); diff --git a/ui/app/controllers/vault/cluster/replication/mode/secondaries/index.js b/ui/app/controllers/vault/cluster/replication/mode/secondaries/index.js deleted file mode 100644 index 01da58dffbe3..000000000000 --- a/ui/app/controllers/vault/cluster/replication/mode/secondaries/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import ReplicationController from '../../../replication'; - -export default ReplicationController.extend(); diff --git a/ui/app/controllers/vault/cluster/replication/mode/secondaries/revoke.js b/ui/app/controllers/vault/cluster/replication/mode/secondaries/revoke.js deleted file mode 100644 index 9be89e9d34fb..000000000000 --- a/ui/app/controllers/vault/cluster/replication/mode/secondaries/revoke.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from '../../../replication'; diff --git a/ui/app/helpers/includes.js b/ui/app/helpers/includes.js deleted file mode 100644 index ff61d3586b9d..000000000000 --- a/ui/app/helpers/includes.js +++ /dev/null @@ -1,7 +0,0 @@ -import { helper as buildHelper } from '@ember/component/helper'; - -export function includes([haystack, needle]) { - return haystack.includes(needle); -} - -export default buildHelper(includes); diff --git a/ui/app/helpers/reduce-to-array.js b/ui/app/helpers/reduce-to-array.js deleted file mode 100644 index b6d76d9e2b24..000000000000 --- a/ui/app/helpers/reduce-to-array.js +++ /dev/null @@ -1,17 +0,0 @@ -import { helper as buildHelper } from '@ember/component/helper'; -import { isNone, typeOf } from '@ember/utils'; - -export function reduceToArray(params) { - return params.reduce(function(result, param) { - if (isNone(param)) { - return result; - } - if (typeOf(param) === 'array') { - return result.concat(param); - } else { - return result.concat([param]); - } - }, []); -} - -export default buildHelper(reduceToArray); diff --git a/ui/app/initializers/enable-engines.js b/ui/app/initializers/enable-engines.js new file mode 100644 index 000000000000..858f36b06d08 --- /dev/null +++ b/ui/app/initializers/enable-engines.js @@ -0,0 +1,13 @@ +import config from '../config/environment'; + +export function initialize(/* application */) { + // attach mount hooks to the environment config + // context will be the router DSL + config.addRootMounts = function() { + this.mount('replication'); + }; +} + +export default { + initialize, +}; diff --git a/ui/app/mixins/cluster-route.js b/ui/app/mixins/cluster-route.js index 9b814c99ed14..2b7ff244ed23 100644 --- a/ui/app/mixins/cluster-route.js +++ b/ui/app/mixins/cluster-route.js @@ -13,6 +13,7 @@ export { INIT, UNSEAL, AUTH, CLUSTER, DR_REPLICATION_SECONDARY }; export default Mixin.create({ auth: service(), + store: service(), transitionToTargetRoute(transition) { const targetRoute = this.targetRouteName(transition); @@ -28,7 +29,7 @@ export default Mixin.create({ }, clusterModel() { - return this.modelFor(CLUSTER); + return this.modelFor(CLUSTER) || this.store.peekRecord('cluster', 'vault'); }, authToken() { diff --git a/ui/app/router.js b/ui/app/router.js index b1b87d87904e..de87a5433917 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -114,22 +114,9 @@ Router.map(function() { this.route('edit', { path: '/:policy_name/edit' }); }); this.route('replication-dr-promote'); - this.route('replication', function() { - this.route('index', { path: '/' }); - this.route('mode', { path: '/:replication_mode' }, function() { - //details - this.route('index', { path: '/' }); - this.route('manage'); - this.route('secondaries', function() { - this.route('add', { path: '/add' }); - this.route('revoke', { path: '/revoke' }); - this.route('config-show', { path: '/config/show/:secondary_id' }); - this.route('config-edit', { path: '/config/edit/:secondary_id' }); - this.route('config-create', { path: '/config/create/:secondary_id' }); - }); - }); - }); - + if (config.addRootMounts) { + config.addRootMounts.call(this); + } this.route('not-found', { path: '/*path' }); }); this.route('not-found', { path: '/*path' }); diff --git a/ui/app/routes/vault/cluster/replication/mode/index.js b/ui/app/routes/vault/cluster/replication/mode/index.js deleted file mode 100644 index b2663787983c..000000000000 --- a/ui/app/routes/vault/cluster/replication/mode/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { inject as service } from '@ember/service'; -import Route from '@ember/routing/route'; - -export default Route.extend({ - replicationMode: service(), - beforeModel() { - const replicationMode = this.paramsFor('vault.cluster.replication.mode').replication_mode; - this.get('replicationMode').setMode(replicationMode); - }, - model() { - return this.modelFor('vault.cluster.replication.mode'); - }, -}); diff --git a/ui/app/templates/components/auth-form.hbs b/ui/app/templates/components/auth-form.hbs index 8d1f204d3958..0f6412a11333 100644 --- a/ui/app/templates/components/auth-form.hbs +++ b/ui/app/templates/components/auth-form.hbs @@ -1,7 +1,7 @@