4a1013e915
* be more specific about node version, and specify a yarn version * update ember, ember-cli, ember-data, ember-data-model-fragments * use router handlers to access transition information * fix shadowing of component helper * update ivy-codemirror, ember-cli-inject-live-reload * remove custom router service * don't use transition.queryParams * update ember-cli-deprecation-workflow * refactor kv v1 to use 'path' instead of 'id' on creation * fix auth-jwt-test and toolbar-link-test * update ember composable helpers * remove Ember.copy from test file * no more deprecations in the workflow * fix more secret tests * fix remaining failed tests * move select component to core because it's used by ttl-picker * generate new model class for each test instead of reusing an existing one * fix selectors on kmip tests * refactor how control groups construct urls from the new transition objects * add router service override back in, and have it be evented so that we can trigger router events on it * move stories and markdown files to core if the component lives in core * update ember-cli, ember-cli-babel, ember-auto-import * update base64js, date-fns, deepmerge, codemirror, broccoli-asset-rev * update linting rules * fix test selectors * update ember-api-actions, ember-concurrency, ember-load-initializers, escape-string-regexp, normalize.css, prettier-eslint-cli, jsdoc-to-markdown * remove test-results dir * update base64js, ember-cli-clipboard, ember-cli-sass, ember-cli-string-helpers, ember-cli-template-lint, ember-cli-uglify, ember-link-action * fix linting * run yarn install without restoring from cache * refactor how tests are run and handle the vault server subprocess * update makefile for new test task names * update circle config to use the new yarn task * fix writing the seal keys when starting the dev server * remove optional deps from the lockfile * don't ignore-optional on yarn install * remove errant console.log * update ember-basic-dropdown-hover, jsonlint, yargs-parser * update ember-cli-flash * add back optionalDeps * update @babel/core@7.5.5, ember-basic-dropdown@1.1.3, eslint-plugin-ember@6.8.2 * update storybook to the latest release * add a babel config with targets so that the ember babel plugin works properly * update ember-resolver, move ember-cli-storybook to devDependencies * revert normalize.css upgrade * silence fetchadapter warning for now * exclude 3rd party array helper now that ember includes one * fix switch and entity lookup styling * only add -root suffix if it's not in versions mode * make sure drop always has an array on the aws role form * fix labels like we did with the backport * update eslintignore * update the yarn version in the docker build file * update eslint ignore |
||
---|---|---|
.. | ||
.storybook | ||
app | ||
blueprints | ||
config | ||
lib | ||
public | ||
scripts | ||
stories | ||
tests | ||
vendor | ||
.editorconfig | ||
.ember-cli | ||
.env | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.nvmrc | ||
.prettierrc | ||
.template-lintrc.js | ||
.watchmanconfig | ||
ember-cli-build.js | ||
package.json | ||
README.md | ||
testem.browserstack.js | ||
testem.js | ||
yarn.lock |
Table of Contents
Vault UI
This README outlines the details of collaborating on this Ember application.
Prerequisites
You will need the following things properly installed on your computer.
* Husky and lint-staged are optional dependencies - running yarn
will install them.
If don't want them installed (husky adds files for every hooks in .git/hooks/
),
then you can run yarn --ignore-optional
. If you've ignored the optional deps
previously and want to install them, you have to tell yarn to refetch all deps by
running yarn --force
.
Running / Development
To get all of the JavaScript dependencies installed, run this in the ui
directory:
yarn
If you want to run Vault UI and proxy back to a Vault server running
on the default port, 8200, run the following in the ui
directory:
yarn run start
This will start an Ember CLI server that proxies requests to port 8200, and enable live rebuilding of the application as you change the UI application code. Visit your app at http://localhost:4200.
If your Vault server is running on a different port you can use the long-form version of the npm script:
ember server --proxy=http://localhost:PORT
Code Generators
Make use of the many generators for code, try ember help generate
for more details
Running Tests
Running tests will spin up a Vault dev server on port 9200 via a pretest script that testem (the test runner) executes. All of the acceptance tests then run, proxing requests back to that server.
yarn run test-oss
yarn run test-oss -s
to keep the test server running after the initial run.yarn run test -f="policies"
to filter the tests that are run.-f
gets passed into QUnit'sfilter
configyarn run test:browserstack
to run the kv acceptance tests in Browserstack
Automated Cross-Browser Testing
Vault uses Browserstack Automate to run all the kv acceptance tests on various browsers. You can view the list of browsers we test by viewing testem.browserstack.js
.
Running Browserstack Locally
To run the Browserstack tests locally you will need to add your BROWSERSTACK_USERNAME
and BROWSERSTACK_ACCESS_KEY
to your environment. Then run yarn run test:browserstack
. You can view the currently running tests at localhost:7357
or log in to Browserstack Automate to view a previous build.
To run the tests locally in a browser other than IE11, swap out launch_in_ci: ['BS_IE_11']
inside testem.browserstack.js
.
Linting
yarn lint:hbs
yarn lint:js
yarn lint:js -- --fix
Building Vault UI into a Vault Binary
We use go-bindata-assetfs
to build the static assets of the
Ember application into a Vault binary.
This can be done by running these commands from the root directory run:
make static-dist
make dev-ui
This will result in a Vault binary that has the UI built-in - though in
a non-dev setup it will still need to be enabled via the ui
config or
setting VAULT_UI
environment variable.
Vault Storybook
The Vault UI uses Storybook to catalog all of its components. Below are details for running and contributing to Storybook.
Storybook Commands at a Glance
Command | Description |
---|---|
yarn storybook |
run storybook |
ember generate story [name-of-component] |
generate a new story |
ember generate story [name-of-component] -ir [name-of-engine-or-addon] |
generate a new story in the specified engine or addon |
yarn gen-story-md [name-of-component] |
update a story notes file |
yarn gen-story-md [name-of-component] [name-of-engine-or-addon] |
update a story notes file in the specified engine or addon |
Writing Stories
Each component in vault/ui/app/components
should have a corresponding [component-name].stories.js
and [component-name].md
files within vault/ui/stories
. Components in the core
addon located at vault/ui/lib/core/addon/components
have corresponding stories and markdown files in vault/ui/lib/core/stories
.
Adding a new story
- Make sure the component is well-documented using jsdoc. This documentation should at minimum include the module name, an example of usage, and the params passed into the handlebars template. For example, here is how we document the ToggleButton Component:
/**
* @module ToggleButton
* `ToggleButton` components are used to expand and collapse content with a toggle.
*
* @example
* ```js
* <ToggleButton @openLabel="Encrypt Output with PGP" @closedLabel="Encrypt Output with PGP" @toggleTarget={{this}} @toggleAttr="showOptions"/>
* {{#if showOptions}}
* <div>
* <p>
* I will be toggled!
* </p>
* </div>
* {{/if}}
* ```
*
* @param toggleAttr=null {String} - The attribute upon which to toggle.
* @param attrTarget=null {Object} - The target upon which the event handler should be added.
* @param [openLabel=Hide options] {String} - The message to display when the toggle is open. //optional params are denoted by square brackets
* @param [closedLabel=More options] {String} - The message to display when the toggle is closed.
*/
Note that placing a param inside brackets (e.g. [closedLabel=More options]
indicates it is optional and has a default value of 'More options'
.)
- Generate a new story with
ember generate story [name-of-component]
- Inside the newly generated
stories
file, add at least one example of the component. If the component should be interactive, enable the Storybook Knobs addon. - Generate the
notes
file for the component withyarn gen-story-md [name-of-component]
(e.g.yarn gen-md alert-banner
). This will generate markdown documentation of the component and place it atvault/ui/stories/[name-of-component].md
. If your component is a template-only component, you will need to manually create the markdown file.
See the Storybook Docs for more information on writing stories.
Code Generators
It is important to add all new components into Storybook and to keep the story and notes files up to date. To ease the process of creating and updating stories please use the code generators using the commands listed above.