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 @@ -7,4 +7,8 @@
</OsfLink>
{{t 'institutions.dashboard.object-list.table-items.permission-level' permissionLevel=contributor.permissionLevel}}
</div>
{{else}}
<div>
{{t 'institutions.dashboard.object-list.table-items.no-contributors'}}
</div>
{{/each}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#each this.dois as |doi|}}
<OsfLink @href={{doi.fullLink}} @target='_blank'>{{doi.displayText}}</OsfLink>
{{else}}
{{t 'institutions.dashboard.object-list.table-items.no-info' field=(t 'institutions.dashboard.object-list.table-headers.doi')}}
{{t 'institutions.dashboard.object-list.table-items.missing-info'}}
{{/each}}
11 changes: 5 additions & 6 deletions app/institutions/dashboard/preprints/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { ObjectListColumn } from '../-components/object-list/component';
export default class InstitutionDashboardPreprints extends Controller {
@service intl!: Intl;

missingItemPlaceholder = this.intl.t('institutions.dashboard.object-list.table-items.missing-info');

columns: ObjectListColumn[] = [
{ // Title
name: this.intl.t('institutions.dashboard.object-list.table-headers.title'),
Expand Down Expand Up @@ -36,8 +38,7 @@ export default class InstitutionDashboardPreprints extends Controller {
},
{ // License
name: this.intl.t('institutions.dashboard.object-list.table-headers.license'),
getValue: searchResult => searchResult.license?.name ||
this.intl.t('institutions.dashboard.object-list.table-items.no-license-info'),
getValue: searchResult => searchResult.license?.name || this.missingItemPlaceholder,
},
{ // Contributor name + permissions
name: this.intl.t('institutions.dashboard.object-list.table-headers.contributor_name'),
Expand All @@ -47,16 +48,14 @@ export default class InstitutionDashboardPreprints extends Controller {
name: this.intl.t('institutions.dashboard.object-list.table-headers.view_count'),
getValue: searchResult => {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.viewCount :
this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
return metrics ? metrics.viewCount : this.missingItemPlaceholder;
},
},
{ // Download count
name: this.intl.t('institutions.dashboard.object-list.table-headers.download_count'),
getValue: searchResult => {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.downloadCount :
this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
return metrics ? metrics.downloadCount : this.missingItemPlaceholder;
},
},
];
Expand Down
26 changes: 9 additions & 17 deletions app/institutions/dashboard/projects/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { ObjectListColumn } from '../-components/object-list/component';
export default class InstitutionDashboardProjects extends Controller {
@service intl!: Intl;

missingItemPlaceholder = this.intl.t('institutions.dashboard.object-list.table-items.missing-info');

columns: ObjectListColumn[] = [
{ // Title
name: this.intl.t('institutions.dashboard.object-list.table-headers.title'),
Expand Down Expand Up @@ -44,8 +46,7 @@ export default class InstitutionDashboardProjects extends Controller {
name: this.intl.t('institutions.dashboard.object-list.table-headers.total_data_stored'),
getValue: searchResult => {
const byteCount = getSingleOsfmapValue(searchResult.resourceMetadata, ['storageByteCount']);
return byteCount ? humanFileSize(byteCount) :
this.intl.t('institutions.dashboard.object-list.table-items.no-storage-info');
return byteCount ? humanFileSize(byteCount) : this.missingItemPlaceholder;
},
},
{ // Contributor name + permissions
Expand All @@ -56,36 +57,27 @@ export default class InstitutionDashboardProjects extends Controller {
name: this.intl.t('institutions.dashboard.object-list.table-headers.view_count'),
getValue: searchResult => {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.viewCount :
this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
return metrics ? metrics.viewCount : this.missingItemPlaceholder;
},
},
{ // Resource type
name: this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature'),
getValue: searchResult => {
const field = this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature');
return searchResult.resourceNature ||
this.intl.t('institutions.dashboard.object-list.table-items.no-info', { field });
},
getValue: searchResult => searchResult.resourceNature || this.missingItemPlaceholder,
},
{ // License
name: this.intl.t('institutions.dashboard.object-list.table-headers.license'),
getValue: searchResult => searchResult.license?.name ||
this.intl.t('institutions.dashboard.object-list.table-items.no-license-info'),
getValue: searchResult => searchResult.license?.name || this.missingItemPlaceholder,
},
{ // addons associated
name: this.intl.t('institutions.dashboard.object-list.table-headers.addons'),
getValue: searchResult => {
const field = this.intl.t('institutions.dashboard.object-list.table-headers.addons');
return searchResult.configuredAddonNames.length ? searchResult.configuredAddonNames :
this.intl.t('institutions.dashboard.object-list.table-items.no-info', { field });
},
getValue: searchResult => searchResult.configuredAddonNames.length ? searchResult.configuredAddonNames :
this.missingItemPlaceholder,
},
{ // Funder name
name: this.intl.t('institutions.dashboard.object-list.table-headers.funder_name'),
getValue: searchResult => {
if (!searchResult.funders) {
return this.intl.t('institutions.dashboard.object-list.table-items.no-funder-info');
return this.missingItemPlaceholder;
}
return searchResult.funders.map((funder: { name: string }) => funder.name).join(', ');
},
Expand Down
18 changes: 6 additions & 12 deletions app/institutions/dashboard/registrations/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ObjectListColumn } from '../-components/object-list/component';
export default class InstitutionDashboardRegistrations extends Controller {
@service intl!: Intl;

missingItemPlaceholder = this.intl.t('institutions.dashboard.object-list.table-items.missing-info');
columns: ObjectListColumn[] = [
{ // Title
name: this.intl.t('institutions.dashboard.object-list.table-headers.title'),
Expand Down Expand Up @@ -43,8 +44,7 @@ export default class InstitutionDashboardRegistrations extends Controller {
name: this.intl.t('institutions.dashboard.object-list.table-headers.total_data_stored'),
getValue: searchResult => {
const byteCount = getSingleOsfmapValue(searchResult.resourceMetadata, ['storageByteCount']);
return byteCount ? humanFileSize(byteCount) :
this.intl.t('institutions.dashboard.object-list.table-items.no-storage-info');
return byteCount ? humanFileSize(byteCount) : this.missingItemPlaceholder;
},
},
{ // Contributor name + permissions
Expand All @@ -55,28 +55,22 @@ export default class InstitutionDashboardRegistrations extends Controller {
name: this.intl.t('institutions.dashboard.object-list.table-headers.view_count'),
getValue: searchResult => {
const metrics = searchResult.usageMetrics;
return metrics ? metrics.viewCount :
this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
return metrics ? metrics.viewCount : this.missingItemPlaceholder;
},
},
{ // Resource type
name: this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature'),
getValue: searchResult => {
const field = this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature');
return searchResult.resourceNature ||
this.intl.t('institutions.dashboard.object-list.table-items.no-info', { field });
},
getValue: searchResult => searchResult.resourceNature || this.missingItemPlaceholder,
},
{ // License
name: this.intl.t('institutions.dashboard.object-list.table-headers.license'),
getValue: searchResult => searchResult.license?.name ||
this.intl.t('institutions.dashboard.object-list.table-items.no-license-info'),
getValue: searchResult => searchResult.license?.name || this.missingItemPlaceholder,
},
{ // Funder name
name: this.intl.t('institutions.dashboard.object-list.table-headers.funder_name'),
getValue: searchResult => {
if (!searchResult.funders) {
return this.intl.t('institutions.dashboard.object-list.table-items.no-funder-info');
return this.missingItemPlaceholder;
}
return searchResult.funders.map((funder: { name: string }) => funder.name).join(', ');
},
Expand Down
7 changes: 2 additions & 5 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -900,11 +900,8 @@ institutions:
funder_name: Funder Name
registration_schema: 'Registration Schema'
table-items:
no-info: 'No {field}'
no-storage-info: 'No Storage Info'
no-metrics: 'No metrics'
no-license-info: 'No License Info'
no-funder-info: 'No Funder info'
missing-info: '-'
no-contributors: 'Contributor no longer affiliated'
permission-level: '({permissionLevel})'
projects_panel: 'Total Projects'
departments_panel: Departments
Expand Down
Loading