diff --git a/src/app/features/admin-institutions/components/filters-section/filters-section.component.html b/src/app/features/admin-institutions/components/filters-section/filters-section.component.html index b1c526da0..f8b04560e 100644 --- a/src/app/features/admin-institutions/components/filters-section/filters-section.component.html +++ b/src/app/features/admin-institutions/components/filters-section/filters-section.component.html @@ -17,7 +17,6 @@

{{ 'adminInstitutions.common.filterBy' | translate }}

class="px-4" [filterValues]="filterValues()" [filters]="filters()" - [filterOptionsCache]="filterOptionsCache()" (filterRemoved)="onFilterChipRemoved($event)" /> diff --git a/src/app/features/admin-institutions/components/filters-section/filters-section.component.ts b/src/app/features/admin-institutions/components/filters-section/filters-section.component.ts index 4e775de6f..060d01331 100644 --- a/src/app/features/admin-institutions/components/filters-section/filters-section.component.ts +++ b/src/app/features/admin-institutions/components/filters-section/filters-section.component.ts @@ -45,7 +45,6 @@ export class FiltersSectionComponent { filters = select(GlobalSearchSelectors.getFilters); filterValues = select(GlobalSearchSelectors.getFilterValues); filterSearchCache = select(GlobalSearchSelectors.getFilterSearchCache); - filterOptionsCache = select(GlobalSearchSelectors.getFilterOptionsCache); areResourcesLoading = select(GlobalSearchSelectors.getResourcesLoading); onFilterChanged(event: { filterType: string; value: StringOrNull }): void { diff --git a/src/app/features/moderation/constants/preprint-sort-options.const.ts b/src/app/features/moderation/constants/preprint-sort-options.const.ts index 60dbe6cdb..3f1579f7b 100644 --- a/src/app/features/moderation/constants/preprint-sort-options.const.ts +++ b/src/app/features/moderation/constants/preprint-sort-options.const.ts @@ -13,10 +13,10 @@ export const PREPRINT_SORT_OPTIONS: CustomOption[] = [ }, { value: PreprintSubmissionsSort.Newest, - label: 'moderation.sortOption.oldest', + label: 'moderation.sortOption.newest', }, { value: PreprintSubmissionsSort.Oldest, - label: 'moderation.sortOption.newest', + label: 'moderation.sortOption.oldest', }, ]; diff --git a/src/app/features/moderation/enums/preprint-submissions-sort.enum.ts b/src/app/features/moderation/enums/preprint-submissions-sort.enum.ts index dbf6c5633..ca1f886f1 100644 --- a/src/app/features/moderation/enums/preprint-submissions-sort.enum.ts +++ b/src/app/features/moderation/enums/preprint-submissions-sort.enum.ts @@ -1,6 +1,6 @@ export enum PreprintSubmissionsSort { TitleAZ = 'title', TitleZA = '-title', - Oldest = '-date_last_transitioned', - Newest = 'date_last_transitioned', + Oldest = 'date_last_transitioned', + Newest = '-date_last_transitioned', } diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html index 673cdd165..ff9244f42 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html @@ -27,7 +27,18 @@

{{ 'preprints.preprintStepper.review.sections.metadata.authors' | translate
@for (contributor of bibliographicContributors(); track contributor.id) {
- {{ contributor.fullName }} + @if (contributor.isUnregisteredContributor) { + {{ contributor.fullName }} + } @else { + + {{ contributor.fullName }} + + } {{ $last ? '' : ',' }}
} @@ -38,7 +49,6 @@

{{ 'preprints.preprintStepper.review.sections.metadata.authors' | translate

- @if (preprintProvider()?.assertionsEnabled) {

{{ 'preprints.preprintStepper.review.sections.authorAssertions.conflictOfInterest' | translate }}

diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts index df6933c9c..f7738f89d 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts @@ -45,7 +45,7 @@ export class GeneralInformationComponent implements OnDestroy { fetchPreprintById: FetchPreprintById, fetchResourceInstitutions: FetchResourceInstitutions, }); - readonly environment = environment; + readonly webUrl = environment.webUrl; preprintProvider = input.required(); preprintVersionSelected = output(); diff --git a/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.html b/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.html index fc9183d87..d42a94e53 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.html +++ b/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.html @@ -41,15 +41,15 @@ } @if (file()) { - @let fileValue = file()!; + @let preprintValue = preprint()!;
- {{ dateLabel() | translate }}: {{ fileValue.dateCreated | date: 'longDate' }} + {{ dateLabel() | translate }}: {{ preprintValue.dateCreated | date: 'longDate' }} @if (isMedium() || isLarge()) { | } - {{ 'preprints.details.file.lastEdited' | translate }} : {{ fileValue.dateModified | date: 'longDate' }} + {{ 'preprints.details.file.lastEdited' | translate }} : {{ preprintValue.dateModified | date: 'longDate' }}
} diff --git a/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.ts b/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.ts index 43bc28fcb..03be07d64 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.ts +++ b/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.ts @@ -36,6 +36,7 @@ export class PreprintFileSectionComponent { isMedium = toSignal(inject(IS_MEDIUM)); isLarge = toSignal(inject(IS_LARGE)); + preprint = select(PreprintSelectors.getPreprint); file = select(PreprintSelectors.getPreprintFile); preprint$ = toObservable(select(PreprintSelectors.getPreprint)); isFileLoading = select(PreprintSelectors.isPreprintFileLoading); @@ -58,10 +59,10 @@ export class PreprintFileSectionComponent { const fileVersions = this.fileVersions(); if (!fileVersions.length) return []; - return fileVersions.map((version, index) => ({ + return fileVersions.map((version) => ({ label: this.translateService.instant('preprints.details.file.downloadVersion', { - version: ++index, - date: this.datePipe.transform(version.dateCreated, 'mm/dd/yyyy hh:mm:ss'), + version: version.id, + date: this.datePipe.transform(version.dateCreated, 'MM/dd/yyyy hh:mm:ss'), }), url: version.downloadLink, command: () => this.logDownload(), diff --git a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html index 56b0e8d3a..be9ad3eb5 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html +++ b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html @@ -39,7 +39,6 @@

{{ 'preprints.preprintStepper.common.labels.abstract' | translate }}

{{ 'preprints.preprintStepper.review.sections.metadata.license' | translate }}

- diff --git a/src/app/features/preprints/components/stepper/file-step/file-step.component.html b/src/app/features/preprints/components/stepper/file-step/file-step.component.html index 2b6b6a399..a6fe88c4d 100644 --- a/src/app/features/preprints/components/stepper/file-step/file-step.component.html +++ b/src/app/features/preprints/components/stepper/file-step/file-step.component.html @@ -10,40 +10,43 @@

{{ 'preprints.preprintStepper.file.title' | translate }}

{{ 'preprints.preprintStepper.file.note' | translate }}

-
- - -
+@if (!preprintHasPrimaryFile() || versionFileMode()) { +
+ + +
+} @if (selectedFileSource() === PreprintFileSource.Computer) {
@if (!fileUploadLink()) { - } @else if ((!preprintFiles().length && !arePreprintFilesLoading()) || versionFileMode()) { + } @else if ((!preprintFile() && !isPreprintFileLoading()) || versionFileMode()) { {{ 'preprints.preprintStepper.file.title' | translate }}

} -@if (selectedFileSource() === PreprintFileSource.Project && !preprintFiles().length && !arePreprintFilesLoading()) { +@if (selectedFileSource() === PreprintFileSource.Project && !preprintFile() && !isPreprintFileLoading()) {

{{ 'preprints.preprintStepper.file.projectSelection.description' | translate }}

@@ -99,28 +102,39 @@

{{ 'preprints.preprintStepper.file.title' | translate }}

} } + +@if (cancelSourceOptionButtonVisible()) { +
+ +
+} + @if (!versionFileMode()) {
- @if (arePreprintFilesLoading()) { + @if (isPreprintFileLoading()) { - } @else { - @for (file of preprintFiles(); track file.id) { -
-
- -

{{ file.name }}

-
+ } @else if (preprintFile()) { +
+
+ +

{{ preprintFile()!.name }}

+
- -
- } + +
}
} @@ -137,9 +151,9 @@

{{ 'preprints.preprintStepper.file.title' | translate }}

class="w-6 md:w-9rem" styleClass="w-full" [label]="'common.buttons.next' | translate" - [disabled]="!preprint()?.primaryFileId || versionFileMode()" + [disabled]="!preprintFile() || versionFileMode()" [pTooltip]=" - !preprint()?.primaryFileId || versionFileMode() + !preprintFile() || versionFileMode() ? ('preprints.preprintStepper.common.validation.fillRequiredFields' | translate) : '' " diff --git a/src/app/features/preprints/components/stepper/file-step/file-step.component.ts b/src/app/features/preprints/components/stepper/file-step/file-step.component.ts index 7717beea2..d3f23ff67 100644 --- a/src/app/features/preprints/components/stepper/file-step/file-step.component.ts +++ b/src/app/features/preprints/components/stepper/file-step/file-step.component.ts @@ -32,6 +32,7 @@ import { CopyFileFromProject, FetchAvailableProjects, FetchPreprintFilesLinks, + FetchPreprintPrimaryFile, FetchProjectFiles, FetchProjectFilesByLink, PreprintStepperSelectors, @@ -73,6 +74,7 @@ export class FileStepComponent implements OnInit { getPreprintFilesLinks: FetchPreprintFilesLinks, uploadFile: UploadFile, reuploadFile: ReuploadFile, + fetchPreprintFile: FetchPreprintPrimaryFile, getAvailableProjects: FetchAvailableProjects, getFilesForSelectedProject: FetchProjectFiles, getProjectFilesByLink: FetchProjectFilesByLink, @@ -88,17 +90,31 @@ export class FileStepComponent implements OnInit { providerId = select(PreprintStepperSelectors.getSelectedProviderId); selectedFileSource = select(PreprintStepperSelectors.getSelectedFileSource); fileUploadLink = select(PreprintStepperSelectors.getUploadLink); - preprintFiles = select(PreprintStepperSelectors.getPreprintFiles); - arePreprintFilesLoading = select(PreprintStepperSelectors.arePreprintFilesLoading); + + preprintFile = select(PreprintStepperSelectors.getPreprintFile); + isPreprintFileLoading = select(PreprintStepperSelectors.isPreprintFilesLoading); + availableProjects = select(PreprintStepperSelectors.getAvailableProjects); areAvailableProjectsLoading = select(PreprintStepperSelectors.areAvailableProjectsLoading); + projectFiles = select(PreprintStepperSelectors.getProjectFiles); areProjectFilesLoading = select(PreprintStepperSelectors.areProjectFilesLoading); + currentFolder = select(PreprintStepperSelectors.getCurrentFolder); selectedProjectId = signal(null); versionFileMode = signal(false); + preprintHasPrimaryFile = computed(() => { + return !!this.preprint()?.primaryFileId; + }); + + cancelSourceOptionButtonVisible = computed(() => { + return ( + !this.preprintFile() && this.selectedFileSource() !== PreprintFileSource.None && !this.isPreprintFileLoading() + ); + }); + projectNameControl = new FormControl(null); filesTreeActions: FilesTreeActions = { @@ -119,7 +135,9 @@ export class FileStepComponent implements OnInit { ngOnInit() { this.actions.getPreprintFilesLinks(); - + if (this.preprintHasPrimaryFile() && !this.preprintFile()) { + this.actions.fetchPreprintFile(); + } this.projectNameControl.valueChanges .pipe(debounceTime(500), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)) .subscribe((projectNameOrId) => { @@ -159,9 +177,17 @@ export class FileStepComponent implements OnInit { if (this.versionFileMode()) { this.versionFileMode.set(false); - this.actions.reuploadFile(file); + this.actions.reuploadFile(file).subscribe({ + next: () => { + this.actions.fetchPreprintFile(); + }, + }); } else { - this.actions.uploadFile(file); + this.actions.uploadFile(file).subscribe({ + next: () => { + this.actions.fetchPreprintFile(); + }, + }); } } @@ -175,7 +201,11 @@ export class FileStepComponent implements OnInit { } selectProjectFile(file: OsfFile) { - this.actions.copyFileFromProject(file); + this.actions.copyFileFromProject(file).subscribe({ + next: () => { + this.actions.fetchPreprintFile(); + }, + }); } versionFile() { @@ -189,4 +219,12 @@ export class FileStepComponent implements OnInit { onReject: () => null, }); } + + cancelButtonClicked() { + if (this.preprintFile()) { + return; + } + + this.actions.setSelectedFileSource(PreprintFileSource.None); + } } diff --git a/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.html b/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.html index 7965285d4..5db80a58c 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.html +++ b/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.html @@ -10,6 +10,8 @@

{{ 'project.overview.metadata.contributors' | translate }}

@@ -20,12 +22,14 @@

{{ 'project.overview.metadata.contributors' | translate }}

} - + @if (isCurrentUserAdminContributor()) { + + }
diff --git a/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.ts b/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.ts index f9b813287..47dc7ee9c 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.ts +++ b/src/app/features/preprints/components/stepper/metadata-step/contributors/contributors.component.ts @@ -10,16 +10,27 @@ import { TableModule } from 'primeng/table'; import { filter, forkJoin } from 'rxjs'; -import { ChangeDetectionStrategy, Component, DestroyRef, effect, inject, input, OnInit, signal } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + computed, + DestroyRef, + effect, + inject, + input, + OnInit, + signal, +} from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; +import { UserSelectors } from '@core/store/user'; import { AddContributorDialogComponent, AddUnregisteredContributorDialogComponent, ContributorsListComponent, } from '@osf/shared/components/contributors'; -import { AddContributorType, ResourceType } from '@osf/shared/enums'; +import { AddContributorType, ContributorPermission, ResourceType } from '@osf/shared/enums'; import { findChangedItems } from '@osf/shared/helpers'; import { ContributorDialogAddModel, ContributorModel } from '@osf/shared/models'; import { CustomConfirmationService, ToastService } from '@osf/shared/services'; @@ -50,8 +61,18 @@ export class ContributorsComponent implements OnInit { initialContributors = select(ContributorsSelectors.getContributors); contributors = signal([]); + isContributorsLoading = select(ContributorsSelectors.isContributorsLoading); + currentUser = select(UserSelectors.getCurrentUser); + + isCurrentUserAdminContributor = computed(() => { + const currentUserId = this.currentUser()?.id; + const initialContributors = this.initialContributors(); + if (!currentUserId) return false; - readonly isContributorsLoading = select(ContributorsSelectors.isContributorsLoading); + return initialContributors.some((contributor: ContributorModel) => { + return contributor.userId === currentUserId && contributor.permission === ContributorPermission.Admin; + }); + }); actions = createDispatchMap({ getContributors: GetAllContributors, diff --git a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html index 1e2736c74..7bbba2f5b 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html +++ b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html @@ -10,8 +10,9 @@

{{ 'shared.license.title' | translate }}

{{ 'shared.license.description' | translate }}

{{ 'shared.license.helpText' | translate }} - {{ 'common.links.helpGuide' | translate }}. + + {{ 'common.links.helpGuide' | translate }}. +

{{ 'preprints.preprintStepper.metadata.affiliatedInstitutionsTitle' | translate }}

-

- {{ +

{{ 'preprints.preprintStepper.review.title' | translate | titlecase }}

{{ 'preprints.preprintStepper.review.learnMore' | translate }} - {{ - 'preprints.preprintStepper.review.moderationPolicies' | translate - }} + {{ 'preprints.preprintStepper.review.moderationPolicies' | translate }} {{ 'preprints.preprintStepper.review.supportCenter' | translate }}

@@ -61,7 +65,18 @@

{{ 'preprints.preprintStepper.review.sections.metadata.contributors' | trans
@for (contributor of bibliographicContributors(); track contributor.id) {
- {{ contributor.fullName }} + @if (contributor.isUnregisteredContributor) { + {{ contributor.fullName }} + } @else { + + {{ contributor.fullName }} + + } {{ $last ? '' : ',' }}
} @@ -69,7 +84,7 @@

{{ 'preprints.preprintStepper.review.sections.metadata.contributors' | trans @if (affiliatedInstitutions().length) { - + }
@@ -91,7 +106,7 @@

{{ 'preprints.preprintStepper.review.sections.metadata.license' | translate

{{ 'preprints.preprintStepper.review.sections.metadata.publicationDoi' | translate }}

- + {{ preprint()?.articleDoiLink }}
@@ -237,6 +252,7 @@

{{ 'preprints.preprintStepper.review.sections.supplements.title' | translate [disabled]="isPreprintSubmitting()" /> ; }); + readonly environment = environment; readonly ApplicabilityStatus = ApplicabilityStatus; readonly PreregLinkInfo = PreregLinkInfo; diff --git a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.html b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.html index 9ec112e1a..01bd85ba5 100644 --- a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.html +++ b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.html @@ -13,6 +13,7 @@

{{ 'preprints.preprintStepper.titleAndAbstract.title' | translate }}