diff --git a/src/app/features/project/registrations/registrations.component.ts b/src/app/features/project/registrations/registrations.component.ts
index 208142a8d..3cb69a5da 100644
--- a/src/app/features/project/registrations/registrations.component.ts
+++ b/src/app/features/project/registrations/registrations.component.ts
@@ -9,7 +9,7 @@ import { map, of } from 'rxjs';
import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { FormsModule } from '@angular/forms';
-import { ActivatedRoute } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
import { LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components';
import { RegistrationCardComponent } from '@osf/shared/components/registration-card/registration-card.component';
@@ -26,20 +26,20 @@ import { GetRegistrations, RegistrationsSelectors } from './store';
})
export class RegistrationsComponent implements OnInit {
private readonly route = inject(ActivatedRoute);
-
+ private readonly router = inject(Router);
readonly projectId = toSignal(this.route.parent?.params.pipe(map((params) => params['id'])) ?? of(undefined));
-
protected registrations = select(RegistrationsSelectors.getRegistrations);
protected isRegistrationsLoading = select(RegistrationsSelectors.isRegistrationsLoading);
-
protected actions = createDispatchMap({ getRegistrations: GetRegistrations });
+ private readonly OSF_PROVIDER_ID = 'osf';
ngOnInit(): void {
this.actions.getRegistrations(this.projectId());
}
addRegistration(): void {
- //TODO: Implement the logic to add a new registration.
- console.log('Add Registration clicked');
+ this.router.navigate([`registries/${this.OSF_PROVIDER_ID}/new`], {
+ queryParams: { projectId: this.projectId() },
+ });
}
}
diff --git a/src/app/features/registries/components/new-registration/new-registration.component.html b/src/app/features/registries/components/new-registration/new-registration.component.html
index 4fd357a08..b33354feb 100644
--- a/src/app/features/registries/components/new-registration/new-registration.component.html
+++ b/src/app/features/registries/components/new-registration/new-registration.component.html
@@ -41,6 +41,7 @@
{{ ('registries.new.steps.title' | translate) + '2' }}
[placeholder]="'registries.new.selectProject' | translate"
optionLabel="title"
optionValue="id"
+ [loading]="isProjectsLoading()"
(onChange)="onSelectProject($event.value)"
class="w-6"
/>
diff --git a/src/app/features/registries/components/new-registration/new-registration.component.ts b/src/app/features/registries/components/new-registration/new-registration.component.ts
index 49599a698..85c031005 100644
--- a/src/app/features/registries/components/new-registration/new-registration.component.ts
+++ b/src/app/features/registries/components/new-registration/new-registration.component.ts
@@ -32,6 +32,7 @@ export class NewRegistrationComponent {
protected readonly isDraftSubmitting = select(RegistriesSelectors.isDraftSubmitting);
protected readonly draftRegistration = select(RegistriesSelectors.getDraftRegistration);
protected readonly isProvidersLoading = select(RegistriesSelectors.isProvidersLoading);
+ protected readonly isProjectsLoading = select(RegistriesSelectors.isProjectsLoading);
protected actions = createDispatchMap({
getProjects: GetProjects,
getProviderSchemas: GetProviderSchemas,
@@ -39,12 +40,13 @@ export class NewRegistrationComponent {
});
protected readonly providerId = this.route.snapshot.params['providerId'];
+ protected readonly projectId = this.route.snapshot.queryParams['projectId'];
- fromProject = false;
+ fromProject = this.projectId !== undefined;
draftForm = this.fb.group({
providerSchema: ['', Validators.required],
- project: [''],
+ project: [this.projectId || ''],
});
constructor() {
diff --git a/src/app/features/registries/components/review/review.component.html b/src/app/features/registries/components/review/review.component.html
index f54c10636..e2bda9dca 100644
--- a/src/app/features/registries/components/review/review.component.html
+++ b/src/app/features/registries/components/review/review.component.html
@@ -37,10 +37,21 @@ {{ 'navigation.registration.contributors' | translate }}
}
-
+
+
{{ 'shared.license.title' | translate }}
-
{{ draftRegistration()?.license?.id }}
- @if (!draftRegistration()?.license) {
+ @if (draftRegistration()?.license && license()) {
+
+
+
+ {{ license()?.name }}
+
+
+ {{ license()!.text | interpolate: licenseOptionsRecord() }}
+
+
+
+ } @else {
{{ 'common.labels.noData' | translate }}
{{ INPUT_VALIDATION_MESSAGES.required | translate }}
diff --git a/src/app/features/registries/components/review/review.component.ts b/src/app/features/registries/components/review/review.component.ts
index 4c542628f..0b24465d8 100644
--- a/src/app/features/registries/components/review/review.component.ts
+++ b/src/app/features/registries/components/review/review.component.ts
@@ -2,6 +2,7 @@ import { createDispatchMap, select } from '@ngxs/store';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
+import { Accordion, AccordionContent, AccordionHeader, AccordionPanel } from 'primeng/accordion';
import { Button } from 'primeng/button';
import { Card } from 'primeng/card';
import { DialogService } from 'primeng/dynamicdialog';
@@ -16,6 +17,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
import { ResourceType } from '@osf/shared/enums';
+import { InterpolatePipe } from '@osf/shared/pipes';
import { CustomConfirmationService, ToastService } from '@osf/shared/services';
import {
ContributorsSelectors,
@@ -25,13 +27,25 @@ import {
} from '@osf/shared/stores';
import { FieldType } from '../../enums';
-import { DeleteDraft, FetchProjectChildren, RegistriesSelectors } from '../../store';
+import { DeleteDraft, FetchLicenses, FetchProjectChildren, RegistriesSelectors } from '../../store';
import { ConfirmRegistrationDialogComponent } from '../confirm-registration-dialog/confirm-registration-dialog.component';
import { SelectComponentsDialogComponent } from '../select-components-dialog/select-components-dialog.component';
@Component({
selector: 'osf-review',
- imports: [TranslatePipe, Card, Message, RouterLink, Tag, Button],
+ imports: [
+ TranslatePipe,
+ Card,
+ Message,
+ RouterLink,
+ Tag,
+ Button,
+ Accordion,
+ AccordionContent,
+ AccordionHeader,
+ AccordionPanel,
+ InterpolatePipe,
+ ],
templateUrl: './review.component.html',
styleUrl: './review.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -54,6 +68,9 @@ export class ReviewComponent {
protected readonly contributors = select(ContributorsSelectors.getContributors);
protected readonly subjects = select(SubjectsSelectors.getSelectedSubjects);
protected readonly components = select(RegistriesSelectors.getRegistrationComponents);
+ protected readonly license = select(RegistriesSelectors.getRegistrationLicense);
+ private readonly OSF_PROVIDER_ID = 'osf';
+
protected readonly FieldType = FieldType;
protected actions = createDispatchMap({
@@ -61,6 +78,7 @@ export class ReviewComponent {
getSubjects: FetchSelectedSubjects,
deleteDraft: DeleteDraft,
getProjectsComponents: FetchProjectChildren,
+ fetchLicenses: FetchLicenses,
});
private readonly draftId = toSignal(this.route.params.pipe(map((params) => params['id'])) ?? of(undefined));
@@ -71,6 +89,10 @@ export class ReviewComponent {
return Object.values(this.stepsValidation()).some((step) => step.invalid);
});
+ licenseOptionsRecord = computed(() => {
+ return (this.draftRegistration()?.license.options ?? {}) as Record;
+ });
+
constructor() {
if (!this.contributors()?.length) {
this.actions.getContributors(this.draftId(), ResourceType.DraftRegistration);
@@ -79,6 +101,12 @@ export class ReviewComponent {
this.actions.getSubjects(this.draftId(), ResourceType.DraftRegistration);
}
+ effect(() => {
+ if (this.draftRegistration()) {
+ this.actions.fetchLicenses(this.draftRegistration()?.providerId ?? this.OSF_PROVIDER_ID);
+ }
+ });
+
let componentsLoaded = false;
effect(() => {
if (!this.isDraftSubmitting()) {
diff --git a/src/app/features/registries/store/registries.selectors.ts b/src/app/features/registries/store/registries.selectors.ts
index 8a4acbffe..52bf4eacf 100644
--- a/src/app/features/registries/store/registries.selectors.ts
+++ b/src/app/features/registries/store/registries.selectors.ts
@@ -23,6 +23,11 @@ export class RegistriesSelectors {
return state.projects.data;
}
+ @Selector([RegistriesState])
+ static isProjectsLoading(state: RegistriesStateModel): boolean {
+ return state.projects.isLoading;
+ }
+
@Selector([RegistriesState])
static isDraftSubmitting(state: RegistriesStateModel): boolean {
return state.draftRegistration.isSubmitting ?? false;
@@ -63,6 +68,11 @@ export class RegistriesSelectors {
return state.draftRegistration.data?.license || null;
}
+ @Selector([RegistriesState])
+ static getRegistrationLicense(state: RegistriesStateModel): License | null {
+ return state.licenses.data.find((l) => l.id === state.draftRegistration.data?.license.id) || null;
+ }
+
@Selector([RegistriesState])
static getPagesSchema(state: RegistriesStateModel): PageSchema[] {
return state.pagesSchema.data;