From 3203f81cfb92be69388989b520b2fa491c6f53f7 Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Wed, 10 Sep 2025 16:32:18 +0300 Subject: [PATCH 1/4] fix(registration): fixed 594 --- .../registries-landing/registries-landing.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/features/registries/pages/registries-landing/registries-landing.component.ts b/src/app/features/registries/pages/registries-landing/registries-landing.component.ts index 9e79c0402..dd70711cb 100644 --- a/src/app/features/registries/pages/registries-landing/registries-landing.component.ts +++ b/src/app/features/registries/pages/registries-landing/registries-landing.component.ts @@ -8,6 +8,8 @@ import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/cor import { FormControl } from '@angular/forms'; import { Router } from '@angular/router'; +import { AuthService } from '@core/services'; +import { UserSelectors } from '@core/store/user'; import { RegistryServicesComponent } from '@osf/features/registries/components'; import { GetRegistries, RegistriesSelectors } from '@osf/features/registries/store'; import { @@ -37,6 +39,8 @@ import { environment } from 'src/environments/environment'; }) export class RegistriesLandingComponent implements OnInit { private router = inject(Router); + private readonly isAuthenticated = select(UserSelectors.isAuthenticated); + private readonly authService = inject(AuthService); searchControl = new FormControl(''); @@ -66,6 +70,10 @@ export class RegistriesLandingComponent implements OnInit { } goToCreateRegistration(): void { - this.router.navigate([`/registries/${environment.defaultProvider}/new`]); + if (this.isAuthenticated()) { + this.router.navigate([`/registries/${environment.defaultProvider}/new`]); + } else { + this.authService.navigateToSignIn(); + } } } From de8debf0ed84558d9c0cce736782418117b98e23 Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Wed, 10 Sep 2025 22:04:15 +0300 Subject: [PATCH 2/4] fix(registration-bugs): fixed some registrations bugs --- .../file-detail/file-detail.component.ts | 4 +-- src/app/features/files/store/files.actions.ts | 5 +--- src/app/features/files/store/files.state.ts | 2 +- .../add-metadata/add-metadata.component.ts | 6 +++- ...confirm-registration-dialog.component.html | 1 + .../custom-step/custom-step.component.html | 9 ++++-- .../metadata/metadata.component.html | 3 +- .../registries-license.component.html | 1 + .../new-registration.component.html | 9 +++++- .../new-registration.component.scss | 1 + .../new-registration.component.ts | 23 +++++++++++++-- .../components/review/review.component.html | 11 ++++---- .../registries/services/projects.service.ts | 28 ------------------- .../store/handlers/projects.handlers.ts | 16 +++++++---- .../registries/store/registries.actions.ts | 5 +++- .../registries/store/registries.state.ts | 4 +-- .../generic-filter.component.html | 2 +- .../components/license/license.component.html | 3 +- .../sub-header/sub-header.component.html | 2 +- .../sub-header/sub-header.component.scss | 1 + .../truncated-text.component.ts | 10 ++++++- src/app/shared/services/files.service.ts | 4 +-- src/styles/_fonts.scss | 4 +++ 23 files changed, 91 insertions(+), 63 deletions(-) delete mode 100644 src/app/features/registries/services/projects.service.ts diff --git a/src/app/features/files/pages/file-detail/file-detail.component.ts b/src/app/features/files/pages/file-detail/file-detail.component.ts index 40ff066d9..d4c60db1a 100644 --- a/src/app/features/files/pages/file-detail/file-detail.component.ts +++ b/src/app/features/files/pages/file-detail/file-detail.component.ts @@ -183,8 +183,8 @@ export class FileDetailComponent { this.actions.getFileResourceMetadata(this.resourceId, this.resourceType); this.actions.getFileResourceContributors(this.resourceId, this.resourceType); if (fileId) { - const storageLink = this.file()?.links.download || ''; - this.actions.getFileRevisions(storageLink, fileId); + const storageLink = this.file()?.links.upload || ''; + this.actions.getFileRevisions(storageLink); this.actions.getCedarTemplates(); this.actions.getCedarRecords(fileId, ResourceType.File); } diff --git a/src/app/features/files/store/files.actions.ts b/src/app/features/files/store/files.actions.ts index 96ef709fa..a6fc56f71 100644 --- a/src/app/features/files/store/files.actions.ts +++ b/src/app/features/files/store/files.actions.ts @@ -114,10 +114,7 @@ export class SetFileMetadata { export class GetFileRevisions { static readonly type = '[Files] Get Revisions'; - constructor( - public link: string, - public fileId: string - ) {} + constructor(public link: string) {} } export class UpdateTags { diff --git a/src/app/features/files/store/files.state.ts b/src/app/features/files/store/files.state.ts index d0e977eb2..d9e572374 100644 --- a/src/app/features/files/store/files.state.ts +++ b/src/app/features/files/store/files.state.ts @@ -257,7 +257,7 @@ export class FilesState { const state = ctx.getState(); ctx.patchState({ fileRevisions: { ...state.fileRevisions, isLoading: true, error: null } }); - return this.filesService.getFileRevisions(action.link, action.fileId).pipe( + return this.filesService.getFileRevisions(action.link).pipe( tap({ next: (revisions) => { ctx.patchState({ fileRevisions: { data: revisions, isLoading: false, error: null } }); diff --git a/src/app/features/metadata/pages/add-metadata/add-metadata.component.ts b/src/app/features/metadata/pages/add-metadata/add-metadata.component.ts index 0c9b31a1f..c27330578 100644 --- a/src/app/features/metadata/pages/add-metadata/add-metadata.component.ts +++ b/src/app/features/metadata/pages/add-metadata/add-metadata.component.ts @@ -123,7 +123,11 @@ export class AddMetadataComponent implements OnInit { if (templates?.links?.first && templates?.links?.last && templates.links.first !== templates.links.last) { this.actions.getCedarTemplates(); } else { - this.router.navigate(['..'], { relativeTo: this.activatedRoute }); + if (this.resourceType() === ResourceType.File) { + this.router.navigate([this.resourceId]); + } else { + this.router.navigate(['..'], { relativeTo: this.activatedRoute }); + } } } diff --git a/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.html b/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.html index 9379b23c6..f4df946e2 100644 --- a/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.html +++ b/src/app/features/registries/components/confirm-registration-dialog/confirm-registration-dialog.component.html @@ -58,6 +58,7 @@ [disabled]="isRegistrationSubmitting()" /> (keyup.enter)="inplaceRef.deactivate()" (keyup.space)="inplaceRef.deactivate()" > - @@ -207,6 +207,11 @@

{{ 'files.actions.uploadFile' | translate }}

class="mr-2" (click)="goBack()" >
- + diff --git a/src/app/features/registries/components/metadata/metadata.component.html b/src/app/features/registries/components/metadata/metadata.component.html index c877f627a..a3bb08450 100644 --- a/src/app/features/registries/components/metadata/metadata.component.html +++ b/src/app/features/registries/components/metadata/metadata.component.html @@ -13,6 +13,7 @@

{{ 'registries.metadata.title' | translate }}