-
-
- {{#let (component 'sort-arrow'
- class=(local-class 'sort-arrow')
- sortAction=this.sortInstitutionalUsers
- sort=this.sort
- ) as |SortArrow|}}
-
- {{#each this.columns as |column|}}
- {{#if (includes column.key this.selectedColumns)}}
-
-
- {{column.label}}
- {{#if column.sort_key}}
-
-
-
- {{/if}}
-
-
- {{/if}}
- {{/each}}
-
- {{/let}}
-
-
- {{#each this.columns as |column|}}
- {{#if (includes column.key this.selectedColumns)}}
-
- {{#if (eq column.type 'user_name')}}
-
- {{institutionalUser.userName}}
-
- {{else if (eq column.type 'osf_link')}}
-
- {{institutionalUser.userGuid}}
-
- {{else if (eq column.type 'date_by_month')}}
- {{#if (get institutionalUser column.key)}}
- {{moment-format (get institutionalUser column.key) 'MM/YYYY'}}
- {{else}}
- N/A
- {{/if}}
+
+
+ {{#let (component 'sort-arrow'
+ class=(local-class 'sort-arrow')
+ sortAction=this.sortInstitutionalUsers
+ sort=this.sort
+ ) as |SortArrow|}}
+
+ {{#each this.columns as |column|}}
+ {{#if (includes column.key this.selectedColumns)}}
+
+
+ {{column.label}}
+ {{#if column.sort_key}}
+
+
+
+ {{/if}}
+
+
+ {{/if}}
+ {{/each}}
+
+ {{/let}}
+
+
+ {{#each this.columns as |column|}}
+ {{#if (includes column.key this.selectedColumns)}}
+
+ {{#if (eq column.type 'user_name')}}
+
+ {{institutionalUser.userName}}
+
+ {{else if (eq column.type 'osf_link')}}
+
+ {{institutionalUser.userGuid}}
+
+ {{else if (eq column.type 'date_by_month')}}
+ {{#if (get institutionalUser column.key)}}
+ {{moment-format (get institutionalUser column.key) 'MM/YYYY'}}
{{else}}
- {{get institutionalUser column.key}}
+ {{t 'institutions.dashboard.users_list.not_found'}}
{{/if}}
-
- {{/if}}
- {{/each}}
-
-
- {{t 'institutions.dashboard.users_list.empty'}}
-
-
-
+ {{else}}
+ {{get institutionalUser column.key}}
+ {{/if}}
+
+ {{/if}}
+ {{/each}}
+
+
+ {{t 'institutions.dashboard.users_list.empty'}}
+
+
{{/if}}
diff --git a/translations/en-us.yml b/translations/en-us.yml
index 0d658184039..4dbb8b88cff 100644
--- a/translations/en-us.yml
+++ b/translations/en-us.yml
@@ -833,6 +833,7 @@ institutions:
has_orcid: 'Has ORCID'
select_columns: 'Customize'
total_users: 'total users'
+ not_found: 'N/A'
kpi-panel:
users: 'Total Users'
projects: 'OSF Public and Private Projects'
From b785d5c5e88de59ad5423db9359974987a3f7d05 Mon Sep 17 00:00:00 2001
From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com>
Date: Fri, 1 Nov 2024 15:00:30 -0400
Subject: [PATCH 68/96] Fix reroute to not-found (#2375)
---
app/institutions/dashboard/route.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/institutions/dashboard/route.ts b/app/institutions/dashboard/route.ts
index f06471c98a7..16ab7b53501 100644
--- a/app/institutions/dashboard/route.ts
+++ b/app/institutions/dashboard/route.ts
@@ -8,6 +8,7 @@ import InstitutionDepartmentModel from 'ember-osf-web/models/institution-departm
import InstitutionSummaryMetricModel from 'ember-osf-web/models/institution-summary-metric';
import { QueryHasManyResult } from 'ember-osf-web/models/osf-model';
import captureException from 'ember-osf-web/utils/capture-exception';
+import { notFoundURL } from 'ember-osf-web/utils/clean-url';
export interface InstitutionsDashboardModel {
institution: InstitutionModel;
@@ -42,7 +43,7 @@ export default class InstitutionsDashboardRoute extends Route {
};
} catch (error) {
captureException(error);
- this.transitionTo('not-found', this.router.get('currentURL').slice(1));
+ this.transitionTo('not-found', notFoundURL(window.location.pathname));
return undefined;
}
}
From a39b12c82d67b1e17dedf58780887e4b7ae2b8a3 Mon Sep 17 00:00:00 2001
From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com>
Date: Tue, 5 Nov 2024 13:44:47 -0500
Subject: [PATCH 69/96] [ENG-6419] Share integration (#2377)
- Ticket: [ENG-6419]
- Feature flag: n/a
## Purpose
- Make sure institution dashboard pages talking to SHARE don't break
## Summary of Changes
- Update project page controller's getters to account for missing values
- Add new package `osfmap/jsonld.ts` with utilities to make getting stuff from SHARE easier and more readable
---
.../contributors-field/component.ts | 46 ++-
.../contributors-field/template.hbs | 14 +-
.../object-list/doi-field/template.hbs | 2 +
.../dashboard/preprints/controller.ts | 15 +-
.../dashboard/projects/controller.ts | 34 +-
.../dashboard/registrations/controller.ts | 28 +-
app/models/search-result.ts | 12 +-
app/packages/osfmap/jsonld.ts | 43 +++
mirage/views/search.ts | 313 +++++++++---------
translations/en-us.yml | 5 +
10 files changed, 323 insertions(+), 189 deletions(-)
create mode 100644 app/packages/osfmap/jsonld.ts
diff --git a/app/institutions/dashboard/-components/object-list/contributors-field/component.ts b/app/institutions/dashboard/-components/object-list/contributors-field/component.ts
index e71de161176..d4923162959 100644
--- a/app/institutions/dashboard/-components/object-list/contributors-field/component.ts
+++ b/app/institutions/dashboard/-components/object-list/contributors-field/component.ts
@@ -5,6 +5,7 @@ import Intl from 'ember-intl/services/intl';
import InstitutionModel from 'ember-osf-web/models/institution';
import SearchResultModel from 'ember-osf-web/models/search-result';
import { AttributionRoleIris } from 'ember-osf-web/models/index-card';
+import { getOsfmapObjects, getSingleOsfmapValue, hasOsfmapValue } from 'ember-osf-web/packages/osfmap/jsonld';
interface ContributorsFieldArgs {
searchResult: SearchResultModel;
@@ -24,34 +25,51 @@ export default class InstitutionalObjectListContributorsField extends Component<
// Return two contributors affiliated with the institution given with highest permission levels
get topInstitutionAffiliatedContributors() {
const { searchResult, institution } = this.args;
- const attributions: any[] = searchResult.resourceMetadata.qualifiedAttribution;
+ const {resourceMetadata} = searchResult;
+ const attributions: any[] = getOsfmapObjects(resourceMetadata, ['qualifiedAttribution']);
+ const contributors = getOsfmapObjects(resourceMetadata, ['creator']);
const institutionIris = institution.iris;
+
const affiliatedAttributions = attributions
- .filter((attribution: any) => hasInstitutionAffiliation(attribution, institutionIris));
- const adminAttributions = affiliatedAttributions
- .filter(attribution => attribution.hadRole[0]['@id'] === AttributionRoleIris.Admin);
- const writeAttributions = affiliatedAttributions
- .filter(attribution => attribution.hadRole[0]['@id'] === AttributionRoleIris.Write);
- const readAttributions = affiliatedAttributions
- .filter(attribution => attribution.hadRole[0]['@id'] === AttributionRoleIris.Read);
+ .filter((attribution: any) => hasInstitutionAffiliation(contributors, attribution, institutionIris));
+ const adminAttributions = affiliatedAttributions.filter(
+ attribution => hasOsfmapValue(attribution, ['hadRole'], AttributionRoleIris.Admin),
+ );
+ const writeAttributions = affiliatedAttributions.filter(
+ attribution => hasOsfmapValue(attribution, ['hadRole'], AttributionRoleIris.Write),
+ );
+ const readAttributions = affiliatedAttributions.filter(
+ attribution => hasOsfmapValue(attribution, ['hadRole'], AttributionRoleIris.Read),
+ );
const prioritizedAttributions = adminAttributions.concat(writeAttributions, readAttributions);
- return prioritizedAttributions.slice(0, 2).map((attribution: any) => {
- const roleIri: AttributionRoleIris = attribution.hadRole[0]['@id'];
+ return prioritizedAttributions.slice(0, 2).map(attribution => {
+ const contributor = getContributorById(contributors, getSingleOsfmapValue(attribution, ['agent']));
+ const roleIri: AttributionRoleIris = getSingleOsfmapValue(attribution, ['hadRole']);
return {
- name: attribution.agent[0].name[0]['@value'],
- url: attribution.agent[0]['@id'],
+ name: getSingleOsfmapValue(contributor,['name']),
+ url: getSingleOsfmapValue(contributor, ['identifier']),
permissionLevel: this.intl.t(roleIriToTranslationKey[roleIri]),
};
});
}
}
-function hasInstitutionAffiliation(contributor: any, institutionIris: string[]) {
- return contributor.agent[0].affiliation.some(
+function hasInstitutionAffiliation(contributors: any[], attribution: any, institutionIris: string[]) {
+ const attributedContributor = getContributorById(contributors, getSingleOsfmapValue(attribution, ['agent']));
+
+ if (!attributedContributor.affiliation) {
+ return false;
+ }
+
+ return attributedContributor.affiliation.some(
(affiliation: any) => affiliation.identifier.some(
(affiliationIdentifier: any) => institutionIris.includes(affiliationIdentifier['@value']),
),
);
}
+
+function getContributorById(contributors: any[], contributorId: string) {
+ return contributors.find(contributor => contributor['@id'] === contributorId);
+}
diff --git a/app/institutions/dashboard/-components/object-list/contributors-field/template.hbs b/app/institutions/dashboard/-components/object-list/contributors-field/template.hbs
index 6bf6e00b3ad..4130b4fd4b0 100644
--- a/app/institutions/dashboard/-components/object-list/contributors-field/template.hbs
+++ b/app/institutions/dashboard/-components/object-list/contributors-field/template.hbs
@@ -1,8 +1,10 @@
{{#each this.topInstitutionAffiliatedContributors as |contributor|}}
-
- {{contributor.name}}
-
- {{t 'institutions.dashboard.object-list.table-items.permission-level' permissionLevel=contributor.permissionLevel}}
+
+
+ {{contributor.name}}
+
+ {{t 'institutions.dashboard.object-list.table-items.permission-level' permissionLevel=contributor.permissionLevel}}
+
{{/each}}
diff --git a/app/institutions/dashboard/-components/object-list/doi-field/template.hbs b/app/institutions/dashboard/-components/object-list/doi-field/template.hbs
index 6cdf6d523bb..e7d4032af6d 100644
--- a/app/institutions/dashboard/-components/object-list/doi-field/template.hbs
+++ b/app/institutions/dashboard/-components/object-list/doi-field/template.hbs
@@ -1,3 +1,5 @@
{{#each this.dois as |doi|}}
{{doi.displayText}}
+{{else}}
+ {{t 'institutions.dashboard.object-list.table-items.no-info' field=(t 'institutions.dashboard.object-list.table-headers.doi')}}
{{/each}}
diff --git a/app/institutions/dashboard/preprints/controller.ts b/app/institutions/dashboard/preprints/controller.ts
index 9b2bb479514..e7cfcdb9573 100644
--- a/app/institutions/dashboard/preprints/controller.ts
+++ b/app/institutions/dashboard/preprints/controller.ts
@@ -35,7 +35,8 @@ export default class InstitutionDashboardPreprints extends Controller {
},
{ // License
name: this.intl.t('institutions.dashboard.object-list.table-headers.license'),
- getValue: searchResult => searchResult.license?.name,
+ getValue: searchResult => searchResult.license?.name ||
+ this.intl.t('institutions.dashboard.object-list.table-items.no-license-info'),
},
{ // Contributor name + permissions
name: this.intl.t('institutions.dashboard.object-list.table-headers.contributor_name'),
@@ -43,11 +44,19 @@ export default class InstitutionDashboardPreprints extends Controller {
},
{ // View count
name: this.intl.t('institutions.dashboard.object-list.table-headers.view_count'),
- getValue: searchResult => searchResult.usageMetrics.viewCount,
+ getValue: searchResult => {
+ const metrics = searchResult.usageMetrics;
+ return metrics ? metrics.viewCount :
+ this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
+ },
},
{ // Download count
name: this.intl.t('institutions.dashboard.object-list.table-headers.download_count'),
- getValue: searchResult => searchResult.usageMetrics.downloadCount,
+ getValue: searchResult => {
+ const metrics = searchResult.usageMetrics;
+ return metrics ? metrics.downloadCount :
+ this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
+ },
},
];
diff --git a/app/institutions/dashboard/projects/controller.ts b/app/institutions/dashboard/projects/controller.ts
index 84a2f4a12ef..42568ef565c 100644
--- a/app/institutions/dashboard/projects/controller.ts
+++ b/app/institutions/dashboard/projects/controller.ts
@@ -41,7 +41,11 @@ export default class InstitutionDashboardProjects extends Controller {
},
{ // Total data stored
name: this.intl.t('institutions.dashboard.object-list.table-headers.total_data_stored'),
- getValue: searchResult => humanFileSize(searchResult.getResourceMetadataField('storageByteCount')),
+ getValue: searchResult => {
+ const byteCount = searchResult.getResourceMetadataField('storageByteCount');
+ return byteCount ? humanFileSize(byteCount) :
+ this.intl.t('institutions.dashboard.object-list.table-items.no-storage-info');
+ },
},
{ // Contributor name + permissions
name: this.intl.t('institutions.dashboard.object-list.table-headers.contributor_name'),
@@ -49,23 +53,41 @@ export default class InstitutionDashboardProjects extends Controller {
},
{ // View count
name: this.intl.t('institutions.dashboard.object-list.table-headers.view_count'),
- getValue: searchResult => searchResult.usageMetrics.viewCount,
+ getValue: searchResult => {
+ const metrics = searchResult.usageMetrics;
+ return metrics ? metrics.viewCount :
+ this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
+ },
},
{ // Resource type
name: this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature'),
- getValue: searchResult => searchResult.resourceNature,
+ 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 });
+ },
},
{ // License
name: this.intl.t('institutions.dashboard.object-list.table-headers.license'),
- getValue: searchResult => searchResult.license?.name,
+ getValue: searchResult => searchResult.license?.name ||
+ this.intl.t('institutions.dashboard.object-list.table-items.no-license-info'),
},
{ // addons associated
name: this.intl.t('institutions.dashboard.object-list.table-headers.addons'),
- getValue: searchResult => searchResult.configuredAddonNames,
+ getValue: searchResult => {
+ const field = this.intl.t('institutions.dashboard.object-list.table-headers.addons');
+ return searchResult.configuredAddonNames ||
+ this.intl.t('institutions.dashboard.object-list.table-items.no-info', { field });
+ },
},
{ // Funder name
name: this.intl.t('institutions.dashboard.object-list.table-headers.funder_name'),
- getValue: searchResult => searchResult.funders.map((funder: {name: string}) => funder.name).join(', '),
+ getValue: searchResult => {
+ if (!searchResult.funders) {
+ return this.intl.t('institutions.dashboard.object-list.table-items.no-funder-info');
+ }
+ return searchResult.funders.map((funder: { name: string }) => funder.name).join(', ');
+ },
},
];
diff --git a/app/institutions/dashboard/registrations/controller.ts b/app/institutions/dashboard/registrations/controller.ts
index 52f5cb92c3e..209c2e146b9 100644
--- a/app/institutions/dashboard/registrations/controller.ts
+++ b/app/institutions/dashboard/registrations/controller.ts
@@ -40,7 +40,11 @@ export default class InstitutionDashboardRegistrations extends Controller {
},
{ // Total data stored
name: this.intl.t('institutions.dashboard.object-list.table-headers.total_data_stored'),
- getValue: searchResult => humanFileSize(searchResult.getResourceMetadataField('storageByteCount')),
+ getValue: searchResult => {
+ const byteCount = searchResult.getResourceMetadataField('storageByteCount');
+ return byteCount ? humanFileSize(byteCount) :
+ this.intl.t('institutions.dashboard.object-list.table-items.no-storage-info');
+ },
},
{ // Contributor name + permissions
name: this.intl.t('institutions.dashboard.object-list.table-headers.contributor_name'),
@@ -48,19 +52,33 @@ export default class InstitutionDashboardRegistrations extends Controller {
},
{ // View count
name: this.intl.t('institutions.dashboard.object-list.table-headers.view_count'),
- getValue: searchResult => searchResult.usageMetrics.viewCount,
+ getValue: searchResult => {
+ const metrics = searchResult.usageMetrics;
+ return metrics ? metrics.viewCount :
+ this.intl.t('institutions.dashboard.object-list.table-items.no-metrics');
+ },
},
{ // Resource type
name: this.intl.t('institutions.dashboard.object-list.table-headers.resource_nature'),
- getValue: searchResult => searchResult.resourceNature,
+ 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 });
+ },
},
{ // License
name: this.intl.t('institutions.dashboard.object-list.table-headers.license'),
- getValue: searchResult => searchResult.license?.name,
+ getValue: searchResult => searchResult.license?.name ||
+ this.intl.t('institutions.dashboard.object-list.table-items.no-license-info'),
},
{ // Funder name
name: this.intl.t('institutions.dashboard.object-list.table-headers.funder_name'),
- getValue: searchResult => searchResult.funders.map((funder: {name: string}) => funder.name).join(', '),
+ getValue: searchResult => {
+ if (!searchResult.funders) {
+ return this.intl.t('institutions.dashboard.object-list.table-items.no-funder-info');
+ }
+ return searchResult.funders.map((funder: { name: string }) => funder.name).join(', ');
+ },
},
{ // schema
name: this.intl.t('institutions.dashboard.object-list.table-headers.registration_schema'),
diff --git a/app/models/search-result.ts b/app/models/search-result.ts
index 9cec3d98273..b092ac5573e 100644
--- a/app/models/search-result.ts
+++ b/app/models/search-result.ts
@@ -307,10 +307,16 @@ export default class SearchResultModel extends Model {
}
get usageMetrics() {
+ if (!this.resourceMetadata.usage) {
+ return null;
+ }
+ const temporalCoverage = this.resourceMetadata.usage[0]['temporalCoverage'];
+ const viewCount = this.resourceMetadata.usage[0]['viewCount'];
+ const downloadCount = this.resourceMetadata.usage[0]['downloadCount'];
return {
- period: this.resourceMetadata.usage[0]['temporalCoverage'][0]['@value'],
- viewCount: this.resourceMetadata.usage[0]['viewCount'][0]['@value'],
- downloadCount: this.resourceMetadata.usage[0]['downloadCount'][0]['@value'],
+ period: temporalCoverage ? temporalCoverage[0]['@value'] : null,
+ viewCount: viewCount ? viewCount[0]['@value'] : null,
+ downloadCount: downloadCount ? downloadCount[0]['@value'] : null,
};
}
diff --git a/app/packages/osfmap/jsonld.ts b/app/packages/osfmap/jsonld.ts
new file mode 100644
index 00000000000..bba174ec419
--- /dev/null
+++ b/app/packages/osfmap/jsonld.ts
@@ -0,0 +1,43 @@
+export function *iterOsfmapObjects(osfmapObject: any, propertyPath: string[]): IterableIterator
{
+ const [property, ...remainingPath] = propertyPath;
+ const innerObjArray = osfmapObject[property] || [];
+ if (remainingPath.length) {
+ for (const innerObj of innerObjArray) {
+ yield* iterOsfmapObjects(innerObj, remainingPath);
+ }
+ } else {
+ yield* innerObjArray;
+ }
+}
+
+export function *iterOsfmapValues(osfmapObject: any, propertyPath: string[]): IterableIterator {
+ for (const obj of iterOsfmapObjects(osfmapObject, propertyPath)) {
+ yield (Object.hasOwn(obj, '@id') ? obj['@id'] : obj['@value']);
+ }
+}
+
+export function getOsfmapValues(osfmapObject: any, propertyPath: string[]) {
+ return Array.from(iterOsfmapValues(osfmapObject, propertyPath));
+}
+
+export function getSingleOsfmapValue(osfmapObject: any, propertyPath: string[]) {
+ return iterOsfmapValues(osfmapObject, propertyPath).next().value;
+}
+
+export function getOsfmapObjects(osfmapObject: any, propertyPath: string[]) {
+ return Array.from(iterOsfmapObjects(osfmapObject, propertyPath));
+}
+
+export function getSingleOsfmapObject(osfmapObject: any, propertyPath: string[]) {
+ return iterOsfmapObjects(osfmapObject, propertyPath).next().value;
+}
+
+export function hasOsfmapValue(osfmapObject: any, propertyPath: string[], expectedValue: any) {
+ // could use `Iterator.prototype.some()` instead, if polyfilled
+ for (const value of iterOsfmapValues(osfmapObject, propertyPath)) {
+ if (value === expectedValue) {
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/mirage/views/search.ts b/mirage/views/search.ts
index c55f6a1c797..c0723c3b47e 100644
--- a/mirage/views/search.ts
+++ b/mirage/views/search.ts
@@ -12,171 +12,180 @@ const osfUrl = config.OSF.url;
const sampleStorageRegions = ['United States', 'Australia - Sydney', 'Germany - Frankfurt'];
const resourceMetadataByType: Partial> = {
- Registration: () => ({
- '@id': faker.random.uuid(),
- // accessService: [{}],
- archivedAt: [{}], // archive.org URL
- conformsTo: [{ // Registration Schema
- '@id': 'https://api.osf.io/v2/schemas/registrations/564d31db8c5e4a7c9694b2be/',
- title: [{
- '@value': 'Open-Ended Registration',
+ Registration: () => {
+ const contributor = _sharePersonField();
+ return {
+ '@id': faker.random.uuid(),
+ // accessService: [{}],
+ archivedAt: [{}], // archive.org URL
+ conformsTo: [{ // Registration Schema
+ '@id': 'https://api.osf.io/v2/schemas/registrations/564d31db8c5e4a7c9694b2be/',
+ title: [{
+ '@value': 'Open-Ended Registration',
+ }],
}],
- }],
- creator: [_sharePersonField()],
- dateAvailable: [_shareDateField()],
- dateCopyrighted: [_shareDateField()],
- dateCreated: [_shareDateField()],
- dateModified: [_shareDateField()],
- description: [{
- '@value': faker.lorem.sentence(),
- }],
- funder: [_shareOrganizationField()],
- hasPart: [{}], // RegistrationComponent
- hostingInstition: [_shareOrganizationField()],
- identifier: [_shareIdentifierField(), _shareOsfIdentifier()],
- isVersionOf: [{}], // if this is from a project
- keyword: [{ // tags
- '@value': faker.random.word(),
- }],
- publisher: [_shareOrganizationField()], // Registration Provider
- qualifiedAttribution: [{
- agent: [_sharePersonField()],
- hadRole: [{
- '@id': faker.random.arrayElement(Object.values(AttributionRoleIris)),
+ creator: [contributor],
+ dateAvailable: [_shareDateField()],
+ dateCopyrighted: [_shareDateField()],
+ dateCreated: [_shareDateField()],
+ dateModified: [_shareDateField()],
+ description: [{
+ '@value': faker.lorem.sentence(),
}],
- }],
- resourceNature: [{ // Registration Category
- '@id': 'https://schema.datacite.org/meta/kernel-4/#StudyRegistration',
- displayLabel: [{
- '@value': 'StudyRegistration',
- '@language': 'en',
+ funder: [_shareOrganizationField()],
+ hasPart: [{}], // RegistrationComponent
+ hostingInstition: [_shareOrganizationField()],
+ identifier: [_shareIdentifierField(), _shareOsfIdentifier()],
+ isVersionOf: [{}], // if this is from a project
+ keyword: [{ // tags
+ '@value': faker.random.word(),
}],
- }],
- resourceType: [{ '@id': 'Registration' }],
- rights: [_shareLicenseField()],
- sameAs: [{}], // some DOI
- storageByteCount: [{
- '@value': faker.random.number(),
- }],
- storageRegion: [{
- prefLabel: [{
- '@value': faker.random.arrayElement(sampleStorageRegions),
+ publisher: [_shareOrganizationField()], // Registration Provider
+ qualifiedAttribution: [{
+ agent: [contributor],
+ hadRole: [{
+ '@id': faker.random.arrayElement(Object.values(AttributionRoleIris)),
+ }],
}],
- }],
- subject: [_shareSubjectField()],
- title: [{
- '@value': faker.lorem.words(3),
- }],
- usage: [_shareUsageReportField()],
- }),
- Project: () => ({
- '@id': faker.internet.url(),
- // accessService: [{}],
- creator: [_sharePersonField()],
- dateCopyrighted: [_shareDateField()],
- dateCreated: [_shareDateField()],
- dateModified: [_shareDateField()],
- description: [{
- '@value': faker.lorem.sentence(),
- }],
- funder: [_shareOrganizationField()],
- hasOsfAddon: [
- {
+ resourceNature: [{ // Registration Category
+ '@id': 'https://schema.datacite.org/meta/kernel-4/#StudyRegistration',
+ displayLabel: [{
+ '@value': 'StudyRegistration',
+ '@language': 'en',
+ }],
+ }],
+ resourceType: [{ '@id': 'Registration' }],
+ rights: [_shareLicenseField()],
+ sameAs: [{}], // some DOI
+ storageByteCount: [{
+ '@value': faker.random.number(),
+ }],
+ storageRegion: [{
prefLabel: [{
- '@value': 'Box',
+ '@value': faker.random.arrayElement(sampleStorageRegions),
}],
- },
- ],
- hasPart: [{}], // ProjectComponent
- hostingInstition: [_shareOrganizationField()],
- identifier: [_shareIdentifierField(), _shareOsfIdentifier()],
- keyword: [{ // tags
- '@value': faker.random.word(),
- }],
- publisher: [_shareOrganizationField()],
- qualifiedAttribution: [{
- agent: [_sharePersonField()],
- hadRole: [{
- '@id': faker.random.arrayElement(Object.values(AttributionRoleIris)),
}],
- }],
- resourceNature: [{
- '@id': 'https://schema.datacite.org/meta/kernel-4/#Dataset',
- displayLabel:[
+ subject: [_shareSubjectField()],
+ title: [{
+ '@value': faker.lorem.words(3),
+ }],
+ usage: [_shareUsageReportField()],
+ };
+ },
+ Project: () => {
+ const contributor = _sharePersonField();
+ return {
+ '@id': faker.internet.url(),
+ // accessService: [{}],
+ creator: [contributor],
+ dateCopyrighted: [_shareDateField()],
+ dateCreated: [_shareDateField()],
+ dateModified: [_shareDateField()],
+ description: [{
+ '@value': faker.lorem.sentence(),
+ }],
+ funder: [_shareOrganizationField()],
+ hasOsfAddon: [
{
- '@value': faker.random.arrayElement(['Dataset', 'JournalArticle', 'Book']),
- '@language': 'en',
+ prefLabel: [{
+ '@value': 'Box',
+ }],
},
],
- }],
- resourceType: [{ '@id': 'Project' }],
- rights: [_shareLicenseField()],
- sameAs: [{}], // some DOI
- storageByteCount: [{
- '@value': faker.random.number(),
- }],
- storageRegion: [{
- prefLabel: [{
- '@value': faker.random.arrayElement(sampleStorageRegions),
+ hasPart: [{}], // ProjectComponent
+ hostingInstition: [_shareOrganizationField()],
+ identifier: [_shareIdentifierField(), _shareOsfIdentifier()],
+ keyword: [{ // tags
+ '@value': faker.random.word(),
}],
- }],
- subject: [_shareSubjectField()],
- title: [{
- '@value': faker.lorem.words(3),
- }],
- usage: [_shareUsageReportField()],
- }),
- Preprint: () => ({
- '@id': faker.internet.url(),
- // accessService: [{}],
- creator: [_sharePersonField('http://ror.org/has-users')],
- dateAccepted: [_shareDateField()],
- dateCopyrighted: [_shareDateField()],
- dateCreated: [_shareDateField()],
- dateSubmitted: [_shareDateField()],
- dateModified: [_shareDateField()],
- description: [{
- '@value': faker.lorem.sentence(),
- }],
- hasPart: [{}], // File
- hostingInstition: [_shareOrganizationField()],
- identifier: [_shareIdentifierField(), _shareOsfIdentifier()],
- // isSupplementedBy: [{}], // if this links a project
- keyword: [{ // tags
- '@value': faker.random.word(),
- }],
- omits: [{
- ommittedMetadataProperty: [
- { '@id': 'hasPreregisteredStudyDesign' },
- { '@id': 'hasPreregisteredAnalysisPlan' },
- ],
- }],
- publisher: [_shareOrganizationField()], // Preprint Provider
- qualifiedAttribution: [{
- agent: [_sharePersonField()],
- hadRole: [{
- '@id': faker.random.arrayElement(Object.values(AttributionRoleIris)),
+ publisher: [_shareOrganizationField()],
+ qualifiedAttribution: [{
+ agent: [contributor],
+ hadRole: [{
+ '@id': faker.random.arrayElement(Object.values(AttributionRoleIris)),
+ }],
}],
- }],
- resourceNature: [{
- '@id': 'https://schema.datacite.org/meta/kernel-4/#Preprint',
- displayLabel: [{
- '@value': 'Preprint',
- '@language': 'en',
+ resourceNature: [{
+ '@id': 'https://schema.datacite.org/meta/kernel-4/#Dataset',
+ displayLabel: [
+ {
+ '@value': faker.random.arrayElement(['Dataset', 'JournalArticle', 'Book']),
+ '@language': 'en',
+ },
+ ],
}],
- }],
- resourceType: [{ '@id': 'Preprint' }],
- rights: [_shareLicenseField()],
- sameAs: [{}], // some DOI
- statedConflictOfInterest: [{
- '@id': 'no-confict-of-interest',
- }],
- subject: [_shareSubjectField()],
- title: [{
- '@value': faker.lorem.words(3),
- }],
- usage: [_shareUsageReportField()],
- }),
+ resourceType: [{ '@id': 'Project' }],
+ rights: [_shareLicenseField()],
+ sameAs: [{}], // some DOI
+ storageByteCount: [{
+ '@value': faker.random.number(),
+ }],
+ storageRegion: [{
+ prefLabel: [{
+ '@value': faker.random.arrayElement(sampleStorageRegions),
+ }],
+ }],
+ subject: [_shareSubjectField()],
+ title: [{
+ '@value': faker.lorem.words(3),
+ }],
+ usage: [_shareUsageReportField()],
+ };
+ },
+ Preprint: () => {
+ const contributor = _sharePersonField();
+ return {
+ '@id': faker.internet.url(),
+ // accessService: [{}],
+ creator: [contributor],
+ dateAccepted: [_shareDateField()],
+ dateCopyrighted: [_shareDateField()],
+ dateCreated: [_shareDateField()],
+ dateSubmitted: [_shareDateField()],
+ dateModified: [_shareDateField()],
+ description: [{
+ '@value': faker.lorem.sentence(),
+ }],
+ hasPart: [{}], // File
+ hostingInstition: [_shareOrganizationField()],
+ identifier: [_shareIdentifierField(), _shareOsfIdentifier()],
+ // isSupplementedBy: [{}], // if this links a project
+ keyword: [{ // tags
+ '@value': faker.random.word(),
+ }],
+ omits: [{
+ ommittedMetadataProperty: [
+ { '@id': 'hasPreregisteredStudyDesign' },
+ { '@id': 'hasPreregisteredAnalysisPlan' },
+ ],
+ }],
+ publisher: [_shareOrganizationField()], // Preprint Provider
+ qualifiedAttribution: [{
+ agent: [contributor],
+ hadRole: [{
+ '@id': faker.random.arrayElement(Object.values(AttributionRoleIris)),
+ }],
+ }],
+ resourceNature: [{
+ '@id': 'https://schema.datacite.org/meta/kernel-4/#Preprint',
+ displayLabel: [{
+ '@value': 'Preprint',
+ '@language': 'en',
+ }],
+ }],
+ resourceType: [{ '@id': 'Preprint' }],
+ rights: [_shareLicenseField()],
+ sameAs: [{}], // some DOI
+ statedConflictOfInterest: [{
+ '@id': 'no-confict-of-interest',
+ }],
+ subject: [_shareSubjectField()],
+ title: [{
+ '@value': faker.lorem.words(3),
+ }],
+ usage: [_shareUsageReportField()],
+ };
+ },
Agent: () => ({
'@id': faker.internet.url(),
// accessService: [{}],
diff --git a/translations/en-us.yml b/translations/en-us.yml
index 4dbb8b88cff..872dd0a811d 100644
--- a/translations/en-us.yml
+++ b/translations/en-us.yml
@@ -893,6 +893,11 @@ 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'
permission-level: '({permissionLevel})'
projects_panel: 'Total Projects'
departments_panel: Departments
From 0a3b593c7173b813c10fb88c0275c831b216f1fa Mon Sep 17 00:00:00 2001
From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com>
Date: Tue, 5 Nov 2024 16:05:32 -0500
Subject: [PATCH 70/96] Fix how index-value-search qps are passed (#2379)
---
.../dashboard/-components/object-list/component.ts | 7 +++++++
.../dashboard/-components/object-list/template.hbs | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/institutions/dashboard/-components/object-list/component.ts b/app/institutions/dashboard/-components/object-list/component.ts
index 383cce5fea7..e07391365c9 100644
--- a/app/institutions/dashboard/-components/object-list/component.ts
+++ b/app/institutions/dashboard/-components/object-list/component.ts
@@ -57,6 +57,13 @@ export default class InstitutionalObjectList extends Component
{{#each list.relatedProperties as |property|}}
From 4320073e67331f024256e31334eba6877b38bad6 Mon Sep 17 00:00:00 2001
From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com>
Date: Thu, 7 Nov 2024 09:44:15 -0500
Subject: [PATCH 71/96] [No ticket] Update language and counts on summary page
(#2381)
- Ticket: [No ticket]
- Feature flag: n/a
## Purpose
- Update and clarify language on summary page
## Summary of Changes
- Update Registration count to account for embargoed registrations
- Update label
- Update labels for Licenses, Add-ons, Storage Region graphs
---
.../-components/chart-kpi-wrapper/component-test.ts | 6 +++---
.../-components/total-count-kpi-wrapper/component-test.ts | 2 +-
.../-components/total-count-kpi-wrapper/component.ts | 6 +++++-
translations/en-us.yml | 8 ++++----
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/app/institutions/dashboard/-components/chart-kpi-wrapper/component-test.ts b/app/institutions/dashboard/-components/chart-kpi-wrapper/component-test.ts
index c12c97d4852..268b43ef98e 100644
--- a/app/institutions/dashboard/-components/chart-kpi-wrapper/component-test.ts
+++ b/app/institutions/dashboard/-components/chart-kpi-wrapper/component-test.ts
@@ -224,7 +224,7 @@ module('Integration | institutions | dashboard | -components | kpi-chart-wrapper
// And the title is verified
assert.dom(`${parentDom} [data-test-chart-title]`)
- .hasText('Licenses');
+ .hasText('Top 10 Licenses');
// And the expanded data position 0 name is verified
assert.dom(`${parentDom} [data-test-expanded-name="0"]`)
@@ -259,7 +259,7 @@ module('Integration | institutions | dashboard | -components | kpi-chart-wrapper
// And the title is verified
assert.dom(`${parentDom} [data-test-chart-title]`)
- .hasText('Add-ons');
+ .hasText('Top 10 Add-ons');
// And the expanded data position 0 name is verified
assert.dom(`${parentDom} [data-test-expanded-name="0"]`)
@@ -295,7 +295,7 @@ module('Integration | institutions | dashboard | -components | kpi-chart-wrapper
// And the title is verified
assert.dom(`${parentDom} [data-test-chart-title]`)
- .hasText('Storage Regions');
+ .hasText('Top Storage Regions');
// And the expanded data position 0 name is verified
assert.dom(`${parentDom} [data-test-expanded-name="0"]`)
diff --git a/app/institutions/dashboard/-components/total-count-kpi-wrapper/component-test.ts b/app/institutions/dashboard/-components/total-count-kpi-wrapper/component-test.ts
index e97c5a312bd..7df5335449e 100644
--- a/app/institutions/dashboard/-components/total-count-kpi-wrapper/component-test.ts
+++ b/app/institutions/dashboard/-components/total-count-kpi-wrapper/component-test.ts
@@ -80,7 +80,7 @@ module('Integration | institutions | dashboard | -components | total-count-kpi-w
assert.dom(parentContainer)
.exists('The Total Registration Widget exists');
assert.dom(parentContainer)
- .hasText('100 OSF Registrations');
+ .hasText('300 OSF Public and Embargoed Registrations');
assert.dom(`${parentContainer} [data-test-kpi-icon]`)
.hasAttribute('data-icon', 'archive');
diff --git a/app/institutions/dashboard/-components/total-count-kpi-wrapper/component.ts b/app/institutions/dashboard/-components/total-count-kpi-wrapper/component.ts
index a6c398e56ee..ccc9c62e102 100644
--- a/app/institutions/dashboard/-components/total-count-kpi-wrapper/component.ts
+++ b/app/institutions/dashboard/-components/total-count-kpi-wrapper/component.ts
@@ -41,6 +41,10 @@ export default class TotalCountKpiWrapperComponent extends Component {
@@ -70,7 +74,7 @@ export default class TotalCountKpiWrapperComponent extends Component
Date: Thu, 7 Nov 2024 16:40:49 -0500
Subject: [PATCH 72/96] Prevent modifying args.defaultQueryOptions when adding
filters (#2382)
---
.../dashboard/-components/object-list/component.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/institutions/dashboard/-components/object-list/component.ts b/app/institutions/dashboard/-components/object-list/component.ts
index e07391365c9..2d5810f98fb 100644
--- a/app/institutions/dashboard/-components/object-list/component.ts
+++ b/app/institutions/dashboard/-components/object-list/component.ts
@@ -42,7 +42,9 @@ export default class InstitutionalObjectList extends Component
Date: Thu, 7 Nov 2024 16:42:25 -0500
Subject: [PATCH 73/96] Hide right panel properly on desktop view (#2383)
---
.../institutional-dashboard-wrapper/styles.scss | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/app/institutions/dashboard/-components/institutional-dashboard-wrapper/styles.scss b/app/institutions/dashboard/-components/institutional-dashboard-wrapper/styles.scss
index dedc41b130c..7613d272224 100644
--- a/app/institutions/dashboard/-components/institutional-dashboard-wrapper/styles.scss
+++ b/app/institutions/dashboard/-components/institutional-dashboard-wrapper/styles.scss
@@ -2,20 +2,8 @@
@import 'app/styles/components';
.container {
- display: flex;
- flex-direction: row;
- flex-grow: 1;
-
- > div {
- // override OsfLayout styles for forcing drawer mode
- max-width: none;
- position: inherit;
- }
-
- > :global(.media-mobile),
- > :global(.media-tablet) {
- // allow drawer to be hidden offscreen
- position: relative;
+ > div { // override OsfLayout styles for forcing drawer mode
+ overflow-x: hidden;
}
}
From 0efac046fc9aff1553a3a4f270b8f28735d7b9c6 Mon Sep 17 00:00:00 2001
From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com>
Date: Thu, 7 Nov 2024 16:51:52 -0500
Subject: [PATCH 74/96] [ENG-6419] Update SHARE getters (#2384)
* Update getters in institution dashboard controllers
* Update getters in search-result model
---
.../dashboard/preprints/controller.ts | 5 +-
.../dashboard/projects/controller.ts | 9 ++-
.../dashboard/registrations/controller.ts | 7 +-
app/models/search-result.ts | 78 +++++++++----------
4 files changed, 49 insertions(+), 50 deletions(-)
diff --git a/app/institutions/dashboard/preprints/controller.ts b/app/institutions/dashboard/preprints/controller.ts
index e7cfcdb9573..fde45219d24 100644
--- a/app/institutions/dashboard/preprints/controller.ts
+++ b/app/institutions/dashboard/preprints/controller.ts
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import Intl from 'ember-intl/services/intl';
+import { getSingleOsfmapValue } from 'ember-osf-web/packages/osfmap/jsonld';
import { ResourceTypeFilterValue } from 'osf-components/components/search-page/component';
import { ObjectListColumn } from '../-components/object-list/component';
@@ -21,12 +22,12 @@ export default class InstitutionDashboardPreprints extends Controller {
},
{ // Date created
name: this.intl.t('institutions.dashboard.object-list.table-headers.created_date'),
- getValue: searchResult => searchResult.getResourceMetadataField('dateCreated'),
+ getValue: searchResult => getSingleOsfmapValue(searchResult.resourceMetadata, ['dateCreated']),
sortKey: 'dateCreated',
},
{ // Date modified
name: this.intl.t('institutions.dashboard.object-list.table-headers.modified_date'),
- getValue: searchResult => searchResult.getResourceMetadataField('dateModified'),
+ getValue: searchResult => getSingleOsfmapValue(searchResult.resourceMetadata, ['dateModified']),
sortKey: 'dateModified',
},
{ // DOI
diff --git a/app/institutions/dashboard/projects/controller.ts b/app/institutions/dashboard/projects/controller.ts
index 42568ef565c..5efb24ef4e2 100644
--- a/app/institutions/dashboard/projects/controller.ts
+++ b/app/institutions/dashboard/projects/controller.ts
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import Intl from 'ember-intl/services/intl';
+import { getSingleOsfmapValue } from 'ember-osf-web/packages/osfmap/jsonld';
import humanFileSize from 'ember-osf-web/utils/human-file-size';
@@ -23,12 +24,12 @@ 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 => getSingleOsfmapValue(searchResult.resourceMetadata, ['dateCreated']),
sortKey: 'dateCreated',
},
{ // Date modified
name: this.intl.t('institutions.dashboard.object-list.table-headers.modified_date'),
- getValue: searchResult => searchResult.getResourceMetadataField('dateModified'),
+ getValue: searchResult => getSingleOsfmapValue(searchResult.resourceMetadata, ['dateModified']),
sortKey: 'dateModified',
},
{ // DOI
@@ -42,7 +43,7 @@ export default class InstitutionDashboardProjects extends Controller {
{ // Total data stored
name: this.intl.t('institutions.dashboard.object-list.table-headers.total_data_stored'),
getValue: searchResult => {
- const byteCount = searchResult.getResourceMetadataField('storageByteCount');
+ const byteCount = getSingleOsfmapValue(searchResult.resourceMetadata, ['storageByteCount']);
return byteCount ? humanFileSize(byteCount) :
this.intl.t('institutions.dashboard.object-list.table-items.no-storage-info');
},
@@ -76,7 +77,7 @@ export default class InstitutionDashboardProjects extends Controller {
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 ||
+ return searchResult.configuredAddonNames.length ? searchResult.configuredAddonNames :
this.intl.t('institutions.dashboard.object-list.table-items.no-info', { field });
},
},
diff --git a/app/institutions/dashboard/registrations/controller.ts b/app/institutions/dashboard/registrations/controller.ts
index 209c2e146b9..5a2dcd5a5a7 100644
--- a/app/institutions/dashboard/registrations/controller.ts
+++ b/app/institutions/dashboard/registrations/controller.ts
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import Intl from 'ember-intl/services/intl';
+import { getSingleOsfmapValue } from 'ember-osf-web/packages/osfmap/jsonld';
import humanFileSize from 'ember-osf-web/utils/human-file-size';
import { ResourceTypeFilterValue } from 'osf-components/components/search-page/component';
@@ -22,12 +23,12 @@ export default class InstitutionDashboardRegistrations extends Controller {
},
{ // Date created
name: this.intl.t('institutions.dashboard.object-list.table-headers.created_date'),
- getValue: searchResult => searchResult.getResourceMetadataField('dateCreated'),
+ getValue: searchResult => getSingleOsfmapValue(searchResult.resourceMetadata, ['dateCreated']),
sortKey: 'dateCreated',
},
{ // Date modified
name: this.intl.t('institutions.dashboard.object-list.table-headers.modified_date'),
- getValue: searchResult => searchResult.getResourceMetadataField('dateModified'),
+ getValue: searchResult => getSingleOsfmapValue(searchResult.resourceMetadata, ['dateModified']),
sortKey: 'dateModified',
},
{ // DOI
@@ -41,7 +42,7 @@ export default class InstitutionDashboardRegistrations extends Controller {
{ // Total data stored
name: this.intl.t('institutions.dashboard.object-list.table-headers.total_data_stored'),
getValue: searchResult => {
- const byteCount = searchResult.getResourceMetadataField('storageByteCount');
+ const byteCount = getSingleOsfmapValue(searchResult.resourceMetadata, ['storageByteCount']);
return byteCount ? humanFileSize(byteCount) :
this.intl.t('institutions.dashboard.object-list.table-items.no-storage-info');
},
diff --git a/app/models/search-result.ts b/app/models/search-result.ts
index b092ac5573e..45a41c9c43c 100644
--- a/app/models/search-result.ts
+++ b/app/models/search-result.ts
@@ -2,6 +2,7 @@ import Model, { attr, belongsTo } from '@ember-data/model';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/template';
import IntlService from 'ember-intl/services/intl';
+import { getOsfmapValues, getSingleOsfmapObject, getSingleOsfmapValue } from 'ember-osf-web/packages/osfmap/jsonld';
import { languageFromLanguageCode } from 'osf-components/components/file-metadata-manager/component';
import IndexCardModel from './index-card';
@@ -62,22 +63,22 @@ export default class SearchResultModel extends Model {
get displayTitle() {
if (this.resourceType === 'user') {
- return this.resourceMetadata['name'][0]['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['name']);
} else if (this.resourceType === 'file') {
- return this.resourceMetadata['fileName'][0]['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['fileName']);
}
- return this.resourceMetadata['title']?.[0]['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['title']);
}
get fileTitle() {
if (this.resourceType === 'file') {
- return this.resourceMetadata.title?.[0]['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['title']);
}
return null;
}
get description() {
- return this.resourceMetadata.description?.[0]?.['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['description']);
}
get absoluteUrl() {
@@ -90,14 +91,14 @@ export default class SearchResultModel extends Model {
if (this.resourceType === 'user') {
if (this.resourceMetadata.affiliation) {
return this.resourceMetadata.affiliation.map((item: any) =>
- ({ name: item.name[0]['@value'], absoluteUrl: item['@id'] }));
+ ({ name: getSingleOsfmapValue(item, ['name']), absoluteUrl: item['@id'] }));
}
} else if (this.resourceMetadata.creator) {
return this.resourceMetadata.creator?.map((item: any) =>
- ({ name: item.name[0]['@value'], absoluteUrl: item['@id'] }));
+ ({ name: getSingleOsfmapValue(item, ['name']), absoluteUrl: item['@id'] }));
} else if (this.isContainedBy?.[0]?.creator) {
return this.isContainedBy[0].creator.map((item: any) =>
- ({ name: item.name?.[0]?.['@value'], absoluteUrl: item['@id'] }));
+ ({ name: getSingleOsfmapValue(item, ['name']), absoluteUrl: item['@id'] }));
}
}
@@ -110,22 +111,22 @@ export default class SearchResultModel extends Model {
return [
{
label: this.intl.t('osf-components.search-result-card.date_registered'),
- date: this.resourceMetadata.dateCreated?.[0]['@value'],
+ date: getSingleOsfmapValue(this.resourceMetadata, ['dateCreated']),
},
{
label: this.intl.t('osf-components.search-result-card.date_modified'),
- date: this.resourceMetadata.dateModified?.[0]['@value'],
+ date: getSingleOsfmapValue(this.resourceMetadata, ['dateModified']),
},
];
default:
return [
{
label: this.intl.t('osf-components.search-result-card.date_created'),
- date: this.resourceMetadata.dateCreated?.[0]['@value'],
+ date: getSingleOsfmapValue(this.resourceMetadata, ['dateCreated']),
},
{
label: this.intl.t('osf-components.search-result-card.date_modified'),
- date: this.resourceMetadata.dateModified?.[0]['@value'],
+ date: getSingleOsfmapValue(this.resourceMetadata, ['dateModified']),
},
];
}
@@ -163,8 +164,8 @@ export default class SearchResultModel extends Model {
const isPartOfCollection = this.resourceMetadata.isPartOfCollection;
if (isPartOfCollection) {
return {
- title: this.resourceMetadata.isPartOfCollection?.[0]?.title?.[0]?.['@value'],
- absoluteUrl: this.resourceMetadata.isPartOfCollection?.[0]?.['@id'],
+ title: getSingleOsfmapValue(this.resourceMetadata, ['isPartOfCollection', 'title']),
+ absoluteUrl: getSingleOsfmapValue(this.resourceMetadata, ['isPartOfCollection']),
};
}
return null;
@@ -172,7 +173,8 @@ export default class SearchResultModel extends Model {
get languageFromCode() {
if (this.resourceMetadata.language) {
- return languageFromLanguageCode(this.resourceMetadata.language[0]['@value']);
+ const language = getSingleOsfmapValue(this.resourceMetadata, ['language']);
+ return languageFromLanguageCode(language);
}
return null;
}
@@ -180,8 +182,8 @@ export default class SearchResultModel extends Model {
get funders() {
if (this.resourceMetadata.funder) {
return this.resourceMetadata.funder.map( (item: any) => ({
- name: item.name[0]['@value'],
- identifier: item.identifier?.[0]['@value'],
+ name: getSingleOsfmapValue(item, ['name']),
+ identifier: getSingleOsfmapValue(item, ['identifier']),
}));
}
return null;
@@ -190,8 +192,8 @@ export default class SearchResultModel extends Model {
get nodeFunders() {
if (this.resourceMetadata.isContainedBy?.[0]?.funder) {
return this.resourceMetadata.isContainedBy[0].funder.map( (item: any) => ({
- name: item.name[0]['@value'],
- identifier: item.identifier?.[0]['@value'],
+ name: getSingleOsfmapValue(item, ['name']),
+ identifier: getSingleOsfmapValue(item, ['identifier']),
}));
}
return null;
@@ -200,8 +202,8 @@ export default class SearchResultModel extends Model {
get provider() {
if (this.resourceMetadata.publisher) {
return {
- name: this.resourceMetadata.publisher[0]?.name?.[0]['@value'],
- identifier: this.resourceMetadata.publisher[0]['@id'],
+ name: getSingleOsfmapValue(this.resourceMetadata, ['publisher', 'name']),
+ identifier: getSingleOsfmapValue(this.resourceMetadata, ['publisher']),
};
}
return null;
@@ -214,8 +216,8 @@ export default class SearchResultModel extends Model {
get license() {
if (this.resourceMetadata.rights) {
return {
- name: this.resourceMetadata.rights?.[0]?.name?.[0]?.['@value'],
- identifier: this.resourceMetadata.rights?.[0]?.['@id'],
+ name: getSingleOsfmapValue(this.resourceMetadata, ['rights', 'name']),
+ identifier: getSingleOsfmapValue(this.resourceMetadata, ['rights']),
};
}
return null;
@@ -224,9 +226,9 @@ export default class SearchResultModel extends Model {
get nodeLicense() {
if (this.resourceMetadata.isContainedBy?.[0]?.rights) {
return {
- name: this.resourceMetadata.isContainedBy[0].rights?.[0]?.name?.[0]?.['@value'],
- identifier: this.resourceMetadata.rights?.[0]?.['@id'] ||
- this.resourceMetadata.isContainedBy[0].rights[0]?.['@id'],
+ name: getSingleOsfmapValue(this.resourceMetadata, ['isContainedBy', 'rights', 'name']),
+ identifier: getSingleOsfmapValue(this.resourceMetadata, ['rights']) ||
+ getSingleOsfmapValue(this.resourceMetadata, ['isContainedBy', 'rights']),
};
}
return null;
@@ -267,7 +269,7 @@ export default class SearchResultModel extends Model {
}
get resourceNature() {
- return this.resourceMetadata.resourceNature?.[0]?.displayLabel?.[0]?.['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['resourceNature','displayLabel']);
}
get hasDataResource() {
@@ -291,7 +293,7 @@ export default class SearchResultModel extends Model {
}
get registrationTemplate() {
- return this.resourceMetadata.conformsTo?.[0]?.title?.[0]?.['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['conformsTo', 'title']);
}
get isWithdrawn() {
@@ -299,30 +301,24 @@ export default class SearchResultModel extends Model {
}
get configuredAddonNames() {
- return this.resourceMetadata.hasOsfAddon?.map((item: any) => item.prefLabel[0]['@value']);
+ return getOsfmapValues(this.resourceMetadata, ['hasOsfAddon', 'prefLabel']);
}
get storageRegion() {
- return this.resourceMetadata.storageRegion?.[0]?.prefLabel[0]['@value'];
+ return getSingleOsfmapValue(this.resourceMetadata, ['storageRegion', 'prefLabel']);
}
get usageMetrics() {
- if (!this.resourceMetadata.usage) {
+ const usage = getSingleOsfmapObject(this.resourceMetadata, ['usage']);
+ if (!usage) {
return null;
}
- const temporalCoverage = this.resourceMetadata.usage[0]['temporalCoverage'];
- const viewCount = this.resourceMetadata.usage[0]['viewCount'];
- const downloadCount = this.resourceMetadata.usage[0]['downloadCount'];
return {
- period: temporalCoverage ? temporalCoverage[0]['@value'] : null,
- viewCount: viewCount ? viewCount[0]['@value'] : null,
- downloadCount: downloadCount ? downloadCount[0]['@value'] : null,
+ period: getSingleOsfmapValue(usage, ['temporalCoverage']),
+ viewCount: getSingleOsfmapValue(usage, ['viewCount']),
+ downloadCount: getSingleOsfmapValue(usage, ['downloadCount']),
};
}
-
- getResourceMetadataField(field: string) {
- return this.resourceMetadata[field]?.[0]?.['@value'];
- }
}
declare module 'ember-data/types/registries/model' {
From 4c26c7b59bb79fd08ad6e164f05c1075a2a546d2 Mon Sep 17 00:00:00 2001
From: John Tordoff <>
Date: Mon, 11 Nov 2024 12:03:50 -0500
Subject: [PATCH 75/96] move archive link button to each tab and add a download
button
---
.../template.hbs | 18 ---------
.../institutional-users-list/styles.scss | 15 +++++++
.../institutional-users-list/template.hbs | 37 ++++++++++++++++++
.../-components/object-list/styles.scss | 10 +++++
.../-components/object-list/template.hbs | 39 +++++++++++++++++++
translations/en-us.yml | 7 ++++
6 files changed, 108 insertions(+), 18 deletions(-)
diff --git a/app/institutions/dashboard/-components/institutional-dashboard-wrapper/template.hbs b/app/institutions/dashboard/-components/institutional-dashboard-wrapper/template.hbs
index 94d5a346efa..acdccd258c2 100644
--- a/app/institutions/dashboard/-components/institutional-dashboard-wrapper/template.hbs
+++ b/app/institutions/dashboard/-components/institutional-dashboard-wrapper/template.hbs
@@ -8,24 +8,6 @@
>
- {{#if @institution.linkToExternalReportsArchive}}
-
-
-
- {{t 'institutions.dashboard.download_past_reports_label'}}
-
-
-
-
- {{/if}}
{{/if}}
+
+ {{#if @institution.linkToExternalReportsArchive}}
+
+
+ {{t 'institutions.dashboard.download_past_reports_label'}}
+
+
+
+ {{/if}}
+
+
+
+
+
+
+
+ {{t 'institutions.dashboard.format_labels.csv'}}
+
+
+ {{t 'institutions.dashboard.format_labels.tsv'}}
+
+
+ {{t 'institutions.dashboard.format_labels.json_table'}}
+
+
+ {{t 'institutions.dashboard.format_labels.json_direct'}}
+
+
+
+
+