Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{ 'project.metadata.resourceInformation.tooltipDialog.secondaryContent' | translate: { resourceName } }}
</p>
<p>
{{ 'project.metadata.resourceInformation.tooltipDialog.dataTypeLink' | translate }}
{{ 'project.metadata.resourceInformation.tooltipDialog.thirdContent' | translate }}
<a
class="font-bold"
href="https://support.datacite.org/docs/what-are-the-resource-types-for-datacite-dois"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DatePipe, TitleCasePipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, computed, inject, input, OnInit } from '@angular/core';
import { Router, RouterLink } from '@angular/router';

import { ApplicabilityStatus, PreregLinkInfo, ReviewsState } from '@osf/features/preprints/enums';
import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums';
import { PreprintProviderDetails } from '@osf/features/preprints/models';
import {
FetchLicenses,
Expand Down Expand Up @@ -59,7 +59,9 @@ export class ReviewStepComponent implements OnInit {
submitPreprint: SubmitPreprint,
fetchResourceInstitutions: FetchResourceInstitutions,
});

provider = input.required<PreprintProviderDetails | undefined>();

preprint = select(PreprintStepperSelectors.getPreprint);
isPreprintSubmitting = select(PreprintStepperSelectors.isPreprintSubmitting);

Expand All @@ -83,16 +85,12 @@ export class ReviewStepComponent implements OnInit {
}

submitPreprint() {
if (this.preprint()?.reviewsState !== ReviewsState.Accepted) {
this.actions.submitPreprint().subscribe({
complete: () => {
this.toastService.showSuccess('preprints.preprintStepper.common.successMessages.preprintSubmitted');
this.router.navigate(['/preprints', this.provider()!.id, this.preprint()!.id]);
},
});
} else {
this.toastService.showSuccess('preprints.preprintStepper.common.successMessages.preprintSubmitted');
}
this.actions.submitPreprint().subscribe({
complete: () => {
this.toastService.showSuccess('preprints.preprintStepper.common.successMessages.preprintSubmitted');
this.router.navigate(['/preprints', this.provider()!.id, this.preprint()!.id]);
},
});
}

cancelSubmission() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea
isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading);
hasBeenSubmitted = select(PreprintStepperSelectors.hasBeenSubmitted);

currentUserIsAdmin = computed(() => {
return this.preprint()?.currentUserPermissions.includes(UserPermissions.Admin) || false;
});
currentUserIsAdmin = computed(() => this.preprint()?.currentUserPermissions.includes(UserPermissions.Admin) || false);

editAndResubmitMode = computed(() => {
const providerIsPremod = this.preprintProvider()?.reviewsWorkflow === ProviderReviewsWorkflow.PreModeration;
Expand Down Expand Up @@ -130,6 +128,7 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea
currentStep = signal<StepOption>(submitPreprintSteps[0]);
isWeb = toSignal(inject(IS_WEB));

readonly SubmitStepsEnum = PreprintSteps;
readonly PreprintSteps = PreprintSteps;

constructor() {
Expand All @@ -149,6 +148,12 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea
});
}

@HostListener('window:beforeunload', ['$event'])
public onBeforeUnload($event: BeforeUnloadEvent): boolean {
$event.preventDefault();
return false;
}

canDeactivate(): Observable<boolean> | boolean {
return this.hasBeenSubmitted();
}
Expand Down Expand Up @@ -181,12 +186,4 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea
moveToPreviousStep() {
this.currentStep.set(this.updateSteps()[this.currentStep()?.index - 1]);
}

@HostListener('window:beforeunload', ['$event'])
public onBeforeUnload($event: BeforeUnloadEvent): boolean {
$event.preventDefault();
return false;
}

protected readonly SubmitStepsEnum = PreprintSteps;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<p-card>
@if (registrationData()) {
@if (registrationData()) {
<p-card>
<div class="flex gap-3 flex-column">
<div class="flex align-items-center flex-wrap gap-2 w-full">
<osf-icon [iconClass]="registrationData().isPublic ? 'fas fa-lock-open' : 'fas fa-lock'"></osf-icon>

<h2 class="align-self-center">
{{ registrationData().title || 'project.registrations.card.noTitle' | translate }}
</h2>
<p-button
class="link-btn-no-padding"
styleClass="text-lg"
link
[label]="registrationData().title || 'project.registrations.card.noTitle' | translate"
(click)="reviewEmitRegistrationData.emit(registrationData()!.id)"
></p-button>
</div>
<div class="flex flex-wrap flex-column lg:flex-nowrap lg:flex-row justify-content-between gap-5">
<div class="flex gap-3 flex-column w-full">
Expand Down Expand Up @@ -81,7 +85,7 @@ <h2 class="align-self-center">
<div class="flex gap-2 mt-1">
<p-button
severity="primary"
[label]="'common.buttons.review' | translate"
[label]="'common.buttons.view' | translate"
(click)="reviewEmitRegistrationData.emit(registrationData()!.id)"
></p-button>

Expand Down Expand Up @@ -113,5 +117,5 @@ <h3 class="mb-1">{{ 'shared.resources.title' | translate }}</h3>
</div>
</div>
</div>
}
</p-card>
</p-card>
}
1 change: 0 additions & 1 deletion src/app/features/registry/models/linked-nodes.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export interface LinkedNode {
dateModified: string;
tags: string[];
isPublic: boolean;
contributorsCount?: number;
contributors?: ContributorModel[];
htmlUrl: string;
apiUrl: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface RegistryComponentModel {
registrationSupplement: string;
tags: string[];
isPublic: boolean;
contributorsCount?: number;
contributors?: ContributorModel[];
registry?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export class AddContributorDialogComponent implements OnInit, OnDestroy {
filter((searchTerm) => !!searchTerm && searchTerm.trim().length > 0),
debounceTime(500),
distinctUntilChanged(),
switchMap((searchTerm) => this.actions.searchUsers(searchTerm, this.currentPage())),
switchMap((searchTerm) => {
this.currentPage.set(1);
this.first.set(0);
return this.actions.searchUsers(searchTerm, this.currentPage());
}),
takeUntilDestroyed(this.destroyRef)
)
.subscribe(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export class AddUnregisteredContributorDialogComponent {
const contributorData: ContributorAddModel = {
fullName: formData.fullName,
email: formData.email,
isBibliographic: false,
permission: ContributorPermission.Read,
isBibliographic: true,
permission: ContributorPermission.Write,
};
const data: ContributorDialogAddModel = { data: [contributorData], type: AddContributorType.Unregistered };
this.dialogRef.close(data);
Expand Down
Loading