open-vault/ui/app/models/role-jwt.js
Matthew Irish 311cc49c61
UI - Vault API explorer engine (#7044)
* open-api-explorer engine with embedded swagger-ui

* move swagger config to a component, rely directly on swagger-ui

* filter operations by endpoint, hook up filter to query param, add namespace handling

* fix namespace handling

* update ember-engines so that we can app.import in a lazy engine

* use engine's included hook to move swagger-ui to engine-vendor.* files

* show flash message about this being a live vault server

* show a namespace reminder and override some styles from swagger-ui

* switch filter to use includes instead of startsWith

* move flash-message to alert-banner and fix namespace reminder with a block

* adds explore web-cli command to navigate to the api-explorer engine

* allow passing a preformatted string to flash messages

* add multi-line flash-message to api explorer

* invert control and trigger events on react app so we can control the layout more and use our components

* tweak styling some more and adjust message on the flash

* change web cli command from 'explore' to 'api'

* shorten namespace warning

* fix console

* fix comments
2019-07-02 17:41:23 -05:00

33 lines
898 B
JavaScript

import DS from 'ember-data';
import { computed } from '@ember/object';
import parseURL from 'core/utils/parse-url';
const { attr } = DS;
const DOMAIN_STRINGS = {
github: 'GitHub',
gitlab: 'GitLab',
google: 'Google',
ping: 'Ping',
okta: 'Okta',
auth0: 'Auth0',
};
const PROVIDER_WITH_LOGO = ['GitLab', 'Google', 'Auth0'];
export { DOMAIN_STRINGS, PROVIDER_WITH_LOGO };
export default DS.Model.extend({
authUrl: attr('string'),
providerName: computed('authUrl', function() {
let { hostname } = parseURL(this.authUrl);
let firstMatch = Object.keys(DOMAIN_STRINGS).find(name => hostname.includes(name));
return DOMAIN_STRINGS[firstMatch] || null;
}),
providerButtonComponent: computed('providerName', function() {
let { providerName } = this;
return PROVIDER_WITH_LOGO.includes(providerName) ? `auth-button-${providerName.toLowerCase()}` : null;
}),
});