open-vault/ui/app/helpers/tabs-for-auth-section.js

108 lines
2.8 KiB
JavaScript
Raw Normal View History

import { helper as buildHelper } from '@ember/component/helper';
import { pluralize } from 'ember-inflector';
import { capitalize } from '@ember/string';
2018-04-03 14:16:57 +00:00
const TABS_FOR_SETTINGS = {
aws: [
{
label: 'Client',
routeParams: ['vault.cluster.settings.auth.configure.section', 'client'],
},
{
label: 'Identity Whitelist Tidy',
routeParams: ['vault.cluster.settings.auth.configure.section', 'identity-whitelist'],
},
{
label: 'Role Tag Blacklist Tidy',
routeParams: ['vault.cluster.settings.auth.configure.section', 'roletag-blacklist'],
},
],
azure: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
2018-04-03 14:16:57 +00:00
github: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
gcp: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
jwt: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
oidc: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
2018-04-03 14:16:57 +00:00
kubernetes: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
ldap: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
okta: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
radius: [
{
label: 'Configuration',
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
},
],
2018-04-03 14:16:57 +00:00
};
const TABS_FOR_SHOW = {};
export function tabsForAuthSection([model, sectionType = 'authSettings', paths]) {
2018-04-03 14:16:57 +00:00
let tabs;
if (sectionType === 'authSettings') {
tabs = (TABS_FOR_SETTINGS[model.type] || []).slice();
2018-04-03 14:16:57 +00:00
tabs.push({
label: 'Method Options',
routeParams: ['vault.cluster.settings.auth.configure.section', 'options'],
});
return tabs;
}
if (paths) {
tabs = paths.map(path => {
let itemName = path.slice(1); //get rid of leading slash
return {
label: capitalize(pluralize(itemName)),
routeParams: ['vault.cluster.access.method.item.list', itemName],
};
});
} else {
tabs = (TABS_FOR_SHOW[model.type] || []).slice();
}
2018-04-03 14:16:57 +00:00
tabs.push({
label: 'Configuration',
routeParams: ['vault.cluster.access.method.section', 'configuration'],
});
return tabs;
}
export default buildHelper(tabsForAuthSection);