open-vault/ui/lib/core/addon/components/alert-inline.js

39 lines
972 B
JavaScript
Raw Normal View History

2018-11-02 16:02:45 +00:00
import Component from '@ember/component';
import { computed } from '@ember/object';
import { messageTypes } from 'core/helpers/message-types';
import layout from '../templates/components/alert-inline';
2018-11-02 16:02:45 +00:00
Add storybook (#6496) * add storybook * add storybook files * add ToggleButton and AlertBanner stories * add knobs addon * add notes addon * add ToggleButton and AlertsBanner notes * move panel to right * add ICon * create story blueprint * add header to blueprint * upgrade to storybook 5.0.1 * add confirm-action stories * move addon panel to bottom * update ConfirmAction * add jsdoc comments to alert banner component * add AlertInline * set showPanel to true in blueprint * include newly generated markdown for stories * adjust code example for toggle button * add json-to-markdown to package.json * update AuthForm * add Storybook readme * add AlertPopup * add story markdown custom template * make storybook dependencies optional * center all stories * use message-types helper to dynamically render alerts * hide panel * nest alert stories * move icons into table * separate homelink into multiple stories * add homelink with nav example * remove see links from alert-banner * add script to autogenerate markdown from component and add it to stories * add viewport addon and remove centered addon * update README to include markdown generation * remove @see links from jsdoc comments * update README to include jsdoc example * update alert banner md * get rid of trailing ###### * update jsdoc and regenerate notes files * update i-con md * Update ui/scripts/gen-story-md.js Co-Authored-By: noelledaley <noelledaley@users.noreply.github.com> * Update ui/scripts/gen-story-md.js Co-Authored-By: noelledaley <noelledaley@users.noreply.github.com> * add storybook docs to vault ui readme * add jsdoc comments to component blueprint, automatically import md file in story blueprint * add template template to component blueprint override * apply basic theme to storybook * remove comment * make sure all stories are using auto generated md * storybook: show optional props in brackets * storybook: 🔪 HomeLink * storybook: show AuthConfigForm stories with knobs
2019-04-03 21:06:20 +00:00
/**
* @module AlertInline
* `AlertInline` components are used to inform users of important messages.
*
* @example
* ```js
* <AlertInline @type="danger" @message="{{model.keyId}} is not a valid lease ID"/>
* ```
*
* @param type=null{String} - The alert type. This comes from the message-types helper.
* @param [message=null]{String} - The message to display within the alert.
*
*/
2018-11-02 16:02:45 +00:00
export default Component.extend({
layout,
2018-11-02 16:02:45 +00:00
type: null,
UI - jwt auth (#6188) * fix default rendering of svg and allow plugins access to mount tune form * add auth-jwt component * add callback route, and allow it to be navigated to on load * add jwt as a supported auth method * use auth-jwt component and implement intial oidc flow * allow wrapping un-authed requests * pass redirect_url and properly redirect with the wrapped token * popup for login * center popup window and move to localStorage events for cross window communication because of IE11 * access window via a getter on the auth-form component * show OIDC provider name on the button * fetch default role on render of the auth-jwt component * simplify auth-form template * style callback page * refetch auth_url when path changes for auth-jwt component * fix glimmer error on alias metadata, and add back popup-metadata component * fix link in metadata page * add logo-edition component and remove use of partial for logo svg * render oidc callback template on the loading page if we're going there * add docs icon and change timeout on the auth form * move OIDC auth specific things to auth-jwt component * start to add branded buttons for OIDC providers * add google button * finish branded buttons * update glyph for error messages * update tests for auth screen not showing tabs, add adapter tests and new auth jwt tests * start auth-jwt tests * simplify auth-jwt * remove negative top margin on AlertInline * only preventDefault if there's an event * fill out tests * sort out some naming * feedback on templates and styles * clear error when starting OIDC auth and call for new auth_url * also allow 'oidc' as the auth method type * handle namespaces with OIDC auth * review feedback * use new getters in popup-metadata
2019-02-14 15:39:19 +00:00
message: null,
2018-11-02 16:02:45 +00:00
classNames: ['message-inline'],
textClass: computed('type', function() {
if (this.get('type') == 'danger') {
return messageTypes([this.get('type')]).glyphClass;
}
return;
2018-11-02 16:02:45 +00:00
}),
alertType: computed('type', function() {
return messageTypes([this.get('type')]);
}),
});