Skip to content
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

UI - core addon & replication engine #6629

Merged
merged 43 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e930ebf
add initializer hook to mount engines inside the cluster route
meirish Apr 17, 2019
fb2f134
add ember-engines and an in-repo addon
meirish Apr 18, 2019
56a1b6a
start moving components needed for replication to core addon
meirish Apr 18, 2019
c014f00
move replication routes to a lazy engine
meirish Apr 18, 2019
d41d95e
add assetLoader block to the build to support rootURL for engines
meirish Apr 19, 2019
29a9d1e
share template addons in the core addon
meirish Apr 19, 2019
4880692
share services with the replication engine
meirish Apr 19, 2019
30e82cc
move replication code over to the replication engine
meirish Apr 19, 2019
e45f981
move shared components to core and replication components to replicat…
meirish Apr 20, 2019
497d656
move shared helpers and utils to core
meirish Apr 20, 2019
87417a4
move named replication route to addon application route
meirish Apr 20, 2019
2811fa5
update shared services and core addon deps
meirish Apr 20, 2019
454da2b
comment out usage of i-con component for now
meirish Apr 22, 2019
e56d139
share info-table-row, is-active-route helper, ember-cli-string-helpers
meirish Apr 22, 2019
c82289c
change route names to be relative to the replication engine
meirish Apr 22, 2019
5bf7644
share confirm-action and doc-link components
meirish Apr 22, 2019
355f626
share namespace service
meirish Apr 22, 2019
3c00245
share ttl-picker component
meirish Apr 22, 2019
672508d
more relative routes and move params checking to the model hook inste…
meirish Apr 22, 2019
fea375a
fix ttl component sharing
meirish Apr 23, 2019
45827d2
fix routing issue with using cluster name in engine route
meirish Apr 23, 2019
1076fa9
move replication partials to components in the replication engine
meirish Apr 23, 2019
9b4b32a
share alert-inline component and message-types helper
meirish Apr 23, 2019
d0c8de3
remove test component
meirish Apr 23, 2019
e7470e6
fix non-replication tests
meirish Apr 23, 2019
695b68e
remove reduce-to-array helper
meirish Apr 25, 2019
a010369
rework components that came from partials
meirish Apr 25, 2019
33ca09a
move vault-loading and loading partials to shared components in core
meirish Apr 25, 2019
323cd6a
share upgrade-page and mount-filter-config-list
meirish Apr 25, 2019
af56b73
remove includes helper, use contains from ember-composable-helpers
meirish Apr 25, 2019
c956ff2
move toggle-button and upgrade-page to core addon
meirish Apr 25, 2019
37023bc
don't reexport layout for engines components
meirish Apr 25, 2019
1d963fe
fix integration tests for the engine component
meirish Apr 25, 2019
9f950d6
share popup-menu component, basic-dropdown addon, and set-flash-messa…
meirish Apr 26, 2019
893b32d
trigger route reloads, and fix routing from controllers, fix tests
meirish Apr 26, 2019
971030c
no text in the popup because it breaks some filtering by text in tests
meirish Apr 29, 2019
a219a26
fix tests
meirish Apr 29, 2019
1b7c5fd
update yarn.lock
meirish May 3, 2019
becb8ce
update md generation script so you can point it at an addon / engine …
meirish May 5, 2019
bbcabca
update ember-cli-storybook fork to support asset-manifest
meirish May 6, 2019
9c06ec4
updates to the generated preview head for storybook
meirish May 6, 2019
17acf70
add doc-link, empty-state, info-table-row, loading-layout, message-er…
meirish May 6, 2019
e3c9983
OR the search for component usage to match curly or angle bracket syntax
meirish May 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add doc-link, empty-state, info-table-row, loading-layout, message-er…
…ror, popup-menu, ttl-picker, and vault-logo-spinner to storybook
  • Loading branch information
meirish committed May 6, 2019
commit 17acf704316d8e30b84e48878e6cf30d777e53fb
13 changes: 13 additions & 0 deletions ui/lib/core/addon/components/doc-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import Component from '@ember/component';
import { computed } from '@ember/object';
import hbs from 'htmlbars-inline-precompile';

/**
* @module DocLink
* `DocLink` components are used to render anchor links to relevant Vault documentation.
*
* @example
* ```js
<DocLink @path="/docs/secrets/kv/kv-v2.html">Learn about KV v2</DocLink>
* ```
*
* @param path="/"{String} - The path to documentation on vaultproject.io that the component should link to.
*
*/

export default Component.extend({
tagName: 'a',
classNames: ['doc-link'],
Expand Down
15 changes: 15 additions & 0 deletions ui/lib/core/addon/components/empty-state.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import Component from '@ember/component';
import layout from '../templates/components/empty-state';

/**
* @module EmptyState
* `EmptyState` components are used to render a helpful message and any necessary content when a user
* encounters a state that would usually be blank.
*
* @example
* ```js
* <EmptyState @title="You don't have an secrets yet" @message="An explanation of why you don't have any secrets but also you maybe want to create one." />
* ```
*
* @param title=null{String} - A short label for the empty state
* @param message=null{String} - A description of why a user might be seeing the empty state and possibly instructions for actions they may take.
*
*/

export default Component.extend({
layout,
tagName: '',
Expand Down
31 changes: 15 additions & 16 deletions ui/lib/core/addon/components/info-table-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@ import { or } from '@ember/object/computed';
import Component from '@ember/component';
import layout from '../templates/components/info-table-row';

/**
* @module InfoTableRow
* `InfoTableRow` displays a label and a value in a table-row style manner. The component is responsive so
* that the value breaks under the label on smaller viewports.
*
* @example
* ```js
* <InfoTableRow @value={{5}} @label="TTL" />
* ```
*
* @param value=null {any} - The the data to be displayed - by default the content of the component will only show if there is a value. Also note that special handling is given to boolean values - they will render `Yes` for true and `No` for false.
* @param label=null {string} - The display name for the value.
* @param alwaysRender=false {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.
*
*/
export default Component.extend({
layout,
'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() {
Expand Down
10 changes: 10 additions & 0 deletions ui/lib/core/addon/components/layout-loading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import Component from '@ember/component';
import layout from '../templates/components/layout-loading';

/**
* @module LayoutLoading
* `LayoutLoading` displays the `VaultLogoSpinner` component in a centered full-page layout.
*
* @example
* ```js
* <LayoutLoading />
* ```
*/

export default Component.extend({
layout,
tagName: '',
Expand Down
18 changes: 15 additions & 3 deletions ui/lib/core/addon/components/message-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@ import { computed } from '@ember/object';
import Component from '@ember/component';
import layout from '../templates/components/message-error';

/**
* @module MessageError
* `MessageError` extracts an error from a model or a passed error and displays it using the `AlertBanner` component.
*
* @example
* ```js
* <MessageError @model={{model}} />
* ```
*
* @param model=null{DS.Model} - An Ember data model that will be used to bind error statest to the internal
* `errors` property.
* @param errors=null{Array} - An array of error strings to show.
* @param errorMessage=null{String} - An Error string to display.
*/
export default Component.extend({
layout,
model: null,
errors: computed(function() {
return [];
}),
errors: null,
errorMessage: null,

displayErrors: computed(
Expand Down
14 changes: 14 additions & 0 deletions ui/lib/core/addon/components/popup-menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import Component from '@ember/component';
import layout from '../templates/components/popup-menu';

/**
* @module PopupMenu
* `PopupMenu` displays a button that when pressed will toggle open a menu that is yielded in the content
* block.
*
* @example
* ```js
* <PopupMenu><nav class="menu"> <ul class="menu-list"> <li class="action"> <button type="button">A menu!</button> </li> </ul> </nav></PopupMenu>
* ```
*
* @param contentClass=''{String} A class that will be applied to the yielded content of the popup.
*/

export default Component.extend({
layout,
contentClass: '',
tagName: 'span',
});
25 changes: 22 additions & 3 deletions ui/lib/core/addon/components/ttl-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,35 @@ import layout from '../templates/components/ttl-picker';

const ERROR_MESSAGE = 'TTLs must be specified in whole number increments, please enter a whole number.';

/**
* @module TtlPicker
* `TtlPicker` components are used to expand and collapse content with a toggle.
*
* @example
* ```js
<TtlPicker @labelText="Lease" @initialValue={{lease}} @onChange={{action (mut lease)}} />
* ```
*
* @param labelClass="" {String} - A CSS class to add to the label.
* @param labelText="TTL" {String} - The text content of the label associated with the widget.
* @param initialValue=null {Number} - The starting value of the TTL;
* @param setDefaultValue=true {Boolean} - If true, the component will trigger onChange on the initial
* render, causing a value to be set.
* @param onChange=Function.prototype{Function} - The function to call when the value of the ttl changes.
* @param outputSeconds=false{Boolean} - If true, the component will trigger onChange with a value
* converted to seconds instead of a Golang duration string.
*/
export default Component.extend({
layout,
'data-test-component': 'ttl-picker',
classNames: 'field',
setDefaultValue: true,

onChange: () => {},
setDefaultValue: true,
labelText: 'TTL',
labelClass: '',
ouputSeconds: false,

time: 30,
unit: 'm',
initialValue: null,
Expand All @@ -28,8 +49,6 @@ export default Component.extend({
];
}),

ouputSeconds: false,

convertToSeconds(time, unit) {
const toSeconds = {
s: 1,
Expand Down
10 changes: 10 additions & 0 deletions ui/lib/core/addon/components/vault-logo-spinner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import Component from '@ember/component';
import layout from '../templates/components/vault-logo-spinner';

/**
* @module VaultLogoSpinner
* `VaultLogoSpinner` displays an animated Vault logo to use for loading screens.
*
* @example
* ```js
* <VaultLogoSpinner />
* ```
*/

export default Component.extend({
layout,
tagName: '',
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/core/app/helpers/message-types.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default, messageTypes } from 'core/helpers/message-types';
export { default, messageTypes, MESSAGE_TYPES } from 'core/helpers/message-types';
3 changes: 2 additions & 1 deletion ui/stories/alert-banner.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import notes from './alert-banner.md';
import { MESSAGE_TYPES } from '../app/helpers/message-types.js';
import { MESSAGE_TYPES } from '../lib/core/addon/helpers/message-types.js';


storiesOf('Alerts/AlertBanner/', module)
.addParameters({ options: { showPanel: false } })
Expand Down
2 changes: 1 addition & 1 deletion ui/stories/alert-inline.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import notes from './alert-inline.md';
import { MESSAGE_TYPES } from '../app/helpers/message-types.js';
import { MESSAGE_TYPES } from '../lib/core/addon/helpers/message-types.js';

storiesOf('Alerts/AlertInline/', module)
.addParameters({ options: { showPanel: false } })
Expand Down
2 changes: 1 addition & 1 deletion ui/stories/alert-popup.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import notes from './alert-popup.md';
import { MESSAGE_TYPES } from '../app/helpers/message-types.js';
import { MESSAGE_TYPES } from '../lib/core/addon/helpers/message-types.js';

storiesOf('Alerts/AlertPopup/', module)
.addParameters({ options: { showPanel: false } })
Expand Down
22 changes: 22 additions & 0 deletions ui/stories/doc-link.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--THIS FILE IS AUTO GENERATED. This file is generated from JSDoc comments in lib/core/addon/components/doc-link.js. To make changes, first edit that file and run "yarn gen-story-md doc-link" to re-generate the content.-->

## DocLink
`DocLink` components are used to render anchor links to relevant Vault documentation.


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| path | <code>String</code> | <code>&quot;/&quot;</code> | The path to documentation on vaultproject.io that the component should link to. |

**Example**

```js
<DocLink @path="/docs/secrets/kv/kv-v2.html">Learn about KV v2</DocLink>
```

**See**

- [Uses of DocLink](https://github.com/hashicorp/vault/search?l=Handlebars&q=DocLink)
- [DocLink Source Code](https://github.com/hashicorp/vault/blob/master/ui/app/components/doc-link.js)

---
16 changes: 16 additions & 0 deletions ui/stories/doc-link.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable import/extensions */
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import notes from './doc-link.md';


storiesOf('DocLink/', module)
.addParameters({ options: { showPanel: true } })
.add(`DocLink`, () => ({
template: hbs`
<h5 class="title is-5">Doc Link</h5>
<DocLink @path="/docs/secrets/kv/kv-v2.html">Learn about KV v2</DocLink>
`
}),
{notes}
);
24 changes: 24 additions & 0 deletions ui/stories/empty-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--THIS FILE IS AUTO GENERATED. This file is generated from JSDoc comments in lib/core/addon/components/empty-state.js. To make changes, first edit that file and run "yarn gen-story-md empty-state" to re-generate the content.-->

## EmptyState
`EmptyState` components are used to render a helpful message and any necessary content when a user
encounters a state that would usually be blank.


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| title | <code>String</code> | <code></code> | A short label for the empty state |
| message | <code>String</code> | <code></code> | A description of why a user might be seeing the empty state and possibly instructions for actions they may take. |

**Example**

```js
<EmptyState @title="You don't have an secrets yet" @message="An explanation of why you don't have any secrets but also you maybe want to create one." />
```

**See**

- [Uses of EmptyState](https://github.com/hashicorp/vault/search?l=Handlebars&q=EmptyState)
- [EmptyState Source Code](https://github.com/hashicorp/vault/blob/master/ui/app/components/empty-state.js)

---
35 changes: 35 additions & 0 deletions ui/stories/empty-state.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable import/extensions */
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import { withKnobs, text } from '@storybook/addon-knobs';
import notes from './empty-state.md';

storiesOf('EmptyState/', module)
.addParameters({ options: { showPanel: true } })
.addDecorator(withKnobs({escapeHTML: false}))
.add(`EmptyState`, () => ({
template: hbs`
<h5 class="title is-5">Empty State</h5>
<EmptyState @title={{title}} @message={{message}} />
`,
context: {
title: text('Title', 'You don\'t have an secrets yet'),
message: text('Message', 'An explanation of why you don\'t have any secrets but also you maybe want to create one.')
},
}),
{notes}
)
.add(`EmptyState with content block`, () => ({
template: hbs`
<h5 class="title is-5">Empty State</h5>
<EmptyState @title={{title}} @message={{message}}>
<DocLink @path="/docs/secrets/kv/kv-v2.html">Learn about KV v2</DocLink>
</EmptyState>
`,
context: {
title: text('Title', 'You don\'t have an secrets yet'),
message: text('Message', 'An explanation of why you don\'t have any secrets but also you maybe want to create one.')
},
}),
{notes}
);
25 changes: 25 additions & 0 deletions ui/stories/info-table-row.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--THIS FILE IS AUTO GENERATED. This file is generated from JSDoc comments in lib/core/addon/components/info-table-row.js. To make changes, first edit that file and run "yarn gen-story-md info-table-row" to re-generate the content.-->

## InfoTableRow
`InfoTableRow` displays a label and a value in a table-row style manner. The component is responsive so
that the value breaks under the label on smaller viewports.


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| value | <code>any</code> | <code></code> | The the data to be displayed - by default the content of the component will only show if there is a value. Also note that special handling is given to boolean values - they will render `Yes` for true and `No` for false. |
| label | <code>string</code> | <code>null</code> | The display name for the value. |
| alwaysRender | <code>Boolean</code> | <code>[false</code> | 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. |

**Example**

```js
<InfoTableRow @value={{5}} @label="TTL" />
```

**See**

- [Uses of InfoTableRow](https://github.com/hashicorp/vault/search?l=Handlebars&q=InfoTableRow)
- [InfoTableRow Source Code](https://github.com/hashicorp/vault/blob/master/ui/app/components/info-table-row.js)

---
Loading