Merge Boundary UI OSS branch 'main' at commit f3dbd7cd

This commit is contained in:
github-team-secure-boundary committed 2022-12-22 22:41:50 +00:00
commit 1b6a5879f1
6 files changed
+66 -14

No files matched your search

-1
View File
@@ -155,7 +155,6 @@ export default class RoleModel extends GeneratedRoleModel {
// return a promise resolving to an empty array
return resolve([]);
}
// =methods
/**
@@ -0,0 +1,12 @@
{{#if this.isManagedGroup}}
<LinkTo
@route={{this.link}}
@models={{array @model.auth_method_id @model.id}}
>
{{@model.displayName}}
</LinkTo>
{{else}}
<LinkTo @route={{this.link}} @model={{@model.id}}>
{{@model.displayName}}
</LinkTo>
{{/if}}
@@ -0,0 +1,26 @@
import Component from '@glimmer/component';
const principalTypeRoutes = {
user: 'scopes.scope.users.user',
group: 'scopes.scope.groups.group',
'managed-group':
'scopes.scope.auth-methods.auth-method.managed-groups.managed-group',
};
export default class LinkToPrincipalComponent extends Component {
/**
* return true if its a managed group model
* @type {boolean}
*/
get isManagedGroup() {
return this.args.model.constructor.modelName === 'managed-group';
}
/**
* return route based on principal type
* @type {string}
*/
get link() {
return principalTypeRoutes[this.args.model.constructor.modelName];
}
}
@@ -0,0 +1,6 @@
<Hds::Badge
@icon={{this.icon}}
@text={{t
(concat 'resources.role.principal.types.' @model.constructor.modelName)
}}
/>
@@ -0,0 +1,17 @@
import Component from '@glimmer/component';
const principalTypes = {
user: 'user',
group: 'folder-users',
'managed-group': 'cloud-lock',
};
export default class PrincipalTypeBadgeComponent extends Component {
/**
* Display icons based on the pricipal type
* @type {string}
*/
get icon() {
return principalTypes[this.args.model.constructor.modelName];
}
}
@@ -46,7 +46,11 @@
{{#each @model.principals as |principal|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'readPrincipal role' principal)}}
<LinkToPrincipal @model={{principal}} />
{{else}}
{{principal.displayName}}
{{/if}}
{{#if principal.accountName}}
<br /><Hds::Badge @text={{principal.accountName}} />
{{/if}}
@@ -61,19 +65,7 @@
</Copyable>
</row.cell>
<row.cell>
<Hds::Badge
@icon={{if
(eq principal.constructor.modelName 'group')
'folder-users'
'user'
}}
@text={{t
(concat
'resources.role.principal.types.'
principal.constructor.modelName
)
}}
/>
<PrincipalTypeBadge @model={{principal}} />
</row.cell>
<row.cell>
<ScopeBadge @scope={{principal.scopeModel}} />