@@ -46,17 +45,6 @@
{{ action.createdBy }}
-
- @for (attribute of attributes; track attribute.key) {
- @if (!$first) {
-
|
- }
-
- {{ attribute.label }}: {{ attribute.value }}
-
- }
-
-
@if (action.comment) {
}
diff --git a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts
index 612a93311..9d6f23010 100644
--- a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts
+++ b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts
@@ -90,39 +90,6 @@ describe('CollectionSubmissionItemComponent', () => {
expect(currentAction).toBeNull();
});
- it('should compute current submission attributes correctly', () => {
- fixture.componentRef.setInput('submission', mockSubmission);
- fixture.detectChanges();
-
- const attributes = component.currentSubmissionAttributes();
- expect(attributes).toBeDefined();
- expect(Array.isArray(attributes)).toBe(true);
- });
-
- it('should return attributes even when submission has no actions', () => {
- const submissionWithoutActions = { ...mockSubmission, actions: [] };
- fixture.componentRef.setInput('submission', submissionWithoutActions);
- fixture.detectChanges();
-
- const attributes = component.currentSubmissionAttributes();
- expect(attributes).toBeDefined();
- expect(attributes).not.toBeNull();
- expect(Array.isArray(attributes)).toBe(true);
- expect(attributes!.length).toBeGreaterThan(0);
- });
-
- it('should return attributes with filtered null values', () => {
- const submissionWithNullFields = { ...mockSubmission, programArea: null, collectedType: null, dataType: null };
- fixture.componentRef.setInput('submission', submissionWithNullFields);
- fixture.detectChanges();
-
- const attributes = component.currentSubmissionAttributes();
- expect(attributes).toBeDefined();
- expect(attributes).not.toBeNull();
- expect(Array.isArray(attributes)).toBe(true);
- expect(attributes!.length).toBeGreaterThan(0);
- });
-
it('should have SubmissionReviewStatus enum available', () => {
expect(component.SubmissionReviewStatus).toBe(SubmissionReviewStatus);
});
diff --git a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts
index a1d475ac1..013686142 100644
--- a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts
+++ b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts
@@ -8,7 +8,6 @@ import { Button } from 'primeng/button';
import { ChangeDetectionStrategy, Component, computed, inject, input, output } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
-import { collectionFilterNames } from '@osf/features/collections/constants';
import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component';
import { IconComponent } from '@osf/shared/components/icon/icon.component';
import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component';
@@ -57,18 +56,6 @@ export class CollectionSubmissionItemComponent {
return actions[0];
});
- currentSubmissionAttributes = computed(() => {
- const item = this.submission();
- if (!item) return null;
-
- return collectionFilterNames
- .map((attribute) => ({
- ...attribute,
- value: item[attribute.key as keyof CollectionSubmissionWithGuid] as string,
- }))
- .filter((attribute) => attribute.value);
- });
-
hasMoreContributors = computed(() => {
const submission = this.submission();
if (submission.contributors && submission.totalContributors) {
diff --git a/src/app/features/project/overview/components/overview-collections/overview-collections.component.html b/src/app/features/project/overview/components/overview-collections/overview-collections.component.html
index 2904e8c9c..ad246257a 100644
--- a/src/app/features/project/overview/components/overview-collections/overview-collections.component.html
+++ b/src/app/features/project/overview/components/overview-collections/overview-collections.component.html
@@ -34,9 +34,9 @@ {{ 'project.overview.metadata.collection' | translate }}
@let cedarTemplate = cedarTemplateById().get(templateId) ?? null;
@let attributes =
- isCedarMode() && cedarRecord && cedarTemplate?.attributes?.template
+ cedarRecord && cedarTemplate?.attributes?.template
? getCedarAttributes(cedarRecord, cedarTemplate!)
- : getSubmissionAttributes(submission);
+ : [];
@if (attributes.length) {
diff --git a/src/app/features/project/overview/components/overview-collections/overview-collections.component.spec.ts b/src/app/features/project/overview/components/overview-collections/overview-collections.component.spec.ts
index 57e2e414b..e0e8ec058 100644
--- a/src/app/features/project/overview/components/overview-collections/overview-collections.component.spec.ts
+++ b/src/app/features/project/overview/components/overview-collections/overview-collections.component.spec.ts
@@ -1,17 +1,13 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';
-import { collectionFilterNames } from '@osf/features/collections/constants';
import { CedarMetadataDataTemplateJsonApi } from '@osf/features/metadata/models';
import { CollectionSubmission } from '@osf/shared/models/collections/collections.model';
import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks/cedar-metadata-data-template-json-api.mock';
import { MOCK_CEDAR_METADATA_RECORD_DATA } from '@testing/mocks/cedar-metadata-record.mock';
import {
- MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS,
- MOCK_COLLECTION_SUBMISSION_SINGLE_FILTER,
- MOCK_COLLECTION_SUBMISSION_STRINGIFY,
- MOCK_COLLECTION_SUBMISSION_WITH_FILTERS,
+ MOCK_COLLECTION_SUBMISSION_BASE,
MOCK_COLLECTION_SUBMISSIONS,
} from '@testing/mocks/collections-submissions.mock';
import { provideOSFCore } from '@testing/osf.testing.provider';
@@ -55,57 +51,15 @@ describe('OverviewCollectionsComponent', () => {
expect(component.isProjectSubmissionsLoading()).toBe(true);
});
- it('should return empty array from getSubmissionAttributes when submission has no filter values', () => {
- expect(component.getSubmissionAttributes(MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS)).toEqual([]);
- });
-
- it('should return attributes for truthy filter keys from getSubmissionAttributes', () => {
- const result = component.getSubmissionAttributes(MOCK_COLLECTION_SUBMISSION_WITH_FILTERS);
- const programAreaFilter = collectionFilterNames.find((f) => f.key === 'programArea');
- const collectedTypeFilter = collectionFilterNames.find((f) => f.key === 'collectedType');
- const statusFilter = collectionFilterNames.find((f) => f.key === 'status');
- expect(result).toContainEqual({
- key: 'programArea',
- label: programAreaFilter?.label,
- value: 'Health',
- });
- expect(result).toContainEqual({
- key: 'collectedType',
- label: collectedTypeFilter?.label,
- value: 'Article',
- });
- expect(result).toContainEqual({
- key: 'status',
- label: statusFilter?.label,
- value: 'Published',
- });
- expect(result.length).toBe(3);
- });
-
- it('should exclude falsy values from getSubmissionAttributes', () => {
- const result = component.getSubmissionAttributes(MOCK_COLLECTION_SUBMISSION_SINGLE_FILTER);
- expect(result).toHaveLength(1);
- expect(result[0].key).toBe('collectedType');
- expect(result[0].value).toBe('Article');
- });
-
- it('should stringify numeric-like values in getSubmissionAttributes', () => {
- const result = component.getSubmissionAttributes(MOCK_COLLECTION_SUBMISSION_STRINGIFY);
- const statusAttr = result.find((a) => a.key === 'status');
- expect(statusAttr?.value).toBe('1');
- expect(typeof statusAttr?.value).toBe('string');
- });
-
- it('should display cedar attributes as key-value pairs when isCedarMode is true with matching record and template', async () => {
+ it('should display cedar attributes as key-value pairs when there is a matching record and template', async () => {
const cedarSubmission: CollectionSubmission = {
- ...MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS,
+ ...MOCK_COLLECTION_SUBMISSION_BASE,
requiredMetadataTemplateId: 'template-1',
};
const cedarTemplate: CedarMetadataDataTemplateJsonApi =
CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK as CedarMetadataDataTemplateJsonApi;
fixture.componentRef.setInput('projectSubmissions', [cedarSubmission]);
- fixture.componentRef.setInput('isCedarMode', true);
fixture.componentRef.setInput('cedarRecords', [MOCK_CEDAR_METADATA_RECORD_DATA]);
fixture.componentRef.setInput('cedarTemplates', [cedarTemplate]);
fixture.detectChanges();
@@ -117,44 +71,20 @@ describe('OverviewCollectionsComponent', () => {
expect(fixture.nativeElement.textContent).toContain('Test Project Name');
});
- it('should display submission attributes when isCedarMode is false', async () => {
- const cedarSubmission: CollectionSubmission = {
- ...MOCK_COLLECTION_SUBMISSION_WITH_FILTERS,
- requiredMetadataTemplateId: 'template-1',
- };
- const cedarTemplate: CedarMetadataDataTemplateJsonApi =
- CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK as CedarMetadataDataTemplateJsonApi;
-
- fixture.componentRef.setInput('projectSubmissions', [cedarSubmission]);
- fixture.componentRef.setInput('isCedarMode', false);
- fixture.componentRef.setInput('cedarRecords', [MOCK_CEDAR_METADATA_RECORD_DATA]);
- fixture.componentRef.setInput('cedarTemplates', [cedarTemplate]);
- fixture.detectChanges();
- await fixture.whenStable();
-
- const attributes = component.getSubmissionAttributes(cedarSubmission);
- expect(attributes.length).toBeGreaterThan(0);
- const paragraphs = fixture.nativeElement.querySelectorAll('p.font-normal');
- expect(paragraphs.length).toBe(attributes.length);
- });
-
- it('should fall back to submission attributes when isCedarMode is true but no matching record', async () => {
+ it('should not display attributes when there is no matching cedar record', async () => {
const cedarSubmission: CollectionSubmission = {
- ...MOCK_COLLECTION_SUBMISSION_WITH_FILTERS,
+ ...MOCK_COLLECTION_SUBMISSION_BASE,
requiredMetadataTemplateId: 'non-existent-template',
};
fixture.componentRef.setInput('projectSubmissions', [cedarSubmission]);
- fixture.componentRef.setInput('isCedarMode', true);
fixture.componentRef.setInput('cedarRecords', []);
fixture.componentRef.setInput('cedarTemplates', []);
fixture.detectChanges();
await fixture.whenStable();
- const attributes = component.getSubmissionAttributes(cedarSubmission);
- expect(attributes.length).toBeGreaterThan(0);
const paragraphs = fixture.nativeElement.querySelectorAll('p.font-normal');
- expect(paragraphs.length).toBe(attributes.length);
+ expect(paragraphs.length).toBe(0);
});
it('should extract key-value pairs from a cedar record using template field order and labels', () => {
diff --git a/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts b/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts
index fdc6cbe7a..e07dc4016 100644
--- a/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts
+++ b/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts
@@ -8,7 +8,6 @@ import { Tag } from 'primeng/tag';
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
import { RouterLink } from '@angular/router';
-import { collectionFilterNames } from '@osf/features/collections/constants';
import { CedarMetadataDataTemplateJsonApi, CedarMetadataRecordData } from '@osf/features/metadata/models';
import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive';
import { CollectionSubmission } from '@osf/shared/models/collections/collections.model';
@@ -37,7 +36,6 @@ import { CollectionStatusSeverityPipe } from '@osf/shared/pipes/collection-statu
export class OverviewCollectionsComponent {
projectSubmissions = input(null);
isProjectSubmissionsLoading = input(false);
- isCedarMode = input(false);
cedarRecords = input(null);
cedarTemplates = input(null);
@@ -56,24 +54,6 @@ export class OverviewCollectionsComponent {
return new Map(templates?.map((t) => [t.id, t] as const) ?? []);
});
- getSubmissionAttributes(submission: CollectionSubmission): KeyValueModel[] {
- const attributes: KeyValueModel[] = [];
-
- for (const filter of collectionFilterNames) {
- const value = submission[filter.key as keyof CollectionSubmission];
-
- if (value) {
- attributes.push({
- key: filter.key,
- label: filter.label,
- value: String(value),
- });
- }
- }
-
- return attributes;
- }
-
getCedarAttributes(record: CedarMetadataRecordData, template: CedarMetadataDataTemplateJsonApi): KeyValueModel[] {
const { order, propertyLabels } = template.attributes.template._ui;
const metadata = record.attributes.metadata as Record;
diff --git a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html
index 8c29f30a4..25c868ce5 100644
--- a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html
+++ b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html
@@ -127,7 +127,6 @@ {{ 'common.labels.affiliatedInstitutions' | translate }}
diff --git a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts
index c95546f14..d89ff2ef5 100644
--- a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts
+++ b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts
@@ -7,7 +7,6 @@ import { Mock } from 'vitest';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
-import { UserSelectors } from '@core/store/user';
import {
GetCedarMetadataRecords,
GetCedarMetadataTemplates,
@@ -103,7 +102,6 @@ describe('ProjectOverviewMetadataComponent', () => {
{ selector: ContributorsSelectors.hasMoreBibliographicContributors, value: false },
{ selector: CollectionsSelectors.getCurrentProjectSubmissions, value: [] },
{ selector: CollectionsSelectors.getCurrentProjectSubmissionsLoading, value: false },
- { selector: UserSelectors.getActiveFlags, value: [] },
{ selector: MetadataSelectors.getCedarRecords, value: [] },
{ selector: MetadataSelectors.getCedarTemplates, value: null },
{ selector: MetadataSelectors.getCustomItemMetadata, value: null },
diff --git a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts
index 1bda04633..77d7963d5 100644
--- a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts
+++ b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts
@@ -8,7 +8,6 @@ import { DatePipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, computed, effect, inject } from '@angular/core';
import { Router, RouterLink } from '@angular/router';
-import { UserSelectors } from '@core/store/user';
import {
GetCedarMetadataRecords,
GetCedarMetadataTemplates,
@@ -34,7 +33,6 @@ import {
LoadMoreBibliographicContributors,
} from '@osf/shared/stores/contributors';
import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects';
-import { COLLECTION_SUBMISSION_WITH_CEDAR } from '@shared/constants/feature-flags.const';
import {
GetProjectIdentifiers,
@@ -95,11 +93,9 @@ export class ProjectOverviewMetadataComponent {
readonly hasMoreBibliographicContributors = select(ContributorsSelectors.hasMoreBibliographicContributors);
readonly projectSubmissions = select(CollectionsSelectors.getCurrentProjectSubmissions);
readonly isProjectSubmissionsLoading = select(CollectionsSelectors.getCurrentProjectSubmissionsLoading);
- readonly activeFlags = select(UserSelectors.getActiveFlags);
readonly cedarRecords = select(MetadataSelectors.getCedarRecords);
private readonly cedarTemplatesResponse = select(MetadataSelectors.getCedarTemplates);
readonly cedarTemplates = computed(() => this.cedarTemplatesResponse()?.data ?? null);
- readonly isCedarMode = computed(() => this.activeFlags().includes(COLLECTION_SUBMISSION_WITH_CEDAR));
readonly resourceType = CurrentResourceType.Projects;
readonly dateFormat = 'MMM d, y, h:mm a';
diff --git a/src/app/shared/helpers/convert-to-snake-case.helper.ts b/src/app/shared/helpers/convert-to-snake-case.helper.ts
deleted file mode 100644
index d63afe76d..000000000
--- a/src/app/shared/helpers/convert-to-snake-case.helper.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export function convertToSnakeCase(obj: Record): Record {
- return Object.entries(obj).reduce(
- (acc, [key, value]) => {
- const snakeCaseKey = key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
- acc[snakeCaseKey] = value;
- return acc;
- },
- {} as Record
- );
-}
diff --git a/src/app/shared/mappers/collections/collections.mapper.ts b/src/app/shared/mappers/collections/collections.mapper.ts
index 165e9544f..fb6191df9 100644
--- a/src/app/shared/mappers/collections/collections.mapper.ts
+++ b/src/app/shared/mappers/collections/collections.mapper.ts
@@ -2,7 +2,6 @@ import {
CollectionSubmissionReviewAction,
CollectionSubmissionReviewActionJsonApi,
} from '@osf/features/moderation/models';
-import { convertToSnakeCase } from '@osf/shared/helpers/convert-to-snake-case.helper';
import { CollectionSubmissionPayload } from '@osf/shared/models/collections/collection-submission-payload.model';
import { CollectionSubmissionPayloadJsonApi } from '@osf/shared/models/collections/collection-submission-payload-json-api.model';
import {
@@ -87,18 +86,6 @@ export class CollectionsMapper {
bookmarks: response.attributes.bookmarks,
isPromoted: response.attributes.is_promoted,
isPublic: response.attributes.is_public,
- filters: {
- status: response.attributes.status_choices,
- collectedType: response.attributes.collected_type_choices,
- volume: response.attributes.volume_choices,
- issue: response.attributes.issue_choices,
- programArea: response.attributes.program_area_choices,
- schoolType: response.attributes.school_type_choices,
- studyDesign: response.attributes.study_design_choices,
- dataType: response.attributes.data_type_choices,
- disease: response.attributes.disease_choices,
- gradeLevels: response.attributes.grade_levels_choices,
- },
};
}
@@ -107,16 +94,6 @@ export class CollectionsMapper {
id: submission.id,
type: submission.type,
reviewsState: submission.attributes.reviews_state,
- collectedType: submission.attributes.collected_type,
- status: submission.attributes.status,
- volume: submission.attributes.volume,
- issue: submission.attributes.issue,
- programArea: submission.attributes.program_area,
- schoolType: submission.attributes.school_type,
- studyDesign: submission.attributes.study_design,
- dataType: submission.attributes.data_type,
- disease: submission.attributes.disease,
- gradeLevels: submission.attributes.grade_levels,
collectionTitle: replaceBadEncodedChars(submission.embeds.collection.data.attributes.title),
collectionId: submission.embeds.collection.data.relationships.provider.data.id,
requiredMetadataTemplateId:
@@ -143,16 +120,6 @@ export class CollectionsMapper {
dateModified: submission.embeds.guid.data.attributes.date_modified,
public: submission.embeds.guid.data.attributes.public,
reviewsState: submission.attributes.reviews_state,
- collectedType: submission.attributes.collected_type,
- status: submission.attributes.status,
- volume: submission.attributes.volume,
- issue: submission.attributes.issue,
- programArea: submission.attributes.program_area,
- schoolType: submission.attributes.school_type,
- studyDesign: submission.attributes.study_design,
- dataType: submission.attributes.data_type,
- disease: submission.attributes.disease,
- gradeLevels: submission.attributes.grade_levels,
creator: creator
? {
id: creator?.id,
@@ -184,35 +151,6 @@ export class CollectionsMapper {
}));
}
- static fromPostCollectionSubmissionsResponse(
- response: CollectionSubmissionWithGuidJsonApi[]
- ): CollectionSubmissionWithGuid[] {
- return response.map((submission) => ({
- id: submission.id,
- type: submission.type,
- nodeId: submission.embeds.guid.data.id,
- nodeUrl: submission.embeds.guid.data.links.html,
- title: replaceBadEncodedChars(submission.embeds.guid.data.attributes.title),
- description: replaceBadEncodedChars(submission.embeds.guid.data.attributes.description),
- category: submission.embeds.guid.data.attributes.category,
- dateCreated: submission.embeds.guid.data.attributes.date_created,
- dateModified: submission.embeds.guid.data.attributes.date_modified,
- public: submission.embeds.guid.data.attributes.public,
- reviewsState: submission.attributes.reviews_state,
- collectedType: submission.attributes.collected_type,
- status: submission.attributes.status,
- volume: submission.attributes.volume,
- issue: submission.attributes.issue,
- programArea: submission.attributes.program_area,
- schoolType: submission.attributes.school_type,
- studyDesign: submission.attributes.study_design,
- dataType: submission.attributes.data_type,
- disease: submission.attributes.disease,
- gradeLevels: submission.attributes.grade_levels,
- contributors: [] as ContributorModel[],
- }));
- }
-
static getProjectSubmission(data: CollectionSubmissionWithGuidJsonApi): CollectionProjectSubmission {
const project = ProjectsMapper.fromProjectResponse(data.embeds.guid.data);
const submission: CollectionSubmissionWithGuid = {
@@ -227,16 +165,6 @@ export class CollectionsMapper {
dateModified: data.embeds.guid.data.attributes.date_modified,
public: data.embeds.guid.data.attributes.public,
reviewsState: data.attributes.reviews_state,
- collectedType: data.attributes.collected_type,
- status: data.attributes.status,
- volume: data.attributes.volume,
- issue: data.attributes.issue,
- programArea: data.attributes.program_area,
- schoolType: data.attributes.school_type,
- studyDesign: data.attributes.study_design,
- dataType: data.attributes.data_type,
- disease: data.attributes.disease,
- gradeLevels: data.attributes.grade_levels,
contributors: [] as ContributorModel[],
};
@@ -244,20 +172,16 @@ export class CollectionsMapper {
}
static toCollectionSubmissionRequest(payload: CollectionSubmissionPayload): CollectionSubmissionPayloadJsonApi {
- const collectionId = payload.collectionId;
- const collectionsMetadata = payload.collectionMetadata ? convertToSnakeCase(payload.collectionMetadata) : {};
-
return {
data: {
type: 'collection-submissions',
attributes: {
guid: payload.projectId,
- ...collectionsMetadata,
},
relationships: {
collection: {
data: {
- id: collectionId,
+ id: payload.collectionId,
type: 'collections',
},
},
@@ -271,19 +195,4 @@ export class CollectionsMapper {
},
};
}
-
- static collectionSubmissionUpdateRequest(payload: CollectionSubmissionPayload) {
- const collectionsMetadata = payload.collectionMetadata ? convertToSnakeCase(payload.collectionMetadata) : {};
-
- return {
- data: {
- id: `${payload.projectId}-${payload.collectionId}`,
- type: 'collection-submissions',
- attributes: {
- ...collectionsMetadata,
- },
- relationships: {},
- },
- };
- }
}
diff --git a/src/app/shared/models/collections/collection-submission-payload.model.ts b/src/app/shared/models/collections/collection-submission-payload.model.ts
index 4ffec1fea..64d7e5779 100644
--- a/src/app/shared/models/collections/collection-submission-payload.model.ts
+++ b/src/app/shared/models/collections/collection-submission-payload.model.ts
@@ -2,5 +2,4 @@ export interface CollectionSubmissionPayload {
collectionId: string;
projectId: string;
userId: string;
- collectionMetadata?: Record;
}
diff --git a/src/app/shared/models/collections/collections-filters.model.ts b/src/app/shared/models/collections/collections-filters.model.ts
deleted file mode 100644
index 706953351..000000000
--- a/src/app/shared/models/collections/collections-filters.model.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export interface CollectionsFilters {
- programArea: string[];
- status: string[];
- collectedType: string[];
- dataType: string[];
- disease: string[];
- gradeLevels: string[];
- issue: string[];
- schoolType: string[];
- studyDesign: string[];
- volume: string[];
-}
diff --git a/src/app/shared/models/collections/collections-json-api.model.ts b/src/app/shared/models/collections/collections-json-api.model.ts
index 885295386..c2a0b456e 100644
--- a/src/app/shared/models/collections/collections-json-api.model.ts
+++ b/src/app/shared/models/collections/collections-json-api.model.ts
@@ -45,16 +45,6 @@ export interface CollectionDetailsResponseJsonApi {
bookmarks: boolean;
is_promoted: boolean;
is_public: boolean;
- status_choices: string[];
- collected_type_choices: string[];
- volume_choices: string[];
- issue_choices: string[];
- program_area_choices: string[];
- school_type_choices: string[];
- study_design_choices: string[];
- data_type_choices: string[];
- disease_choices: string[];
- grade_levels_choices: string[];
};
}
@@ -63,16 +53,6 @@ export interface CollectionSubmissionJsonApi {
type: string;
attributes: {
reviews_state: CollectionSubmissionReviewState;
- collected_type: string;
- status: string;
- volume: string;
- issue: string;
- program_area: string;
- school_type: string;
- study_design: string;
- data_type: string;
- disease: string;
- grade_levels: string;
};
embeds: {
collection: {
@@ -103,16 +83,6 @@ export interface CollectionSubmissionWithGuidJsonApi {
type: string;
attributes: {
reviews_state: CollectionSubmissionReviewState;
- collected_type: string;
- status: string;
- volume: string;
- issue: string;
- program_area: string;
- school_type: string;
- study_design: string;
- data_type: string;
- disease: string;
- grade_levels: string;
};
embeds: {
guid: {
@@ -139,23 +109,3 @@ export interface SparseCollectionsResponseJsonApi {
export interface CollectionDetailsGetResponseJsonApi extends JsonApiResponse {
data: CollectionDetailsResponseJsonApi;
}
-
-export interface CollectionSubmissionsSearchPayloadJsonApi {
- data: {
- attributes: {
- provider: string[];
- studyDesign?: string[];
- schoolType?: string[];
- status?: string[];
- collectedType?: string[];
- volume?: string[];
- issue?: string[];
- programArea?: string[];
- dataType?: string[];
- disease?: string[];
- gradeLevels?: string[];
- q?: string;
- };
- };
- type: string;
-}
diff --git a/src/app/shared/models/collections/collections.model.ts b/src/app/shared/models/collections/collections.model.ts
index e2b6bdf0b..7faa5113e 100644
--- a/src/app/shared/models/collections/collections.model.ts
+++ b/src/app/shared/models/collections/collections.model.ts
@@ -24,19 +24,6 @@ export interface CollectionProvider extends BaseProviderModel {
requiredMetadataTemplate?: CedarMetadataDataTemplateJsonApi | null;
}
-export interface CollectionFilters {
- collectedType: string[];
- disease: string[];
- dataType: string[];
- gradeLevels: string[];
- issue: string[];
- programArea: string[];
- schoolType: string[];
- status: string[];
- studyDesign: string[];
- volume: string[];
-}
-
export interface CollectionDetails {
id: string;
type: string;
@@ -47,7 +34,6 @@ export interface CollectionDetails {
bookmarks: boolean;
isPromoted: boolean;
isPublic: boolean;
- filters: CollectionFilters;
}
export interface CollectionSubmission {
@@ -56,16 +42,6 @@ export interface CollectionSubmission {
collectionTitle: string;
collectionId: string;
reviewsState: CollectionSubmissionReviewState;
- collectedType: string;
- status: string;
- volume: string;
- issue: string;
- programArea: string;
- schoolType: string;
- studyDesign: string;
- dataType: string;
- disease: string;
- gradeLevels: string;
requiredMetadataTemplateId?: string | null;
}
@@ -81,16 +57,6 @@ export interface CollectionSubmissionWithGuid {
dateModified: string;
public: boolean;
reviewsState: CollectionSubmissionReviewState;
- collectedType: string;
- status: string;
- volume: string;
- issue: string;
- programArea: string;
- schoolType: string;
- studyDesign: string;
- dataType: string;
- disease: string;
- gradeLevels: string;
contributors?: ContributorModel[];
creator?: {
id: string;
diff --git a/src/app/shared/models/environment.model.ts b/src/app/shared/models/environment.model.ts
index 3a688ca4e..184fe4ce4 100644
--- a/src/app/shared/models/environment.model.ts
+++ b/src/app/shared/models/environment.model.ts
@@ -65,5 +65,4 @@ export interface EnvironmentModel {
*/
googleFilePickerAppId: number;
throttleToken: string;
- collectionSubmissionWithCedar: boolean;
}
diff --git a/src/app/shared/services/collections.service.ts b/src/app/shared/services/collections.service.ts
index 80a1577e4..5ab6156fb 100644
--- a/src/app/shared/services/collections.service.ts
+++ b/src/app/shared/services/collections.service.ts
@@ -1,11 +1,7 @@
-import { createDispatchMap } from '@ngxs/store';
+import { forkJoin, map, Observable } from 'rxjs';
-import { catchError, forkJoin, map, Observable, of, switchMap } from 'rxjs';
-
-import { HttpContext } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
-import { BYPASS_ERROR_INTERCEPTOR } from '@core/interceptors/error-interceptor.tokens';
import { ENVIRONMENT } from '@core/provider/environment.provider';
import {
CollectionSubmissionReviewAction,
@@ -13,7 +9,6 @@ import {
} from '@osf/features/moderation/models';
import { CollectionsMapper } from '../mappers/collections';
-import { ContributorsMapper } from '../mappers/contributors';
import { ReviewActionsMapper } from '../mappers/review-actions.mapper';
import {
CollectionDetails,
@@ -25,20 +20,15 @@ import {
CollectionSubmissionWithGuid,
} from '../models/collections/collections.model';
import {
- CollectionDetailsGetResponseJsonApi,
CollectionDetailsResponseJsonApi,
CollectionProviderResponseJsonApi,
CollectionSubmissionJsonApi,
- CollectionSubmissionsSearchPayloadJsonApi,
CollectionSubmissionWithGuidJsonApi,
} from '../models/collections/collections-json-api.model';
import { JsonApiResponse, ResponseJsonApi } from '../models/common/json-api.model';
-import { ContributorModel } from '../models/contributors/contributor.model';
-import { ContributorsResponseJsonApi } from '../models/contributors/contributor-response-json-api.model';
import { PaginatedData } from '../models/paginated-data.model';
import { ReviewActionPayload } from '../models/review-action/review-action-payload.model';
import { ReviewActionPayloadJsonApi } from '../models/review-action/review-action-payload-json-api.model';
-import { SetTotalSubmissions } from '../stores/collections/collections.actions';
import { JsonApiService } from './json-api.service';
@@ -53,8 +43,6 @@ export class CollectionsService {
return `${this.environment.apiDomainUrl}/v2`;
}
- private actions = createDispatchMap({ setTotalSubmissions: SetTotalSubmissions });
-
getCollectionProvider(collectionName: string): Observable {
const url = `${this.apiUrl}/providers/collections/${collectionName}/?embed=brand&embed=required_metadata_template`;
@@ -63,72 +51,6 @@ export class CollectionsService {
.pipe(map((response) => CollectionsMapper.fromGetCollectionProviderResponse(response.data)));
}
- getCollectionDetails(collectionId: string): Observable {
- const url = `${this.apiUrl}/collections/${collectionId}/`;
-
- return this.jsonApiService
- .get(url)
- .pipe(map((response) => CollectionsMapper.fromGetCollectionDetailsResponse(response.data)));
- }
-
- searchCollectionSubmissions(
- providerId: string,
- searchText: string,
- activeFilters: Record,
- page = '1',
- sortBy: string
- ): Observable {
- const url = `${this.apiUrl}/search/collections/`;
- const params: Record = {
- page,
- };
-
- if (sortBy) {
- params['sort'] = sortBy;
- }
-
- const payload: CollectionSubmissionsSearchPayloadJsonApi = {
- data: {
- attributes: {
- provider: [providerId],
- ...activeFilters,
- q: searchText ? searchText : '*',
- },
- },
- type: 'search',
- };
-
- return this.jsonApiService.post>(url, payload, params).pipe(
- switchMap((response) => {
- const totalCount = response.meta?.total ?? 0;
- this.actions.setTotalSubmissions(totalCount);
-
- if (!response.data.length) {
- return of([]);
- }
-
- const contributorRequests = response.data.map((submission) =>
- this.getCollectionContributors(
- submission.embeds.guid.data.relationships!.bibliographic_contributors!.links.related.href
- ).pipe(catchError(() => of([])))
- );
-
- if (!contributorRequests.length) {
- return of([]);
- }
-
- return forkJoin(contributorRequests).pipe(
- map((contributorsArrays) =>
- response.data.map((submission, index) => ({
- ...CollectionsMapper.fromPostCollectionSubmissionsResponse([submission])[0],
- contributors: contributorsArrays[index],
- }))
- )
- );
- })
- );
- }
-
fetchCollectionSubmissionsByStatus(
collectionId: string,
status: string,
@@ -226,19 +148,6 @@ export class CollectionsService {
>(`${this.apiUrl}/collection_submission_actions/`, params);
}
- private getCollectionContributors(contributorsUrl: string): Observable {
- const params: Record = {
- 'fields[users]': 'full_name',
- };
-
- const context = new HttpContext();
- context.set(BYPASS_ERROR_INTERCEPTOR, true);
-
- return this.jsonApiService
- .get(contributorsUrl, params, context)
- .pipe(map((response) => ContributorsMapper.getContributors(response.data)));
- }
-
private fetchUserCollectionSubmissionsByStatus(
providerId: string,
projectIds: string[],
diff --git a/src/app/shared/stores/collections/collections.actions.ts b/src/app/shared/stores/collections/collections.actions.ts
index cf43e1f98..6f47a3ace 100644
--- a/src/app/shared/stores/collections/collections.actions.ts
+++ b/src/app/shared/stores/collections/collections.actions.ts
@@ -1,17 +1,9 @@
-import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model';
-
export class GetCollectionProvider {
static readonly type = '[Collections] Get Collection Provider';
constructor(public collectionName: string) {}
}
-export class GetCollectionDetails {
- static readonly type = '[Collections] Get Collection Details';
-
- constructor(public collectionId: string) {}
-}
-
export class GetProjectSubmissions {
static readonly type = '[Collections] Get Project Submissions';
@@ -22,118 +14,6 @@ export class ClearCollections {
static readonly type = '[Collections] Clear Collections';
}
-export class ClearCollectionSubmissions {
- static readonly type = '[Collections] Clear Collection Submissions';
-}
-
-export class SetProgramAreaFilters {
- static readonly type = '[Collections] Set Program Area Filters';
-
- constructor(public programAreaFilters: string[]) {}
-}
-
-export class SetCollectedTypeFilters {
- static readonly type = '[Collections] Set Collected Type Filters';
-
- constructor(public collectedTypeFilters: string[]) {}
-}
-
-export class SetStatusFilters {
- static readonly type = '[Collections] Set Status Filters';
-
- constructor(public statusFilters: string[]) {}
-}
-
-export class SetDataTypeFilters {
- static readonly type = '[Collections] Set Data Type Filters';
-
- constructor(public dataTypeFilters: string[]) {}
-}
-
-export class SetDiseaseFilters {
- static readonly type = '[Collections] Set Disease Filters';
-
- constructor(public diseaseFilters: string[]) {}
-}
-
-export class SetGradeLevelsFilters {
- static readonly type = '[Collections] Set Grade Levels Filters';
-
- constructor(public gradeLevelsFilters: string[]) {}
-}
-
-export class SetIssueFilters {
- static readonly type = '[Collections] Set Issue Filters';
-
- constructor(public issueFilters: string[]) {}
-}
-
-export class SetReviewsStateFilters {
- static readonly type = '[Collections] Set Reviews State Filters';
-
- constructor(public reviewsStateFilters: string[]) {}
-}
-
-export class SetSchoolTypeFilters {
- static readonly type = '[Collections] Set School Type Filters';
-
- constructor(public schoolTypeFilters: string[]) {}
-}
-
-export class SetStudyDesignFilters {
- static readonly type = '[Collections] Set Study Design Filters';
-
- constructor(public studyDesignFilters: string[]) {}
-}
-
-export class SetVolumeFilters {
- static readonly type = '[Collections] Set Volume Filters';
-
- constructor(public volumeFilters: string[]) {}
-}
-
-export class SetSortBy {
- static readonly type = '[Collections] Set Sort By';
-
- constructor(public sortValue: string) {}
-}
-
-export class SetTotalSubmissions {
- static readonly type = '[Collections] Set Total Submission';
-
- constructor(public totalCount: number) {}
-}
-
-export class SetPageNumber {
- static readonly type = '[Collections] Set Page Number';
-
- constructor(public page: string) {}
-}
-
-export class SetSearchValue {
- static readonly type = '[Collections] Set Search Value';
-
- constructor(public searchValue: string) {}
-}
-
-export class SetAllFilters {
- static readonly type = '[Collections] Set All Filters';
-
- constructor(public filters: Partial) {}
-}
-
-export class SearchCollectionSubmissions {
- static readonly type = '[Collections] Search Collection Submissions';
-
- constructor(
- public providerId: string,
- public searchText: string,
- public activeFilters: Record,
- public page: string,
- public sort: string
- ) {}
-}
-
export class GetUserCollectionSubmissions {
static readonly type = '[Collections] Get User Collection Submissions';
diff --git a/src/app/shared/stores/collections/collections.model.ts b/src/app/shared/stores/collections/collections.model.ts
index 8ad7f5035..59bbe7cda 100644
--- a/src/app/shared/stores/collections/collections.model.ts
+++ b/src/app/shared/stores/collections/collections.model.ts
@@ -1,60 +1,22 @@
import {
- CollectionDetails,
CollectionProvider,
CollectionSubmission,
CollectionSubmissionWithGuid,
} from '@osf/shared/models/collections/collections.model';
-import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model';
import { AsyncStateModel } from '@osf/shared/models/store/async-state.model';
export interface CollectionsStateModel {
- currentFilters: CollectionsFilters;
- filtersOptions: CollectionsFilters;
collectionProvider: AsyncStateModel;
- collectionDetails: AsyncStateModel;
- collectionSubmissions: AsyncStateModel;
userCollectionSubmissions: AsyncStateModel;
currentProjectSubmissions: AsyncStateModel;
- totalSubmissions: number;
- sortBy: string;
- searchText: string;
- page: string;
}
-export const FILTERS_DEFAULTS = {
- programArea: [],
- status: [],
- collectedType: [],
- dataType: [],
- disease: [],
- gradeLevels: [],
- issue: [],
- reviewsState: [],
- schoolType: [],
- studyDesign: [],
- volume: [],
-};
-
export const COLLECTIONS_DEFAULTS: CollectionsStateModel = {
- currentFilters: FILTERS_DEFAULTS,
- filtersOptions: FILTERS_DEFAULTS,
collectionProvider: {
data: null,
isLoading: false,
error: null,
},
- collectionDetails: {
- data: null,
- isLoading: false,
- isSubmitting: false,
- error: null,
- },
- collectionSubmissions: {
- data: [],
- isLoading: false,
- isSubmitting: false,
- error: null,
- },
userCollectionSubmissions: {
data: [],
isLoading: false,
@@ -67,8 +29,4 @@ export const COLLECTIONS_DEFAULTS: CollectionsStateModel = {
isSubmitting: false,
error: null,
},
- totalSubmissions: 0,
- sortBy: '',
- searchText: '',
- page: '1',
};
diff --git a/src/app/shared/stores/collections/collections.selectors.ts b/src/app/shared/stores/collections/collections.selectors.ts
index 22620d7ae..f41323d87 100644
--- a/src/app/shared/stores/collections/collections.selectors.ts
+++ b/src/app/shared/stores/collections/collections.selectors.ts
@@ -1,21 +1,9 @@
import { Selector } from '@ngxs/store';
-import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model';
-
import { CollectionsStateModel } from './collections.model';
import { CollectionsState } from './collections.state';
export class CollectionsSelectors {
- @Selector([CollectionsState])
- static getAllSelectedFilters(state: CollectionsStateModel): CollectionsFilters {
- return state.currentFilters;
- }
-
- @Selector([CollectionsState])
- static getAllFiltersOptions(state: CollectionsStateModel): CollectionsFilters {
- return state.filtersOptions;
- }
-
@Selector([CollectionsState])
static getCollectionProvider(state: CollectionsStateModel) {
return state.collectionProvider.data;
@@ -26,26 +14,11 @@ export class CollectionsSelectors {
return state.collectionProvider.data?.requiredMetadataTemplate ?? null;
}
- @Selector([CollectionsState])
- static getCollectionDetails(state: CollectionsStateModel) {
- return state.collectionDetails.data;
- }
-
@Selector([CollectionsState])
static getCollectionProviderLoading(state: CollectionsStateModel) {
return state.collectionProvider.isLoading;
}
- @Selector([CollectionsState])
- static getCollectionDetailsLoading(state: CollectionsStateModel) {
- return state.collectionDetails.isLoading;
- }
-
- @Selector([CollectionsState])
- static getCollectionSubmissionsSearchResult(state: CollectionsStateModel) {
- return state.collectionSubmissions.data;
- }
-
@Selector([CollectionsState])
static getCurrentProjectSubmissions(state: CollectionsStateModel) {
return state.currentProjectSubmissions.data;
@@ -56,38 +29,8 @@ export class CollectionsSelectors {
return state.currentProjectSubmissions.isLoading;
}
- @Selector([CollectionsState])
- static getCollectionSubmissionsLoading(state: CollectionsStateModel) {
- return state.collectionSubmissions.isLoading;
- }
-
@Selector([CollectionsState])
static getUserCollectionSubmissions(state: CollectionsStateModel) {
return state.userCollectionSubmissions.data;
}
-
- @Selector([CollectionsState])
- static getUserCollectionSubmissionsLoading(state: CollectionsStateModel) {
- return state.userCollectionSubmissions.isLoading;
- }
-
- @Selector([CollectionsState])
- static getSortBy(state: CollectionsStateModel) {
- return state.sortBy;
- }
-
- @Selector([CollectionsState])
- static getSearchText(state: CollectionsStateModel) {
- return state.searchText;
- }
-
- @Selector([CollectionsState])
- static getPageNumber(state: CollectionsStateModel) {
- return state.page;
- }
-
- @Selector([CollectionsState])
- static getTotalSubmissions(state: CollectionsStateModel) {
- return state.totalSubmissions;
- }
}
diff --git a/src/app/shared/stores/collections/collections.state.ts b/src/app/shared/stores/collections/collections.state.ts
index 55a55c089..a069291fa 100644
--- a/src/app/shared/stores/collections/collections.state.ts
+++ b/src/app/shared/stores/collections/collections.state.ts
@@ -12,27 +12,9 @@ import { CollectionsService } from '@osf/shared/services/collections.service';
import {
ClearCollections,
- ClearCollectionSubmissions,
- GetCollectionDetails,
GetCollectionProvider,
GetProjectSubmissions,
GetUserCollectionSubmissions,
- SearchCollectionSubmissions,
- SetAllFilters,
- SetCollectedTypeFilters,
- SetDataTypeFilters,
- SetDiseaseFilters,
- SetGradeLevelsFilters,
- SetIssueFilters,
- SetPageNumber,
- SetProgramAreaFilters,
- SetSchoolTypeFilters,
- SetSearchValue,
- SetSortBy,
- SetStatusFilters,
- SetStudyDesignFilters,
- SetTotalSubmissions,
- SetVolumeFilters,
} from './collections.actions';
import { COLLECTIONS_DEFAULTS, CollectionsStateModel } from './collections.model';
@@ -145,233 +127,11 @@ export class CollectionsState {
);
}
- @Action(GetCollectionDetails)
- getCollectionDetails(ctx: StateContext, action: GetCollectionDetails) {
- const state = ctx.getState();
-
- ctx.patchState({
- collectionDetails: {
- ...state.collectionDetails,
- isLoading: true,
- },
- });
-
- return this.collectionsService.getCollectionDetails(action.collectionId).pipe(
- tap((res) => {
- ctx.patchState({
- collectionDetails: {
- data: res,
- isLoading: false,
- isSubmitting: false,
- error: null,
- },
- });
-
- ctx.patchState({
- filtersOptions: {
- ...state.filtersOptions,
- ...res.filters,
- },
- });
- }),
- catchError((error) => handleSectionError(ctx, 'collectionDetails', error))
- );
- }
-
@Action(ClearCollections)
clearCollections(ctx: StateContext) {
ctx.patchState(COLLECTIONS_DEFAULTS);
}
- @Action(ClearCollectionSubmissions)
- clearCollectionSubmissions(ctx: StateContext) {
- ctx.patchState({
- collectionSubmissions: {
- data: [],
- isLoading: false,
- isSubmitting: false,
- error: null,
- },
- });
- }
-
- @Action(SetAllFilters)
- setAllFilters(ctx: StateContext, action: SetAllFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- ...action.filters,
- },
- page: '1',
- });
- }
-
- @Action(SetProgramAreaFilters)
- setProgramAreaFilters(ctx: StateContext, action: SetProgramAreaFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- programArea: action.programAreaFilters,
- },
- });
- }
-
- @Action(SetCollectedTypeFilters)
- setCollectedTypesFilters(ctx: StateContext, action: SetCollectedTypeFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- collectedType: action.collectedTypeFilters,
- },
- });
- }
-
- @Action(SetStatusFilters)
- setStatusFilters(ctx: StateContext, action: SetStatusFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- status: action.statusFilters,
- },
- });
- }
-
- @Action(SetDataTypeFilters)
- setDataTypeFilters(ctx: StateContext, action: SetDataTypeFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- dataType: action.dataTypeFilters,
- },
- });
- }
-
- @Action(SetDiseaseFilters)
- setDiseaseFilters(ctx: StateContext, action: SetDiseaseFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- disease: action.diseaseFilters,
- },
- });
- }
-
- @Action(SetGradeLevelsFilters)
- setGradeLevelsFilters(ctx: StateContext, action: SetGradeLevelsFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- gradeLevels: action.gradeLevelsFilters,
- },
- });
- }
-
- @Action(SetIssueFilters)
- setIssueFilters(ctx: StateContext, action: SetIssueFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- issue: action.issueFilters,
- },
- });
- }
-
- @Action(SetSchoolTypeFilters)
- setSchoolTypeFilters(ctx: StateContext, action: SetSchoolTypeFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- schoolType: action.schoolTypeFilters,
- },
- });
- }
-
- @Action(SetStudyDesignFilters)
- setStudyDesignFilters(ctx: StateContext, action: SetStudyDesignFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- studyDesign: action.studyDesignFilters,
- },
- });
- }
-
- @Action(SetVolumeFilters)
- setVolumeFilters(ctx: StateContext, action: SetVolumeFilters) {
- const state = ctx.getState();
- ctx.patchState({
- currentFilters: {
- ...state.currentFilters,
- volume: action.volumeFilters,
- },
- });
- }
-
- @Action(SetSortBy)
- setSortBy(ctx: StateContext, action: SetSortBy) {
- ctx.patchState({
- sortBy: action.sortValue,
- });
- }
-
- @Action(SetSearchValue)
- setSearchValue(ctx: StateContext, action: SetSearchValue) {
- ctx.patchState({
- searchText: action.searchValue,
- page: '1',
- });
- }
-
- @Action(SetPageNumber)
- setPageNumber(ctx: StateContext, action: SetPageNumber) {
- ctx.patchState({
- page: action.page,
- });
- }
-
- @Action(SetTotalSubmissions)
- setTotalSubmissions(ctx: StateContext, action: SetTotalSubmissions) {
- ctx.patchState({
- totalSubmissions: action.totalCount,
- });
- }
-
- @Action(SearchCollectionSubmissions)
- searchCollectionSubmissions(ctx: StateContext, action: SearchCollectionSubmissions) {
- const state = ctx.getState();
- ctx.patchState({
- collectionSubmissions: {
- ...state.collectionSubmissions,
- isLoading: true,
- },
- });
-
- return this.collectionsService
- .searchCollectionSubmissions(action.providerId, action.searchText, action.activeFilters, action.page, action.sort)
- .pipe(
- tap((res) => {
- ctx.patchState({
- collectionSubmissions: {
- data: res,
- isLoading: false,
- error: null,
- },
- });
- }),
- catchError((error) => handleSectionError(ctx, 'collectionSubmissions', error))
- );
- }
-
@Action(GetUserCollectionSubmissions)
getUserCollectionSubmissions(ctx: StateContext, action: GetUserCollectionSubmissions) {
const state = ctx.getState();
diff --git a/src/assets/config/template.json b/src/assets/config/template.json
index 18f954f75..826cb39c4 100644
--- a/src/assets/config/template.json
+++ b/src/assets/config/template.json
@@ -27,6 +27,5 @@
"newRelicLoaderConfigTrustKey": "",
"newRelicLoaderConfigAgentID": "",
"newRelicLoaderConfigLicenseKey": "",
- "newRelicLoaderConfigApplicationID": "",
- "collectionSubmissionWithCedar": false
+ "newRelicLoaderConfigApplicationID": ""
}
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 914de5f04..488113e19 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -285,6 +285,7 @@
},
"collections": {
"addToCollection": {
+ "cedarFormNotAvailable": "CEDAR metadata form is not available for this collection.",
"collectionMetadata": "Collection Metadata",
"confirmationDialogHeader": "Add to Collection",
"confirmationDialogMessage": "Once submitted to the collection, the project will be made public. It can later be made private again. A moderator will review your submission before it is included in the collection.",
@@ -303,7 +304,8 @@
"projectMetadataUpdateSuccess": "Project Metadata successfully updated.",
"resourceMetadata": "Project Metadata",
"selectProject": "Select a project",
- "tooltipMessage": "Complete previous step to edit this section"
+ "tooltipMessage": "Complete previous step to edit this section",
+ "updateError": "Failed to submit to the collection. Please try again."
},
"common": {
"by": "by",
@@ -312,68 +314,13 @@
},
"filters": {
"additionalFilters": "Additional Filters",
- "collectedType": {
- "description": "Please select the collected type from the dropdown below or start typing to find it",
- "label": "Type",
- "placeholder": "Select collected types"
- },
- "dataType": {
- "description": "Please select the data type from the dropdown below or start typing to find it",
- "label": "Data Type",
- "placeholder": "Select data types"
- },
- "disease": {
- "description": "Please select the disease from the dropdown below or start typing to find it",
- "label": "Disease",
- "placeholder": "Select diseases"
- },
- "gradeLevels": {
- "description": "Please select the grade level from the dropdown below or start typing to find it",
- "label": "Grade Levels",
- "placeholder": "Select grade levels"
- },
- "issue": {
- "description": "Please select the issue from the dropdown below or start typing to find it",
- "label": "Issue",
- "placeholder": "Select issues"
- },
"noFiltersAvailable": "No filters available",
"noOptionsAvailable": "No options available",
- "programArea": {
- "description": "Please select the program area from the dropdown below or start typing to find it",
- "label": "Program Area",
- "placeholder": "Select program areas"
- },
- "reviewsState": {
- "description": "Please select the reviews state from the dropdown below or start typing to find it",
- "label": "Reviews State",
- "placeholder": "Select reviews states"
- },
- "schoolType": {
- "description": "Please select the school type from the dropdown below or start typing to find it",
- "label": "School Type",
- "placeholder": "Select school types"
- },
"searchCreators": "Search for creators",
"sort": {
"label": "Sort by:"
},
- "sortBy": "Sort by",
- "status": {
- "description": "Please select the status from the dropdown below or start typing to find it",
- "label": "Status",
- "placeholder": "Select status"
- },
- "studyDesign": {
- "description": "Please select the study design from the dropdown below or start typing to find it",
- "label": "Study Design",
- "placeholder": "Select study designs"
- },
- "volume": {
- "description": "Please select the volume from the dropdown below or start typing to find it",
- "label": "Volume",
- "placeholder": "Select volumes"
- }
+ "sortBy": "Sort by"
},
"helpDialog": {
"header": "Search help",
diff --git a/src/testing/data/collections/cedar-metadata.mock.ts b/src/testing/data/collections/cedar-metadata.mock.ts
index 2e8a5fc43..9439b6aac 100644
--- a/src/testing/data/collections/cedar-metadata.mock.ts
+++ b/src/testing/data/collections/cedar-metadata.mock.ts
@@ -54,15 +54,5 @@ export const MOCK_CEDAR_SUBMISSION: CollectionSubmission = {
collectionTitle: 'Test Collection',
collectionId: 'collection-123',
reviewsState: CollectionSubmissionReviewState.Pending,
- collectedType: 'preprint',
- status: 'pending',
- volume: '1',
- issue: '1',
- programArea: 'Science',
- schoolType: 'University',
- studyDesign: 'Experimental',
- dataType: 'Quantitative',
- disease: 'Cancer',
- gradeLevels: 'Graduate',
requiredMetadataTemplateId: 'template-1',
};
diff --git a/src/testing/data/collections/collection-submissions.mock.ts b/src/testing/data/collections/collection-submissions.mock.ts
index 6dbba45b9..b36456937 100644
--- a/src/testing/data/collections/collection-submissions.mock.ts
+++ b/src/testing/data/collections/collection-submissions.mock.ts
@@ -8,16 +8,6 @@ export const MOCK_PROJECT_COLLECTION_SUBMISSIONS: CollectionSubmission[] = [
collectionTitle: 'Collection A',
collectionId: 'col1',
reviewsState: CollectionSubmissionReviewState.Accepted,
- collectedType: 'typeA',
- status: 'accepted',
- volume: 'vol1',
- issue: 'iss1',
- programArea: 'prog1',
- schoolType: 'school1',
- studyDesign: 'design1',
- dataType: 'data1',
- disease: 'disease1',
- gradeLevels: 'grade1',
},
{
id: '2',
@@ -25,15 +15,5 @@ export const MOCK_PROJECT_COLLECTION_SUBMISSIONS: CollectionSubmission[] = [
collectionTitle: 'Collection B',
collectionId: 'col2',
reviewsState: CollectionSubmissionReviewState.Pending,
- collectedType: 'typeB',
- status: 'pending',
- volume: 'vol2',
- issue: 'iss2',
- programArea: 'prog2',
- schoolType: 'school2',
- studyDesign: 'design2',
- dataType: 'data2',
- disease: 'disease2',
- gradeLevels: 'grade2',
},
];
diff --git a/src/testing/mocks/collections-filters.mock.ts b/src/testing/mocks/collections-filters.mock.ts
deleted file mode 100644
index 63f4d1e8c..000000000
--- a/src/testing/mocks/collections-filters.mock.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-export const MOCK_COLLECTIONS_FILTERS_OPTIONS = {
- programArea: ['Science', 'Technology', 'Engineering'],
- collectedType: ['preprint', 'project'],
- status: ['pending', 'approved', 'rejected'],
- dataType: ['Quantitative', 'Qualitative'],
- disease: ['Cancer', 'Diabetes'],
- gradeLevels: ['Graduate', 'Undergraduate'],
- issue: ['1', '2', '3'],
- schoolType: ['University', 'College'],
- studyDesign: ['Experimental', 'Observational'],
- volume: ['1', '2', '3'],
-};
-
-export const MOCK_COLLECTIONS_SELECTED_FILTERS = {
- programArea: ['Science'],
- collectedType: ['preprint'],
- status: ['pending'],
- dataType: ['Quantitative'],
- disease: ['Cancer'],
- gradeLevels: ['Graduate'],
- issue: ['1'],
- schoolType: ['University'],
- studyDesign: ['Experimental'],
- volume: ['1'],
-};
-
-export const MOCK_COLLECTIONS_ACTIVE_FILTERS = {
- programArea: ['Science', 'Technology'],
- collectedType: ['preprint'],
- status: ['pending'],
- dataType: ['Quantitative'],
- disease: ['Cancer'],
- gradeLevels: ['Graduate'],
- issue: ['1'],
- schoolType: ['University'],
- studyDesign: ['Experimental'],
- volume: ['1'],
-};
-
-export const MOCK_COLLECTIONS_EMPTY_FILTERS = {
- programArea: [],
- collectedType: [],
- status: [],
- dataType: [],
- disease: [],
- gradeLevels: [],
- issue: [],
- schoolType: [],
- studyDesign: [],
- volume: [],
-};
diff --git a/src/testing/mocks/collections-submissions.mock.ts b/src/testing/mocks/collections-submissions.mock.ts
index fcf93c12e..720f33ce6 100644
--- a/src/testing/mocks/collections-submissions.mock.ts
+++ b/src/testing/mocks/collections-submissions.mock.ts
@@ -13,16 +13,6 @@ export const MOCK_COLLECTION_SUBMISSION_1: CollectionSubmissionWithGuid = {
dateModified: '2024-01-02T00:00:00Z',
public: false,
reviewsState: CollectionSubmissionReviewState.Pending,
- collectedType: 'preprint',
- status: 'pending',
- volume: '1',
- issue: '1',
- programArea: 'Science',
- schoolType: 'University',
- studyDesign: 'Experimental',
- dataType: 'Quantitative',
- disease: 'Cancer',
- gradeLevels: 'Graduate',
creator: {
id: 'user-123',
fullName: 'John Doe',
@@ -56,16 +46,6 @@ export const MOCK_COLLECTION_SUBMISSION_2: CollectionSubmissionWithGuid = {
dateModified: '2024-01-03T00:00:00Z',
public: true,
reviewsState: CollectionSubmissionReviewState.Accepted,
- collectedType: 'preprint',
- status: 'approved',
- volume: '2',
- issue: '2',
- programArea: 'Technology',
- schoolType: 'College',
- studyDesign: 'Observational',
- dataType: 'Qualitative',
- disease: 'Diabetes',
- gradeLevels: 'Undergraduate',
creator: {
id: 'user-456',
fullName: 'Jane Smith',
@@ -89,39 +69,15 @@ export const MOCK_COLLECTION_SUBMISSION_2: CollectionSubmissionWithGuid = {
export const MOCK_COLLECTION_SUBMISSIONS = [MOCK_COLLECTION_SUBMISSION_1, MOCK_COLLECTION_SUBMISSION_2];
-export const MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS: CollectionSubmission = {
+export const MOCK_COLLECTION_SUBMISSION_BASE: CollectionSubmission = {
id: 'sub-1',
type: 'collection-submissions',
collectionTitle: 'Collection',
collectionId: 'col-1',
reviewsState: CollectionSubmissionReviewState.Pending,
- collectedType: '',
- status: '',
- volume: '',
- issue: '',
- programArea: '',
- schoolType: '',
- studyDesign: '',
- dataType: '',
- disease: '',
- gradeLevels: '',
};
-export const MOCK_COLLECTION_SUBMISSION_WITH_FILTERS: CollectionSubmission = {
- ...MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS,
+export const MOCK_COLLECTION_SUBMISSION_ACCEPTED: CollectionSubmission = {
+ ...MOCK_COLLECTION_SUBMISSION_BASE,
reviewsState: CollectionSubmissionReviewState.Accepted,
- collectedType: 'Article',
- status: 'Published',
- programArea: 'Health',
-};
-
-export const MOCK_COLLECTION_SUBMISSION_SINGLE_FILTER: CollectionSubmission = {
- ...MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS,
- collectedType: 'Article',
-};
-
-export const MOCK_COLLECTION_SUBMISSION_STRINGIFY: CollectionSubmission = {
- ...MOCK_COLLECTION_SUBMISSION_EMPTY_FILTERS,
- collectedType: 'Article',
- status: '1',
};
diff --git a/src/testing/mocks/submission.mock.ts b/src/testing/mocks/submission.mock.ts
index 2d7d8eedb..32be4fc3e 100644
--- a/src/testing/mocks/submission.mock.ts
+++ b/src/testing/mocks/submission.mock.ts
@@ -39,16 +39,6 @@ export const MOCK_COLLECTION_SUBMISSION_WITH_GUID: CollectionSubmissionWithGuid
dateModified: '2024-01-02T00:00:00Z',
public: false,
reviewsState: CollectionSubmissionReviewState.Pending,
- collectedType: 'preprint',
- status: 'pending',
- volume: '1',
- issue: '1',
- programArea: 'Science',
- schoolType: 'University',
- studyDesign: 'Experimental',
- dataType: 'Quantitative',
- disease: 'None',
- gradeLevels: 'Graduate',
creator: {
id: 'user-123',
fullName: 'John Doe',
diff --git a/src/testing/providers/environment.token.mock.ts b/src/testing/providers/environment.token.mock.ts
index 7bc33d525..02105aed2 100644
--- a/src/testing/providers/environment.token.mock.ts
+++ b/src/testing/providers/environment.token.mock.ts
@@ -47,6 +47,5 @@ export const EnvironmentTokenMock = {
newRelicLoaderConfigAgentID: '',
newRelicLoaderConfigLicenseKey: '',
newRelicLoaderConfigApplicationID: '',
- collectionSubmissionWithCedar: false,
},
};