diff --git a/app/institutions/dashboard/-components/object-list/component.ts b/app/institutions/dashboard/-components/object-list/component.ts index 62c45fedfd..c5183e0dfb 100644 --- a/app/institutions/dashboard/-components/object-list/component.ts +++ b/app/institutions/dashboard/-components/object-list/component.ts @@ -6,20 +6,21 @@ import InstitutionModel from 'ember-osf-web/models/institution'; import SearchResultModel from 'ember-osf-web/models/search-result'; import { Filter } from 'osf-components/components/search-page/component'; -interface ValueColumn { +interface Column { name: string; + sortKey?: string; +} +interface ValueColumn extends Column { getValue(searchResult: SearchResultModel): string; } -interface LinkColumn { - name: string; +interface LinkColumn extends Column { getHref(searchResult: SearchResultModel): string; getLinkText(searchResult: SearchResultModel): string; type: 'link'; } -interface ComponentColumn { - name: string; +interface ComponentColumn extends Column { type: 'doi' | 'contributors'; } @@ -34,14 +35,14 @@ interface InstitutionalObjectListArgs { export default class InstitutionalObjectList extends Component { @tracked activeFilters: Filter[] = []; - @tracked page = ''; // TODO: ENG-6184 Implement pagination - @tracked sort = '-relevance'; // TODO: ENG-6184 Implement sorting + @tracked page = ''; + @tracked sort = '-dateModified'; get queryOptions() { const options = { ... this.args.defaultQueryOptions, 'page[cursor]': this.page, - 'page[size]': 10, // TODO: ENG-6184 Implement pagination + 'page[size]': 10, sort: this.sort, }; @@ -62,4 +63,18 @@ export default class InstitutionalObjectList extends Component - {{#each @columns as |column|}} - - {{/each}} + {{#let (component 'sort-arrow' + sort=this.sort + ) as |SortArrow| + }} + {{#each @columns as |column|}} + + {{/each}} + {{/let}} @@ -65,6 +81,23 @@ as |list|>
- {{column.name}} - + + {{column.name}} + {{#if column.sortKey}} + + {{/if}} + +
+
+ {{#if list.showFirstPageOption}} + + {{/if}} + {{#if list.hasPrevPage}} + + {{/if}} + {{#if list.hasNextPage}} + + {{/if}} +
{{/if}} {{#if list.relatedProperties}} diff --git a/app/institutions/dashboard/projects/controller.ts b/app/institutions/dashboard/projects/controller.ts index fcb90c7c15..0d62d299fe 100644 --- a/app/institutions/dashboard/projects/controller.ts +++ b/app/institutions/dashboard/projects/controller.ts @@ -25,11 +25,13 @@ export default class InstitutionDashboardProjects extends Controller { }, { // Date created name: this.intl.t('institutions.dashboard.object-list.table-headers.created_date'), - getValue : searchResult => searchResult.getResourceMetadataField('dateCreated'), + getValue: searchResult => searchResult.getResourceMetadataField('dateCreated'), + sortKey: 'dateCreated', }, { // Date modified name: this.intl.t('institutions.dashboard.object-list.table-headers.modified_date'), - getValue : searchResult => searchResult.getResourceMetadataField('dateModified'), + getValue: searchResult => searchResult.getResourceMetadataField('dateModified'), + sortKey: 'dateModified', }, { // DOI name: this.intl.t('institutions.dashboard.object-list.table-headers.doi'), diff --git a/lib/osf-components/addon/components/sort-arrow/component.ts b/lib/osf-components/addon/components/sort-arrow/component.ts index 0c8a55b0d2..08d1ca2b2a 100644 --- a/lib/osf-components/addon/components/sort-arrow/component.ts +++ b/lib/osf-components/addon/components/sort-arrow/component.ts @@ -14,7 +14,7 @@ export default class SortArrow extends Component { } get isCurrentDescending() { - return this.args.sort === `-${this.sortBy}`; + return this.args.sort === `-${this.args.sortBy}`; } get isSelected() { diff --git a/translations/en-us.yml b/translations/en-us.yml index abe3b2e2b0..4d7150670f 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -845,6 +845,9 @@ institutions: filter-button-label: 'Filter' filter-heading: 'Filter by:' total-objects: 'total {objectType}' + first: First + prev: Prev + next: Next table-headers: title: Title link: Link