Skip to content

Commit 54b4eb9

Browse files
authored
Show orcid in user list table (#2403)
* Show orcid in user list table * Update test
1 parent 2405c48 commit 54b4eb9

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

app/institutions/dashboard/-components/institutional-users-list/component.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ interface Column {
1414
key: string;
1515
selected: boolean;
1616
label: string;
17-
type: 'string' | 'date_by_month' | 'osf_link' | 'user_name';
17+
sort_key: string | false;
18+
type: 'string' | 'date_by_month' | 'osf_link' | 'user_name' | 'orcid';
1819
}
1920

2021
interface InstitutionalUsersListArgs {
@@ -34,7 +35,6 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
3435
@tracked department = this.defaultDepartment;
3536
@tracked sort = 'user_name';
3637
@tracked selectedDepartments: string[] = [];
37-
@tracked selectedColumns: string[] = this.defaultSelectedColumns;
3838
@tracked filteredUsers = [];
3939

4040
@tracked columns: Column[] = [
@@ -59,6 +59,13 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
5959
selected: true,
6060
type: 'osf_link',
6161
},
62+
{
63+
key: 'orcid',
64+
sort_key: false,
65+
label: this.intl.t('institutions.dashboard.users_list.orcid'),
66+
selected: true,
67+
type: 'orcid',
68+
},
6269
{
6370
key: 'publicProjects',
6471
sort_key: 'public_projects',
@@ -133,11 +140,9 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
133140

134141
@tracked selectedColumns: string[] = this.columns.filter(col => col.selected).map(col => col.key);
135142
// Private properties
136-
@tracked department = this.intl.t('institutions.dashboard.select_default');
137-
@tracked sort = 'user_name';
138143
@tracked hasOrcid = false;
139144
@tracked totalUsers = 0;
140-
145+
orcidUrlPrefix = 'https://orcid.org/'; // Move to config?
141146

142147
@action
143148
toggleColumnSelection(columnKey: string) {
@@ -216,7 +221,6 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
216221
@action
217222
cancelSelection() {
218223
this.selectedDepartments = [];
219-
this.isAllSelected = false;
220224
}
221225

222226
@action

app/institutions/dashboard/-components/institutional-users-list/template.hbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@
155155
<OsfLink @href={{concat '/' institutionalUser.userGuid '/'}}>
156156
{{institutionalUser.userGuid}}
157157
</OsfLink>
158+
{{else if (eq column.type 'orcid')}}
159+
<OsfLink @href={{concat this.orcidUrlPrefix institutionalUser.orcidId}}>
160+
{{institutionalUser.orcidId}}
161+
</OsfLink>
158162
{{else if (eq column.type 'date_by_month')}}
159163
{{#if (get institutionalUser column.key)}}
160164
{{moment-format (get institutionalUser column.key) 'MM/YYYY'}}

tests/integration/routes/institutions/dashboard/-components/institutional-users-list/component-test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module('Integration | routes | institutions | dashboard | -components | institut
1818
this.owner.register('service:router', OsfLinkRouterStub);
1919
});
2020

21-
test('it renders and paginates 8 default columns', async function(assert) {
21+
test('it renders and paginates 9 default columns', async function(assert) {
2222
server.create('institution', {
2323
id: 'testinstitution',
2424
}, 'withMetrics');
@@ -41,16 +41,18 @@ module('Integration | routes | institutions | dashboard | -components | institut
4141
/>
4242
`);
4343
assert.dom('[data-test-header]')
44-
.exists({ count: 8 }, '8 default headers');
44+
.exists({ count: 9 }, '9 default headers');
4545
assert.dom('[data-test-header="department"]')
4646
.exists({ count: 1 }, '1 departments header');
47+
assert.dom('[data-test-header="orcid"]')
48+
.exists('1 orcid header');
4749
assert.dom('[data-test-header="publicProjects"]')
4850
.exists({ count: 1 }, '1 public projects header');
4951
assert.dom('[data-test-header="privateProjects"]')
5052
.exists({ count: 1 }, '1 private projects header');
5153

5254
assert.dom('[data-test-item]')
53-
.exists({ count: 80 }, '80 items 10 rows and 8 columns by default');
55+
.exists({ count: 90 }, '90 items 10 rows and 9 columns by default');
5456
assert.dom('[data-test-item="department"]')
5557
.exists({ count: 10 }, '10 in the list with department');
5658
assert.dom('[data-test-item="publicProjects"]')

translations/en-us.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,10 +815,10 @@ institutions:
815815
download_csv: 'Download CSV'
816816
download_tsv: 'Download TSV'
817817
format_labels:
818-
csv: '.csv'
819-
tsv: '.tsv'
820-
json_table: 'JSON (table)'
821-
json_direct: 'JSON (direct)'
818+
csv: '.csv'
819+
tsv: '.tsv'
820+
json_table: 'JSON (table)'
821+
json_direct: 'JSON (direct)'
822822
download: 'Download'
823823
select_default: 'All Departments'
824824
users_list:
@@ -831,6 +831,7 @@ institutions:
831831
public_registration_count: 'Public Registrations'
832832
private_registration_count: 'Private Registrations'
833833
published_preprint_count: 'Preprints'
834+
orcid: ORCID
834835
osf_link: 'OSF Link'
835836
public_file_count: 'Files on OSF'
836837
storage_byte_count: 'Total Data Stored on OSF'

0 commit comments

Comments
 (0)