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 - auth method edit #4770

Merged
merged 4 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions ui/app/helpers/tabs-for-auth-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ const TABS_FOR_SETTINGS = {
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'],
},
],
};

const TABS_FOR_SHOW = {};
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/section-tabs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<nav class="tabs sub-nav">
<ul>
{{#each tabs as |tab|}}
{{#link-to params=tab.routeParams tagName="li"}}
{{#link-to params=tab.routeParams tagName="li" data-test-auth-section-tab=true}}
<a href={{href-to params=tab.routeParams}}>
{{tab.label}}
</a>
Expand Down
19 changes: 19 additions & 0 deletions ui/tests/acceptance/settings/auth/configure/section-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { test } from 'qunit';
import { create } from 'ember-cli-page-object';
import moduleForAcceptance from 'vault/tests/helpers/module-for-acceptance';
import enablePage from 'vault/tests/pages/settings/auth/enable';
import page from 'vault/tests/pages/settings/auth/configure/section';
import indexPage from 'vault/tests/pages/settings/auth/configure/index';
import apiStub from 'vault/tests/helpers/noop-all-api-requests';
import consolePanel from 'vault/tests/pages/components/console/ui-panel';

const cli = create(consolePanel);

moduleForAcceptance('Acceptance | settings/auth/configure/section', {
beforeEach() {
Expand Down Expand Up @@ -37,3 +42,17 @@ test('it can save options', function(assert) {
);
});
});

['aws', 'azure', 'gcp', 'github', 'kubernetes', 'ldap', 'okta', 'radius'].forEach(function(type) {
test(`it shows tabs for auth method: ${type}`, assert => {
let path = `${type}-${Date.now()}`;
cli.consoleInput(`write sys/auth/${path} type=${type}`);
cli.enter();
indexPage.visit({ path });
andThen(() => {
// aws has 4 tabs, the others will have 'Configuration' and 'Method Options' tabs
let numTabs = type === 'aws' ? 4 : 2;
assert.equal(page.tabs.length, numTabs, 'shows correct number of tabs');
});
});
});
3 changes: 2 additions & 1 deletion ui/tests/pages/settings/auth/configure/section.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { create, clickable, visitable } from 'ember-cli-page-object';
import { create, clickable, visitable, collection } from 'ember-cli-page-object';
import fields from '../../../components/form-field';
import flashMessage from '../../../components/flash-message';

export default create({
...fields,
tabs: collection('[data-test-auth-section-tab]'),
visit: visitable('/vault/settings/auth/configure/:path/:section'),
flash: flashMessage,
save: clickable('[data-test-save-config]'),
Expand Down