Merge branch 'main' into checkbox-style-updates
This commit is contained in:
16 files changed
+249
-10
No files matched your search
@@ -77,8 +77,17 @@ export default function () {
|
||||
// Auth Method Accounts
|
||||
this.get(
|
||||
'/accounts',
|
||||
({ accounts }, { queryParams: { auth_method_id: authMethodId } }) => {
|
||||
return accounts.where({ authMethodId });
|
||||
(
|
||||
{ accounts },
|
||||
{ queryParams: { auth_method_id: authMethodId, filter } }
|
||||
) => {
|
||||
let resultSet;
|
||||
if (authMethodId) {
|
||||
resultSet = accounts.where({ authMethodId });
|
||||
} else {
|
||||
resultSet = accounts.all();
|
||||
}
|
||||
return resultSet.filter(makeBooleanFilter(filter));
|
||||
}
|
||||
);
|
||||
this.post('/accounts');
|
||||
|
||||
@@ -36,7 +36,17 @@ export default factory.extend({
|
||||
});
|
||||
|
||||
if (type === 'oidc') {
|
||||
server.createList('managed-group', 2, { scope, authMethod });
|
||||
server
|
||||
.createList('managed-group', 2, { scope, authMethod })
|
||||
.map((managedGroup) => {
|
||||
const accounts = server.createList('account', 2, {
|
||||
scope,
|
||||
type,
|
||||
authMethod,
|
||||
});
|
||||
const accountIds = accounts.map((account) => account.id);
|
||||
managedGroup.update({ memberIds: accountIds });
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -362,3 +362,9 @@ managed-group:
|
||||
welcome:
|
||||
title: Welcome to Managed Groups
|
||||
description: Create and manage managed groups for an auth method.
|
||||
member:
|
||||
title: Member
|
||||
title_plural: Members
|
||||
messages:
|
||||
title: Welcome to Members
|
||||
description: No members in this managed group.
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsManagedGroupMembersController extends Controller {
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
/**
|
||||
* Translated new managed group breadcrumb
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
return this.intl.t('resources.managed-group.member.title_plural');
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,8 +7,9 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsNewController
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
* Translated new managed group breadcrumb
|
||||
* Translated new account breadcrumb
|
||||
* @type {string}
|
||||
*/
|
||||
get breadCrumb() {
|
||||
|
||||
@@ -59,7 +59,9 @@ Router.map(function () {
|
||||
this.route(
|
||||
'managed-group',
|
||||
{ path: ':managed_group_id' },
|
||||
function () {}
|
||||
function () {
|
||||
this.route('members');
|
||||
}
|
||||
);
|
||||
this.route('new');
|
||||
});
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsManagedGroupMembersRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service resourceFilterStore;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Returns the previously loaded managed group instances memebrs.
|
||||
* @return {Promise{[AccountModel]}}
|
||||
*/
|
||||
model() {
|
||||
const { auth_method_id, member_ids } = this.modelFor(
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups.managed-group'
|
||||
);
|
||||
|
||||
return this.resourceFilterStore.queryBy(
|
||||
'account',
|
||||
{ id: member_ids },
|
||||
{ auth_method_id }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{{page-title (t 'resources.account.title_plural')}}
|
||||
|
||||
{{outlet}}
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
{{page-title 'ManagedGroup'}}
|
||||
{{page-title @model.displayName}}
|
||||
{{outlet}}
|
||||
+5
@@ -4,4 +4,9 @@
|
||||
>
|
||||
{{t 'titles.details'}}
|
||||
</nav.link>
|
||||
<nav.link
|
||||
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group.members'
|
||||
>
|
||||
{{t 'resources.managed-group.member.title_plural'}}
|
||||
</nav.link>
|
||||
</Rose::Nav::Tabs>
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
{{page-title (t 'resources.managed-group.member.title_plural')}}
|
||||
|
||||
{{#if @model}}
|
||||
<Rose::Table as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.issuer.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.subject.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.email.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.full_name.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
|
||||
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
|
||||
</header.row>
|
||||
</table.header>
|
||||
<table.body as |body|>
|
||||
{{#each @model as |member|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell scope='row'>
|
||||
{{member.accountName}}
|
||||
<p>{{member.description}}</p>
|
||||
</row.headerCell>
|
||||
<row.cell>
|
||||
<code>{{member.attributes.issuer}}</code>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<code>{{member.attributes.subject}}</code>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<code>{{member.attributes.email}}</code>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
{{member.attributes.full_name}}
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Badge>{{member.type}}</Rose::Badge>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Copyable
|
||||
@text={{member.id}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<code>{{member.id}}</code>
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
{{else}}
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message
|
||||
@title={{t 'resources.managed-group.member.messages.title'}}
|
||||
as |message|
|
||||
>
|
||||
<message.description>
|
||||
{{t 'resources.managed-group.member.messages.description'}}
|
||||
</message.description>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
{{/if}}
|
||||
@@ -0,0 +1,3 @@
|
||||
{{page-title (t 'resources.managed-group.member.title_plural')}}
|
||||
|
||||
{{outlet}}
|
||||
@@ -123,7 +123,6 @@ module('Acceptance | auth methods | oidc', function (hooks) {
|
||||
await visit(urls.authMethod);
|
||||
await click('.rose-layout-page-actions .rose-dropdown-trigger');
|
||||
await click(`.rose-dropdown[open] input[value="${newState}"]`);
|
||||
// debugger;
|
||||
const authMethod = this.server.db.authMethods.find(instances.authMethod.id);
|
||||
assert.notEqual(
|
||||
newState,
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, findAll } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import {
|
||||
authenticateSession,
|
||||
// These are left here intentionally for future reference.
|
||||
//currentSession,
|
||||
//invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Acceptance | managed-groups | members', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
authMethod: null,
|
||||
managedGroup: null,
|
||||
accounts: null,
|
||||
};
|
||||
const urls = {
|
||||
orgScope: null,
|
||||
authMethods: null,
|
||||
managedGroups: null,
|
||||
managedGroup: null,
|
||||
managedGroupMembers: null,
|
||||
};
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
authenticateSession({});
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
});
|
||||
instances.authMethod = this.server.create(
|
||||
'auth-method',
|
||||
{
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
},
|
||||
'withAccountsAndUsersAndManagedGroups'
|
||||
);
|
||||
|
||||
instances.managedGroup = this.server.db.managedGroups[0];
|
||||
// Generate route URLs for resources
|
||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.authMethods = `${urls.orgScope}/auth-methods`;
|
||||
urls.authMethod = `${urls.authMethods}/${instances.authMethod.id}`;
|
||||
urls.managedGroups = `${urls.authMethod}/managed-groups`;
|
||||
urls.managedGroup = `${urls.managedGroups}/${instances.managedGroup.id}`;
|
||||
urls.managedGroupMembers = `${urls.managedGroup}/members`;
|
||||
});
|
||||
|
||||
test('User can navigate to index', async function (assert) {
|
||||
assert.expect(3);
|
||||
const membersCount = instances.managedGroup.memberIds.length;
|
||||
await visit(urls.managedGroupMembers);
|
||||
await a11yAudit();
|
||||
assert.equal(currentURL(), urls.managedGroupMembers);
|
||||
assert.ok(membersCount);
|
||||
assert.equal(findAll('tbody tr').length, membersCount);
|
||||
});
|
||||
});
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module(
|
||||
'Unit | Controller | scopes/scope/auth-methods/auth-method/managed-groups/managed-group/members',
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it exists', function (assert) {
|
||||
let controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/auth-method/managed-groups/managed-group/members'
|
||||
);
|
||||
assert.ok(controller);
|
||||
});
|
||||
}
|
||||
);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module(
|
||||
'Unit | Route | scopes/scope/auth-methods/auth-method/managed-groups/managed-group/members',
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup(
|
||||
'route:scopes/scope/auth-methods/auth-method/managed-groups/managed-group/members'
|
||||
);
|
||||
assert.ok(route);
|
||||
});
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user