@@ -20,10 +20,8 @@ import {
2020 signal ,
2121} from '@angular/core' ;
2222import { takeUntilDestroyed , toSignal } from '@angular/core/rxjs-interop' ;
23- import { FormGroup } from '@angular/forms' ;
2423import { ActivatedRoute , Router , RouterLink } from '@angular/router' ;
2524
26- import { ENVIRONMENT } from '@core/provider/environment.provider' ;
2725import { UserSelectors } from '@core/store/user' ;
2826import { CedarMetadataRecordData , CedarRecordDataBinding } from '@osf/features/metadata/models' ;
2927import {
@@ -43,7 +41,6 @@ import { LoaderService } from '@osf/shared/services/loader.service';
4341import { ToastService } from '@osf/shared/services/toast.service' ;
4442import { CollectionsSelectors , GetCollectionProvider } from '@osf/shared/stores/collections' ;
4543import { ProjectsSelectors , SetSelectedProject } from '@osf/shared/stores/projects' ;
46- import { COLLECTION_SUBMISSION_WITH_CEDAR } from '@shared/constants/feature-flags.const' ;
4744
4845import { AddToCollectionSteps } from '../../enums' ;
4946import { RemoveCollectionSubmissionPayload } from '../../models/remove-collection-submission-payload.model' ;
@@ -53,7 +50,6 @@ import {
5350 ClearAddToCollectionState ,
5451 GetCurrentCollectionSubmission ,
5552 RemoveCollectionSubmission ,
56- UpdateCollectionSubmission ,
5753} from '../../store/add-to-collection' ;
5854
5955import { AddToCollectionConfirmationDialogComponent } from './add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component' ;
@@ -91,22 +87,18 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
9187 private readonly headerStyleHelper = inject ( HeaderStyleService ) ;
9288 private readonly platformId = inject ( PLATFORM_ID ) ;
9389 private readonly isBrowser = isPlatformBrowser ( this . platformId ) ;
94- private readonly environment = inject ( ENVIRONMENT ) ;
9590
9691 readonly selectedProjectId = toSignal < string | null > (
9792 this . route . params . pipe ( map ( ( params ) => params [ 'id' ] ) ) ?? of ( null )
9893 ) ;
9994
10095 readonly AddToCollectionSteps = AddToCollectionSteps ;
10196
102- collectionMetadataForm = new FormGroup ( { } ) ;
103-
10497 isProviderLoading = select ( CollectionsSelectors . getCollectionProviderLoading ) ;
10598 collectionProvider = select ( CollectionsSelectors . getCollectionProvider ) ;
10699 requiredMetadataTemplate = select ( CollectionsSelectors . getRequiredMetadataTemplate ) ;
107100 selectedProject = select ( ProjectsSelectors . getSelectedProject ) ;
108101 currentUser = select ( UserSelectors . getCurrentUser ) ;
109- activeFlags = select ( UserSelectors . getActiveFlags ) ;
110102 currentCollectionSubmission = select ( AddToCollectionSelectors . getCurrentCollectionSubmission ) ;
111103 cedarRecords = select ( MetadataSelectors . getCedarRecords ) ;
112104
@@ -125,9 +117,6 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
125117 isCollectionMetadataDisabled = computed (
126118 ( ) => ! this . selectedProject ( ) || ! this . projectMetadataSaved ( ) || ! this . projectContributorsSaved ( )
127119 ) ;
128- isCedarMode = computed (
129- ( ) => this . activeFlags ( ) . includes ( COLLECTION_SUBMISSION_WITH_CEDAR ) && ! ! this . requiredMetadataTemplate ( )
130- ) ;
131120 existingCedarRecord = computed < CedarMetadataRecordData | null > ( ( ) => {
132121 const records = this . cedarRecords ( ) ;
133122 const templateId = this . requiredMetadataTemplate ( ) ?. id ;
@@ -138,7 +127,6 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
138127 readonly actions = createDispatchMap ( {
139128 getCollectionProvider : GetCollectionProvider ,
140129 clearAddToCollectionState : ClearAddToCollectionState ,
141- updateCollectionSubmission : UpdateCollectionSubmission ,
142130 deleteCollectionSubmission : RemoveCollectionSubmission ,
143131 setSelectedProject : SetSelectedProject ,
144132 getCurrentCollectionSubmission : GetCurrentCollectionSubmission ,
@@ -195,12 +183,6 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
195183 this . projectContributorsSaved . set ( true ) ;
196184 }
197185
198- handleCollectionMetadataSaved ( form : FormGroup ) : void {
199- this . collectionMetadataForm = form ;
200- this . collectionMetadataSaved . set ( true ) ;
201- this . stepperActiveValue . set ( AddToCollectionSteps . Complete ) ;
202- }
203-
204186 handleCedarDataSaved ( data : CedarRecordDataBinding ) : void {
205187 this . pendingCedarData . set ( data ) ;
206188 this . collectionMetadataSaved . set ( true ) ;
@@ -212,17 +194,13 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
212194 collectionId : this . primaryCollectionId ( ) || '' ,
213195 projectId : this . selectedProject ( ) ?. id || '' ,
214196 userId : this . currentUser ( ) ?. id || '' ,
215- collectionMetadata : this . isCedarMode ( ) ? { } : this . collectionMetadataForm . value || { } ,
216197 } ;
217198
218- const isEditMode = this . isEditMode ( ) ;
219-
220- if ( isEditMode ) {
199+ if ( this . isEditMode ( ) ) {
221200 this . loaderService . show ( ) ;
222201
223202 this . saveCedarRecordIfNeeded ( )
224203 . pipe (
225- switchMap ( ( ) => this . actions . updateCollectionSubmission ( payload ) ) ,
226204 finalize ( ( ) => this . loaderService . hide ( ) ) ,
227205 takeUntilDestroyed ( this . destroyRef )
228206 )
@@ -298,8 +276,6 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
298276 }
299277
300278 private saveCedarRecordIfNeeded ( ) : Observable < unknown > {
301- if ( ! this . isCedarMode ( ) ) return of ( null ) ;
302-
303279 const cedarData = this . pendingCedarData ( ) ;
304280 const projectId = this . selectedProject ( ) ?. id ;
305281 const templateId = this . requiredMetadataTemplate ( ) ?. id ;
@@ -352,8 +328,7 @@ export class AddToCollectionComponent implements CanDeactivateComponent {
352328
353329 effect ( ( ) => {
354330 const projectId = this . selectedProjectId ( ) ;
355- const isCedar = this . isCedarMode ( ) ;
356- if ( isCedar && projectId ) {
331+ if ( projectId ) {
357332 this . actions . getCedarRecords ( projectId , ResourceType . Project ) ;
358333 }
359334 } ) ;
0 commit comments