Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ interface Column {
key: string;
selected: boolean;
label: string;
type: 'string' | 'date_by_month' | 'osf_link' | 'user_name';
sort_key: string | false;
type: 'string' | 'date_by_month' | 'osf_link' | 'user_name' | 'orcid';
}

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

@tracked columns: Column[] = [
Expand All @@ -59,6 +59,13 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
selected: true,
type: 'osf_link',
},
{
key: 'orcid',
sort_key: false,
label: this.intl.t('institutions.dashboard.users_list.orcid'),
selected: true,
type: 'orcid',
},
{
key: 'publicProjects',
sort_key: 'public_projects',
Expand Down Expand Up @@ -133,11 +140,9 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers

@tracked selectedColumns: string[] = this.columns.filter(col => col.selected).map(col => col.key);
// Private properties
@tracked department = this.intl.t('institutions.dashboard.select_default');
@tracked sort = 'user_name';
@tracked hasOrcid = false;
@tracked totalUsers = 0;

orcidUrlPrefix = 'https://orcid.org/'; // Move to config?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's something that's likely to need to change per environment, so probably doesn't need to be configurable.


@action
toggleColumnSelection(columnKey: string) {
Expand Down Expand Up @@ -216,7 +221,6 @@ export default class InstitutionalUsersList extends Component<InstitutionalUsers
@action
cancelSelection() {
this.selectedDepartments = [];
this.isAllSelected = false;
}

@action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@
<OsfLink @href={{concat '/' institutionalUser.userGuid '/'}}>
{{institutionalUser.userGuid}}
</OsfLink>
{{else if (eq column.type 'orcid')}}
<OsfLink @href={{concat this.orcidUrlPrefix institutionalUser.orcidId}}>
{{institutionalUser.orcidId}}
</OsfLink>
{{else if (eq column.type 'date_by_month')}}
{{#if (get institutionalUser column.key)}}
{{moment-format (get institutionalUser column.key) 'MM/YYYY'}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module('Integration | routes | institutions | dashboard | -components | institut
this.owner.register('service:router', OsfLinkRouterStub);
});

test('it renders and paginates 8 default columns', async function(assert) {
test('it renders and paginates 9 default columns', async function(assert) {
server.create('institution', {
id: 'testinstitution',
}, 'withMetrics');
Expand All @@ -41,16 +41,18 @@ module('Integration | routes | institutions | dashboard | -components | institut
/>
`);
assert.dom('[data-test-header]')
.exists({ count: 8 }, '8 default headers');
.exists({ count: 9 }, '9 default headers');
assert.dom('[data-test-header="department"]')
.exists({ count: 1 }, '1 departments header');
assert.dom('[data-test-header="orcid"]')
.exists('1 orcid header');
assert.dom('[data-test-header="publicProjects"]')
.exists({ count: 1 }, '1 public projects header');
assert.dom('[data-test-header="privateProjects"]')
.exists({ count: 1 }, '1 private projects header');

assert.dom('[data-test-item]')
.exists({ count: 80 }, '80 items 10 rows and 8 columns by default');
.exists({ count: 90 }, '90 items 10 rows and 9 columns by default');
assert.dom('[data-test-item="department"]')
.exists({ count: 10 }, '10 in the list with department');
assert.dom('[data-test-item="publicProjects"]')
Expand Down
9 changes: 5 additions & 4 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -815,10 +815,10 @@ institutions:
download_csv: 'Download CSV'
download_tsv: 'Download TSV'
format_labels:
csv: '.csv'
tsv: '.tsv'
json_table: 'JSON (table)'
json_direct: 'JSON (direct)'
csv: '.csv'
tsv: '.tsv'
json_table: 'JSON (table)'
json_direct: 'JSON (direct)'
download: 'Download'
select_default: 'All Departments'
users_list:
Expand All @@ -831,6 +831,7 @@ institutions:
public_registration_count: 'Public Registrations'
private_registration_count: 'Private Registrations'
published_preprint_count: 'Preprints'
orcid: ORCID
osf_link: 'OSF Link'
public_file_count: 'Files on OSF'
storage_byte_count: 'Total Data Stored on OSF'
Expand Down
Loading