From d8b26b2c76005f695bb97ff385f7ffd92b20c113 Mon Sep 17 00:00:00 2001 From: nsemets Date: Thu, 4 Sep 2025 17:45:34 +0300 Subject: [PATCH 1/4] fix(settings): updated settings routes --- src/app/core/constants/nav-items.constant.ts | 8 ++++---- src/app/features/settings/settings.routes.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/core/constants/nav-items.constant.ts b/src/app/core/constants/nav-items.constant.ts index 314cd1b31..efcc4338b 100644 --- a/src/app/core/constants/nav-items.constant.ts +++ b/src/app/core/constants/nav-items.constant.ts @@ -353,15 +353,15 @@ export const MENU_ITEMS: MenuItem[] = [ visible: false, items: [ { - id: 'settings-profile-settings', - routerLink: '/settings/profile-settings', + id: 'settings-profile', + routerLink: '/settings/profile', label: 'navigation.profileSettings', visible: true, routerLinkActiveOptions: { exact: true }, }, { - id: 'settings-account-settings', - routerLink: '/settings/account-settings', + id: 'settings-account', + routerLink: '/settings/account', label: 'navigation.accountSettings', visible: true, routerLinkActiveOptions: { exact: true }, diff --git a/src/app/features/settings/settings.routes.ts b/src/app/features/settings/settings.routes.ts index dc349dbd1..10decd081 100644 --- a/src/app/features/settings/settings.routes.ts +++ b/src/app/features/settings/settings.routes.ts @@ -17,15 +17,15 @@ export const settingsRoutes: Routes = [ { path: '', pathMatch: 'full', - redirectTo: 'profile-settings', + redirectTo: 'profile', }, { - path: 'profile-settings', + path: 'profile', loadComponent: () => import('./profile-settings/profile-settings.component').then((c) => c.ProfileSettingsComponent), }, { - path: 'account-settings', + path: 'account', loadComponent: () => import('./account-settings/account-settings.component').then((c) => c.AccountSettingsComponent), }, From 1235e64db76d16eea66367a0cb4f75143dbd112e Mon Sep 17 00:00:00 2001 From: nsemets Date: Thu, 4 Sep 2025 17:55:48 +0300 Subject: [PATCH 2/4] fix(registry-links): updated registry links --- .../registration-links-card.component.html | 2 +- .../registration-links-card.component.ts | 22 ++++++++++---- .../registry-links.component.ts | 30 +++++++++---------- .../registry-links/registry-links.model.ts | 7 +++++ .../registry-links/registry-links.state.ts | 11 ++----- 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/app/features/registry/components/registration-links-card/registration-links-card.component.html b/src/app/features/registry/components/registration-links-card/registration-links-card.component.html index e15247772..d0e49c9fe 100644 --- a/src/app/features/registry/components/registration-links-card/registration-links-card.component.html +++ b/src/app/features/registry/components/registration-links-card/registration-links-card.component.html @@ -38,7 +38,7 @@

{{ 'project.overview.metadata.contributors' | translate }}: @for (contributor of registrationData().contributors; track contributor.id) { - {{ contributor.fullName }} + {{ contributor.fullName }} @if (!$last) { , } diff --git a/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts b/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts index 02831f81a..5c597ef20 100644 --- a/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts +++ b/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts @@ -5,6 +5,7 @@ import { Card } from 'primeng/card'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; +import { RouterLink } from '@angular/router'; import { DataResourcesComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components'; import { RevisionReviewStates } from '@osf/shared/enums'; @@ -13,7 +14,16 @@ import { LinkedNode, LinkedRegistration, RegistryComponentModel } from '../../mo @Component({ selector: 'osf-registration-links-card', - imports: [Card, Button, TranslatePipe, DatePipe, DataResourcesComponent, TruncatedTextComponent, IconComponent], + imports: [ + Card, + Button, + TranslatePipe, + DatePipe, + DataResourcesComponent, + TruncatedTextComponent, + IconComponent, + RouterLink, + ], templateUrl: './registration-links-card.component.html', styleUrl: './registration-links-card.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, @@ -24,24 +34,24 @@ export class RegistrationLinksCardComponent { readonly updateEmitRegistrationData = output(); readonly reviewEmitRegistrationData = output(); - protected readonly RevisionReviewStates = RevisionReviewStates; + readonly RevisionReviewStates = RevisionReviewStates; - protected readonly isRegistrationData = computed(() => { + readonly isRegistrationData = computed(() => { const data = this.registrationData(); return 'reviewsState' in data; }); - protected readonly isComponentData = computed(() => { + readonly isComponentData = computed(() => { const data = this.registrationData(); return 'registrationSupplement' in data; }); - protected readonly registrationDataTyped = computed(() => { + readonly registrationDataTyped = computed(() => { const data = this.registrationData(); return this.isRegistrationData() ? (data as LinkedRegistration) : null; }); - protected readonly componentsDataTyped = computed(() => { + readonly componentsDataTyped = computed(() => { const data = this.registrationData(); return this.isComponentData() ? (data as RegistryComponentModel) : null; }); diff --git a/src/app/features/registry/pages/registry-links/registry-links.component.ts b/src/app/features/registry/pages/registry-links/registry-links.component.ts index e0e725b14..65b777ec0 100644 --- a/src/app/features/registry/pages/registry-links/registry-links.component.ts +++ b/src/app/features/registry/pages/registry-links/registry-links.component.ts @@ -8,11 +8,11 @@ import { ChangeDetectionStrategy, Component, effect, inject, OnInit, signal } fr import { ActivatedRoute, Router } from '@angular/router'; import { FetchAllSchemaResponses, RegistriesSelectors } from '@osf/features/registries/store'; -import { RegistrationLinksCardComponent } from '@osf/features/registry/components'; -import { LinkedNode, LinkedRegistration } from '@osf/features/registry/models'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; -import { LoaderService } from '@shared/services'; +import { LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components'; +import { LoaderService } from '@osf/shared/services'; +import { RegistrationLinksCardComponent } from '../../components'; +import { LinkedNode, LinkedRegistration } from '../../models'; import { GetBibliographicContributors, GetBibliographicContributorsForRegistration, @@ -35,7 +35,7 @@ export class RegistryLinksComponent implements OnInit { private registryId = signal(''); - protected actions = createDispatchMap({ + actions = createDispatchMap({ getLinkedNodes: GetLinkedNodes, getLinkedRegistrations: GetLinkedRegistrations, getBibliographicContributors: GetBibliographicContributors, @@ -46,23 +46,21 @@ export class RegistryLinksComponent implements OnInit { nodes = signal([]); registrations = signal([]); - protected linkedNodes = select(RegistryLinksSelectors.getLinkedNodes); - protected linkedNodesLoading = select(RegistryLinksSelectors.getLinkedNodesLoading); + linkedNodes = select(RegistryLinksSelectors.getLinkedNodes); + linkedNodesLoading = select(RegistryLinksSelectors.getLinkedNodesLoading); - protected linkedRegistrations = select(RegistryLinksSelectors.getLinkedRegistrations); - protected linkedRegistrationsLoading = select(RegistryLinksSelectors.getLinkedRegistrationsLoading); + linkedRegistrations = select(RegistryLinksSelectors.getLinkedRegistrations); + linkedRegistrationsLoading = select(RegistryLinksSelectors.getLinkedRegistrationsLoading); - protected bibliographicContributors = select(RegistryLinksSelectors.getBibliographicContributors); - protected bibliographicContributorsNodeId = select(RegistryLinksSelectors.getBibliographicContributorsNodeId); + bibliographicContributors = select(RegistryLinksSelectors.getBibliographicContributors); + bibliographicContributorsNodeId = select(RegistryLinksSelectors.getBibliographicContributorsNodeId); - protected bibliographicContributorsForRegistration = select( - RegistryLinksSelectors.getBibliographicContributorsForRegistration - ); - protected bibliographicContributorsForRegistrationId = select( + bibliographicContributorsForRegistration = select(RegistryLinksSelectors.getBibliographicContributorsForRegistration); + bibliographicContributorsForRegistrationId = select( RegistryLinksSelectors.getBibliographicContributorsForRegistrationId ); - protected schemaResponse = select(RegistriesSelectors.getSchemaResponse); + schemaResponse = select(RegistriesSelectors.getSchemaResponse); constructor() { effect(() => { diff --git a/src/app/features/registry/store/registry-links/registry-links.model.ts b/src/app/features/registry/store/registry-links/registry-links.model.ts index f9056747f..1ce7f12e7 100644 --- a/src/app/features/registry/store/registry-links/registry-links.model.ts +++ b/src/app/features/registry/store/registry-links/registry-links.model.ts @@ -16,3 +16,10 @@ export interface RegistryLinksStateModel { registrationId?: string; }; } + +export const REGISTRY_LINKS_STATE_DEFAULTS: RegistryLinksStateModel = { + linkedNodes: { data: [], isLoading: false, error: null }, + linkedRegistrations: { data: [], isLoading: false, error: null }, + bibliographicContributors: { data: [], isLoading: false, error: null }, + bibliographicContributorsForRegistration: { data: [], isLoading: false, error: null }, +}; diff --git a/src/app/features/registry/store/registry-links/registry-links.state.ts b/src/app/features/registry/store/registry-links/registry-links.state.ts index 9713ea7eb..5cf9945a9 100644 --- a/src/app/features/registry/store/registry-links/registry-links.state.ts +++ b/src/app/features/registry/store/registry-links/registry-links.state.ts @@ -14,18 +14,11 @@ import { GetLinkedNodes, GetLinkedRegistrations, } from './registry-links.actions'; -import { RegistryLinksStateModel } from './registry-links.model'; - -const initialState: RegistryLinksStateModel = { - linkedNodes: { data: [], isLoading: false, error: null }, - linkedRegistrations: { data: [], isLoading: false, error: null }, - bibliographicContributors: { data: [], isLoading: false, error: null }, - bibliographicContributorsForRegistration: { data: [], isLoading: false, error: null }, -}; +import { REGISTRY_LINKS_STATE_DEFAULTS, RegistryLinksStateModel } from './registry-links.model'; @State({ name: 'registryLinks', - defaults: initialState, + defaults: REGISTRY_LINKS_STATE_DEFAULTS, }) @Injectable() export class RegistryLinksState { From 6a038f795b14c92e5aefda615b3374a54ed33ec9 Mon Sep 17 00:00:00 2001 From: nsemets Date: Thu, 4 Sep 2025 19:06:18 +0300 Subject: [PATCH 3/4] fix(registration): updated components, resource and links --- src/app/app.component.ts | 2 +- .../add-resource-dialog.component.html | 6 ++- .../add-resource-dialog.component.ts | 24 +++++------- .../edit-resource-dialog.component.ts | 6 +-- .../registry-make-decision.component.ts | 26 ++++++------- .../registry-revisions.component.ts | 4 +- .../registry-statuses.component.scss | 3 +- .../registry-statuses.component.ts | 22 +++++------ .../resource-form.component.html | 11 +++++- .../resource-form/resource-form.component.ts | 6 +-- .../short-registration-info.component.ts | 3 +- .../withdraw-dialog.component.ts | 14 +++---- .../registry-components.component.ts | 11 +++--- .../registry-resources.component.html | 2 +- .../registry-resources.component.ts | 37 ++++++++----------- .../registry-components.model.ts | 4 ++ .../registry-components.state.ts | 8 +--- src/app/shared/mappers/user/user.mapper.ts | 2 +- src/assets/i18n/en.json | 4 +- 19 files changed, 95 insertions(+), 100 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ccf75a496..afba7d027 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -15,7 +15,7 @@ import { GetEmails, UserEmailsSelectors } from '@core/store/user-emails'; import { ConfirmEmailComponent } from '@shared/components'; import { FullScreenLoaderComponent, ToastComponent } from './shared/components'; -import { MetaTagsService } from './shared/services/meta-tags.service'; +import { MetaTagsService } from './shared/services'; @Component({ selector: 'osf-root', diff --git a/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.html b/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.html index 4983d95fb..d5b12579b 100644 --- a/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.html +++ b/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.html @@ -14,7 +14,9 @@

{{ currentResource()?.description }}

@@ -25,7 +27,7 @@

{{ resourceName }}

class="btn-full-width" [label]="'common.buttons.edit' | translate" severity="info" - (click)="backToEdit()" + (onClick)="backToEdit()" /> ({ + form = new FormGroup({ pid: new FormControl('', [CustomValidators.requiredTrimmed(), CustomValidators.doiValidator]), resourceType: new FormControl('', [Validators.required]), description: new FormControl(''), @@ -60,7 +60,7 @@ export class AddResourceDialogComponent { public resourceOptions = signal(resourceTypeOptions); public isPreviewMode = signal(false); - protected readonly RegistryResourceType = RegistryResourceType; + readonly RegistryResourceType = RegistryResourceType; previewResource(): void { if (this.form.invalid) { @@ -78,9 +78,7 @@ export class AddResourceDialogComponent { throw new Error(this.translateService.instant('resources.errors.noCurrentResource')); } - this.actions.previewResource(currentResource.id, addResource).subscribe(() => { - this.isPreviewMode.set(true); - }); + this.actions.previewResource(currentResource.id, addResource).subscribe(() => this.isPreviewMode.set(true)); } backToEdit() { @@ -88,9 +86,7 @@ export class AddResourceDialogComponent { } onAddResource() { - const addResource: ConfirmAddResource = { - finalized: true, - }; + const addResource: ConfirmAddResource = { finalized: true }; const currentResource = this.currentResource(); if (!currentResource) { diff --git a/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.ts b/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.ts index eae30ae18..f5b0900a7 100644 --- a/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.ts +++ b/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.ts @@ -24,15 +24,15 @@ import { ResourceFormComponent } from '../resource-form/resource-form.component' changeDetection: ChangeDetectionStrategy.OnPush, }) export class EditResourceDialogComponent { - protected readonly dialogRef = inject(DynamicDialogRef); - protected readonly isCurrentResourceLoading = select(RegistryResourcesSelectors.isCurrentResourceLoading); + readonly dialogRef = inject(DynamicDialogRef); + readonly isCurrentResourceLoading = select(RegistryResourcesSelectors.isCurrentResourceLoading); private translateService = inject(TranslateService); private dialogConfig = inject(DynamicDialogConfig); private registryId: string = this.dialogConfig.data.id; private resource: RegistryResource = this.dialogConfig.data.resource as RegistryResource; - protected form = new FormGroup({ + form = new FormGroup({ pid: new FormControl('', [CustomValidators.requiredTrimmed(), CustomValidators.doiValidator]), resourceType: new FormControl('', [Validators.required]), description: new FormControl(''), diff --git a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.ts b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.ts index b25e836f7..741b7efa3 100644 --- a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.ts +++ b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.ts @@ -48,21 +48,19 @@ import { RegistryOverviewSelectors, SubmitDecision } from '../../store/registry- }) export class RegistryMakeDecisionComponent { private readonly fb = inject(FormBuilder); - protected readonly config = inject(DynamicDialogConfig); - protected readonly dialogRef = inject(DynamicDialogRef); + readonly config = inject(DynamicDialogConfig); + readonly dialogRef = inject(DynamicDialogRef); - protected readonly ReviewActionTrigger = ReviewActionTrigger; - protected readonly SchemaResponseActionTrigger = SchemaResponseActionTrigger; - protected readonly SubmissionReviewStatus = SubmissionReviewStatus; - protected readonly ModerationDecisionFormControls = ModerationDecisionFormControls; - protected reviewActions = select(RegistryOverviewSelectors.getReviewActions); + readonly ReviewActionTrigger = ReviewActionTrigger; + readonly SchemaResponseActionTrigger = SchemaResponseActionTrigger; + readonly SubmissionReviewStatus = SubmissionReviewStatus; + readonly ModerationDecisionFormControls = ModerationDecisionFormControls; + reviewActions = select(RegistryOverviewSelectors.getReviewActions); - protected isSubmitting = select(RegistryOverviewSelectors.isReviewActionSubmitting); - protected requestForm!: FormGroup; + isSubmitting = select(RegistryOverviewSelectors.isReviewActionSubmitting); + requestForm!: FormGroup; - protected actions = createDispatchMap({ - submitDecision: SubmitDecision, - }); + actions = createDispatchMap({ submitDecision: SubmitDecision }); registry = this.config.data.registry as RegistryOverview; embargoEndDate = this.registry.embargoEndDate; @@ -105,7 +103,7 @@ export class RegistryMakeDecisionComponent { }); } - protected handleSubmission(): void { + handleSubmission(): void { const revisionId = this.config.data.revisionId; this.actions .submitDecision( @@ -120,7 +118,7 @@ export class RegistryMakeDecisionComponent { .subscribe(); } - protected isCommentRequired(action: string): boolean { + isCommentRequired(action: string): boolean { return ( action === ReviewActionTrigger.RejectSubmission || action === SchemaResponseActionTrigger.RejectRevision || diff --git a/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts b/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts index 761ca39ff..a028e61f3 100644 --- a/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts +++ b/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts @@ -19,13 +19,16 @@ import { RevisionReviewStates } from '@shared/enums'; }) export class RegistryRevisionsComponent { @HostBinding('class') classes = 'flex-1 flex'; + registry = input.required(); selectedRevisionIndex = input.required(); isSubmitting = input(false); isModeration = input(false); openRevision = output(); + readonly updateRegistration = output(); readonly continueUpdate = output(); + readonly RevisionReviewStates = RevisionReviewStates; unApprovedRevisionId: string | null = null; @@ -76,7 +79,6 @@ export class RegistryRevisionsComponent { this.openRevision.emit(index); } - protected readonly RevisionReviewStates = RevisionReviewStates; continueUpdateHandler(): void { this.continueUpdate.emit(); } diff --git a/src/app/features/registry/components/registry-statuses/registry-statuses.component.scss b/src/app/features/registry/components/registry-statuses/registry-statuses.component.scss index 51e2630d2..4e711ed03 100644 --- a/src/app/features/registry/components/registry-statuses/registry-statuses.component.scss +++ b/src/app/features/registry/components/registry-statuses/registry-statuses.component.scss @@ -1,8 +1,7 @@ -@use "/styles/variables" as var; @use "styles/mixins" as mix; .accordion-border { - border: 1px solid var.$grey-2; + border: 1px solid var(--grey-2); border-radius: mix.rem(12px); height: max-content !important; } diff --git a/src/app/features/registry/components/registry-statuses/registry-statuses.component.ts b/src/app/features/registry/components/registry-statuses/registry-statuses.component.ts index e3048d041..31f9b0537 100644 --- a/src/app/features/registry/components/registry-statuses/registry-statuses.component.ts +++ b/src/app/features/registry/components/registry-statuses/registry-statuses.component.ts @@ -9,13 +9,13 @@ import { DialogService } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, computed, HostBinding, inject, input } from '@angular/core'; import { Router } from '@angular/router'; -import { WithdrawDialogComponent } from '@osf/features/registry/components'; -import { RegistryOverview } from '@osf/features/registry/models'; -import { MakePublic } from '@osf/features/registry/store/registry-overview'; -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; -import { RegistryStatus } from '@shared/enums'; -import { hasViewOnlyParam } from '@shared/helpers'; -import { CustomConfirmationService } from '@shared/services'; +import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; +import { hasViewOnlyParam } from '@osf/shared/helpers'; +import { CustomConfirmationService } from '@osf/shared/services'; + +import { RegistryOverview } from '../../models'; +import { MakePublic } from '../../store/registry-overview'; +import { WithdrawDialogComponent } from '../withdraw-dialog/withdraw-dialog.component'; @Component({ selector: 'osf-registry-statuses', @@ -27,15 +27,15 @@ import { CustomConfirmationService } from '@shared/services'; export class RegistryStatusesComponent { @HostBinding('class') classes = 'flex-1 flex'; private readonly router = inject(Router); - registry = input.required(); private readonly dialogService = inject(DialogService); private readonly translateService = inject(TranslateService); + + registry = input.required(); + readonly RegistryStatus = RegistryStatus; readonly RevisionReviewStates = RevisionReviewStates; readonly customConfirmationService = inject(CustomConfirmationService); - readonly actions = createDispatchMap({ - makePublic: MakePublic, - }); + readonly actions = createDispatchMap({ makePublic: MakePublic }); get canWithdraw(): boolean { return ( diff --git a/src/app/features/registry/components/resource-form/resource-form.component.html b/src/app/features/registry/components/resource-form/resource-form.component.html index 0aceb3622..0f8b5ff09 100644 --- a/src/app/features/registry/components/resource-form/resource-form.component.html +++ b/src/app/features/registry/components/resource-form/resource-form.component.html @@ -20,7 +20,14 @@
- +
@@ -29,7 +36,7 @@ class="btn-full-width" [label]="cancelButtonLabel() | translate" severity="info" - (click)="handleCancel()" + (onClick)="handleCancel()" /> } (); submitClicked = output(); - protected inputLimits = InputLimits; - public resourceOptions = signal(resourceTypeOptions); + inputLimits = InputLimits; + resourceOptions = signal(resourceTypeOptions); - protected getControl(controlName: keyof RegistryResourceFormModel): FormControl { + getControl(controlName: keyof RegistryResourceFormModel): FormControl { return this.formGroup().get(controlName) as FormControl; } diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts b/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts index d20a7ef4e..7ebd33717 100644 --- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts +++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts @@ -16,7 +16,8 @@ import { environment } from 'src/environments/environment'; }) export class ShortRegistrationInfoComponent { registration = input.required(); - protected readonly environment = environment; + + readonly environment = environment; get associatedProjectUrl(): string { return `${this.environment.webUrl}/${this.registration().associatedProjectId}`; diff --git a/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.ts b/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.ts index 37f7e7299..fb97c3fc4 100644 --- a/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.ts +++ b/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.ts @@ -22,16 +22,12 @@ import { TextInputComponent } from '@shared/components'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class WithdrawDialogComponent { - protected readonly dialogRef = inject(DynamicDialogRef); + readonly dialogRef = inject(DynamicDialogRef); private readonly config = inject(DynamicDialogConfig); - private readonly actions = createDispatchMap({ - withdrawRegistration: WithdrawRegistration, - }); - - protected readonly form = new FormGroup({ - text: new FormControl(''), - }); - protected readonly inputLimits = InputLimits; + private readonly actions = createDispatchMap({ withdrawRegistration: WithdrawRegistration }); + + readonly form = new FormGroup({ text: new FormControl('') }); + readonly inputLimits = InputLimits; withdrawRegistration(): void { const registryId = this.config.data.registryId; diff --git a/src/app/features/registry/pages/registry-components/registry-components.component.ts b/src/app/features/registry/pages/registry-components/registry-components.component.ts index 0dc699230..167d5c40c 100644 --- a/src/app/features/registry/pages/registry-components/registry-components.component.ts +++ b/src/app/features/registry/pages/registry-components/registry-components.component.ts @@ -5,15 +5,14 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, computed, effect, inject, OnInit, signal } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { RegistrationLinksCardComponent } from '@osf/features/registry/components'; -import { RegistryComponentModel } from '@osf/features/registry/models'; -import { GetRegistryById, RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; -import { ViewOnlyLinkMessageComponent } from '@shared/components/view-only-link-message/view-only-link-message.component'; -import { hasViewOnlyParam } from '@shared/helpers'; +import { LoadingSpinnerComponent, SubHeaderComponent, ViewOnlyLinkMessageComponent } from '@osf/shared/components'; +import { hasViewOnlyParam } from '@osf/shared/helpers'; +import { RegistrationLinksCardComponent } from '../../components'; +import { RegistryComponentModel } from '../../models'; import { GetRegistryComponents, RegistryComponentsSelectors } from '../../store/registry-components'; import { GetBibliographicContributorsForRegistration, RegistryLinksSelectors } from '../../store/registry-links'; +import { GetRegistryById, RegistryOverviewSelectors } from '../../store/registry-overview'; @Component({ selector: 'osf-registry-components', diff --git a/src/app/features/registry/pages/registry-resources/registry-resources.component.html b/src/app/features/registry/pages/registry-resources/registry-resources.component.html index 1ca013a57..add727823 100644 --- a/src/app/features/registry/pages/registry-resources/registry-resources.component.html +++ b/src/app/features/registry/pages/registry-resources/registry-resources.component.html @@ -28,7 +28,7 @@

{{ resourceName }}

- https://doi.org/{{ resource.pid }} + https://doi.org/{{ resource.pid }}

{{ resource.description }}

diff --git a/src/app/features/registry/pages/registry-resources/registry-resources.component.ts b/src/app/features/registry/pages/registry-resources/registry-resources.component.ts index 7ccd81da4..18aac974f 100644 --- a/src/app/features/registry/pages/registry-resources/registry-resources.component.ts +++ b/src/app/features/registry/pages/registry-resources/registry-resources.component.ts @@ -34,16 +34,17 @@ import { export class RegistryResourcesComponent { @HostBinding('class') classes = 'flex-1 flex flex-column w-full h-full'; private readonly route = inject(ActivatedRoute); - private dialogService = inject(DialogService); - private translateService = inject(TranslateService); - private toastService = inject(ToastService); - private customConfirmationService = inject(CustomConfirmationService); + private readonly dialogService = inject(DialogService); + private readonly translateService = inject(TranslateService); + private readonly toastService = inject(ToastService); + private readonly customConfirmationService = inject(CustomConfirmationService); - protected readonly resources = select(RegistryResourcesSelectors.getResources); - protected readonly isResourcesLoading = select(RegistryResourcesSelectors.isResourcesLoading); - private registryId = ''; - protected addingResource = signal(false); - private readonly currentResource = select(RegistryResourcesSelectors.getCurrentResource); + readonly resources = select(RegistryResourcesSelectors.getResources); + readonly isResourcesLoading = select(RegistryResourcesSelectors.isResourcesLoading); + readonly currentResource = select(RegistryResourcesSelectors.getCurrentResource); + + registryId = ''; + addingResource = signal(false); private readonly actions = createDispatchMap({ getResources: GetRegistryResources, @@ -62,9 +63,7 @@ export class RegistryResourcesComponent { } addResource() { - if (!this.registryId) { - throw new Error(this.translateService.instant('resources.errors.noRegistryId')); - } + if (!this.registryId) return; this.addingResource.set(true); @@ -91,10 +90,10 @@ export class RegistryResourcesComponent { this.toastService.showSuccess('resources.toastMessages.addResourceSuccess'); } else { const currentResource = this.currentResource(); - if (!currentResource) { - throw new Error(this.translateService.instant('resources.errors.noCurrentResource')); + + if (currentResource) { + this.actions.silentDelete(currentResource.id); } - this.actions.silentDelete(currentResource.id); } }, error: () => this.toastService.showError('resources.toastMessages.addResourceError'), @@ -103,9 +102,7 @@ export class RegistryResourcesComponent { } updateResource(resource: RegistryResource) { - if (!this.registryId) { - throw new Error(this.translateService.instant('resources.errors.noRegistryId')); - } + if (!this.registryId) return; const dialogRef = this.dialogService.open(EditResourceDialogComponent, { header: this.translateService.instant('resources.edit'), @@ -138,9 +135,7 @@ export class RegistryResourcesComponent { this.actions .deleteResource(id, this.registryId) .pipe(take(1)) - .subscribe(() => { - this.toastService.showSuccess('resources.toastMessages.deletedResourceSuccess'); - }); + .subscribe(() => this.toastService.showSuccess('resources.toastMessages.deletedResourceSuccess')); }, }); } diff --git a/src/app/features/registry/store/registry-components/registry-components.model.ts b/src/app/features/registry/store/registry-components/registry-components.model.ts index a285b7853..d07b37b34 100644 --- a/src/app/features/registry/store/registry-components/registry-components.model.ts +++ b/src/app/features/registry/store/registry-components/registry-components.model.ts @@ -5,3 +5,7 @@ import { RegistryComponentModel } from '../../models'; export interface RegistryComponentsStateModel { registryComponents: AsyncStateWithTotalCount; } + +export const REGISTRY_COMPONENTS_STATE_DEFAULTS: RegistryComponentsStateModel = { + registryComponents: { data: [], isLoading: false, error: null, totalCount: 0 }, +}; diff --git a/src/app/features/registry/store/registry-components/registry-components.state.ts b/src/app/features/registry/store/registry-components/registry-components.state.ts index fa46b1b32..d3914fcbd 100644 --- a/src/app/features/registry/store/registry-components/registry-components.state.ts +++ b/src/app/features/registry/store/registry-components/registry-components.state.ts @@ -9,15 +9,11 @@ import { handleSectionError } from '@shared/helpers'; import { RegistryComponentsService } from '../../services/registry-components.service'; import { GetRegistryComponents } from './registry-components.actions'; -import { RegistryComponentsStateModel } from './registry-components.model'; - -const initialState: RegistryComponentsStateModel = { - registryComponents: { data: [], isLoading: false, error: null, totalCount: 0 }, -}; +import { REGISTRY_COMPONENTS_STATE_DEFAULTS, RegistryComponentsStateModel } from './registry-components.model'; @State({ name: 'registryComponents', - defaults: initialState, + defaults: REGISTRY_COMPONENTS_STATE_DEFAULTS, }) @Injectable() export class RegistryComponentsState { diff --git a/src/app/shared/mappers/user/user.mapper.ts b/src/app/shared/mappers/user/user.mapper.ts index 552354044..cbf232ec3 100644 --- a/src/app/shared/mappers/user/user.mapper.ts +++ b/src/app/shared/mappers/user/user.mapper.ts @@ -34,7 +34,7 @@ export class UserMapper { social: user.attributes.social, defaultRegionId: user.relationships?.default_region?.data?.id, allowIndexing: user.attributes?.allow_indexing, - canViewReviews: user.attributes.can_view_reviews === true, //do not simplify it + canViewReviews: user.attributes.can_view_reviews === true, // [NS] Do not simplify it }; } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index a9cdbd862..f0a62a800 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -2675,9 +2675,9 @@ "edit": "Edit Resource", "delete": "Delete Resource", "check": "Check your DOI for accuracy", - "deleteText": "Are you sure you want to delete resource", + "deleteText": "Are you sure you want to delete resource? This cannot be undone.", "selectAResourceType": "Select A Resource Type", - "descriptionLabel": "Description(Optional)", + "descriptionLabel": "Description (Optional)", "typeOptions": { "data": "Data", "code": "Analytic Code", From f7dae843cc2241b985457054c3cf3ee06d930ef6 Mon Sep 17 00:00:00 2001 From: nsemets Date: Thu, 4 Sep 2025 19:06:46 +0300 Subject: [PATCH 4/4] fix(wiki): updated wiki --- .../features/project/wiki/wiki.component.html | 1 + .../registry-wiki.component.html | 4 +- .../registry-wiki/registry-wiki.component.ts | 9 ++-- .../wiki/wiki-list/wiki-list.component.html | 51 +++++++++++-------- .../wiki/wiki-list/wiki-list.component.ts | 10 ++-- 5 files changed, 42 insertions(+), 33 deletions(-) diff --git a/src/app/features/project/wiki/wiki.component.html b/src/app/features/project/wiki/wiki.component.html index 8e2debb7c..b3ede123b 100644 --- a/src/app/features/project/wiki/wiki.component.html +++ b/src/app/features/project/wiki/wiki.component.html @@ -34,6 +34,7 @@ [componentsList]="componentsWikiList()" [currentWikiId]="currentWikiId()" [viewOnly]="hasViewOnly()" + [showAddBtn]="true" (createWiki)="onCreateWiki()" (deleteWiki)="onDeleteWiki()" > diff --git a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html index 01bedd68c..2f5ee68ad 100644 --- a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html +++ b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html @@ -1,4 +1,4 @@ - + + @if (wikiModes().view) { } + @if (wikiModes().compare) { { - return hasViewOnlyParam(this.router); - }); + hasViewOnly = computed(() => hasViewOnlyParam(this.router)); readonly resourceId = this.route.parent?.snapshot.params['id']; diff --git a/src/app/shared/components/wiki/wiki-list/wiki-list.component.html b/src/app/shared/components/wiki/wiki-list/wiki-list.component.html index cf8b708ba..30265bcc8 100644 --- a/src/app/shared/components/wiki/wiki-list/wiki-list.component.html +++ b/src/app/shared/components/wiki/wiki-list/wiki-list.component.html @@ -11,15 +11,21 @@ } @else { @if (expanded()) { -
- +
+ @if (showAddBtn()) { + + } + - + />
@if (!viewOnly()) { @if (!isHomeWikiSelected() || !list().length) { @@ -39,8 +44,7 @@ outlined (onClick)="openDeleteWikiDialog()" class="mb-2 flex" - > -
+ /> } }
@@ -72,19 +76,22 @@

{{ item.label | translate }}

} @else {
- +
- + + @if (showAddBtn()) { + + } } }
diff --git a/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts b/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts index 3f27d32ac..63ce9bd5d 100644 --- a/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts +++ b/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts @@ -24,12 +24,14 @@ import { AddWikiDialogComponent } from '../add-wiki-dialog/add-wiki-dialog.compo providers: [DialogService], }) export class WikiListComponent { - readonly viewOnly = input(false); - readonly resourceId = input.required(); readonly list = input.required(); - readonly isLoading = input(false); - readonly componentsList = input.required(); + readonly resourceId = input.required(); readonly currentWikiId = input.required(); + readonly componentsList = input.required(); + + readonly showAddBtn = input(false); + readonly isLoading = input(false); + readonly viewOnly = input(false); readonly deleteWiki = output(); readonly createWiki = output();