chore: 🤖 cleanup feature flags - OIDC (#1245)

* chore: 🤖 cleanup OIDC feature flag
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-08-11 15:37:44 -07:00
1 parent d8b5056094
commit 746426fc82
12 files changed
+106 -188

No files matched your search

@@ -40,22 +40,20 @@
@dropdownRight={{true}}
as |dropdown|
>
{{#if (feature-flag 'primary-auth-method')}}
{{#if @model.isPrimary}}
<dropdown.button
@disabled={{@model.canSave}}
{{on 'click' (route-action 'removeAsPrimary' @model)}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dropdown.button>
{{else}}
<dropdown.button
@disabled={{@model.canSave}}
{{on 'click' (route-action 'makePrimary' @model)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dropdown.button>
{{/if}}
{{#if @model.isPrimary}}
<dropdown.button
@disabled={{@model.canSave}}
{{on 'click' (route-action 'removeAsPrimary' @model)}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dropdown.button>
{{else}}
<dropdown.button
@disabled={{@model.canSave}}
{{on 'click' (route-action 'makePrimary' @model)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dropdown.button>
{{/if}}
{{#if (can 'create model' @model collection='accounts')}}
@@ -1,13 +1,11 @@
<h2>
{{t 'resources.auth-method.title'}}
{{#if (feature-flag 'primary-auth-method')}}
{{#if @model.isPrimary}}
&nbsp;
<Rose::Badge @style='success-outline'>
{{t 'states.primary'}}
</Rose::Badge>
&nbsp;
{{/if}}
{{#if @model.isPrimary}}
&nbsp;
<Rose::Badge @style='success-outline'>
{{t 'states.primary'}}
</Rose::Badge>
&nbsp;
{{/if}}
<DocLink @doc='auth-method' @iconSize='large' />
</h2>
@@ -87,20 +87,18 @@
{{/if}}
{{#if @model}}
{{#if (feature-flag 'primary-auth-method')}}
{{#unless this.hasPrimaryAuthMethod}}
<Rose::Notification
@style='warning'
@heading={{t
'resources.auth-method.messages.no-primary-auth-method.title'
}}
>
{{t
'resources.auth-method.messages.no-primary-auth-method.description'
}}
</Rose::Notification>
{{/unless}}
{{/if}}
{{#unless this.hasPrimaryAuthMethod}}
<Rose::Notification
@style='warning'
@heading={{t
'resources.auth-method.messages.no-primary-auth-method.title'
}}
>
{{t
'resources.auth-method.messages.no-primary-auth-method.description'
}}
</Rose::Notification>
{{/unless}}
<Rose::Table as |table|>
<table.header as |header|>
@@ -108,10 +106,8 @@
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
{{#if (feature-flag 'primary-auth-method')}}
<row.cell />
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
{{/if}}
<row.cell />
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
@@ -165,43 +161,38 @@
<code>{{authMethod.id}}</code>
</Copyable>
</row.cell>
{{#if (feature-flag 'primary-auth-method')}}
<row.cell>
<row.cell>
{{#if authMethod.isPrimary}}
<Rose::Badge @style='success-outline'>
{{t 'states.primary'}}
</Rose::Badge>
{{/if}}
</row.cell>
<row.cell>
<Rose::Dropdown
@text={{t 'actions.manage'}}
@dropdownRight={{true}}
@iconOnly={{true}}
@showCaret={{false}}
@icon='flight-icons/svg/more-horizontal-16'
as |dropdown|
>
{{#unless authMethod.isPrimary}}
<dropdown.button
{{on 'click' (route-action 'makePrimary' authMethod)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dropdown.button>
{{/unless}}
{{#if authMethod.isPrimary}}
<Rose::Badge @style='success-outline'>
{{t 'states.primary'}}
</Rose::Badge>
<dropdown.button
{{on 'click' (route-action 'removeAsPrimary' authMethod)}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dropdown.button>
{{/if}}
</row.cell>
<row.cell>
<Rose::Dropdown
@text={{t 'actions.manage'}}
@dropdownRight={{true}}
@iconOnly={{true}}
@showCaret={{false}}
@icon='flight-icons/svg/more-horizontal-16'
as |dropdown|
>
{{#unless authMethod.isPrimary}}
<dropdown.button
{{on 'click' (route-action 'makePrimary' authMethod)}}
>
{{t 'resources.auth-method.actions.make-primary'}}
</dropdown.button>
{{/unless}}
{{#if authMethod.isPrimary}}
<dropdown.button
{{on
'click'
(route-action 'removeAsPrimary' authMethod)
}}
>
{{t 'resources.auth-method.actions.remove-as-primary'}}
</dropdown.button>
{{/if}}
</Rose::Dropdown>
</row.cell>
{{/if}}
</Rose::Dropdown>
</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -38,41 +38,19 @@
<Rose::Separator />
<Rose::Nav::Tabs as |nav|>
{{#if (feature-flag 'oidc')}}
{{! OIDC enable: list all auth methods }}
{{#each @model.authMethods as |authMethod|}}
<nav.link
@route='scopes.scope.authenticate.method'
@model={{authMethod.id}}
>
{{#if authMethod.name}}
{{authMethod.name}}
{{else}}
{{t
(concat 'resources.auth-method.types.' authMethod.type)
}}
{{/if}}
</nav.link>
{{/each}}
{{else}}
{{! OIDC disabled: filter out OIDC auth methods}}
{{#each @model.authMethods as |authMethod|}}
{{#unless authMethod.isOIDC}}
<nav.link
@route='scopes.scope.authenticate.method'
@model={{authMethod.id}}
>
{{#if authMethod.name}}
{{authMethod.name}}
{{else}}
{{t
(concat 'resources.auth-method.types.' authMethod.type)
}}
{{/if}}
</nav.link>
{{/unless}}
{{/each}}
{{/if}}
{{#each @model.authMethods as |authMethod|}}
<nav.link
@route='scopes.scope.authenticate.method'
@model={{authMethod.id}}
>
{{#if authMethod.name}}
{{authMethod.name}}
{{else}}
{{t (concat 'resources.auth-method.types.' authMethod.type)}}
{{/if}}
</nav.link>
{{/each}}
</Rose::Nav::Tabs>
{{#if @model.authMethods}}
@@ -1,17 +1,5 @@
{{#if (feature-flag 'oidc')}}
{{! OIDC enabled: show form for any auth method}}
<Form::Authenticate
@model={{@model}}
@submit={{route-action 'authenticate'}}
@disabled={{(is-loading)}}
/>
{{else}}
{{! OIDC disabled: hide OIDC auth form}}
{{#unless @model.isOIDC}}
<Form::Authenticate
@model={{@model}}
@submit={{route-action 'authenticate'}}
@disabled={{(is-loading)}}
/>
{{/unless}}
{{/if}}
<Form::Authenticate
@model={{@model}}
@submit={{route-action 'authenticate'}}
@disabled={{(is-loading)}}
/>
-2
View File
@@ -7,8 +7,6 @@ const EDITION = process.env.EDITION || 'oss'; // Default edition is OSS
// Object that defines edition features.
const featureEditions = {
oss: {
'primary-auth-method': true,
oidc: true,
'oidc-crud': true,
'oidc-account-crud': true,
search: false,
@@ -9,7 +9,6 @@ import {
// //currentSession,
// //invalidateSession,
} from 'ember-simple-auth/test-support';
import { enableFeature } from 'ember-feature-flags/test-support';
module('Acceptance | auth-methods | create ', function (hooks) {
setupApplicationTest(hooks);
@@ -113,7 +112,6 @@ module('Acceptance | auth-methods | create ', function (hooks) {
instances.orgScope.primaryAuthMethodId,
'Primary auth method is not yet set.'
);
enableFeature('primary-auth-method');
await visit(urls.authMethod);
await click(
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
@@ -143,7 +141,6 @@ module('Acceptance | auth-methods | create ', function (hooks) {
instances.orgScope.primaryAuthMethodId,
'Primary auth method is not yet set.'
);
enableFeature('primary-auth-method');
await visit(urls.authMethod);
await click(
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
@@ -160,7 +157,6 @@ module('Acceptance | auth-methods | create ', function (hooks) {
instances.orgScope.primaryAuthMethodId,
'Primary auth method is set.'
);
enableFeature('primary-auth-method');
await visit(urls.authMethod);
await click(
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
@@ -189,7 +185,6 @@ module('Acceptance | auth-methods | create ', function (hooks) {
instances.orgScope.primaryAuthMethodId,
'Primary auth method is set.'
);
enableFeature('primary-auth-method');
await visit(urls.authMethod);
await click(
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
@@ -203,7 +198,6 @@ module('Acceptance | auth-methods | create ', function (hooks) {
instances.orgScope.primaryAuthMethodId,
'Primary auth method is not yet set.'
);
enableFeature('primary-auth-method');
await visit(urls.authMethods);
await click(
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
@@ -25,37 +25,18 @@
</Rose::Dropdown>
<Rose::Nav::Tabs as |nav|>
{{#if (feature-flag 'oidc')}}
{{! OIDC enable: list all auth methods }}
{{#each @model.authMethods as |authMethod|}}
<nav.link
@route='scopes.scope.authenticate.method'
@model={{authMethod.id}}
>
{{#if authMethod.name}}
{{authMethod.name}}
{{else}}
{{t (concat 'resources.auth-method.types.' authMethod.type)}}
{{/if}}
</nav.link>
{{/each}}
{{else}}
{{! OIDC disabled: filter out OIDC auth methods}}
{{#each @model.authMethods as |authMethod|}}
{{#unless authMethod.isOIDC}}
<nav.link
@route='scopes.scope.authenticate.method'
@model={{authMethod.id}}
>
{{#if authMethod.name}}
{{authMethod.name}}
{{else}}
{{t (concat 'resources.auth-method.types.' authMethod.type)}}
{{/if}}
</nav.link>
{{/unless}}
{{/each}}
{{/if}}
{{#each @model.authMethods as |authMethod|}}
<nav.link
@route='scopes.scope.authenticate.method'
@model={{authMethod.id}}
>
{{#if authMethod.name}}
{{authMethod.name}}
{{else}}
{{t (concat 'resources.auth-method.types.' authMethod.type)}}
{{/if}}
</nav.link>
{{/each}}
</Rose::Nav::Tabs>
{{#if @model.authMethods}}
@@ -1,17 +1,5 @@
{{#if (feature-flag 'oidc')}}
{{! OIDC enabled: show form for any auth method}}
<Form::Authenticate
@model={{@model}}
@submit={{route-action 'authenticate'}}
@disabled={{(is-loading)}}
/>
{{else}}
{{! OIDC disabled: hide OIDC auth form}}
{{#unless @model.isOIDC}}
<Form::Authenticate
@model={{@model}}
@submit={{route-action 'authenticate'}}
@disabled={{(is-loading)}}
/>
{{/unless}}
{{/if}}
<Form::Authenticate
@model={{@model}}
@submit={{route-action 'authenticate'}}
@disabled={{(is-loading)}}
/>
-1
View File
@@ -55,7 +55,6 @@ module.exports = function (environment) {
},
featureFlags: {
oidc: true,
search: false,
filter: true,
'ssh-target': false,
@@ -141,7 +141,9 @@ module('Acceptance | clusterUrl', function (hooks) {
test('captures error on clusterUrl update', async function (assert) {
assert.expect(2);
assert.notOk(mockIPC.clusterUrl);
sinon.stub(this.owner.lookup('service:clusterUrl'), 'setClusterUrl').throws();
sinon
.stub(this.owner.lookup('service:clusterUrl'), 'setClusterUrl')
.throws();
await visit(urls.clusterUrl);
await fillIn('[name="host"]', currentOrigin);
await click('[type="submit"]');
@@ -40,6 +40,9 @@ module('Integration | Component | card', function (hooks) {
assert.ok(find('.card'));
assert.ok(find('.card-header'));
assert.ok(find('.card-header .rose-icon'));
assert.strictEqual(this.element.textContent.trim(), 'This is a heading test');
assert.strictEqual(
this.element.textContent.trim(),
'This is a heading test'
);
});
});