2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
import { helper as buildHelper } from '@ember/component/helper';
|
2019-06-21 15:18:26 +00:00
|
|
|
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'],
|
|
|
|
},
|
|
|
|
{
|
2021-02-26 07:23:34 +00:00
|
|
|
label: 'Identity Allow List Tidy',
|
2022-09-13 16:42:34 +00:00
|
|
|
routeParams: ['vault.cluster.settings.auth.configure.section', 'identity-accesslist'],
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
{
|
2021-02-26 07:23:34 +00:00
|
|
|
label: 'Role Tag Deny List Tidy',
|
2022-09-13 16:42:34 +00:00
|
|
|
routeParams: ['vault.cluster.settings.auth.configure.section', 'roletag-denylist'],
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
],
|
2018-04-09 19:44:53 +00:00
|
|
|
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'],
|
|
|
|
},
|
|
|
|
],
|
2018-07-24 22:35:31 +00:00
|
|
|
jwt: [
|
|
|
|
{
|
|
|
|
label: 'Configuration',
|
|
|
|
routeParams: ['vault.cluster.settings.auth.configure.section', 'configuration'],
|
|
|
|
},
|
|
|
|
],
|
2019-03-14 21:01:56 +00:00
|
|
|
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'],
|
|
|
|
},
|
|
|
|
],
|
2018-06-15 17:53:21 +00:00
|
|
|
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 = {};
|
|
|
|
|
2019-06-21 15:18:26 +00:00
|
|
|
export function tabsForAuthSection([model, sectionType = 'authSettings', paths]) {
|
2018-04-03 14:16:57 +00:00
|
|
|
let tabs;
|
|
|
|
if (sectionType === 'authSettings') {
|
2019-06-21 15:18:26 +00:00
|
|
|
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;
|
|
|
|
}
|
2019-10-17 23:19:14 +00:00
|
|
|
if (paths || model.paths) {
|
|
|
|
if (model.paths) {
|
2021-12-17 03:44:29 +00:00
|
|
|
paths = model.paths.paths.filter((path) => path.navigation);
|
2019-10-17 23:19:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: we're unsure if we actually need compact here
|
|
|
|
// but are leaving it just in case OpenAPI ever returns an empty thing
|
2021-12-17 03:44:29 +00:00
|
|
|
tabs = paths.compact().map((path) => {
|
2019-06-21 15:18:26 +00:00
|
|
|
return {
|
2019-10-17 23:19:14 +00:00
|
|
|
label: capitalize(pluralize(path.itemName)),
|
|
|
|
routeParams: ['vault.cluster.access.method.item.list', path.itemType],
|
2019-06-21 15:18:26 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default buildHelper(tabsForAuthSection);
|