11import { TranslatePipe , TranslateService } from '@ngx-translate/core' ;
22
3+ import { Button } from 'primeng/button' ;
34import { DialogService } from 'primeng/dynamicdialog' ;
45import { Skeleton } from 'primeng/skeleton' ;
56
67import { TitleCasePipe } from '@angular/common' ;
78import { ChangeDetectionStrategy , Component , effect , inject , input , output } from '@angular/core' ;
89import { FormControl } from '@angular/forms' ;
10+ import { Router } from '@angular/router' ;
911
1012import { PreprintsHelpDialogComponent } from '@osf/features/preprints/components' ;
1113import { RegistryProviderDetails } from '@osf/features/registries/models/registry-provider.model' ;
@@ -16,14 +18,15 @@ import { HeaderStyleHelper } from '@shared/utils';
1618
1719@Component ( {
1820 selector : 'osf-registry-provider-hero' ,
19- imports : [ DecodeHtmlPipe , SearchInputComponent , Skeleton , TitleCasePipe , TranslatePipe ] ,
21+ imports : [ DecodeHtmlPipe , SearchInputComponent , Skeleton , TitleCasePipe , TranslatePipe , Button ] ,
2022 templateUrl : './registry-provider-hero.component.html' ,
2123 styleUrl : './registry-provider-hero.component.scss' ,
2224 changeDetection : ChangeDetectionStrategy . OnPush ,
2325} )
2426export class RegistryProviderHeroComponent {
25- protected translateService = inject ( TranslateService ) ;
26- protected dialogService = inject ( DialogService ) ;
27+ private readonly router = inject ( Router ) ;
28+ private readonly translateService = inject ( TranslateService ) ;
29+ private readonly dialogService = inject ( DialogService ) ;
2730
2831 searchControl = input < FormControl > ( new FormControl ( ) ) ;
2932 provider = input . required < RegistryProviderDetails | null > ( ) ;
@@ -58,4 +61,14 @@ export class RegistryProviderHeroComponent {
5861 closable : true ,
5962 } ) ;
6063 }
64+
65+ navigateToCreatePage ( ) {
66+ const providerId = this . provider ( ) ?. id ;
67+
68+ if ( ! providerId ) {
69+ return ;
70+ }
71+
72+ this . router . navigate ( [ `/registries/${ providerId } /new` ] ) ;
73+ }
6174}
0 commit comments