chore: 🤖 add user "account name" wherever users are listed

This commit is contained in:
Randall Morey committed 2021-10-06 16:00:23 -04:00
1 parent 84242dc014
commit 02682cb008
6 files changed
+59 -12

No files matched your search

+30
View File
@@ -1,5 +1,6 @@
import GeneratedUserModel from '../generated/models/user';
import { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { A } from '@ember/array';
export default class UserModel extends GeneratedUserModel {
@@ -16,6 +17,35 @@ export default class UserModel extends GeneratedUserModel {
})
account_ids;
/**
* Represents the user's primary account email, if any.
* @type {string}
*/
@attr('string', { readOnly: true }) email;
/**
* Represents the user's primary account full_name, if any.
* @type {string}
*/
@attr('string', { readOnly: true }) full_name;
/**
* Represents the user's primary account login_name, if any.
* @type {string}
*/
@attr('string', { readOnly: true }) login_name;
/**
* Convenience for getting a reasonable string that names the account.
* There are many options, so we fallback in order of precedence.
* @type {string}
*/
@computed('email,full_name,login_name,displayName')
get accountName() {
const { email, full_name, login_name } = this;
return email || full_name || login_name;
}
// =methods
/**
@@ -16,21 +16,25 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'form.description.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each this.availableUsers as |user|}}
<body.row as |row|>
<row.cell>
<row.headerCell>
<form.checkbox
@label={{user.id}}
@description={{user.description}}
@label={{user.displayName}}
onChange={{fn this.toggleMember user}}
/>
</row.cell>
<row.cell>{{user.name}}</row.cell>
{{#if user.accountName}}
<br /><Rose::Badge>{{user.accountName}}</Rose::Badge>
{{/if}}
</row.headerCell>
<row.cell><code>{{user.id}}</code></row.cell>
<row.cell>{{user.description}}</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -16,22 +16,25 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.description.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each this.filteredPrincipals as |principal|}}
<body.row as |row|>
<row.cell>
<row.headerCell>
<form.checkbox
@label={{principal.id}}
@description={{principal.description}}
@label={{principal.displayName}}
onChange={{fn this.togglePrincipal principal}}
/>
</row.cell>
<row.cell>{{principal.name}}</row.cell>
{{#if principal.accountName}}
<br /><Rose::Badge>{{principal.accountName}}</Rose::Badge>
{{/if}}
</row.headerCell>
<row.cell>{{principal.id}}</row.cell>
<row.cell>
<Rose::Badge>{{t
(concat
@@ -40,6 +43,7 @@
)
}}</Rose::Badge>
</row.cell>
<row.cell>{{principal.description}}</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -15,6 +15,9 @@
<body.row as |row|>
<row.headerCell>
{{member.displayName}}
{{#if member.accountName}}
<br /><Rose::Badge>{{member.accountName}}</Rose::Badge>
{{/if}}
</row.headerCell>
<row.cell>
<Copyable
@@ -16,6 +16,9 @@
<body.row as |row|>
<row.headerCell>
{{principal.model.displayName}}
{{#if principal.model.accountName}}
<br /><Rose::Badge>{{principal.model.accountName}}</Rose::Badge>
{{/if}}
</row.headerCell>
<row.cell>
{{t (concat 'resources.role.principal.types.' principal.type)}}
@@ -46,6 +46,9 @@
{{else}}
{{user.displayName}}
{{/if}}
{{#if user.accountName}}
<br /><Rose::Badge>{{user.accountName}}</Rose::Badge>
{{/if}}
<p>{{user.description}}</p>
</row.headerCell>
<row.cell>