-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PKI Redesign: setup Ember Engine #16925
Conversation
ui/app/templates/vault/cluster/secrets/backend/configuration.hbs
Outdated
Show resolved
Hide resolved
ui/lib/pki/addon/engine.js
Outdated
|
||
const { modulePrefix } = config; | ||
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */ | ||
const Eng = Engine.extend({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update this syntax to extends Engine
- that way we can also remove the eslint-disable
comment?
Sample below from ember engines quickstart which is also what Chelsea's used in the Vault Insights engine PR
// addon/engine.js
import Engine from '@ember/engine';
import loadInitializers from 'ember-load-initializers';
import Resolver from 'ember-resolver';
import config from './config/environment';
const { modulePrefix } = config;
export default class PkiEngine extends Engine {
modulePrefix = modulePrefix;
Resolver = Resolver;
}
loadInitializers(PkiEngine, modulePrefix);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out! I'll update.
ui/lib/pki/addon/resolver.js
Outdated
@@ -0,0 +1,3 @@ | |||
import Resolver from 'ember-resolver'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete this file if wherever we have import Resolver from './resolver';
we change to import Resolver from 'ember-resolver';
ui/lib/pki/index.js
Outdated
/* eslint-disable node/no-extraneous-require */ | ||
'use strict'; | ||
|
||
const EngineAddon = require('ember-engines/lib/engine-addon'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also taken from the quickstart guide, but could we do something like this instead?
const { buildEngine } = require('ember-engines/lib/engine-addon');
module.exports = buildEngine({
name: 'pki',
lazyLoading: {
enabled: false
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments! As I haven't worked much with engines I'm not confident enough in to give a full approval
ui/app/router.js
Outdated
@@ -114,6 +114,7 @@ Router.map(function () { | |||
this.route('backends', { path: '/' }); | |||
this.route('backend', { path: '/:backend' }, function () { | |||
this.mount('kmip'); | |||
// this.mount('pki'); // ARG TODO always comment out when pushing to main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought but if you used the environment from the config (which is already imported in the router file) you could conditionally use the mount for development and not have to worry about commenting it out. Something like this:
if (config.environment !== 'production') {
this.mount('pki');
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! Amended, and tested.
I have a question about the routing. If the engine is pki would it make more sense for that to come before the dyanmic engine name? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're off to a good start. Thanks!
This PR is the first of the PKI redesign project. We will be pushing our changes to main, but keeping the work hidden behind an Ember engine (later exposed in the 1.13 release). The mount for this engine will be commented out on the
router.js
file so a user can't accidentally fall upon the new routing. Thus, you should never see a pki mount added to therouter.js
file until the project is ready.Notes:
http://localhost:4200/ui/vault/secrets/pki-1/pki/<route>
wherepki-1
is the secret engine mount's name.Compare this to the current route (which doesn't have the appended pki).
http://localhost:4200/ui/vault/secrets/pki-1/<route>
Ran test locally, twice in a row, including Enterprise. Everything looked good.
If you want to test on the ui, be sure to yarn install before hand (And you'll need to yarn install when you move off the branch too).