From 3a079a0c0779095b5aa0773b3fd06e22f250188c Mon Sep 17 00:00:00 2001 From: mkovalua Date: Wed, 22 Oct 2025 22:49:04 +0300 Subject: [PATCH 01/31] fix & and > for text fields for metadata tab --- .../metadata-description/metadata-description.component.html | 2 +- .../metadata-description/metadata-description.component.ts | 4 ++-- .../components/metadata-title/metadata-title.component.html | 2 +- .../components/metadata-title/metadata-title.component.ts | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/features/metadata/components/metadata-description/metadata-description.component.html b/src/app/features/metadata/components/metadata-description/metadata-description.component.html index b1dd3143b..f74c20da0 100644 --- a/src/app/features/metadata/components/metadata-description/metadata-description.component.html +++ b/src/app/features/metadata/components/metadata-description/metadata-description.component.html @@ -13,6 +13,6 @@

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

- {{ description() || ('project.overview.metadata.noDescription' | translate) }} + {{ (description() | fixSpecialChar) || ('project.overview.metadata.noDescription' | translate) }}

diff --git a/src/app/features/metadata/components/metadata-description/metadata-description.component.ts b/src/app/features/metadata/components/metadata-description/metadata-description.component.ts index 27a06c164..d8bcaabcc 100644 --- a/src/app/features/metadata/components/metadata-description/metadata-description.component.ts +++ b/src/app/features/metadata/components/metadata-description/metadata-description.component.ts @@ -2,12 +2,12 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Button } from 'primeng/button'; import { Card } from 'primeng/card'; - +import { FixSpecialCharPipe } from '@shared/pipes'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; @Component({ selector: 'osf-metadata-description', - imports: [Card, Button, TranslatePipe], + imports: [Card, Button, FixSpecialCharPipe, TranslatePipe], templateUrl: './metadata-description.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) diff --git a/src/app/features/metadata/components/metadata-title/metadata-title.component.html b/src/app/features/metadata/components/metadata-title/metadata-title.component.html index 9f1e06f1a..91a677fd7 100644 --- a/src/app/features/metadata/components/metadata-title/metadata-title.component.html +++ b/src/app/features/metadata/components/metadata-title/metadata-title.component.html @@ -13,6 +13,6 @@

{{ 'common.labels.title' | translate }}

- {{ title() }} + {{ title() | fixSpecialChar }}

diff --git a/src/app/features/metadata/components/metadata-title/metadata-title.component.ts b/src/app/features/metadata/components/metadata-title/metadata-title.component.ts index b1864575c..d4dd0714d 100644 --- a/src/app/features/metadata/components/metadata-title/metadata-title.component.ts +++ b/src/app/features/metadata/components/metadata-title/metadata-title.component.ts @@ -4,10 +4,11 @@ import { Button } from 'primeng/button'; import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; +import { FixSpecialCharPipe } from '@shared/pipes'; @Component({ selector: 'osf-metadata-title', - imports: [Card, Button, TranslatePipe], + imports: [Card, Button, FixSpecialCharPipe, TranslatePipe], templateUrl: './metadata-title.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) From 4716d52d246a7fb1cc677c9cf8bb9fd865fb26da Mon Sep 17 00:00:00 2001 From: mkovalua Date: Thu, 23 Oct 2025 16:52:26 +0300 Subject: [PATCH 02/31] show correct < > & for registry text fields on rendering --- .../registries/components/review/review.component.html | 4 ++-- .../features/registries/components/review/review.component.ts | 2 ++ .../registration-blocks-data.component.html | 2 +- .../registration-blocks-data.component.ts | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/features/registries/components/review/review.component.html b/src/app/features/registries/components/review/review.component.html index 5f7c247bf..e64d92e46 100644 --- a/src/app/features/registries/components/review/review.component.html +++ b/src/app/features/registries/components/review/review.component.html @@ -4,7 +4,7 @@

{{ 'navigation.metadata' | translate }}

{{ 'common.labels.title' | translate }}

-

{{ draftRegistration()?.title }}

+

{{ draftRegistration()?.title | fixSpecialChar }}

@if (!draftRegistration()?.title) {

{{ 'common.labels.title' | translate }}

{{ 'common.labels.noData' | translate }}

@@ -16,7 +16,7 @@

{{ 'common.labels.title' | translate }}

{{ 'common.labels.description' | translate }}

-

{{ draftRegistration()?.description }}

+

{{ draftRegistration()?.description | fixSpecialChar }}

@if (!draftRegistration()?.description) {

{{ 'common.labels.noData' | translate }}

diff --git a/src/app/features/registries/components/review/review.component.ts b/src/app/features/registries/components/review/review.component.ts index cc8b2e29a..a2bbd098d 100644 --- a/src/app/features/registries/components/review/review.component.ts +++ b/src/app/features/registries/components/review/review.component.ts @@ -26,6 +26,7 @@ import { GetAllContributors, SubjectsSelectors, } from '@osf/shared/stores'; +import { FixSpecialCharPipe } from '@shared/pipes'; import { ClearState, @@ -53,6 +54,7 @@ import { SelectComponentsDialogComponent } from '../select-components-dialog/sel InterpolatePipe, RegistrationBlocksDataComponent, ContributorsListComponent, + FixSpecialCharPipe, ], templateUrl: './review.component.html', styleUrl: './review.component.scss', diff --git a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html index ec75249f2..4aaff05bf 100644 --- a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html +++ b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html @@ -36,7 +36,7 @@

} } @default { -

{{ reviewData()[question.responseKey!] }}

+

{{ reviewData()[question.responseKey!] | fixSpecialChar }}

} } } @else { diff --git a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts index 4d7d381b9..096ad56bf 100644 --- a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts +++ b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts @@ -8,10 +8,11 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; import { FieldType } from '@osf/shared/enums'; import { Question } from '@osf/shared/models'; +import { FixSpecialCharPipe } from '@shared/pipes'; @Component({ selector: 'osf-registration-blocks-data', - imports: [Tag, TranslatePipe, Message], + imports: [FixSpecialCharPipe, Tag, TranslatePipe, Message], templateUrl: './registration-blocks-data.component.html', styleUrl: './registration-blocks-data.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, From 7c7ccd452bbce201a7c03d62f01cbcdd678d7b8a Mon Sep 17 00:00:00 2001 From: Oleh Paduchak Date: Thu, 23 Oct 2025 16:57:50 +0300 Subject: [PATCH 03/31] fix(addons): fix citation root collection selection --- .../storage-item-selector.component.html | 33 +++++++++---------- .../storage-item-selector.component.ts | 26 ++++++++++++++- .../shared/enums/storage-item-type.enum.ts | 1 + 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html index c74bdb3ba..0d860844d 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html @@ -51,17 +51,16 @@

{{ 'settings.addons.configureAddon.folderName' | translate }}

{{ 'settings.addons.configureAddon.selectFolder' | translate }}

@if (operationInvocationResult().length) { - @for (folder of operationInvocationResult(); track folder.itemId) { - @let operationName = - folder.mayContainRootCandidates ? OperationNames.LIST_CHILD_ITEMS : OperationNames.GET_ITEM_INFO; - @let itemId = folder.itemId || '/'; - @let isLinkDisabled = !folder.mayContainRootCandidates || folder.itemType !== StorageItemType.Folder; + @for (resultItem of operationInvocationResult(); track resultItem.itemId) { + @let operationName = getOperationNameForItem(resultItem); + @let itemId = resultItem.itemId || '/'; + @let isLinkDisabled = isItemDisabled(resultItem);
diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts index 6d36a4dfb..d153d7f01 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts @@ -69,7 +69,7 @@ export class StorageItemSelectorComponent implements OnInit { operationInvocationResult = input.required(); accountNameControl = input(new FormControl()); isCreateMode = input(false); - currentAddonType = input(AddonType.STORAGE); + currentAddonType = input(AddonType.STORAGE); supportedResourceTypes = input([]); selectedStorageItemId = model('/'); @@ -259,6 +259,30 @@ export class StorageItemSelectorComponent implements OnInit { } } + isItemDisabled(item: StorageItem): boolean { + return !item.mayContainRootCandidates || !this.isDirectory(item); + } + + isDirectory(item: StorageItem): boolean { + return item.itemType === StorageItemType.Folder || item.itemType === StorageItemType.Collection; + } + + getOperationNameForItem(item: StorageItem): OperationNames | null { + const addonType = this.currentAddonType(); + if (addonType == AddonType.STORAGE || addonType === AddonType.LINK) { + if (item.mayContainRootCandidates) { + return OperationNames.LIST_CHILD_ITEMS; + } else { + return OperationNames.GET_ITEM_INFO; + } + } else if (addonType == AddonType.CITATION) { + if (item.mayContainRootCandidates) { + return OperationNames.LIST_COLLECTION_ITEMS; + } + } + return null; + } + private trimBreadcrumbs(itemId: string): void { const currentBreadcrumbs = this.breadcrumbItems(); diff --git a/src/app/shared/enums/storage-item-type.enum.ts b/src/app/shared/enums/storage-item-type.enum.ts index 91ab6cfcf..7c32fd2a3 100644 --- a/src/app/shared/enums/storage-item-type.enum.ts +++ b/src/app/shared/enums/storage-item-type.enum.ts @@ -2,5 +2,6 @@ export enum StorageItemType { Folder = 'FOLDER', Resource = 'RESOURCE', Document = 'DOCUMENT', + File = 'FILE', Collection = 'COLLECTION', } From b32d0942ef301615d1c25ae9491f22fc5c555928 Mon Sep 17 00:00:00 2001 From: mkovalua Date: Thu, 23 Oct 2025 17:09:41 +0300 Subject: [PATCH 04/31] render /my-projects?tab=1&page=1 with good title formatting --- .../my-projects-table/my-projects-table.component.html | 2 +- .../my-projects-table/my-projects-table.component.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/shared/components/my-projects-table/my-projects-table.component.html b/src/app/shared/components/my-projects-table/my-projects-table.component.html index d56a1cb68..f67b93b39 100644 --- a/src/app/shared/components/my-projects-table/my-projects-table.component.html +++ b/src/app/shared/components/my-projects-table/my-projects-table.component.html @@ -39,7 +39,7 @@

- {{ item.title }} + {{ item.title | fixSpecialChar }}

diff --git a/src/app/shared/components/my-projects-table/my-projects-table.component.ts b/src/app/shared/components/my-projects-table/my-projects-table.component.ts index 4bfaab38e..9ae8553aa 100644 --- a/src/app/shared/components/my-projects-table/my-projects-table.component.ts +++ b/src/app/shared/components/my-projects-table/my-projects-table.component.ts @@ -9,12 +9,13 @@ import { ChangeDetectionStrategy, Component, input, output } from '@angular/core import { SortOrder } from '@osf/shared/enums'; import { MyResourcesItem, TableParameters } from '@osf/shared/models'; +import { FixSpecialCharPipe } from '@shared/pipes'; import { IconComponent } from '../icon/icon.component'; @Component({ selector: 'osf-my-projects-table', - imports: [CommonModule, TableModule, IconComponent, Skeleton, TranslatePipe], + imports: [CommonModule, TableModule, IconComponent, Skeleton, TranslatePipe, FixSpecialCharPipe], templateUrl: './my-projects-table.component.html', styleUrl: './my-projects-table.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, From 9529652f4be0813250a484654138b7fcd7c31b35 Mon Sep 17 00:00:00 2001 From: mkovalua Date: Thu, 23 Oct 2025 17:15:23 +0300 Subject: [PATCH 05/31] render /my-preprints with good title formatting --- .../preprints/pages/my-preprints/my-preprints.component.html | 2 +- .../preprints/pages/my-preprints/my-preprints.component.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/features/preprints/pages/my-preprints/my-preprints.component.html b/src/app/features/preprints/pages/my-preprints/my-preprints.component.html index cef30ce96..a5f24cdcf 100644 --- a/src/app/features/preprints/pages/my-preprints/my-preprints.component.html +++ b/src/app/features/preprints/pages/my-preprints/my-preprints.component.html @@ -52,7 +52,7 @@ @if (item?.id) { - {{ item.title }} + {{ item.title | fixSpecialChar }} diff --git a/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts b/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts index 76178fb3e..7a8dbeb8f 100644 --- a/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts +++ b/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts @@ -7,6 +7,7 @@ import { Skeleton } from 'primeng/skeleton'; import { TableModule, TablePageEvent } from 'primeng/table'; import { debounceTime, distinctUntilChanged, skip } from 'rxjs'; +import { FixSpecialCharPipe } from '@shared/pipes'; import { DatePipe, TitleCasePipe } from '@angular/common'; import { @@ -43,6 +44,7 @@ import { FetchMyPreprints, PreprintSelectors } from '../../store/preprint'; DatePipe, ListInfoShortenerComponent, TitleCasePipe, + FixSpecialCharPipe, ], templateUrl: './my-preprints.component.html', styleUrl: './my-preprints.component.scss', From dc2a85bcabc6f56883aa7bfb71e1c55e5feaf73f Mon Sep 17 00:00:00 2001 From: mkovalua Date: Thu, 23 Oct 2025 18:41:48 +0300 Subject: [PATCH 06/31] render /my-registrations with good title formatting --- .../registration-blocks-data.component.html | 2 +- .../registration-card/registration-card.component.html | 2 +- .../components/registration-card/registration-card.component.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html index 4aaff05bf..33ae60402 100644 --- a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html +++ b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.html @@ -11,7 +11,7 @@

@if (reviewData()[question.responseKey!]) { @switch (question.fieldType) { @case (FieldType.Text) { -

{{ reviewData()[question.responseKey!] }}

+

{{ reviewData()[question.responseKey!] | fixSpecialChar }}

} @case (FieldType.Checkbox) { @for (option of reviewData()[question.responseKey!]; track option) { diff --git a/src/app/shared/components/registration-card/registration-card.component.html b/src/app/shared/components/registration-card/registration-card.component.html index f28b93ec2..48ee2de8c 100644 --- a/src/app/shared/components/registration-card/registration-card.component.html +++ b/src/app/shared/components/registration-card/registration-card.component.html @@ -5,7 +5,7 @@

- {{ registrationData().title || 'project.registrations.card.noTitle' | translate }} + {{ (registrationData().title | fixSpecialChar) || ('project.registrations.card.noTitle' | translate) }}

@if (!isDraft()) { diff --git a/src/app/shared/components/registration-card/registration-card.component.ts b/src/app/shared/components/registration-card/registration-card.component.ts index f5df0e9f5..6c85bf76e 100644 --- a/src/app/shared/components/registration-card/registration-card.component.ts +++ b/src/app/shared/components/registration-card/registration-card.component.ts @@ -20,6 +20,7 @@ import { DataResourcesComponent } from '../data-resources/data-resources.compone import { IconComponent } from '../icon/icon.component'; import { StatusBadgeComponent } from '../status-badge/status-badge.component'; import { TruncatedTextComponent } from '../truncated-text/truncated-text.component'; +import { FixSpecialCharPipe } from '@shared/pipes'; @Component({ selector: 'osf-registration-card', @@ -34,6 +35,7 @@ import { TruncatedTextComponent } from '../truncated-text/truncated-text.compone IconComponent, TruncatedTextComponent, ContributorsListComponent, + FixSpecialCharPipe, ], templateUrl: './registration-card.component.html', styleUrl: './registration-card.component.scss', From b0c63a60cc722da1b59063da0a93fe520b0c58d5 Mon Sep 17 00:00:00 2001 From: mkovalua Date: Thu, 23 Oct 2025 18:58:16 +0300 Subject: [PATCH 07/31] render preprint title with good title formatting --- .../pages/preprint-details/preprint-details.component.html | 2 +- .../pages/preprint-details/preprint-details.component.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.html b/src/app/features/preprints/pages/preprint-details/preprint-details.component.html index 38aaef76b..6f80e86d8 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.html +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.html @@ -17,7 +17,7 @@ height="36" [src]="preprintProvider()?.brand?.heroLogoImageUrl" /> -

{{ preprint()?.title }}

+

{{ preprint()?.title | fixSpecialChar }}

} diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts index 8db420ff6..0b241f9a2 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts @@ -58,6 +58,7 @@ import { DataciteService } from '@shared/services/datacite/datacite.service'; import { ContributorsSelectors } from '@shared/stores'; import { PreprintWarningBannerComponent } from '../../components/preprint-details/preprint-warning-banner/preprint-warning-banner.component'; +import { FixSpecialCharPipe } from '@shared/pipes'; @Component({ selector: 'osf-preprint-details', @@ -76,6 +77,7 @@ import { PreprintWarningBannerComponent } from '../../components/preprint-detail PreprintMakeDecisionComponent, PreprintMetricsInfoComponent, RouterLink, + FixSpecialCharPipe, ], templateUrl: './preprint-details.component.html', styleUrl: './preprint-details.component.scss', From 53ddd5aa0604a3a1c96f5040d9ae48207a503a42 Mon Sep 17 00:00:00 2001 From: mkovalua Date: Thu, 23 Oct 2025 20:55:08 +0300 Subject: [PATCH 08/31] use correct encoding on /search? elements rendering --- .../components/resource-card/resource-card.component.html | 2 +- .../components/resource-card/resource-card.component.ts | 2 ++ src/app/shared/components/select/select.component.html | 4 ++-- src/app/shared/components/select/select.component.ts | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/shared/components/resource-card/resource-card.component.html b/src/app/shared/components/resource-card/resource-card.component.html index dbe1167bf..279ab27ff 100644 --- a/src/app/shared/components/resource-card/resource-card.component.html +++ b/src/app/shared/components/resource-card/resource-card.component.html @@ -13,7 +13,7 @@

target="_blank" rel="noopener noreferrer" > - {{ displayTitle() }} + {{ displayTitle() | fixSpecialChar }}

diff --git a/src/app/shared/components/resource-card/resource-card.component.ts b/src/app/shared/components/resource-card/resource-card.component.ts index 55d01d1cf..5d026cf4e 100644 --- a/src/app/shared/components/resource-card/resource-card.component.ts +++ b/src/app/shared/components/resource-card/resource-card.component.ts @@ -25,6 +25,7 @@ import { PreprintSecondaryMetadataComponent } from './components/preprint-second import { ProjectSecondaryMetadataComponent } from './components/project-secondary-metadata/project-secondary-metadata.component'; import { RegistrationSecondaryMetadataComponent } from './components/registration-secondary-metadata/registration-secondary-metadata.component'; import { UserSecondaryMetadataComponent } from './components/user-secondary-metadata/user-secondary-metadata.component'; +import { FixSpecialCharPipe } from '@shared/pipes'; @Component({ selector: 'osf-resource-card', @@ -44,6 +45,7 @@ import { UserSecondaryMetadataComponent } from './components/user-secondary-meta PreprintSecondaryMetadataComponent, FileSecondaryMetadataComponent, StopPropagationDirective, + FixSpecialCharPipe, ], templateUrl: './resource-card.component.html', styleUrl: './resource-card.component.scss', diff --git a/src/app/shared/components/select/select.component.html b/src/app/shared/components/select/select.component.html index 75ceb01cb..a6ddb6200 100644 --- a/src/app/shared/components/select/select.component.html +++ b/src/app/shared/components/select/select.component.html @@ -12,10 +12,10 @@ [loading]="loading()" > - {{ selectedOption.label | translate }} + {{ selectedOption.label | fixSpecialChar | translate }} - {{ item.label | translate }} + {{ item.label | fixSpecialChar | translate }} diff --git a/src/app/shared/components/select/select.component.ts b/src/app/shared/components/select/select.component.ts index 0f0d87a05..1f259df01 100644 --- a/src/app/shared/components/select/select.component.ts +++ b/src/app/shared/components/select/select.component.ts @@ -7,10 +7,11 @@ import { FormsModule } from '@angular/forms'; import { Primitive } from '@osf/shared/helpers'; import { SelectOption } from '@osf/shared/models'; +import { FixSpecialCharPipe } from '@shared/pipes'; @Component({ selector: 'osf-select', - imports: [FormsModule, Select, TranslatePipe], + imports: [FormsModule, Select, TranslatePipe, FixSpecialCharPipe], templateUrl: './select.component.html', styleUrl: './select.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, From 29ab4b963a4545ed0a9c26dc27afb637f0cbca9b Mon Sep 17 00:00:00 2001 From: mkovalua Date: Mon, 27 Oct 2025 13:33:38 +0200 Subject: [PATCH 09/31] specify needed columns to extract for registation/preprint/project csv tsv downloading for /institutions/cos/dashboard/ --- .../helpers/download-url.helper.ts | 13 +++++++++++-- .../institutions-preprints.component.ts | 13 ++++++++++++- .../institutions-projects.component.ts | 17 ++++++++++++++++- .../institutions-registrations.component.ts | 17 ++++++++++++++++- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/app/features/admin-institutions/helpers/download-url.helper.ts b/src/app/features/admin-institutions/helpers/download-url.helper.ts index 1ea3ebf56..614269970 100644 --- a/src/app/features/admin-institutions/helpers/download-url.helper.ts +++ b/src/app/features/admin-institutions/helpers/download-url.helper.ts @@ -1,7 +1,12 @@ import { DOWNLOAD_FORMATS } from '../constants'; import { DownloadType } from '../enums'; -export function downloadResults(downloadUrl: string | null, type: DownloadType) { +export function downloadResults( + downloadUrl: string | null, + type: DownloadType, + fields: string[], + resourceType: string +) { if (!downloadUrl) { return; } @@ -12,7 +17,11 @@ export function downloadResults(downloadUrl: string | null, type: DownloadType) cardSearchUrl.searchParams.set('page[size]', '10000'); cardSearchUrl.searchParams.set('page[cursor]', ''); cardSearchUrl.searchParams.set('acceptMediatype', format); - cardSearchUrl.searchParams.set('withFileName', `projects-search-results`); + cardSearchUrl.searchParams.set('withFileName', `${resourceType.toLowerCase()}s-search-results`); + + if (type === DownloadType.CSV || type === DownloadType.TSV) { + cardSearchUrl.searchParams.set(`fields[${resourceType}]`, fields.join(',')); + } const downloadLink = cardSearchUrl.toString(); window.open(downloadLink, '_blank'); diff --git a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts index da2e9a868..3c9e64973 100644 --- a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts @@ -105,6 +105,17 @@ export class InstitutionsPreprintsComponent implements OnInit, OnDestroy { } download(type: DownloadType) { - downloadResults(this.selfLink(), type); + const fields = [ + 'title', + 'dateCreated', + 'dateModified', + 'sameAs', + 'rights.name', + 'creator.name', + 'usage.viewCount', + 'usage.downloadCount', + ]; + const resourceType = 'Preprint'; + downloadResults(this.selfLink(), type, fields, resourceType); } } diff --git a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts index 47dfddafb..0bf03c08e 100644 --- a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts @@ -128,7 +128,22 @@ export class InstitutionsProjectsComponent implements OnInit, OnDestroy { } download(type: DownloadType) { - downloadResults(this.selfLink(), type); + const fields = [ + 'title', + 'dateCreated', + 'dateModified', + 'sameAs', + 'storageRegion.prefLabel', + 'storageByteCount', + 'creator.name', + 'usage.viewCount', + 'resourceNature.displayLabel', + 'rights.name', + 'hasOsfAddon.prefLabel', + 'funder.name', + ]; + const resourceType = 'Project'; + downloadResults(this.selfLink(), type, fields, resourceType); } onIconClick(event: TableIconClickEvent): void { diff --git a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts index a48f36e43..496f2960c 100644 --- a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts @@ -106,6 +106,21 @@ export class InstitutionsRegistrationsComponent implements OnInit, OnDestroy { } download(type: DownloadType) { - downloadResults(this.selfLink(), type); + const fields = [ + 'title', + 'dateCreated', + 'dateModified', + 'sameAs', + 'storageRegion.prefLabel', + 'storageByteCount', + 'creator.name', + 'usage.viewCount', + 'resourceNature.displayLabel', + 'rights.name', + 'funder.name', + 'conformsTo.title', + ]; + const resourceType = 'Registration'; + downloadResults(this.selfLink(), type, fields, resourceType); } } From 5b1cccbc598f5cfbd2baf1f653f032813c01128b Mon Sep 17 00:00:00 2001 From: Andriy Sheredko Date: Mon, 27 Oct 2025 13:53:21 +0200 Subject: [PATCH 10/31] fix(curator_delete_project_button_permissions): fix delete button visibility for curators on project settings page --- .../settings-project-form-card.component.html | 2 +- .../settings-project-form-card.component.ts | 4 +++- src/app/features/project/settings/settings.component.html | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html index 6dcfc1e3b..c7abf8e90 100644 --- a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html +++ b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html @@ -33,7 +33,7 @@

{{ 'myProjects.settings.project' | translate }}

>
-
+
diff --git a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts index d7b0e22a7..9599c9f9d 100644 --- a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts +++ b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts @@ -3,6 +3,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Button } from 'primeng/button'; import { Card } from 'primeng/card'; import { Textarea } from 'primeng/textarea'; +import { NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, effect, input, output } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; @@ -16,7 +17,7 @@ import { NodeDetailsModel, ProjectDetailsModel } from '../../models'; @Component({ selector: 'osf-settings-project-form-card', - imports: [Button, Card, Textarea, TranslatePipe, ReactiveFormsModule, TextInputComponent], + imports: [Button, Card, Textarea, TranslatePipe, ReactiveFormsModule, TextInputComponent, NgIf], templateUrl: './settings-project-form-card.component.html', styleUrl: 'settings-project-form-card.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, @@ -25,6 +26,7 @@ export class SettingsProjectFormCardComponent { projectDetails = input.required(); submitForm = output(); deleteProject = output(); + canDelete = input(false); readonly ProjectFormControls = ProjectFormControls; readonly inputLimits = InputLimits; diff --git a/src/app/features/project/settings/settings.component.html b/src/app/features/project/settings/settings.component.html index 3c1b3f8b4..2aecf4770 100644 --- a/src/app/features/project/settings/settings.component.html +++ b/src/app/features/project/settings/settings.component.html @@ -10,6 +10,7 @@ (submitForm)="submitForm($event)" (deleteProject)="deleteProject()" [projectDetails]="projectDetails()" + [canDelete]="hasAdminAccess()" /> Date: Mon, 27 Oct 2025 14:11:15 +0200 Subject: [PATCH 11/31] add link to user (JSON has an api link to the user, but the other two don't contain the user guid (labeled OSF Link in the table)) --- .../institutions-preprints/institutions-preprints.component.ts | 1 + .../institutions-projects/institutions-projects.component.ts | 1 + .../institutions-registrations.component.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts index 3c9e64973..a60665ffc 100644 --- a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts @@ -111,6 +111,7 @@ export class InstitutionsPreprintsComponent implements OnInit, OnDestroy { 'dateModified', 'sameAs', 'rights.name', + 'creator.@id', 'creator.name', 'usage.viewCount', 'usage.downloadCount', diff --git a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts index 0bf03c08e..2fe02cd16 100644 --- a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts @@ -135,6 +135,7 @@ export class InstitutionsProjectsComponent implements OnInit, OnDestroy { 'sameAs', 'storageRegion.prefLabel', 'storageByteCount', + 'creator.@id', 'creator.name', 'usage.viewCount', 'resourceNature.displayLabel', diff --git a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts index 496f2960c..364490f6c 100644 --- a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts @@ -113,6 +113,7 @@ export class InstitutionsRegistrationsComponent implements OnInit, OnDestroy { 'sameAs', 'storageRegion.prefLabel', 'storageByteCount', + 'creator.@id', 'creator.name', 'usage.viewCount', 'resourceNature.displayLabel', From 8c5fc4eb2d97194a27772b0a324f21937befecbf Mon Sep 17 00:00:00 2001 From: mkovalua Date: Mon, 27 Oct 2025 18:14:00 +0200 Subject: [PATCH 12/31] resolve CR comments --- .../helpers/download-url.helper.ts | 71 ++++++++++++++++++- .../institutions-preprints.component.ts | 24 +++---- .../institutions-projects.component.ts | 27 +++---- .../institutions-registrations.component.ts | 27 +++---- 4 files changed, 93 insertions(+), 56 deletions(-) diff --git a/src/app/features/admin-institutions/helpers/download-url.helper.ts b/src/app/features/admin-institutions/helpers/download-url.helper.ts index 614269970..f14202706 100644 --- a/src/app/features/admin-institutions/helpers/download-url.helper.ts +++ b/src/app/features/admin-institutions/helpers/download-url.helper.ts @@ -1,11 +1,76 @@ import { DOWNLOAD_FORMATS } from '../constants'; import { DownloadType } from '../enums'; +import { CurrentResourceType } from '@shared/enums'; + +interface ResourceNameText { + singular_upper: string; + plural_lower: string; +} + +export const INSTITUTIONS_CSV_TSV_FIELDS = { + [CurrentResourceType.Preprints]: [ + 'title', + 'dateCreated', + 'dateModified', + 'sameAs', + 'rights.name', + 'creator.@id', + 'creator.name', + 'usage.viewCount', + 'usage.downloadCount', + ], + [CurrentResourceType.Projects]: [ + 'title', + 'dateCreated', + 'dateModified', + 'sameAs', + 'storageRegion.prefLabel', + 'storageByteCount', + 'creator.@id', + 'creator.name', + 'usage.viewCount', + 'resourceNature.displayLabel', + 'rights.name', + 'hasOsfAddon.prefLabel', + 'funder.name', + ], + [CurrentResourceType.Registrations]: [ + 'title', + 'dateCreated', + 'dateModified', + 'sameAs', + 'storageRegion.prefLabel', + 'storageByteCount', + 'creator.@id', + 'creator.name', + 'usage.viewCount', + 'resourceNature.displayLabel', + 'rights.name', + 'funder.name', + 'conformsTo.title', + ], +}; + +export const INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE = { + [CurrentResourceType.Projects]: { + singular_upper: 'Project', + plural_lower: 'projects', + }, + [CurrentResourceType.Registrations]: { + singular_upper: 'Registration', + plural_lower: 'registrations', + }, + [CurrentResourceType.Preprints]: { + singular_upper: 'Preprint', + plural_lower: 'preprints', + }, +}; export function downloadResults( downloadUrl: string | null, type: DownloadType, fields: string[], - resourceType: string + resourceNameText: ResourceNameText ) { if (!downloadUrl) { return; @@ -17,10 +82,10 @@ export function downloadResults( cardSearchUrl.searchParams.set('page[size]', '10000'); cardSearchUrl.searchParams.set('page[cursor]', ''); cardSearchUrl.searchParams.set('acceptMediatype', format); - cardSearchUrl.searchParams.set('withFileName', `${resourceType.toLowerCase()}s-search-results`); + cardSearchUrl.searchParams.set('withFileName', `${resourceNameText.plural_lower}-search-results`); if (type === DownloadType.CSV || type === DownloadType.TSV) { - cardSearchUrl.searchParams.set(`fields[${resourceType}]`, fields.join(',')); + cardSearchUrl.searchParams.set(`fields[${resourceNameText.singular_upper}]`, fields.join(',')); } const downloadLink = cardSearchUrl.toString(); diff --git a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts index a60665ffc..b601e20a9 100644 --- a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts @@ -7,7 +7,7 @@ import { Button } from 'primeng/button'; import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, OnDestroy, OnInit, signal } from '@angular/core'; -import { ResourceType, SortOrder } from '@osf/shared/enums'; +import { CurrentResourceType, ResourceType, SortOrder } from '@osf/shared/enums'; import { PaginationLinksModel, ResourceModel, SearchFilters } from '@osf/shared/models'; import { FetchResources, @@ -23,10 +23,11 @@ import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { preprintsTableColumns } from '../../constants'; import { DownloadType } from '../../enums'; -import { downloadResults } from '../../helpers'; +import { INSTITUTIONS_CSV_TSV_FIELDS, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE, downloadResults } from '../../helpers'; import { mapPreprintResourceToTableData } from '../../mappers/institution-preprint-to-table-data.mapper'; import { TableCellData } from '../../models'; import { InstitutionsAdminSelectors } from '../../store'; +import { CurrentResourceSelectors } from '@shared/stores/current-resource'; @Component({ selector: 'osf-institutions-preprints', @@ -105,18 +106,11 @@ export class InstitutionsPreprintsComponent implements OnInit, OnDestroy { } download(type: DownloadType) { - const fields = [ - 'title', - 'dateCreated', - 'dateModified', - 'sameAs', - 'rights.name', - 'creator.@id', - 'creator.name', - 'usage.viewCount', - 'usage.downloadCount', - ]; - const resourceType = 'Preprint'; - downloadResults(this.selfLink(), type, fields, resourceType); + downloadResults( + this.selfLink(), + type, + INSTITUTIONS_CSV_TSV_FIELDS[CurrentResourceType.Preprints], + INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE[CurrentResourceType.Preprints] + ); } } diff --git a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts index 2fe02cd16..00dd64b5a 100644 --- a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts @@ -21,7 +21,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { UserSelectors } from '@core/store/user'; import { RequestAccessErrorDialogComponent } from '@osf/features/admin-institutions/components/request-access-error-dialog/request-access-error-dialog.component'; -import { ResourceType, SortOrder } from '@osf/shared/enums'; +import { CurrentResourceType, ResourceType, SortOrder } from '@osf/shared/enums'; import { PaginationLinksModel, ResourceModel, SearchFilters } from '@osf/shared/models'; import { CustomDialogService, ToastService } from '@osf/shared/services'; import { @@ -39,7 +39,7 @@ import { FiltersSectionComponent } from '../../components/filters-section/filter import { projectTableColumns } from '../../constants'; import { ContactDialogComponent } from '../../dialogs'; import { ContactOption, DownloadType } from '../../enums'; -import { downloadResults } from '../../helpers'; +import { INSTITUTIONS_CSV_TSV_FIELDS, downloadResults, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; import { mapProjectResourceToTableCellData } from '../../mappers/institution-project-to-table-data.mapper'; import { ContactDialogData, TableCellData, TableCellLink, TableIconClickEvent } from '../../models'; import { InstitutionsAdminSelectors, RequestProjectAccess, SendUserMessage } from '../../store'; @@ -128,23 +128,12 @@ export class InstitutionsProjectsComponent implements OnInit, OnDestroy { } download(type: DownloadType) { - const fields = [ - 'title', - 'dateCreated', - 'dateModified', - 'sameAs', - 'storageRegion.prefLabel', - 'storageByteCount', - 'creator.@id', - 'creator.name', - 'usage.viewCount', - 'resourceNature.displayLabel', - 'rights.name', - 'hasOsfAddon.prefLabel', - 'funder.name', - ]; - const resourceType = 'Project'; - downloadResults(this.selfLink(), type, fields, resourceType); + downloadResults( + this.selfLink(), + type, + INSTITUTIONS_CSV_TSV_FIELDS[CurrentResourceType.Projects], + INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE[CurrentResourceType.Projects] + ); } onIconClick(event: TableIconClickEvent): void { diff --git a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts index 364490f6c..74c265e4e 100644 --- a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts @@ -8,7 +8,7 @@ import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, OnDestroy, OnInit, signal } from '@angular/core'; import { TableCellData } from '@osf/features/admin-institutions/models'; -import { ResourceType, SortOrder } from '@osf/shared/enums'; +import { CurrentResourceType, ResourceType, SortOrder } from '@osf/shared/enums'; import { PaginationLinksModel, ResourceModel, SearchFilters } from '@osf/shared/models'; import { ClearFilterSearchResults, @@ -25,7 +25,7 @@ import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { registrationTableColumns } from '../../constants'; import { DownloadType } from '../../enums'; -import { downloadResults } from '../../helpers'; +import { INSTITUTIONS_CSV_TSV_FIELDS, downloadResults, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; import { mapRegistrationResourceToTableData } from '../../mappers/institution-registration-to-table-data.mapper'; import { InstitutionsAdminSelectors } from '../../store'; @@ -106,22 +106,11 @@ export class InstitutionsRegistrationsComponent implements OnInit, OnDestroy { } download(type: DownloadType) { - const fields = [ - 'title', - 'dateCreated', - 'dateModified', - 'sameAs', - 'storageRegion.prefLabel', - 'storageByteCount', - 'creator.@id', - 'creator.name', - 'usage.viewCount', - 'resourceNature.displayLabel', - 'rights.name', - 'funder.name', - 'conformsTo.title', - ]; - const resourceType = 'Registration'; - downloadResults(this.selfLink(), type, fields, resourceType); + downloadResults( + this.selfLink(), + type, + INSTITUTIONS_CSV_TSV_FIELDS[CurrentResourceType.Registrations], + INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE[CurrentResourceType.Registrations] + ); } } From 98282b55d5812ca8bd9bef0cf0252b64a109eb79 Mon Sep 17 00:00:00 2001 From: Andriy Sheredko Date: Tue, 28 Oct 2025 14:46:14 +0200 Subject: [PATCH 13/31] fix(curator_delete_project_button_permissions): fix delete button visibility for curators on project settings page --- .../settings-project-form-card.component.html | 8 +++++--- .../settings-project-form-card.component.ts | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html index c7abf8e90..cdc49e571 100644 --- a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html +++ b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.html @@ -33,8 +33,10 @@

{{ 'myProjects.settings.project' | translate }}

>
-
- -
+ @if (canDelete()) { +
+ +
+ } diff --git a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts index 9599c9f9d..df198ca1a 100644 --- a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts +++ b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts @@ -3,7 +3,6 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Button } from 'primeng/button'; import { Card } from 'primeng/card'; import { Textarea } from 'primeng/textarea'; -import { NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, effect, input, output } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; @@ -17,7 +16,7 @@ import { NodeDetailsModel, ProjectDetailsModel } from '../../models'; @Component({ selector: 'osf-settings-project-form-card', - imports: [Button, Card, Textarea, TranslatePipe, ReactiveFormsModule, TextInputComponent, NgIf], + imports: [Button, Card, Textarea, TranslatePipe, ReactiveFormsModule, TextInputComponent], templateUrl: './settings-project-form-card.component.html', styleUrl: 'settings-project-form-card.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, From d08f9ddd9c7b6b3b47e201eca95e3d60f72a7efb Mon Sep 17 00:00:00 2001 From: mkovalua Date: Tue, 28 Oct 2025 14:56:15 +0200 Subject: [PATCH 14/31] npm run lint:format --- .../features/admin-institutions/helpers/download-url.helper.ts | 3 ++- .../institutions-preprints/institutions-preprints.component.ts | 3 +-- .../institutions-projects/institutions-projects.component.ts | 2 +- .../institutions-registrations.component.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/features/admin-institutions/helpers/download-url.helper.ts b/src/app/features/admin-institutions/helpers/download-url.helper.ts index f14202706..7bdac62e4 100644 --- a/src/app/features/admin-institutions/helpers/download-url.helper.ts +++ b/src/app/features/admin-institutions/helpers/download-url.helper.ts @@ -1,6 +1,7 @@ +import { CurrentResourceType } from '@shared/enums'; + import { DOWNLOAD_FORMATS } from '../constants'; import { DownloadType } from '../enums'; -import { CurrentResourceType } from '@shared/enums'; interface ResourceNameText { singular_upper: string; diff --git a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts index b601e20a9..8da5f03c3 100644 --- a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts @@ -23,11 +23,10 @@ import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { preprintsTableColumns } from '../../constants'; import { DownloadType } from '../../enums'; -import { INSTITUTIONS_CSV_TSV_FIELDS, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE, downloadResults } from '../../helpers'; +import { downloadResults, INSTITUTIONS_CSV_TSV_FIELDS, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; import { mapPreprintResourceToTableData } from '../../mappers/institution-preprint-to-table-data.mapper'; import { TableCellData } from '../../models'; import { InstitutionsAdminSelectors } from '../../store'; -import { CurrentResourceSelectors } from '@shared/stores/current-resource'; @Component({ selector: 'osf-institutions-preprints', diff --git a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts index 00dd64b5a..455455e31 100644 --- a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts @@ -39,7 +39,7 @@ import { FiltersSectionComponent } from '../../components/filters-section/filter import { projectTableColumns } from '../../constants'; import { ContactDialogComponent } from '../../dialogs'; import { ContactOption, DownloadType } from '../../enums'; -import { INSTITUTIONS_CSV_TSV_FIELDS, downloadResults, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; +import { downloadResults, INSTITUTIONS_CSV_TSV_FIELDS, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; import { mapProjectResourceToTableCellData } from '../../mappers/institution-project-to-table-data.mapper'; import { ContactDialogData, TableCellData, TableCellLink, TableIconClickEvent } from '../../models'; import { InstitutionsAdminSelectors, RequestProjectAccess, SendUserMessage } from '../../store'; diff --git a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts index 74c265e4e..6461ba964 100644 --- a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts @@ -25,7 +25,7 @@ import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { registrationTableColumns } from '../../constants'; import { DownloadType } from '../../enums'; -import { INSTITUTIONS_CSV_TSV_FIELDS, downloadResults, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; +import { downloadResults, INSTITUTIONS_CSV_TSV_FIELDS, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; import { mapRegistrationResourceToTableData } from '../../mappers/institution-registration-to-table-data.mapper'; import { InstitutionsAdminSelectors } from '../../store'; From ba5eae9b751d6ccafbabbc2f49e45be3a8b3ce0a Mon Sep 17 00:00:00 2001 From: nsemets Date: Wed, 29 Oct 2025 17:35:48 +0200 Subject: [PATCH 15/31] [ENG-9641] Moderation queues do not show more than 10 contributors (#722) - Ticket: [ENG-9641] - Feature flag: n/a ## Summary of Changes 1. Added load more for preprint modetation. --- .../preprint-submission-item.component.html | 14 ++-- .../preprint-submission-item.component.ts | 10 ++- .../preprint-submissions.component.html | 1 + .../preprint-submissions.component.spec.ts | 34 +++++++-- .../preprint-submissions.component.ts | 6 ++ ...rint-withdrawal-submissions.component.html | 1 + ...t-withdrawal-submissions.component.spec.ts | 32 ++++++++- ...eprint-withdrawal-submissions.component.ts | 6 ++ .../models/preprint-submission.model.ts | 1 + .../preprint-withdrawal-submission.model.ts | 1 + .../preprint-moderation.actions.ts | 19 +++++ .../preprint-moderation.state.ts | 54 +++++++++++--- .../contributors-list.component.html | 3 +- src/testing/mocks/index.ts | 1 + src/testing/mocks/preprint-submission.mock.ts | 70 +++++++++++++++++++ .../preprint-withdrawal-submission.mock.ts | 12 ++++ 16 files changed, 241 insertions(+), 24 deletions(-) create mode 100644 src/testing/mocks/preprint-submission.mock.ts diff --git a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html index 8de29f158..ab1ad39ef 100644 --- a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html +++ b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.html @@ -39,14 +39,16 @@ -
+

{{ 'common.labels.contributors' | translate }}:

- @if (submission().contributorsLoading) { - - } @else { - - } + +
diff --git a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts index 4541bb200..509c1e144 100644 --- a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts +++ b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts @@ -2,9 +2,8 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Accordion, AccordionContent, AccordionHeader, AccordionPanel } from 'primeng/accordion'; import { Button } from 'primeng/button'; -import { Skeleton } from 'primeng/skeleton'; -import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; +import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; import { ContributorsListComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components'; import { StopPropagationDirective } from '@osf/shared/directives'; @@ -27,7 +26,6 @@ import { PreprintSubmissionModel, PreprintWithdrawalSubmission } from '../../mod AccordionHeader, AccordionContent, ContributorsListComponent, - Skeleton, StopPropagationDirective, ], templateUrl: './preprint-submission-item.component.html', @@ -39,6 +37,7 @@ export class PreprintSubmissionItemComponent { submission = input.required(); selected = output(); loadContributors = output(); + loadMoreContributors = output(); readonly reviewStatusIcon = ReviewStatusIcon; readonly actionLabel = PREPRINT_ACTION_LABEL; @@ -47,6 +46,11 @@ export class PreprintSubmissionItemComponent { limitValue = 1; showAll = false; + hasMoreContributors = computed(() => { + const submission = this.submission(); + return submission.contributors.length < submission.totalContributors; + }); + toggleHistory() { this.showAll = !this.showAll; } diff --git a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.html b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.html index 51c7dc27f..989764d85 100644 --- a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.html +++ b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.html @@ -41,6 +41,7 @@ [status]="selectedReviewOption()" (selected)="navigateToPreprint(item)" (loadContributors)="loadContributors(item)" + (loadMoreContributors)="loadMoreContributors(item)" >
} diff --git a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts index 27d867b67..95f36ff18 100644 --- a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts +++ b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts @@ -1,18 +1,24 @@ +import { Store } from '@ngxs/store'; + import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { PreprintSubmissionItemComponent } from '@osf/features/moderation/components'; -import { RegistryModeration } from '@osf/features/moderation/models'; +import { PreprintSubmissionModel } from '@osf/features/moderation/models'; import { CustomPaginatorComponent, IconComponent, LoadingSpinnerComponent, SelectComponent } from '@shared/components'; import { PreprintSubmissionsSort, SubmissionReviewStatus } from '../../enums'; -import { PreprintModerationSelectors } from '../../store/preprint-moderation'; +import { + GetPreprintSubmissionContributors, + LoadMorePreprintSubmissionContributors, + PreprintModerationSelectors, +} from '../../store/preprint-moderation'; import { PreprintSubmissionsComponent } from './preprint-submissions.component'; -import { MOCK_REGISTRY_MODERATIONS } from '@testing/mocks/registry-moderation.mock'; +import { MOCK_PREPRINT_SUBMISSIONS } from '@testing/mocks/preprint-submission.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { RouterMockBuilder } from '@testing/providers/router-provider.mock'; @@ -23,9 +29,10 @@ describe('PreprintSubmissionsComponent', () => { let fixture: ComponentFixture; let mockRouter: ReturnType; let mockActivatedRoute: ReturnType; + let store: Store; const mockProviderId = 'test-provider-id'; - const mockSubmissions: RegistryModeration[] = MOCK_REGISTRY_MODERATIONS; + const mockSubmissions: PreprintSubmissionModel[] = MOCK_PREPRINT_SUBMISSIONS; beforeEach(async () => { mockRouter = RouterMockBuilder.create().build(); @@ -64,6 +71,7 @@ describe('PreprintSubmissionsComponent', () => { fixture = TestBed.createComponent(PreprintSubmissionsComponent); component = fixture.componentInstance; + store = TestBed.inject(Store); fixture.detectChanges(); }); @@ -143,4 +151,22 @@ describe('PreprintSubmissionsComponent', () => { expect(component.currentPage()).toBe(1); expect(component.first()).toBe(0); }); + + it('should load contributors for a submission', () => { + const mockItem = mockSubmissions[0]; + const dispatchSpy = jest.spyOn(store, 'dispatch'); + + component.loadContributors(mockItem); + + expect(dispatchSpy).toHaveBeenCalledWith(new GetPreprintSubmissionContributors(mockItem.id)); + }); + + it('should load more contributors for a submission', () => { + const mockItem = mockSubmissions[0]; + const dispatchSpy = jest.spyOn(store, 'dispatch'); + + component.loadMoreContributors(mockItem); + + expect(dispatchSpy).toHaveBeenCalledWith(new LoadMorePreprintSubmissionContributors(mockItem.id)); + }); }); diff --git a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts index 094fcd2fd..a4bb80458 100644 --- a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts +++ b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts @@ -28,6 +28,7 @@ import { PreprintSubmissionModel } from '../../models'; import { GetPreprintSubmissionContributors, GetPreprintSubmissions, + LoadMorePreprintSubmissionContributors, PreprintModerationSelectors, } from '../../store/preprint-moderation'; @@ -60,6 +61,7 @@ export class PreprintSubmissionsComponent implements OnInit { readonly actions = createDispatchMap({ getPreprintSubmissions: GetPreprintSubmissions, getPreprintSubmissionContributors: GetPreprintSubmissionContributors, + loadMorePreprintSubmissionContributors: LoadMorePreprintSubmissionContributors, }); readonly submissions = select(PreprintModerationSelectors.getPreprintSubmissions); @@ -131,6 +133,10 @@ export class PreprintSubmissionsComponent implements OnInit { this.actions.getPreprintSubmissionContributors(item.id); } + loadMoreContributors(item: PreprintSubmissionModel) { + this.actions.loadMorePreprintSubmissionContributors(item.id); + } + private getStatusFromQueryParams() { const queryParams = this.route.snapshot.queryParams; const statusValues = Object.values(SubmissionReviewStatus); diff --git a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.html b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.html index 01e06c618..0557fecaf 100644 --- a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.html +++ b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.html @@ -41,6 +41,7 @@ [status]="selectedReviewOption()" (selected)="navigateToPreprint(item)" (loadContributors)="loadContributors(item)" + (loadMoreContributors)="loadMoreContributors(item)" >

} diff --git a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts index dcc2e0e35..d493700b6 100644 --- a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts +++ b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts @@ -1,3 +1,5 @@ +import { Store } from '@ngxs/store'; + import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; @@ -8,7 +10,11 @@ import { PreprintWithdrawalSubmission } from '@osf/features/moderation/models'; import { CustomPaginatorComponent, IconComponent, LoadingSpinnerComponent, SelectComponent } from '@shared/components'; import { PreprintSubmissionsSort, SubmissionReviewStatus } from '../../enums'; -import { PreprintModerationSelectors } from '../../store/preprint-moderation'; +import { + GetPreprintWithdrawalSubmissionContributors, + LoadMorePreprintWithdrawalSubmissionContributors, + PreprintModerationSelectors, +} from '../../store/preprint-moderation'; import { PreprintWithdrawalSubmissionsComponent } from './preprint-withdrawal-submissions.component'; @@ -23,6 +29,7 @@ describe('PreprintWithdrawalSubmissionsComponent', () => { let fixture: ComponentFixture; let mockRouter: ReturnType; let mockActivatedRoute: ReturnType; + let store: Store; const mockProviderId = 'test-provider-id'; const mockSubmissions: PreprintWithdrawalSubmission[] = MOCK_PREPRINT_WITHDRAWAL_SUBMISSIONS; @@ -74,6 +81,7 @@ describe('PreprintWithdrawalSubmissionsComponent', () => { fixture = TestBed.createComponent(PreprintWithdrawalSubmissionsComponent); component = fixture.componentInstance; + store = TestBed.inject(Store); fixture.detectChanges(); }); @@ -164,4 +172,26 @@ describe('PreprintWithdrawalSubmissionsComponent', () => { expect(component.currentPage()).toBe(1); expect(component.first()).toBe(0); }); + + it('should load contributors for a withdrawal submission', () => { + const mockItem = mockSubmissions[0]; + const dispatchSpy = jest.spyOn(store, 'dispatch'); + + component.loadContributors(mockItem); + + expect(dispatchSpy).toHaveBeenCalledWith( + new GetPreprintWithdrawalSubmissionContributors(mockItem.id, mockItem.preprintId) + ); + }); + + it('should load more contributors for a withdrawal submission', () => { + const mockItem = mockSubmissions[0]; + const dispatchSpy = jest.spyOn(store, 'dispatch'); + + component.loadMoreContributors(mockItem); + + expect(dispatchSpy).toHaveBeenCalledWith( + new LoadMorePreprintWithdrawalSubmissionContributors(mockItem.id, mockItem.preprintId) + ); + }); }); diff --git a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts index 3517a572b..6bb394055 100644 --- a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts +++ b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts @@ -27,6 +27,7 @@ import { PreprintWithdrawalSubmission } from '../../models'; import { GetPreprintWithdrawalSubmissionContributors, GetPreprintWithdrawalSubmissions, + LoadMorePreprintWithdrawalSubmissionContributors, PreprintModerationSelectors, } from '../../store/preprint-moderation'; import { PreprintSubmissionItemComponent } from '../preprint-submission-item/preprint-submission-item.component'; @@ -60,6 +61,7 @@ export class PreprintWithdrawalSubmissionsComponent implements OnInit { readonly actions = createDispatchMap({ getPreprintWithdrawalSubmissions: GetPreprintWithdrawalSubmissions, getPreprintWithdrawalSubmissionContributors: GetPreprintWithdrawalSubmissionContributors, + loadMorePreprintWithdrawalSubmissionContributors: LoadMorePreprintWithdrawalSubmissionContributors, }); readonly submissions = select(PreprintModerationSelectors.getPreprintWithdrawalSubmissions); @@ -128,6 +130,10 @@ export class PreprintWithdrawalSubmissionsComponent implements OnInit { this.actions.getPreprintWithdrawalSubmissionContributors(item.id, item.preprintId); } + loadMoreContributors(item: PreprintWithdrawalSubmission) { + this.actions.loadMorePreprintWithdrawalSubmissionContributors(item.id, item.preprintId); + } + private getStatusFromQueryParams() { const queryParams = this.route.snapshot.queryParams; const statusValues = Object.values(SubmissionReviewStatus); diff --git a/src/app/features/moderation/models/preprint-submission.model.ts b/src/app/features/moderation/models/preprint-submission.model.ts index 998a1fa8f..da61aae40 100644 --- a/src/app/features/moderation/models/preprint-submission.model.ts +++ b/src/app/features/moderation/models/preprint-submission.model.ts @@ -18,4 +18,5 @@ export interface PreprintSubmissionModel { contributors: ContributorModel[]; totalContributors: number; contributorsLoading?: boolean; + contributorsPage?: number; } diff --git a/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts b/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts index b75e0dc7a..819ff6251 100644 --- a/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts +++ b/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts @@ -16,4 +16,5 @@ export interface PreprintWithdrawalSubmission { contributors: ContributorModel[]; totalContributors: number; contributorsLoading?: boolean; + contributorsPage?: number; } diff --git a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.actions.ts b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.actions.ts index bdcb30368..35bdd77c5 100644 --- a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.actions.ts +++ b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.actions.ts @@ -43,12 +43,31 @@ export class GetPreprintWithdrawalSubmissions { export class GetPreprintSubmissionContributors { static readonly type = `${ACTION_SCOPE} Get Preprint Submission Contributors`; + constructor( + public preprintId: string, + public page = 1 + ) {} +} + +export class LoadMorePreprintSubmissionContributors { + static readonly type = `${ACTION_SCOPE} Load More Preprint Submission Contributors`; + constructor(public preprintId: string) {} } export class GetPreprintWithdrawalSubmissionContributors { static readonly type = `${ACTION_SCOPE} Get Preprint Withdrawal Submission Contributors`; + constructor( + public submissionId: string, + public preprintId: string, + public page = 1 + ) {} +} + +export class LoadMorePreprintWithdrawalSubmissionContributors { + static readonly type = `${ACTION_SCOPE} Load More Preprint Withdrawal Submission Contributors`; + constructor( public submissionId: string, public preprintId: string diff --git a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts index bae189e49..4c88d5cd8 100644 --- a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts +++ b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts @@ -22,6 +22,8 @@ import { GetPreprintSubmissions, GetPreprintWithdrawalSubmissionContributors, GetPreprintWithdrawalSubmissions, + LoadMorePreprintSubmissionContributors, + LoadMorePreprintWithdrawalSubmissionContributors, } from './preprint-moderation.actions'; import { PREPRINT_MODERATION_STATE_DEFAULTS, PreprintModerationStateModel } from './preprint-moderation.model'; @@ -172,12 +174,12 @@ export class PreprintModerationState { @Action(GetPreprintSubmissionContributors) getPreprintSubmissionContributors( ctx: StateContext, - { preprintId }: GetPreprintSubmissionContributors + { preprintId, page }: GetPreprintSubmissionContributors ) { const state = ctx.getState(); const submission = state.submissions.data.find((s) => s.id === preprintId); - if (submission?.contributors && submission.contributors.length > 0) { + if (submission?.contributors && submission.contributors.length > 0 && page === 1) { return; } @@ -193,18 +195,23 @@ export class PreprintModerationState { ); return this.contributorsService - .getBibliographicContributors(ResourceType.Preprint, preprintId, 1, DEFAULT_TABLE_PARAMS.rows) + .getBibliographicContributors(ResourceType.Preprint, preprintId, page, DEFAULT_TABLE_PARAMS.rows) .pipe( tap((res) => { + const currentSubmission = state.submissions.data.find((s) => s.id === preprintId); + const existingContributors = currentSubmission?.contributors || []; + const newContributors = page === 1 ? res.data : [...existingContributors, ...res.data]; + ctx.setState( patch({ submissions: patch({ data: updateItem( (submission) => submission.id === preprintId, patch({ - contributors: res.data, + contributors: newContributors, totalContributors: res.totalCount, contributorsLoading: false, + contributorsPage: page, }) ), }), @@ -231,12 +238,12 @@ export class PreprintModerationState { @Action(GetPreprintWithdrawalSubmissionContributors) getPreprintWithdrawalSubmissionContributors( ctx: StateContext, - { submissionId, preprintId }: GetPreprintWithdrawalSubmissionContributors + { submissionId, preprintId, page }: GetPreprintWithdrawalSubmissionContributors ) { const state = ctx.getState(); const submission = state.withdrawalSubmissions.data.find((s) => s.id === submissionId); - if (submission?.contributors && submission.contributors.length > 0) { + if (submission?.contributors && submission.contributors.length > 0 && page === 1) { return; } @@ -252,18 +259,23 @@ export class PreprintModerationState { ); return this.contributorsService - .getBibliographicContributors(ResourceType.Preprint, preprintId, 1, DEFAULT_TABLE_PARAMS.rows) + .getBibliographicContributors(ResourceType.Preprint, preprintId, page, DEFAULT_TABLE_PARAMS.rows) .pipe( tap((res) => { + const currentSubmission = state.withdrawalSubmissions.data.find((s) => s.id === submissionId); + const existingContributors = currentSubmission?.contributors || []; + const newContributors = page === 1 ? res.data : [...existingContributors, ...res.data]; + ctx.setState( patch({ withdrawalSubmissions: patch({ data: updateItem( (submission) => submission.id === submissionId, patch({ - contributors: res.data, + contributors: newContributors, totalContributors: res.totalCount, contributorsLoading: false, + contributorsPage: page, }) ), }), @@ -286,4 +298,30 @@ export class PreprintModerationState { }) ); } + + @Action(LoadMorePreprintSubmissionContributors) + loadMorePreprintSubmissionContributors( + ctx: StateContext, + { preprintId }: LoadMorePreprintSubmissionContributors + ) { + const state = ctx.getState(); + const submission = state.submissions.data.find((s) => s.id === preprintId); + const currentPage = submission?.contributorsPage || 1; + const nextPage = currentPage + 1; + + return ctx.dispatch(new GetPreprintSubmissionContributors(preprintId, nextPage)); + } + + @Action(LoadMorePreprintWithdrawalSubmissionContributors) + loadMorePreprintWithdrawalSubmissionContributors( + ctx: StateContext, + { submissionId, preprintId }: LoadMorePreprintWithdrawalSubmissionContributors + ) { + const state = ctx.getState(); + const submission = state.withdrawalSubmissions.data.find((s) => s.id === submissionId); + const currentPage = submission?.contributorsPage || 1; + const nextPage = currentPage + 1; + + return ctx.dispatch(new GetPreprintWithdrawalSubmissionContributors(submissionId, preprintId, nextPage)); + } } diff --git a/src/app/shared/components/contributors-list/contributors-list.component.html b/src/app/shared/components/contributors-list/contributors-list.component.html index 814ad1dac..a3f4ae9e8 100644 --- a/src/app/shared/components/contributors-list/contributors-list.component.html +++ b/src/app/shared/components/contributors-list/contributors-list.component.html @@ -22,13 +22,12 @@ }
-@if (hasLoadMore()) { +@if (hasLoadMore() && !isLoading()) {
} diff --git a/src/testing/mocks/index.ts b/src/testing/mocks/index.ts index 72402caff..77e2b09cc 100644 --- a/src/testing/mocks/index.ts +++ b/src/testing/mocks/index.ts @@ -25,6 +25,7 @@ export { MOCK_REGISTRATION } from './registration.mock'; export * from './resource.mock'; export { MOCK_REVIEW } from './review.mock'; export { MOCK_SCOPES } from './scope.mock'; +export * from './submission.mock'; export { MOCK_TOKEN } from './token.mock'; export { TranslateServiceMock } from './translate.service.mock'; export * from './view-only-link.mock'; diff --git a/src/testing/mocks/preprint-submission.mock.ts b/src/testing/mocks/preprint-submission.mock.ts new file mode 100644 index 000000000..711d38519 --- /dev/null +++ b/src/testing/mocks/preprint-submission.mock.ts @@ -0,0 +1,70 @@ +import { PreprintSubmissionModel } from '@osf/features/moderation/models'; + +export const MOCK_PREPRINT_SUBMISSIONS: PreprintSubmissionModel[] = [ + { + id: '1', + title: 'Test Preprint Submission 1', + reviewsState: 'pending', + public: false, + actions: [ + { + id: '1', + trigger: 'manual', + fromState: 'pending', + toState: 'pending', + dateModified: '2023-01-01', + creator: { + id: 'user-1', + name: 'John Doe', + }, + comment: 'Test comment', + }, + ], + contributors: [], + totalContributors: 0, + }, + { + id: '2', + title: 'Test Preprint Submission 2', + reviewsState: 'accepted', + public: true, + actions: [ + { + id: '2', + trigger: 'manual', + fromState: 'pending', + toState: 'accepted', + dateModified: '2023-01-02', + creator: { + id: 'user-2', + name: 'Jane Doe', + }, + comment: 'Approved submission', + }, + ], + contributors: [], + totalContributors: 0, + }, + { + id: '3', + title: 'Test Preprint Submission 3', + reviewsState: 'rejected', + public: false, + actions: [ + { + id: '3', + trigger: 'manual', + fromState: 'pending', + toState: 'rejected', + dateModified: '2023-01-03', + creator: { + id: 'user-3', + name: 'Bob Smith', + }, + comment: 'Rejected submission', + }, + ], + contributors: [], + totalContributors: 0, + }, +]; diff --git a/src/testing/mocks/preprint-withdrawal-submission.mock.ts b/src/testing/mocks/preprint-withdrawal-submission.mock.ts index b3fd7cd34..543775c50 100644 --- a/src/testing/mocks/preprint-withdrawal-submission.mock.ts +++ b/src/testing/mocks/preprint-withdrawal-submission.mock.ts @@ -5,6 +5,10 @@ export const MOCK_PREPRINT_WITHDRAWAL_SUBMISSIONS: PreprintWithdrawalSubmission[ id: '1', title: 'Test Withdrawal 1', preprintId: 'preprint-1', + contributors: [], + contributorsLoading: false, + contributorsPage: 1, + totalContributors: 0, actions: [ { id: '1', @@ -24,6 +28,10 @@ export const MOCK_PREPRINT_WITHDRAWAL_SUBMISSIONS: PreprintWithdrawalSubmission[ id: '2', preprintId: 'preprint-2', title: 'Test Withdrawal 2', + contributors: [], + contributorsLoading: false, + contributorsPage: 1, + totalContributors: 0, actions: [ { id: '2', @@ -43,6 +51,10 @@ export const MOCK_PREPRINT_WITHDRAWAL_SUBMISSIONS: PreprintWithdrawalSubmission[ id: '3', preprintId: 'preprint-3', title: 'Test Withdrawal 3', + contributors: [], + contributorsLoading: false, + contributorsPage: 1, + totalContributors: 0, actions: [ { id: '3', From d90694d10578b902c56a27ef55ece979f6e6e1f9 Mon Sep 17 00:00:00 2001 From: nsemets Date: Wed, 29 Oct 2025 20:50:54 +0200 Subject: [PATCH 16/31] fix(profile): removed employment and education from hero section (#725) - Ticket: [ENG-9511] - Feature flag: n/a ## Summary of Changes 1. Removed employment and education from hero section. --- .../mappers/preprint-moderation.mapper.ts | 8 ++--- .../profile-information.component.html | 36 ++----------------- 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/app/features/moderation/mappers/preprint-moderation.mapper.ts b/src/app/features/moderation/mappers/preprint-moderation.mapper.ts index cf4500f0b..799671e2d 100644 --- a/src/app/features/moderation/mappers/preprint-moderation.mapper.ts +++ b/src/app/features/moderation/mappers/preprint-moderation.mapper.ts @@ -72,10 +72,10 @@ export class PreprintModerationMapper { })), totalCount: response.meta.total, pageSize: response.meta.per_page, - pendingCount: response.meta.reviews_state_counts.pending, - acceptedCount: response.meta.reviews_state_counts.accepted, - rejectedCount: response.meta.reviews_state_counts.rejected, - withdrawnCount: response.meta.reviews_state_counts.withdrawn, + pendingCount: response.meta?.reviews_state_counts?.pending || 0, + acceptedCount: response.meta?.reviews_state_counts?.accepted || 0, + rejectedCount: response.meta?.reviews_state_counts?.rejected || 0, + withdrawnCount: response.meta?.reviews_state_counts?.withdrawn || 0, }; } diff --git a/src/app/features/profile/components/profile-information/profile-information.component.html b/src/app/features/profile/components/profile-information/profile-information.component.html index e21756c3f..e03ceb58f 100644 --- a/src/app/features/profile/components/profile-information/profile-information.component.html +++ b/src/app/features/profile/components/profile-information/profile-information.component.html @@ -8,18 +8,9 @@

{{ currentUser()?.fullName }}

-
- @if (currentUser()?.employment?.length) { -

- {{ currentUser()?.employment?.[0]?.title }}, - {{ currentUser()?.employment?.[0]?.institution }} -

- } - -

- {{ 'myProfile.memberSince' | translate }}: {{ currentUser()?.dateRegistered | date: 'MMM d, yyyy' }} -

-
+

+ {{ 'myProfile.memberSince' | translate }}: {{ currentUser()?.dateRegistered | date: 'MMM d, yyyy' }} +

@@ -38,27 +29,6 @@

{{ currentUser()?.fullName }}

- @if (isEmploymentAndEducationVisible()) { -
- @if (currentUser()?.education?.length) { -
- -

- {{ currentUser()?.education?.[0]?.institution }} -

-
- } - - @if (currentUser()?.employment?.length) { -
-

- {{ currentUser()?.employment?.[0]?.institution }} -

-
- } -
- } -
@for (social of userSocials(); track social.alt) { From 626857d9fc3cf01491d6229c232dd7c9e08bb6bf Mon Sep 17 00:00:00 2001 From: nsemets Date: Wed, 29 Oct 2025 22:20:24 +0200 Subject: [PATCH 17/31] Chunk improvements (#730) ## Summary of Changes 1. Removed barrel files for less chunks on initial loading. --- jest.config.js | 2 + src/app/app.component.spec.ts | 7 +- src/app/app.component.ts | 7 +- src/app/app.config.ts | 8 ++- src/app/app.routes.ts | 5 +- .../breadcrumb/breadcrumb.component.spec.ts | 5 +- .../breadcrumb/breadcrumb.component.ts | 4 +- .../footer/footer.component.spec.ts | 2 +- .../components/footer/footer.component.ts | 4 +- .../header/header.component.spec.ts | 3 +- .../components/header/header.component.ts | 2 +- src/app/core/components/index.ts | 8 --- .../layout/layout.component.spec.ts | 2 +- .../components/layout/layout.component.ts | 4 +- .../nav-menu/nav-menu.component.spec.ts | 9 +-- .../components/nav-menu/nav-menu.component.ts | 20 +++--- .../cookie-consent-banner.component.spec.ts | 8 +-- .../cookie-consent-banner.component.ts | 2 +- .../maintenance-banner.component.spec.ts | 2 + .../scheduled-banner.component.spec.ts | 2 +- .../scheduled-banner.component.ts | 2 +- .../tos-consent-banner.component.spec.ts | 4 +- .../tos-consent-banner.component.ts | 2 +- .../request-access.component.spec.ts | 2 +- .../request-access.component.ts | 8 ++- src/app/core/constants/index.ts | 4 -- src/app/core/constants/nav-items.constant.ts | 2 +- .../core/constants/ngxs-states.constant.ts | 4 -- .../core/constants/social-icons.constant.ts | 2 +- src/app/core/guards/auth.guard.spec.ts | 2 +- src/app/core/guards/auth.guard.ts | 4 +- src/app/core/guards/index.ts | 5 -- src/app/core/guards/is-file.guard.ts | 3 +- src/app/core/guards/is-project.guard.ts | 2 +- src/app/core/guards/is-registry.guard.ts | 2 +- .../redirect-if-logged-in.guard.spec.ts | 2 +- src/app/core/guards/view-only.guard.ts | 2 +- src/app/core/helpers/index.ts | 2 - src/app/core/helpers/nav-menu.helper.ts | 10 +-- .../core/interceptors/error.interceptor.ts | 10 +-- src/app/core/interceptors/index.ts | 4 -- .../interceptors/view-only.interceptor.ts | 2 +- src/app/core/models/custom-menu-item.model.ts | 2 +- src/app/core/models/index.ts | 4 -- src/app/core/models/route-context.model.ts | 2 +- src/app/core/services/auth.service.ts | 8 +-- src/app/core/services/index.ts | 3 - src/app/core/services/user-emails.service.ts | 11 +++- src/app/core/services/user.service.ts | 13 ++-- .../core/store/provider/provider.actions.ts | 2 +- src/app/core/store/provider/provider.model.ts | 2 +- .../core/store/provider/provider.selectors.ts | 4 +- .../store/user-emails/user-emails.model.ts | 3 +- .../user-emails/user-emails.selectors.ts | 2 +- .../store/user-emails/user-emails.state.ts | 4 +- src/app/core/store/user/user.actions.ts | 5 +- src/app/core/store/user/user.model.ts | 3 +- src/app/core/store/user/user.selectors.ts | 5 +- src/app/core/store/user/user.state.ts | 12 ++-- .../admin-institutions.component.spec.ts | 66 +++++++++++++------ .../admin-institutions.component.ts | 7 +- .../admin-table/admin-table.component.spec.ts | 7 +- .../admin-table/admin-table.component.ts | 7 +- .../filters-section.component.spec.ts | 7 +- .../filters-section.component.ts | 5 +- .../constants/contact-options.constant.ts | 2 +- .../constants/department-options.constant.ts | 2 +- .../constants/resource-tab-option.constant.ts | 2 +- .../contact-dialog.component.ts | 2 +- .../helpers/download-url.helper.ts | 2 +- .../mappers/creators.mapper.ts | 4 +- ...stitution-preprint-to-table-data.mapper.ts | 2 +- ...nstitution-project-to-table-data.mapper.ts | 2 +- ...ution-registration-to-table-data.mapper.ts | 2 +- ...ution-index-value-search-json-api.model.ts | 2 +- .../institution-users-json-api.model.ts | 2 +- .../institutions-preprints.component.spec.ts | 5 +- .../institutions-preprints.component.ts | 9 ++- .../institutions-projects.component.spec.ts | 10 +-- .../institutions-projects.component.ts | 14 ++-- ...stitutions-registrations.component.spec.ts | 5 +- .../institutions-registrations.component.ts | 11 ++-- .../institutions-summary.component.spec.ts | 4 +- .../institutions-summary.component.ts | 7 +- .../institutions-users.component.spec.ts | 13 ++-- .../institutions-users.component.ts | 13 ++-- .../services/institutions-admin.service.ts | 2 +- .../store/institutions-admin.model.ts | 4 +- .../store/institutions-admin.selectors.ts | 2 +- .../store/institutions-admin.state.ts | 6 +- .../analytics/analytics.component.spec.ts | 19 +++--- .../features/analytics/analytics.component.ts | 22 +++---- .../view-duplicates.component.spec.ts | 20 +++--- .../view-duplicates.component.ts | 23 +++---- .../view-linked-projects.component.spec.ts | 18 +++-- .../view-linked-projects.component.ts | 16 ++--- .../models/node-analytics-json-api.model.ts | 2 +- .../analytics/services/analytics.service.ts | 4 +- .../analytics/store/analytics.actions.ts | 2 +- .../analytics/store/analytics.model.ts | 2 +- .../analytics/store/analytics.state.ts | 2 +- .../forgot-password.component.spec.ts | 4 +- .../forgot-password.component.ts | 8 +-- .../reset-password.component.spec.ts | 12 ++-- .../reset-password.component.ts | 7 +- .../pages/sign-up/sign-up.component.spec.ts | 8 +-- .../auth/pages/sign-up/sign-up.component.ts | 14 ++-- .../collections/collections.routes.ts | 2 +- ...tion-confirmation-dialog.component.spec.ts | 2 +- ...ollection-confirmation-dialog.component.ts | 2 +- .../add-to-collection.component.spec.ts | 7 +- .../add-to-collection.component.ts | 11 ++-- ...roject-contributors-step.component.spec.ts | 8 +-- .../project-contributors-step.component.ts | 17 +++-- .../project-metadata-step.component.spec.ts | 12 ++-- .../project-metadata-step.component.ts | 26 ++++---- .../select-project-step.component.spec.ts | 12 +--- .../select-project-step.component.ts | 4 +- .../collections-discover.component.spec.ts | 8 ++- .../collections-discover.component.ts | 10 +-- .../collections-main-content.component.ts | 2 +- ...tions-search-result-card.component.spec.ts | 4 +- ...ollections-search-result-card.component.ts | 4 +- ...llections-search-results.component.spec.ts | 2 +- .../collections-search-results.component.ts | 2 +- .../collection-license-json-api.models.ts | 2 +- .../models/project-metadata-form.model.ts | 2 +- .../services/add-to-collection.service.ts | 9 ++- .../collections-query-sync.service.ts | 2 +- .../services/project-metadata-form.service.ts | 7 +- .../add-to-collection.actions.ts | 2 +- .../add-to-collection.model.ts | 4 +- .../add-to-collection.state.ts | 2 +- .../create-view-link-dialog.component.spec.ts | 13 +++- .../create-view-link-dialog.component.ts | 10 +-- .../contributors.component.spec.ts | 37 +++++++---- .../contributors/contributors.component.ts | 38 ++++++----- .../models/resource-info.model.ts | 2 +- .../create-folder-dialog.component.spec.ts | 4 +- .../create-folder-dialog.component.ts | 6 +- .../edit-file-metadata-dialog.component.ts | 3 +- .../file-browser-info.component.spec.ts | 2 +- .../file-browser-info.component.ts | 2 +- .../file-keywords/file-keywords.component.ts | 5 +- .../file-metadata.component.spec.ts | 4 +- .../file-metadata/file-metadata.component.ts | 8 +-- .../file-resource-metadata.component.spec.ts | 2 +- .../file-resource-metadata.component.ts | 4 +- .../file-revisions.component.spec.ts | 4 +- .../file-revisions.component.ts | 4 +- .../files-selection-actions.component.ts | 2 +- .../move-file-dialog.component.spec.ts | 16 ++++- .../move-file-dialog.component.ts | 19 ++++-- .../rename-file-dialog.component.spec.ts | 4 +- .../rename-file-dialog.component.ts | 4 +- .../constants/file-browser-info.constants.ts | 2 +- src/app/features/files/files.routes.ts | 2 +- .../mappers/file-custom-metadata.mapper.ts | 2 +- .../files/mappers/file-revision.mapper.ts | 2 +- .../files/mappers/resource-metadata.mapper.ts | 4 +- .../get-custom-metadata-response.model.ts | 2 +- .../get-file-metadata-response.model.ts | 2 +- .../get-file-revisions-response.model.ts | 2 +- ...resource-custom-metadata-response.model.ts | 2 +- .../get-resource-short-info-response.model.ts | 3 +- .../models/get-short-info-response.model.ts | 3 +- .../features/files/models/info-item.model.ts | 2 +- .../file-detail/file-detail.component.spec.ts | 63 +++++++----------- .../file-detail/file-detail.component.ts | 17 +++-- .../file-redirect.component.spec.ts | 2 +- .../file-redirect/file-redirect.component.ts | 2 +- .../files-container.component.spec.ts | 27 -------- .../files/pages/files/files.component.spec.ts | 53 +++++++-------- .../files/pages/files/files.component.ts | 39 ++++++----- src/app/features/files/store/files.actions.ts | 2 +- src/app/features/files/store/files.model.ts | 12 ++-- .../features/files/store/files.selectors.ts | 16 ++--- src/app/features/files/store/files.state.ts | 7 +- src/app/features/home/components/index.ts | 1 - src/app/features/home/home.component.spec.ts | 3 +- src/app/features/home/home.component.ts | 3 +- .../dashboard/dashboard.component.spec.ts | 25 ++++--- .../pages/dashboard/dashboard.component.ts | 23 +++---- .../institutions/institutions.routes.ts | 2 +- .../institutions-list.component.html | 2 + .../institutions-list.component.spec.ts | 12 +++- .../institutions-list.component.ts | 14 ++-- .../institutions-search.component.spec.ts | 5 +- .../institutions-search.component.ts | 7 +- .../meeting-submissions-table.constants.ts | 2 +- .../meetings/mappers/meetings.mapper.ts | 2 +- .../models/meetings-json-api.model.ts | 2 +- .../meetings/models/meetings.models.ts | 2 +- .../meeting-details.component.spec.ts | 6 +- .../meeting-details.component.ts | 11 ++-- .../meetings-landing.component.spec.ts | 13 ++-- .../meetings-landing.component.ts | 13 ++-- .../meetings/services/meetings.service.ts | 7 +- .../meetings/store/meetings.actions.ts | 2 +- .../features/meetings/store/meetings.model.ts | 2 +- .../cedar-template-form.component.spec.ts | 2 +- ...-affiliated-institutions.component.spec.ts | 4 +- ...adata-affiliated-institutions.component.ts | 4 +- .../metadata-contributors.component.spec.ts | 6 +- .../metadata-contributors.component.ts | 4 +- .../metadata-description.component.ts | 2 +- .../metadata-funding.component.spec.ts | 2 +- .../metadata-license.component.spec.ts | 2 +- .../metadata-license.component.ts | 2 +- ...metadata-publication-doi.component.spec.ts | 6 +- .../metadata-publication-doi.component.ts | 6 +- ...etadata-registration-doi.component.spec.ts | 6 +- .../metadata-registration-doi.component.ts | 4 +- ...metadata-resource-information.component.ts | 4 +- .../metadata-subjects.component.spec.ts | 4 +- .../metadata-subjects.component.ts | 2 +- .../metadata-title.component.ts | 2 +- ...ated-institutions-dialog.component.spec.ts | 7 +- ...ffiliated-institutions-dialog.component.ts | 4 +- .../contributors-dialog.component.spec.ts | 10 +-- .../contributors-dialog.component.ts | 17 +++-- .../edit-title-dialog.component.spec.ts | 2 +- .../edit-title-dialog.component.ts | 6 +- .../funding-dialog.component.spec.ts | 2 +- .../funding-dialog.component.ts | 2 +- .../license-dialog.component.spec.ts | 5 +- .../license-dialog.component.ts | 7 +- .../publication-doi-dialog.component.ts | 2 +- .../resource-information-dialog.component.ts | 4 +- .../metadata/mappers/metadata.mapper.ts | 3 +- .../metadata/metadata.component.spec.ts | 9 ++- .../features/metadata/metadata.component.ts | 13 ++-- .../models/cedar-metadata-template.model.ts | 2 +- .../models/metadata-json-api.model.ts | 13 ++-- .../metadata/models/metadata.model.ts | 8 ++- .../add-metadata.component.spec.ts | 12 ++-- .../add-metadata/add-metadata.component.ts | 9 +-- .../metadata/services/metadata.service.ts | 10 +-- .../metadata/store/metadata.actions.ts | 4 +- .../features/metadata/store/metadata.model.ts | 2 +- .../metadata/store/metadata.selectors.ts | 2 +- .../features/metadata/store/metadata.state.ts | 2 +- .../collection-moderation.routes.ts | 2 +- .../add-moderator-dialog.component.spec.ts | 6 +- .../add-moderator-dialog.component.ts | 4 +- ...n-moderation-submissions.component.spec.ts | 7 +- ...ection-moderation-submissions.component.ts | 14 ++-- ...llection-submission-item.component.spec.ts | 10 +-- .../collection-submission-item.component.ts | 7 +- ...tion-submission-overview.component.spec.ts | 2 +- ...ollection-submission-overview.component.ts | 2 +- .../invite-moderator-dialog.component.spec.ts | 3 +- .../invite-moderator-dialog.component.ts | 7 +- .../moderators-list.component.spec.ts | 10 +-- .../moderators-list.component.ts | 12 ++-- .../moderators-table.component.spec.ts | 6 +- .../moderators-table.component.ts | 12 ++-- .../my-reviewing-navigation.component.spec.ts | 2 +- ...rint-moderation-settings.component.spec.ts | 2 +- .../preprint-moderation-settings.component.ts | 2 +- ...int-recent-activity-list.component.spec.ts | 3 +- ...preprint-recent-activity-list.component.ts | 3 +- ...preprint-submission-item.component.spec.ts | 5 +- .../preprint-submission-item.component.ts | 8 ++- .../preprint-submissions.component.spec.ts | 12 ++-- .../preprint-submissions.component.ts | 12 ++-- ...t-withdrawal-submissions.component.spec.ts | 9 ++- ...eprint-withdrawal-submissions.component.ts | 12 ++-- ...stry-pending-submissions.component.spec.ts | 20 +++++- .../registry-pending-submissions.component.ts | 15 ++--- .../registry-settings.component.spec.ts | 5 +- ...registry-submission-item.component.spec.ts | 15 +++-- .../registry-submission-item.component.ts | 5 +- .../registry-submissions.component.spec.ts | 5 +- .../registry-submissions.component.ts | 15 ++--- .../collection-moderation-tabs.const.ts | 2 +- .../preprint-moderation-tabs.const.ts | 2 +- .../constants/preprint-sort-options.const.ts | 2 +- .../registry-moderation-tabs.const.ts | 2 +- .../constants/registry-sort-options.const.ts | 2 +- .../moderation/mappers/moderation.mapper.ts | 4 +- .../mappers/preprint-moderation.mapper.ts | 5 +- .../mappers/registry-moderation.mapper.ts | 4 +- ...ction-submission-review-action-json.api.ts | 2 +- .../models/moderator-json-api.model.ts | 3 +- .../moderation/models/moderator.model.ts | 3 +- ...preprint-provider-moderation-info.model.ts | 2 +- .../preprint-related-count-json-api.model.ts | 2 +- .../preprint-review-action-json-api.model.ts | 6 +- .../models/preprint-review-action.model.ts | 8 +-- .../preprint-submission-json-api.model.ts | 2 +- .../models/preprint-submission.model.ts | 3 +- ...nt-withdrawal-submission-json-api.model.ts | 3 +- .../preprint-withdrawal-submission.model.ts | 3 +- .../models/registry-json-api.model.ts | 3 +- .../models/registry-moderation.model.ts | 3 +- .../models/review-action-json-api.model.ts | 3 +- .../moderation/models/review-action.model.ts | 4 +- .../collection-moderation.component.spec.ts | 5 +- .../collection-moderation.component.ts | 6 +- .../my-preprint-reviewing.component.spec.ts | 2 +- .../my-preprint-reviewing.component.ts | 2 +- .../preprint-moderation.component.spec.ts | 5 +- .../preprint-moderation.component.ts | 8 ++- .../registries-moderation.component.spec.ts | 5 +- .../registries-moderation.component.ts | 8 ++- .../moderation/preprint-moderation.routes.ts | 2 +- .../moderation/registry-moderation.routes.ts | 2 +- .../moderation/services/moderators.service.ts | 10 +-- .../services/preprint-moderation.service.ts | 5 +- .../services/registry-moderation.service.ts | 4 +- .../collections-moderation.actions.ts | 2 +- .../collections-moderation.model.ts | 4 +- .../collections-moderation.state.ts | 4 +- .../store/moderators/moderators.actions.ts | 4 +- .../store/moderators/moderators.model.ts | 2 +- .../store/moderators/moderators.state.ts | 4 +- .../preprint-moderation.model.ts | 3 +- .../preprint-moderation.state.ts | 8 +-- .../registry-moderation.model.ts | 2 +- .../registry-moderation.state.ts | 4 +- .../create-project-dialog.component.spec.ts | 8 +-- .../create-project-dialog.component.ts | 10 +-- .../constants/my-projects-tabs.const.ts | 2 +- .../constants/project-filter-options.const.ts | 4 +- .../mappers/my-resources.mapper.ts | 7 +- .../my-projects/my-projects.component.spec.ts | 17 +++-- .../my-projects/my-projects.component.ts | 25 +++---- .../services/my-projects-query.service.ts | 6 +- .../my-projects-table-params.service.ts | 4 +- .../advisory-board.component.ts | 6 +- .../browse-by-subjects.component.spec.ts | 4 +- .../browse-by-subjects.component.ts | 4 +- .../additional-info.component.spec.ts | 7 +- .../additional-info.component.ts | 4 +- .../citation-section.component.spec.ts | 4 +- .../citation-section.component.ts | 5 +- .../general-information.component.spec.ts | 16 ++--- .../general-information.component.ts | 14 ++-- ...moderation-status-banner.component.spec.ts | 4 +- .../moderation-status-banner.component.ts | 2 +- .../preprint-file-section.component.spec.ts | 4 +- .../preprint-file-section.component.ts | 4 +- .../preprint-make-decision.component.ts | 4 +- .../preprint-tombstone.component.spec.ts | 18 +++-- .../preprint-tombstone.component.ts | 6 +- .../share-and-download.component.spec.ts | 2 +- .../share-and-download.component.ts | 6 +- .../status-banner.component.spec.ts | 2 +- .../status-banner/status-banner.component.ts | 2 +- .../withdraw-dialog.component.ts | 4 +- .../preprint-provider-footer.component.ts | 2 +- .../preprint-provider-hero.component.spec.ts | 5 +- .../preprint-provider-hero.component.ts | 8 +-- .../array-input/array-input.component.spec.ts | 2 +- .../array-input/array-input.component.ts | 2 +- .../author-assertions-step.component.spec.ts | 7 +- .../author-assertions-step.component.ts | 15 +++-- .../file-step/file-step.component.spec.ts | 10 +-- .../stepper/file-step/file-step.component.ts | 11 ++-- ...-affiliated-institutions.component.spec.ts | 6 +- ...rints-affiliated-institutions.component.ts | 6 +- .../preprints-contributors.component.spec.ts | 9 ++- .../preprints-contributors.component.ts | 17 +++-- .../preprints-metadata-step.component.spec.ts | 20 +++--- .../preprints-metadata-step.component.ts | 15 +++-- .../preprints-subjects.component.spec.ts | 4 +- .../preprints-subjects.component.ts | 8 +-- .../review-step/review-step.component.spec.ts | 22 +++++-- .../review-step/review-step.component.ts | 14 ++-- .../supplements-step.component.spec.ts | 6 +- .../supplements-step.component.ts | 13 ++-- .../title-and-abstract-step.component.spec.ts | 2 +- .../title-and-abstract-step.component.ts | 8 +-- .../create-new-version-steps.const.ts | 2 +- .../constants/prereg-link-options.const.ts | 2 +- .../constants/submit-preprint-steps.const.ts | 2 +- .../mappers/preprint-providers.mapper.ts | 16 ++--- .../preprint-request-actions.mapper.ts | 7 +- .../mappers/preprint-request.mapper.ts | 7 +- .../preprints/mappers/preprints.mapper.ts | 7 +- .../models/preprint-json-api.models.ts | 13 ++-- .../preprint-licenses-json-api.models.ts | 2 +- .../preprint-provider-json-api.models.ts | 6 +- .../models/preprint-provider.models.ts | 8 +-- ...preprint-request-action-json-api.models.ts | 3 +- .../models/preprint-request-action.models.ts | 4 +- .../preprint-request-json-api.models.ts | 3 +- .../models/preprint-request.models.ts | 7 +- .../preprints/models/preprint.models.ts | 12 ++-- .../models/submit-preprint-form.models.ts | 4 +- .../create-new-version.component.spec.ts | 23 ++++--- .../create-new-version.component.ts | 29 ++++---- .../preprints-landing.component.spec.ts | 17 ++--- .../landing/preprints-landing.component.ts | 17 ++--- .../my-preprints.component.spec.ts | 10 +-- .../my-preprints/my-preprints.component.ts | 16 +++-- .../preprint-details.component.spec.ts | 11 ++-- .../preprint-details.component.ts | 38 ++++++----- ...eprint-provider-discover.component.spec.ts | 14 ++-- .../preprint-provider-discover.component.ts | 13 ++-- ...eprint-provider-overview.component.spec.ts | 12 ++-- .../preprint-provider-overview.component.ts | 10 +-- .../select-preprint-service.component.spec.ts | 11 ++-- .../select-preprint-service.component.ts | 17 ++--- .../submit-preprint-stepper.component.spec.ts | 45 ++++++++++--- .../submit-preprint-stepper.component.ts | 28 ++++---- .../update-preprint-stepper.component.spec.ts | 44 ++++++++++--- .../update-preprint-stepper.component.ts | 33 +++++----- .../features/preprints/preprints.routes.ts | 2 +- .../services/preprint-files.service.ts | 12 +++- .../services/preprint-licenses.service.ts | 8 ++- .../services/preprint-providers.service.ts | 6 +- .../services/preprints-projects.service.ts | 16 ++--- .../preprints/services/preprints.service.ts | 13 +++- .../my-preprints/my-preprints.actions.ts | 2 +- .../store/my-preprints/my-preprints.model.ts | 2 +- .../store/my-preprints/my-preprints.state.ts | 2 +- .../preprint-providers.model.ts | 3 +- .../preprint-providers.state.ts | 4 +- .../preprint-stepper.actions.ts | 11 ++-- .../preprint-stepper.model.ts | 13 ++-- .../preprint-stepper.state.ts | 7 +- .../store/preprint/preprint.actions.ts | 2 +- .../store/preprint/preprint.model.ts | 4 +- .../store/preprint/preprint.selectors.ts | 2 +- .../store/preprint/preprint.state.ts | 4 +- .../profile-information.component.spec.ts | 10 +-- .../profile-information.component.ts | 11 ++-- .../profile/helpers/user-socials.helper.ts | 4 +- .../profile/profile.component.spec.ts | 13 +++- src/app/features/profile/profile.component.ts | 9 +-- .../features/profile/store/profile.actions.ts | 2 +- .../features/profile/store/profile.model.ts | 3 +- .../profile/store/profile.selectors.ts | 2 +- .../features/profile/store/profile.state.ts | 4 +- .../linked-services.component.spec.ts | 9 +-- .../linked-services.component.ts | 11 ++-- .../add-component-dialog.component.spec.ts | 6 +- .../add-component-dialog.component.ts | 11 ++-- .../citation-addon-card.component.spec.ts | 7 +- .../citation-addon-card.component.ts | 19 ++++-- ...citation-collection-item.component.spec.ts | 7 +- .../citation-collection-item.component.ts | 14 ++-- .../citation-item.component.spec.ts | 7 +- .../citation-item/citation-item.component.ts | 4 +- .../delete-component-dialog.component.ts | 12 ++-- .../delete-node-link-dialog.component.ts | 3 +- .../duplicate-dialog.component.ts | 3 +- .../files-widget.component.spec.ts | 7 +- .../files-widget/files-widget.component.ts | 22 +++---- .../fork-dialog/fork-dialog.component.ts | 4 +- .../link-resource-dialog.component.spec.ts | 6 +- .../link-resource-dialog.component.ts | 8 ++- .../linked-resources.component.spec.ts | 11 +++- .../linked-resources.component.ts | 6 +- .../overview-collections.component.ts | 5 +- .../overview-components.component.spec.ts | 11 +++- .../overview-components.component.ts | 12 ++-- .../overview-parent-project.component.spec.ts | 11 +++- .../overview-parent-project.component.ts | 4 +- .../overview-toolbar.component.spec.ts | 6 +- .../overview-toolbar.component.ts | 13 ++-- .../overview-wiki.component.spec.ts | 7 +- .../overview-wiki/overview-wiki.component.ts | 3 +- .../recent-activity.component.spec.ts | 9 ++- .../recent-activity.component.ts | 4 +- .../toggle-publicity-dialog.component.spec.ts | 10 ++- .../toggle-publicity-dialog.component.ts | 9 +-- .../mappers/project-overview.mapper.ts | 5 +- .../overview/models/addon-tree-item.model.ts | 2 +- .../models/formatted-citation-item.model.ts | 2 +- .../models/project-overview.models.ts | 24 +++---- .../project-overview.component.spec.ts | 39 +++++++++-- .../overview/project-overview.component.ts | 23 +++---- .../services/project-overview.service.ts | 20 +++--- .../store/project-overview.actions.ts | 4 +- .../overview/store/project-overview.model.ts | 5 +- .../store/project-overview.selectors.ts | 2 +- .../overview/store/project-overview.state.ts | 4 +- .../configure-addon.component.spec.ts | 10 ++- .../configure-addon.component.ts | 17 +++-- ...firm-account-connection-modal.component.ts | 4 +- ...connect-configured-addon.component.spec.ts | 18 +++-- .../connect-configured-addon.component.ts | 32 ++++----- .../disconnect-addon-modal.component.ts | 4 +- .../models/addon-config-actions.model.ts | 2 +- .../project-addons.component.spec.ts | 19 +++++- .../project-addons.component.ts | 19 ++++-- .../services/addon-dialog.service.ts | 5 +- src/app/features/project/project.component.ts | 3 +- src/app/features/project/project.routes.ts | 21 ++---- .../registrations.component.spec.ts | 21 +++++- .../registrations/registrations.component.ts | 10 ++- .../services/registrations.service.ts | 7 +- .../store/registrations.model.ts | 3 +- .../store/registrations.state.ts | 2 +- .../delete-project-dialog.component.spec.ts | 44 +++++++++++++ .../delete-project-dialog.component.ts | 6 +- ...detail-setting-accordion.component.spec.ts | 2 +- ...ject-detail-setting-accordion.component.ts | 2 +- ...ct-setting-notifications.component.spec.ts | 13 ++-- ...project-setting-notifications.component.ts | 6 +- ...ings-project-affiliation.component.spec.ts | 4 +- .../settings-project-affiliation.component.ts | 2 +- ...ttings-project-form-card.component.spec.ts | 10 +-- .../settings-project-form-card.component.ts | 8 +-- ...ngs-view-only-links-card.component.spec.ts | 6 +- ...settings-view-only-links-card.component.ts | 7 +- .../settings/mappers/settings.mapper.ts | 6 +- .../settings/models/node-details.model.ts | 7 +- .../settings/models/right-control.model.ts | 4 +- .../pipes/notification-description.pipe.ts | 3 +- .../settings/services/settings.service.ts | 21 +++--- .../settings/settings.component.spec.ts | 15 +++-- .../project/settings/settings.component.ts | 16 +++-- .../settings/store/settings.actions.ts | 5 +- .../project/settings/store/settings.model.ts | 3 +- .../settings/store/settings.selectors.ts | 4 +- .../project/settings/store/settings.state.ts | 4 +- .../wiki/legacy-wiki-redirect.component.ts | 8 +-- .../project/wiki/wiki.component.spec.ts | 37 ++++++----- .../features/project/wiki/wiki.component.ts | 20 +++--- .../custom-step/custom-step.component.spec.ts | 7 +- .../custom-step/custom-step.component.ts | 16 +++-- .../drafts/drafts.component.spec.ts | 10 +-- .../components/drafts/drafts.component.ts | 10 +-- .../files-control.component.spec.ts | 15 ++++- .../files-control/files-control.component.ts | 15 +++-- .../justification-review.component.spec.ts | 11 ++-- .../justification-review.component.ts | 11 ++-- .../justification-step.component.spec.ts | 3 +- .../justification-step.component.ts | 9 ++- .../new-registration.component.spec.ts | 2 +- .../new-registration.component.ts | 4 +- ...s-affiliated-institution.component.spec.ts | 9 ++- ...stries-affiliated-institution.component.ts | 6 +- .../registries-contributors.component.spec.ts | 6 +- .../registries-contributors.component.ts | 15 +++-- .../registries-license.component.spec.ts | 5 +- .../registries-license.component.ts | 7 +- ...registries-metadata-step.component.spec.ts | 10 +-- .../registries-metadata-step.component.ts | 16 +++-- .../registries-subjects.component.spec.ts | 7 +- .../registries-subjects.component.ts | 8 +-- .../registries-tags.component.ts | 2 +- .../registry-provider-hero.component.spec.ts | 6 +- .../registry-provider-hero.component.ts | 11 ++-- .../registry-services.component.ts | 2 +- .../review/review.component.spec.ts | 22 +++---- .../components/review/review.component.ts | 20 +++--- .../registries/constants/default-steps.ts | 2 +- .../constants/registrations-tabs.ts | 2 +- .../registries/mappers/files.mapper.ts | 3 +- .../registries/mappers/licenses.mapper.ts | 3 +- ...registration-custom-step.component.spec.ts | 6 +- ...raft-registration-custom-step.component.ts | 2 +- .../justification.component.spec.ts | 8 ++- .../justification/justification.component.ts | 9 +-- .../my-registrations.component.spec.ts | 15 ++++- .../my-registrations.component.ts | 15 ++--- .../registries-landing.component.spec.ts | 10 ++- .../registries-landing.component.ts | 14 ++-- ...gistries-provider-search.component.spec.ts | 4 +- .../registries-provider-search.component.ts | 4 +- .../revisions-custom-step.component.spec.ts | 4 +- .../features/registries/registries.routes.ts | 2 +- .../registries/services/licenses.service.ts | 11 ++-- .../registries/services/registries.service.ts | 20 +++--- .../store/handlers/files.handlers.ts | 4 +- .../store/handlers/licenses.handlers.ts | 2 +- .../store/handlers/projects.handlers.ts | 2 +- .../registries/store/registries.actions.ts | 6 +- .../registries/store/registries.model.ts | 26 ++++---- .../registries/store/registries.selectors.ts | 22 +++---- .../registries/store/registries.state.ts | 7 +- .../add-resource-dialog.component.spec.ts | 12 +++- .../add-resource-dialog.component.ts | 11 ++-- .../archiving-message.component.spec.ts | 4 +- .../archiving-message.component.ts | 2 +- .../edit-resource-dialog.component.spec.ts | 7 +- .../edit-resource-dialog.component.ts | 4 +- .../registration-links-card.component.spec.ts | 12 +++- .../registration-links-card.component.ts | 12 ++-- .../registry-make-decision.component.spec.ts | 13 ++-- .../registry-make-decision.component.ts | 16 ++--- .../registry-revisions.component.spec.ts | 3 +- .../registry-revisions.component.ts | 4 +- .../registry-statuses.component.spec.ts | 5 +- .../registry-statuses.component.ts | 7 +- .../resource-form.component.spec.ts | 12 ++-- .../resource-form/resource-form.component.ts | 7 +- .../short-registration-info.component.spec.ts | 4 +- .../short-registration-info.component.ts | 2 +- .../withdraw-dialog.component.spec.ts | 2 +- .../withdraw-dialog.component.ts | 6 +- .../withdrawn-message.component.spec.ts | 4 +- .../withdrawn-message.component.ts | 2 +- .../resource-type-options.constant.ts | 4 +- .../registry/mappers/linked-nodes.mapper.ts | 2 +- .../mappers/linked-registrations.mapper.ts | 2 +- .../mappers/registry-components.mapper.ts | 2 +- .../mappers/registry-overview.mapper.ts | 4 +- .../get-registry-overview-json-api.model.ts | 17 ++--- .../models/linked-nodes-json-api.model.ts | 4 +- .../registry/models/linked-nodes.models.ts | 4 +- .../linked-registrations-json-api.model.ts | 4 +- .../registry/models/linked-response.models.ts | 2 +- .../registry-components-json-api.model.ts | 4 +- .../models/registry-components.models.ts | 2 +- .../models/registry-overview.models.ts | 31 +++++---- .../add-resource-response-json-api.model.ts | 4 +- .../get-registry-resources-json-api.model.ts | 2 +- .../resources/registry-resource.model.ts | 2 +- ...stration-recent-activity.component.spec.ts | 6 +- .../registration-recent-activity.component.ts | 2 +- .../registry-components.component.spec.ts | 9 ++- .../registry-components.component.ts | 6 +- .../registry-links.component.spec.ts | 10 +-- .../registry-links.component.ts | 5 +- .../registry-overview.component.spec.ts | 20 +++--- .../registry-overview.component.ts | 30 +++++---- .../registry-resources.component.spec.ts | 13 ++-- .../registry-resources.component.ts | 11 +++- .../registry-wiki.component.spec.ts | 11 ++-- .../registry-wiki/registry-wiki.component.ts | 13 ++-- .../registry/registry.component.spec.ts | 3 +- .../features/registry/registry.component.ts | 5 +- src/app/features/registry/registry.routes.ts | 6 +- .../services/registry-components.service.ts | 2 +- .../services/registry-links.service.ts | 2 +- .../services/registry-overview.service.ts | 19 ++++-- .../services/registry-resources.service.ts | 14 ++-- .../registry-components.model.ts | 2 +- .../registry-components.state.ts | 2 +- .../registry-links/registry-links.model.ts | 2 +- .../registry-links/registry-links.state.ts | 2 +- .../registry-overview.actions.ts | 2 +- .../registry-overview.model.ts | 4 +- .../registry-overview.selectors.ts | 5 +- .../registry-overview.state.ts | 4 +- .../registry-resources.model.ts | 2 +- .../registry-resources.state.ts | 2 +- .../features/search/search.component.spec.ts | 2 +- src/app/features/search/search.component.ts | 4 +- .../account-settings.component.spec.ts | 9 ++- .../account-settings.component.ts | 2 +- .../add-email/add-email.component.spec.ts | 9 +-- .../add-email/add-email.component.ts | 8 +-- .../affiliated-institutions.component.spec.ts | 8 ++- .../affiliated-institutions.component.ts | 8 ++- .../cancel-deactivation.component.spec.ts | 2 +- .../change-password.component.spec.ts | 10 +-- .../change-password.component.ts | 11 ++-- .../connected-emails.component.spec.ts | 20 +++--- .../connected-emails.component.ts | 11 ++-- .../connected-identities.component.spec.ts | 11 ++-- .../connected-identities.component.ts | 6 +- .../deactivate-account.component.spec.ts | 15 +---- .../deactivate-account.component.ts | 4 +- ...default-storage-location.component.spec.ts | 5 +- .../default-storage-location.component.ts | 7 +- .../share-indexing.component.spec.ts | 2 +- .../share-indexing.component.ts | 3 +- .../two-factor-auth.component.spec.ts | 9 +-- .../two-factor-auth.component.ts | 6 +- .../mappers/external-identities.mapper.ts | 2 +- ...ccount-settings-response-json-api.model.ts | 2 +- .../list-identities-response.model.ts | 2 +- .../services/account-settings.service.ts | 7 +- .../store/account-settings.model.ts | 3 +- .../store/account-settings.selectors.ts | 2 +- .../store/account-settings.state.ts | 4 +- ...eloper-app-add-edit-form.component.spec.ts | 9 +-- .../developer-app-add-edit-form.component.ts | 8 +-- ...developer-apps-container.component.spec.ts | 9 +-- .../developer-apps-container.component.ts | 4 +- .../models/developer-app-form.model.ts | 2 +- .../models/developer-app-json-api.model.ts | 2 +- .../models/developer-apps.models.ts | 2 +- .../developer-app-details.component.spec.ts | 3 +- .../developer-app-details.component.ts | 7 +- .../developer-apps-list.component.spec.ts | 3 +- .../developer-apps-list.component.ts | 3 +- .../services/developer-apps.service.ts | 4 +- .../store/developer-apps.state-model.ts | 2 +- .../constants/notifications-constants.ts | 2 +- .../models/subscription-event.model.ts | 2 +- .../notifications.component.spec.ts | 28 +++++--- .../notifications/notifications.component.ts | 9 ++- .../notification-subscription.service.ts | 16 ++--- .../notification-subscription.actions.ts | 2 +- .../store/notification-subscription.model.ts | 3 +- .../notification-subscription.selectors.ts | 2 +- .../store/notification-subscription.state.ts | 4 +- .../citation-preview.component.spec.ts | 4 +- .../citation-preview.component.ts | 4 +- .../education-form.component.spec.ts | 4 +- .../education-form.component.ts | 4 +- .../education/education.component.spec.ts | 11 ++-- .../education/education.component.ts | 6 +- .../employment-form.component.spec.ts | 4 +- .../employment-form.component.ts | 4 +- .../employment/employment.component.spec.ts | 44 +++++++------ .../employment/employment.component.ts | 6 +- .../name-form/name-form.component.spec.ts | 2 +- .../name-form/name-form.component.ts | 4 +- .../components/name/name.component.spec.ts | 10 ++- .../components/name/name.component.ts | 10 +-- .../social-form/social-form.component.ts | 5 +- .../social/social.component.spec.ts | 47 ++++++------- .../components/social/social.component.ts | 9 ++- .../profile-settings-tab-options.const.ts | 2 +- .../helpers/education-comparison.helper.ts | 4 +- .../helpers/employment-comparison.helper.ts | 4 +- .../helpers/name-comparison.helper.ts | 4 +- .../helpers/social-comparison.helper.ts | 8 ++- .../profile-settings.component.spec.ts | 14 +++- .../profile-settings.component.ts | 5 +- .../connect-addon.component.spec.ts | 14 ++-- .../connect-addon/connect-addon.component.ts | 19 ++++-- .../settings-addons.component.spec.ts | 18 +++-- .../settings-addons.component.ts | 15 +++-- .../token-add-edit-form.component.spec.ts | 15 +++-- .../token-add-edit-form.component.ts | 7 +- .../token-created-dialog.component.spec.ts | 4 +- .../token-created-dialog.component.ts | 2 +- .../token-details.component.spec.ts | 15 ++++- .../token-details/token-details.component.ts | 6 +- .../tokens-list/tokens-list.component.spec.ts | 3 - .../tokens-list/tokens-list.component.ts | 3 +- .../tokens/services/tokens.service.spec.ts | 4 +- .../tokens/services/tokens.service.ts | 4 +- .../settings/tokens/store/tokens.models.ts | 2 +- .../settings/tokens/store/tokens.state.ts | 2 +- .../settings/tokens/tokens.component.spec.ts | 9 +-- .../settings/tokens/tokens.component.ts | 4 +- .../add-project-form.component.spec.ts | 12 ++-- .../add-project-form.component.ts | 14 ++-- .../addon-card-list.component.spec.ts | 2 +- .../addon-card-list.component.ts | 5 +- .../addon-card/addon-card.component.spec.ts | 6 +- .../addons/addon-card/addon-card.component.ts | 10 ++- ...addon-setup-account-form.component.spec.ts | 5 +- .../addon-setup-account-form.component.ts | 8 ++- .../addon-terms/addon-terms.component.spec.ts | 14 ++-- .../addon-terms/addon-terms.component.ts | 10 +-- .../addons-toolbar.component.spec.ts | 7 +- .../addons-toolbar.component.ts | 6 +- src/app/shared/components/addons/index.ts | 6 -- .../storage-item-selector.component.spec.ts | 9 ++- .../storage-item-selector.component.ts | 12 ++-- ...iated-institution-select.component.spec.ts | 4 +- ...affiliated-institution-select.component.ts | 2 +- ...liated-institutions-view.component.spec.ts | 4 +- .../affiliated-institutions-view.component.ts | 2 +- .../bar-chart/bar-chart.component.spec.ts | 6 +- .../bar-chart/bar-chart.component.ts | 4 +- .../component-checkbox-item.component.spec.ts | 6 +- .../component-checkbox-item.component.ts | 2 +- ...omponents-selection-list.component.spec.ts | 8 ++- .../components-selection-list.component.ts | 2 +- .../confirm-email.component.spec.ts | 10 +-- .../confirm-email/confirm-email.component.ts | 4 +- .../contributors-list.component.spec.ts | 2 +- .../contributors-list.component.ts | 2 +- .../add-contributor-dialog.component.spec.ts | 14 ++-- .../add-contributor-dialog.component.ts | 9 ++- .../add-contributor-item.component.spec.ts | 2 +- .../add-contributor-item.component.ts | 4 +- ...tered-contributor-dialog.component.spec.ts | 13 ++-- ...registered-contributor-dialog.component.ts | 11 ++-- .../contributors-table.component.spec.ts | 19 ++++-- .../contributors-table.component.ts | 11 ++-- .../request-access-table.component.spec.ts | 17 +++-- .../request-access-table.component.ts | 9 +-- .../copy-button/copy-button.component.spec.ts | 2 +- .../copy-button/copy-button.component.ts | 4 +- .../data-resources.component.spec.ts | 6 +- .../datacite-tracker.component.ts | 0 .../doughnut-chart.component.spec.ts | 6 +- .../doughnut-chart.component.ts | 4 +- ...education-history-dialog.component.spec.ts | 6 +- .../education-history-dialog.component.ts | 2 +- .../education-history.component.spec.ts | 8 ++- .../education-history.component.ts | 4 +- ...mployment-history-dialog.component.spec.ts | 6 +- .../employment-history-dialog.component.ts | 2 +- .../employment-history.component.spec.ts | 8 ++- .../employment-history.component.ts | 4 +- .../file-menu/file-menu.component.ts | 8 +-- .../file-select-destination.component.spec.ts | 6 +- .../file-select-destination.component.ts | 7 +- .../file-upload-dialog.component.spec.ts | 6 +- .../files-tree/files-tree.component.spec.ts | 20 ++++-- .../files-tree/files-tree.component.ts | 21 ++++-- .../filter-chips.component.spec.ts | 14 ++-- .../filter-chips/filter-chips.component.ts | 2 +- .../form-select/form-select.component.spec.ts | 2 +- .../form-select/form-select.component.ts | 2 +- .../full-screen-loader.component.spec.ts | 4 +- .../full-screen-loader.component.ts | 2 +- .../generic-filter.component.spec.ts | 14 ++-- .../generic-filter.component.ts | 4 +- .../global-search.component.spec.ts | 31 +++++++-- .../global-search/global-search.component.ts | 7 +- .../google-file-picker.component.spec.ts | 2 +- .../google-file-picker.component.ts | 11 ++-- src/app/shared/components/index.ts | 60 ----------------- .../info-icon/info-icon.component.spec.ts | 2 +- .../info-icon/info-icon.component.ts | 2 +- .../license-display.component.spec.ts | 6 +- .../license-display.component.ts | 4 +- .../license/license.component.spec.ts | 12 ++-- .../components/license/license.component.ts | 10 +-- .../line-chart/line-chart.component.spec.ts | 6 +- .../line-chart/line-chart.component.ts | 2 +- .../list-info-shortener.component.ts | 4 +- .../make-decision-dialog.component.spec.ts | 3 +- .../make-decision-dialog.component.ts | 9 ++- .../metadata-tabs.component.spec.ts | 17 +++-- .../metadata-tabs/metadata-tabs.component.ts | 2 +- .../my-projects-table.component.spec.ts | 3 +- .../my-projects-table.component.ts | 7 +- .../password-input-hint.component.ts | 3 +- .../pie-chart/pie-chart.component.spec.ts | 6 +- .../pie-chart/pie-chart.component.ts | 4 +- .../project-selector.component.spec.ts | 2 +- .../project-selector.component.ts | 4 +- ...registration-blocks-data.component.spec.ts | 7 +- .../registration-blocks-data.component.ts | 8 +-- .../registration-card.component.spec.ts | 23 +++++-- .../registration-card.component.ts | 9 ++- .../file-secondary-metadata.component.spec.ts | 6 +- .../file-secondary-metadata.component.ts | 2 +- ...print-secondary-metadata.component.spec.ts | 6 +- .../preprint-secondary-metadata.component.ts | 2 +- ...oject-secondary-metadata.component.spec.ts | 6 +- .../project-secondary-metadata.component.ts | 4 +- ...ation-secondary-metadata.component.spec.ts | 6 +- ...gistration-secondary-metadata.component.ts | 2 +- .../user-secondary-metadata.component.spec.ts | 6 +- .../user-secondary-metadata.component.ts | 3 +- .../resource-card.component.spec.ts | 36 +++++++--- .../resource-card/resource-card.component.ts | 16 +++-- .../resource-citations.component.spec.ts | 6 +- .../resource-citations.component.ts | 8 ++- .../resource-metadata.component.spec.ts | 23 ++++++- .../resource-metadata.component.ts | 5 +- .../search-filters.component.spec.ts | 29 +++++--- .../search-filters.component.ts | 10 ++- .../search-help-tutorial.component.html | 6 +- .../search-help-tutorial.component.spec.ts | 4 +- .../search-help-tutorial.component.ts | 10 +-- .../search-input.component.spec.ts | 6 +- ...search-results-container.component.spec.ts | 14 +++- .../search-results-container.component.ts | 8 ++- .../select/select.component.spec.ts | 2 +- .../components/select/select.component.ts | 6 +- .../socials-share-button.component.spec.ts | 4 +- .../socials-share-button.component.ts | 6 +- .../statistic-card.component.ts | 2 +- .../status-badge.component.spec.ts | 2 +- .../status-badge/status-badge.component.ts | 6 +- .../stepper/stepper.component.spec.ts | 11 +++- .../components/stepper/stepper.component.ts | 2 +- .../sub-header/sub-header.component.spec.ts | 8 ++- .../sub-header/sub-header.component.ts | 2 +- .../subjects/subjects.component.spec.ts | 6 +- .../components/subjects/subjects.component.ts | 2 +- .../text-input/text-input.component.spec.ts | 5 +- .../text-input/text-input.component.ts | 4 +- .../components/toast/toast.component.spec.ts | 4 +- .../truncated-text.component.spec.ts | 2 +- .../truncated-text.component.ts | 3 +- .../view-only-table.component.spec.ts | 8 ++- .../view-only-table.component.ts | 5 +- .../add-wiki-dialog.component.spec.ts | 12 ++-- .../add-wiki-dialog.component.ts | 8 +-- .../compare-section.component.spec.ts | 7 +- .../compare-section.component.ts | 2 +- .../edit-section.component.spec.ts | 2 +- .../edit-section/edit-section.component.ts | 2 +- src/app/shared/components/wiki/index.ts | 6 -- .../view-section.component.spec.ts | 7 +- .../view-section/view-section.component.ts | 2 +- .../wiki-list/wiki-list.component.spec.ts | 8 ++- .../wiki/wiki-list/wiki-list.component.ts | 10 ++- .../wiki-syntax-help-dialog.component.html | 2 +- .../wiki-syntax-help-dialog.component.spec.ts | 2 +- src/app/shared/constants/addon-terms.const.ts | 2 +- .../addons-category-options.const.ts | 2 +- .../constants/addons-tab-options.const.ts | 2 +- .../constants/contributors.constants.ts | 4 +- .../default-citation-titles.const.ts | 2 +- .../default-table-params.constants.ts | 2 +- src/app/shared/constants/index.ts | 26 -------- .../shared/constants/registration-statuses.ts | 4 +- .../constants/resource-card-labels.const.ts | 2 +- .../constants/search-tab-options.const.ts | 4 +- .../constants/search-tutorial-steps.const.ts | 2 +- .../shared/constants/social-links.const.ts | 2 +- .../constants/social-platforms.const.ts | 2 +- .../shared/constants/sort-options.const.ts | 4 +- src/app/shared/directives/index.ts | 3 - src/app/shared/enums/contributors/index.ts | 3 - .../datacite/datacite-event.enum.ts | 0 src/app/shared/enums/index.ts | 43 ------------ src/app/shared/enums/subscriptions/index.ts | 3 - .../subscriptions/subscription-event.enum.ts | 1 - .../shared/guards/confirm-leaving.guard.ts | 5 +- src/app/shared/helpers/addon-card.helper.ts | 4 +- src/app/shared/helpers/addon-type.helper.ts | 8 ++- src/app/shared/helpers/breakpoints.tokens.ts | 2 +- .../helpers/citation-formatter.helper.ts | 2 +- .../helpers/get-resource-types.helper.ts | 2 +- src/app/shared/helpers/http.helper.ts | 5 +- src/app/shared/helpers/index.ts | 26 -------- ...ch-pref-to-json-api-query-params.helper.ts | 4 +- .../sort-contributors-by-permissions.ts | 2 +- .../shared/mappers/activity-logs.mapper.ts | 15 ++--- src/app/shared/mappers/addon.mapper.ts | 15 +++-- src/app/shared/mappers/citations.mapper.ts | 18 +++-- .../mappers/collections/collections.mapper.ts | 22 ++++--- .../mappers/components/components.mapper.ts | 3 +- .../contributors/contributors.mapper.ts | 16 ++--- src/app/shared/mappers/emails.mapper.ts | 3 +- src/app/shared/mappers/files/files.mapper.ts | 18 ++--- .../mappers/filters/filter-option.mapper.ts | 4 +- .../shared/mappers/filters/filters.mapper.ts | 7 +- src/app/shared/mappers/identifiers.mapper.ts | 5 +- src/app/shared/mappers/index.ts | 22 ------- .../institutions/institutions.mapper.ts | 5 +- src/app/shared/mappers/licenses.mapper.ts | 3 +- .../shared/mappers/nodes/base-node.mapper.ts | 16 ++--- .../notification-subscription.mapper.ts | 8 ++- .../mappers/projects/projects.mapper.ts | 5 +- .../shared/mappers/regions/regions-mapper.ts | 7 +- .../mappers/registration-provider.mapper.ts | 10 ++- .../map-registry-status.mapper.ts | 6 +- .../registration/page-schema.mapper.ts | 6 +- .../registration/registration-node.mapper.ts | 11 ++-- .../registration/registration.mapper.ts | 12 ++-- .../request-access/request-access.mapper.ts | 8 ++- .../mappers/resource-overview.mappers.ts | 5 +- .../shared/mappers/review-actions.mapper.ts | 3 +- .../shared/mappers/search/search.mapper.ts | 6 +- .../shared/mappers/subjects/subject-mapper.ts | 3 +- .../user-related-counts/user-counts.mapper.ts | 3 +- src/app/shared/mappers/user/user.mapper.ts | 5 +- .../shared/mappers/view-only-links.mapper.ts | 6 +- src/app/shared/mappers/wiki/wiki.mapper.ts | 12 ++-- .../activity-logs/activity-logs.model.ts | 6 +- src/app/shared/models/activity-logs/index.ts | 3 - .../shared/models/addons/addon-card.model.ts | 3 +- .../models/addons/addon-utils.models.ts | 5 +- .../{ => addons}/addons-query-params.model.ts | 0 .../models/addons/authorized-account.model.ts | 2 +- .../models/addons/configured-addon.model.ts | 2 +- src/app/shared/models/addons/index.ts | 9 --- .../addons/operation-invocation.model.ts | 2 +- .../{ => brand}/brand.json-api.model.ts | 0 .../shared/models/{ => brand}/brand.model.ts | 2 +- src/app/shared/models/charts/index.ts | 1 - src/app/shared/models/citations/index.ts | 6 -- .../collections-json-api.models.ts | 12 ++-- .../models/collections/collections.models.ts | 8 +-- src/app/shared/models/collections/index.ts | 5 -- src/app/shared/models/common/id-name.model.ts | 2 +- src/app/shared/models/common/index.ts | 3 - .../components/component-json-api.model.ts | 4 +- .../models/components/components.models.ts | 4 +- src/app/shared/models/components/index.ts | 2 - .../contributor-dialog-add.model.ts | 2 +- .../contributor-response-json-api.model.ts | 6 +- .../models/contributors/contributor.model.ts | 5 +- src/app/shared/models/contributors/index.ts | 5 -- .../shared/models/current-resource.model.ts | 2 +- .../emails/account-emails-json-api.model.ts | 2 +- src/app/shared/models/emails/index.ts | 2 - .../files/file-folder-json-api.model.ts | 4 +- .../shared/models/files/file-folder.model.ts | 2 +- .../models/files/file-json-api.model.ts | 6 +- .../models/files/file-menu-action.model.ts | 2 +- .../files/file-version-json-api.model.ts | 2 +- src/app/shared/models/files/file.model.ts | 2 +- src/app/shared/models/files/index.ts | 10 --- .../models/guid-response-json-api.model.ts | 4 +- .../identifiers/identifier-json-api.model.ts | 2 +- .../models/identifiers/identifier.model.ts | 2 +- src/app/shared/models/identifiers/index.ts | 2 - src/app/shared/models/index.ts | 62 ----------------- src/app/shared/models/institutions/index.ts | 2 - .../institution-json-api.model.ts | 4 +- src/app/shared/models/license/index.ts | 1 - .../models/{ => license}/license.model.ts | 0 .../{ => license}/licenses-json-api.model.ts | 2 +- src/app/shared/models/meta-tags/index.ts | 3 - src/app/shared/models/metadata-tabs.model.ts | 2 +- src/app/shared/models/my-resources/index.ts | 3 - .../my-resources-search-filters.models.ts | 2 +- .../my-resources/my-resources.models.ts | 4 +- src/app/shared/models/node-links/index.ts | 2 - .../base-node-attributes-json-api.model.ts | 2 +- .../nodes/base-node-data-json-api.model.ts | 3 +- .../nodes/base-node-embeds-json-api.model.ts | 16 ++--- .../shared/models/nodes/base-node.model.ts | 4 +- src/app/shared/models/nodes/index.ts | 8 --- .../models/nodes/node-with-children.model.ts | 2 +- .../models/nodes/nodes-json-api.model.ts | 2 +- src/app/shared/models/notifications/index.ts | 2 - ...otification-subscription-json-api.model.ts | 2 +- .../notification-subscription.model.ts | 3 +- .../models/profile-settings-update.model.ts | 5 +- .../project-metadata-update-payload.model.ts | 2 +- .../projects/create-project-form.model.ts | 2 +- src/app/shared/models/projects/index.ts | 3 - .../projects/projects-json-api.models.ts | 4 +- .../shared/models/projects/projects.models.ts | 4 +- .../provider/base-provider-json-api.model.ts | 2 +- src/app/shared/models/provider/index.ts | 7 -- .../shared/models/provider/provider.model.ts | 3 +- .../provider/providers-json-api.model.ts | 4 +- .../registration-provider-json-api.model.ts | 2 +- .../provider/registry-provider.model.ts | 7 +- src/app/shared/models/query-params.model.ts | 2 +- src/app/shared/models/regions/index.ts | 1 - .../models/regions/regions.json-api.model.ts | 2 +- .../registration/draft-registration.model.ts | 6 +- src/app/shared/models/registration/index.ts | 10 --- .../models/registration/page-schema.model.ts | 2 +- .../registration/registration-card.model.ts | 7 +- .../registration-json-api.model.ts | 10 +-- .../registration-node-json-api.model.ts | 5 +- .../registration/registration-node.model.ts | 5 +- .../models/registration/registration.model.ts | 11 ++-- .../schema-blocks-json-api.model.ts | 4 +- .../registration/schema-response.model.ts | 2 +- src/app/shared/models/request-access/index.ts | 3 - .../request-access-json-api.model.ts | 6 +- .../request-access-payload.model.ts | 2 +- .../request-access/request-access.model.ts | 4 +- .../shared/models/resource-metadata.model.ts | 4 +- .../shared/models/resource-overview.model.ts | 14 ++-- src/app/shared/models/review-action/index.ts | 2 - .../review-action-payload-json-api.model.ts | 2 +- .../review-action-payload.model.ts | 2 +- src/app/shared/models/search-filters.model.ts | 2 +- .../search/discaverable-filter.model.ts | 4 +- .../search/filter-options-json-api.models.ts | 4 +- .../index-card-search-json-api.models.ts | 2 +- src/app/shared/models/search/index.ts | 4 -- .../shared/models/search/resource.model.ts | 4 +- src/app/shared/models/select-option.model.ts | 2 +- src/app/shared/models/socials/index.ts | 5 -- src/app/shared/models/store/index.ts | 2 - src/app/shared/models/subject/index.ts | 2 - .../models/subject/subjects-json-api.model.ts | 2 +- .../shared/models/table-parameters.model.ts | 2 +- .../shared/models/toolbar-resource.model.ts | 2 +- .../models/user-related-counts/index.ts | 2 - .../user-related-counts-json-api.model.ts | 2 +- src/app/shared/models/user/index.ts | 8 --- .../shared/models/user/social-links.model.ts | 2 +- .../shared/models/user/user-json-api.model.ts | 2 +- .../shared/models/view-only-links/index.ts | 2 - .../view-only-link-response.model.ts | 6 +- src/app/shared/models/wiki/index.ts | 3 - src/app/shared/models/wiki/wiki.model.ts | 8 +-- src/app/shared/pipes/citation-format.pipe.ts | 2 +- src/app/shared/pipes/index.ts | 11 ---- src/app/shared/pipes/sort-by-date.pipe.ts | 2 +- .../activity-log-display.service.ts | 2 +- .../activity-log-formatter.service.ts | 2 +- .../activity-log-url-builder.service.ts | 2 +- .../activity-logs.service.spec.ts | 3 +- .../activity-logs/activity-logs.service.ts | 15 ++--- .../shared/services/activity-logs/index.ts | 4 -- .../services/addons-query-params.service.ts | 8 ++- .../services/addons/addon-form.service.ts | 16 +++-- .../services/addons/addon-oauth.service.ts | 5 +- .../addon-operation-invocation.service.ts | 9 ++- .../shared/services/addons/addons.service.ts | 20 +++--- src/app/shared/services/addons/index.ts | 4 -- src/app/shared/services/analytics.service.ts | 3 +- src/app/shared/services/banners.service.ts | 2 +- src/app/shared/services/bookmarks.service.ts | 4 +- src/app/shared/services/brand.service.ts | 4 +- src/app/shared/services/citations.service.ts | 18 +++-- .../shared/services/collections.service.ts | 32 +++++---- .../shared/services/contributors.service.ts | 17 ++--- .../services/csl-style-manager.service.ts | 2 +- .../services/custom-confirmation.service.ts | 6 +- .../datacite/datacite.service.spec.ts | 6 +- .../services/datacite/datacite.service.ts | 13 ++-- src/app/shared/services/duplicates.service.ts | 7 +- src/app/shared/services/files.service.ts | 40 ++++++----- .../shared/services/global-search.service.ts | 16 ++--- src/app/shared/services/index.ts | 35 ---------- .../shared/services/institutions.service.ts | 10 +-- src/app/shared/services/json-api.service.ts | 2 +- src/app/shared/services/licenses.service.ts | 6 +- .../services/linked-projects.service.ts | 7 +- src/app/shared/services/meta-tags.service.ts | 6 +- .../services/metadata-records.service.ts | 2 +- .../shared/services/my-resources.service.ts | 14 ++-- src/app/shared/services/node-links.service.ts | 9 ++- src/app/shared/services/projects.service.ts | 4 +- src/app/shared/services/regions.service.ts | 5 +- .../services/registration-provider.service.ts | 14 ++-- .../shared/services/request-access.service.ts | 7 +- .../shared/services/resource-card.service.ts | 6 +- src/app/shared/services/resource.service.ts | 19 +++--- .../shared/services/social-share.service.ts | 7 +- src/app/shared/services/subjects.service.ts | 7 +- .../services/view-only-links.service.ts | 10 +-- src/app/shared/services/wiki.service.ts | 15 +++-- .../activity-logs/activity-logs.model.ts | 3 +- .../activity-logs/activity-logs.selectors.ts | 3 +- .../activity-logs/activity-logs.state.spec.ts | 2 +- .../activity-logs/activity-logs.state.ts | 2 +- .../shared/stores/addons/addons.actions.ts | 4 +- src/app/shared/stores/addons/addons.models.ts | 12 ++-- .../shared/stores/addons/addons.selectors.ts | 12 ++-- src/app/shared/stores/addons/addons.state.ts | 8 +-- .../shared/stores/banners/banners.model.ts | 2 +- .../shared/stores/banners/banners.state.ts | 2 +- .../stores/bookmarks/bookmarks.actions.ts | 2 +- .../stores/bookmarks/bookmarks.model.ts | 2 +- .../stores/bookmarks/bookmarks.state.ts | 4 +- .../stores/citations/citations.actions.ts | 4 +- .../stores/citations/citations.model.ts | 4 +- .../stores/citations/citations.state.ts | 4 +- .../stores/collections/collections.actions.ts | 2 +- .../stores/collections/collections.model.ts | 6 +- .../collections/collections.selectors.ts | 2 +- .../stores/collections/collections.state.ts | 6 +- .../contributors/contributors.actions.ts | 8 ++- .../stores/contributors/contributors.model.ts | 9 ++- .../stores/contributors/contributors.state.ts | 5 +- .../current-resource.actions.ts | 2 +- .../current-resource.model.ts | 6 +- .../current-resource.selectors.ts | 6 +- .../current-resource.state.ts | 4 +- .../stores/duplicates/duplicates.model.ts | 3 +- .../stores/duplicates/duplicates.state.ts | 2 +- .../global-search/global-search.actions.ts | 6 +- .../global-search/global-search.model.ts | 8 ++- .../global-search/global-search.selectors.ts | 7 +- .../global-search/global-search.state.ts | 9 +-- .../institutions-search.model.ts | 3 +- .../institutions-search.state.ts | 6 +- .../institutions/institutions.actions.ts | 4 +- .../stores/institutions/institutions.model.ts | 4 +- .../stores/institutions/institutions.state.ts | 4 +- .../shared/stores/licenses/licenses.model.ts | 3 +- .../stores/licenses/licenses.selectors.ts | 2 +- .../shared/stores/licenses/licenses.state.ts | 2 +- .../linked-projects/linked-projects.model.ts | 3 +- .../linked-projects/linked-projects.state.ts | 2 +- .../my-resources/my-resources.actions.ts | 6 +- .../stores/my-resources/my-resources.model.ts | 5 +- .../my-resources/my-resources.selectors.ts | 2 +- .../stores/my-resources/my-resources.state.ts | 6 +- .../stores/node-links/node-links.actions.ts | 3 +- .../stores/node-links/node-links.model.ts | 3 +- .../stores/node-links/node-links.state.ts | 2 +- .../stores/projects/projects.actions.ts | 4 +- .../shared/stores/projects/projects.model.ts | 3 +- .../shared/stores/projects/projects.state.ts | 2 +- .../shared/stores/regions/regions.model.ts | 5 +- .../shared/stores/regions/regions.state.ts | 4 +- .../registration-provider.model.ts | 3 +- .../registration-provider.state.ts | 7 +- .../stores/subjects/subjects.actions.ts | 4 +- .../shared/stores/subjects/subjects.model.ts | 3 +- .../stores/subjects/subjects.selectors.ts | 2 +- .../shared/stores/subjects/subjects.state.ts | 4 +- .../view-only-links/view-only-link.actions.ts | 4 +- .../view-only-links/view-only-link.model.ts | 3 +- .../view-only-links/view-only-link.state.ts | 6 +- src/app/shared/stores/wiki/wiki.actions.ts | 4 +- src/app/shared/stores/wiki/wiki.model.ts | 7 +- src/app/shared/stores/wiki/wiki.selectors.ts | 4 +- src/app/shared/stores/wiki/wiki.state.ts | 6 +- .../data/addons/addons.configured.data.ts | 2 +- src/testing/data/dashboard/dasboard.data.ts | 2 +- src/testing/data/files/node.data.ts | 2 +- src/testing/mocks/addon.mock.ts | 4 +- src/testing/mocks/base-node.mock.ts | 4 +- .../mocks/cedar-artifact-viewer.mock.ts | 13 ++++ .../mocks/cedar-embeddable-editor.mock.ts | 13 ++++ src/testing/mocks/citation-style.mock.ts | 2 +- .../mocks/collections-submissions.mock.ts | 2 +- src/testing/mocks/contributors.mock.ts | 5 +- .../mocks/custom-confirmation.service.mock.ts | 2 +- src/testing/mocks/data.mock.ts | 4 +- src/testing/mocks/draft-registration.mock.ts | 4 +- src/testing/mocks/education.mock.ts | 2 +- src/testing/mocks/employment.mock.ts | 2 +- src/testing/mocks/index.ts | 32 --------- src/testing/mocks/license.mock.ts | 2 +- src/testing/mocks/node-details.mock.ts | 2 + .../mocks/notification-subscription.mock.ts | 10 +-- src/testing/mocks/osf-file.mock.ts | 4 +- .../mocks/preprint-provider-details.ts | 2 +- .../preprint-provider-moderation-info.mock.ts | 2 + src/testing/mocks/preprint.mock.ts | 2 +- src/testing/mocks/project-metadata.mock.ts | 7 +- src/testing/mocks/project-overview.mock.ts | 5 +- src/testing/mocks/project.mock.ts | 2 +- src/testing/mocks/registration.mock.ts | 14 ++-- src/testing/mocks/registries.mock.ts | 2 +- src/testing/mocks/registry-moderation.mock.ts | 3 +- src/testing/mocks/registry-overview.mock.ts | 4 +- src/testing/mocks/resource.mock.ts | 15 +++-- src/testing/mocks/social-share-links.mock.ts | 2 +- src/testing/mocks/subject.mock.ts | 2 +- src/testing/mocks/submission.mock.ts | 2 +- src/testing/mocks/toast.service.mock.ts | 2 +- .../mocks/user-employment-education.mock.ts | 3 +- src/testing/mocks/view-only-link.mock.ts | 6 +- .../custom-confirmation-provider.mock.ts | 8 ++- .../providers/custom-dialog-provider.mock.ts | 2 +- src/testing/providers/toast-provider.mock.ts | 2 +- 1225 files changed, 4738 insertions(+), 3967 deletions(-) delete mode 100644 src/app/core/components/index.ts delete mode 100644 src/app/core/constants/index.ts delete mode 100644 src/app/core/guards/index.ts delete mode 100644 src/app/core/helpers/index.ts delete mode 100644 src/app/core/interceptors/index.ts delete mode 100644 src/app/core/models/index.ts delete mode 100644 src/app/core/services/index.ts delete mode 100644 src/app/features/home/components/index.ts create mode 100644 src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.spec.ts delete mode 100644 src/app/shared/components/addons/index.ts delete mode 100644 src/app/shared/components/datacite-tracker/datacite-tracker.component.ts delete mode 100644 src/app/shared/components/index.ts delete mode 100644 src/app/shared/components/wiki/index.ts delete mode 100644 src/app/shared/constants/index.ts delete mode 100644 src/app/shared/directives/index.ts delete mode 100644 src/app/shared/enums/contributors/index.ts rename src/app/shared/{models => enums}/datacite/datacite-event.enum.ts (100%) delete mode 100644 src/app/shared/enums/index.ts delete mode 100644 src/app/shared/enums/subscriptions/index.ts delete mode 100644 src/app/shared/helpers/index.ts delete mode 100644 src/app/shared/mappers/index.ts delete mode 100644 src/app/shared/models/activity-logs/index.ts rename src/app/shared/models/{ => addons}/addons-query-params.model.ts (100%) delete mode 100644 src/app/shared/models/addons/index.ts rename src/app/shared/models/{ => brand}/brand.json-api.model.ts (100%) rename src/app/shared/models/{ => brand}/brand.model.ts (87%) delete mode 100644 src/app/shared/models/charts/index.ts delete mode 100644 src/app/shared/models/citations/index.ts delete mode 100644 src/app/shared/models/collections/index.ts delete mode 100644 src/app/shared/models/common/index.ts delete mode 100644 src/app/shared/models/components/index.ts delete mode 100644 src/app/shared/models/contributors/index.ts delete mode 100644 src/app/shared/models/emails/index.ts delete mode 100644 src/app/shared/models/files/index.ts delete mode 100644 src/app/shared/models/identifiers/index.ts delete mode 100644 src/app/shared/models/index.ts delete mode 100644 src/app/shared/models/institutions/index.ts delete mode 100644 src/app/shared/models/license/index.ts rename src/app/shared/models/{ => license}/license.model.ts (100%) rename src/app/shared/models/{ => license}/licenses-json-api.model.ts (84%) delete mode 100644 src/app/shared/models/meta-tags/index.ts delete mode 100644 src/app/shared/models/my-resources/index.ts delete mode 100644 src/app/shared/models/node-links/index.ts delete mode 100644 src/app/shared/models/nodes/index.ts delete mode 100644 src/app/shared/models/notifications/index.ts delete mode 100644 src/app/shared/models/projects/index.ts delete mode 100644 src/app/shared/models/provider/index.ts delete mode 100644 src/app/shared/models/regions/index.ts delete mode 100644 src/app/shared/models/registration/index.ts delete mode 100644 src/app/shared/models/request-access/index.ts delete mode 100644 src/app/shared/models/review-action/index.ts delete mode 100644 src/app/shared/models/search/index.ts delete mode 100644 src/app/shared/models/socials/index.ts delete mode 100644 src/app/shared/models/store/index.ts delete mode 100644 src/app/shared/models/subject/index.ts delete mode 100644 src/app/shared/models/user-related-counts/index.ts delete mode 100644 src/app/shared/models/user/index.ts delete mode 100644 src/app/shared/models/view-only-links/index.ts delete mode 100644 src/app/shared/models/wiki/index.ts delete mode 100644 src/app/shared/pipes/index.ts delete mode 100644 src/app/shared/services/activity-logs/index.ts delete mode 100644 src/app/shared/services/addons/index.ts delete mode 100644 src/app/shared/services/index.ts create mode 100644 src/testing/mocks/cedar-artifact-viewer.mock.ts create mode 100644 src/testing/mocks/cedar-embeddable-editor.mock.ts delete mode 100644 src/testing/mocks/index.ts diff --git a/jest.config.js b/jest.config.js index 73c577307..98fccd89f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,6 +11,8 @@ module.exports = { '^@styles/(.*)$': '/assets/styles/$1', '^@testing/(.*)$': '/src/testing/$1', '^src/environments/environment$': '/src/environments/environment.ts', + '^cedar-artifact-viewer$': '/src/testing/mocks/cedar-artifact-viewer.mock.ts', + '^cedar-embeddable-editor$': '/src/testing/mocks/cedar-embeddable-editor.mock.ts', }, transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index d3706b5af..a9ab876ec 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -12,11 +12,12 @@ import { CookieConsentBannerComponent } from '@core/components/osf-banners/cooki import { ENVIRONMENT } from '@core/provider/environment.provider'; import { GetCurrentUser, UserState } from '@core/store/user'; import { UserEmailsState } from '@core/store/user-emails'; -import { CustomDialogService } from '@shared/services'; -import { TranslateServiceMock } from '../testing/mocks'; +import { TranslateServiceMock } from '../testing/mocks/translate.service.mock'; -import { FullScreenLoaderComponent, ToastComponent } from './shared/components'; +import { FullScreenLoaderComponent } from './shared/components/full-screen-loader/full-screen-loader.component'; +import { ToastComponent } from './shared/components/toast/toast.component'; +import { CustomDialogService } from './shared/services/custom-dialog.service'; import { AppComponent } from './app.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e1eb1045b..d51395bcc 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,10 +9,11 @@ import { NavigationEnd, Router, RouterOutlet } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { GetCurrentUser } from '@core/store/user'; import { GetEmails, UserEmailsSelectors } from '@core/store/user-emails'; -import { ConfirmEmailComponent } from '@shared/components'; -import { CustomDialogService } from '@shared/services'; -import { FullScreenLoaderComponent, ToastComponent } from './shared/components'; +import { ConfirmEmailComponent } from './shared/components/confirm-email/confirm-email.component'; +import { FullScreenLoaderComponent } from './shared/components/full-screen-loader/full-screen-loader.component'; +import { ToastComponent } from './shared/components/toast/toast.component'; +import { CustomDialogService } from './shared/services/custom-dialog.service'; import { GoogleTagManagerService } from 'angular-google-tag-manager'; diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 45474cd08..4ab27fe0b 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -11,12 +11,14 @@ import { ApplicationConfig, ErrorHandler, importProvidersFrom, provideZoneChange import { provideAnimations } from '@angular/platform-browser/animations'; import { provideRouter, withInMemoryScrolling } from '@angular/router'; -import { STATES } from '@core/constants'; -import { provideTranslation } from '@core/helpers'; +import { STATES } from '@core/constants/ngxs-states.constant'; +import { provideTranslation } from '@core/helpers/i18n.helper'; +import { authInterceptor } from '@core/interceptors/auth.interceptor'; +import { errorInterceptor } from '@core/interceptors/error.interceptor'; +import { viewOnlyInterceptor } from '@core/interceptors/view-only.interceptor'; import { APPLICATION_INITIALIZATION_PROVIDER } from '@core/provider/application.initialization.provider'; import { SENTRY_PROVIDER } from '@core/provider/sentry.provider'; -import { authInterceptor, errorInterceptor, viewOnlyInterceptor } from './core/interceptors'; import CustomPreset from './core/theme/custom-preset'; import { routes } from './app.routes'; diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 0c2bb9259..15ab0b05a 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -2,9 +2,10 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; +import { authGuard } from '@core/guards/auth.guard'; import { isFileGuard } from '@core/guards/is-file.guard'; +import { redirectIfLoggedInGuard } from '@core/guards/redirect-if-logged-in.guard'; -import { authGuard, redirectIfLoggedInGuard } from './core/guards'; import { isProjectGuard } from './core/guards/is-project.guard'; import { isRegistryGuard } from './core/guards/is-registry.guard'; import { MyPreprintsState } from './features/preprints/store/my-preprints'; @@ -12,7 +13,7 @@ import { ProfileState } from './features/profile/store'; import { RegistriesState } from './features/registries/store'; import { LicensesHandlers, ProjectsHandlers, ProvidersHandlers } from './features/registries/store/handlers'; import { FilesHandlers } from './features/registries/store/handlers/files.handlers'; -import { LicensesService } from './shared/services'; +import { LicensesService } from './shared/services/licenses.service'; import { BookmarksState } from './shared/stores/bookmarks'; import { ProjectsState } from './shared/stores/projects'; diff --git a/src/app/core/components/breadcrumb/breadcrumb.component.spec.ts b/src/app/core/components/breadcrumb/breadcrumb.component.spec.ts index 9b0039645..9d225834d 100644 --- a/src/app/core/components/breadcrumb/breadcrumb.component.spec.ts +++ b/src/app/core/components/breadcrumb/breadcrumb.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -7,6 +7,7 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { ProviderSelectors } from '@core/store/provider'; import { InstitutionsAdminSelectors } from '@osf/features/admin-institutions/store'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { InstitutionsSearchSelectors } from '@shared/stores/institutions-search'; import { BreadcrumbComponent } from './breadcrumb.component'; @@ -41,7 +42,7 @@ describe('Component: Breadcrumb', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [BreadcrumbComponent], + imports: [BreadcrumbComponent, MockComponent(IconComponent)], providers: [ MockProvider(Router, mockRouter), { provide: ActivatedRoute, useValue: mockActivatedRoute }, diff --git a/src/app/core/components/breadcrumb/breadcrumb.component.ts b/src/app/core/components/breadcrumb/breadcrumb.component.ts index 2c71234f7..35f99145b 100644 --- a/src/app/core/components/breadcrumb/breadcrumb.component.ts +++ b/src/app/core/components/breadcrumb/breadcrumb.component.ts @@ -6,10 +6,10 @@ import { Component, computed, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router'; +import { RouteData } from '@core/models/route-data.model'; import { ProviderSelectors } from '@core/store/provider'; -import { RouteData } from '@osf/core/models'; import { InstitutionsAdminSelectors } from '@osf/features/admin-institutions/store'; -import { IconComponent } from '@osf/shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { InstitutionsSearchSelectors } from '@shared/stores/institutions-search'; @Component({ diff --git a/src/app/core/components/footer/footer.component.spec.ts b/src/app/core/components/footer/footer.component.spec.ts index 6c1aedbca..2c20957ca 100644 --- a/src/app/core/components/footer/footer.component.spec.ts +++ b/src/app/core/components/footer/footer.component.spec.ts @@ -4,7 +4,7 @@ import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { FooterComponent } from './footer.component'; diff --git a/src/app/core/components/footer/footer.component.ts b/src/app/core/components/footer/footer.component.ts index c96bde332..e1865b547 100644 --- a/src/app/core/components/footer/footer.component.ts +++ b/src/app/core/components/footer/footer.component.ts @@ -3,8 +3,8 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { SOCIAL_ICONS } from '@osf/core/constants'; -import { IconComponent } from '@osf/shared/components'; +import { SOCIAL_ICONS } from '@core/constants/social-icons.constant'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; @Component({ selector: 'osf-footer', diff --git a/src/app/core/components/header/header.component.spec.ts b/src/app/core/components/header/header.component.spec.ts index 344394e6e..8d78b7a39 100644 --- a/src/app/core/components/header/header.component.spec.ts +++ b/src/app/core/components/header/header.component.spec.ts @@ -14,7 +14,8 @@ import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; import { HeaderComponent } from './header.component'; -import { MOCK_STORE, MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; describe('HeaderComponent', () => { let component: HeaderComponent; diff --git a/src/app/core/components/header/header.component.ts b/src/app/core/components/header/header.component.ts index 52f04a1fd..c2b5a1df9 100644 --- a/src/app/core/components/header/header.component.ts +++ b/src/app/core/components/header/header.component.ts @@ -8,7 +8,7 @@ import { Menu } from 'primeng/menu'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { Router } from '@angular/router'; -import { AuthService } from '@osf/core/services'; +import { AuthService } from '@core/services/auth.service'; import { UserSelectors } from '@osf/core/store/user'; import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; diff --git a/src/app/core/components/index.ts b/src/app/core/components/index.ts deleted file mode 100644 index 37255faf6..000000000 --- a/src/app/core/components/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { BreadcrumbComponent } from './breadcrumb/breadcrumb.component'; -export { FooterComponent } from './footer/footer.component'; -export { HeaderComponent } from './header/header.component'; -export { LayoutComponent } from './layout/layout.component'; -export { MaintenanceBannerComponent } from './osf-banners/maintenance-banner/maintenance-banner.component'; -export { PageNotFoundComponent } from './page-not-found/page-not-found.component'; -export { SidenavComponent } from './sidenav/sidenav.component'; -export { TopnavComponent } from './topnav/topnav.component'; diff --git a/src/app/core/components/layout/layout.component.spec.ts b/src/app/core/components/layout/layout.component.spec.ts index be2d217e3..699b8564d 100644 --- a/src/app/core/components/layout/layout.component.spec.ts +++ b/src/app/core/components/layout/layout.component.spec.ts @@ -7,7 +7,7 @@ import { BehaviorSubject } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { IS_WEB } from '@osf/shared/helpers'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; import { FooterComponent } from '../footer/footer.component'; diff --git a/src/app/core/components/layout/layout.component.ts b/src/app/core/components/layout/layout.component.ts index c3c8030f5..e9aa32c2b 100644 --- a/src/app/core/components/layout/layout.component.ts +++ b/src/app/core/components/layout/layout.component.ts @@ -7,8 +7,8 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { RouterOutlet } from '@angular/router'; -import { ScrollTopOnRouteChangeDirective } from '@osf/shared/directives'; -import { IS_MEDIUM, IS_WEB } from '@osf/shared/helpers'; +import { ScrollTopOnRouteChangeDirective } from '@osf/shared/directives/scroll-top.directive'; +import { IS_MEDIUM, IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; import { FooterComponent } from '../footer/footer.component'; diff --git a/src/app/core/components/nav-menu/nav-menu.component.spec.ts b/src/app/core/components/nav-menu/nav-menu.component.spec.ts index 26a43c3aa..749818228 100644 --- a/src/app/core/components/nav-menu/nav-menu.component.spec.ts +++ b/src/app/core/components/nav-menu/nav-menu.component.spec.ts @@ -1,18 +1,19 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { NO_ERRORS_SCHEMA, signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; +import { AuthService } from '@core/services/auth.service'; import { CustomMenuItem } from '@osf/core/models'; -import { AuthService } from '@osf/core/services'; import { ProviderSelectors } from '@osf/core/store/provider/provider.selectors'; import { UserSelectors } from '@osf/core/store/user/user.selectors'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { NavMenuComponent } from './nav-menu.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { RouterMockBuilder } from '@testing/providers/router-provider.mock'; @@ -34,7 +35,7 @@ describe('NavMenuComponent', () => { }; await TestBed.configureTestingModule({ - imports: [NavMenuComponent, OSFTestingModule], + imports: [NavMenuComponent, OSFTestingModule, MockComponent(IconComponent)], providers: [ provideMockStore({ signals: [ diff --git a/src/app/core/components/nav-menu/nav-menu.component.ts b/src/app/core/components/nav-menu/nav-menu.component.ts index 6ac7d0bbd..4f4d28086 100644 --- a/src/app/core/components/nav-menu/nav-menu.component.ts +++ b/src/app/core/components/nav-menu/nav-menu.component.ts @@ -10,16 +10,18 @@ import { Component, computed, inject, output } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, NavigationEnd, Router, RouterLink, RouterLinkActive } from '@angular/router'; -import { MENU_ITEMS } from '@core/constants'; +import { MENU_ITEMS } from '@core/constants/nav-items.constant'; +import { filterMenuItems, updateMenuItems } from '@core/helpers/nav-menu.helper'; +import { CustomMenuItem } from '@core/models/custom-menu-item.model'; +import { RouteContext } from '@core/models/route-context.model'; +import { AuthService } from '@core/services/auth.service'; import { ProviderSelectors } from '@core/store/provider'; -import { filterMenuItems, updateMenuItems } from '@osf/core/helpers'; -import { CustomMenuItem, RouteContext } from '@osf/core/models'; -import { AuthService } from '@osf/core/services'; -import { UserSelectors } from '@osf/core/store/user'; -import { IconComponent } from '@osf/shared/components'; -import { CurrentResourceType, ReviewPermissions } from '@osf/shared/enums'; -import { getViewOnlyParam } from '@osf/shared/helpers'; -import { WrapFnPipe } from '@osf/shared/pipes'; +import { UserSelectors } from '@core/store/user'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; +import { getViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { WrapFnPipe } from '@osf/shared/pipes/wrap-fn.pipe'; import { CurrentResourceSelectors, GetResourceDetails } from '@osf/shared/stores/current-resource'; @Component({ diff --git a/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.spec.ts b/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.spec.ts index 9c097775f..c40290217 100644 --- a/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.spec.ts +++ b/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.spec.ts @@ -1,9 +1,10 @@ import { CookieService } from 'ngx-cookie-service'; - -import { Button } from 'primeng/button'; +import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; + import { CookieConsentBannerComponent } from './cookie-consent-banner.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -19,8 +20,7 @@ describe('Component: Cookie Consent Banner', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [OSFTestingModule, CookieConsentBannerComponent, Button], - + imports: [OSFTestingModule, CookieConsentBannerComponent, MockComponent(IconComponent)], providers: [{ provide: CookieService, useValue: cookieServiceMock }], }); diff --git a/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.ts b/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.ts index 4d3b7ca5a..ca87aca36 100644 --- a/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.ts +++ b/src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.ts @@ -7,7 +7,7 @@ import { Message } from 'primeng/message'; import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; import { fadeInOutAnimation } from '@core/animations/fade.in-out.animation'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; /** * Displays a cookie consent banner until the user accepts. diff --git a/src/app/core/components/osf-banners/maintenance-banner/maintenance-banner.component.spec.ts b/src/app/core/components/osf-banners/maintenance-banner/maintenance-banner.component.spec.ts index 1711da79c..e617a1333 100644 --- a/src/app/core/components/osf-banners/maintenance-banner/maintenance-banner.component.spec.ts +++ b/src/app/core/components/osf-banners/maintenance-banner/maintenance-banner.component.spec.ts @@ -21,7 +21,9 @@ describe('Component: Maintenance Banner', () => { check: jest.fn(), set: jest.fn(), } as any; + httpClient = { get: jest.fn() } as any; + await TestBed.configureTestingModule({ imports: [MaintenanceBannerComponent, NoopAnimationsModule, MessageModule], providers: [ diff --git a/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.spec.ts b/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.spec.ts index a72198b04..e784ebb16 100644 --- a/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.spec.ts +++ b/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.spec.ts @@ -6,7 +6,7 @@ import { signal, WritableSignal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BannerModel } from '@core/components/osf-banners/models/banner.model'; -import { IS_XSMALL } from '@osf/shared/helpers'; +import { IS_XSMALL } from '@osf/shared/helpers/breakpoints.tokens'; import { BannersSelector, GetCurrentScheduledBanner } from '@osf/shared/stores/banners'; import { ScheduledBannerComponent } from './scheduled-banner.component'; diff --git a/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.ts b/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.ts index be8307906..c2761b236 100644 --- a/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.ts +++ b/src/app/core/components/osf-banners/scheduled-banner/scheduled-banner.component.ts @@ -3,7 +3,7 @@ import { Store } from '@ngxs/store'; import { ChangeDetectionStrategy, Component, computed, inject, OnInit } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; -import { IS_XSMALL } from '@osf/shared/helpers'; +import { IS_XSMALL } from '@osf/shared/helpers/breakpoints.tokens'; import { BannersSelector, GetCurrentScheduledBanner } from '@osf/shared/stores/banners'; /** diff --git a/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.spec.ts b/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.spec.ts index 83e2ef0a0..f08e2f5da 100644 --- a/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.spec.ts +++ b/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.spec.ts @@ -9,11 +9,11 @@ import { By } from '@angular/platform-browser'; import { AcceptTermsOfServiceByUser } from '@core/store/user'; import { UserSelectors } from '@osf/core/store/user'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { TosConsentBannerComponent } from './tos-consent-banner.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { TranslationServiceMock } from '@testing/mocks/translation.service.mock'; import { OSFTestingStoreModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.ts b/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.ts index 8ccebf39b..4b09dcfcb 100644 --- a/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.ts +++ b/src/app/core/components/osf-banners/tos-consent-banner/tos-consent-banner.component.ts @@ -11,7 +11,7 @@ import { FormsModule } from '@angular/forms'; import { RouterLink } from '@angular/router'; import { AcceptTermsOfServiceByUser, UserSelectors } from '@core/store/user'; -import { IconComponent } from '@osf/shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; /** * TosConsentBannerComponent displays a Terms of Service (ToS) consent banner for users who haven't accepted yet. diff --git a/src/app/core/components/request-access/request-access.component.spec.ts b/src/app/core/components/request-access/request-access.component.spec.ts index dd191e221..2c15a032f 100644 --- a/src/app/core/components/request-access/request-access.component.spec.ts +++ b/src/app/core/components/request-access/request-access.component.spec.ts @@ -10,7 +10,7 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { RequestAccessComponent } from './request-access.component'; diff --git a/src/app/core/components/request-access/request-access.component.ts b/src/app/core/components/request-access/request-access.component.ts index a6b10d493..eaa56b861 100644 --- a/src/app/core/components/request-access/request-access.component.ts +++ b/src/app/core/components/request-access/request-access.component.ts @@ -12,9 +12,11 @@ import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { AuthService } from '@core/services'; -import { InputLimits } from '@osf/shared/constants'; -import { LoaderService, RequestAccessService, ToastService } from '@osf/shared/services'; +import { AuthService } from '@core/services/auth.service'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { RequestAccessService } from '@osf/shared/services/request-access.service'; +import { ToastService } from '@osf/shared/services/toast.service'; @Component({ selector: 'osf-request-access', diff --git a/src/app/core/constants/index.ts b/src/app/core/constants/index.ts deleted file mode 100644 index 54e8fcb58..000000000 --- a/src/app/core/constants/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './error-messages'; -export * from './nav-items.constant'; -export * from './ngxs-states.constant'; -export * from './social-icons.constant'; diff --git a/src/app/core/constants/nav-items.constant.ts b/src/app/core/constants/nav-items.constant.ts index 781031d38..6ec9ee652 100644 --- a/src/app/core/constants/nav-items.constant.ts +++ b/src/app/core/constants/nav-items.constant.ts @@ -1,6 +1,6 @@ import { MenuItem } from 'primeng/api'; -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { CustomMenuItem } from '../models/custom-menu-item.model'; diff --git a/src/app/core/constants/ngxs-states.constant.ts b/src/app/core/constants/ngxs-states.constant.ts index 08e715223..9cddfb352 100644 --- a/src/app/core/constants/ngxs-states.constant.ts +++ b/src/app/core/constants/ngxs-states.constant.ts @@ -5,7 +5,6 @@ import { InstitutionsAdminState } from '@osf/features/admin-institutions/store'; import { FilesState } from '@osf/features/files/store'; import { MetadataState } from '@osf/features/metadata/store'; import { ProjectOverviewState } from '@osf/features/project/overview/store'; -import { RegistrationsState } from '@osf/features/project/registrations/store'; import { AddonsState } from '@osf/shared/stores/addons'; import { BannersState } from '@osf/shared/stores/banners'; import { ContributorsState } from '@osf/shared/stores/contributors'; @@ -15,7 +14,6 @@ import { GlobalSearchState } from '@shared/stores/global-search'; import { InstitutionsState } from '@shared/stores/institutions'; import { InstitutionsSearchState } from '@shared/stores/institutions-search'; import { LicensesState } from '@shared/stores/licenses'; -import { LinkedProjectsState } from '@shared/stores/linked-projects'; import { MyResourcesState } from '@shared/stores/my-resources'; import { RegionsState } from '@shared/stores/regions'; @@ -30,7 +28,6 @@ export const STATES = [ InstitutionsSearchState, ProjectOverviewState, WikiState, - RegistrationsState, LicensesState, RegionsState, FilesState, @@ -38,6 +35,5 @@ export const STATES = [ CurrentResourceState, GlobalSearchState, BannersState, - LinkedProjectsState, ContributorsState, ]; diff --git a/src/app/core/constants/social-icons.constant.ts b/src/app/core/constants/social-icons.constant.ts index a9ffe0b0f..ae0c7b070 100644 --- a/src/app/core/constants/social-icons.constant.ts +++ b/src/app/core/constants/social-icons.constant.ts @@ -1,4 +1,4 @@ -import { SocialIcon } from '@osf/shared/models'; +import { SocialIcon } from '@osf/shared/models/socials/social-icon.model'; export const SOCIAL_ICONS: SocialIcon[] = [ { diff --git a/src/app/core/guards/auth.guard.spec.ts b/src/app/core/guards/auth.guard.spec.ts index 465c4e958..cc5dfcdb8 100644 --- a/src/app/core/guards/auth.guard.spec.ts +++ b/src/app/core/guards/auth.guard.spec.ts @@ -1,6 +1,6 @@ import { inject } from '@angular/core'; -import { AuthService } from '../services'; +import { AuthService } from '@core/services/auth.service'; import { authGuard } from './auth.guard'; diff --git a/src/app/core/guards/auth.guard.ts b/src/app/core/guards/auth.guard.ts index 9e233a5d6..d20108e71 100644 --- a/src/app/core/guards/auth.guard.ts +++ b/src/app/core/guards/auth.guard.ts @@ -5,9 +5,9 @@ import { map, switchMap, take } from 'rxjs'; import { inject } from '@angular/core'; import { CanActivateFn, Router } from '@angular/router'; -import { AuthService } from '@core/services'; +import { AuthService } from '@core/services/auth.service'; import { GetCurrentUser, UserSelectors } from '@osf/core/store/user'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; export const authGuard: CanActivateFn = () => { const store = inject(Store); diff --git a/src/app/core/guards/index.ts b/src/app/core/guards/index.ts deleted file mode 100644 index 98319a72e..000000000 --- a/src/app/core/guards/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { authGuard } from './auth.guard'; -export { isProjectGuard } from './is-project.guard'; -export { isRegistryGuard } from './is-registry.guard'; -export { redirectIfLoggedInGuard } from './redirect-if-logged-in.guard'; -export { viewOnlyGuard } from './view-only.guard'; diff --git a/src/app/core/guards/is-file.guard.ts b/src/app/core/guards/is-file.guard.ts index c1e543139..dea7fe8e1 100644 --- a/src/app/core/guards/is-file.guard.ts +++ b/src/app/core/guards/is-file.guard.ts @@ -5,10 +5,9 @@ import { map, switchMap } from 'rxjs/operators'; import { inject } from '@angular/core'; import { CanMatchFn, Route, Router, UrlSegment } from '@angular/router'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; import { CurrentResourceSelectors, GetResource } from '@osf/shared/stores/current-resource'; -import { CurrentResourceType } from '../../shared/enums'; - export const isFileGuard: CanMatchFn = (route: Route, segments: UrlSegment[]) => { const store = inject(Store); const router = inject(Router); diff --git a/src/app/core/guards/is-project.guard.ts b/src/app/core/guards/is-project.guard.ts index 43fbc078a..e41a461af 100644 --- a/src/app/core/guards/is-project.guard.ts +++ b/src/app/core/guards/is-project.guard.ts @@ -6,8 +6,8 @@ import { inject } from '@angular/core'; import { CanMatchFn, Route, Router, UrlSegment } from '@angular/router'; import { UserSelectors } from '@core/store/user'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; import { CurrentResourceSelectors, GetResource } from '@osf/shared/stores/current-resource'; -import { CurrentResourceType } from '@shared/enums'; export const isProjectGuard: CanMatchFn = (route: Route, segments: UrlSegment[]) => { const store = inject(Store); diff --git a/src/app/core/guards/is-registry.guard.ts b/src/app/core/guards/is-registry.guard.ts index ca713439e..9c9369019 100644 --- a/src/app/core/guards/is-registry.guard.ts +++ b/src/app/core/guards/is-registry.guard.ts @@ -6,7 +6,7 @@ import { inject } from '@angular/core'; import { CanMatchFn, Route, Router, UrlSegment } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { CurrentResourceType } from '@shared/enums'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; import { CurrentResourceSelectors, GetResource } from '@shared/stores/current-resource'; export const isRegistryGuard: CanMatchFn = (route: Route, segments: UrlSegment[]) => { diff --git a/src/app/core/guards/redirect-if-logged-in.guard.spec.ts b/src/app/core/guards/redirect-if-logged-in.guard.spec.ts index af6792014..f3855b273 100644 --- a/src/app/core/guards/redirect-if-logged-in.guard.spec.ts +++ b/src/app/core/guards/redirect-if-logged-in.guard.spec.ts @@ -1,6 +1,6 @@ import { Router } from '@angular/router'; -import { AuthService } from '../services'; +import { AuthService } from '@core/services/auth.service'; import { redirectIfLoggedInGuard } from './redirect-if-logged-in.guard'; diff --git a/src/app/core/guards/view-only.guard.ts b/src/app/core/guards/view-only.guard.ts index 964733c30..4cd3f5117 100644 --- a/src/app/core/guards/view-only.guard.ts +++ b/src/app/core/guards/view-only.guard.ts @@ -2,7 +2,7 @@ import { inject } from '@angular/core'; import { CanActivateFn, Router } from '@angular/router'; import { VIEW_ONLY_EXCLUDED_ROUTES } from '@core/constants/view-only-excluded-routes.const'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; export const viewOnlyGuard: CanActivateFn = (route) => { const router = inject(Router); diff --git a/src/app/core/helpers/index.ts b/src/app/core/helpers/index.ts deleted file mode 100644 index ac9901588..000000000 --- a/src/app/core/helpers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './i18n.helper'; -export * from './nav-menu.helper'; diff --git a/src/app/core/helpers/nav-menu.helper.ts b/src/app/core/helpers/nav-menu.helper.ts index 279c15c42..b126d2dc7 100644 --- a/src/app/core/helpers/nav-menu.helper.ts +++ b/src/app/core/helpers/nav-menu.helper.ts @@ -1,6 +1,3 @@ -import { UserPermissions } from '@osf/shared/enums'; -import { getViewOnlyParamFromUrl } from '@osf/shared/helpers'; - import { AUTHENTICATED_MENU_ITEMS, PREPRINT_MENU_ITEMS, @@ -8,8 +5,11 @@ import { REGISTRATION_MENU_ITEMS, VIEW_ONLY_PROJECT_MENU_ITEMS, VIEW_ONLY_REGISTRY_MENU_ITEMS, -} from '../constants'; -import { RouteContext } from '../models'; +} from '@core/constants/nav-items.constant'; +import { RouteContext } from '@core/models/route-context.model'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { getViewOnlyParamFromUrl } from '@osf/shared/helpers/view-only.helper'; + import { CustomMenuItem } from '../models/custom-menu-item.model'; function shouldShowMenuItem(menuItem: CustomMenuItem, permissions: UserPermissions[] | undefined): boolean { diff --git a/src/app/core/interceptors/error.interceptor.ts b/src/app/core/interceptors/error.interceptor.ts index 8c50bbc61..d4f038c89 100644 --- a/src/app/core/interceptors/error.interceptor.ts +++ b/src/app/core/interceptors/error.interceptor.ts @@ -5,12 +5,12 @@ import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http'; import { inject } from '@angular/core'; import { Router } from '@angular/router'; +import { ERROR_MESSAGES } from '@core/constants/error-messages'; import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; -import { LoaderService, ToastService } from '@osf/shared/services'; - -import { ERROR_MESSAGES } from '../constants'; -import { AuthService } from '../services'; +import { AuthService } from '@core/services/auth.service'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { BYPASS_ERROR_INTERCEPTOR } from './error-interceptor.tokens'; diff --git a/src/app/core/interceptors/index.ts b/src/app/core/interceptors/index.ts deleted file mode 100644 index b3bee1a9a..000000000 --- a/src/app/core/interceptors/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { authInterceptor } from './auth.interceptor'; -export { errorInterceptor } from './error.interceptor'; -export { BYPASS_ERROR_INTERCEPTOR } from './error-interceptor.tokens'; -export { viewOnlyInterceptor } from './view-only.interceptor'; diff --git a/src/app/core/interceptors/view-only.interceptor.ts b/src/app/core/interceptors/view-only.interceptor.ts index a0a4d91e1..e77c731ab 100644 --- a/src/app/core/interceptors/view-only.interceptor.ts +++ b/src/app/core/interceptors/view-only.interceptor.ts @@ -4,7 +4,7 @@ import { HttpEvent, HttpHandlerFn, HttpInterceptorFn, HttpRequest } from '@angul import { inject } from '@angular/core'; import { Router } from '@angular/router'; -import { getViewOnlyParam } from '@osf/shared/helpers'; +import { getViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; export const viewOnlyInterceptor: HttpInterceptorFn = ( req: HttpRequest, diff --git a/src/app/core/models/custom-menu-item.model.ts b/src/app/core/models/custom-menu-item.model.ts index c8af4ba3e..04d413977 100644 --- a/src/app/core/models/custom-menu-item.model.ts +++ b/src/app/core/models/custom-menu-item.model.ts @@ -1,6 +1,6 @@ import { MenuItem } from 'primeng/api'; -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; export interface CustomMenuItem extends MenuItem { requiredPermission?: UserPermissions; diff --git a/src/app/core/models/index.ts b/src/app/core/models/index.ts deleted file mode 100644 index 86f9cf210..000000000 --- a/src/app/core/models/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './custom-menu-item.model'; -export * from './route-context.model'; -export * from './route-data.model'; -export * from './sign-up.model'; diff --git a/src/app/core/models/route-context.model.ts b/src/app/core/models/route-context.model.ts index 456173ee2..fa6f20a7b 100644 --- a/src/app/core/models/route-context.model.ts +++ b/src/app/core/models/route-context.model.ts @@ -1,4 +1,4 @@ -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; export interface RouteContext { resourceId: string | undefined; diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index 7da6a169e..c07b1e10d 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -4,12 +4,12 @@ import { CookieService } from 'ngx-cookie-service'; import { inject, Injectable } from '@angular/core'; +import { SignUpModel } from '@core/models/sign-up.model'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ClearCurrentUser } from '@osf/core/store/user'; -import { urlParam } from '@osf/shared/helpers'; -import { JsonApiService, LoaderService } from '@osf/shared/services'; - -import { SignUpModel } from '../models'; +import { urlParam } from '@osf/shared/helpers/url-param.helper'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; @Injectable({ providedIn: 'root', diff --git a/src/app/core/services/index.ts b/src/app/core/services/index.ts deleted file mode 100644 index acb0db14e..000000000 --- a/src/app/core/services/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { AuthService } from './auth.service'; -export { UserService } from './user.service'; -export { UserEmailsService } from './user-emails.service'; diff --git a/src/app/core/services/user-emails.service.ts b/src/app/core/services/user-emails.service.ts index 1ee9834e2..1a4415516 100644 --- a/src/app/core/services/user-emails.service.ts +++ b/src/app/core/services/user-emails.service.ts @@ -3,9 +3,14 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MapEmail, MapEmails } from '@osf/shared/mappers'; -import { AccountEmailModel, EmailResponseJsonApi, EmailsDataJsonApi, EmailsResponseJsonApi } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { MapEmail, MapEmails } from '@osf/shared/mappers/emails.mapper'; +import { AccountEmailModel } from '@osf/shared/models/emails/account-email.model'; +import { + EmailResponseJsonApi, + EmailsDataJsonApi, + EmailsResponseJsonApi, +} from '@osf/shared/models/emails/account-emails-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; @Injectable({ providedIn: 'root', diff --git a/src/app/core/services/user.service.ts b/src/app/core/services/user.service.ts index bffea800f..8de41701d 100644 --- a/src/app/core/services/user.service.ts +++ b/src/app/core/services/user.service.ts @@ -3,18 +3,17 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ProfileSettingsKey } from '@osf/shared/enums'; -import { UserMapper } from '@osf/shared/mappers'; +import { ProfileSettingsKey } from '@osf/shared/enums/profile-settings-key.enum'; +import { UserMapper } from '@osf/shared/mappers/user'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { ProfileSettingsUpdate } from '@shared/models/profile-settings-update.model'; +import { UserData, UserModel } from '@shared/models/user/user.models'; import { - ProfileSettingsUpdate, UserAcceptedTermsOfServiceJsonApi, - UserData, UserDataJsonApi, UserDataResponseJsonApi, - UserModel, UserResponseJsonApi, -} from '@osf/shared/models'; -import { JsonApiService } from '@shared/services'; +} from '@shared/models/user/user-json-api.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/core/store/provider/provider.actions.ts b/src/app/core/store/provider/provider.actions.ts index aeed386b5..5e6f65bc2 100644 --- a/src/app/core/store/provider/provider.actions.ts +++ b/src/app/core/store/provider/provider.actions.ts @@ -1,4 +1,4 @@ -import { ProviderShortInfoModel } from '@osf/shared/models'; +import { ProviderShortInfoModel } from '@osf/shared/models/provider/provider.model'; export class SetCurrentProvider { static readonly type = '[Provider] Set Current Provider'; diff --git a/src/app/core/store/provider/provider.model.ts b/src/app/core/store/provider/provider.model.ts index bc5d90faa..b8318ca0e 100644 --- a/src/app/core/store/provider/provider.model.ts +++ b/src/app/core/store/provider/provider.model.ts @@ -1,4 +1,4 @@ -import { ProviderShortInfoModel } from '@osf/shared/models'; +import { ProviderShortInfoModel } from '@osf/shared/models/provider/provider.model'; export interface ProviderStateModel { currentProvider: ProviderShortInfoModel | null; diff --git a/src/app/core/store/provider/provider.selectors.ts b/src/app/core/store/provider/provider.selectors.ts index 1da68985e..c43ddd904 100644 --- a/src/app/core/store/provider/provider.selectors.ts +++ b/src/app/core/store/provider/provider.selectors.ts @@ -1,7 +1,7 @@ import { Selector } from '@ngxs/store'; -import { ReviewPermissions } from '@osf/shared/enums'; -import { ProviderShortInfoModel } from '@osf/shared/models'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; +import { ProviderShortInfoModel } from '@shared/models/provider/provider.model'; import { ProviderStateModel } from './provider.model'; import { ProviderState } from './provider.state'; diff --git a/src/app/core/store/user-emails/user-emails.model.ts b/src/app/core/store/user-emails/user-emails.model.ts index fa894f3dc..fc9ff9550 100644 --- a/src/app/core/store/user-emails/user-emails.model.ts +++ b/src/app/core/store/user-emails/user-emails.model.ts @@ -1,4 +1,5 @@ -import { AccountEmailModel, AsyncStateModel } from '@shared/models'; +import { AccountEmailModel } from '@osf/shared/models/emails/account-email.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface UserEmailsStateModel { emails: AsyncStateModel; diff --git a/src/app/core/store/user-emails/user-emails.selectors.ts b/src/app/core/store/user-emails/user-emails.selectors.ts index 7e1f0316d..2787239f4 100644 --- a/src/app/core/store/user-emails/user-emails.selectors.ts +++ b/src/app/core/store/user-emails/user-emails.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { AccountEmailModel } from '@osf/shared/models'; +import { AccountEmailModel } from '@osf/shared/models/emails/account-email.model'; import { UserEmailsStateModel } from './user-emails.model'; import { UserEmailsState } from './user-emails.state'; diff --git a/src/app/core/store/user-emails/user-emails.state.ts b/src/app/core/store/user-emails/user-emails.state.ts index 3b1c176c8..31fb2b2f0 100644 --- a/src/app/core/store/user-emails/user-emails.state.ts +++ b/src/app/core/store/user-emails/user-emails.state.ts @@ -4,8 +4,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { UserEmailsService } from '@core/services'; -import { handleSectionError } from '@osf/shared/helpers'; +import { UserEmailsService } from '@core/services/user-emails.service'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { UserSelectors } from '../user/user.selectors'; diff --git a/src/app/core/store/user/user.actions.ts b/src/app/core/store/user/user.actions.ts index b81dab84d..c645288df 100644 --- a/src/app/core/store/user/user.actions.ts +++ b/src/app/core/store/user/user.actions.ts @@ -1,4 +1,7 @@ -import { Education, Employment, SocialModel, UserModel } from '@osf/shared/models'; +import { Education } from '@osf/shared/models/user/education.model'; +import { Employment } from '@osf/shared/models/user/employment.model'; +import { SocialModel } from '@osf/shared/models/user/social.model'; +import { UserModel } from '@osf/shared/models/user/user.models'; export class GetCurrentUser { static readonly type = '[User] Get Current User'; diff --git a/src/app/core/store/user/user.model.ts b/src/app/core/store/user/user.model.ts index 83207c2f8..35a18a34b 100644 --- a/src/app/core/store/user/user.model.ts +++ b/src/app/core/store/user/user.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, UserModel } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { UserModel } from '@osf/shared/models/user/user.models'; export interface UserStateModel { currentUser: AsyncStateModel; diff --git a/src/app/core/store/user/user.selectors.ts b/src/app/core/store/user/user.selectors.ts index 9839b480d..77f285acf 100644 --- a/src/app/core/store/user/user.selectors.ts +++ b/src/app/core/store/user/user.selectors.ts @@ -1,6 +1,9 @@ import { Selector } from '@ngxs/store'; -import { Education, Employment, SocialModel, UserModel } from '@osf/shared/models'; +import { Education } from '@osf/shared/models/user/education.model'; +import { Employment } from '@osf/shared/models/user/employment.model'; +import { SocialModel } from '@osf/shared/models/user/social.model'; +import { UserModel } from '@osf/shared/models/user/user.models'; import { UserStateModel } from './user.model'; import { UserState } from './user.state'; diff --git a/src/app/core/store/user/user.state.ts b/src/app/core/store/user/user.state.ts index 760a77b65..5bccbc339 100644 --- a/src/app/core/store/user/user.state.ts +++ b/src/app/core/store/user/user.state.ts @@ -4,12 +4,12 @@ import { tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { ProfileSettingsKey } from '@osf/shared/enums'; -import { removeNullable } from '@osf/shared/helpers'; -import { UserMapper } from '@osf/shared/mappers'; -import { SocialModel, UserModel } from '@osf/shared/models'; - -import { UserService } from '../../services'; +import { UserService } from '@core/services/user.service'; +import { ProfileSettingsKey } from '@osf/shared/enums/profile-settings-key.enum'; +import { removeNullable } from '@osf/shared/helpers/remove-nullable.helper'; +import { UserMapper } from '@osf/shared/mappers/user'; +import { SocialModel } from '@shared/models/user/social.model'; +import { UserModel } from '@shared/models/user/user.models'; import { AcceptTermsOfServiceByUser, diff --git a/src/app/features/admin-institutions/admin-institutions.component.spec.ts b/src/app/features/admin-institutions/admin-institutions.component.spec.ts index a2af8f668..baf0fec8b 100644 --- a/src/app/features/admin-institutions/admin-institutions.component.spec.ts +++ b/src/app/features/admin-institutions/admin-institutions.component.spec.ts @@ -1,46 +1,72 @@ -import { provideStore } from '@ngxs/store'; +import { Store } from '@ngxs/store'; import { MockComponents, MockProvider } from 'ng-mocks'; -import { provideHttpClient } from '@angular/common/http'; -import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { of } from 'rxjs'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search'; -import { LoadingSpinnerComponent, SelectComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { AdminInstitutionsComponent } from './admin-institutions.component'; +import { AdminInstitutionResourceTab } from './enums'; +import { InstitutionsAdminSelectors } from './store'; + +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; +import { OSFTestingModule } from '@testing/osf.testing.module'; +import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; +import { RouterMockBuilder } from '@testing/providers/router-provider.mock'; +import { provideMockStore } from '@testing/providers/store-provider.mock'; -describe.skip('AdminInstitutionsComponent', () => { +describe('AdminInstitutionsComponent', () => { let component: AdminInstitutionsComponent; let fixture: ComponentFixture; - - const mockActivatedRoute = { - snapshot: { - params: { 'institution-id': '42' }, - firstChild: { routeConfig: { path: 'summary' } }, - }, - }; + let mockActivatedRoute: ReturnType; + let mockRouter: ReturnType; + let store: jest.Mocked; beforeEach(async () => { + mockActivatedRoute = ActivatedRouteMockBuilder.create().build(); + mockRouter = RouterMockBuilder.create().build(); + await TestBed.configureTestingModule({ - imports: [AdminInstitutionsComponent, ...MockComponents(LoadingSpinnerComponent, SelectComponent)], + imports: [ + AdminInstitutionsComponent, + OSFTestingModule, + ...MockComponents(LoadingSpinnerComponent, SelectComponent), + ], providers: [ - { provide: ActivatedRoute, useValue: mockActivatedRoute }, - MockProvider(Router), - provideStore([InstitutionsSearchState]), - provideHttpClient(), - provideHttpClientTesting(), + MockProvider(ActivatedRoute, mockActivatedRoute), + MockProvider(Router, mockRouter), + provideMockStore({ + signals: [ + { selector: InstitutionsAdminSelectors.getInstitution, value: MOCK_INSTITUTION }, + { selector: InstitutionsAdminSelectors.getInstitutionLoading, value: false }, + ], + }), ], }).compileComponents(); fixture = TestBed.createComponent(AdminInstitutionsComponent); component = fixture.componentInstance; - fixture.detectChanges(); + + store = TestBed.inject(Store) as jest.Mocked; + store.dispatch = jest.fn().mockReturnValue(of(undefined)); }); it('should create', () => { + fixture.detectChanges(); expect(component).toBeTruthy(); }); + + it('should initialize resourceTabOptions', () => { + expect(component.resourceTabOptions).toBeDefined(); + expect(component.resourceTabOptions.length).toBeGreaterThan(0); + }); + + it('should initialize selectedTab to Summary by default', () => { + expect(component.selectedTab).toBe(AdminInstitutionResourceTab.Summary); + }); }); diff --git a/src/app/features/admin-institutions/admin-institutions.component.ts b/src/app/features/admin-institutions/admin-institutions.component.ts index 9f61a7ac7..be82e1b2c 100644 --- a/src/app/features/admin-institutions/admin-institutions.component.ts +++ b/src/app/features/admin-institutions/admin-institutions.component.ts @@ -8,12 +8,13 @@ import { NgOptimizedImage } from '@angular/common'; import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core'; import { ActivatedRoute, Router, RouterOutlet } from '@angular/router'; -import { FetchInstitutionById, InstitutionsAdminSelectors } from '@osf/features/admin-institutions/store'; -import { Primitive } from '@osf/shared/helpers'; -import { LoadingSpinnerComponent, SelectComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { resourceTabOptions } from './constants'; import { AdminInstitutionResourceTab } from './enums'; +import { FetchInstitutionById, InstitutionsAdminSelectors } from './store'; @Component({ selector: 'osf-admin-institutions', diff --git a/src/app/features/admin-institutions/components/admin-table/admin-table.component.spec.ts b/src/app/features/admin-institutions/components/admin-table/admin-table.component.spec.ts index bb30a5107..f0785d766 100644 --- a/src/app/features/admin-institutions/components/admin-table/admin-table.component.spec.ts +++ b/src/app/features/admin-institutions/components/admin-table/admin-table.component.spec.ts @@ -5,8 +5,8 @@ import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TableCellLink } from '@osf/features/admin-institutions/models'; -import { CustomPaginatorComponent } from '@shared/components'; -import { StopPropagationDirective } from '@shared/directives'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; import { AdminTableComponent } from './admin-table.component'; @@ -21,10 +21,9 @@ describe('AdminTableComponent', () => { await TestBed.configureTestingModule({ imports: [ AdminTableComponent, - MockComponent(CustomPaginatorComponent), OSFTestingModule, - MockPipe(DatePipe), MockComponent(CustomPaginatorComponent), + MockPipe(DatePipe), MockDirective(StopPropagationDirective), ], }).compileComponents(); diff --git a/src/app/features/admin-institutions/components/admin-table/admin-table.component.ts b/src/app/features/admin-institutions/components/admin-table/admin-table.component.ts index 4d6b5d5ed..68d79dbb5 100644 --- a/src/app/features/admin-institutions/components/admin-table/admin-table.component.ts +++ b/src/app/features/admin-institutions/components/admin-table/admin-table.component.ts @@ -19,9 +19,10 @@ import { TableColumn, TableIconClickEvent, } from '@osf/features/admin-institutions/models'; -import { CustomPaginatorComponent } from '@osf/shared/components'; -import { StopPropagationDirective } from '@shared/directives'; -import { PaginationLinksModel, SearchFilters } from '@shared/models'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; +import { PaginationLinksModel } from '@osf/shared/models/pagination-links.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; import { DOWNLOAD_OPTIONS } from '../../constants'; import { DownloadType } from '../../enums'; diff --git a/src/app/features/admin-institutions/components/filters-section/filters-section.component.spec.ts b/src/app/features/admin-institutions/components/filters-section/filters-section.component.spec.ts index c28be0a04..494ce5a0b 100644 --- a/src/app/features/admin-institutions/components/filters-section/filters-section.component.spec.ts +++ b/src/app/features/admin-institutions/components/filters-section/filters-section.component.spec.ts @@ -1,5 +1,10 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FilterChipsComponent } from '@osf/shared/components/filter-chips/filter-chips.component'; +import { SearchFiltersComponent } from '@osf/shared/components/search-filters/search-filters.component'; + import { FiltersSectionComponent } from './filters-section.component'; describe.skip('FiltersSectionComponent', () => { @@ -8,7 +13,7 @@ describe.skip('FiltersSectionComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FiltersSectionComponent], + imports: [FiltersSectionComponent, ...MockComponents(FilterChipsComponent, SearchFiltersComponent)], }).compileComponents(); fixture = TestBed.createComponent(FiltersSectionComponent); 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 1b2aa72d0..72578033a 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 @@ -7,8 +7,9 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, model } from '@angular/core'; -import { FilterChipsComponent, SearchFiltersComponent } from '@shared/components'; -import { DiscoverableFilter, FilterOption } from '@shared/models'; +import { FilterChipsComponent } from '@osf/shared/components/filter-chips/filter-chips.component'; +import { SearchFiltersComponent } from '@osf/shared/components/search-filters/search-filters.component'; +import { DiscoverableFilter, FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; import { ClearFilterSearchResults, FetchResources, diff --git a/src/app/features/admin-institutions/constants/contact-options.constant.ts b/src/app/features/admin-institutions/constants/contact-options.constant.ts index 2429a3a05..ac04b4497 100644 --- a/src/app/features/admin-institutions/constants/contact-options.constant.ts +++ b/src/app/features/admin-institutions/constants/contact-options.constant.ts @@ -1,4 +1,4 @@ -import { SelectOption } from '@shared/models'; +import { SelectOption } from '@shared/models/select-option.model'; import { ContactOption } from '../enums'; diff --git a/src/app/features/admin-institutions/constants/department-options.constant.ts b/src/app/features/admin-institutions/constants/department-options.constant.ts index 9ae885c16..41ebbb59b 100644 --- a/src/app/features/admin-institutions/constants/department-options.constant.ts +++ b/src/app/features/admin-institutions/constants/department-options.constant.ts @@ -1,4 +1,4 @@ -import { SelectOption } from '@shared/models'; +import { SelectOption } from '@shared/models/select-option.model'; export const departmentOptions: SelectOption[] = [ { label: 'adminInstitutions.institutionUsers.allDepartments', value: null }, diff --git a/src/app/features/admin-institutions/constants/resource-tab-option.constant.ts b/src/app/features/admin-institutions/constants/resource-tab-option.constant.ts index d4d9249b2..b14c2ae39 100644 --- a/src/app/features/admin-institutions/constants/resource-tab-option.constant.ts +++ b/src/app/features/admin-institutions/constants/resource-tab-option.constant.ts @@ -1,4 +1,4 @@ -import { CustomOption } from '@shared/models'; +import { CustomOption } from '@osf/shared/models/select-option.model'; import { AdminInstitutionResourceTab } from '../enums'; diff --git a/src/app/features/admin-institutions/dialogs/contact-dialog/contact-dialog.component.ts b/src/app/features/admin-institutions/dialogs/contact-dialog/contact-dialog.component.ts index 1d4d77c40..01f267d72 100644 --- a/src/app/features/admin-institutions/dialogs/contact-dialog/contact-dialog.component.ts +++ b/src/app/features/admin-institutions/dialogs/contact-dialog/contact-dialog.component.ts @@ -10,7 +10,7 @@ import { Textarea } from 'primeng/textarea'; import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; -import { CustomValidators } from '@osf/shared/helpers'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { CONTACT_OPTIONS } from '../../constants'; import { ContactOption, ProjectPermission } from '../../enums'; diff --git a/src/app/features/admin-institutions/helpers/download-url.helper.ts b/src/app/features/admin-institutions/helpers/download-url.helper.ts index 7bdac62e4..89e4e377c 100644 --- a/src/app/features/admin-institutions/helpers/download-url.helper.ts +++ b/src/app/features/admin-institutions/helpers/download-url.helper.ts @@ -1,4 +1,4 @@ -import { CurrentResourceType } from '@shared/enums'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; import { DOWNLOAD_FORMATS } from '../constants'; import { DownloadType } from '../enums'; diff --git a/src/app/features/admin-institutions/mappers/creators.mapper.ts b/src/app/features/admin-institutions/mappers/creators.mapper.ts index f0b9b5c90..bf25e0b12 100644 --- a/src/app/features/admin-institutions/mappers/creators.mapper.ts +++ b/src/app/features/admin-institutions/mappers/creators.mapper.ts @@ -1,5 +1,5 @@ -import { getSortedContributorsByPermissions } from '@shared/helpers'; -import { ResourceModel } from '@shared/models'; +import { getSortedContributorsByPermissions } from '@osf/shared/helpers/sort-contributors-by-permissions'; +import { ResourceModel } from '@shared/models/search/resource.model'; export function mapCreators(project: ResourceModel, currentInstitutionId: string) { const creatorsRoles = project.qualifiedAttribution.map((qa) => { diff --git a/src/app/features/admin-institutions/mappers/institution-preprint-to-table-data.mapper.ts b/src/app/features/admin-institutions/mappers/institution-preprint-to-table-data.mapper.ts index 78247d03a..679bed1ab 100644 --- a/src/app/features/admin-institutions/mappers/institution-preprint-to-table-data.mapper.ts +++ b/src/app/features/admin-institutions/mappers/institution-preprint-to-table-data.mapper.ts @@ -1,4 +1,4 @@ -import { ResourceModel } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; import { extractPathAfterDomain } from '../helpers'; import { TableCellData } from '../models'; diff --git a/src/app/features/admin-institutions/mappers/institution-project-to-table-data.mapper.ts b/src/app/features/admin-institutions/mappers/institution-project-to-table-data.mapper.ts index 0a32b1a02..92c5e88ee 100644 --- a/src/app/features/admin-institutions/mappers/institution-project-to-table-data.mapper.ts +++ b/src/app/features/admin-institutions/mappers/institution-project-to-table-data.mapper.ts @@ -1,4 +1,4 @@ -import { ResourceModel } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; import { extractPathAfterDomain } from '../helpers'; import { TableCellData } from '../models'; diff --git a/src/app/features/admin-institutions/mappers/institution-registration-to-table-data.mapper.ts b/src/app/features/admin-institutions/mappers/institution-registration-to-table-data.mapper.ts index 5116c73df..a38e1a434 100644 --- a/src/app/features/admin-institutions/mappers/institution-registration-to-table-data.mapper.ts +++ b/src/app/features/admin-institutions/mappers/institution-registration-to-table-data.mapper.ts @@ -1,5 +1,5 @@ import { extractPathAfterDomain } from '@osf/features/admin-institutions/helpers'; -import { ResourceModel } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; import { TableCellData } from '../models'; diff --git a/src/app/features/admin-institutions/models/institution-index-value-search-json-api.model.ts b/src/app/features/admin-institutions/models/institution-index-value-search-json-api.model.ts index 45faf689c..9c6a995eb 100644 --- a/src/app/features/admin-institutions/models/institution-index-value-search-json-api.model.ts +++ b/src/app/features/admin-institutions/models/institution-index-value-search-json-api.model.ts @@ -1,4 +1,4 @@ -import { JsonApiResponse } from '@shared/models'; +import { JsonApiResponse } from '@shared/models/common/json-api.model'; export interface InstitutionSearchResultCountJsonApi { attributes: { diff --git a/src/app/features/admin-institutions/models/institution-users-json-api.model.ts b/src/app/features/admin-institutions/models/institution-users-json-api.model.ts index 3b90db240..dd07ec1eb 100644 --- a/src/app/features/admin-institutions/models/institution-users-json-api.model.ts +++ b/src/app/features/admin-institutions/models/institution-users-json-api.model.ts @@ -1,4 +1,4 @@ -import { MetaJsonApi } from '@shared/models'; +import { MetaJsonApi } from '@osf/shared/models/common/json-api.model'; export interface InstitutionUserAttributesJsonApi { user_name: string; diff --git a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.spec.ts b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.spec.ts index c8c632e79..fdb0e444a 100644 --- a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.spec.ts +++ b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.spec.ts @@ -12,7 +12,8 @@ import { ActivatedRoute, Router } from '@angular/router'; import { AdminTableComponent } from '@osf/features/admin-institutions/components'; import { InstitutionsAdminState } from '@osf/features/admin-institutions/store'; -import { LoadingSpinnerComponent } from '@shared/components'; + +import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { InstitutionsPreprintsComponent } from './institutions-preprints.component'; @@ -30,7 +31,7 @@ describe.skip('InstitutionsPreprintsComponent', () => { await TestBed.configureTestingModule({ imports: [ InstitutionsPreprintsComponent, - ...MockComponents(AdminTableComponent, LoadingSpinnerComponent), + ...MockComponents(AdminTableComponent, FiltersSectionComponent), MockPipe(TranslatePipe), ], providers: [ diff --git a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts index 8da5f03c3..271e7e1bf 100644 --- a/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-preprints/institutions-preprints.component.ts @@ -7,8 +7,11 @@ import { Button } from 'primeng/button'; import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, OnDestroy, OnInit, signal } from '@angular/core'; -import { CurrentResourceType, ResourceType, SortOrder } from '@osf/shared/enums'; -import { PaginationLinksModel, ResourceModel, SearchFilters } from '@osf/shared/models'; +import { CurrentResourceType, ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { PaginationLinksModel } from '@osf/shared/models/pagination-links.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; import { FetchResources, FetchResourcesByLink, @@ -17,7 +20,7 @@ import { SetDefaultFilterValue, SetResourceType, SetSortBy, -} from '@shared/stores/global-search'; +} from '@osf/shared/stores/global-search'; import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; diff --git a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.spec.ts b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.spec.ts index a7d20bf54..e0118cbe1 100644 --- a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.spec.ts +++ b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.spec.ts @@ -1,6 +1,6 @@ import { provideStore } from '@ngxs/store'; -import { TranslatePipe, TranslateService } from '@ngx-translate/core'; +import { TranslatePipe } from '@ngx-translate/core'; import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -12,9 +12,10 @@ import { ActivatedRoute } from '@angular/router'; import { AdminTableComponent } from '@osf/features/admin-institutions/components'; import { InstitutionsAdminState } from '@osf/features/admin-institutions/store'; -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search'; -import { LoadingSpinnerComponent } from '@shared/components'; + +import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { InstitutionsProjectsComponent } from './institutions-projects.component'; @@ -26,13 +27,12 @@ describe.skip('InstitutionsProjectsComponent', () => { await TestBed.configureTestingModule({ imports: [ InstitutionsProjectsComponent, - ...MockComponents(AdminTableComponent, LoadingSpinnerComponent), + ...MockComponents(AdminTableComponent, FiltersSectionComponent), MockPipe(TranslatePipe), ], providers: [ MockProvider(ActivatedRoute, { queryParams: of({}) }), MockProvider(ToastService), - MockProvider(TranslateService), provideStore([InstitutionsAdminState, InstitutionsSearchState]), provideHttpClient(), provideHttpClientTesting(), diff --git a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts index 455455e31..11c826559 100644 --- a/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-projects/institutions-projects.component.ts @@ -20,10 +20,13 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { UserSelectors } from '@core/store/user'; -import { RequestAccessErrorDialogComponent } from '@osf/features/admin-institutions/components/request-access-error-dialog/request-access-error-dialog.component'; -import { CurrentResourceType, ResourceType, SortOrder } from '@osf/shared/enums'; -import { PaginationLinksModel, ResourceModel, SearchFilters } from '@osf/shared/models'; -import { CustomDialogService, ToastService } from '@osf/shared/services'; +import { CurrentResourceType, ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { PaginationLinksModel } from '@osf/shared/models/pagination-links.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { FetchResources, FetchResourcesByLink, @@ -32,10 +35,11 @@ import { SetDefaultFilterValue, SetResourceType, SetSortBy, -} from '@shared/stores/global-search'; +} from '@osf/shared/stores/global-search'; import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; +import { RequestAccessErrorDialogComponent } from '../../components/request-access-error-dialog/request-access-error-dialog.component'; import { projectTableColumns } from '../../constants'; import { ContactDialogComponent } from '../../dialogs'; import { ContactOption, DownloadType } from '../../enums'; diff --git a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.spec.ts b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.spec.ts index 90e5cc629..520afd780 100644 --- a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.spec.ts +++ b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.spec.ts @@ -12,7 +12,8 @@ import { ActivatedRoute, Router } from '@angular/router'; import { AdminTableComponent } from '@osf/features/admin-institutions/components'; import { InstitutionsAdminState } from '@osf/features/admin-institutions/store'; import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search'; -import { LoadingSpinnerComponent } from '@shared/components'; + +import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; import { InstitutionsRegistrationsComponent } from './institutions-registrations.component'; @@ -22,7 +23,7 @@ describe.skip('InstitutionsRegistrationsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [InstitutionsRegistrationsComponent, ...MockComponents(AdminTableComponent, LoadingSpinnerComponent)], + imports: [InstitutionsRegistrationsComponent, ...MockComponents(AdminTableComponent, FiltersSectionComponent)], providers: [ MockProvider(ActivatedRoute, { queryParams: of({}) }), MockProvider(Router), diff --git a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts index 6461ba964..099951102 100644 --- a/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-registrations/institutions-registrations.component.ts @@ -7,9 +7,11 @@ import { Button } from 'primeng/button'; import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, OnDestroy, OnInit, signal } from '@angular/core'; -import { TableCellData } from '@osf/features/admin-institutions/models'; -import { CurrentResourceType, ResourceType, SortOrder } from '@osf/shared/enums'; -import { PaginationLinksModel, ResourceModel, SearchFilters } from '@osf/shared/models'; +import { CurrentResourceType, ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { PaginationLinksModel } from '@osf/shared/models/pagination-links.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; import { ClearFilterSearchResults, FetchResources, @@ -19,7 +21,7 @@ import { SetDefaultFilterValue, SetResourceType, SetSortBy, -} from '@shared/stores/global-search'; +} from '@osf/shared/stores/global-search'; import { AdminTableComponent } from '../../components'; import { FiltersSectionComponent } from '../../components/filters-section/filters-section.component'; @@ -27,6 +29,7 @@ import { registrationTableColumns } from '../../constants'; import { DownloadType } from '../../enums'; import { downloadResults, INSTITUTIONS_CSV_TSV_FIELDS, INSTITUTIONS_DOWNLOAD_CSV_TSV_RESOURCE } from '../../helpers'; import { mapRegistrationResourceToTableData } from '../../mappers/institution-registration-to-table-data.mapper'; +import { TableCellData } from '../../models'; import { InstitutionsAdminSelectors } from '../../store'; @Component({ diff --git a/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.spec.ts b/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.spec.ts index f03f1df41..df59e1126 100644 --- a/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.spec.ts +++ b/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.spec.ts @@ -11,7 +11,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { InstitutionsAdminState } from '@osf/features/admin-institutions/store'; -import { BarChartComponent, LoadingSpinnerComponent, StatisticCardComponent } from '@shared/components'; +import { BarChartComponent } from '@osf/shared/components/bar-chart/bar-chart.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { StatisticCardComponent } from '@osf/shared/components/statistic-card/statistic-card.component'; import { DoughnutChartComponent } from '@shared/components/doughnut-chart/doughnut-chart.component'; import { InstitutionsSummaryComponent } from './institutions-summary.component'; diff --git a/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.ts b/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.ts index 2b340f435..4d89b1140 100644 --- a/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-summary/institutions-summary.component.ts @@ -5,9 +5,12 @@ import { TranslatePipe, TranslateService } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, effect, inject, OnInit, signal } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { BarChartComponent, LoadingSpinnerComponent, StatisticCardComponent } from '@shared/components'; +import { BarChartComponent } from '@osf/shared/components/bar-chart/bar-chart.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { StatisticCardComponent } from '@osf/shared/components/statistic-card/statistic-card.component'; +import { DatasetInput } from '@osf/shared/models/charts/dataset-input'; +import { SelectOption } from '@osf/shared/models/select-option.model'; import { DoughnutChartComponent } from '@shared/components/doughnut-chart/doughnut-chart.component'; -import { DatasetInput, SelectOption } from '@shared/models'; import { FetchHasOsfAddonSearch, diff --git a/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.spec.ts b/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.spec.ts index f2c37b13e..6348f7f68 100644 --- a/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.spec.ts +++ b/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.spec.ts @@ -10,13 +10,14 @@ import { ActivatedRoute, Router } from '@angular/router'; import { UserState } from '@core/store/user'; import { AdminTableComponent } from '@osf/features/admin-institutions/components'; import { InstitutionsAdminState } from '@osf/features/admin-institutions/store'; -import { CustomDialogService, ToastService } from '@osf/shared/services'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { InstitutionsSearchState } from '@osf/shared/stores/institutions-search'; -import { LoadingSpinnerComponent, SelectComponent } from '@shared/components'; import { InstitutionsUsersComponent } from './institutions-users.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; @@ -29,11 +30,7 @@ describe('InstitutionsUsersComponent', () => { mockCustomDialogService = CustomDialogServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [ - InstitutionsUsersComponent, - ...MockComponents(AdminTableComponent, SelectComponent, LoadingSpinnerComponent), - OSFTestingModule, - ], + imports: [InstitutionsUsersComponent, ...MockComponents(AdminTableComponent, SelectComponent), OSFTestingModule], providers: [ MockProvider(ActivatedRoute, { queryParams: of({}) }), MockProvider(Router), diff --git a/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.ts b/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.ts index 9510d4d63..ee9b276f0 100644 --- a/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.ts +++ b/src/app/features/admin-institutions/pages/institutions-users/institutions-users.component.ts @@ -13,12 +13,13 @@ import { FormsModule } from '@angular/forms'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { UserSelectors } from '@osf/core/store/user'; -import { SelectComponent } from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { Primitive } from '@osf/shared/helpers'; -import { SearchFilters } from '@osf/shared/models'; -import { CustomDialogService, ToastService } from '@osf/shared/services'; -import { SortOrder } from '@shared/enums'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { Primitive } from '@osf/shared/helpers/types.helper'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { SortOrder } from '@shared/enums/sort-order.enum'; +import { SearchFilters } from '@shared/models/search-filters.model'; import { AdminTableComponent } from '../../components'; import { departmentOptions, userTableColumns } from '../../constants'; diff --git a/src/app/features/admin-institutions/services/institutions-admin.service.ts b/src/app/features/admin-institutions/services/institutions-admin.service.ts index 4b3eb4e97..92cf4855e 100644 --- a/src/app/features/admin-institutions/services/institutions-admin.service.ts +++ b/src/app/features/admin-institutions/services/institutions-admin.service.ts @@ -4,7 +4,7 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiService } from '@shared/services'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { mapIndexCardResults, diff --git a/src/app/features/admin-institutions/store/institutions-admin.model.ts b/src/app/features/admin-institutions/store/institutions-admin.model.ts index a93998706..d62a6d0eb 100644 --- a/src/app/features/admin-institutions/store/institutions-admin.model.ts +++ b/src/app/features/admin-institutions/store/institutions-admin.model.ts @@ -1,4 +1,6 @@ -import { AsyncStateModel, AsyncStateWithTotalCount, Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { InstitutionDepartment, InstitutionSearchFilter, InstitutionSummaryMetrics, InstitutionUser } from '../models'; diff --git a/src/app/features/admin-institutions/store/institutions-admin.selectors.ts b/src/app/features/admin-institutions/store/institutions-admin.selectors.ts index bb7e54173..4211deb98 100644 --- a/src/app/features/admin-institutions/store/institutions-admin.selectors.ts +++ b/src/app/features/admin-institutions/store/institutions-admin.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; import { InstitutionDepartment, InstitutionSearchFilter, InstitutionSummaryMetrics, InstitutionUser } from '../models'; diff --git a/src/app/features/admin-institutions/store/institutions-admin.state.ts b/src/app/features/admin-institutions/store/institutions-admin.state.ts index 7ab2223cb..6e2d720cb 100644 --- a/src/app/features/admin-institutions/store/institutions-admin.state.ts +++ b/src/app/features/admin-institutions/store/institutions-admin.state.ts @@ -5,9 +5,9 @@ import { catchError, tap, throwError } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { Institution } from '@osf/shared/models'; -import { InstitutionsService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { InstitutionsService } from '@osf/shared/services/institutions.service'; import { InstitutionsAdminService } from '../services/institutions-admin.service'; diff --git a/src/app/features/analytics/analytics.component.spec.ts b/src/app/features/analytics/analytics.component.spec.ts index 9b11bcd3f..fba7dc76d 100644 --- a/src/app/features/analytics/analytics.component.spec.ts +++ b/src/app/features/analytics/analytics.component.spec.ts @@ -8,17 +8,16 @@ import { ActivatedRoute, Router } from '@angular/router'; import { AnalyticsComponent } from '@osf/features/analytics/analytics.component'; import { AnalyticsKpiComponent } from '@osf/features/analytics/components'; import { AnalyticsSelectors } from '@osf/features/analytics/store'; -import { - BarChartComponent, - LineChartComponent, - PieChartComponent, - SelectComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@shared/components'; -import { IS_WEB } from '@shared/helpers'; +import { BarChartComponent } from '@osf/shared/components/bar-chart/bar-chart.component'; +import { LineChartComponent } from '@osf/shared/components/line-chart/line-chart.component'; +import { PieChartComponent } from '@osf/shared/components/pie-chart/pie-chart.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; -import { MOCK_ANALYTICS_METRICS, MOCK_RELATED_COUNTS, MOCK_RESOURCE_OVERVIEW } from '@testing/mocks'; +import { MOCK_ANALYTICS_METRICS, MOCK_RELATED_COUNTS } from '@testing/mocks/analytics.mock'; +import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { RouterMockBuilder } from '@testing/providers/router-provider.mock'; diff --git a/src/app/features/analytics/analytics.component.ts b/src/app/features/analytics/analytics.component.ts index c1d008b57..fff8d7072 100644 --- a/src/app/features/analytics/analytics.component.ts +++ b/src/app/features/analytics/analytics.component.ts @@ -19,17 +19,17 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { - BarChartComponent, - LineChartComponent, - LoadingSpinnerComponent, - PieChartComponent, - SelectComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@osf/shared/components'; -import { hasViewOnlyParam, IS_WEB, Primitive } from '@osf/shared/helpers'; -import { DatasetInput } from '@osf/shared/models'; +import { BarChartComponent } from '@osf/shared/components/bar-chart/bar-chart.component'; +import { LineChartComponent } from '@osf/shared/components/line-chart/line-chart.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { PieChartComponent } from '@osf/shared/components/pie-chart/pie-chart.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { Primitive } from '@osf/shared/helpers/types.helper'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { DatasetInput } from '@osf/shared/models/charts/dataset-input'; import { AnalyticsKpiComponent } from './components'; import { DATE_RANGE_OPTIONS } from './constants'; diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts index fbdec8174..7ed3672de 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts @@ -9,21 +9,19 @@ import { ActivatedRoute, Router } from '@angular/router'; import { ProjectOverviewSelectors } from '@osf/features/project/overview/store'; import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; -import { ResourceType } from '@osf/shared/enums'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { DuplicatesSelectors } from '@osf/shared/stores/duplicates'; -import { - ContributorsListComponent, - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SubHeaderComponent, - TruncatedTextComponent, -} from '@shared/components'; -import { CustomDialogService } from '@shared/services'; import { ViewDuplicatesComponent } from './view-duplicates.component'; -import { MOCK_PROJECT_OVERVIEW } from '@testing/mocks'; +import { MOCK_PROJECT_OVERVIEW } from '@testing/mocks/project-overview.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts index 519453b58..caf3a9093 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts @@ -30,19 +30,20 @@ import { GetRegistryById, RegistryOverviewSelectors, } from '@osf/features/registry/store/registry-overview'; -import { - ContributorsListComponent, - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SubHeaderComponent, - TruncatedTextComponent, -} from '@osf/shared/components'; -import { ResourceType, UserPermissions } from '@osf/shared/enums'; -import { BaseNodeModel, ToolbarResource } from '@osf/shared/models'; -import { CustomDialogService, LoaderService } from '@osf/shared/services'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { GetResourceWithChildren } from '@osf/shared/stores/current-resource'; import { ClearDuplicates, DuplicatesSelectors, GetAllDuplicates } from '@osf/shared/stores/duplicates'; +import { BaseNodeModel } from '@shared/models/nodes/base-node.model'; +import { ToolbarResource } from '@shared/models/toolbar-resource.model'; @Component({ selector: 'osf-view-duplicates', diff --git a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts index 977d289c5..071c60bcd 100644 --- a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts +++ b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts @@ -7,20 +7,18 @@ import { ActivatedRoute } from '@angular/router'; import { ProjectOverviewSelectors } from '@osf/features/project/overview/store'; import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; -import { ResourceType } from '@osf/shared/enums'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { LinkedProjectsSelectors } from '@osf/shared/stores/linked-projects'; -import { - ContributorsListComponent, - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SubHeaderComponent, - TruncatedTextComponent, -} from '@shared/components'; import { ViewLinkedProjectsComponent } from './view-linked-projects.component'; -import { MOCK_PROJECT_OVERVIEW } from '@testing/mocks'; +import { MOCK_PROJECT_OVERVIEW } from '@testing/mocks/project-overview.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts index 62c40b840..a87a77c09 100644 --- a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts +++ b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts @@ -27,15 +27,13 @@ import { GetRegistryById, RegistryOverviewSelectors, } from '@osf/features/registry/store/registry-overview'; -import { - ContributorsListComponent, - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SubHeaderComponent, - TruncatedTextComponent, -} from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ClearLinkedProjects, GetAllLinkedProjects, LinkedProjectsSelectors } from '@shared/stores/linked-projects'; @Component({ diff --git a/src/app/features/analytics/models/node-analytics-json-api.model.ts b/src/app/features/analytics/models/node-analytics-json-api.model.ts index 362960f34..e06297531 100644 --- a/src/app/features/analytics/models/node-analytics-json-api.model.ts +++ b/src/app/features/analytics/models/node-analytics-json-api.model.ts @@ -1,4 +1,4 @@ -import { ResponseDataJsonApi } from '@osf/shared/models'; +import { ResponseDataJsonApi } from '@osf/shared/models/common/json-api.model'; export type NodeAnalyticsResponseJsonApi = ResponseDataJsonApi; diff --git a/src/app/features/analytics/services/analytics.service.ts b/src/app/features/analytics/services/analytics.service.ts index 207a82e70..715ad26ce 100644 --- a/src/app/features/analytics/services/analytics.service.ts +++ b/src/app/features/analytics/services/analytics.service.ts @@ -3,8 +3,8 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '@osf/shared/enums'; -import { JsonApiService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { AnalyticsMetricsMapper, RelatedCountsMapper } from '../mappers'; import { NodeAnalyticsModel, NodeAnalyticsResponseJsonApi, RelatedCountsGetResponse } from '../models'; diff --git a/src/app/features/analytics/store/analytics.actions.ts b/src/app/features/analytics/store/analytics.actions.ts index a8e450bec..5a4e2c274 100644 --- a/src/app/features/analytics/store/analytics.actions.ts +++ b/src/app/features/analytics/store/analytics.actions.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { DateRange } from '../enums'; diff --git a/src/app/features/analytics/store/analytics.model.ts b/src/app/features/analytics/store/analytics.model.ts index 5bf841e7c..57cf6671b 100644 --- a/src/app/features/analytics/store/analytics.model.ts +++ b/src/app/features/analytics/store/analytics.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateModel } from '@osf/shared/models/store'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { NodeAnalyticsModel, RelatedCountsModel } from '../models'; diff --git a/src/app/features/analytics/store/analytics.state.ts b/src/app/features/analytics/store/analytics.state.ts index fa4ed078f..064c28310 100644 --- a/src/app/features/analytics/store/analytics.state.ts +++ b/src/app/features/analytics/store/analytics.state.ts @@ -5,7 +5,7 @@ import { catchError, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { NodeAnalyticsModel, RelatedCountsModel } from '../models'; import { AnalyticsService } from '../services'; diff --git a/src/app/features/auth/pages/forgot-password/forgot-password.component.spec.ts b/src/app/features/auth/pages/forgot-password/forgot-password.component.spec.ts index 8264a56e4..4ad56bbe3 100644 --- a/src/app/features/auth/pages/forgot-password/forgot-password.component.spec.ts +++ b/src/app/features/auth/pages/forgot-password/forgot-password.component.spec.ts @@ -3,8 +3,8 @@ import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AuthService } from '@osf/core/services'; -import { TextInputComponent } from '@shared/components'; +import { AuthService } from '@core/services/auth.service'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { ForgotPasswordComponent } from './forgot-password.component'; diff --git a/src/app/features/auth/pages/forgot-password/forgot-password.component.ts b/src/app/features/auth/pages/forgot-password/forgot-password.component.ts index 32f843103..749fc466b 100644 --- a/src/app/features/auth/pages/forgot-password/forgot-password.component.ts +++ b/src/app/features/auth/pages/forgot-password/forgot-password.component.ts @@ -6,10 +6,10 @@ import { Message } from 'primeng/message'; import { Component, inject, signal } from '@angular/core'; import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; -import { AuthService } from '@osf/core/services'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; +import { AuthService } from '@core/services/auth.service'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { ForgotPasswordFormGroupType, MessageInfo } from '../../models'; diff --git a/src/app/features/auth/pages/reset-password/reset-password.component.spec.ts b/src/app/features/auth/pages/reset-password/reset-password.component.spec.ts index fff0ec6c7..c3eccb623 100644 --- a/src/app/features/auth/pages/reset-password/reset-password.component.spec.ts +++ b/src/app/features/auth/pages/reset-password/reset-password.component.spec.ts @@ -6,11 +6,11 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { AuthService } from '@osf/core/services'; +import { AuthService } from '@core/services/auth.service'; import { ResetPasswordComponent } from '@osf/features/auth/pages'; -import { PasswordInputHintComponent } from '@osf/shared/components'; +import { PasswordInputHintComponent } from '@osf/shared/components/password-input-hint/password-input-hint.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('ResetPasswordComponent', () => { let component: ResetPasswordComponent; @@ -18,11 +18,7 @@ describe('ResetPasswordComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - ResetPasswordComponent, - MockComponent(PasswordInputHintComponent), - MockPipe(TranslatePipe, (value) => value), - ], + imports: [ResetPasswordComponent, MockComponent(PasswordInputHintComponent), MockPipe(TranslatePipe)], providers: [ TranslateServiceMock, MockProvider(AuthService), diff --git a/src/app/features/auth/pages/reset-password/reset-password.component.ts b/src/app/features/auth/pages/reset-password/reset-password.component.ts index 0969df45c..558b7574b 100644 --- a/src/app/features/auth/pages/reset-password/reset-password.component.ts +++ b/src/app/features/auth/pages/reset-password/reset-password.component.ts @@ -8,9 +8,10 @@ import { Component, inject, signal } from '@angular/core'; import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { AuthService } from '@osf/core/services'; -import { CustomValidators, PASSWORD_REGEX } from '@osf/shared/helpers'; -import { PasswordInputHintComponent } from '@shared/components'; +import { AuthService } from '@core/services/auth.service'; +import { PasswordInputHintComponent } from '@osf/shared/components/password-input-hint/password-input-hint.component'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { PASSWORD_REGEX } from '@osf/shared/helpers/password.helper'; import { ResetPasswordFormGroupType } from '../../models'; diff --git a/src/app/features/auth/pages/sign-up/sign-up.component.spec.ts b/src/app/features/auth/pages/sign-up/sign-up.component.spec.ts index 2c6a4d333..1644aa564 100644 --- a/src/app/features/auth/pages/sign-up/sign-up.component.spec.ts +++ b/src/app/features/auth/pages/sign-up/sign-up.component.spec.ts @@ -4,13 +4,13 @@ import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { AuthService } from '@osf/core/services'; -import { PasswordInputHintComponent } from '@osf/shared/components'; -import { ToastService } from '@osf/shared/services'; +import { AuthService } from '@core/services/auth.service'; +import { PasswordInputHintComponent } from '@osf/shared/components/password-input-hint/password-input-hint.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { SignUpComponent } from './sign-up.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('SignUpComponent', () => { let component: SignUpComponent; diff --git a/src/app/features/auth/pages/sign-up/sign-up.component.ts b/src/app/features/auth/pages/sign-up/sign-up.component.ts index 9763ec4cc..cbaf99c1c 100644 --- a/src/app/features/auth/pages/sign-up/sign-up.component.ts +++ b/src/app/features/auth/pages/sign-up/sign-up.component.ts @@ -12,13 +12,15 @@ import { Component, inject, OnInit, signal } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { RouterLink } from '@angular/router'; +import { SignUpModel } from '@core/models/sign-up.model'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SignUpModel } from '@osf/core/models'; -import { AuthService } from '@osf/core/services'; -import { PasswordInputHintComponent, TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators, PASSWORD_REGEX } from '@osf/shared/helpers'; -import { ToastService } from '@osf/shared/services'; +import { AuthService } from '@core/services/auth.service'; +import { PasswordInputHintComponent } from '@osf/shared/components/password-input-hint/password-input-hint.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { PASSWORD_REGEX } from '@osf/shared/helpers/password.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; import { SignUpForm } from '../../models'; diff --git a/src/app/features/collections/collections.routes.ts b/src/app/features/collections/collections.routes.ts index bbdeac48a..d7743827c 100644 --- a/src/app/features/collections/collections.routes.ts +++ b/src/app/features/collections/collections.routes.ts @@ -2,7 +2,7 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; -import { authGuard } from '@osf/core/guards'; +import { authGuard } from '@core/guards/auth.guard'; import { AddToCollectionState } from '@osf/features/collections/store/add-to-collection'; import { CollectionsModerationState } from '@osf/features/moderation/store/collections-moderation'; import { ConfirmLeavingGuard } from '@shared/guards'; diff --git a/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.spec.ts b/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.spec.ts index c436ff966..c5acea141 100644 --- a/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.spec.ts +++ b/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.spec.ts @@ -4,7 +4,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddToCollectionConfirmationDialogComponent } from './add-to-collection-confirmation-dialog.component'; diff --git a/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.ts b/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.ts index b0c43d9ee..4ed620f02 100644 --- a/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.ts +++ b/src/app/features/collections/components/add-to-collection/add-to-collection-confirmation-dialog/add-to-collection-confirmation-dialog.component.ts @@ -12,7 +12,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CreateCollectionSubmission } from '@osf/features/collections/store/add-to-collection/add-to-collection.actions'; import { UpdateProjectPublicStatus } from '@osf/features/project/overview/store'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; @Component({ selector: 'osf-add-to-collection-confirmation-dialog', diff --git a/src/app/features/collections/components/add-to-collection/add-to-collection.component.spec.ts b/src/app/features/collections/components/add-to-collection/add-to-collection.component.spec.ts index b8125eb79..cb2b5999a 100644 --- a/src/app/features/collections/components/add-to-collection/add-to-collection.component.spec.ts +++ b/src/app/features/collections/components/add-to-collection/add-to-collection.component.spec.ts @@ -10,15 +10,16 @@ import { ProjectContributorsStepComponent } from '@osf/features/collections/comp import { ProjectMetadataStepComponent } from '@osf/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component'; import { SelectProjectStepComponent } from '@osf/features/collections/components/add-to-collection/select-project-step/select-project-step.component'; import { AddToCollectionSteps } from '@osf/features/collections/enums'; -import { LoadingSpinnerComponent } from '@shared/components'; -import { CustomDialogService } from '@shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { CollectionsSelectors } from '@shared/stores/collections'; import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; import { AddToCollectionComponent } from './add-to-collection.component'; -import { MOCK_PROVIDER, MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { MOCK_PROJECT } from '@testing/mocks/project.mock'; +import { MOCK_PROVIDER } from '@testing/mocks/provider.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; diff --git a/src/app/features/collections/components/add-to-collection/add-to-collection.component.ts b/src/app/features/collections/components/add-to-collection/add-to-collection.component.ts index 78498c110..f9be9fb74 100644 --- a/src/app/features/collections/components/add-to-collection/add-to-collection.component.ts +++ b/src/app/features/collections/components/add-to-collection/add-to-collection.component.ts @@ -26,10 +26,11 @@ import { ClearAddToCollectionState, CreateCollectionSubmission, } from '@osf/features/collections/store/add-to-collection'; -import { LoadingSpinnerComponent } from '@shared/components'; -import { HeaderStyleHelper } from '@shared/helpers'; -import { CanDeactivateComponent } from '@shared/models'; -import { BrandService, CustomDialogService } from '@shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { BrandService } from '@osf/shared/services/brand.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { HeaderStyleHelper } from '@shared/helpers/header-style.helper'; +import { CanDeactivateComponent } from '@shared/models/can-deactivate.interface'; import { CollectionsSelectors, GetCollectionProvider } from '@shared/stores/collections'; import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; @@ -45,10 +46,10 @@ import { selector: 'osf-add-to-collection-form', imports: [ Button, - LoadingSpinnerComponent, TranslatePipe, RouterLink, Stepper, + LoadingSpinnerComponent, SelectProjectStepComponent, ProjectMetadataStepComponent, ProjectContributorsStepComponent, diff --git a/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.spec.ts b/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.spec.ts index 448fccab9..6c77035f2 100644 --- a/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.spec.ts +++ b/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.spec.ts @@ -1,12 +1,11 @@ import { MockComponents, MockProvider } from 'ng-mocks'; -import { Step, StepItem, StepPanel } from 'primeng/stepper'; - import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { InfoIconComponent } from '@shared/components'; +import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ContributorsTableComponent } from '@shared/components/contributors'; -import { CustomDialogService, ToastService } from '@shared/services'; import { CustomConfirmationService } from '@shared/services/custom-confirmation.service'; import { ContributorsSelectors } from '@shared/stores/contributors'; import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; @@ -35,7 +34,6 @@ describe.skip('ProjectContributorsStepComponent', () => { imports: [ ProjectContributorsStepComponent, OSFTestingModule, - MockComponents(StepPanel, Step, StepItem), ...MockComponents(ContributorsTableComponent, InfoIconComponent), ], providers: [ diff --git a/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.ts b/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.ts index d532a621c..35af2dc55 100644 --- a/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.ts +++ b/src/app/features/collections/components/add-to-collection/project-contributors-step/project-contributors-step.component.ts @@ -23,17 +23,19 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { InfoIconComponent } from '@osf/shared/components'; import { AddContributorDialogComponent, AddUnregisteredContributorDialogComponent, ContributorsTableComponent, } from '@osf/shared/components/contributors'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { AddContributorType, ResourceType } from '@osf/shared/enums'; -import { findChangedItems } from '@osf/shared/helpers'; -import { ContributorDialogAddModel, ContributorModel, TableParameters } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { findChangedItems } from '@osf/shared/helpers/find-changed-items.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddContributor, BulkAddContributors, @@ -43,6 +45,9 @@ import { LoadMoreContributors, } from '@osf/shared/stores/contributors'; import { ProjectsSelectors } from '@osf/shared/stores/projects'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; @Component({ selector: 'osf-project-contributors-step', diff --git a/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.spec.ts b/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.spec.ts index 53638581b..9bb058c3c 100644 --- a/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.spec.ts +++ b/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.spec.ts @@ -1,13 +1,13 @@ import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; -import { Step, StepItem, StepPanel } from 'primeng/stepper'; - import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AddToCollectionSelectors } from '@osf/features/collections/store/add-to-collection'; -import { TagsInputComponent, TextInputComponent, TruncatedTextComponent } from '@shared/components'; -import { InterpolatePipe } from '@shared/pipes'; -import { ToastService } from '@shared/services'; +import { TagsInputComponent } from '@osf/shared/components/tags-input/tags-input.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { InterpolatePipe } from '@shared/pipes/interpolate.pipe'; import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; import { ProjectMetadataStepComponent } from './project-metadata-step.component'; @@ -29,7 +29,7 @@ describe.skip('ProjectMetadataStepComponent', () => { imports: [ ProjectMetadataStepComponent, OSFTestingModule, - ...MockComponents(StepPanel, Step, StepItem, TagsInputComponent, TextInputComponent, TruncatedTextComponent), + ...MockComponents(TagsInputComponent, TextInputComponent, TruncatedTextComponent), MockPipe(InterpolatePipe), ], providers: [ diff --git a/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.ts b/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.ts index 47c2a3862..343c0db89 100644 --- a/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.ts +++ b/src/app/features/collections/components/add-to-collection/project-metadata-step/project-metadata-step.component.ts @@ -30,19 +30,19 @@ import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AddToCollectionSteps, ProjectMetadataFormControls } from '@osf/features/collections/enums'; import { ProjectMetadataForm } from '@osf/features/collections/models'; -import { ProjectMetadataFormService } from '@osf/features/collections/services/project-metadata-form.service'; -import { GetCollectionLicenses } from '@osf/features/collections/store/add-to-collection/add-to-collection.actions'; -import { AddToCollectionSelectors } from '@osf/features/collections/store/add-to-collection/add-to-collection.selectors'; -import { TagsInputComponent, TextInputComponent, TruncatedTextComponent } from '@shared/components'; -import { InputLimits } from '@shared/constants'; -import { ResourceType } from '@shared/enums'; -import { LicenseModel } from '@shared/models'; -import { ProjectModel } from '@shared/models/projects'; -import { InterpolatePipe } from '@shared/pipes'; -import { ToastService } from '@shared/services'; -import { GetAllContributors } from '@shared/stores/contributors'; -import { ClearProjects, UpdateProjectMetadata } from '@shared/stores/projects'; -import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; +import { ProjectMetadataFormService } from '@osf/features/collections/services'; +import { AddToCollectionSelectors, GetCollectionLicenses } from '@osf/features/collections/store/add-to-collection'; +import { TagsInputComponent } from '@osf/shared/components/tags-input/tags-input.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { ProjectModel } from '@osf/shared/models/projects/projects.models'; +import { InterpolatePipe } from '@osf/shared/pipes/interpolate.pipe'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { GetAllContributors } from '@osf/shared/stores/contributors'; +import { ClearProjects, ProjectsSelectors, UpdateProjectMetadata } from '@osf/shared/stores/projects'; @Component({ selector: 'osf-project-metadata-step', diff --git a/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.spec.ts b/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.spec.ts index 237d3c88d..fe144e0bf 100644 --- a/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.spec.ts +++ b/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.spec.ts @@ -1,11 +1,9 @@ import { MockComponents, MockProvider } from 'ng-mocks'; -import { Step, StepItem, StepPanel, Stepper } from 'primeng/stepper'; - import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProjectSelectorComponent } from '@shared/components'; -import { ToastService } from '@shared/services'; +import { ProjectSelectorComponent } from '@osf/shared/components/project-selector/project-selector.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CollectionsSelectors } from '@shared/stores/collections'; import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; @@ -28,11 +26,7 @@ describe.skip('SelectProjectStepComponent', () => { toastServiceMock = ToastServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [ - SelectProjectStepComponent, - OSFTestingModule, - ...MockComponents(Step, StepItem, StepPanel, Stepper, ProjectSelectorComponent), - ], + imports: [SelectProjectStepComponent, OSFTestingModule, ...MockComponents(ProjectSelectorComponent)], providers: [ MockProvider(ToastService, toastServiceMock), provideMockStore({ diff --git a/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.ts b/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.ts index bef7c72c5..7c610f347 100644 --- a/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.ts +++ b/src/app/features/collections/components/add-to-collection/select-project-step/select-project-step.component.ts @@ -8,9 +8,9 @@ import { Step, StepItem, StepPanel } from 'primeng/stepper'; import { ChangeDetectionStrategy, Component, computed, input, output, signal } from '@angular/core'; import { AddToCollectionSteps } from '@osf/features/collections/enums'; +import { ProjectSelectorComponent } from '@osf/shared/components/project-selector/project-selector.component'; import { SetSelectedProject } from '@osf/shared/stores/projects'; -import { ProjectSelectorComponent } from '@shared/components'; -import { ProjectModel } from '@shared/models/projects'; +import { ProjectModel } from '@shared/models/projects/projects.models'; import { CollectionsSelectors, GetUserCollectionSubmissions } from '@shared/stores/collections'; import { ProjectsSelectors } from '@shared/stores/projects/projects.selectors'; diff --git a/src/app/features/collections/components/collections-discover/collections-discover.component.spec.ts b/src/app/features/collections/components/collections-discover/collections-discover.component.spec.ts index 27c54b634..1b51c738e 100644 --- a/src/app/features/collections/components/collections-discover/collections-discover.component.spec.ts +++ b/src/app/features/collections/components/collections-discover/collections-discover.component.spec.ts @@ -5,13 +5,15 @@ import { ActivatedRoute } from '@angular/router'; import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; import { CollectionsMainContentComponent } from '@osf/features/collections/components'; -import { LoadingSpinnerComponent, SearchInputComponent } from '@shared/components'; -import { CustomDialogService, ToastService } from '@shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CollectionsSelectors } from '@shared/stores/collections'; import { CollectionsDiscoverComponent } from './collections-discover.component'; -import { MOCK_PROVIDER } from '@testing/mocks'; +import { MOCK_PROVIDER } from '@testing/mocks/provider.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; diff --git a/src/app/features/collections/components/collections-discover/collections-discover.component.ts b/src/app/features/collections/components/collections-discover/collections-discover.component.ts index 80a7bf084..61ff5ddc8 100644 --- a/src/app/features/collections/components/collections-discover/collections-discover.component.ts +++ b/src/app/features/collections/components/collections-discover/collections-discover.component.ts @@ -12,10 +12,12 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { ClearCurrentProvider } from '@core/store/provider'; -import { LoadingSpinnerComponent, SearchInputComponent } from '@osf/shared/components'; -import { HeaderStyleHelper } from '@osf/shared/helpers'; -import { CollectionsFilters } from '@osf/shared/models'; -import { BrandService, CustomDialogService } from '@osf/shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model'; +import { BrandService } from '@osf/shared/services/brand.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ClearCollections, ClearCollectionSubmissions, diff --git a/src/app/features/collections/components/collections-main-content/collections-main-content.component.ts b/src/app/features/collections/components/collections-main-content/collections-main-content.component.ts index 016db3f03..3509e6d64 100644 --- a/src/app/features/collections/components/collections-main-content/collections-main-content.component.ts +++ b/src/app/features/collections/components/collections-main-content/collections-main-content.component.ts @@ -12,7 +12,7 @@ import { FormsModule } from '@angular/forms'; import { CollectionsFilterChipsComponent } from '@osf/features/collections/components'; import { collectionsSortOptions } from '@osf/features/collections/constants'; -import { IS_WEB } from '@osf/shared/helpers'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; import { CollectionsSelectors, SetSortBy } from '@shared/stores/collections'; import { CollectionsFiltersComponent } from '../collections-filters/collections-filters.component'; diff --git a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.spec.ts b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.spec.ts index 031a02237..f4738728c 100644 --- a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.spec.ts +++ b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.spec.ts @@ -3,8 +3,8 @@ import { MockComponent } from 'ng-mocks'; import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorsListComponent } from '@osf/shared/components'; -import { CollectionSubmissionWithGuid } from '@shared/models'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { CollectionSubmissionWithGuid } from '@osf/shared/models/collections/collections.models'; import { CollectionsSearchResultCardComponent } from './collections-search-result-card.component'; diff --git a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts index 21dcb74d7..08299c88f 100644 --- a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts +++ b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts @@ -4,8 +4,8 @@ import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; import { collectionFilterNames } from '@osf/features/collections/constants'; -import { ContributorsListComponent } from '@osf/shared/components'; -import { CollectionSubmissionWithGuid } from '@shared/models'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { CollectionSubmissionWithGuid } from '@osf/shared/models/collections/collections.models'; @Component({ selector: 'osf-collections-search-result-card', diff --git a/src/app/features/collections/components/collections-search-results/collections-search-results.component.spec.ts b/src/app/features/collections/components/collections-search-results/collections-search-results.component.spec.ts index 07aa10ca6..e4030a3f4 100644 --- a/src/app/features/collections/components/collections-search-results/collections-search-results.component.spec.ts +++ b/src/app/features/collections/components/collections-search-results/collections-search-results.component.spec.ts @@ -3,7 +3,7 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CollectionsSearchResultCardComponent } from '@osf/features/collections/components'; -import { CustomPaginatorComponent } from '@shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { CollectionsSelectors } from '@shared/stores/collections'; import { CollectionsSearchResultsComponent } from './collections-search-results.component'; diff --git a/src/app/features/collections/components/collections-search-results/collections-search-results.component.ts b/src/app/features/collections/components/collections-search-results/collections-search-results.component.ts index db710ea7d..20a819560 100644 --- a/src/app/features/collections/components/collections-search-results/collections-search-results.component.ts +++ b/src/app/features/collections/components/collections-search-results/collections-search-results.component.ts @@ -8,7 +8,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed } from '@angular/core'; -import { CustomPaginatorComponent } from '@osf/shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { CollectionsSelectors, SetPageNumber } from '@shared/stores/collections'; import { CollectionsSearchResultCardComponent } from '../collections-search-result-card/collections-search-result-card.component'; diff --git a/src/app/features/collections/models/collection-license-json-api.models.ts b/src/app/features/collections/models/collection-license-json-api.models.ts index 42085e518..10f98c57e 100644 --- a/src/app/features/collections/models/collection-license-json-api.models.ts +++ b/src/app/features/collections/models/collection-license-json-api.models.ts @@ -1,4 +1,4 @@ -import { LicenseRecordJsonApi } from '@shared/models'; +import { LicenseRecordJsonApi } from '@osf/shared/models/license/licenses-json-api.model'; export interface CollectionSubmissionMetadataPayloadJsonApi { data: { diff --git a/src/app/features/collections/models/project-metadata-form.model.ts b/src/app/features/collections/models/project-metadata-form.model.ts index d9cb52cee..464ca263a 100644 --- a/src/app/features/collections/models/project-metadata-form.model.ts +++ b/src/app/features/collections/models/project-metadata-form.model.ts @@ -1,7 +1,7 @@ import { FormControl } from '@angular/forms'; import { ProjectMetadataFormControls } from '@osf/features/collections/enums'; -import { LicenseModel } from '@shared/models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; export interface ProjectMetadataForm { [ProjectMetadataFormControls.Title]: FormControl; diff --git a/src/app/features/collections/services/add-to-collection.service.ts b/src/app/features/collections/services/add-to-collection.service.ts index 6ebddb9cf..952837525 100644 --- a/src/app/features/collections/services/add-to-collection.service.ts +++ b/src/app/features/collections/services/add-to-collection.service.ts @@ -3,9 +3,12 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { CollectionsMapper, LicensesMapper } from '@shared/mappers'; -import { CollectionSubmissionPayload, LicenseModel, LicensesResponseJsonApi } from '@shared/models'; -import { JsonApiService } from '@shared/services'; +import { CollectionsMapper } from '@osf/shared/mappers/collections'; +import { LicensesMapper } from '@osf/shared/mappers/licenses.mapper'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { CollectionSubmissionPayload } from '@shared/models/collections/collection-submission-payload.model'; +import { LicenseModel } from '@shared/models/license/license.model'; +import { LicensesResponseJsonApi } from '@shared/models/license/licenses-json-api.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/collections/services/collections-query-sync.service.ts b/src/app/features/collections/services/collections-query-sync.service.ts index 0b8431671..7e1e6f5ef 100644 --- a/src/app/features/collections/services/collections-query-sync.service.ts +++ b/src/app/features/collections/services/collections-query-sync.service.ts @@ -8,7 +8,7 @@ import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; import { collectionsSortOptions } from '@osf/features/collections/constants'; import { queryParamsKeys } from '@osf/features/collections/constants/query-params-keys.const'; import { CollectionQueryParams } from '@osf/features/collections/models'; -import { CollectionsFilters } from '@shared/models'; +import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model'; import { CollectionsSelectors, SetAllFilters, SetSearchValue, SetSortBy } from '@shared/stores/collections'; import { SetPageNumber } from '@shared/stores/collections/collections.actions'; diff --git a/src/app/features/collections/services/project-metadata-form.service.ts b/src/app/features/collections/services/project-metadata-form.service.ts index 3cd133fdd..02459c2dc 100644 --- a/src/app/features/collections/services/project-metadata-form.service.ts +++ b/src/app/features/collections/services/project-metadata-form.service.ts @@ -3,9 +3,10 @@ import { FormControl, FormGroup, Validators } from '@angular/forms'; import { ProjectMetadataFormControls } from '@osf/features/collections/enums'; import { ProjectMetadataForm } from '@osf/features/collections/models'; -import { CustomValidators } from '@osf/shared/helpers'; -import { LicenseModel, ProjectMetadataUpdatePayload } from '@shared/models'; -import { ProjectModel } from '@shared/models/projects'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { LicenseModel } from '@shared/models/license/license.model'; +import { ProjectMetadataUpdatePayload } from '@shared/models/project-metadata-update-payload.model'; +import { ProjectModel } from '@shared/models/projects/projects.models'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/collections/store/add-to-collection/add-to-collection.actions.ts b/src/app/features/collections/store/add-to-collection/add-to-collection.actions.ts index bf91e101b..4868808ed 100644 --- a/src/app/features/collections/store/add-to-collection/add-to-collection.actions.ts +++ b/src/app/features/collections/store/add-to-collection/add-to-collection.actions.ts @@ -1,4 +1,4 @@ -import { CollectionSubmissionPayload } from '@shared/models'; +import { CollectionSubmissionPayload } from '@osf/shared/models/collections/collection-submission-payload.model'; export class GetCollectionLicenses { static readonly type = '[Add To Collection] Get Collection Licenses'; diff --git a/src/app/features/collections/store/add-to-collection/add-to-collection.model.ts b/src/app/features/collections/store/add-to-collection/add-to-collection.model.ts index 422f95e34..f0b0a0b1f 100644 --- a/src/app/features/collections/store/add-to-collection/add-to-collection.model.ts +++ b/src/app/features/collections/store/add-to-collection/add-to-collection.model.ts @@ -1,5 +1,5 @@ -import { LicenseModel } from '@shared/models'; -import { AsyncStateModel } from '@shared/models/store'; +import { LicenseModel } from '@shared/models/license/license.model'; +import { AsyncStateModel } from '@shared/models/store/async-state.model'; export interface AddToCollectionStateModel { collectionLicenses: AsyncStateModel; diff --git a/src/app/features/collections/store/add-to-collection/add-to-collection.state.ts b/src/app/features/collections/store/add-to-collection/add-to-collection.state.ts index ae08e54b4..a0e843865 100644 --- a/src/app/features/collections/store/add-to-collection/add-to-collection.state.ts +++ b/src/app/features/collections/store/add-to-collection/add-to-collection.state.ts @@ -6,7 +6,7 @@ import { catchError } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { AddToCollectionService } from '@osf/features/collections/services/add-to-collection.service'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { ClearAddToCollectionState, diff --git a/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.spec.ts b/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.spec.ts index 688c92f82..982f3d27e 100644 --- a/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.spec.ts +++ b/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.spec.ts @@ -1,14 +1,17 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentCheckboxItemComponent } from '@osf/shared/components/component-checkbox-item/component-checkbox-item.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { CreateViewLinkDialogComponent } from './create-view-link-dialog.component'; -import { MOCK_RESOURCE_INFO, MOCK_RESOURCE_WITH_CHILDREN } from '@testing/mocks'; +import { MOCK_RESOURCE_INFO, MOCK_RESOURCE_WITH_CHILDREN } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; @@ -28,7 +31,11 @@ describe('Component: Create View Link Dialog', () => { } as DynamicDialogConfig; await TestBed.configureTestingModule({ - imports: [CreateViewLinkDialogComponent, OSFTestingModule], + imports: [ + CreateViewLinkDialogComponent, + OSFTestingModule, + ...MockComponents(TextInputComponent, LoadingSpinnerComponent, ComponentCheckboxItemComponent), + ], providers: [ provideMockStore({ signals: [ diff --git a/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.ts b/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.ts index e3c1b4d75..eac3dd6bb 100644 --- a/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.ts +++ b/src/app/features/contributors/components/create-view-link-dialog/create-view-link-dialog.component.ts @@ -9,11 +9,13 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, effect, inject, OnInit, signal, WritableSignal } from '@angular/core'; import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { ComponentCheckboxItemComponent, LoadingSpinnerComponent, TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ComponentCheckboxItemModel } from '@osf/shared/models'; +import { ComponentCheckboxItemComponent } from '@osf/shared/components/component-checkbox-item/component-checkbox-item.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { CurrentResourceSelectors, GetResourceWithChildren } from '@osf/shared/stores/current-resource'; +import { ComponentCheckboxItemModel } from '@shared/models/component-checkbox-item.model'; import { ResourceInfoModel, ViewOnlyLinkComponentItem } from '../../models'; diff --git a/src/app/features/contributors/contributors.component.spec.ts b/src/app/features/contributors/contributors.component.spec.ts index 4831001a0..249c8e8b3 100644 --- a/src/app/features/contributors/contributors.component.spec.ts +++ b/src/app/features/contributors/contributors.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { ConfirmationService } from 'primeng/api'; import { DialogService } from 'primeng/dynamicdialog'; @@ -7,21 +7,21 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorPermission } from '@shared/enums'; -import { ContributorModel } from '@shared/models'; -import { CustomConfirmationService } from '@shared/services'; -import { ContributorsSelectors } from '@shared/stores/contributors'; -import { CurrentResourceSelectors } from '@shared/stores/current-resource'; -import { ViewOnlyLinkSelectors } from '@shared/stores/view-only-links'; +import { ContributorsTableComponent, RequestAccessTableComponent } from '@osf/shared/components/contributors'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { ViewOnlyTableComponent } from '@osf/shared/components/view-only-table/view-only-table.component'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ContributorsSelectors } from '@osf/shared/stores/contributors'; +import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; +import { ViewOnlyLinkSelectors } from '@osf/shared/stores/view-only-links'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; import { ContributorsComponent } from './contributors.component'; -import { - MOCK_CONTRIBUTOR, - MOCK_CONTRIBUTOR_WITHOUT_HISTORY, - MOCK_PAGINATED_VIEW_ONLY_LINKS, - MOCK_RESOURCE_INFO, -} from '@testing/mocks'; +import { MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY } from '@testing/mocks/contributors.mock'; +import { MOCK_RESOURCE_INFO } from '@testing/mocks/resource.mock'; +import { MOCK_PAGINATED_VIEW_ONLY_LINKS } from '@testing/mocks/view-only-link.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomConfirmationServiceMockBuilder } from '@testing/providers/custom-confirmation-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; @@ -49,7 +49,16 @@ describe('Component: Contributors', () => { customConfirmationServiceMock = CustomConfirmationServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [ContributorsComponent, OSFTestingModule], + imports: [ + ContributorsComponent, + OSFTestingModule, + MockComponents( + SearchInputComponent, + ContributorsTableComponent, + RequestAccessTableComponent, + ViewOnlyTableComponent + ), + ], providers: [ MockProvider(DialogService, { open: jest.fn().mockReturnValue({ onClose: of({}) }), diff --git a/src/app/features/contributors/contributors.component.ts b/src/app/features/contributors/contributors.component.ts index 5f620123e..8c2ef4b23 100644 --- a/src/app/features/contributors/contributors.component.ts +++ b/src/app/features/contributors/contributors.component.ts @@ -24,28 +24,25 @@ import { FormControl, FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { SearchInputComponent, ViewOnlyTableComponent } from '@osf/shared/components'; import { AddContributorDialogComponent, AddUnregisteredContributorDialogComponent, ContributorsTableComponent, RequestAccessTableComponent, } from '@osf/shared/components/contributors'; -import { BIBLIOGRAPHY_OPTIONS, DEFAULT_TABLE_PARAMS, PERMISSION_OPTIONS } from '@osf/shared/constants'; -import { AddContributorType, ContributorPermission, ResourceType, UserPermissions } from '@osf/shared/enums'; -import { findChangedItems } from '@osf/shared/helpers'; -import { - ComponentCheckboxItemModel, - ContributorDialogAddModel, - ContributorModel, - NodeShortInfoModel, - RequestAccessModel, - SelectOption, - TableParameters, - ViewOnlyLinkJsonApi, - ViewOnlyLinkModel, -} from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, LoaderService, ToastService } from '@osf/shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { ViewOnlyTableComponent } from '@osf/shared/components/view-only-table/view-only-table.component'; +import { BIBLIOGRAPHY_OPTIONS, PERMISSION_OPTIONS } from '@osf/shared/constants/contributors.constants'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { findChangedItems } from '@osf/shared/helpers/find-changed-items.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AcceptRequestAccess, AddContributor, @@ -74,6 +71,15 @@ import { FetchViewOnlyLinks, ViewOnlyLinkSelectors, } from '@osf/shared/stores/view-only-links'; +import { ComponentCheckboxItemModel } from '@shared/models/component-checkbox-item.model'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; +import { NodeShortInfoModel } from '@shared/models/nodes/node-with-children.model'; +import { RequestAccessModel } from '@shared/models/request-access/request-access.model'; +import { SelectOption } from '@shared/models/select-option.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; +import { ViewOnlyLinkModel } from '@shared/models/view-only-links/view-only-link.model'; +import { ViewOnlyLinkJsonApi } from '@shared/models/view-only-links/view-only-link-response.model'; import { CreateViewLinkDialogComponent } from './components'; import { ResourceInfoModel } from './models'; diff --git a/src/app/features/contributors/models/resource-info.model.ts b/src/app/features/contributors/models/resource-info.model.ts index ddd417ac2..b128b8ccb 100644 --- a/src/app/features/contributors/models/resource-info.model.ts +++ b/src/app/features/contributors/models/resource-info.model.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; export interface ResourceInfoModel { id: string; diff --git a/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.spec.ts b/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.spec.ts index c4286955e..5b69983db 100644 --- a/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.spec.ts +++ b/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.spec.ts @@ -5,8 +5,8 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; import { CreateFolderDialogComponent } from './create-folder-dialog.component'; diff --git a/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.ts b/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.ts index 76f9f8a3a..187b46b6d 100644 --- a/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.ts +++ b/src/app/features/files/components/create-folder-dialog/create-folder-dialog.component.ts @@ -6,9 +6,9 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { forbiddenFileNameCharacters, InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { forbiddenFileNameCharacters, InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; @Component({ selector: 'osf-create-folder-dialog', diff --git a/src/app/features/files/components/edit-file-metadata-dialog/edit-file-metadata-dialog.component.ts b/src/app/features/files/components/edit-file-metadata-dialog/edit-file-metadata-dialog.component.ts index c33614889..a47be2ff6 100644 --- a/src/app/features/files/components/edit-file-metadata-dialog/edit-file-metadata-dialog.component.ts +++ b/src/app/features/files/components/edit-file-metadata-dialog/edit-file-metadata-dialog.component.ts @@ -8,7 +8,8 @@ import { Select } from 'primeng/select'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { languageCodes, resourceTypes } from '@osf/shared/constants'; +import { languageCodes } from '@osf/shared/constants/language.const'; +import { resourceTypes } from '@osf/shared/constants/resource-types.const'; import { OsfFileCustomMetadata, PatchFileMetadata } from '../../models'; diff --git a/src/app/features/files/components/file-browser-info/file-browser-info.component.spec.ts b/src/app/features/files/components/file-browser-info/file-browser-info.component.spec.ts index ba5340121..01307c6eb 100644 --- a/src/app/features/files/components/file-browser-info/file-browser-info.component.spec.ts +++ b/src/app/features/files/components/file-browser-info/file-browser-info.component.spec.ts @@ -2,7 +2,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FileBrowserInfoComponent } from './file-browser-info.component'; diff --git a/src/app/features/files/components/file-browser-info/file-browser-info.component.ts b/src/app/features/files/components/file-browser-info/file-browser-info.component.ts index 4cb855e03..7110c2873 100644 --- a/src/app/features/files/components/file-browser-info/file-browser-info.component.ts +++ b/src/app/features/files/components/file-browser-info/file-browser-info.component.ts @@ -5,7 +5,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FILE_BROWSER_INFO_ITEMS } from '../../constants'; diff --git a/src/app/features/files/components/file-keywords/file-keywords.component.ts b/src/app/features/files/components/file-keywords/file-keywords.component.ts index 89a66ac24..83bf1893e 100644 --- a/src/app/features/files/components/file-keywords/file-keywords.component.ts +++ b/src/app/features/files/components/file-keywords/file-keywords.component.ts @@ -12,8 +12,9 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { CustomValidators, hasViewOnlyParam } from '@osf/shared/helpers'; -import { InputLimits } from '@shared/constants'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; import { FilesSelectors, UpdateTags } from '../../store'; diff --git a/src/app/features/files/components/file-metadata/file-metadata.component.spec.ts b/src/app/features/files/components/file-metadata/file-metadata.component.spec.ts index 5c179a8b8..6f6e00b56 100644 --- a/src/app/features/files/components/file-metadata/file-metadata.component.spec.ts +++ b/src/app/features/files/components/file-metadata/file-metadata.component.spec.ts @@ -2,8 +2,8 @@ import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { languageCodes } from '@osf/shared/constants'; -import { CustomDialogService } from '@osf/shared/services'; +import { languageCodes } from '@osf/shared/constants/language.const'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { FileMetadataFields } from '../../constants'; import { PatchFileMetadata } from '../../models'; diff --git a/src/app/features/files/components/file-metadata/file-metadata.component.ts b/src/app/features/files/components/file-metadata/file-metadata.component.ts index cff741776..eee47d70a 100644 --- a/src/app/features/files/components/file-metadata/file-metadata.component.ts +++ b/src/app/features/files/components/file-metadata/file-metadata.component.ts @@ -12,10 +12,10 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { languageCodes } from '@osf/shared/constants'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; -import { LanguageCodeModel } from '@osf/shared/models'; -import { CustomDialogService } from '@osf/shared/services'; +import { languageCodes } from '@osf/shared/constants/language.const'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LanguageCodeModel } from '@shared/models/language-code.model'; import { FileMetadataFields } from '../../constants'; import { PatchFileMetadata } from '../../models'; diff --git a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.spec.ts b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.spec.ts index db502562f..51678f59f 100644 --- a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.spec.ts +++ b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.spec.ts @@ -4,7 +4,7 @@ import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { ContributorsListComponent } from '@osf/shared/components'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; import { FilesSelectors } from '../../store'; diff --git a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts index 4239a1cbe..e554a4734 100644 --- a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts +++ b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts @@ -8,8 +8,8 @@ import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core'; import { Router } from '@angular/router'; -import { ContributorsListComponent } from '@osf/shared/components'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; import { FilesSelectors } from '../../store'; diff --git a/src/app/features/files/components/file-revisions/file-revisions.component.spec.ts b/src/app/features/files/components/file-revisions/file-revisions.component.spec.ts index ad24084f7..79988ed4c 100644 --- a/src/app/features/files/components/file-revisions/file-revisions.component.spec.ts +++ b/src/app/features/files/components/file-revisions/file-revisions.component.spec.ts @@ -2,9 +2,9 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CopyButtonComponent } from '@osf/shared/components'; +import { CopyButtonComponent } from '@osf/shared/components/copy-button/copy-button.component'; import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; -import { StopPropagationDirective } from '@osf/shared/directives'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; import { FileRevisionsComponent } from './file-revisions.component'; diff --git a/src/app/features/files/components/file-revisions/file-revisions.component.ts b/src/app/features/files/components/file-revisions/file-revisions.component.ts index 957647ee1..445206fcf 100644 --- a/src/app/features/files/components/file-revisions/file-revisions.component.ts +++ b/src/app/features/files/components/file-revisions/file-revisions.component.ts @@ -7,9 +7,9 @@ import { Skeleton } from 'primeng/skeleton'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { CopyButtonComponent } from '@osf/shared/components'; +import { CopyButtonComponent } from '@osf/shared/components/copy-button/copy-button.component'; import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; -import { StopPropagationDirective } from '@osf/shared/directives'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; import { OsfFileRevision } from '../../models'; diff --git a/src/app/features/files/components/files-selection-actions/files-selection-actions.component.ts b/src/app/features/files/components/files-selection-actions/files-selection-actions.component.ts index d21568c95..8077aa3f3 100644 --- a/src/app/features/files/components/files-selection-actions/files-selection-actions.component.ts +++ b/src/app/features/files/components/files-selection-actions/files-selection-actions.component.ts @@ -4,7 +4,7 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { FileModel } from '@osf/shared/models'; +import { FileModel } from '@osf/shared/models/files/file.model'; @Component({ selector: 'osf-files-selection-actions', diff --git a/src/app/features/files/components/move-file-dialog/move-file-dialog.component.spec.ts b/src/app/features/files/components/move-file-dialog/move-file-dialog.component.spec.ts index 97b2e0ca8..3e5c8e56f 100644 --- a/src/app/features/files/components/move-file-dialog/move-file-dialog.component.spec.ts +++ b/src/app/features/files/components/move-file-dialog/move-file-dialog.component.spec.ts @@ -1,12 +1,17 @@ import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe } from 'ng-mocks'; +import { MockComponents, MockPipe } from 'ng-mocks'; import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomConfirmationService, FilesService, ToastService } from '@osf/shared/services'; +import { FileSelectDestinationComponent } from '@osf/shared/components/file-select-destination/file-select-destination.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors } from '@shared/stores/current-resource'; import { FilesSelectors } from '../../store'; @@ -37,7 +42,12 @@ describe('MoveFileDialogComponent', () => { }; await TestBed.configureTestingModule({ - imports: [MoveFileDialogComponent, OSFTestingModule, MockPipe(TranslatePipe)], + imports: [ + MoveFileDialogComponent, + OSFTestingModule, + ...MockComponents(IconComponent, LoadingSpinnerComponent, FileSelectDestinationComponent), + MockPipe(TranslatePipe), + ], providers: [ { provide: DynamicDialogRef, useValue: dialogRefMock }, { provide: DynamicDialogConfig, useValue: dialogConfigMock }, diff --git a/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts b/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts index 40c0f12bc..e3b33a856 100644 --- a/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts +++ b/src/app/features/files/components/move-file-dialog/move-file-dialog.component.ts @@ -20,16 +20,23 @@ import { SetCurrentFolder, SetMoveDialogCurrentFolder, } from '@osf/features/files/store'; -import { FileKind, ResourceType, SupportedFeature } from '@osf/shared/enums'; +import { FileSelectDestinationComponent } from '@osf/shared/components/file-select-destination/file-select-destination.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FilesMapper } from '@osf/shared/mappers/files/files.mapper'; -import { FileFolderModel, FileModel } from '@osf/shared/models'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors, GetResourceDetails, GetResourceWithChildren, } from '@osf/shared/stores/current-resource'; -import { FileSelectDestinationComponent, IconComponent, LoadingSpinnerComponent } from '@shared/components'; -import { CustomConfirmationService, FilesService, ToastService } from '@shared/services'; +import { FileModel } from '@shared/models/files/file.model'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; import { FileProvider } from '../../constants'; @@ -37,11 +44,11 @@ import { FileProvider } from '../../constants'; selector: 'osf-move-file-dialog', imports: [ Button, - LoadingSpinnerComponent, Tooltip, TranslatePipe, - IconComponent, ScrollerModule, + IconComponent, + LoadingSpinnerComponent, FileSelectDestinationComponent, ], templateUrl: './move-file-dialog.component.html', diff --git a/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.spec.ts b/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.spec.ts index d694695bc..a89480123 100644 --- a/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.spec.ts +++ b/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.spec.ts @@ -5,8 +5,8 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; import { RenameFileDialogComponent } from './rename-file-dialog.component'; diff --git a/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.ts b/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.ts index beb87b39c..a32b53f3c 100644 --- a/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.ts +++ b/src/app/features/files/components/rename-file-dialog/rename-file-dialog.component.ts @@ -7,8 +7,8 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; -import { forbiddenFileNameCharacters, InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; +import { forbiddenFileNameCharacters, InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; @Component({ selector: 'osf-rename-file-dialog', diff --git a/src/app/features/files/constants/file-browser-info.constants.ts b/src/app/features/files/constants/file-browser-info.constants.ts index fb7e8b99a..9e0c95ec0 100644 --- a/src/app/features/files/constants/file-browser-info.constants.ts +++ b/src/app/features/files/constants/file-browser-info.constants.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FileInfoItem } from '../models'; diff --git a/src/app/features/files/files.routes.ts b/src/app/features/files/files.routes.ts index a2505aa7b..e21cd5ef5 100644 --- a/src/app/features/files/files.routes.ts +++ b/src/app/features/files/files.routes.ts @@ -1,6 +1,6 @@ import { Routes } from '@angular/router'; -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FilesContainerComponent } from './pages/files-container/files-container.component'; diff --git a/src/app/features/files/mappers/file-custom-metadata.mapper.ts b/src/app/features/files/mappers/file-custom-metadata.mapper.ts index dc75ca1e3..a347b32a4 100644 --- a/src/app/features/files/mappers/file-custom-metadata.mapper.ts +++ b/src/app/features/files/mappers/file-custom-metadata.mapper.ts @@ -1,4 +1,4 @@ -import { ApiData } from '@osf/shared/models'; +import { ApiData } from '@osf/shared/models/common/json-api.model'; import { FileCustomMetadata, OsfFileCustomMetadata } from '../models'; diff --git a/src/app/features/files/mappers/file-revision.mapper.ts b/src/app/features/files/mappers/file-revision.mapper.ts index 764b7718d..19046d20f 100644 --- a/src/app/features/files/mappers/file-revision.mapper.ts +++ b/src/app/features/files/mappers/file-revision.mapper.ts @@ -1,4 +1,4 @@ -import { ApiData } from '@osf/shared/models'; +import { ApiData } from '@osf/shared/models/common/json-api.model'; import { FileRevisionJsonApi, OsfFileRevision } from '../models'; diff --git a/src/app/features/files/mappers/resource-metadata.mapper.ts b/src/app/features/files/mappers/resource-metadata.mapper.ts index 0f3890722..cf89e485d 100644 --- a/src/app/features/files/mappers/resource-metadata.mapper.ts +++ b/src/app/features/files/mappers/resource-metadata.mapper.ts @@ -1,5 +1,5 @@ -import { ResourceMetadata } from '@osf/shared/models'; -import { IdentifiersMapper } from '@shared/mappers/identifiers.mapper'; +import { IdentifiersMapper } from '@osf/shared/mappers/identifiers.mapper'; +import { ResourceMetadata } from '@osf/shared/models/resource-metadata.model'; import { GetResourceCustomMetadataResponse } from '../models/get-resource-custom-metadata-response.model'; import { GetResourceShortInfoResponse } from '../models/get-resource-short-info-response.model'; diff --git a/src/app/features/files/models/get-custom-metadata-response.model.ts b/src/app/features/files/models/get-custom-metadata-response.model.ts index 947edeff0..4420eff6e 100644 --- a/src/app/features/files/models/get-custom-metadata-response.model.ts +++ b/src/app/features/files/models/get-custom-metadata-response.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@osf/shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; export type GetCustomMetadataResponse = JsonApiResponse, null>; diff --git a/src/app/features/files/models/get-file-metadata-response.model.ts b/src/app/features/files/models/get-file-metadata-response.model.ts index d91b1b7d1..7f0662855 100644 --- a/src/app/features/files/models/get-file-metadata-response.model.ts +++ b/src/app/features/files/models/get-file-metadata-response.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@osf/shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; export type GetFileMetadataResponse = JsonApiResponse, null>; diff --git a/src/app/features/files/models/get-file-revisions-response.model.ts b/src/app/features/files/models/get-file-revisions-response.model.ts index d6aaedab1..1491314c3 100644 --- a/src/app/features/files/models/get-file-revisions-response.model.ts +++ b/src/app/features/files/models/get-file-revisions-response.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@osf/shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; export interface FileRevisionJsonApi { extra: { diff --git a/src/app/features/files/models/get-resource-custom-metadata-response.model.ts b/src/app/features/files/models/get-resource-custom-metadata-response.model.ts index 34b6a7f89..10e121cfa 100644 --- a/src/app/features/files/models/get-resource-custom-metadata-response.model.ts +++ b/src/app/features/files/models/get-resource-custom-metadata-response.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@osf/shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; export type GetResourceCustomMetadataResponse = JsonApiResponse< ApiData, diff --git a/src/app/features/files/models/get-resource-short-info-response.model.ts b/src/app/features/files/models/get-resource-short-info-response.model.ts index 0964e9e41..831a33f76 100644 --- a/src/app/features/files/models/get-resource-short-info-response.model.ts +++ b/src/app/features/files/models/get-resource-short-info-response.model.ts @@ -1,4 +1,5 @@ -import { ApiData, IdentifiersResponseJsonApi, JsonApiResponse } from '@osf/shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { IdentifiersResponseJsonApi } from '@osf/shared/models/identifiers/identifier-json-api.model'; export type GetResourceShortInfoResponse = JsonApiResponse< ApiData< diff --git a/src/app/features/files/models/get-short-info-response.model.ts b/src/app/features/files/models/get-short-info-response.model.ts index 13353aaca..2fd10f273 100644 --- a/src/app/features/files/models/get-short-info-response.model.ts +++ b/src/app/features/files/models/get-short-info-response.model.ts @@ -1,4 +1,5 @@ -import { ApiData, IdentifiersResponseJsonApi, JsonApiResponse } from '@shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { IdentifiersResponseJsonApi } from '@osf/shared/models/identifiers/identifier-json-api.model'; export type GetShortInfoResponse = JsonApiResponse< ApiData< diff --git a/src/app/features/files/models/info-item.model.ts b/src/app/features/files/models/info-item.model.ts index 7224bb6a2..dde5a25db 100644 --- a/src/app/features/files/models/info-item.model.ts +++ b/src/app/features/files/models/info-item.model.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; export interface FileInfoItem { titleKey: string; diff --git a/src/app/features/files/pages/file-detail/file-detail.component.spec.ts b/src/app/features/files/pages/file-detail/file-detail.component.spec.ts index 4045042f3..551a56853 100644 --- a/src/app/features/files/pages/file-detail/file-detail.component.spec.ts +++ b/src/app/features/files/pages/file-detail/file-detail.component.spec.ts @@ -1,39 +1,31 @@ import { Store } from '@ngxs/store'; import { TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { MockProvider } from 'ng-mocks'; - -import { ButtonGroupModule } from 'primeng/buttongroup'; -import { DialogService } from 'primeng/dynamicdialog'; -import { Message } from 'primeng/message'; -import { TagModule } from 'primeng/tag'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; import { DestroyRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormsModule } from '@angular/forms'; -import { ActivatedRoute, Router, RouterLink } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; -import { FileDetailComponent } from '@osf/features/files/pages/file-detail/file-detail.component'; -import { - LinkedResourcesComponent, - OverviewComponentsComponent, - OverviewToolbarComponent, - OverviewWikiComponent, - RecentActivityComponent, -} from '@osf/features/project/overview/components'; -import { - LoadingSpinnerComponent, - ResourceMetadataComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { MetadataTabsComponent } from '@osf/shared/components/metadata-tabs/metadata-tabs.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { CustomConfirmationService } from '@shared/services/custom-confirmation.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { ToastService } from '@shared/services/toast.service'; -import { MOCK_STORE } from '@testing/mocks'; +import { + FileKeywordsComponent, + FileMetadataComponent, + FileResourceMetadataComponent, + FileRevisionsComponent, +} from '../../components'; + +import { FileDetailComponent } from './file-detail.component'; + +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('FileDetailComponent', () => { @@ -63,21 +55,15 @@ describe('FileDetailComponent', () => { imports: [ FileDetailComponent, OSFTestingModule, - ButtonGroupModule, - TagModule, - SubHeaderComponent, - FormsModule, - LoadingSpinnerComponent, - OverviewWikiComponent, - OverviewComponentsComponent, - LinkedResourcesComponent, - RecentActivityComponent, - OverviewToolbarComponent, - ResourceMetadataComponent, - TranslatePipe, - Message, - RouterLink, - ViewOnlyLinkMessageComponent, + ...MockComponents( + SubHeaderComponent, + LoadingSpinnerComponent, + FileKeywordsComponent, + FileRevisionsComponent, + FileMetadataComponent, + FileResourceMetadataComponent, + MetadataTabsComponent + ), ], providers: [ TranslatePipe, @@ -88,7 +74,6 @@ describe('FileDetailComponent', () => { DestroyRef, MockProvider(ToastService), MockProvider(CustomConfirmationService), - DialogService, TranslateService, ], }).compileComponents(); 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 d9979de82..ec366758d 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 @@ -38,12 +38,19 @@ import { MetadataSelectors, UpdateCedarMetadataRecord, } from '@osf/features/metadata/store'; -import { LoadingSpinnerComponent, MetadataTabsComponent, SubHeaderComponent } from '@osf/shared/components'; -import { MetadataResourceEnum, ResourceType } from '@osf/shared/enums'; -import { getViewOnlyParam, hasViewOnlyParam, pathJoin } from '@osf/shared/helpers'; -import { FileDetailsModel, MetadataTabsModel } from '@osf/shared/models'; -import { CustomConfirmationService, MetaTagsService, ToastService } from '@osf/shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { MetadataTabsComponent } from '@osf/shared/components/metadata-tabs/metadata-tabs.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { MetadataResourceEnum } from '@osf/shared/enums/metadata-resource.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { pathJoin } from '@osf/shared/helpers/path-join.helper'; +import { getViewOnlyParam, hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { FileDetailsModel } from '@shared/models/files/file.model'; +import { MetadataTabsModel } from '@shared/models/metadata-tabs.model'; import { FileKeywordsComponent, diff --git a/src/app/features/files/pages/file-redirect/file-redirect.component.spec.ts b/src/app/features/files/pages/file-redirect/file-redirect.component.spec.ts index 9825adcab..1d7700b52 100644 --- a/src/app/features/files/pages/file-redirect/file-redirect.component.spec.ts +++ b/src/app/features/files/pages/file-redirect/file-redirect.component.spec.ts @@ -3,7 +3,7 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { FilesService } from '@osf/shared/services'; +import { FilesService } from '@osf/shared/services/files.service'; import { FileRedirectComponent } from './file-redirect.component'; diff --git a/src/app/features/files/pages/file-redirect/file-redirect.component.ts b/src/app/features/files/pages/file-redirect/file-redirect.component.ts index dfe42b96b..5b133a9e6 100644 --- a/src/app/features/files/pages/file-redirect/file-redirect.component.ts +++ b/src/app/features/files/pages/file-redirect/file-redirect.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, DestroyRef, inject } from '@angular import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { FilesService } from '@osf/shared/services'; +import { FilesService } from '@osf/shared/services/files.service'; @Component({ selector: 'osf-file-redirect', diff --git a/src/app/features/files/pages/files-container/files-container.component.spec.ts b/src/app/features/files/pages/files-container/files-container.component.spec.ts index 500e85fc8..93fefcc3b 100644 --- a/src/app/features/files/pages/files-container/files-container.component.spec.ts +++ b/src/app/features/files/pages/files-container/files-container.component.spec.ts @@ -20,35 +20,8 @@ describe('FilesContainerComponent', () => { expect(component).toBeTruthy(); }); - it('should be an instance of FilesContainerComponent', () => { - expect(component).toBeInstanceOf(FilesContainerComponent); - }); - it('should render router-outlet', () => { const routerOutlet = fixture.nativeElement.querySelector('router-outlet'); expect(routerOutlet).toBeTruthy(); }); - - it('should have only router-outlet in template', () => { - const children = fixture.nativeElement.children; - expect(children.length).toBe(1); - expect(children[0].tagName.toLowerCase()).toBe('router-outlet'); - }); - - it('should have no custom input properties', () => { - const customProperties = Object.keys(component).filter((key) => !key.startsWith('__')); - expect(customProperties).toEqual([]); - }); - - it('should have no output properties', () => { - const outputs = Object.getOwnPropertyNames(Object.getPrototypeOf(component)).filter( - (prop) => prop.startsWith('on') || prop.endsWith('$') - ); - expect(outputs).toEqual([]); - }); - - it('should be a simple container component', () => { - expect(component).toBeDefined(); - expect(typeof component).toBe('object'); - }); }); diff --git a/src/app/features/files/pages/files/files.component.spec.ts b/src/app/features/files/pages/files/files.component.spec.ts index 7abc3d793..656984423 100644 --- a/src/app/features/files/pages/files/files.component.spec.ts +++ b/src/app/features/files/pages/files/files.component.spec.ts @@ -1,36 +1,32 @@ -import { TranslatePipe } from '@ngx-translate/core'; -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; -import { Button } from 'primeng/button'; -import { Dialog } from 'primeng/dialog'; import { DialogService } from 'primeng/dynamicdialog'; -import { TableModule } from 'primeng/table'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; -import { - FilesTreeComponent, - FormSelectComponent, - LoadingSpinnerComponent, - SearchInputComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@osf/shared/components'; -import { CustomConfirmationService, FilesService } from '@osf/shared/services'; +import { FileUploadDialogComponent } from '@osf/shared/components/file-upload-dialog/file-upload-dialog.component'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { FilesService } from '@osf/shared/services/files.service'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { GoogleFilePickerComponent } from '@shared/components/google-file-picker/google-file-picker.component'; +import { FilesSelectionActionsComponent } from '../../components'; import { FilesSelectors } from '../../store'; import { FilesComponent } from './files.component'; import { getConfiguredAddonsMappedData } from '@testing/data/addons/addons.configured.data'; import { getNodeFilesMappedData } from '@testing/data/files/node.data'; -import { testNode } from '@testing/mocks'; +import { testNode } from '@testing/mocks/base-node.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { MockComponentWithSignal } from '@testing/providers/component-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; @@ -44,20 +40,19 @@ describe('Component: Files', () => { jest.clearAllMocks(); await TestBed.configureTestingModule({ imports: [ - OSFTestingModule, FilesComponent, - Button, - Dialog, - FormSelectComponent, - FormsModule, - GoogleFilePickerComponent, - LoadingSpinnerComponent, - ReactiveFormsModule, - SearchInputComponent, - SubHeaderComponent, - TableModule, - TranslatePipe, - ViewOnlyLinkMessageComponent, + OSFTestingModule, + ...MockComponents( + FileUploadDialogComponent, + FormSelectComponent, + GoogleFilePickerComponent, + LoadingSpinnerComponent, + SearchInputComponent, + SubHeaderComponent, + ViewOnlyLinkMessageComponent, + GoogleFilePickerComponent, + FilesSelectionActionsComponent + ), ], providers: [ FilesService, diff --git a/src/app/features/files/pages/files/files.component.ts b/src/app/features/files/pages/files/files.component.ts index 28bde3f50..7e47f9dc1 100644 --- a/src/app/features/files/pages/files/files.component.ts +++ b/src/app/features/files/pages/files/files.component.ts @@ -42,22 +42,31 @@ import { SetSearch, SetSort, } from '@osf/features/files/store'; -import { ALL_SORT_OPTIONS, FILE_SIZE_LIMIT } from '@osf/shared/constants'; -import { FileMenuType, ResourceType, SupportedFeature, UserPermissions } from '@osf/shared/enums'; -import { getViewOnlyParamFromUrl, hasViewOnlyParam } from '@osf/shared/helpers'; +import { FileUploadDialogComponent } from '@osf/shared/components/file-upload-dialog/file-upload-dialog.component'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { GoogleFilePickerComponent } from '@osf/shared/components/google-file-picker/google-file-picker.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { FILE_SIZE_LIMIT } from '@osf/shared/constants/files-limits.const'; +import { ALL_SORT_OPTIONS } from '@osf/shared/constants/sort-options.const'; +import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; +import { FileMenuType } from '@osf/shared/enums/file-menu-type.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { getViewOnlyParamFromUrl, hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors, GetResourceDetails } from '@osf/shared/stores/current-resource'; -import { - FilesTreeComponent, - FileUploadDialogComponent, - FormSelectComponent, - GoogleFilePickerComponent, - LoadingSpinnerComponent, - SearchInputComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@shared/components'; -import { ConfiguredAddonModel, FileFolderModel, FileLabelModel, FileModel, StorageItem } from '@shared/models'; -import { CustomConfirmationService, CustomDialogService, FilesService, ToastService } from '@shared/services'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; +import { StorageItem } from '@shared/models/addons/storage-item.model'; +import { FileModel } from '@shared/models/files/file.model'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; +import { FileLabelModel } from '@shared/models/files/file-label.model'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { diff --git a/src/app/features/files/store/files.actions.ts b/src/app/features/files/store/files.actions.ts index 9ae5e6c87..effb868b5 100644 --- a/src/app/features/files/store/files.actions.ts +++ b/src/app/features/files/store/files.actions.ts @@ -1,4 +1,4 @@ -import { FileFolderModel } from '@osf/shared/models'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; import { PatchFileMetadata } from '../models'; diff --git a/src/app/features/files/store/files.model.ts b/src/app/features/files/store/files.model.ts index 25b515be4..518bed572 100644 --- a/src/app/features/files/store/files.model.ts +++ b/src/app/features/files/store/files.model.ts @@ -1,7 +1,11 @@ -import { SupportedFeature } from '@osf/shared/enums'; -import { ContributorModel, FileDetailsModel, FileFolderModel, FileModel, ResourceMetadata } from '@shared/models'; -import { ConfiguredAddonModel } from '@shared/models/addons'; -import { AsyncStateModel, AsyncStateWithTotalCount } from '@shared/models/store'; +import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; +import { FileDetailsModel, FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { ResourceMetadata } from '@osf/shared/models/resource-metadata.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { FileProvider } from '../constants'; import { OsfFileCustomMetadata, OsfFileRevision } from '../models'; diff --git a/src/app/features/files/store/files.selectors.ts b/src/app/features/files/store/files.selectors.ts index ee5da665a..81e0cca87 100644 --- a/src/app/features/files/store/files.selectors.ts +++ b/src/app/features/files/store/files.selectors.ts @@ -1,14 +1,12 @@ import { Selector } from '@ngxs/store'; -import { SupportedFeature, UserPermissions } from '@osf/shared/enums'; -import { - ConfiguredAddonModel, - ContributorModel, - FileDetailsModel, - FileFolderModel, - FileModel, - ResourceMetadata, -} from '@shared/models'; +import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; +import { FileDetailsModel, FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { ResourceMetadata } from '@osf/shared/models/resource-metadata.model'; import { OsfFileCustomMetadata, OsfFileRevision } from '../models'; diff --git a/src/app/features/files/store/files.state.ts b/src/app/features/files/store/files.state.ts index 6d0ce875e..b9d718298 100644 --- a/src/app/features/files/store/files.state.ts +++ b/src/app/features/files/store/files.state.ts @@ -4,9 +4,10 @@ import { catchError, finalize, forkJoin, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { SupportedFeature } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; -import { FilesService, ToastService } from '@osf/shared/services'; +import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { MapResourceMetadata } from '../mappers'; diff --git a/src/app/features/home/components/index.ts b/src/app/features/home/components/index.ts deleted file mode 100644 index db02d1201..000000000 --- a/src/app/features/home/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { TosConsentBannerComponent } from '../../../core/components/osf-banners/tos-consent-banner/tos-consent-banner.component'; diff --git a/src/app/features/home/home.component.spec.ts b/src/app/features/home/home.component.spec.ts index 3b01b0907..665c42054 100644 --- a/src/app/features/home/home.component.spec.ts +++ b/src/app/features/home/home.component.spec.ts @@ -3,7 +3,8 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { IconComponent, SearchInputComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; import { HomeComponent } from './home.component'; diff --git a/src/app/features/home/home.component.ts b/src/app/features/home/home.component.ts index 5013b55ce..891e13488 100644 --- a/src/app/features/home/home.component.ts +++ b/src/app/features/home/home.component.ts @@ -8,7 +8,8 @@ import { Component, inject } from '@angular/core'; import { FormControl } from '@angular/forms'; import { Router, RouterLink } from '@angular/router'; -import { IconComponent, SearchInputComponent } from '@osf/shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; import { INTEGRATION_ICONS, SLIDES } from './constants'; diff --git a/src/app/features/home/pages/dashboard/dashboard.component.spec.ts b/src/app/features/home/pages/dashboard/dashboard.component.spec.ts index 005ddcf6d..5e78d2e44 100644 --- a/src/app/features/home/pages/dashboard/dashboard.component.spec.ts +++ b/src/app/features/home/pages/dashboard/dashboard.component.spec.ts @@ -6,13 +6,15 @@ import { signal, WritableSignal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { CustomConfirmationService, CustomDialogService, ProjectRedirectDialogService } from '@osf/shared/services'; -import { - LoadingSpinnerComponent, - MyProjectsTableComponent, - SearchInputComponent, - SubHeaderComponent, -} from '@shared/components'; +import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled-banner/scheduled-banner.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { MyProjectsTableComponent } from '@osf/shared/components/my-projects-table/my-projects-table.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ProjectRedirectDialogService } from '@osf/shared/services/project-redirect-dialog.service'; import { MyResourcesSelectors } from '@shared/stores/my-resources'; import { DashboardComponent } from './dashboard.component'; @@ -37,7 +39,14 @@ describe('DashboardComponent', () => { imports: [ DashboardComponent, OSFTestingStoreModule, - ...MockComponents(SubHeaderComponent, MyProjectsTableComponent, LoadingSpinnerComponent, SearchInputComponent), + ...MockComponents( + SubHeaderComponent, + MyProjectsTableComponent, + SearchInputComponent, + IconComponent, + LoadingSpinnerComponent, + ScheduledBannerComponent + ), ], providers: [ { diff --git a/src/app/features/home/pages/dashboard/dashboard.component.ts b/src/app/features/home/pages/dashboard/dashboard.component.ts index 8a04adc12..cbb42eff3 100644 --- a/src/app/features/home/pages/dashboard/dashboard.component.ts +++ b/src/app/features/home/pages/dashboard/dashboard.component.ts @@ -15,18 +15,19 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled-banner/scheduled-banner.component'; import { CreateProjectDialogComponent } from '@osf/features/my-projects/components'; -import { - IconComponent, - LoadingSpinnerComponent, - MyProjectsTableComponent, - SearchInputComponent, - SubHeaderComponent, -} from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { SortOrder } from '@osf/shared/enums'; -import { MyResourcesItem, MyResourcesSearchFilters, TableParameters } from '@osf/shared/models'; -import { CustomDialogService, ProjectRedirectDialogService } from '@osf/shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { MyProjectsTableComponent } from '@osf/shared/components/my-projects-table/my-projects-table.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ProjectRedirectDialogService } from '@osf/shared/services/project-redirect-dialog.service'; import { ClearMyResources, GetMyProjects, MyResourcesSelectors } from '@osf/shared/stores/my-resources'; +import { MyResourcesItem } from '@shared/models/my-resources/my-resources.models'; +import { MyResourcesSearchFilters } from '@shared/models/my-resources/my-resources-search-filters.models'; +import { TableParameters } from '@shared/models/table-parameters.model'; @Component({ selector: 'osf-dashboard', diff --git a/src/app/features/institutions/institutions.routes.ts b/src/app/features/institutions/institutions.routes.ts index 82d4aea78..cde03d7ff 100644 --- a/src/app/features/institutions/institutions.routes.ts +++ b/src/app/features/institutions/institutions.routes.ts @@ -1,6 +1,6 @@ import { Routes } from '@angular/router'; -import { authGuard } from '@core/guards'; +import { authGuard } from '@core/guards/auth.guard'; import { InstitutionsComponent } from './institutions.component'; import { InstitutionsListComponent, InstitutionsSearchComponent } from './pages'; diff --git a/src/app/features/institutions/pages/institutions-list/institutions-list.component.html b/src/app/features/institutions/pages/institutions-list/institutions-list.component.html index b8e898200..a1d7fd280 100644 --- a/src/app/features/institutions/pages/institutions-list/institutions-list.component.html +++ b/src/app/features/institutions/pages/institutions-list/institutions-list.component.html @@ -5,7 +5,9 @@ [title]="'institutions.title' | translate" [icon]="'custom-icon-institutions-dark'" /> + +
diff --git a/src/app/features/institutions/pages/institutions-list/institutions-list.component.spec.ts b/src/app/features/institutions/pages/institutions-list/institutions-list.component.spec.ts index 8677764f7..2c90dcfd1 100644 --- a/src/app/features/institutions/pages/institutions-list/institutions-list.component.spec.ts +++ b/src/app/features/institutions/pages/institutions-list/institutions-list.component.spec.ts @@ -1,9 +1,13 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; +import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled-banner/scheduled-banner.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { InstitutionsSelectors } from '@osf/shared/stores/institutions'; import { InstitutionsListComponent } from './institutions-list.component'; @@ -30,7 +34,11 @@ describe.skip('Component: Institutions List', () => { .build(); await TestBed.configureTestingModule({ - imports: [InstitutionsListComponent, OSFTestingModule], + imports: [ + InstitutionsListComponent, + OSFTestingModule, + ...MockComponents(SubHeaderComponent, SearchInputComponent, LoadingSpinnerComponent, ScheduledBannerComponent), + ], providers: [ provideMockStore({ signals: [ diff --git a/src/app/features/institutions/pages/institutions-list/institutions-list.component.ts b/src/app/features/institutions/pages/institutions-list/institutions-list.component.ts index 4b1fefc08..135588f15 100644 --- a/src/app/features/institutions/pages/institutions-list/institutions-list.component.ts +++ b/src/app/features/institutions/pages/institutions-list/institutions-list.component.ts @@ -8,22 +8,24 @@ import { NgOptimizedImage } from '@angular/common'; import { ChangeDetectionStrategy, Component, DestroyRef, HostBinding, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl } from '@angular/forms'; -import { ActivatedRoute, Router, RouterLink } from '@angular/router'; +import { RouterLink } from '@angular/router'; import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled-banner/scheduled-banner.component'; -import { LoadingSpinnerComponent, SearchInputComponent, SubHeaderComponent } from '@osf/shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { FetchInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions'; @Component({ selector: 'osf-institutions-list', imports: [ - SubHeaderComponent, + RouterLink, TranslatePipe, - SearchInputComponent, NgOptimizedImage, + SubHeaderComponent, + SearchInputComponent, LoadingSpinnerComponent, ScheduledBannerComponent, - RouterLink, ], templateUrl: './institutions-list.component.html', changeDetection: ChangeDetectionStrategy.OnPush, @@ -31,8 +33,6 @@ import { FetchInstitutions, InstitutionsSelectors } from '@osf/shared/stores/ins export class InstitutionsListComponent { @HostBinding('class') classes = 'flex-1 flex flex-column w-full'; - private readonly route = inject(ActivatedRoute); - private readonly router = inject(Router); private readonly destroyRef = inject(DestroyRef); private readonly actions = createDispatchMap({ getInstitutions: FetchInstitutions }); diff --git a/src/app/features/institutions/pages/institutions-search/institutions-search.component.spec.ts b/src/app/features/institutions/pages/institutions-search/institutions-search.component.spec.ts index c4b3102d8..64389ce0b 100644 --- a/src/app/features/institutions/pages/institutions-search/institutions-search.component.spec.ts +++ b/src/app/features/institutions/pages/institutions-search/institutions-search.component.spec.ts @@ -7,12 +7,13 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search'; -import { GlobalSearchComponent, LoadingSpinnerComponent } from '@shared/components'; import { InstitutionsSearchComponent } from './institutions-search.component'; -import { MOCK_INSTITUTION } from '@testing/mocks'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/institutions/pages/institutions-search/institutions-search.component.ts b/src/app/features/institutions/pages/institutions-search/institutions-search.component.ts index 7b4472cc6..8550e6916 100644 --- a/src/app/features/institutions/pages/institutions-search/institutions-search.component.ts +++ b/src/app/features/institutions/pages/institutions-search/institutions-search.component.ts @@ -7,14 +7,15 @@ import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@ang import { FormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { GlobalSearchComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { SEARCH_TAB_OPTIONS } from '@osf/shared/constants'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SEARCH_TAB_OPTIONS } from '@osf/shared/constants/search-tab-options.const'; import { SetDefaultFilterValue } from '@osf/shared/stores/global-search'; import { FetchInstitutionById, InstitutionsSearchSelectors } from '@osf/shared/stores/institutions-search'; @Component({ selector: 'osf-institutions-search', - imports: [FormsModule, NgOptimizedImage, LoadingSpinnerComponent, SafeHtmlPipe, GlobalSearchComponent], + imports: [FormsModule, NgOptimizedImage, SafeHtmlPipe, LoadingSpinnerComponent, GlobalSearchComponent], templateUrl: './institutions-search.component.html', styleUrl: './institutions-search.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/meetings/constants/meeting-submissions-table.constants.ts b/src/app/features/meetings/constants/meeting-submissions-table.constants.ts index 20c57103d..e3c25c78a 100644 --- a/src/app/features/meetings/constants/meeting-submissions-table.constants.ts +++ b/src/app/features/meetings/constants/meeting-submissions-table.constants.ts @@ -1,4 +1,4 @@ -import { TableParameters } from '@osf/shared/models'; +import { TableParameters } from '@osf/shared/models/table-parameters.model'; export const MEETING_SUBMISSIONS_TABLE_PARAMS: TableParameters = { rows: 10, diff --git a/src/app/features/meetings/mappers/meetings.mapper.ts b/src/app/features/meetings/mappers/meetings.mapper.ts index 42ed13328..4807257e6 100644 --- a/src/app/features/meetings/mappers/meetings.mapper.ts +++ b/src/app/features/meetings/mappers/meetings.mapper.ts @@ -1,4 +1,4 @@ -import { ResponseJsonApi } from '@shared/models'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; import { MeetingGetResponseJsonApi, diff --git a/src/app/features/meetings/models/meetings-json-api.model.ts b/src/app/features/meetings/models/meetings-json-api.model.ts index 1b6ebb5fb..b2d77d7e1 100644 --- a/src/app/features/meetings/models/meetings-json-api.model.ts +++ b/src/app/features/meetings/models/meetings-json-api.model.ts @@ -1,4 +1,4 @@ -import { NumberOrNull, StringOrNull } from '@osf/shared/helpers'; +import { NumberOrNull, StringOrNull } from '@osf/shared/helpers/types.helper'; export interface MeetingGetResponseJsonApi { id: string; diff --git a/src/app/features/meetings/models/meetings.models.ts b/src/app/features/meetings/models/meetings.models.ts index a672a4551..916e6d2d1 100644 --- a/src/app/features/meetings/models/meetings.models.ts +++ b/src/app/features/meetings/models/meetings.models.ts @@ -1,4 +1,4 @@ -import { StringOrNull } from '@osf/shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; export interface Meeting { id: string; diff --git a/src/app/features/meetings/pages/meeting-details/meeting-details.component.spec.ts b/src/app/features/meetings/pages/meeting-details/meeting-details.component.spec.ts index 1dd76f62d..25138abe7 100644 --- a/src/app/features/meetings/pages/meeting-details/meeting-details.component.spec.ts +++ b/src/app/features/meetings/pages/meeting-details/meeting-details.component.spec.ts @@ -13,11 +13,13 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { MeetingsSelectors } from '@osf/features/meetings/store'; -import { SearchInputComponent, SubHeaderComponent } from '@shared/components'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { MeetingDetailsComponent } from './meeting-details.component'; -import { MOCK_MEETING, MOCK_MEETING_SUBMISSIONS, MOCK_STORE } from '@testing/mocks'; +import { MOCK_MEETING, MOCK_MEETING_SUBMISSIONS } from '@testing/mocks/meeting.mock'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; const mockActivatedRoute = { params: of({ id: 'test-meeting-id' }), diff --git a/src/app/features/meetings/pages/meeting-details/meeting-details.component.ts b/src/app/features/meetings/pages/meeting-details/meeting-details.component.ts index 9229a7e4a..d099a1854 100644 --- a/src/app/features/meetings/pages/meeting-details/meeting-details.component.ts +++ b/src/app/features/meetings/pages/meeting-details/meeting-details.component.ts @@ -25,10 +25,13 @@ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; -import { SearchInputComponent, SubHeaderComponent } from '@osf/shared/components'; -import { SortOrder } from '@osf/shared/enums'; -import { parseQueryFilterParams } from '@osf/shared/helpers'; -import { QueryParams, SearchFilters, TableParameters } from '@osf/shared/models'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { parseQueryFilterParams } from '@osf/shared/helpers/http.helper'; +import { QueryParams } from '@shared/models/query-params.model'; +import { SearchFilters } from '@shared/models/search-filters.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { MEETING_SUBMISSIONS_TABLE_PARAMS } from '../../constants'; import { MeetingSubmission } from '../../models'; diff --git a/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.spec.ts b/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.spec.ts index 5be06c427..cd19ec1ac 100644 --- a/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.spec.ts +++ b/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.spec.ts @@ -11,18 +11,19 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { MeetingsState } from '@osf/features/meetings/store'; -import { parseQueryFilterParams } from '@osf/shared/helpers'; -import { SearchInputComponent, SubHeaderComponent } from '@shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@shared/constants'; -import { SortOrder } from '@shared/enums'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { parseQueryFilterParams } from '@osf/shared/helpers/http.helper'; +import { SortOrder } from '@shared/enums/sort-order.enum'; import { MeetingsFeatureCardComponent } from '../../components'; import { MEETINGS_FEATURE_CARDS, PARTNER_ORGANIZATIONS } from '../../constants'; +import { MeetingsState } from '../../store'; import { MeetingsLandingComponent } from './meetings-landing.component'; -import { MOCK_MEETING } from '@testing/mocks'; +import { MOCK_MEETING } from '@testing/mocks/meeting.mock'; const mockQueryParams = { page: 1, diff --git a/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.ts b/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.ts index 20ac9a133..33dfb2ec1 100644 --- a/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.ts +++ b/src/app/features/meetings/pages/meetings-landing/meetings-landing.component.ts @@ -23,11 +23,14 @@ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { SearchInputComponent, SubHeaderComponent } from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { SortOrder } from '@osf/shared/enums'; -import { parseQueryFilterParams } from '@osf/shared/helpers'; -import { QueryParams, SearchFilters, TableParameters } from '@osf/shared/models'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { parseQueryFilterParams } from '@osf/shared/helpers/http.helper'; +import { QueryParams } from '@shared/models/query-params.model'; +import { SearchFilters } from '@shared/models/search-filters.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { MeetingsFeatureCardComponent } from '../../components'; import { MEETINGS_FEATURE_CARDS, PARTNER_ORGANIZATIONS } from '../../constants'; diff --git a/src/app/features/meetings/services/meetings.service.ts b/src/app/features/meetings/services/meetings.service.ts index 0fed53296..d3dc25201 100644 --- a/src/app/features/meetings/services/meetings.service.ts +++ b/src/app/features/meetings/services/meetings.service.ts @@ -3,9 +3,10 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { searchPreferencesToJsonApiQueryParams } from '@osf/shared/helpers'; -import { JsonApiResponse, ResponseJsonApi, SearchFilters } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { searchPreferencesToJsonApiQueryParams } from '@osf/shared/helpers/search-pref-to-json-api-query-params.helper'; +import { JsonApiResponse, ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { meetingSortFieldMap, meetingSubmissionSortFieldMap } from '../constants'; import { MeetingsMapper } from '../mappers'; diff --git a/src/app/features/meetings/store/meetings.actions.ts b/src/app/features/meetings/store/meetings.actions.ts index 66ba74eae..24997f63a 100644 --- a/src/app/features/meetings/store/meetings.actions.ts +++ b/src/app/features/meetings/store/meetings.actions.ts @@ -1,4 +1,4 @@ -import { SearchFilters } from '@osf/shared/models'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; export class GetAllMeetings { static readonly type = '[Meetings] Get All'; diff --git a/src/app/features/meetings/store/meetings.model.ts b/src/app/features/meetings/store/meetings.model.ts index 9f6d5b1bc..1867d0531 100644 --- a/src/app/features/meetings/store/meetings.model.ts +++ b/src/app/features/meetings/store/meetings.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateWithTotalCount } from '@osf/shared/models'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { Meeting, MeetingSubmission } from '../models'; diff --git a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.spec.ts b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.spec.ts index 9d705af62..15b023b33 100644 --- a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.spec.ts +++ b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.spec.ts @@ -5,7 +5,7 @@ import { CedarMetadataDataTemplateJsonApi } from '@osf/features/metadata/models' import { CedarTemplateFormComponent } from './cedar-template-form.component'; -import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks'; +import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks/cedar-metadata-data-template-json-api.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('CedarTemplateFormComponent', () => { diff --git a/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.spec.ts b/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.spec.ts index eb863e68b..3baf28f7b 100644 --- a/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.spec.ts +++ b/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.spec.ts @@ -2,11 +2,11 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; import { MetadataAffiliatedInstitutionsComponent } from './metadata-affiliated-institutions.component'; -import { MOCK_PROJECT_AFFILIATED_INSTITUTIONS } from '@testing/mocks'; +import { MOCK_PROJECT_AFFILIATED_INSTITUTIONS } from '@testing/mocks/project-overview.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('MetadataAffiliatedInstitutionsComponent', () => { diff --git a/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.ts b/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.ts index a939c25f3..36f21d30f 100644 --- a/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.ts +++ b/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.ts @@ -5,8 +5,8 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components'; -import { Institution } from '@osf/shared/models'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; @Component({ selector: 'osf-metadata-affiliated-institutions', diff --git a/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.spec.ts b/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.spec.ts index c9bc089a9..74d6fa72a 100644 --- a/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.spec.ts +++ b/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.spec.ts @@ -3,12 +3,12 @@ import { MockComponent, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { ContributorsListComponent } from '@osf/shared/components'; -import { ContributorModel } from '@osf/shared/models'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; import { MetadataContributorsComponent } from './metadata-contributors.component'; -import { MOCK_CONTRIBUTOR } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; diff --git a/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.ts b/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.ts index 360c4b225..abfa69571 100644 --- a/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.ts +++ b/src/app/features/metadata/components/metadata-contributors/metadata-contributors.component.ts @@ -5,8 +5,8 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { ContributorsListComponent } from '@osf/shared/components'; -import { ContributorModel } from '@osf/shared/models'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; @Component({ selector: 'osf-metadata-contributors', diff --git a/src/app/features/metadata/components/metadata-description/metadata-description.component.ts b/src/app/features/metadata/components/metadata-description/metadata-description.component.ts index 43ba892d5..e7cd92173 100644 --- a/src/app/features/metadata/components/metadata-description/metadata-description.component.ts +++ b/src/app/features/metadata/components/metadata-description/metadata-description.component.ts @@ -5,7 +5,7 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; @Component({ selector: 'osf-metadata-description', diff --git a/src/app/features/metadata/components/metadata-funding/metadata-funding.component.spec.ts b/src/app/features/metadata/components/metadata-funding/metadata-funding.component.spec.ts index c2cb829f0..758988586 100644 --- a/src/app/features/metadata/components/metadata-funding/metadata-funding.component.spec.ts +++ b/src/app/features/metadata/components/metadata-funding/metadata-funding.component.spec.ts @@ -4,7 +4,7 @@ import { Funder } from '@osf/features/metadata/models'; import { MetadataFundingComponent } from './metadata-funding.component'; -import { MOCK_FUNDERS } from '@testing/mocks'; +import { MOCK_FUNDERS } from '@testing/mocks/funder.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('MetadataFundingComponent', () => { diff --git a/src/app/features/metadata/components/metadata-license/metadata-license.component.spec.ts b/src/app/features/metadata/components/metadata-license/metadata-license.component.spec.ts index 3a1883aaf..d1272d3a4 100644 --- a/src/app/features/metadata/components/metadata-license/metadata-license.component.spec.ts +++ b/src/app/features/metadata/components/metadata-license/metadata-license.component.spec.ts @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MetadataLicenseComponent } from './metadata-license.component'; -import { MOCK_LICENSE } from '@testing/mocks'; +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('MetadataLicenseComponent', () => { diff --git a/src/app/features/metadata/components/metadata-license/metadata-license.component.ts b/src/app/features/metadata/components/metadata-license/metadata-license.component.ts index f131c3d07..9fc0c98d6 100644 --- a/src/app/features/metadata/components/metadata-license/metadata-license.component.ts +++ b/src/app/features/metadata/components/metadata-license/metadata-license.component.ts @@ -5,7 +5,7 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { LicenseModel } from '@shared/models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; @Component({ selector: 'osf-metadata-license', diff --git a/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.spec.ts b/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.spec.ts index 3aaf3e17c..1efb22a7a 100644 --- a/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.spec.ts +++ b/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.spec.ts @@ -1,17 +1,17 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Identifier } from '@osf/shared/models'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; import { MetadataPublicationDoiComponent } from './metadata-publication-doi.component'; -import { MOCK_PROJECT_IDENTIFIERS } from '@testing/mocks'; +import { MOCK_PROJECT_IDENTIFIERS } from '@testing/mocks/project-overview.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('MetadataPublicationDoiComponent', () => { let component: MetadataPublicationDoiComponent; let fixture: ComponentFixture; - const mockIdentifiers: Identifier = MOCK_PROJECT_IDENTIFIERS; + const mockIdentifiers: IdentifierModel = MOCK_PROJECT_IDENTIFIERS; beforeEach(async () => { await TestBed.configureTestingModule({ diff --git a/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.ts b/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.ts index a8547da10..10231c8b2 100644 --- a/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.ts +++ b/src/app/features/metadata/components/metadata-publication-doi/metadata-publication-doi.component.ts @@ -5,8 +5,8 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; -import { ResourceType } from '@osf/shared/enums'; -import { Identifier } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; @Component({ selector: 'osf-metadata-publication-doi', @@ -17,7 +17,7 @@ import { Identifier } from '@osf/shared/models'; export class MetadataPublicationDoiComponent { openEditPublicationDoiDialog = output(); - identifiers = input([]); + identifiers = input([]); hideEditDoi = input(false); publicationDoi = input(null); resourceType = input(ResourceType.Project); diff --git a/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.spec.ts b/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.spec.ts index 4f1d1a197..d21e4a03b 100644 --- a/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.spec.ts +++ b/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.spec.ts @@ -1,17 +1,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Identifier } from '@osf/shared/models'; - import { MetadataRegistrationDoiComponent } from './metadata-registration-doi.component'; -import { MOCK_PROJECT_IDENTIFIERS } from '@testing/mocks'; +import { MOCK_PROJECT_IDENTIFIERS } from '@testing/mocks/project-overview.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('MetadataRegistrationDoiComponent', () => { let component: MetadataRegistrationDoiComponent; let fixture: ComponentFixture; - const mockIdentifiers: Identifier[] = [MOCK_PROJECT_IDENTIFIERS]; + const mockIdentifiers = [MOCK_PROJECT_IDENTIFIERS]; beforeEach(async () => { await TestBed.configureTestingModule({ diff --git a/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.ts b/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.ts index 3b06d0bdb..eb41e56fc 100644 --- a/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.ts +++ b/src/app/features/metadata/components/metadata-registration-doi/metadata-registration-doi.component.ts @@ -4,7 +4,7 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; -import { Identifier } from '@osf/shared/models'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; @Component({ selector: 'osf-metadata-registration-doi', @@ -13,7 +13,7 @@ import { Identifier } from '@osf/shared/models'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class MetadataRegistrationDoiComponent { - identifiers = input([]); + identifiers = input([]); doiHost = 'https://doi.org/'; registrationDoi = computed(() => (this.identifiers() ? this.doiHost + this.identifiers()[0]?.value : '')); diff --git a/src/app/features/metadata/components/metadata-resource-information/metadata-resource-information.component.ts b/src/app/features/metadata/components/metadata-resource-information/metadata-resource-information.component.ts index f4c3c6ff7..b5a9cb0de 100644 --- a/src/app/features/metadata/components/metadata-resource-information/metadata-resource-information.component.ts +++ b/src/app/features/metadata/components/metadata-resource-information/metadata-resource-information.component.ts @@ -7,8 +7,8 @@ import { ChangeDetectionStrategy, Component, input, output } from '@angular/core import { RESOURCE_TYPE_OPTIONS } from '@osf/features/metadata/constants'; import { CustomItemMetadataRecord } from '@osf/features/metadata/models'; -import { languageCodes } from '@osf/shared/constants'; -import { LanguageCodeModel } from '@osf/shared/models'; +import { languageCodes } from '@osf/shared/constants/language.const'; +import { LanguageCodeModel } from '@shared/models/language-code.model'; @Component({ selector: 'osf-metadata-resource-information', diff --git a/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.spec.ts b/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.spec.ts index bf486630a..2f8425aeb 100644 --- a/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.spec.ts +++ b/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.spec.ts @@ -2,8 +2,8 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { SubjectsComponent } from '@osf/shared/components'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectsComponent } from '@osf/shared/components/subjects/subjects.component'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; import { MetadataSubjectsComponent } from './metadata-subjects.component'; diff --git a/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.ts b/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.ts index 317d57b8e..052163f85 100644 --- a/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.ts +++ b/src/app/features/metadata/components/metadata-subjects/metadata-subjects.component.ts @@ -3,7 +3,7 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; import { SubjectsComponent } from '@osf/shared/components/subjects/subjects.component'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; @Component({ selector: 'osf-metadata-subjects', diff --git a/src/app/features/metadata/components/metadata-title/metadata-title.component.ts b/src/app/features/metadata/components/metadata-title/metadata-title.component.ts index fca3e4e57..5ab4d32ba 100644 --- a/src/app/features/metadata/components/metadata-title/metadata-title.component.ts +++ b/src/app/features/metadata/components/metadata-title/metadata-title.component.ts @@ -5,7 +5,7 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; @Component({ selector: 'osf-metadata-title', diff --git a/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.spec.ts b/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.spec.ts index ab70fcd28..2378c870a 100644 --- a/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.spec.ts +++ b/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.spec.ts @@ -4,13 +4,14 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Institution } from '@osf/shared/models'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; import { InstitutionsSelectors } from '@osf/shared/stores/institutions'; -import { AffiliatedInstitutionSelectComponent } from '@shared/components'; +import { Institution } from '@shared/models/institutions/institutions.models'; import { AffiliatedInstitutionsDialogComponent } from './affiliated-institutions-dialog.component'; -import { MOCK_INSTITUTION, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.ts b/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.ts index 3c8bb1ac0..079629c43 100644 --- a/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.ts +++ b/src/app/features/metadata/dialogs/affiliated-institutions-dialog/affiliated-institutions-dialog.component.ts @@ -8,8 +8,8 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; -import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components'; -import { Institution } from '@osf/shared/models'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; import { FetchUserInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions'; @Component({ diff --git a/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.spec.ts b/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.spec.ts index 8f1fa353e..b1e61b48e 100644 --- a/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.spec.ts +++ b/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.spec.ts @@ -4,15 +4,17 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorModel } from '@osf/shared/models'; -import { CustomDialogService } from '@osf/shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ContributorsSelectors } from '@osf/shared/stores/contributors'; -import { SearchInputComponent } from '@shared/components'; import { ContributorsTableComponent } from '@shared/components/contributors'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; import { ContributorsDialogComponent } from './contributors-dialog.component'; -import { MOCK_CONTRIBUTOR, MockCustomConfirmationServiceProvider, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; +import { MockCustomConfirmationServiceProvider } from '@testing/mocks/custom-confirmation.service.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.ts b/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.ts index 7f7d430e0..896cbae48 100644 --- a/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.ts +++ b/src/app/features/metadata/dialogs/contributors-dialog/contributors-dialog.component.ts @@ -22,17 +22,19 @@ import { FormControl, FormsModule } from '@angular/forms'; import { Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { SearchInputComponent } from '@osf/shared/components'; import { AddContributorDialogComponent, AddUnregisteredContributorDialogComponent, ContributorsTableComponent, } from '@osf/shared/components/contributors'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { AddContributorType, ResourceType } from '@osf/shared/enums'; -import { findChangedItems } from '@osf/shared/helpers'; -import { ContributorDialogAddModel, ContributorModel, TableParameters } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { findChangedItems } from '@osf/shared/helpers/find-changed-items.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddContributor, BulkAddContributors, @@ -45,6 +47,9 @@ import { UpdateContributorsSearchValue, UpdatePermissionFilter, } from '@osf/shared/stores/contributors'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { MetadataSelectors } from '../../store'; diff --git a/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.spec.ts b/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.spec.ts index 2548899e9..7cd0fd268 100644 --- a/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.spec.ts +++ b/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.spec.ts @@ -4,7 +4,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { EditTitleDialogComponent } from './edit-title-dialog.component'; diff --git a/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.ts b/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.ts index 027196487..c96d84f5b 100644 --- a/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.ts +++ b/src/app/features/metadata/dialogs/edit-title-dialog/edit-title-dialog.component.ts @@ -6,9 +6,9 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { DialogValueModel } from '../../models'; diff --git a/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.spec.ts b/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.spec.ts index 68f5a2e15..ef2b1aa46 100644 --- a/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.spec.ts +++ b/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.spec.ts @@ -9,7 +9,7 @@ import { MetadataSelectors } from '../../store'; import { FundingDialogComponent } from './funding-dialog.component'; -import { MOCK_FUNDERS } from '@testing/mocks'; +import { MOCK_FUNDERS } from '@testing/mocks/funder.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.ts b/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.ts index c2a036f25..0e2f80403 100644 --- a/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.ts +++ b/src/app/features/metadata/dialogs/funding-dialog/funding-dialog.component.ts @@ -13,7 +13,7 @@ import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, OnIni import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormArray, FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { CustomValidators } from '@osf/shared/helpers'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { Funder, FundingDialogResult, FundingEntryForm, FundingForm, SupplementData } from '../../models'; import { GetFundersList, MetadataSelectors } from '../../store'; diff --git a/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.spec.ts b/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.spec.ts index fb9d009d8..e693c2280 100644 --- a/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.spec.ts +++ b/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.spec.ts @@ -4,12 +4,13 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { LicenseComponent, LoadingSpinnerComponent } from '@shared/components'; +import { LicenseComponent } from '@osf/shared/components/license/license.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { LicensesSelectors } from '@shared/stores/licenses'; import { LicenseDialogComponent } from './license-dialog.component'; -import { MOCK_LICENSE } from '@testing/mocks'; +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.ts b/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.ts index 7e74f2295..0afd8ca27 100644 --- a/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.ts +++ b/src/app/features/metadata/dialogs/license-dialog/license-dialog.component.ts @@ -8,9 +8,10 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject, OnInit, signal, viewChild } from '@angular/core'; import { MetadataModel } from '@osf/features/metadata/models'; -import { LicenseComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { LicenseModel, LicenseOptions } from '@shared/models'; -import { LicensesSelectors, LoadAllLicenses } from '@shared/stores/licenses'; +import { LicenseComponent } from '@osf/shared/components/license/license.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { LicenseModel, LicenseOptions } from '@osf/shared/models/license/license.model'; +import { LicensesSelectors, LoadAllLicenses } from '@osf/shared/stores/licenses'; @Component({ selector: 'osf-license-dialog', diff --git a/src/app/features/metadata/dialogs/publication-doi-dialog/publication-doi-dialog.component.ts b/src/app/features/metadata/dialogs/publication-doi-dialog/publication-doi-dialog.component.ts index 502dfacca..332a9a5d2 100644 --- a/src/app/features/metadata/dialogs/publication-doi-dialog/publication-doi-dialog.component.ts +++ b/src/app/features/metadata/dialogs/publication-doi-dialog/publication-doi-dialog.component.ts @@ -9,7 +9,7 @@ import { InputText } from 'primeng/inputtext'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { CustomValidators } from '@osf/shared/helpers'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { DialogValueModel } from '../../models'; diff --git a/src/app/features/metadata/dialogs/resource-information-dialog/resource-information-dialog.component.ts b/src/app/features/metadata/dialogs/resource-information-dialog/resource-information-dialog.component.ts index 48a29bd7d..51866076d 100644 --- a/src/app/features/metadata/dialogs/resource-information-dialog/resource-information-dialog.component.ts +++ b/src/app/features/metadata/dialogs/resource-information-dialog/resource-information-dialog.component.ts @@ -7,8 +7,8 @@ import { Select } from 'primeng/select'; import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { languageCodes } from '@osf/shared/constants'; -import { LanguageCodeModel } from '@osf/shared/models'; +import { languageCodes } from '@osf/shared/constants/language.const'; +import { LanguageCodeModel } from '@shared/models/language-code.model'; import { RESOURCE_TYPE_OPTIONS } from '../../constants'; import { CustomItemMetadataRecord, ResourceInformationForm } from '../../models'; diff --git a/src/app/features/metadata/mappers/metadata.mapper.ts b/src/app/features/metadata/mappers/metadata.mapper.ts index 83bb43c07..c55d1f5bd 100644 --- a/src/app/features/metadata/mappers/metadata.mapper.ts +++ b/src/app/features/metadata/mappers/metadata.mapper.ts @@ -1,4 +1,5 @@ -import { IdentifiersMapper, LicensesMapper } from '@osf/shared/mappers'; +import { IdentifiersMapper } from '@osf/shared/mappers/identifiers.mapper'; +import { LicensesMapper } from '@osf/shared/mappers/licenses.mapper'; import { CustomItemMetadataRecord, CustomMetadataJsonApi, MetadataJsonApi, MetadataModel } from '../models'; diff --git a/src/app/features/metadata/metadata.component.spec.ts b/src/app/features/metadata/metadata.component.spec.ts index 242e159b0..c89783d38 100644 --- a/src/app/features/metadata/metadata.component.spec.ts +++ b/src/app/features/metadata/metadata.component.spec.ts @@ -18,9 +18,12 @@ import { MetadataTitleComponent, } from '@osf/features/metadata/components'; import { MetadataSelectors } from '@osf/features/metadata/store'; -import { MetadataTabsComponent, SubHeaderComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { MetadataTabsComponent } from '@osf/shared/components/metadata-tabs/metadata-tabs.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { MetadataComponent } from './metadata.component'; diff --git a/src/app/features/metadata/metadata.component.ts b/src/app/features/metadata/metadata.component.ts index 157945f25..df8378733 100644 --- a/src/app/features/metadata/metadata.component.ts +++ b/src/app/features/metadata/metadata.component.ts @@ -18,10 +18,13 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MetadataTabsComponent, SubHeaderComponent } from '@osf/shared/components'; -import { MetadataResourceEnum, ResourceType } from '@osf/shared/enums'; -import { MetadataTabsModel, SubjectModel } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { MetadataTabsComponent } from '@osf/shared/components/metadata-tabs/metadata-tabs.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { MetadataResourceEnum } from '@osf/shared/enums/metadata-resource.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ContributorsSelectors, GetBibliographicContributors, @@ -40,6 +43,8 @@ import { SubjectsSelectors, UpdateResourceSubjects, } from '@osf/shared/stores/subjects'; +import { MetadataTabsModel } from '@shared/models/metadata-tabs.model'; +import { SubjectModel } from '@shared/models/subject/subject.model'; import { EditTitleDialogComponent } from './dialogs/edit-title-dialog/edit-title-dialog.component'; import { diff --git a/src/app/features/metadata/models/cedar-metadata-template.model.ts b/src/app/features/metadata/models/cedar-metadata-template.model.ts index 9ebeb420c..e75886006 100644 --- a/src/app/features/metadata/models/cedar-metadata-template.model.ts +++ b/src/app/features/metadata/models/cedar-metadata-template.model.ts @@ -1,4 +1,4 @@ -import { MetaJsonApi, PaginationLinksJsonApi } from '@osf/shared/models'; +import { MetaJsonApi, PaginationLinksJsonApi } from '@osf/shared/models/common/json-api.model'; export interface CedarMetadataDataTemplateJsonApi { id: string; diff --git a/src/app/features/metadata/models/metadata-json-api.model.ts b/src/app/features/metadata/models/metadata-json-api.model.ts index 4207ae96f..11dfbd342 100644 --- a/src/app/features/metadata/models/metadata-json-api.model.ts +++ b/src/app/features/metadata/models/metadata-json-api.model.ts @@ -1,11 +1,8 @@ -import { - ApiData, - IdentifiersResponseJsonApi, - InstitutionsJsonApiResponse, - LicenseDataJsonApi, - LicenseRecordJsonApi, -} from '@osf/shared/models'; -import { UserPermissions } from '@shared/enums'; +import { UserPermissions } from '@shared/enums/user-permissions.enum'; +import { ApiData } from '@shared/models/common/json-api.model'; +import { IdentifiersResponseJsonApi } from '@shared/models/identifiers/identifier-json-api.model'; +import { InstitutionsJsonApiResponse } from '@shared/models/institutions/institution-json-api.model'; +import { LicenseDataJsonApi, LicenseRecordJsonApi } from '@shared/models/license/licenses-json-api.model'; export interface MetadataJsonApiResponse { data: MetadataJsonApi; diff --git a/src/app/features/metadata/models/metadata.model.ts b/src/app/features/metadata/models/metadata.model.ts index 351487783..43c44bf84 100644 --- a/src/app/features/metadata/models/metadata.model.ts +++ b/src/app/features/metadata/models/metadata.model.ts @@ -1,5 +1,7 @@ -import { Identifier, Institution, LicenseModel } from '@osf/shared/models'; -import { UserPermissions } from '@shared/enums'; +import { UserPermissions } from '@shared/enums/user-permissions.enum'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; +import { Institution } from '@shared/models/institutions/institutions.models'; +import { LicenseModel } from '@shared/models/license/license.model'; export interface MetadataModel { id: string; @@ -13,7 +15,7 @@ export interface MetadataModel { category?: string; dateCreated: string; dateModified: string; - identifiers: Identifier[]; + identifiers: IdentifierModel[]; affiliatedInstitutions?: Institution[]; provider?: string; nodeLicense?: { diff --git a/src/app/features/metadata/pages/add-metadata/add-metadata.component.spec.ts b/src/app/features/metadata/pages/add-metadata/add-metadata.component.spec.ts index 914ac5775..b6e1594c4 100644 --- a/src/app/features/metadata/pages/add-metadata/add-metadata.component.spec.ts +++ b/src/app/features/metadata/pages/add-metadata/add-metadata.component.spec.ts @@ -4,16 +4,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { CedarTemplateFormComponent } from '@osf/features/metadata/components'; -import { ResourceType } from '@osf/shared/enums'; -import { ToastService } from '@osf/shared/services'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ToastService } from '@osf/shared/services/toast.service'; -import { CedarMetadataDataTemplateJsonApi } from '../../models'; import { MetadataSelectors } from '../../store'; import { AddMetadataComponent } from './add-metadata.component'; -import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks'; +import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks/cedar-metadata-data-template-json-api.mock'; import { MOCK_CEDAR_METADATA_RECORD_DATA } from '@testing/mocks/cedar-metadata-record.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; @@ -27,7 +27,7 @@ describe('AddMetadataComponent', () => { let activatedRoute: Partial; let toastService: ReturnType; - const mockTemplate: CedarMetadataDataTemplateJsonApi = CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK; + const mockTemplate = CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK; const mockRecord = MOCK_CEDAR_METADATA_RECORD_DATA; const mockCedarTemplates = { 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 c5d06ffd7..63cd38edf 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 @@ -18,10 +18,11 @@ import { import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { ResourceType } from '@osf/shared/enums'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; -import { ToastService } from '@shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CedarTemplateFormComponent } from '../../components'; import { CedarMetadataDataTemplateJsonApi, CedarMetadataRecordData, CedarRecordDataBinding } from '../../models'; diff --git a/src/app/features/metadata/services/metadata.service.ts b/src/app/features/metadata/services/metadata.service.ts index 8447c7337..75ae0c86b 100644 --- a/src/app/features/metadata/services/metadata.service.ts +++ b/src/app/features/metadata/services/metadata.service.ts @@ -4,9 +4,11 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '@osf/shared/enums'; -import { BaseNodeAttributesJsonApi, Identifier, LicenseOptions } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; +import { LicenseOptions } from '@osf/shared/models/license/license.model'; +import { BaseNodeAttributesJsonApi } from '@osf/shared/models/nodes/base-node-attributes-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { CedarRecordsMapper, MetadataMapper } from '../mappers'; import { @@ -60,7 +62,7 @@ export class MetadataService { .pipe(map((response) => MetadataMapper.fromCustomMetadataApiResponse(response))); } - createDoi(resourceId: string, resourceType: ResourceType): Observable { + createDoi(resourceId: string, resourceType: ResourceType): Observable { const payload = { data: { type: 'identifiers', diff --git a/src/app/features/metadata/store/metadata.actions.ts b/src/app/features/metadata/store/metadata.actions.ts index 07f714a54..cc3301bca 100644 --- a/src/app/features/metadata/store/metadata.actions.ts +++ b/src/app/features/metadata/store/metadata.actions.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@osf/shared/enums'; -import { LicenseOptions } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { LicenseOptions } from '@shared/models/license/license.model'; import { CedarMetadataRecordData, diff --git a/src/app/features/metadata/store/metadata.model.ts b/src/app/features/metadata/store/metadata.model.ts index a950cb246..1deae0c00 100644 --- a/src/app/features/metadata/store/metadata.model.ts +++ b/src/app/features/metadata/store/metadata.model.ts @@ -4,7 +4,7 @@ import { CedarMetadataTemplateJsonApi, CustomItemMetadataRecord, } from '@osf/features/metadata/models'; -import { AsyncStateModel } from '@shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { CrossRefFunder, MetadataModel } from '../models'; diff --git a/src/app/features/metadata/store/metadata.selectors.ts b/src/app/features/metadata/store/metadata.selectors.ts index 9693a56fc..7ceca5945 100644 --- a/src/app/features/metadata/store/metadata.selectors.ts +++ b/src/app/features/metadata/store/metadata.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { MetadataStateModel } from './metadata.model'; import { MetadataState } from './metadata.state'; diff --git a/src/app/features/metadata/store/metadata.state.ts b/src/app/features/metadata/store/metadata.state.ts index 4ede9b82d..245895fd9 100644 --- a/src/app/features/metadata/store/metadata.state.ts +++ b/src/app/features/metadata/store/metadata.state.ts @@ -4,7 +4,7 @@ import { catchError, finalize, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { CedarMetadataRecord, CedarMetadataRecordJsonApi, MetadataModel } from '../models'; import { MetadataService } from '../services'; diff --git a/src/app/features/moderation/collection-moderation.routes.ts b/src/app/features/moderation/collection-moderation.routes.ts index 421f1cee5..76d153d3b 100644 --- a/src/app/features/moderation/collection-moderation.routes.ts +++ b/src/app/features/moderation/collection-moderation.routes.ts @@ -3,7 +3,7 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; import { CollectionsModerationState } from '@osf/features/moderation/store/collections-moderation'; -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ActivityLogsState } from '@shared/stores/activity-logs'; import { CollectionsState } from '@shared/stores/collections'; diff --git a/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.spec.ts b/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.spec.ts index 0e682c87e..9ec93dd0c 100644 --- a/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.spec.ts +++ b/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.spec.ts @@ -6,14 +6,16 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomPaginatorComponent, LoadingSpinnerComponent, SearchInputComponent } from '@shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; import { ModeratorAddModel } from '../../models'; import { ModeratorsSelectors } from '../../store/moderators'; import { AddModeratorDialogComponent } from './add-moderator-dialog.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { DynamicDialogRefMock } from '@testing/mocks/dynamic-dialog-ref.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.ts b/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.ts index 106657b1c..f0f6e3be3 100644 --- a/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.ts +++ b/src/app/features/moderation/components/add-moderator-dialog/add-moderator-dialog.component.ts @@ -13,7 +13,9 @@ import { ChangeDetectionStrategy, Component, DestroyRef, inject, OnDestroy, OnIn import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule } from '@angular/forms'; -import { CustomPaginatorComponent, LoadingSpinnerComponent, SearchInputComponent } from '@osf/shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; import { AddModeratorType } from '../../enums'; import { ModeratorAddModel, ModeratorDialogAddModel } from '../../models'; diff --git a/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.spec.ts b/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.spec.ts index 88d55311b..cf5243f73 100644 --- a/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.spec.ts +++ b/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.spec.ts @@ -4,15 +4,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { CollectionSubmissionsListComponent } from '@osf/features/moderation/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { CollectionsSelectors } from '@osf/shared/stores/collections'; -import { CustomPaginatorComponent, IconComponent, LoadingSpinnerComponent, SelectComponent } from '@shared/components'; import { SubmissionReviewStatus } from '../../enums'; import { CollectionsModerationSelectors } from '../../store/collections-moderation'; import { CollectionModerationSubmissionsComponent } from './collection-moderation-submissions.component'; -import { MOCK_PROVIDER } from '@testing/mocks'; +import { MOCK_PROVIDER } from '@testing/mocks/provider.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { RouterMockBuilder } from '@testing/providers/router-provider.mock'; diff --git a/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.ts b/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.ts index 16f0fb2e4..8c86b6814 100644 --- a/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.ts +++ b/src/app/features/moderation/components/collection-moderation-submissions/collection-moderation-submissions.component.ts @@ -9,14 +9,12 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject, signal } import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SelectComponent, -} from '@osf/shared/components'; -import { COLLECTION_SUBMISSIONS_SORT_OPTIONS } from '@osf/shared/constants'; -import { Primitive } from '@osf/shared/helpers'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { COLLECTION_SUBMISSIONS_SORT_OPTIONS } from '@osf/shared/constants/sort-options.const'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { ClearCollections, ClearCollectionSubmissions, diff --git a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts index 6160eae16..fd0b7ef0f 100644 --- a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts +++ b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.spec.ts @@ -1,12 +1,12 @@ -import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; +import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { CollectionSubmissionWithGuid } from '@osf/shared/models'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { CollectionsSelectors } from '@osf/shared/stores/collections'; -import { IconComponent } from '@shared/components'; -import { DateAgoPipe } from '@shared/pipes'; +import { CollectionSubmissionWithGuid } from '@shared/models/collections/collections.models'; +import { DateAgoPipe } from '@shared/pipes/date-ago.pipe'; import { SubmissionReviewStatus } from '../../enums'; @@ -39,7 +39,7 @@ describe('CollectionSubmissionItemComponent', () => { imports: [ CollectionSubmissionItemComponent, OSFTestingModule, - MockComponent(IconComponent), + ...MockComponents(IconComponent), MockPipe(DateAgoPipe), ], providers: [ diff --git a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts index cea58dfca..c24ba1577 100644 --- a/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts +++ b/src/app/features/moderation/components/collection-submission-item/collection-submission-item.component.ts @@ -8,9 +8,10 @@ import { ChangeDetectionStrategy, Component, computed, inject, input } from '@an import { ActivatedRoute, Router } from '@angular/router'; import { collectionFilterNames } from '@osf/features/collections/constants'; -import { IconComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { CollectionSubmissionWithGuid } from '@osf/shared/models'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { CollectionSubmissionWithGuid } from '@osf/shared/models/collections/collections.models'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { CollectionsSelectors } from '@osf/shared/stores/collections'; import { ReviewStatusIcon } from '../../constants'; diff --git a/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.spec.ts b/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.spec.ts index 6dfd3ea5e..aad71b9cb 100644 --- a/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.spec.ts +++ b/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.spec.ts @@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { ProjectOverviewComponent } from '@osf/features/project/overview/project-overview.component'; -import { Mode } from '@shared/enums'; +import { Mode } from '@osf/shared/enums/mode.enum'; import { CollectionSubmissionOverviewComponent } from './collection-submission-overview.component'; diff --git a/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.ts b/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.ts index d0a610b59..a0810e4b5 100644 --- a/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.ts +++ b/src/app/features/moderation/components/collection-submission-overview/collection-submission-overview.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject } from '@a import { ActivatedRoute, Router } from '@angular/router'; import { ProjectOverviewComponent } from '@osf/features/project/overview/project-overview.component'; -import { Mode } from '@shared/enums'; +import { Mode } from '@osf/shared/enums/mode.enum'; @Component({ selector: 'osf-collection-submission-overview', diff --git a/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.spec.ts b/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.spec.ts index 238e7689f..fe6f3d8ea 100644 --- a/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.spec.ts +++ b/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.spec.ts @@ -4,7 +4,8 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormSelectComponent, TextInputComponent } from '@shared/components'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { ModeratorPermission } from '../../enums'; diff --git a/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.ts b/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.ts index 700717724..8b57ed3f5 100644 --- a/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.ts +++ b/src/app/features/moderation/components/invite-moderator-dialog/invite-moderator-dialog.component.ts @@ -6,9 +6,10 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { FormSelectComponent, TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { MODERATION_PERMISSIONS } from '../../constants'; import { AddModeratorType, ModeratorPermission } from '../../enums'; diff --git a/src/app/features/moderation/components/moderators-list/moderators-list.component.spec.ts b/src/app/features/moderation/components/moderators-list/moderators-list.component.spec.ts index d70f3ef85..1da622c33 100644 --- a/src/app/features/moderation/components/moderators-list/moderators-list.component.spec.ts +++ b/src/app/features/moderation/components/moderators-list/moderators-list.component.spec.ts @@ -7,9 +7,10 @@ import { ActivatedRoute } from '@angular/router'; import { ProviderSelectors } from '@core/store/provider'; import { UserSelectors } from '@core/store/user'; -import { SearchInputComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService } from '@shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ModeratorPermission } from '../../enums'; import { ModeratorModel } from '../../models'; @@ -18,8 +19,9 @@ import { ModeratorsTableComponent } from '../moderators-table/moderators-table.c import { ModeratorsListComponent } from './moderators-list.component'; -import { MOCK_USER, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { MOCK_MODERATORS } from '@testing/mocks/moderator.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomConfirmationServiceMockBuilder } from '@testing/providers/custom-confirmation-provider.mock'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; diff --git a/src/app/features/moderation/components/moderators-list/moderators-list.component.ts b/src/app/features/moderation/components/moderators-list/moderators-list.component.ts index e7af36f1e..7bd4ef1b8 100644 --- a/src/app/features/moderation/components/moderators-list/moderators-list.component.ts +++ b/src/app/features/moderation/components/moderators-list/moderators-list.component.ts @@ -24,11 +24,13 @@ import { ActivatedRoute } from '@angular/router'; import { ProviderSelectors } from '@core/store/provider'; import { UserSelectors } from '@core/store/user'; -import { SearchInputComponent } from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { TableParameters } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { AddModeratorType } from '../../enums'; import { ModeratorDialogAddModel, ModeratorModel } from '../../models'; diff --git a/src/app/features/moderation/components/moderators-table/moderators-table.component.spec.ts b/src/app/features/moderation/components/moderators-table/moderators-table.component.spec.ts index 0df3b64a4..0c8fac6ce 100644 --- a/src/app/features/moderation/components/moderators-table/moderators-table.component.spec.ts +++ b/src/app/features/moderation/components/moderators-table/moderators-table.component.spec.ts @@ -2,9 +2,9 @@ import { MockComponent, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { SelectComponent } from '@shared/components'; -import { TableParameters } from '@shared/models'; -import { CustomDialogService } from '@shared/services'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { ModeratorModel } from '../../models'; diff --git a/src/app/features/moderation/components/moderators-table/moderators-table.component.ts b/src/app/features/moderation/components/moderators-table/moderators-table.component.ts index 80e61d8d7..61dd9e49c 100644 --- a/src/app/features/moderation/components/moderators-table/moderators-table.component.ts +++ b/src/app/features/moderation/components/moderators-table/moderators-table.component.ts @@ -11,13 +11,11 @@ import { RouterLink } from '@angular/router'; import { MODERATION_PERMISSIONS } from '@osf/features/moderation/constants'; import { ModeratorPermission } from '@osf/features/moderation/enums'; import { ModeratorModel } from '@osf/features/moderation/models'; -import { - EducationHistoryDialogComponent, - EmploymentHistoryDialogComponent, - SelectComponent, -} from '@osf/shared/components'; -import { TableParameters } from '@osf/shared/models'; -import { CustomDialogService } from '@osf/shared/services'; +import { EducationHistoryDialogComponent } from '@osf/shared/components/education-history-dialog/education-history-dialog.component'; +import { EmploymentHistoryDialogComponent } from '@osf/shared/components/employment-history-dialog/employment-history-dialog.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { TableParameters } from '@osf/shared/models/table-parameters.model'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; @Component({ selector: 'osf-moderators-table', diff --git a/src/app/features/moderation/components/my-reviewing-navigation/my-reviewing-navigation.component.spec.ts b/src/app/features/moderation/components/my-reviewing-navigation/my-reviewing-navigation.component.spec.ts index b8bf3cb3b..785c5a7a4 100644 --- a/src/app/features/moderation/components/my-reviewing-navigation/my-reviewing-navigation.component.spec.ts +++ b/src/app/features/moderation/components/my-reviewing-navigation/my-reviewing-navigation.component.spec.ts @@ -4,7 +4,7 @@ import { PreprintModerationTab } from '../../enums'; import { MyReviewingNavigationComponent } from './my-reviewing-navigation.component'; -import { MOCK_PROVIDER } from '@testing/mocks'; +import { MOCK_PROVIDER } from '@testing/mocks/provider.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('MyReviewingNavigationComponent', () => { diff --git a/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.spec.ts b/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.spec.ts index 7872b7d22..155d6bf3e 100644 --- a/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.spec.ts +++ b/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.spec.ts @@ -3,7 +3,7 @@ import { MockComponent, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { LoadingSpinnerComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { SettingsSectionControl } from '../../enums'; import { PreprintProviderModerationInfo } from '../../models'; diff --git a/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.ts b/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.ts index ff7d9643a..bb00e0da4 100644 --- a/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.ts +++ b/src/app/features/moderation/components/preprint-moderation-settings/preprint-moderation-settings.component.ts @@ -14,7 +14,7 @@ import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { LoadingSpinnerComponent } from '@osf/shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { PREPRINT_SETTINGS_SECTIONS } from '../../constants'; import { SettingsSectionControl } from '../../enums'; diff --git a/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.spec.ts b/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.spec.ts index c1baca4ba..b1f8bf48e 100644 --- a/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.spec.ts +++ b/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.spec.ts @@ -2,7 +2,8 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomPaginatorComponent, IconComponent } from '@osf/shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { PreprintReviewActionModel } from '../../models'; diff --git a/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.ts b/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.ts index 49ad896eb..9606a7e62 100644 --- a/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.ts +++ b/src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.ts @@ -7,7 +7,8 @@ import { TableModule } from 'primeng/table'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input, output, signal } from '@angular/core'; -import { CustomPaginatorComponent, IconComponent } from '@osf/shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { PreprintReviewStatus, ReviewStatusIcon } from '../../constants'; import { PreprintReviewActionModel } from '../../models'; diff --git a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.spec.ts b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.spec.ts index 02d4c7035..d5dd8258b 100644 --- a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.spec.ts +++ b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.spec.ts @@ -3,8 +3,9 @@ import { MockComponents, MockPipes } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorsListComponent, IconComponent } from '@osf/shared/components'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { SubmissionReviewStatus } from '../../enums'; import { PreprintSubmissionModel } from '../../models'; diff --git a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts index 509c1e144..35e537c49 100644 --- a/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts +++ b/src/app/features/moderation/components/preprint-submission-item/preprint-submission-item.component.ts @@ -5,9 +5,11 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; -import { ContributorsListComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { StopPropagationDirective } from '@osf/shared/directives'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { PREPRINT_ACTION_LABEL, ReviewStatusIcon } from '../../constants'; import { ActionStatus, SubmissionReviewStatus } from '../../enums'; diff --git a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts index 95f36ff18..647cf91e8 100644 --- a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts +++ b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.spec.ts @@ -5,18 +5,20 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { PreprintSubmissionItemComponent } from '@osf/features/moderation/components'; -import { PreprintSubmissionModel } from '@osf/features/moderation/models'; -import { CustomPaginatorComponent, IconComponent, LoadingSpinnerComponent, SelectComponent } from '@shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { PreprintSubmissionsSort, SubmissionReviewStatus } from '../../enums'; +import { PreprintSubmissionModel } from '../../models'; import { GetPreprintSubmissionContributors, LoadMorePreprintSubmissionContributors, PreprintModerationSelectors, } from '../../store/preprint-moderation'; - -import { PreprintSubmissionsComponent } from './preprint-submissions.component'; +import { PreprintSubmissionItemComponent } from '../preprint-submission-item/preprint-submission-item.component'; +import { PreprintSubmissionsComponent } from '..'; import { MOCK_PREPRINT_SUBMISSIONS } from '@testing/mocks/preprint-submission.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; diff --git a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts index a4bb80458..f4fe157e8 100644 --- a/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts +++ b/src/app/features/moderation/components/preprint-submissions/preprint-submissions.component.ts @@ -16,13 +16,11 @@ import { ActivatedRoute, Router } from '@angular/router'; import { PreprintSubmissionItemComponent } from '@osf/features/moderation/components'; import { PREPRINT_SORT_OPTIONS, SUBMISSION_REVIEW_OPTIONS } from '@osf/features/moderation/constants'; import { PreprintSubmissionsSort, SubmissionReviewStatus } from '@osf/features/moderation/enums'; -import { - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SelectComponent, -} from '@osf/shared/components'; -import { Primitive } from '@osf/shared/helpers'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { PreprintSubmissionModel } from '../../models'; import { diff --git a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts index d493700b6..97a2e3707 100644 --- a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts +++ b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.spec.ts @@ -5,16 +5,19 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { PreprintSubmissionItemComponent } from '@osf/features/moderation/components'; -import { PreprintWithdrawalSubmission } from '@osf/features/moderation/models'; -import { CustomPaginatorComponent, IconComponent, LoadingSpinnerComponent, SelectComponent } from '@shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { PreprintSubmissionsSort, SubmissionReviewStatus } from '../../enums'; +import { PreprintWithdrawalSubmission } from '../../models'; import { GetPreprintWithdrawalSubmissionContributors, LoadMorePreprintWithdrawalSubmissionContributors, PreprintModerationSelectors, } from '../../store/preprint-moderation'; +import { PreprintSubmissionItemComponent } from '../preprint-submission-item/preprint-submission-item.component'; import { PreprintWithdrawalSubmissionsComponent } from './preprint-withdrawal-submissions.component'; diff --git a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts index 6bb394055..7dd69df25 100644 --- a/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts +++ b/src/app/features/moderation/components/preprint-withdrawal-submissions/preprint-withdrawal-submissions.component.ts @@ -15,13 +15,11 @@ import { ActivatedRoute, Router } from '@angular/router'; import { PREPRINT_SORT_OPTIONS, WITHDRAWAL_SUBMISSION_REVIEW_OPTIONS } from '@osf/features/moderation/constants'; import { PreprintSubmissionsSort, SubmissionReviewStatus } from '@osf/features/moderation/enums'; -import { - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SelectComponent, -} from '@osf/shared/components'; -import { Primitive } from '@osf/shared/helpers'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { PreprintWithdrawalSubmission } from '../../models'; import { diff --git a/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.spec.ts b/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.spec.ts index 055391f6f..666cc14db 100644 --- a/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.spec.ts +++ b/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.spec.ts @@ -1,13 +1,18 @@ import { TranslatePipe } from '@ngx-translate/core'; -import { MockComponents, MockProvider } from 'ng-mocks'; +import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RegistryModeration } from '@osf/features/moderation/models'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { RegistrySort, SubmissionReviewStatus } from '../../enums'; import { RegistryModerationSelectors } from '../../store/registry-moderation'; +import { RegistrySubmissionItemComponent } from '../registry-submission-item/registry-submission-item.component'; import { RegistryPendingSubmissionsComponent } from './registry-pending-submissions.component'; @@ -34,7 +39,18 @@ describe('RegistryPendingSubmissionsComponent', () => { .build(); await TestBed.configureTestingModule({ - imports: [RegistryPendingSubmissionsComponent, OSFTestingModule, ...MockComponents(), TranslatePipe], + imports: [ + RegistryPendingSubmissionsComponent, + OSFTestingModule, + ...MockComponents( + SelectComponent, + IconComponent, + LoadingSpinnerComponent, + RegistrySubmissionItemComponent, + CustomPaginatorComponent + ), + MockPipe(TranslatePipe), + ], providers: [ MockProvider(Router, mockRouter), MockProvider(ActivatedRoute, mockActivatedRoute), diff --git a/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.ts b/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.ts index 8a25f067c..7f21e3fc5 100644 --- a/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.ts +++ b/src/app/features/moderation/components/registry-pending-submissions/registry-pending-submissions.component.ts @@ -13,14 +13,13 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SelectComponent, -} from '@osf/shared/components'; -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; -import { Primitive } from '@osf/shared/helpers'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { PENDING_SUBMISSION_REVIEW_OPTIONS, REGISTRY_SORT_OPTIONS } from '../../constants'; import { RegistrySort, SubmissionReviewStatus } from '../../enums'; diff --git a/src/app/features/moderation/components/registry-settings/registry-settings.component.spec.ts b/src/app/features/moderation/components/registry-settings/registry-settings.component.spec.ts index 346ef660b..dd06d8fdc 100644 --- a/src/app/features/moderation/components/registry-settings/registry-settings.component.spec.ts +++ b/src/app/features/moderation/components/registry-settings/registry-settings.component.spec.ts @@ -1,3 +1,6 @@ +import { TranslatePipe } from '@ngx-translate/core'; +import { MockPipe } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RegistrySettingsComponent } from './registry-settings.component'; @@ -10,7 +13,7 @@ describe('RegistrySettingsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RegistrySettingsComponent, OSFTestingModule], + imports: [RegistrySettingsComponent, OSFTestingModule, MockPipe(TranslatePipe)], }).compileComponents(); fixture = TestBed.createComponent(RegistrySettingsComponent); diff --git a/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.spec.ts b/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.spec.ts index 15c97a7ab..a4c08224b 100644 --- a/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.spec.ts +++ b/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.spec.ts @@ -1,9 +1,10 @@ -import { MockComponent, MockPipe } from 'ng-mocks'; +import { TranslatePipe } from '@ngx-translate/core'; +import { MockComponents, MockPipe } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { IconComponent } from '@osf/shared/components'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { SubmissionReviewStatus } from '../../enums'; import { RegistryModeration } from '../../models'; @@ -21,7 +22,13 @@ describe('RegistrySubmissionItemComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RegistrySubmissionItemComponent, OSFTestingModule, MockComponent(IconComponent), MockPipe(DateAgoPipe)], + imports: [ + RegistrySubmissionItemComponent, + OSFTestingModule, + ...MockComponents(IconComponent), + MockPipe(DateAgoPipe), + MockPipe(TranslatePipe), + ], }).compileComponents(); fixture = TestBed.createComponent(RegistrySubmissionItemComponent); diff --git a/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.ts b/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.ts index 3f0aedf77..38f265cf8 100644 --- a/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.ts +++ b/src/app/features/moderation/components/registry-submission-item/registry-submission-item.component.ts @@ -5,8 +5,9 @@ import { Button } from 'primeng/button'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { IconComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { REGISTRY_ACTION_LABEL, ReviewStatusIcon } from '../../constants'; import { ActionStatus, SubmissionReviewStatus } from '../../enums'; diff --git a/src/app/features/moderation/components/registry-submissions/registry-submissions.component.spec.ts b/src/app/features/moderation/components/registry-submissions/registry-submissions.component.spec.ts index aa145cbc0..9bb0297db 100644 --- a/src/app/features/moderation/components/registry-submissions/registry-submissions.component.spec.ts +++ b/src/app/features/moderation/components/registry-submissions/registry-submissions.component.spec.ts @@ -5,7 +5,10 @@ import { ActivatedRoute, Router } from '@angular/router'; import { RegistrySubmissionItemComponent } from '@osf/features/moderation/components'; import { RegistryModeration } from '@osf/features/moderation/models'; -import { CustomPaginatorComponent, IconComponent, LoadingSpinnerComponent, SelectComponent } from '@shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { RegistrySort, SubmissionReviewStatus } from '../../enums'; import { RegistryModerationSelectors } from '../../store/registry-moderation'; diff --git a/src/app/features/moderation/components/registry-submissions/registry-submissions.component.ts b/src/app/features/moderation/components/registry-submissions/registry-submissions.component.ts index 3e27ba445..86afd1975 100644 --- a/src/app/features/moderation/components/registry-submissions/registry-submissions.component.ts +++ b/src/app/features/moderation/components/registry-submissions/registry-submissions.component.ts @@ -13,14 +13,13 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { - CustomPaginatorComponent, - IconComponent, - LoadingSpinnerComponent, - SelectComponent, -} from '@osf/shared/components'; -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; -import { Primitive } from '@osf/shared/helpers'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { REGISTRY_SORT_OPTIONS, SUBMITTED_SUBMISSION_REVIEW_OPTIONS } from '../../constants'; import { RegistrySort, SubmissionReviewStatus } from '../../enums'; diff --git a/src/app/features/moderation/constants/collection-moderation-tabs.const.ts b/src/app/features/moderation/constants/collection-moderation-tabs.const.ts index 758261f8d..082a74034 100644 --- a/src/app/features/moderation/constants/collection-moderation-tabs.const.ts +++ b/src/app/features/moderation/constants/collection-moderation-tabs.const.ts @@ -1,4 +1,4 @@ -import { CustomOption, SelectOption } from '@osf/shared/models'; +import { CustomOption, SelectOption } from '@osf/shared/models/select-option.model'; import { CollectionModerationTab, ModeratorPermission } from '../enums'; diff --git a/src/app/features/moderation/constants/preprint-moderation-tabs.const.ts b/src/app/features/moderation/constants/preprint-moderation-tabs.const.ts index f12c02823..26d83450a 100644 --- a/src/app/features/moderation/constants/preprint-moderation-tabs.const.ts +++ b/src/app/features/moderation/constants/preprint-moderation-tabs.const.ts @@ -1,4 +1,4 @@ -import { CustomOption } from '@osf/shared/models'; +import { CustomOption } from '@osf/shared/models/select-option.model'; import { PreprintModerationTab } from '../enums'; 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 3f1579f7b..56cc9464f 100644 --- a/src/app/features/moderation/constants/preprint-sort-options.const.ts +++ b/src/app/features/moderation/constants/preprint-sort-options.const.ts @@ -1,4 +1,4 @@ -import { CustomOption } from '@osf/shared/models'; +import { CustomOption } from '@osf/shared/models/select-option.model'; import { PreprintSubmissionsSort } from '../enums'; diff --git a/src/app/features/moderation/constants/registry-moderation-tabs.const.ts b/src/app/features/moderation/constants/registry-moderation-tabs.const.ts index 57143a564..050436761 100644 --- a/src/app/features/moderation/constants/registry-moderation-tabs.const.ts +++ b/src/app/features/moderation/constants/registry-moderation-tabs.const.ts @@ -1,4 +1,4 @@ -import { CustomOption } from '@osf/shared/models'; +import { CustomOption } from '@osf/shared/models/select-option.model'; import { RegistryModerationTab } from '../enums'; diff --git a/src/app/features/moderation/constants/registry-sort-options.const.ts b/src/app/features/moderation/constants/registry-sort-options.const.ts index 0e75886a3..2c57d9b24 100644 --- a/src/app/features/moderation/constants/registry-sort-options.const.ts +++ b/src/app/features/moderation/constants/registry-sort-options.const.ts @@ -1,4 +1,4 @@ -import { CustomOption } from '@osf/shared/models'; +import { CustomOption } from '@osf/shared/models/select-option.model'; import { RegistrySort } from '../enums'; diff --git a/src/app/features/moderation/mappers/moderation.mapper.ts b/src/app/features/moderation/mappers/moderation.mapper.ts index 0459d7be3..18af21c2e 100644 --- a/src/app/features/moderation/mappers/moderation.mapper.ts +++ b/src/app/features/moderation/mappers/moderation.mapper.ts @@ -1,4 +1,6 @@ -import { PaginatedData, ResponseJsonApi, UserDataJsonApi } from '@osf/shared/models'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { UserDataJsonApi } from '@osf/shared/models/user/user-json-api.model'; import { AddModeratorType, ModeratorPermission } from '../enums'; import { ModeratorAddModel, ModeratorAddRequestModel, ModeratorDataJsonApi, ModeratorModel } from '../models'; diff --git a/src/app/features/moderation/mappers/preprint-moderation.mapper.ts b/src/app/features/moderation/mappers/preprint-moderation.mapper.ts index 799671e2d..b87c70438 100644 --- a/src/app/features/moderation/mappers/preprint-moderation.mapper.ts +++ b/src/app/features/moderation/mappers/preprint-moderation.mapper.ts @@ -1,5 +1,6 @@ -import { UserMapper } from '@osf/shared/mappers'; -import { PaginatedData, ResponseJsonApi } from '@osf/shared/models'; +import { UserMapper } from '@osf/shared/mappers/user'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { PreprintProviderModerationInfo, diff --git a/src/app/features/moderation/mappers/registry-moderation.mapper.ts b/src/app/features/moderation/mappers/registry-moderation.mapper.ts index 2b79fc178..8c7113170 100644 --- a/src/app/features/moderation/mappers/registry-moderation.mapper.ts +++ b/src/app/features/moderation/mappers/registry-moderation.mapper.ts @@ -1,5 +1,5 @@ -import { UserMapper } from '@osf/shared/mappers'; -import { PaginatedData } from '@osf/shared/models'; +import { UserMapper } from '@osf/shared/mappers/user'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { RegistryDataJsonApi, diff --git a/src/app/features/moderation/models/collection-submission-review-action-json.api.ts b/src/app/features/moderation/models/collection-submission-review-action-json.api.ts index 1d536d6a5..cca102865 100644 --- a/src/app/features/moderation/models/collection-submission-review-action-json.api.ts +++ b/src/app/features/moderation/models/collection-submission-review-action-json.api.ts @@ -1,4 +1,4 @@ -import { UserDataErrorResponseJsonApi } from '@osf/shared/models'; +import { UserDataErrorResponseJsonApi } from '@osf/shared/models/user/user-json-api.model'; export interface CollectionSubmissionReviewActionJsonApi { id: string; diff --git a/src/app/features/moderation/models/moderator-json-api.model.ts b/src/app/features/moderation/models/moderator-json-api.model.ts index edeeda2d3..24449f115 100644 --- a/src/app/features/moderation/models/moderator-json-api.model.ts +++ b/src/app/features/moderation/models/moderator-json-api.model.ts @@ -1,4 +1,5 @@ -import { ApiData, MetaJsonApi, PaginationLinksJsonApi, UserDataJsonApi } from '@osf/shared/models'; +import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '@osf/shared/models/common/json-api.model'; +import { UserDataJsonApi } from '@osf/shared/models/user/user-json-api.model'; export interface ModeratorResponseJsonApi { data: ModeratorDataJsonApi[]; diff --git a/src/app/features/moderation/models/moderator.model.ts b/src/app/features/moderation/models/moderator.model.ts index 7170e6dd0..d68ad448b 100644 --- a/src/app/features/moderation/models/moderator.model.ts +++ b/src/app/features/moderation/models/moderator.model.ts @@ -1,4 +1,5 @@ -import { Education, Employment } from '@osf/shared/models'; +import { Education } from '@osf/shared/models/user/education.model'; +import { Employment } from '@osf/shared/models/user/employment.model'; import { ModeratorPermission } from '../enums'; diff --git a/src/app/features/moderation/models/preprint-provider-moderation-info.model.ts b/src/app/features/moderation/models/preprint-provider-moderation-info.model.ts index 73649885b..ab4e5ac7e 100644 --- a/src/app/features/moderation/models/preprint-provider-moderation-info.model.ts +++ b/src/app/features/moderation/models/preprint-provider-moderation-info.model.ts @@ -1,4 +1,4 @@ -import { ReviewPermissions } from '@osf/shared/enums'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; export interface PreprintProviderModerationInfo { id: string; diff --git a/src/app/features/moderation/models/preprint-related-count-json-api.model.ts b/src/app/features/moderation/models/preprint-related-count-json-api.model.ts index 9524c1bfd..7b78a3871 100644 --- a/src/app/features/moderation/models/preprint-related-count-json-api.model.ts +++ b/src/app/features/moderation/models/preprint-related-count-json-api.model.ts @@ -1,4 +1,4 @@ -import { PreprintProviderAttributesJsonApi } from '@osf/shared/models'; +import { PreprintProviderAttributesJsonApi } from '@osf/shared/models/provider/preprints-provider-json-api.model'; export interface PreprintRelatedCountJsonApi { id: string; diff --git a/src/app/features/moderation/models/preprint-review-action-json-api.model.ts b/src/app/features/moderation/models/preprint-review-action-json-api.model.ts index 8e6f722a8..ef2ce5fbf 100644 --- a/src/app/features/moderation/models/preprint-review-action-json-api.model.ts +++ b/src/app/features/moderation/models/preprint-review-action-json-api.model.ts @@ -1,4 +1,4 @@ -import { UserDataErrorResponseJsonApi } from '@osf/shared/models'; +import { UserAttributesJsonApi, UserDataErrorResponseJsonApi } from '@osf/shared/models/user/user-json-api.model'; export interface ReviewActionJsonApi { id: string; @@ -31,10 +31,6 @@ export interface UserModelJsonApi { attributes: UserAttributesJsonApi; } -export interface UserAttributesJsonApi { - full_name: string; -} - export interface PreprintModelJsonApi { id: string; type: 'preprints'; diff --git a/src/app/features/moderation/models/preprint-review-action.model.ts b/src/app/features/moderation/models/preprint-review-action.model.ts index 6c811f95e..489865fd2 100644 --- a/src/app/features/moderation/models/preprint-review-action.model.ts +++ b/src/app/features/moderation/models/preprint-review-action.model.ts @@ -1,11 +1,11 @@ -import { IdName } from '@osf/shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; export interface PreprintReviewActionModel { id: string; dateModified: string; fromState: string; toState: string; - creator: IdName; - preprint: IdName; - provider: IdName; + creator: IdNameModel; + preprint: IdNameModel; + provider: IdNameModel; } diff --git a/src/app/features/moderation/models/preprint-submission-json-api.model.ts b/src/app/features/moderation/models/preprint-submission-json-api.model.ts index 3a7fffa8d..d18b87089 100644 --- a/src/app/features/moderation/models/preprint-submission-json-api.model.ts +++ b/src/app/features/moderation/models/preprint-submission-json-api.model.ts @@ -1,4 +1,4 @@ -import { JsonApiResponseWithMeta, MetaJsonApi } from '@osf/shared/models'; +import { JsonApiResponseWithMeta, MetaJsonApi } from '@osf/shared/models/common/json-api.model'; export type PreprintSubmissionResponseJsonApi = JsonApiResponseWithMeta< PreprintSubmissionDataJsonApi[], diff --git a/src/app/features/moderation/models/preprint-submission.model.ts b/src/app/features/moderation/models/preprint-submission.model.ts index da61aae40..73862b019 100644 --- a/src/app/features/moderation/models/preprint-submission.model.ts +++ b/src/app/features/moderation/models/preprint-submission.model.ts @@ -1,4 +1,5 @@ -import { ContributorModel, PaginatedData } from '@osf/shared/models'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { ReviewAction } from './review-action.model'; diff --git a/src/app/features/moderation/models/preprint-withdrawal-submission-json-api.model.ts b/src/app/features/moderation/models/preprint-withdrawal-submission-json-api.model.ts index f874bc5b7..c68a0c336 100644 --- a/src/app/features/moderation/models/preprint-withdrawal-submission-json-api.model.ts +++ b/src/app/features/moderation/models/preprint-withdrawal-submission-json-api.model.ts @@ -1,4 +1,5 @@ -import { JsonApiResponseWithMeta, MetaJsonApi, UserDataErrorResponseJsonApi } from '@osf/shared/models'; +import { JsonApiResponseWithMeta, MetaJsonApi } from '@osf/shared/models/common/json-api.model'; +import { UserDataErrorResponseJsonApi } from '@osf/shared/models/user/user-json-api.model'; export type PreprintSubmissionWithdrawalResponseJsonApi = JsonApiResponseWithMeta< PreprintWithdrawalSubmissionDataJsonApi[], diff --git a/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts b/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts index 819ff6251..62a318617 100644 --- a/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts +++ b/src/app/features/moderation/models/preprint-withdrawal-submission.model.ts @@ -1,4 +1,5 @@ -import { ContributorModel, PaginatedData } from '@osf/shared/models'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { ReviewAction } from './review-action.model'; diff --git a/src/app/features/moderation/models/registry-json-api.model.ts b/src/app/features/moderation/models/registry-json-api.model.ts index ebd568026..e8dd6c41e 100644 --- a/src/app/features/moderation/models/registry-json-api.model.ts +++ b/src/app/features/moderation/models/registry-json-api.model.ts @@ -1,4 +1,5 @@ -import { RegistrationNodeAttributesJsonApi, ResponseJsonApi } from '@osf/shared/models'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { RegistrationNodeAttributesJsonApi } from '@osf/shared/models/registration/registration-node-json-api.model'; export type RegistryResponseJsonApi = ResponseJsonApi; diff --git a/src/app/features/moderation/models/registry-moderation.model.ts b/src/app/features/moderation/models/registry-moderation.model.ts index 1a5054ec0..cf2cc9662 100644 --- a/src/app/features/moderation/models/registry-moderation.model.ts +++ b/src/app/features/moderation/models/registry-moderation.model.ts @@ -1,4 +1,5 @@ -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; import { ReviewAction } from './review-action.model'; diff --git a/src/app/features/moderation/models/review-action-json-api.model.ts b/src/app/features/moderation/models/review-action-json-api.model.ts index 0b071dba1..a8d5be563 100644 --- a/src/app/features/moderation/models/review-action-json-api.model.ts +++ b/src/app/features/moderation/models/review-action-json-api.model.ts @@ -1,4 +1,5 @@ -import { JsonApiResponse, UserDataErrorResponseJsonApi } from '@osf/shared/models'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { UserDataErrorResponseJsonApi } from '@osf/shared/models/user/user-json-api.model'; export type ReviewActionsResponseJsonApi = JsonApiResponse; diff --git a/src/app/features/moderation/models/review-action.model.ts b/src/app/features/moderation/models/review-action.model.ts index e21a32c35..484c0be07 100644 --- a/src/app/features/moderation/models/review-action.model.ts +++ b/src/app/features/moderation/models/review-action.model.ts @@ -1,4 +1,4 @@ -import { IdName } from '@osf/shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; export interface ReviewAction { id: string; @@ -6,6 +6,6 @@ export interface ReviewAction { fromState: string; toState: string; dateModified: string; - creator: IdName | null; + creator: IdNameModel | null; comment: string; } diff --git a/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.spec.ts b/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.spec.ts index 9612028e0..7755fc5f6 100644 --- a/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.spec.ts +++ b/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.spec.ts @@ -5,8 +5,9 @@ import { BehaviorSubject } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { SelectComponent, SubHeaderComponent } from '@shared/components'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { CollectionModerationTab } from '../../enums'; diff --git a/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.ts b/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.ts index df433f843..6a7aca068 100644 --- a/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.ts +++ b/src/app/features/moderation/pages/collection-moderation/collection-moderation.component.ts @@ -10,8 +10,10 @@ import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterOutlet } from '@angular/router'; import { ClearCurrentProvider } from '@core/store/provider'; -import { SelectComponent, SubHeaderComponent } from '@osf/shared/components'; -import { IS_MEDIUM, Primitive } from '@osf/shared/helpers'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { GetCollectionProvider } from '@osf/shared/stores/collections'; import { COLLECTION_MODERATION_TABS } from '../../constants'; diff --git a/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.spec.ts b/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.spec.ts index f1f24ead4..cd84b78ef 100644 --- a/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.spec.ts +++ b/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.spec.ts @@ -6,7 +6,7 @@ import { MyReviewingNavigationComponent, PreprintRecentActivityListComponent, } from '@osf/features/moderation/components'; -import { SubHeaderComponent } from '@osf/shared/components'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { PreprintModerationSelectors } from '../../store/preprint-moderation'; diff --git a/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.ts b/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.ts index 73e2146c5..a80e3772d 100644 --- a/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.ts +++ b/src/app/features/moderation/pages/my-preprint-reviewing/my-preprint-reviewing.component.ts @@ -7,7 +7,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { SubHeaderComponent } from '@osf/shared/components'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { MyReviewingNavigationComponent, PreprintRecentActivityListComponent } from '../../components'; import { diff --git a/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.spec.ts b/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.spec.ts index bdc1f18f3..a190edfc6 100644 --- a/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.spec.ts +++ b/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.spec.ts @@ -5,8 +5,9 @@ import { BehaviorSubject } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { SelectComponent, SubHeaderComponent } from '@shared/components'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { PreprintModerationTab } from '../../enums'; diff --git a/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.ts b/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.ts index 90d1538d1..705fec6e5 100644 --- a/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.ts +++ b/src/app/features/moderation/pages/preprint-moderation/preprint-moderation.component.ts @@ -9,9 +9,11 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterOutlet } from '@angular/router'; -import { SelectComponent, SubHeaderComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { IS_MEDIUM, Primitive } from '@osf/shared/helpers'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { PREPRINT_MODERATION_TABS } from '../../constants'; import { PreprintModerationTab } from '../../enums'; diff --git a/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.spec.ts b/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.spec.ts index a64e44e18..32bca7f3c 100644 --- a/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.spec.ts +++ b/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.spec.ts @@ -5,8 +5,9 @@ import { BehaviorSubject } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { SelectComponent, SubHeaderComponent } from '@shared/components'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { RegistryModerationTab } from '../../enums'; diff --git a/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.ts b/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.ts index 4cf6b1805..0a111fc5f 100644 --- a/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.ts +++ b/src/app/features/moderation/pages/registries-moderation/registries-moderation.component.ts @@ -10,9 +10,11 @@ import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterOutlet } from '@angular/router'; import { ClearCurrentProvider } from '@core/store/provider'; -import { SelectComponent, SubHeaderComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { IS_MEDIUM, Primitive } from '@osf/shared/helpers'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { Primitive } from '@osf/shared/helpers/types.helper'; import { GetRegistryProvider } from '@osf/shared/stores/registration-provider'; import { REGISTRY_MODERATION_TABS } from '../../constants'; diff --git a/src/app/features/moderation/preprint-moderation.routes.ts b/src/app/features/moderation/preprint-moderation.routes.ts index 03d96c0c3..be607da8e 100644 --- a/src/app/features/moderation/preprint-moderation.routes.ts +++ b/src/app/features/moderation/preprint-moderation.routes.ts @@ -2,7 +2,7 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ModeratorsState } from './store/moderators'; import { PreprintModerationState } from './store/preprint-moderation'; diff --git a/src/app/features/moderation/registry-moderation.routes.ts b/src/app/features/moderation/registry-moderation.routes.ts index 953f3cb8b..7afada056 100644 --- a/src/app/features/moderation/registry-moderation.routes.ts +++ b/src/app/features/moderation/registry-moderation.routes.ts @@ -2,7 +2,7 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ModeratorsState } from './store/moderators'; import { RegistryModerationState } from './store/registry-moderation'; diff --git a/src/app/features/moderation/services/moderators.service.ts b/src/app/features/moderation/services/moderators.service.ts index 28978cbdb..7c32d8461 100644 --- a/src/app/features/moderation/services/moderators.service.ts +++ b/src/app/features/moderation/services/moderators.service.ts @@ -3,10 +3,12 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '@osf/shared/enums'; -import { JsonApiResponse, PaginatedData, ResponseJsonApi, UserDataJsonApi } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; -import { StringOrNull } from '@shared/helpers'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { JsonApiResponse, ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { UserDataJsonApi } from '@osf/shared/models/user/user-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { StringOrNull } from '@shared/helpers/types.helper'; import { AddModeratorType } from '../enums'; import { ModerationMapper } from '../mappers'; diff --git a/src/app/features/moderation/services/preprint-moderation.service.ts b/src/app/features/moderation/services/preprint-moderation.service.ts index 0696c5f2c..a41c9906f 100644 --- a/src/app/features/moderation/services/preprint-moderation.service.ts +++ b/src/app/features/moderation/services/preprint-moderation.service.ts @@ -3,8 +3,9 @@ import { catchError, forkJoin, map, Observable, of, switchMap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { PaginatedData, ResponseJsonApi } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { PreprintSubmissionsSort } from '../enums'; import { PreprintModerationMapper, RegistryModerationMapper } from '../mappers'; diff --git a/src/app/features/moderation/services/registry-moderation.service.ts b/src/app/features/moderation/services/registry-moderation.service.ts index b7f016d8f..657a86128 100644 --- a/src/app/features/moderation/services/registry-moderation.service.ts +++ b/src/app/features/moderation/services/registry-moderation.service.ts @@ -3,8 +3,8 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { PaginatedData } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { RegistrySort, SubmissionReviewStatus } from '../enums'; import { RegistryModerationMapper } from '../mappers'; diff --git a/src/app/features/moderation/store/collections-moderation/collections-moderation.actions.ts b/src/app/features/moderation/store/collections-moderation/collections-moderation.actions.ts index 23f75e8c2..dc44a8e29 100644 --- a/src/app/features/moderation/store/collections-moderation/collections-moderation.actions.ts +++ b/src/app/features/moderation/store/collections-moderation/collections-moderation.actions.ts @@ -1,4 +1,4 @@ -import { ReviewActionPayload } from '@osf/shared/models/review-action'; +import { ReviewActionPayload } from '@osf/shared/models/review-action/review-action-payload.model'; export class GetCollectionSubmissions { static readonly type = '[Collections Moderation] Get Collection Submissions'; diff --git a/src/app/features/moderation/store/collections-moderation/collections-moderation.model.ts b/src/app/features/moderation/store/collections-moderation/collections-moderation.model.ts index 86a84879e..b685d281e 100644 --- a/src/app/features/moderation/store/collections-moderation/collections-moderation.model.ts +++ b/src/app/features/moderation/store/collections-moderation/collections-moderation.model.ts @@ -1,5 +1,7 @@ import { CollectionSubmissionReviewAction } from '@osf/features/moderation/models'; -import { AsyncStateModel, AsyncStateWithTotalCount, CollectionSubmissionWithGuid } from '@shared/models'; +import { CollectionSubmissionWithGuid } from '@osf/shared/models/collections/collections.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface CollectionsModerationStateModel { collectionSubmissions: AsyncStateWithTotalCount; diff --git a/src/app/features/moderation/store/collections-moderation/collections-moderation.state.ts b/src/app/features/moderation/store/collections-moderation/collections-moderation.state.ts index 242b6610b..5e4d94010 100644 --- a/src/app/features/moderation/store/collections-moderation/collections-moderation.state.ts +++ b/src/app/features/moderation/store/collections-moderation/collections-moderation.state.ts @@ -5,8 +5,8 @@ import { catchError, forkJoin, map, of, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; -import { CollectionsService } from '@shared/services'; +import { CollectionsService } from '@osf/shared/services/collections.service'; +import { handleSectionError } from '@shared/helpers/state-error.handler'; import { ClearCollectionModeration, diff --git a/src/app/features/moderation/store/moderators/moderators.actions.ts b/src/app/features/moderation/store/moderators/moderators.actions.ts index 4700cc601..8a871265e 100644 --- a/src/app/features/moderation/store/moderators/moderators.actions.ts +++ b/src/app/features/moderation/store/moderators/moderators.actions.ts @@ -1,5 +1,5 @@ -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ModeratorAddModel, ModeratorModel } from '../../models'; diff --git a/src/app/features/moderation/store/moderators/moderators.model.ts b/src/app/features/moderation/store/moderators/moderators.model.ts index ad49ea441..0adc50668 100644 --- a/src/app/features/moderation/store/moderators/moderators.model.ts +++ b/src/app/features/moderation/store/moderators/moderators.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateWithTotalCount } from '@osf/shared/models'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { ModeratorAddModel, ModeratorModel } from '../../models'; diff --git a/src/app/features/moderation/store/moderators/moderators.state.ts b/src/app/features/moderation/store/moderators/moderators.state.ts index 51138ccfb..27d4aee17 100644 --- a/src/app/features/moderation/store/moderators/moderators.state.ts +++ b/src/app/features/moderation/store/moderators/moderators.state.ts @@ -4,8 +4,8 @@ import { catchError, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { PaginatedData } from '@osf/shared/models'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { ModeratorModel } from '../../models'; import { ModeratorsService } from '../../services'; diff --git a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.model.ts b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.model.ts index a846bc440..b6fc1be2d 100644 --- a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.model.ts +++ b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, AsyncStateWithTotalCount } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { PreprintProviderModerationInfo, PreprintReviewActionModel, PreprintWithdrawalSubmission } from '../../models'; import { PreprintSubmissionModel } from '../../models/preprint-submission.model'; diff --git a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts index 4c88d5cd8..df21b061d 100644 --- a/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts +++ b/src/app/features/moderation/store/preprint-moderation/preprint-moderation.state.ts @@ -6,10 +6,10 @@ import { catchError, forkJoin, map, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { SetCurrentProvider } from '@core/store/provider'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { CurrentResourceType, ResourceType } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; -import { ContributorsService } from '@osf/shared/services'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { CurrentResourceType, ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { ContributorsService } from '@osf/shared/services/contributors.service'; import { PreprintSubmissionModel, PreprintWithdrawalSubmission } from '../../models'; import { PreprintModerationService } from '../../services'; diff --git a/src/app/features/moderation/store/registry-moderation/registry-moderation.model.ts b/src/app/features/moderation/store/registry-moderation/registry-moderation.model.ts index 4e17fb03d..09a25a3e0 100644 --- a/src/app/features/moderation/store/registry-moderation/registry-moderation.model.ts +++ b/src/app/features/moderation/store/registry-moderation/registry-moderation.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateWithTotalCount } from '@osf/shared/models'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { RegistryModeration } from '../../models'; diff --git a/src/app/features/moderation/store/registry-moderation/registry-moderation.state.ts b/src/app/features/moderation/store/registry-moderation/registry-moderation.state.ts index 24bfcdc2b..a7ac4561b 100644 --- a/src/app/features/moderation/store/registry-moderation/registry-moderation.state.ts +++ b/src/app/features/moderation/store/registry-moderation/registry-moderation.state.ts @@ -5,8 +5,8 @@ import { catchError, forkJoin, map, of, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { PaginatedData } from '@osf/shared/models'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { RegistryModeration } from '../../models'; import { RegistryModerationService } from '../../services'; diff --git a/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.spec.ts b/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.spec.ts index f3743edb5..2f1152278 100644 --- a/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.spec.ts +++ b/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.spec.ts @@ -8,14 +8,14 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ProjectFormControls } from '@osf/shared/enums'; +import { AddProjectFormComponent } from '@osf/shared/components/add-project-form/add-project-form.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; import { CreateProject, GetMyProjects, MyResourcesSelectors } from '@osf/shared/stores/my-resources'; -import { AddProjectFormComponent } from '@shared/components'; import { CreateProjectDialogComponent } from './create-project-dialog.component'; -import { MOCK_STORE } from '@testing/mocks'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('CreateProjectDialogComponent', () => { diff --git a/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.ts b/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.ts index 90eacddad..95d8c0ca9 100644 --- a/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.ts +++ b/src/app/features/my-projects/components/create-project-dialog/create-project-dialog.component.ts @@ -8,12 +8,12 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; -import { AddProjectFormComponent } from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ProjectFormControls } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ProjectForm } from '@osf/shared/models'; +import { AddProjectFormComponent } from '@osf/shared/components/add-project-form/add-project-form.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { CreateProject, GetMyProjects, MyResourcesSelectors } from '@osf/shared/stores/my-resources'; +import { ProjectForm } from '@shared/models/projects/create-project-form.model'; @Component({ selector: 'osf-create-project-dialog', diff --git a/src/app/features/my-projects/constants/my-projects-tabs.const.ts b/src/app/features/my-projects/constants/my-projects-tabs.const.ts index 3b2534744..69be3e0e7 100644 --- a/src/app/features/my-projects/constants/my-projects-tabs.const.ts +++ b/src/app/features/my-projects/constants/my-projects-tabs.const.ts @@ -1,4 +1,4 @@ -import { TabOption } from '@osf/shared/models'; +import { TabOption } from '@osf/shared/models/tab-option.model'; import { MyProjectsTab } from '../enums'; diff --git a/src/app/features/my-projects/constants/project-filter-options.const.ts b/src/app/features/my-projects/constants/project-filter-options.const.ts index 8c3e2ea27..6b5aec3d7 100644 --- a/src/app/features/my-projects/constants/project-filter-options.const.ts +++ b/src/app/features/my-projects/constants/project-filter-options.const.ts @@ -1,5 +1,5 @@ -import { ResourceSearchMode } from '@osf/shared/enums'; -import { TabOption } from '@osf/shared/models'; +import { ResourceSearchMode } from '@osf/shared/enums/resource-search-mode.enum'; +import { TabOption } from '@shared/models/tab-option.model'; export const PROJECT_FILTER_OPTIONS: TabOption[] = [ { diff --git a/src/app/features/my-projects/mappers/my-resources.mapper.ts b/src/app/features/my-projects/mappers/my-resources.mapper.ts index d70c19be9..80be683b6 100644 --- a/src/app/features/my-projects/mappers/my-resources.mapper.ts +++ b/src/app/features/my-projects/mappers/my-resources.mapper.ts @@ -1,5 +1,8 @@ -import { ContributorsMapper } from '@osf/shared/mappers'; -import { MyResourcesItem, MyResourcesItemGetResponseJsonApi } from '@osf/shared/models'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; +import { + MyResourcesItem, + MyResourcesItemGetResponseJsonApi, +} from '@osf/shared/models/my-resources/my-resources.models'; export class MyResourcesMapper { static fromResponse(response: MyResourcesItemGetResponseJsonApi): MyResourcesItem { diff --git a/src/app/features/my-projects/my-projects.component.spec.ts b/src/app/features/my-projects/my-projects.component.spec.ts index a5868a1d5..d3d9da18f 100644 --- a/src/app/features/my-projects/my-projects.component.spec.ts +++ b/src/app/features/my-projects/my-projects.component.spec.ts @@ -6,17 +6,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { MyProjectsTab } from '@osf/features/my-projects/enums'; -import { SortOrder } from '@osf/shared/enums'; -import { IS_MEDIUM } from '@osf/shared/helpers'; +import { MyProjectsTableComponent } from '@osf/shared/components/my-projects-table/my-projects-table.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ProjectRedirectDialogService } from '@osf/shared/services/project-redirect-dialog.service'; import { BookmarksSelectors } from '@osf/shared/stores/bookmarks'; import { MyResourcesSelectors } from '@osf/shared/stores/my-resources'; -import { - MyProjectsTableComponent, - SearchInputComponent, - SelectComponent, - SubHeaderComponent, -} from '@shared/components'; -import { CustomDialogService, ProjectRedirectDialogService } from '@shared/services'; import { MyProjectsComponent } from './my-projects.component'; diff --git a/src/app/features/my-projects/my-projects.component.ts b/src/app/features/my-projects/my-projects.component.ts index 618c2df18..6e87c49cf 100644 --- a/src/app/features/my-projects/my-projects.component.ts +++ b/src/app/features/my-projects/my-projects.component.ts @@ -23,16 +23,16 @@ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { - MyProjectsTableComponent, - SearchInputComponent, - SelectComponent, - SubHeaderComponent, -} from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ResourceType, SortOrder } from '@osf/shared/enums'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { MyResourcesItem, MyResourcesSearchFilters, QueryParams, TableParameters } from '@osf/shared/models'; +import { MyProjectsTableComponent } from '@osf/shared/components/my-projects-table/my-projects-table.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ProjectRedirectDialogService } from '@osf/shared/services/project-redirect-dialog.service'; import { BookmarksSelectors, GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks'; import { ClearMyResources, @@ -42,7 +42,10 @@ import { GetMyRegistrations, MyResourcesSelectors, } from '@osf/shared/stores/my-resources'; -import { CustomDialogService, ProjectRedirectDialogService } from '@shared/services'; +import { MyResourcesItem } from '@shared/models/my-resources/my-resources.models'; +import { MyResourcesSearchFilters } from '@shared/models/my-resources/my-resources-search-filters.models'; +import { QueryParams } from '@shared/models/query-params.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { PROJECT_FILTER_OPTIONS } from './constants/project-filter-options.const'; import { MyProjectsQueryService } from './services/my-projects-query.service'; diff --git a/src/app/features/my-projects/services/my-projects-query.service.ts b/src/app/features/my-projects/services/my-projects-query.service.ts index 378408f3b..7905772a9 100644 --- a/src/app/features/my-projects/services/my-projects-query.service.ts +++ b/src/app/features/my-projects/services/my-projects-query.service.ts @@ -1,9 +1,9 @@ import { inject, Injectable } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { SortOrder } from '@osf/shared/enums'; -import { parseQueryFilterParams } from '@osf/shared/helpers'; -import { QueryParams } from '@osf/shared/models'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { parseQueryFilterParams } from '@osf/shared/helpers/http.helper'; +import { QueryParams } from '@shared/models/query-params.model'; import { MyProjectsTab } from '../enums'; diff --git a/src/app/features/my-projects/services/my-projects-table-params.service.ts b/src/app/features/my-projects/services/my-projects-table-params.service.ts index 8ee82183a..4740e9dbd 100644 --- a/src/app/features/my-projects/services/my-projects-table-params.service.ts +++ b/src/app/features/my-projects/services/my-projects-table-params.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { TableParameters } from '@osf/shared/models'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { TableParameters } from '@shared/models/table-parameters.model'; @Injectable({ providedIn: 'root' }) export class MyProjectsTableParamsService { diff --git a/src/app/features/preprints/components/advisory-board/advisory-board.component.ts b/src/app/features/preprints/components/advisory-board/advisory-board.component.ts index f390899ad..ec2485492 100644 --- a/src/app/features/preprints/components/advisory-board/advisory-board.component.ts +++ b/src/app/features/preprints/components/advisory-board/advisory-board.component.ts @@ -1,8 +1,8 @@ import { NgClass } from '@angular/common'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { StringOrNullOrUndefined } from '@osf/shared/helpers'; -import { Brand } from '@shared/models'; +import { StringOrNullOrUndefined } from '@osf/shared/helpers/types.helper'; +import { BrandModel } from '@osf/shared/models/brand/brand.model'; @Component({ selector: 'osf-advisory-board', @@ -13,6 +13,6 @@ import { Brand } from '@shared/models'; }) export class AdvisoryBoardComponent { htmlContent = input(null); - brand = input(); + brand = input(); isLandingPage = input(false); } diff --git a/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.spec.ts b/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.spec.ts index 4ff85fff5..8c71f8c0c 100644 --- a/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.spec.ts +++ b/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; -import { SubjectModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { SubjectModel } from '@shared/models/subject/subject.model'; import { BrowseBySubjectsComponent } from './browse-by-subjects.component'; diff --git a/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.ts b/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.ts index 332d58b2c..c701c73c4 100644 --- a/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.ts +++ b/src/app/features/preprints/components/browse-by-subjects/browse-by-subjects.component.ts @@ -6,8 +6,8 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { ResourceType } from '@shared/enums'; -import { SubjectModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { SubjectModel } from '@shared/models/subject/subject.model'; @Component({ selector: 'osf-browse-by-subjects', diff --git a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.spec.ts b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.spec.ts index d49611b63..c6c1824d8 100644 --- a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.spec.ts @@ -1,10 +1,11 @@ -import { MockComponent, MockPipe } from 'ng-mocks'; +import { MockComponents, MockPipe } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { InterpolatePipe } from '@osf/shared/pipes'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { InterpolatePipe } from '@osf/shared/pipes/interpolate.pipe'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; import { CitationSectionComponent } from '../citation-section/citation-section.component'; @@ -26,7 +27,7 @@ describe('AdditionalInfoComponent', () => { imports: [ AdditionalInfoComponent, OSFTestingModule, - MockComponent(CitationSectionComponent), + ...MockComponents(CitationSectionComponent, LicenseDisplayComponent), MockPipe(InterpolatePipe), ], providers: [ diff --git a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts index 894b8c32b..2076cd54a 100644 --- a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts +++ b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts @@ -11,8 +11,8 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject, input } f import { Router } from '@angular/router'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { LicenseDisplayComponent } from '@osf/shared/components'; -import { ResourceType } from '@shared/enums'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { ResourceType } from '@shared/enums/resource-type.enum'; import { FetchSelectedSubjects, SubjectsSelectors } from '@shared/stores/subjects'; import { CitationSectionComponent } from '../citation-section/citation-section.component'; diff --git a/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.spec.ts b/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.spec.ts index a6512b47c..340def6a0 100644 --- a/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CitationStyle } from '@shared/models'; -import { CitationsSelectors } from '@shared/stores/citations'; +import { CitationStyle } from '@osf/shared/models/citations/citation-style.model'; +import { CitationsSelectors } from '@osf/shared/stores/citations'; import { CitationSectionComponent } from './citation-section.component'; diff --git a/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.ts b/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.ts index 7e595f6ab..4435424fe 100644 --- a/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.ts +++ b/src/app/features/preprints/components/preprint-details/citation-section/citation-section.component.ts @@ -22,8 +22,9 @@ import { } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { ResourceType } from '@shared/enums'; -import { CitationStyle, CustomOption } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { CitationStyle } from '@shared/models/citations/citation-style.model'; +import { CustomOption } from '@shared/models/select-option.model'; import { CitationsSelectors, FetchDefaultProviderCitationStyles, diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.spec.ts b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.spec.ts index 9baa56810..327d980dc 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.spec.ts @@ -3,14 +3,11 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { - AffiliatedInstitutionsViewComponent, - ContributorsListComponent, - IconComponent, - TruncatedTextComponent, -} from '@shared/components'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; import { ContributorsSelectors } from '@shared/stores/contributors'; import { InstitutionsSelectors } from '@shared/stores/institutions'; @@ -18,7 +15,8 @@ import { PreprintDoiSectionComponent } from '../preprint-doi-section/preprint-do import { GeneralInformationComponent } from './general-information.component'; -import { MOCK_CONTRIBUTOR, MOCK_INSTITUTION } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { PREPRINT_PROVIDER_DETAILS_MOCK } from '@testing/mocks/preprint-provider-details'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -31,7 +29,7 @@ describe('GeneralInformationComponent', () => { const mockPreprint = PREPRINT_MOCK; const mockContributors = [MOCK_CONTRIBUTOR]; const mockInstitutions = [MOCK_INSTITUTION]; - const mockPreprintProvider: PreprintProviderDetails = PREPRINT_PROVIDER_DETAILS_MOCK; + const mockPreprintProvider = PREPRINT_PROVIDER_DETAILS_MOCK; const mockWebUrl = 'https://staging4.osf.io'; beforeEach(async () => { 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 4f9b1650f..cfe1039bd 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 @@ -12,13 +12,11 @@ import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { FetchPreprintById, PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { - AffiliatedInstitutionsViewComponent, - ContributorsListComponent, - IconComponent, - TruncatedTextComponent, -} from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ContributorsSelectors, GetBibliographicContributors, @@ -34,9 +32,9 @@ import { PreprintDoiSectionComponent } from '../preprint-doi-section/preprint-do imports: [ Card, TranslatePipe, - TruncatedTextComponent, Skeleton, FormsModule, + TruncatedTextComponent, PreprintDoiSectionComponent, IconComponent, AffiliatedInstitutionsViewComponent, diff --git a/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.spec.ts b/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.spec.ts index 7e6a3274a..b8413c5aa 100644 --- a/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.spec.ts @@ -7,14 +7,14 @@ import { ReviewAction } from '@osf/features/moderation/models'; import { ProviderReviewsWorkflow, ReviewsState } from '@osf/features/preprints/enums'; import { PreprintRequest } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { ModerationStatusBannerComponent } from './moderation-status-banner.component'; -import { MOCK_PROVIDER } from '@testing/mocks'; import { EnvironmentTokenMock } from '@testing/mocks/environment.token.mock'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { PREPRINT_REQUEST_MOCK } from '@testing/mocks/preprint-request.mock'; +import { MOCK_PROVIDER } from '@testing/mocks/provider.mock'; import { REVIEW_ACTION_MOCK } from '@testing/mocks/review-action.mock'; import { TranslationServiceMock } from '@testing/mocks/translation.service.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; diff --git a/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts b/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts index ad40fccc8..0440d25a5 100644 --- a/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts +++ b/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts @@ -20,7 +20,7 @@ import { ProviderReviewsWorkflow, ReviewsState } from '@osf/features/preprints/e import { getPreprintDocumentType } from '@osf/features/preprints/helpers'; import { PreprintProviderDetails, PreprintRequest } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; @Component({ selector: 'osf-moderation-status-banner', diff --git a/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.spec.ts b/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.spec.ts index 96f6145e7..e251447a3 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.spec.ts @@ -6,8 +6,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ProviderReviewsWorkflow } from '@osf/features/preprints/enums'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { IS_LARGE, IS_MEDIUM } from '@osf/shared/helpers'; -import { LoadingSpinnerComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { IS_LARGE, IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { PreprintFileSectionComponent } from './preprint-file-section.component'; 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 31f55482a..26f737ef9 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 @@ -13,8 +13,8 @@ import { DomSanitizer } from '@angular/platform-browser'; import { ProviderReviewsWorkflow } from '@osf/features/preprints/enums'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { LoadingSpinnerComponent } from '@osf/shared/components'; -import { IS_LARGE, IS_MEDIUM } from '@osf/shared/helpers'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { IS_LARGE, IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; @Component({ diff --git a/src/app/features/preprints/components/preprint-details/preprint-make-decision/preprint-make-decision.component.ts b/src/app/features/preprints/components/preprint-details/preprint-make-decision/preprint-make-decision.component.ts index 3b1858e5d..65ffaa1f9 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-make-decision/preprint-make-decision.component.ts +++ b/src/app/features/preprints/components/preprint-details/preprint-make-decision/preprint-make-decision.component.ts @@ -23,8 +23,8 @@ import { SubmitRequestsDecision, SubmitReviewsDecision, } from '@osf/features/preprints/store/preprint'; -import { InputLimits } from '@osf/shared/constants'; -import { StringOrNull } from '@osf/shared/helpers'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; @Component({ selector: 'osf-preprint-make-decision', diff --git a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.spec.ts b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.spec.ts index 8b8a19bd3..336cfc9b5 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.spec.ts @@ -2,10 +2,11 @@ import { MockComponents, MockPipes } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { ContributorsListComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { InterpolatePipe } from '@osf/shared/pipes'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { InterpolatePipe } from '@osf/shared/pipes/interpolate.pipe'; import { ContributorsSelectors } from '@osf/shared/stores/contributors'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; @@ -13,7 +14,7 @@ import { PreprintDoiSectionComponent } from '../preprint-doi-section/preprint-do import { PreprintTombstoneComponent } from './preprint-tombstone.component'; -import { MOCK_CONTRIBUTOR } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { PREPRINT_PROVIDER_DETAILS_MOCK } from '@testing/mocks/preprint-provider-details'; import { SUBJECTS_MOCK } from '@testing/mocks/subject.mock'; @@ -26,7 +27,7 @@ describe('PreprintTombstoneComponent', () => { let fixture: ComponentFixture; const mockPreprint = PREPRINT_MOCK; - const mockProvider: PreprintProviderDetails = PREPRINT_PROVIDER_DETAILS_MOCK; + const mockProvider = PREPRINT_PROVIDER_DETAILS_MOCK; const mockContributors = [MOCK_CONTRIBUTOR]; const mockSubjects = SUBJECTS_MOCK; @@ -35,7 +36,12 @@ describe('PreprintTombstoneComponent', () => { imports: [ PreprintTombstoneComponent, OSFTestingModule, - ...MockComponents(PreprintDoiSectionComponent, TruncatedTextComponent, ContributorsListComponent), + ...MockComponents( + PreprintDoiSectionComponent, + TruncatedTextComponent, + ContributorsListComponent, + LicenseDisplayComponent + ), MockPipes(InterpolatePipe), ], providers: [ diff --git a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts index 34f587648..341290d97 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts +++ b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts @@ -13,8 +13,10 @@ import { Router } from '@angular/router'; import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { FetchPreprintById, PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { ContributorsListComponent, LicenseDisplayComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ContributorsSelectors, GetBibliographicContributors, diff --git a/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.spec.ts b/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.spec.ts index 0e11fe9c3..544da7073 100644 --- a/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.spec.ts @@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { SocialsShareButtonComponent } from '@osf/shared/components'; +import { SocialsShareButtonComponent } from '@osf/shared/components/socials-share-button/socials-share-button.component'; import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; import { ShareAndDownloadComponent } from './share-and-download.component'; diff --git a/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.ts b/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.ts index 5d4cd6374..b0fae3b09 100644 --- a/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.ts +++ b/src/app/features/preprints/components/preprint-details/share-and-download/share-and-download.component.ts @@ -10,10 +10,10 @@ import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { SocialsShareButtonComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { SocialShareService } from '@osf/shared/services'; +import { SocialsShareButtonComponent } from '@osf/shared/components/socials-share-button/socials-share-button.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; +import { SocialShareService } from '@osf/shared/services/social-share.service'; @Component({ selector: 'osf-preprint-share-and-download', diff --git a/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.spec.ts b/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.spec.ts index 449cd76e7..f366c3ad4 100644 --- a/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.spec.ts +++ b/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.spec.ts @@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReviewAction } from '@osf/features/moderation/models'; import { PreprintModel, PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { StatusBannerComponent } from './status-banner.component'; diff --git a/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.ts b/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.ts index 693a527ab..1d9856b88 100644 --- a/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.ts +++ b/src/app/features/preprints/components/preprint-details/status-banner/status-banner.component.ts @@ -22,7 +22,7 @@ import { import { ProviderReviewsWorkflow, ReviewsState } from '@osf/features/preprints/enums'; import { PreprintProviderDetails, PreprintRequestAction } from '@osf/features/preprints/models'; import { PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { IconComponent } from '@osf/shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; @Component({ selector: 'osf-preprint-status-banner', diff --git a/src/app/features/preprints/components/preprint-details/withdraw-dialog/withdraw-dialog.component.ts b/src/app/features/preprints/components/preprint-details/withdraw-dialog/withdraw-dialog.component.ts index 53a683cb4..1ade9c91a 100644 --- a/src/app/features/preprints/components/preprint-details/withdraw-dialog/withdraw-dialog.component.ts +++ b/src/app/features/preprints/components/preprint-details/withdraw-dialog/withdraw-dialog.component.ts @@ -17,8 +17,8 @@ import { ProviderReviewsWorkflow, ReviewsState } from '@osf/features/preprints/e import { getPreprintDocumentType } from '@osf/features/preprints/helpers'; import { PreprintModel, PreprintProviderDetails, PreprintWordGrammar } from '@osf/features/preprints/models'; import { WithdrawPreprint } from '@osf/features/preprints/store/preprint'; -import { CustomValidators } from '@osf/shared/helpers'; -import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; @Component({ selector: 'osf-withdraw-dialog', diff --git a/src/app/features/preprints/components/preprint-provider-footer/preprint-provider-footer.component.ts b/src/app/features/preprints/components/preprint-provider-footer/preprint-provider-footer.component.ts index 9af3a5538..851b83ff4 100644 --- a/src/app/features/preprints/components/preprint-provider-footer/preprint-provider-footer.component.ts +++ b/src/app/features/preprints/components/preprint-provider-footer/preprint-provider-footer.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { StringOrNullOrUndefined } from '@osf/shared/helpers'; +import { StringOrNullOrUndefined } from '@osf/shared/helpers/types.helper'; @Component({ selector: 'osf-preprint-provider-footer', diff --git a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.spec.ts b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.spec.ts index 74535c99f..dbb62042e 100644 --- a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.spec.ts +++ b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DialogService } from 'primeng/dynamicdialog'; @@ -7,6 +7,7 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; import { PreprintProviderHeroComponent } from './preprint-provider-hero.component'; @@ -27,7 +28,7 @@ describe('PreprintProviderHeroComponent', () => { mockDialogService = DialogServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [PreprintProviderHeroComponent, OSFTestingModule], + imports: [PreprintProviderHeroComponent, OSFTestingModule, MockComponent(SearchInputComponent)], providers: [ MockProvider(DialogService, mockDialogService), MockProvider(ActivatedRoute, ActivatedRouteMockBuilder.create().build()), diff --git a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts index b5dbab66f..d875330c5 100644 --- a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts +++ b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts @@ -9,10 +9,10 @@ import { FormControl } from '@angular/forms'; import { RouterLink } from '@angular/router'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { CustomDialogService } from '@osf/shared/services'; -import { SearchInputComponent } from '@shared/components'; -import { normalizeQuotes } from '@shared/helpers'; -import { DecodeHtmlPipe } from '@shared/pipes'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { normalizeQuotes } from '@shared/helpers/normalize-quotes'; +import { DecodeHtmlPipe } from '@shared/pipes/decode-html.pipe'; import { PreprintsHelpDialogComponent } from '../preprints-help-dialog/preprints-help-dialog.component'; diff --git a/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.spec.ts b/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.spec.ts index 73598cb90..6af60f53a 100644 --- a/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.spec.ts +++ b/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.spec.ts @@ -3,7 +3,7 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormArray, FormControl, Validators } from '@angular/forms'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { ArrayInputComponent } from './array-input.component'; diff --git a/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.ts b/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.ts index 327841ee1..4e32dd133 100644 --- a/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.ts +++ b/src/app/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component.ts @@ -5,7 +5,7 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { FormArray, FormControl, ReactiveFormsModule, ValidatorFn } from '@angular/forms'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; @Component({ selector: 'osf-array-input', diff --git a/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.spec.ts b/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.spec.ts index 64abf505c..bba0d23d6 100644 --- a/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.spec.ts +++ b/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.spec.ts @@ -2,13 +2,14 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ArrayInputComponent } from '@osf/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component'; import { ApplicabilityStatus } from '@osf/features/preprints/enums'; import { PreprintModel } from '@osf/features/preprints/models'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { FormSelectComponent } from '@shared/components'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ArrayInputComponent } from './array-input/array-input.component'; import { AuthorAssertionsStepComponent } from './author-assertions-step.component'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; diff --git a/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts b/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts index 5a16cbd9e..97ca4a946 100644 --- a/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts +++ b/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts @@ -23,16 +23,19 @@ import { Validators, } from '@angular/forms'; -import { ArrayInputComponent } from '@osf/features/preprints/components/stepper/author-assertion-step/array-input/array-input.component'; import { formInputLimits, preregLinksOptions } from '@osf/features/preprints/constants'; import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums'; import { PreprintModel } from '@osf/features/preprints/models'; import { PreprintStepperSelectors, UpdatePreprint } from '@osf/features/preprints/store/preprint-stepper'; -import { CustomValidators, findChangedFields } from '@osf/shared/helpers'; -import { FormSelectComponent } from '@shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; -import { StringOrNull } from '@shared/helpers'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; + +import { ArrayInputComponent } from './array-input/array-input.component'; @Component({ selector: 'osf-author-assertions-step', diff --git a/src/app/features/preprints/components/stepper/file-step/file-step.component.spec.ts b/src/app/features/preprints/components/stepper/file-step/file-step.component.spec.ts index 0163a1125..1471c9a39 100644 --- a/src/app/features/preprints/components/stepper/file-step/file-step.component.spec.ts +++ b/src/app/features/preprints/components/stepper/file-step/file-step.component.spec.ts @@ -5,9 +5,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PreprintFileSource } from '@osf/features/preprints/enums'; import { PreprintModel, PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { FilesTreeComponent, IconComponent } from '@shared/components'; -import { FileFolderModel } from '@shared/models'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; import { FileStepComponent } from './file-step.component'; @@ -40,7 +42,7 @@ describe('FileStepComponent', () => { confirmationServiceMock = CustomConfirmationServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [FileStepComponent, MockComponents(IconComponent, FilesTreeComponent), OSFTestingModule], + imports: [FileStepComponent, ...MockComponents(IconComponent, FilesTreeComponent), OSFTestingModule], providers: [ MockProvider(ToastService, toastServiceMock), MockProvider(CustomConfirmationService, confirmationServiceMock), 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 4048db784..ed7803353 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 @@ -40,10 +40,13 @@ import { SetSelectedPreprintFileSource, UploadFile, } from '@osf/features/preprints/store/preprint-stepper'; -import { FileFolderModel, FileModel } from '@osf/shared/models'; -import { FilesTreeComponent, IconComponent } from '@shared/components'; -import { StringOrNull } from '@shared/helpers'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; @Component({ selector: 'osf-file-step', diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.spec.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.spec.ts index 080673ea0..8bb817170 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.spec.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.spec.ts @@ -5,13 +5,13 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReviewsState } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { AffiliatedInstitutionSelectComponent } from '@shared/components'; -import { Institution } from '@shared/models'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; +import { Institution } from '@shared/models/institutions/institutions.models'; import { InstitutionsSelectors } from '@shared/stores/institutions'; import { PreprintsAffiliatedInstitutionsComponent } from './preprints-affiliated-institutions.component'; -import { MOCK_INSTITUTION } from '@testing/mocks'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; import { PREPRINT_PROVIDER_DETAILS_MOCK } from '@testing/mocks/preprint-provider-details'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts index 06bab1f5b..f1a315ce1 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-affiliated-institutions/preprints-affiliated-institutions.component.ts @@ -9,9 +9,9 @@ import { ChangeDetectionStrategy, Component, effect, input, OnInit, signal } fro import { ReviewsState } from '@osf/features/preprints/enums'; import { PreprintModel, PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintStepperSelectors, SetInstitutionsChanged } from '@osf/features/preprints/store/preprint-stepper'; -import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { Institution } from '@osf/shared/models'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; import { FetchResourceInstitutions, FetchUserInstitutions, diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.spec.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.spec.ts index 68481f6c6..6da10dfb3 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.spec.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.spec.ts @@ -4,13 +4,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserSelectors } from '@core/store/user'; import { ContributorsTableComponent } from '@osf/shared/components/contributors'; -import { ContributorModel } from '@shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; import { ContributorsSelectors } from '@shared/stores/contributors'; import { PreprintsContributorsComponent } from './preprints-contributors.component'; -import { MOCK_CONTRIBUTOR, MOCK_USER } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomConfirmationServiceMockBuilder } from '@testing/providers/custom-confirmation-provider.mock'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.ts index d11782ce5..e54f8787d 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-contributors/preprints-contributors.component.ts @@ -22,18 +22,19 @@ import { } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; -import { Router } from '@angular/router'; import { AddContributorDialogComponent, AddUnregisteredContributorDialogComponent, ContributorsTableComponent, } from '@osf/shared/components/contributors'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { AddContributorType, ResourceType } from '@osf/shared/enums'; -import { findChangedItems } from '@osf/shared/helpers'; -import { ContributorDialogAddModel, ContributorModel, TableParameters } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { findChangedItems } from '@osf/shared/helpers/find-changed-items.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddContributor, BulkAddContributors, @@ -43,6 +44,9 @@ import { GetAllContributors, LoadMoreContributors, } from '@osf/shared/stores/contributors'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; @Component({ selector: 'osf-preprints-contributors', @@ -58,7 +62,6 @@ export class PreprintsContributorsComponent implements OnInit { readonly customDialogService = inject(CustomDialogService); readonly toastService = inject(ToastService); readonly customConfirmationService = inject(CustomConfirmationService); - private readonly router = inject(Router); initialContributors = select(ContributorsSelectors.getContributors); contributors = signal([]); diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.spec.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.spec.ts index 6d0f6f529..ee60f9c14 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.spec.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.spec.ts @@ -7,17 +7,19 @@ import { provideNoopAnimations } from '@angular/platform-browser/animations'; import { formInputLimits } from '@osf/features/preprints/constants'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { IconComponent, LicenseComponent, TextInputComponent } from '@shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; -import { LicenseModel } from '@shared/models'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LicenseComponent } from '@osf/shared/components/license/license.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { PreprintsAffiliatedInstitutionsComponent } from './preprints-affiliated-institutions/preprints-affiliated-institutions.component'; import { PreprintsContributorsComponent } from './preprints-contributors/preprints-contributors.component'; import { PreprintsSubjectsComponent } from './preprints-subjects/preprints-subjects.component'; import { PreprintsMetadataStepComponent } from './preprints-metadata-step.component'; -import { MOCK_LICENSE } from '@testing/mocks'; +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { PREPRINT_PROVIDER_DETAILS_MOCK } from '@testing/mocks/preprint-provider-details'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -33,7 +35,7 @@ describe('PreprintsMetadataStepComponent', () => { const mockProvider: PreprintProviderDetails = PREPRINT_PROVIDER_DETAILS_MOCK; const mockPreprint = PREPRINT_MOCK; - const mockLicenses: LicenseModel[] = [MOCK_LICENSE]; + const mockLicenses = [MOCK_LICENSE]; beforeEach(async () => { toastServiceMock = ToastServiceMockBuilder.create().withShowSuccess(jest.fn()).build(); @@ -47,11 +49,11 @@ describe('PreprintsMetadataStepComponent', () => { OSFTestingModule, ...MockComponents( PreprintsContributorsComponent, - PreprintsAffiliatedInstitutionsComponent, - PreprintsSubjectsComponent, IconComponent, + TextInputComponent, LicenseComponent, - TextInputComponent + PreprintsSubjectsComponent, + PreprintsAffiliatedInstitutionsComponent ), ], providers: [ diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.ts index b9ce03bba..716bcdfa9 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-metadata-step.component.ts @@ -21,11 +21,16 @@ import { SaveLicense, UpdatePreprint, } from '@osf/features/preprints/store/preprint-stepper'; -import { IconComponent, LicenseComponent, TagsInputComponent, TextInputComponent } from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { CustomValidators, findChangedFields } from '@osf/shared/helpers'; -import { LicenseModel, LicenseOptions } from '@osf/shared/models'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LicenseComponent } from '@osf/shared/components/license/license.component'; +import { TagsInputComponent } from '@osf/shared/components/tags-input/tags-input.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; import { PreprintsAffiliatedInstitutionsComponent } from './preprints-affiliated-institutions/preprints-affiliated-institutions.component'; import { PreprintsContributorsComponent } from './preprints-contributors/preprints-contributors.component'; diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.spec.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.spec.ts index 42e91469b..1c9a4abe3 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.spec.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.spec.ts @@ -4,8 +4,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { SubjectsComponent } from '@osf/shared/components'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectsComponent } from '@osf/shared/components/subjects/subjects.component'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; import { PreprintsSubjectsComponent } from './preprints-subjects.component'; diff --git a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.ts b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.ts index 8551451f4..0d18ceb5c 100644 --- a/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.ts +++ b/src/app/features/preprints/components/stepper/preprints-metadata-step/preprints-subjects/preprints-subjects.component.ts @@ -9,10 +9,9 @@ import { ChangeDetectionStrategy, Component, effect, input, OnInit } from '@angu import { FormControl } from '@angular/forms'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { SubjectsComponent } from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectsComponent } from '@osf/shared/components/subjects/subjects.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FetchChildrenSubjects, FetchSelectedSubjects, @@ -20,6 +19,7 @@ import { SubjectsSelectors, UpdateResourceSubjects, } from '@osf/shared/stores/subjects'; +import { SubjectModel } from '@shared/models/subject/subject.model'; @Component({ selector: 'osf-preprints-subjects', diff --git a/src/app/features/preprints/components/stepper/review-step/review-step.component.spec.ts b/src/app/features/preprints/components/stepper/review-step/review-step.component.spec.ts index 455f94667..3187a6bdb 100644 --- a/src/app/features/preprints/components/stepper/review-step/review-step.component.spec.ts +++ b/src/app/features/preprints/components/stepper/review-step/review-step.component.spec.ts @@ -1,20 +1,24 @@ -import { MockPipe } from 'ng-mocks'; +import { MockComponents, MockPipe } from 'ng-mocks'; -import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { InterpolatePipe } from '@shared/pipes'; -import { ToastService } from '@shared/services'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { InterpolatePipe } from '@shared/pipes/interpolate.pipe'; import { ContributorsSelectors } from '@shared/stores/contributors'; import { InstitutionsSelectors } from '@shared/stores/institutions'; import { SubjectsSelectors } from '@shared/stores/subjects'; import { ReviewStepComponent } from './review-step.component'; -import { MOCK_CONTRIBUTOR, MOCK_INSTITUTION, MOCK_LICENSE } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; import { OSF_FILE_MOCK } from '@testing/mocks/osf-file.mock'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { PREPRINT_PROVIDER_DETAILS_MOCK } from '@testing/mocks/preprint-provider-details'; @@ -43,7 +47,12 @@ describe('ReviewStepComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ReviewStepComponent, OSFTestingModule, MockPipe(InterpolatePipe)], + imports: [ + ReviewStepComponent, + OSFTestingModule, + ...MockComponents(AffiliatedInstitutionsViewComponent, ContributorsListComponent, LicenseDisplayComponent), + MockPipe(InterpolatePipe), + ], providers: [ { provide: Router, useValue: RouterMock.create().build() }, { provide: ToastService, useValue: ToastServiceMock.simple() }, @@ -62,7 +71,6 @@ describe('ReviewStepComponent', () => { ], }), ], - schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); fixture = TestBed.createComponent(ReviewStepComponent); diff --git a/src/app/features/preprints/components/stepper/review-step/review-step.component.ts b/src/app/features/preprints/components/stepper/review-step/review-step.component.ts index 3a5d77919..5e898818c 100644 --- a/src/app/features/preprints/components/stepper/review-step/review-step.component.ts +++ b/src/app/features/preprints/components/stepper/review-step/review-step.component.ts @@ -22,14 +22,12 @@ import { UpdatePreprint, UpdatePrimaryFileRelationship, } from '@osf/features/preprints/store/preprint-stepper'; -import { - AffiliatedInstitutionsViewComponent, - ContributorsListComponent, - LicenseDisplayComponent, - TruncatedTextComponent, -} from '@shared/components'; -import { ResourceType } from '@shared/enums'; -import { ToastService } from '@shared/services'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ResourceType } from '@shared/enums/resource-type.enum'; import { ContributorsSelectors, GetBibliographicContributors, diff --git a/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.spec.ts b/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.spec.ts index 5ffe7cca5..8f7123c13 100644 --- a/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.spec.ts +++ b/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.spec.ts @@ -5,12 +5,12 @@ import { ConfirmationService } from 'primeng/api'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { AddProjectFormComponent } from '@shared/components'; -import { ToastService } from '@shared/services'; +import { AddProjectFormComponent } from '@osf/shared/components/add-project-form/add-project-form.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { SupplementsStepComponent } from './supplements-step.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; import { ToastServiceMock } from '@testing/providers/toast-provider.mock'; diff --git a/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts b/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts index 46e94e77e..4e36e1a14 100644 --- a/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts +++ b/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts @@ -34,12 +34,13 @@ import { FetchPreprintProject, PreprintStepperSelectors, } from '@osf/features/preprints/store/preprint-stepper'; -import { CustomValidators } from '@osf/shared/helpers'; -import { AddProjectFormComponent } from '@shared/components'; -import { ProjectFormControls } from '@shared/enums'; -import { StringOrNull } from '@shared/helpers'; -import { ProjectForm } from '@shared/models'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { AddProjectFormComponent } from '@osf/shared/components/add-project-form/add-project-form.component'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ProjectForm } from '@shared/models/projects/create-project-form.model'; @Component({ selector: 'osf-supplements-step', diff --git a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.spec.ts b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.spec.ts index a5645f971..a972d6439 100644 --- a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.spec.ts +++ b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.spec.ts @@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TitleAndAbstractStepComponent } from '@osf/features/preprints/components'; import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; diff --git a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts index 86bd75dc3..cadca4dc6 100644 --- a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts +++ b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts @@ -19,10 +19,10 @@ import { PreprintStepperSelectors, UpdatePreprint, } from '@osf/features/preprints/store/preprint-stepper'; -import { CustomValidators } from '@osf/shared/helpers'; -import { TextInputComponent } from '@shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; -import { ToastService } from '@shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; @Component({ selector: 'osf-title-and-abstract-step', diff --git a/src/app/features/preprints/constants/create-new-version-steps.const.ts b/src/app/features/preprints/constants/create-new-version-steps.const.ts index 2314ce425..a87a486f2 100644 --- a/src/app/features/preprints/constants/create-new-version-steps.const.ts +++ b/src/app/features/preprints/constants/create-new-version-steps.const.ts @@ -1,4 +1,4 @@ -import { StepOption } from '@osf/shared/models'; +import { StepOption } from '@osf/shared/models/step-option.model'; import { PreprintSteps } from '../enums'; diff --git a/src/app/features/preprints/constants/prereg-link-options.const.ts b/src/app/features/preprints/constants/prereg-link-options.const.ts index 0c6cb4f07..61fb2afff 100644 --- a/src/app/features/preprints/constants/prereg-link-options.const.ts +++ b/src/app/features/preprints/constants/prereg-link-options.const.ts @@ -1,4 +1,4 @@ -import { SelectOption } from '@osf/shared/models'; +import { SelectOption } from '@osf/shared/models/select-option.model'; import { PreregLinkInfo } from '../enums'; diff --git a/src/app/features/preprints/constants/submit-preprint-steps.const.ts b/src/app/features/preprints/constants/submit-preprint-steps.const.ts index 978cc991e..770243b42 100644 --- a/src/app/features/preprints/constants/submit-preprint-steps.const.ts +++ b/src/app/features/preprints/constants/submit-preprint-steps.const.ts @@ -1,4 +1,4 @@ -import { StepOption } from '@osf/shared/models'; +import { StepOption } from '@osf/shared/models/step-option.model'; import { PreprintSteps } from '../enums'; diff --git a/src/app/features/preprints/mappers/preprint-providers.mapper.ts b/src/app/features/preprints/mappers/preprint-providers.mapper.ts index a7f43a4e9..92feb4ba8 100644 --- a/src/app/features/preprints/mappers/preprint-providers.mapper.ts +++ b/src/app/features/preprints/mappers/preprint-providers.mapper.ts @@ -1,9 +1,9 @@ -import { - PreprintProviderDetails, - PreprintProviderDetailsJsonApi, - PreprintProviderShortInfo, -} from '@osf/features/preprints/models'; -import { Brand, BrandDataJsonApi, SubjectDataJsonApi, SubjectModel } from '@shared/models'; +import { BrandDataJsonApi } from '@osf/shared/models/brand/brand.json-api.model'; +import { BrandModel } from '@osf/shared/models/brand/brand.model'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; +import { SubjectDataJsonApi } from '@osf/shared/models/subject/subjects-json-api.model'; + +import { PreprintProviderDetails, PreprintProviderDetailsJsonApi, PreprintProviderShortInfo } from '../models'; export class PreprintProvidersMapper { static fromPreprintProviderDetailsGetResponse(response: PreprintProviderDetailsJsonApi): PreprintProviderDetails { @@ -31,12 +31,12 @@ export class PreprintProvidersMapper { }; } - static parseBrand(brandRaw: BrandDataJsonApi): Brand { + static parseBrand(brandRaw: BrandDataJsonApi): BrandModel { if (!brandRaw) { return { primaryColor: 'var(--osf-provider-primary-color)', secondaryColor: 'var(--osf-provider-secondary-color)', - } as Brand; + } as BrandModel; } return { diff --git a/src/app/features/preprints/mappers/preprint-request-actions.mapper.ts b/src/app/features/preprints/mappers/preprint-request-actions.mapper.ts index 41498bbe9..9166acfd5 100644 --- a/src/app/features/preprints/mappers/preprint-request-actions.mapper.ts +++ b/src/app/features/preprints/mappers/preprint-request-actions.mapper.ts @@ -1,6 +1,7 @@ -import { PreprintRequestAction, PreprintRequestActionDataJsonApi } from '@osf/features/preprints/models'; -import { UserMapper } from '@osf/shared/mappers'; -import { StringOrNull } from '@shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { UserMapper } from '@osf/shared/mappers/user'; + +import { PreprintRequestAction, PreprintRequestActionDataJsonApi } from '../models'; export class PreprintRequestActionsMapper { static fromPreprintRequestActions(data: PreprintRequestActionDataJsonApi): PreprintRequestAction { diff --git a/src/app/features/preprints/mappers/preprint-request.mapper.ts b/src/app/features/preprints/mappers/preprint-request.mapper.ts index 46e4e4f4b..f0396816d 100644 --- a/src/app/features/preprints/mappers/preprint-request.mapper.ts +++ b/src/app/features/preprints/mappers/preprint-request.mapper.ts @@ -1,6 +1,7 @@ -import { PreprintRequestType } from '@osf/features/preprints/enums'; -import { PreprintRequest, PreprintRequestDataJsonApi } from '@osf/features/preprints/models'; -import { UserMapper } from '@osf/shared/mappers'; +import { UserMapper } from '@osf/shared/mappers/user'; + +import { PreprintRequestType } from '../enums'; +import { PreprintRequest, PreprintRequestDataJsonApi } from '../models'; export class PreprintRequestMapper { static toWithdrawPreprintPayload(preprintId: string, justification: string) { diff --git a/src/app/features/preprints/mappers/preprints.mapper.ts b/src/app/features/preprints/mappers/preprints.mapper.ts index 0c7c4dfdf..6bd45b4b9 100644 --- a/src/app/features/preprints/mappers/preprints.mapper.ts +++ b/src/app/features/preprints/mappers/preprints.mapper.ts @@ -1,6 +1,7 @@ -import { IdentifiersMapper, LicensesMapper } from '@osf/shared/mappers'; -import { ApiData, JsonApiResponseWithMeta, ResponseJsonApi } from '@osf/shared/models'; -import { StringOrNull } from '@shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { IdentifiersMapper } from '@osf/shared/mappers/identifiers.mapper'; +import { LicensesMapper } from '@osf/shared/mappers/licenses.mapper'; +import { ApiData, JsonApiResponseWithMeta, ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; import { PreprintAttributesJsonApi, diff --git a/src/app/features/preprints/models/preprint-json-api.models.ts b/src/app/features/preprints/models/preprint-json-api.models.ts index 8dcc27bff..9761ef0fa 100644 --- a/src/app/features/preprints/models/preprint-json-api.models.ts +++ b/src/app/features/preprints/models/preprint-json-api.models.ts @@ -1,11 +1,8 @@ -import { UserPermissions } from '@osf/shared/enums'; -import { BooleanOrNull, StringOrNull } from '@osf/shared/helpers'; -import { - ContributorDataJsonApi, - IdentifiersResponseJsonApi, - LicenseRecordJsonApi, - LicenseResponseJsonApi, -} from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { BooleanOrNull, StringOrNull } from '@osf/shared/helpers/types.helper'; +import { ContributorDataJsonApi } from '@shared/models/contributors/contributor-response-json-api.model'; +import { IdentifiersResponseJsonApi } from '@shared/models/identifiers/identifier-json-api.model'; +import { LicenseRecordJsonApi, LicenseResponseJsonApi } from '@shared/models/license/licenses-json-api.model'; import { ApplicabilityStatus, PreregLinkInfo, ReviewsState } from '../enums'; diff --git a/src/app/features/preprints/models/preprint-licenses-json-api.models.ts b/src/app/features/preprints/models/preprint-licenses-json-api.models.ts index 5d5efeea2..b1b1ba6f8 100644 --- a/src/app/features/preprints/models/preprint-licenses-json-api.models.ts +++ b/src/app/features/preprints/models/preprint-licenses-json-api.models.ts @@ -1,4 +1,4 @@ -import { LicenseRecordJsonApi } from '@shared/models'; +import { LicenseRecordJsonApi } from '@osf/shared/models/license/licenses-json-api.model'; export interface PreprintLicenseRelationshipJsonApi { id: string; diff --git a/src/app/features/preprints/models/preprint-provider-json-api.models.ts b/src/app/features/preprints/models/preprint-provider-json-api.models.ts index c75f31f62..0dffb8a70 100644 --- a/src/app/features/preprints/models/preprint-provider-json-api.models.ts +++ b/src/app/features/preprints/models/preprint-provider-json-api.models.ts @@ -1,6 +1,6 @@ -import { ReviewPermissions } from '@osf/shared/enums'; -import { StringOrNull } from '@osf/shared/helpers'; -import { BrandDataJsonApi } from '@osf/shared/models'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { BrandDataJsonApi } from '@osf/shared/models/brand/brand.json-api.model'; import { ProviderReviewsWorkflow } from '../enums'; diff --git a/src/app/features/preprints/models/preprint-provider.models.ts b/src/app/features/preprints/models/preprint-provider.models.ts index bc60444a9..362917430 100644 --- a/src/app/features/preprints/models/preprint-provider.models.ts +++ b/src/app/features/preprints/models/preprint-provider.models.ts @@ -1,6 +1,6 @@ -import { ReviewPermissions } from '@shared/enums/review-permissions.enum'; -import { StringOrNull } from '@shared/helpers'; -import { Brand } from '@shared/models'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { BrandModel } from '@osf/shared/models/brand/brand.model'; import { ProviderReviewsWorkflow } from '../enums'; @@ -20,7 +20,7 @@ export interface PreprintProviderDetails { assertionsEnabled: boolean; reviewsWorkflow: ProviderReviewsWorkflow | null; permissions: ReviewPermissions[]; - brand: Brand; + brand: BrandModel; lastFetched?: number; iri: string; faviconUrl: string; diff --git a/src/app/features/preprints/models/preprint-request-action-json-api.models.ts b/src/app/features/preprints/models/preprint-request-action-json-api.models.ts index 350798fc5..4c9e53bef 100644 --- a/src/app/features/preprints/models/preprint-request-action-json-api.models.ts +++ b/src/app/features/preprints/models/preprint-request-action-json-api.models.ts @@ -1,4 +1,5 @@ -import { JsonApiResponse, UserDataErrorResponseJsonApi } from '@osf/shared/models'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { UserDataErrorResponseJsonApi } from '@osf/shared/models/user/user-json-api.model'; export type PreprintRequestActionsJsonApiResponse = JsonApiResponse; diff --git a/src/app/features/preprints/models/preprint-request-action.models.ts b/src/app/features/preprints/models/preprint-request-action.models.ts index 7fbdf8fee..dc26cdc8c 100644 --- a/src/app/features/preprints/models/preprint-request-action.models.ts +++ b/src/app/features/preprints/models/preprint-request-action.models.ts @@ -1,4 +1,4 @@ -import { IdName } from '@shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; export interface PreprintRequestAction { id: string; @@ -7,5 +7,5 @@ export interface PreprintRequestAction { fromState: string; toState: string; dateModified: Date; - creator: IdName; + creator: IdNameModel; } diff --git a/src/app/features/preprints/models/preprint-request-json-api.models.ts b/src/app/features/preprints/models/preprint-request-json-api.models.ts index 2dbae3216..fca82bcde 100644 --- a/src/app/features/preprints/models/preprint-request-json-api.models.ts +++ b/src/app/features/preprints/models/preprint-request-json-api.models.ts @@ -1,5 +1,6 @@ import { PreprintRequestMachineState, PreprintRequestType } from '@osf/features/preprints/enums'; -import { JsonApiResponse, UserDataErrorResponseJsonApi } from '@osf/shared/models'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { UserDataErrorResponseJsonApi } from '@osf/shared/models/user/user-json-api.model'; export type PreprintRequestsJsonApiResponse = JsonApiResponse; diff --git a/src/app/features/preprints/models/preprint-request.models.ts b/src/app/features/preprints/models/preprint-request.models.ts index 9489fbaa4..03a353070 100644 --- a/src/app/features/preprints/models/preprint-request.models.ts +++ b/src/app/features/preprints/models/preprint-request.models.ts @@ -1,5 +1,6 @@ -import { PreprintRequestMachineState, PreprintRequestType } from '@osf/features/preprints/enums'; -import { IdName } from '@shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; + +import { PreprintRequestMachineState, PreprintRequestType } from '../enums'; export interface PreprintRequest { id: string; @@ -7,5 +8,5 @@ export interface PreprintRequest { machineState: PreprintRequestMachineState; requestType: PreprintRequestType; dateLastTransitioned: Date; - creator: IdName; + creator: IdNameModel; } diff --git a/src/app/features/preprints/models/preprint.models.ts b/src/app/features/preprints/models/preprint.models.ts index 22ceab8cc..7a64f138d 100644 --- a/src/app/features/preprints/models/preprint.models.ts +++ b/src/app/features/preprints/models/preprint.models.ts @@ -1,6 +1,8 @@ -import { UserPermissions } from '@osf/shared/enums'; -import { BooleanOrNull, StringOrNull } from '@osf/shared/helpers'; -import { Identifier, IdName, LicenseModel, LicenseOptions } from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { BooleanOrNull, StringOrNull } from '@osf/shared/helpers/types.helper'; +import { IdNameModel } from '@shared/models/common/id-name.model'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; +import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; import { ApplicabilityStatus, PreregLinkInfo, ReviewsState } from '../enums'; @@ -43,7 +45,7 @@ export interface PreprintModel { embeddedLicense: LicenseModel | null; preprintDoiLink?: string; articleDoiLink?: string; - identifiers?: Identifier[]; + identifiers?: IdentifierModel[]; } export interface PreprintFilesLinks { @@ -54,7 +56,7 @@ export interface PreprintShortInfo { id: string; title: string; dateModified: string; - contributors: IdName[]; + contributors: IdNameModel[]; providerId: string; } diff --git a/src/app/features/preprints/models/submit-preprint-form.models.ts b/src/app/features/preprints/models/submit-preprint-form.models.ts index 74bb49c7f..fe4e674b3 100644 --- a/src/app/features/preprints/models/submit-preprint-form.models.ts +++ b/src/app/features/preprints/models/submit-preprint-form.models.ts @@ -1,7 +1,7 @@ import { FormControl } from '@angular/forms'; -import { StringOrNull } from '@shared/helpers'; -import { SubjectModel } from '@shared/models'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { SubjectModel } from '@shared/models/subject/subject.model'; export interface TitleAndAbstractForm { title: FormControl; diff --git a/src/app/features/preprints/pages/create-new-version/create-new-version.component.spec.ts b/src/app/features/preprints/pages/create-new-version/create-new-version.component.spec.ts index 16102a442..146373b19 100644 --- a/src/app/features/preprints/pages/create-new-version/create-new-version.component.spec.ts +++ b/src/app/features/preprints/pages/create-new-version/create-new-version.component.spec.ts @@ -5,16 +5,19 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { FileStepComponent, ReviewStepComponent } from '@osf/features/preprints/components'; -import { createNewVersionStepsConst } from '@osf/features/preprints/constants'; -import { PreprintSteps } from '@osf/features/preprints/enums'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { StepperComponent } from '@shared/components'; -import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/helpers'; -import { StepOption } from '@shared/models'; -import { BrandService } from '@shared/services'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { StepOption } from '@osf/shared/models/step-option.model'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { FileStepComponent, ReviewStepComponent } from '../../components'; +import { createNewVersionStepsConst } from '../../constants'; +import { PreprintSteps } from '../../enums'; +import { PreprintProviderDetails } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors } from '../../store/preprint-stepper'; import { CreateNewVersionComponent } from './create-new-version.component'; diff --git a/src/app/features/preprints/pages/create-new-version/create-new-version.component.ts b/src/app/features/preprints/pages/create-new-version/create-new-version.component.ts index 8a6b43c3a..d59bfa609 100644 --- a/src/app/features/preprints/pages/create-new-version/create-new-version.component.ts +++ b/src/app/features/preprints/pages/create-new-version/create-new-version.component.ts @@ -20,20 +20,21 @@ import { import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { FileStepComponent, ReviewStepComponent } from '@osf/features/preprints/components'; -import { createNewVersionStepsConst } from '@osf/features/preprints/constants'; -import { PreprintSteps } from '@osf/features/preprints/enums'; -import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { - FetchPreprintById, - PreprintStepperSelectors, - ResetState, - SetSelectedPreprintProviderId, -} from '@osf/features/preprints/store/preprint-stepper'; -import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@osf/shared/helpers'; -import { StepperComponent } from '@shared/components'; -import { CanDeactivateComponent, StepOption } from '@shared/models'; -import { BrandService } from '@shared/services'; +import { ResetState } from '@osf/features/files/store'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { CanDeactivateComponent } from '@osf/shared/models/can-deactivate.interface'; +import { StepOption } from '@osf/shared/models/step-option.model'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { FileStepComponent, ReviewStepComponent } from '../../components'; +import { createNewVersionStepsConst } from '../../constants'; +import { PreprintSteps } from '../../enums'; +import { FetchPreprintById } from '../../store/preprint'; +import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors, SetSelectedPreprintProviderId } from '../../store/preprint-stepper'; @Component({ selector: 'osf-create-new-version', diff --git a/src/app/features/preprints/pages/landing/preprints-landing.component.spec.ts b/src/app/features/preprints/pages/landing/preprints-landing.component.spec.ts index 9c07caeea..6be95e3fb 100644 --- a/src/app/features/preprints/pages/landing/preprints-landing.component.spec.ts +++ b/src/app/features/preprints/pages/landing/preprints-landing.component.spec.ts @@ -4,16 +4,13 @@ import { TitleCasePipe } from '@angular/common'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { - AdvisoryBoardComponent, - BrowseBySubjectsComponent, - PreprintServicesComponent, -} from '@osf/features/preprints/components'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { SearchInputComponent } from '@shared/components'; -import { ResourceType } from '@shared/enums'; -import { BrandService } from '@shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { AdvisoryBoardComponent, BrowseBySubjectsComponent, PreprintServicesComponent } from '../../components'; +import { PreprintProviderDetails } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; import { PreprintsLandingComponent } from './preprints-landing.component'; diff --git a/src/app/features/preprints/pages/landing/preprints-landing.component.ts b/src/app/features/preprints/pages/landing/preprints-landing.component.ts index 46b8a3985..b2d04393e 100644 --- a/src/app/features/preprints/pages/landing/preprints-landing.component.ts +++ b/src/app/features/preprints/pages/landing/preprints-landing.component.ts @@ -11,21 +11,18 @@ import { FormControl } from '@angular/forms'; import { Router, RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { - AdvisoryBoardComponent, - BrowseBySubjectsComponent, - PreprintServicesComponent, -} from '@osf/features/preprints/components'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { normalizeQuotes } from '@osf/shared/helpers/normalize-quotes'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { AdvisoryBoardComponent, BrowseBySubjectsComponent, PreprintServicesComponent } from '../../components'; import { GetHighlightedSubjectsByProviderId, GetPreprintProviderById, GetPreprintProvidersToAdvertise, PreprintProvidersSelectors, -} from '@osf/features/preprints/store/preprint-providers'; -import { SearchInputComponent } from '@shared/components'; -import { ResourceType } from '@shared/enums'; -import { normalizeQuotes } from '@shared/helpers'; -import { BrandService } from '@shared/services'; +} from '../../store/preprint-providers'; @Component({ selector: 'osf-overview', diff --git a/src/app/features/preprints/pages/my-preprints/my-preprints.component.spec.ts b/src/app/features/preprints/pages/my-preprints/my-preprints.component.spec.ts index e1bc36de0..9045aeb8a 100644 --- a/src/app/features/preprints/pages/my-preprints/my-preprints.component.spec.ts +++ b/src/app/features/preprints/pages/my-preprints/my-preprints.component.spec.ts @@ -6,11 +6,13 @@ import { TitleCasePipe } from '@angular/common'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { PreprintShortInfo } from '@osf/features/preprints/models'; -import { ListInfoShortenerComponent, SearchInputComponent, SubHeaderComponent } from '@shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@shared/constants'; -import { SortOrder } from '@shared/enums'; +import { ListInfoShortenerComponent } from '@osf/shared/components/list-info-shortener/list-info-shortener.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { PreprintShortInfo } from '../../models'; import { MyPreprintsSelectors } from '../../store/my-preprints'; import { MyPreprintsComponent } from './my-preprints.component'; diff --git a/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts b/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts index a836d4df4..6f6d346b4 100644 --- a/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts +++ b/src/app/features/preprints/pages/my-preprints/my-preprints.component.ts @@ -23,12 +23,16 @@ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { ListInfoShortenerComponent, SearchInputComponent, SubHeaderComponent } from '@osf/shared/components'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { SortOrder } from '@osf/shared/enums'; -import { parseQueryFilterParams } from '@osf/shared/helpers'; -import { QueryParams, SearchFilters, TableParameters } from '@osf/shared/models'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { ListInfoShortenerComponent } from '@osf/shared/components/list-info-shortener/list-info-shortener.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { parseQueryFilterParams } from '@osf/shared/helpers/http.helper'; +import { QueryParams } from '@osf/shared/models/query-params.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; +import { TableParameters } from '@osf/shared/models/table-parameters.model'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; import { PreprintShortInfo } from '../../models'; import { FetchMyPreprints, MyPreprintsSelectors } from '../../store/my-preprints'; diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts b/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts index 78bd01e18..ceb5bf6e1 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts @@ -5,9 +5,10 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { UserPermissions } from '@osf/shared/enums'; -import { CustomDialogService, MetaTagsService } from '@osf/shared/services'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; import { ContributorsSelectors } from '@osf/shared/stores/contributors'; import { @@ -16,6 +17,7 @@ import { ModerationStatusBannerComponent, PreprintFileSectionComponent, PreprintMakeDecisionComponent, + PreprintMetricsInfoComponent, PreprintTombstoneComponent, PreprintWarningBannerComponent, ShareAndDownloadComponent, @@ -27,7 +29,7 @@ import { PreprintProvidersSelectors } from '../../store/preprint-providers'; import { PreprintDetailsComponent } from './preprint-details.component'; -import { MOCK_CONTRIBUTOR } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; import { PREPRINT_MOCK } from '@testing/mocks/preprint.mock'; import { PREPRINT_PROVIDER_DETAILS_MOCK } from '@testing/mocks/preprint-provider-details'; import { PREPRINT_REQUEST_MOCK } from '@testing/mocks/preprint-request.mock'; @@ -90,7 +92,8 @@ describe('PreprintDetailsComponent', () => { PreprintTombstoneComponent, PreprintWarningBannerComponent, ModerationStatusBannerComponent, - PreprintMakeDecisionComponent + PreprintMakeDecisionComponent, + PreprintMetricsInfoComponent ), ], providers: [ diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts index 84a36c734..a6d301206 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts @@ -27,23 +27,16 @@ import { ENVIRONMENT } from '@core/provider/environment.provider'; import { HelpScoutService } from '@core/services/help-scout.service'; import { ClearCurrentProvider } from '@core/store/provider'; import { UserSelectors } from '@core/store/user'; -import { - FetchPreprintById, - FetchPreprintRequestActions, - FetchPreprintRequests, - FetchPreprintReviewActions, - PreprintSelectors, - ResetState, -} from '@osf/features/preprints/store/preprint'; -import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { CreateNewVersion, PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { pathJoin } from '@osf/shared/helpers'; -import { ReviewPermissions } from '@shared/enums'; -import { FixSpecialCharPipe } from '@shared/pipes'; -import { CustomDialogService, MetaTagsService, ToastService } from '@shared/services'; -import { AnalyticsService } from '@shared/services/analytics.service'; -import { DataciteService } from '@shared/services/datacite/datacite.service'; -import { ContributorsSelectors } from '@shared/stores/contributors'; +import { ResetState } from '@osf/features/files/store'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; +import { pathJoin } from '@osf/shared/helpers/path-join.helper'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; +import { AnalyticsService } from '@osf/shared/services/analytics.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ContributorsSelectors } from '@osf/shared/stores/contributors'; import { AdditionalInfoComponent, @@ -53,12 +46,21 @@ import { PreprintMakeDecisionComponent, PreprintMetricsInfoComponent, PreprintTombstoneComponent, + PreprintWarningBannerComponent, ShareAndDownloadComponent, StatusBannerComponent, WithdrawDialogComponent, } from '../../components'; -import { PreprintWarningBannerComponent } from '../../components/preprint-details/preprint-warning-banner/preprint-warning-banner.component'; import { PreprintRequestMachineState, ProviderReviewsWorkflow, ReviewsState } from '../../enums'; +import { + FetchPreprintById, + FetchPreprintRequestActions, + FetchPreprintRequests, + FetchPreprintReviewActions, + PreprintSelectors, +} from '../../store/preprint'; +import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { CreateNewVersion, PreprintStepperSelectors } from '../../store/preprint-stepper'; @Component({ selector: 'osf-preprint-details', diff --git a/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.spec.ts b/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.spec.ts index db019900f..819db4e62 100644 --- a/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.spec.ts +++ b/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.spec.ts @@ -4,12 +4,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { PreprintProviderHeroComponent } from '@osf/features/preprints/components'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { GlobalSearchComponent } from '@shared/components'; -import { BrowserTabHelper, HeaderStyleHelper } from '@shared/helpers'; -import { BrandService } from '@shared/services'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { PreprintProviderHeroComponent } from '../../components'; +import { PreprintProviderDetails } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; import { PreprintProviderDiscoverComponent } from './preprint-provider-discover.component'; diff --git a/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.ts b/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.ts index d1349d57e..298f4624f 100644 --- a/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.ts +++ b/src/app/features/preprints/pages/preprint-provider-discover/preprint-provider-discover.component.ts @@ -4,13 +4,14 @@ import { ChangeDetectionStrategy, Component, HostBinding, inject, OnDestroy, OnI import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { PreprintProviderHeroComponent } from '@osf/features/preprints/components'; -import { BrowserTabHelper, HeaderStyleHelper } from '@osf/shared/helpers'; -import { BrandService } from '@osf/shared/services'; -import { GlobalSearchComponent } from '@shared/components'; -import { ResourceType } from '@shared/enums'; -import { SetDefaultFilterValue, SetResourceType } from '@shared/stores/global-search'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { BrandService } from '@osf/shared/services/brand.service'; +import { SetDefaultFilterValue, SetResourceType } from '@osf/shared/stores/global-search'; +import { PreprintProviderHeroComponent } from '../../components'; import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers'; @Component({ diff --git a/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.spec.ts b/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.spec.ts index 9f3cfa173..363c14880 100644 --- a/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.spec.ts +++ b/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.spec.ts @@ -3,16 +3,18 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { BrandService } from '@osf/shared/services/brand.service'; + import { AdvisoryBoardComponent, BrowseBySubjectsComponent, PreprintProviderFooterComponent, PreprintProviderHeroComponent, -} from '@osf/features/preprints/components'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { BrowserTabHelper, HeaderStyleHelper } from '@shared/helpers'; -import { BrandService } from '@shared/services'; +} from '../../components'; +import { PreprintProviderDetails } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; import { PreprintProviderOverviewComponent } from './preprint-provider-overview.component'; diff --git a/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.ts b/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.ts index a1edc0a96..05cc5d4bc 100644 --- a/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.ts +++ b/src/app/features/preprints/pages/preprint-provider-overview/preprint-provider-overview.component.ts @@ -6,19 +6,21 @@ import { ChangeDetectionStrategy, Component, effect, inject, OnDestroy, OnInit } import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { BrandService } from '@osf/shared/services/brand.service'; + import { AdvisoryBoardComponent, BrowseBySubjectsComponent, PreprintProviderFooterComponent, PreprintProviderHeroComponent, -} from '@osf/features/preprints/components'; +} from '../../components'; import { GetHighlightedSubjectsByProviderId, GetPreprintProviderById, PreprintProvidersSelectors, -} from '@osf/features/preprints/store/preprint-providers'; -import { BrowserTabHelper, HeaderStyleHelper } from '@osf/shared/helpers'; -import { BrandService } from '@shared/services'; +} from '../../store/preprint-providers'; @Component({ selector: 'osf-provider-overview', diff --git a/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.spec.ts b/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.spec.ts index 59159d2cb..49d4a8cee 100644 --- a/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.spec.ts +++ b/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.spec.ts @@ -4,11 +4,12 @@ import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { PreprintProviderShortInfo } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { SubHeaderComponent } from '@shared/components'; -import { DecodeHtmlPipe } from '@shared/pipes'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DecodeHtmlPipe } from '@osf/shared/pipes/decode-html.pipe'; + +import { PreprintProviderShortInfo } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors } from '../../store/preprint-stepper'; import { SelectPreprintServiceComponent } from './select-preprint-service.component'; diff --git a/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts b/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts index ae3ea0719..de7ad2daf 100644 --- a/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts +++ b/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts @@ -11,17 +11,12 @@ import { NgClass } from '@angular/common'; import { ChangeDetectionStrategy, Component, HostBinding, OnInit } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { PreprintProviderShortInfo } from '@osf/features/preprints/models'; -import { - GetPreprintProvidersAllowingSubmissions, - PreprintProvidersSelectors, -} from '@osf/features/preprints/store/preprint-providers'; -import { - PreprintStepperSelectors, - SetSelectedPreprintProviderId, -} from '@osf/features/preprints/store/preprint-stepper'; -import { SubHeaderComponent } from '@shared/components'; -import { DecodeHtmlPipe } from '@shared/pipes'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { DecodeHtmlPipe } from '@osf/shared/pipes/decode-html.pipe'; + +import { PreprintProviderShortInfo } from '../../models'; +import { GetPreprintProvidersAllowingSubmissions, PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors, SetSelectedPreprintProviderId } from '../../store/preprint-stepper'; @Component({ selector: 'osf-select-preprint-service', diff --git a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.spec.ts b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.spec.ts index 101b54c0f..c20849a1c 100644 --- a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.spec.ts +++ b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -6,14 +6,26 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { submitPreprintSteps } from '@osf/features/preprints/constants'; -import { PreprintSteps } from '@osf/features/preprints/enums'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/helpers'; -import { StepOption } from '@shared/models'; -import { BrandService } from '@shared/services'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { StepOption } from '@osf/shared/models/step-option.model'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { + AuthorAssertionsStepComponent, + FileStepComponent, + PreprintsMetadataStepComponent, + ReviewStepComponent, + SupplementsStepComponent, + TitleAndAbstractStepComponent, +} from '../../components'; +import { submitPreprintSteps } from '../../constants'; +import { PreprintSteps } from '../../enums'; +import { PreprintProviderDetails } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors } from '../../store/preprint-stepper'; import { SubmitPreprintStepperComponent } from './submit-preprint-stepper.component'; @@ -47,7 +59,20 @@ describe('SubmitPreprintStepperComponent', () => { .build(); await TestBed.configureTestingModule({ - imports: [SubmitPreprintStepperComponent, OSFTestingModule], + imports: [ + SubmitPreprintStepperComponent, + OSFTestingModule, + ...MockComponents( + StepperComponent, + TitleAndAbstractStepComponent, + FileStepComponent, + PreprintsMetadataStepComponent, + AuthorAssertionsStepComponent, + SupplementsStepComponent, + AuthorAssertionsStepComponent, + ReviewStepComponent + ), + ], providers: [ MockProvider(BrandService), MockProvider(Router, routerMock), diff --git a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts index 1bd30ccb5..63e47a8c8 100644 --- a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts @@ -21,6 +21,15 @@ import { import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute } from '@angular/router'; +import { ResetState } from '@osf/features/files/store'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { CanDeactivateComponent } from '@osf/shared/models/can-deactivate.interface'; +import { StepOption } from '@osf/shared/models/step-option.model'; +import { BrandService } from '@osf/shared/services/brand.service'; + import { AuthorAssertionsStepComponent, FileStepComponent, @@ -28,20 +37,11 @@ import { ReviewStepComponent, SupplementsStepComponent, TitleAndAbstractStepComponent, -} from '@osf/features/preprints/components'; -import { submitPreprintSteps } from '@osf/features/preprints/constants'; -import { PreprintSteps } from '@osf/features/preprints/enums'; -import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { - DeletePreprint, - PreprintStepperSelectors, - ResetState, - SetSelectedPreprintProviderId, -} from '@osf/features/preprints/store/preprint-stepper'; -import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@osf/shared/helpers'; -import { CanDeactivateComponent, StepOption } from '@osf/shared/models'; -import { StepperComponent } from '@shared/components'; -import { BrandService } from '@shared/services'; +} from '../../components'; +import { submitPreprintSteps } from '../../constants'; +import { PreprintSteps } from '../../enums'; +import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { DeletePreprint, PreprintStepperSelectors, SetSelectedPreprintProviderId } from '../../store/preprint-stepper'; @Component({ selector: 'osf-submit-preprint-stepper', diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts index 60957f4be..0e399ebe9 100644 --- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -6,14 +6,26 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { submitPreprintSteps } from '@osf/features/preprints/constants'; -import { PreprintSteps } from '@osf/features/preprints/enums'; -import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; -import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/helpers'; -import { StepOption } from '@shared/models'; -import { BrandService } from '@shared/services'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { StepOption } from '@osf/shared/models/step-option.model'; +import { BrandService } from '@osf/shared/services/brand.service'; + +import { + AuthorAssertionsStepComponent, + FileStepComponent, + PreprintsMetadataStepComponent, + ReviewStepComponent, + SupplementsStepComponent, + TitleAndAbstractStepComponent, +} from '../../components'; +import { submitPreprintSteps } from '../../constants'; +import { PreprintSteps } from '../../enums'; +import { PreprintProviderDetails } from '../../models'; +import { PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors } from '../../store/preprint-stepper'; import { UpdatePreprintStepperComponent } from './update-preprint-stepper.component'; @@ -50,7 +62,19 @@ describe('UpdatePreprintStepperComponent', () => { .build(); await TestBed.configureTestingModule({ - imports: [UpdatePreprintStepperComponent, OSFTestingModule], + imports: [ + UpdatePreprintStepperComponent, + OSFTestingModule, + ...MockComponents( + AuthorAssertionsStepComponent, + StepperComponent, + TitleAndAbstractStepComponent, + PreprintsMetadataStepComponent, + SupplementsStepComponent, + ReviewStepComponent, + FileStepComponent + ), + ], providers: [ MockProvider(BrandService), MockProvider(Router, routerMock), diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts index 2a3dddb30..963db1228 100644 --- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts @@ -21,6 +21,16 @@ import { import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute } from '@angular/router'; +import { ResetState } from '@osf/features/files/store'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { IS_WEB } from '@osf/shared/helpers/breakpoints.tokens'; +import { BrowserTabHelper } from '@osf/shared/helpers/browser-tab.helper'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { BrandService } from '@osf/shared/services/brand.service'; +import { CanDeactivateComponent } from '@shared/models/can-deactivate.interface'; +import { StepOption } from '@shared/models/step-option.model'; + import { AuthorAssertionsStepComponent, FileStepComponent, @@ -28,21 +38,12 @@ import { ReviewStepComponent, SupplementsStepComponent, TitleAndAbstractStepComponent, -} from '@osf/features/preprints/components'; -import { submitPreprintSteps } from '@osf/features/preprints/constants'; -import { PreprintSteps, ProviderReviewsWorkflow, ReviewsState } from '@osf/features/preprints/enums'; -import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; -import { - FetchPreprintById, - PreprintStepperSelectors, - ResetState, - SetSelectedPreprintProviderId, -} from '@osf/features/preprints/store/preprint-stepper'; -import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@osf/shared/helpers'; -import { StepperComponent } from '@shared/components'; -import { UserPermissions } from '@shared/enums'; -import { CanDeactivateComponent, StepOption } from '@shared/models'; -import { BrandService } from '@shared/services'; +} from '../../components'; +import { submitPreprintSteps } from '../../constants'; +import { PreprintSteps, ProviderReviewsWorkflow, ReviewsState } from '../../enums'; +import { FetchPreprintById } from '../../store/preprint'; +import { GetPreprintProviderById, PreprintProvidersSelectors } from '../../store/preprint-providers'; +import { PreprintStepperSelectors, SetSelectedPreprintProviderId } from '../../store/preprint-stepper'; @Component({ selector: 'osf-update-preprint-stepper', @@ -54,8 +55,8 @@ import { BrandService } from '@shared/services'; PreprintsMetadataStepComponent, SupplementsStepComponent, ReviewStepComponent, - TranslatePipe, FileStepComponent, + TranslatePipe, ], templateUrl: './update-preprint-stepper.component.html', styleUrl: './update-preprint-stepper.component.scss', diff --git a/src/app/features/preprints/preprints.routes.ts b/src/app/features/preprints/preprints.routes.ts index a1d8b12ad..71732e2fb 100644 --- a/src/app/features/preprints/preprints.routes.ts +++ b/src/app/features/preprints/preprints.routes.ts @@ -2,7 +2,7 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; -import { authGuard } from '@osf/core/guards'; +import { authGuard } from '@core/guards/auth.guard'; import { preprintsModeratorGuard } from '@osf/features/preprints/guards'; import { PreprintsComponent } from '@osf/features/preprints/preprints.component'; import { PreprintState } from '@osf/features/preprints/store/preprint'; diff --git a/src/app/features/preprints/services/preprint-files.service.ts b/src/app/features/preprints/services/preprint-files.service.ts index ef640e202..aa2a0cad1 100644 --- a/src/app/features/preprints/services/preprint-files.service.ts +++ b/src/app/features/preprints/services/preprint-files.service.ts @@ -12,9 +12,15 @@ import { PreprintModel, PreprintRelationshipsJsonApi, } from '@osf/features/preprints/models'; -import { ApiData, FileFolderModel, FileFolderResponseJsonApi, FileFoldersResponseJsonApi } from '@osf/shared/models'; -import { FilesMapper } from '@shared/mappers'; -import { FilesService, JsonApiService } from '@shared/services'; +import { ApiData } from '@osf/shared/models/common/json-api.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { + FileFolderResponseJsonApi, + FileFoldersResponseJsonApi, +} from '@osf/shared/models/files/file-folder-json-api.model'; +import { FilesService } from '@osf/shared/services/files.service'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { FilesMapper } from '@shared/mappers/files/files.mapper'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/preprints/services/preprint-licenses.service.ts b/src/app/features/preprints/services/preprint-licenses.service.ts index adc772aae..5d8a3a5f8 100644 --- a/src/app/features/preprints/services/preprint-licenses.service.ts +++ b/src/app/features/preprints/services/preprint-licenses.service.ts @@ -10,9 +10,11 @@ import { PreprintLinksJsonApi, PreprintRelationshipsJsonApi, } from '@osf/features/preprints/models'; -import { LicensesMapper } from '@shared/mappers'; -import { ApiData, LicenseModel, LicenseOptions, LicensesResponseJsonApi } from '@shared/models'; -import { JsonApiService } from '@shared/services'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { LicensesMapper } from '@shared/mappers/licenses.mapper'; +import { ApiData } from '@shared/models/common/json-api.model'; +import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; +import { LicensesResponseJsonApi } from '@shared/models/license/licenses-json-api.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/preprints/services/preprint-providers.service.ts b/src/app/features/preprints/services/preprint-providers.service.ts index 3daf1ef1c..3463e59ed 100644 --- a/src/app/features/preprints/services/preprint-providers.service.ts +++ b/src/app/features/preprints/services/preprint-providers.service.ts @@ -9,8 +9,10 @@ import { PreprintProviderDetailsJsonApi, PreprintProviderShortInfo, } from '@osf/features/preprints/models'; -import { JsonApiResponse, SubjectModel, SubjectsResponseJsonApi } from '@shared/models'; -import { JsonApiService } from '@shared/services'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; +import { JsonApiResponse } from '@shared/models/common/json-api.model'; +import { SubjectModel } from '@shared/models/subject/subject.model'; +import { SubjectsResponseJsonApi } from '@shared/models/subject/subjects-json-api.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/preprints/services/preprints-projects.service.ts b/src/app/features/preprints/services/preprints-projects.service.ts index e3cd53fad..4bffbd5bd 100644 --- a/src/app/features/preprints/services/preprints-projects.service.ts +++ b/src/app/features/preprints/services/preprints-projects.service.ts @@ -3,15 +3,15 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { Primitive, StringOrNull } from '@osf/shared/helpers'; +import { Primitive, StringOrNull } from '@osf/shared/helpers/types.helper'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; +import { ApiData } from '@osf/shared/models/common/json-api.model'; import { - ApiData, CreateProjectPayloadJsoApi, - IdName, NodeResponseJsonApi, NodesResponseJsonApi, -} from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +} from '@osf/shared/models/nodes/nodes-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { PreprintsMapper } from '../mappers'; import { @@ -32,7 +32,7 @@ export class PreprintsProjectsService { return `${this.environment.apiDomainUrl}/v2`; } - getAvailableProjects(searchTerm: StringOrNull): Observable { + getAvailableProjects(searchTerm: StringOrNull): Observable { const params: Record = {}; params['page'] = 1; @@ -50,7 +50,7 @@ export class PreprintsProjectsService { ); } - getProjectById(projectId: string): Observable { + getProjectById(projectId: string): Observable { return this.jsonApiService.get(`${this.apiUrl}/nodes/${projectId}/`).pipe( map((response) => { return { @@ -96,7 +96,7 @@ export class PreprintsProjectsService { templateFrom: string, regionId: string, affiliationsId: string[] - ): Observable { + ): Observable { const payload: CreateProjectPayloadJsoApi = { data: { type: 'nodes', diff --git a/src/app/features/preprints/services/preprints.service.ts b/src/app/features/preprints/services/preprints.service.ts index ff55460ba..15e11e7bc 100644 --- a/src/app/features/preprints/services/preprints.service.ts +++ b/src/app/features/preprints/services/preprints.service.ts @@ -7,9 +7,16 @@ import { RegistryModerationMapper } from '@osf/features/moderation/mappers'; import { ReviewActionsResponseJsonApi } from '@osf/features/moderation/models'; import { PreprintRequestActionsMapper } from '@osf/features/preprints/mappers/preprint-request-actions.mapper'; import { PreprintRequestAction } from '@osf/features/preprints/models/preprint-request-action.models'; -import { searchPreferencesToJsonApiQueryParams, StringOrNull } from '@osf/shared/helpers'; -import { ApiData, JsonApiResponse, JsonApiResponseWithMeta, ResponseJsonApi, SearchFilters } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { searchPreferencesToJsonApiQueryParams } from '@osf/shared/helpers/search-pref-to-json-api-query-params.helper'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { + ApiData, + JsonApiResponse, + JsonApiResponseWithMeta, + ResponseJsonApi, +} from '@osf/shared/models/common/json-api.model'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { preprintSortFieldMap } from '../constants'; import { PreprintRequestMapper, PreprintsMapper } from '../mappers'; diff --git a/src/app/features/preprints/store/my-preprints/my-preprints.actions.ts b/src/app/features/preprints/store/my-preprints/my-preprints.actions.ts index 6718a06e7..fe7ff5bc3 100644 --- a/src/app/features/preprints/store/my-preprints/my-preprints.actions.ts +++ b/src/app/features/preprints/store/my-preprints/my-preprints.actions.ts @@ -1,4 +1,4 @@ -import { SearchFilters } from '@shared/models'; +import { SearchFilters } from '@osf/shared/models/search-filters.model'; export class FetchMyPreprints { static readonly type = '[My Preprints] Fetch My Preprints'; diff --git a/src/app/features/preprints/store/my-preprints/my-preprints.model.ts b/src/app/features/preprints/store/my-preprints/my-preprints.model.ts index d2343a4ec..55f5b814a 100644 --- a/src/app/features/preprints/store/my-preprints/my-preprints.model.ts +++ b/src/app/features/preprints/store/my-preprints/my-preprints.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateWithTotalCount } from '@shared/models'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { PreprintShortInfo } from '../../models'; diff --git a/src/app/features/preprints/store/my-preprints/my-preprints.state.ts b/src/app/features/preprints/store/my-preprints/my-preprints.state.ts index dc6bc45ce..c65af78ce 100644 --- a/src/app/features/preprints/store/my-preprints/my-preprints.state.ts +++ b/src/app/features/preprints/store/my-preprints/my-preprints.state.ts @@ -6,7 +6,7 @@ import { catchError } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { PreprintsService } from '../../services'; diff --git a/src/app/features/preprints/store/preprint-providers/preprint-providers.model.ts b/src/app/features/preprints/store/preprint-providers/preprint-providers.model.ts index bbac257e3..be75b8f50 100644 --- a/src/app/features/preprints/store/preprint-providers/preprint-providers.model.ts +++ b/src/app/features/preprints/store/preprint-providers/preprint-providers.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, SubjectModel } from '@shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; import { PreprintProviderDetails, PreprintProviderShortInfo } from '../../models'; diff --git a/src/app/features/preprints/store/preprint-providers/preprint-providers.state.ts b/src/app/features/preprints/store/preprint-providers/preprint-providers.state.ts index f7b9188e3..e70522ff2 100644 --- a/src/app/features/preprints/store/preprint-providers/preprint-providers.state.ts +++ b/src/app/features/preprints/store/preprint-providers/preprint-providers.state.ts @@ -8,8 +8,8 @@ import { inject, Injectable } from '@angular/core'; import { SetCurrentProvider } from '@core/store/provider'; import { PreprintProvidersService } from '@osf/features/preprints/services'; -import { CurrentResourceType } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { GetHighlightedSubjectsByProviderId, diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts index 288638c23..7638e6557 100644 --- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts @@ -1,7 +1,10 @@ -import { PreprintFileSource } from '@osf/features/preprints/enums'; -import { PreprintModel } from '@osf/features/preprints/models'; -import { StringOrNull } from '@shared/helpers'; -import { FileFolderModel, FileModel, LicenseOptions } from '@shared/models'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { LicenseOptions } from '@osf/shared/models/license/license.model'; + +import { PreprintFileSource } from '../../enums'; +import { PreprintModel } from '../../models'; export class SetSelectedPreprintProviderId { static readonly type = '[Preprint Stepper] Set Selected Preprint Provider Id'; diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts index 42261f965..49929ec9f 100644 --- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts @@ -1,8 +1,11 @@ import { PreprintFileSource } from '@osf/features/preprints/enums'; import { PreprintFilesLinks, PreprintModel } from '@osf/features/preprints/models'; -import { StringOrNull } from '@shared/helpers'; -import { AsyncStateModel, FileFolderModel, FileModel, IdName } from '@shared/models'; -import { LicenseModel } from '@shared/models/license.model'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { StringOrNull } from '@shared/helpers/types.helper'; +import { IdNameModel } from '@shared/models/common/id-name.model'; +import { FileModel } from '@shared/models/files/file.model'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; +import { AsyncStateModel } from '@shared/models/store/async-state.model'; export interface PreprintStepperStateModel { selectedProviderId: StringOrNull; @@ -10,11 +13,11 @@ export interface PreprintStepperStateModel { fileSource: PreprintFileSource; preprintFilesLinks: AsyncStateModel; preprintFile: AsyncStateModel; - availableProjects: AsyncStateModel; + availableProjects: AsyncStateModel; projectFiles: AsyncStateModel; licenses: AsyncStateModel; currentFolder: AsyncStateModel; - preprintProject: AsyncStateModel; + preprintProject: AsyncStateModel; hasBeenSubmitted: boolean; institutionsChanged: boolean; } diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts index 78962f57d..d63e44fad 100644 --- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts @@ -15,9 +15,10 @@ import { PreprintsProjectsService, PreprintsService, } from '@osf/features/preprints/services'; -import { FileFolderModel, FileModel } from '@osf/shared/models'; -import { handleSectionError } from '@shared/helpers'; -import { FilesService } from '@shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { FilesService } from '@osf/shared/services/files.service'; import { ConnectProject, diff --git a/src/app/features/preprints/store/preprint/preprint.actions.ts b/src/app/features/preprints/store/preprint/preprint.actions.ts index e13179b78..a3f4a3b02 100644 --- a/src/app/features/preprints/store/preprint/preprint.actions.ts +++ b/src/app/features/preprints/store/preprint/preprint.actions.ts @@ -1,4 +1,4 @@ -import { StringOrNull } from '@shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; export class FetchPreprintById { static readonly type = '[Preprint] Fetch Preprint By Id'; diff --git a/src/app/features/preprints/store/preprint/preprint.model.ts b/src/app/features/preprints/store/preprint/preprint.model.ts index 6876edc7e..35aed7476 100644 --- a/src/app/features/preprints/store/preprint/preprint.model.ts +++ b/src/app/features/preprints/store/preprint/preprint.model.ts @@ -1,5 +1,7 @@ import { ReviewAction } from '@osf/features/moderation/models'; -import { AsyncStateModel, FileModel, FileVersionModel } from '@shared/models'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileVersionModel } from '@osf/shared/models/files/file-version.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { PreprintMetrics, PreprintModel, PreprintRequest, PreprintRequestAction } from '../../models'; diff --git a/src/app/features/preprints/store/preprint/preprint.selectors.ts b/src/app/features/preprints/store/preprint/preprint.selectors.ts index 66cdf22fe..4f67a2572 100644 --- a/src/app/features/preprints/store/preprint/preprint.selectors.ts +++ b/src/app/features/preprints/store/preprint/preprint.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { PreprintStateModel } from './preprint.model'; import { PreprintState } from './preprint.state'; diff --git a/src/app/features/preprints/store/preprint/preprint.state.ts b/src/app/features/preprints/store/preprint/preprint.state.ts index ecda51613..6f2a3684b 100644 --- a/src/app/features/preprints/store/preprint/preprint.state.ts +++ b/src/app/features/preprints/store/preprint/preprint.state.ts @@ -6,8 +6,8 @@ import { catchError } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { FilesService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { FilesService } from '@osf/shared/services/files.service'; import { PreprintsService } from '../../services'; diff --git a/src/app/features/profile/components/profile-information/profile-information.component.spec.ts b/src/app/features/profile/components/profile-information/profile-information.component.spec.ts index eb0415ab0..b88e9c062 100644 --- a/src/app/features/profile/components/profile-information/profile-information.component.spec.ts +++ b/src/app/features/profile/components/profile-information/profile-information.component.spec.ts @@ -4,13 +4,15 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { SocialModel, UserModel } from '@osf/shared/models'; -import { EducationHistoryComponent, EmploymentHistoryComponent } from '@shared/components'; +import { EducationHistoryComponent } from '@osf/shared/components/education-history/education-history.component'; +import { EmploymentHistoryComponent } from '@osf/shared/components/employment-history/employment-history.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { SocialModel } from '@shared/models/user/social.model'; +import { UserModel } from '@shared/models/user/user.models'; import { ProfileInformationComponent } from './profile-information.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { MOCK_EDUCATION, MOCK_EMPLOYMENT } from '@testing/mocks/user-employment-education.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; diff --git a/src/app/features/profile/components/profile-information/profile-information.component.ts b/src/app/features/profile/components/profile-information/profile-information.component.ts index 0424ba49b..25d7f1a4d 100644 --- a/src/app/features/profile/components/profile-information/profile-information.component.ts +++ b/src/app/features/profile/components/profile-information/profile-information.component.ts @@ -6,11 +6,12 @@ import { DatePipe, NgOptimizedImage } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, inject, input, output } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; -import { EducationHistoryComponent, EmploymentHistoryComponent } from '@osf/shared/components'; -import { SOCIAL_LINKS } from '@osf/shared/constants'; -import { IS_MEDIUM } from '@osf/shared/helpers'; -import { UserModel } from '@osf/shared/models'; -import { SortByDatePipe } from '@osf/shared/pipes'; +import { EducationHistoryComponent } from '@osf/shared/components/education-history/education-history.component'; +import { EmploymentHistoryComponent } from '@osf/shared/components/employment-history/employment-history.component'; +import { SOCIAL_LINKS } from '@osf/shared/constants/social-links.const'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { UserModel } from '@osf/shared/models/user/user.models'; +import { SortByDatePipe } from '@osf/shared/pipes/sort-by-date.pipe'; import { mapUserSocials } from '../../helpers'; diff --git a/src/app/features/profile/helpers/user-socials.helper.ts b/src/app/features/profile/helpers/user-socials.helper.ts index 65b739f42..414695967 100644 --- a/src/app/features/profile/helpers/user-socials.helper.ts +++ b/src/app/features/profile/helpers/user-socials.helper.ts @@ -1,4 +1,6 @@ -import { SocialLinksModel, SocialLinkViewModel, SocialModel } from '@osf/shared/models'; +import { SocialModel } from '@osf/shared/models/user/social.model'; +import { SocialLinkViewModel } from '@osf/shared/models/user/social-link-view.model'; +import { SocialLinksModel } from '@osf/shared/models/user/social-links.model'; export function mapUserSocials( socialData: SocialModel | undefined, diff --git a/src/app/features/profile/profile.component.spec.ts b/src/app/features/profile/profile.component.spec.ts index 495486a95..484834991 100644 --- a/src/app/features/profile/profile.component.spec.ts +++ b/src/app/features/profile/profile.component.spec.ts @@ -1,11 +1,14 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { ResourceType } from '@osf/shared/enums'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ProfileInformationComponent } from './components'; import { ProfileComponent } from './profile.component'; import { ProfileSelectors } from './store'; @@ -25,7 +28,11 @@ describe('ProfileComponent', () => { activatedRouteMock = ActivatedRouteMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [ProfileComponent, OSFTestingModule], + imports: [ + ProfileComponent, + OSFTestingModule, + ...MockComponents(ProfileInformationComponent, GlobalSearchComponent, LoadingSpinnerComponent), + ], providers: [ MockProvider(Router, routerMock), MockProvider(ActivatedRoute, activatedRouteMock), diff --git a/src/app/features/profile/profile.component.ts b/src/app/features/profile/profile.component.ts index b79311749..ee2b9b23e 100644 --- a/src/app/features/profile/profile.component.ts +++ b/src/app/features/profile/profile.component.ts @@ -5,11 +5,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { GlobalSearchComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { SEARCH_TAB_OPTIONS } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { UserModel } from '@osf/shared/models'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SEARCH_TAB_OPTIONS } from '@osf/shared/constants/search-tab-options.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { SetDefaultFilterValue } from '@osf/shared/stores/global-search'; +import { UserModel } from '@shared/models/user/user.models'; import { ProfileInformationComponent } from './components'; import { FetchUserProfile, ProfileSelectors, SetUserProfile } from './store'; diff --git a/src/app/features/profile/store/profile.actions.ts b/src/app/features/profile/store/profile.actions.ts index f6598603c..61269ae9e 100644 --- a/src/app/features/profile/store/profile.actions.ts +++ b/src/app/features/profile/store/profile.actions.ts @@ -1,4 +1,4 @@ -import { UserModel } from '@osf/shared/models'; +import { UserModel } from '@osf/shared/models/user/user.models'; export class FetchUserProfile { static readonly type = '[Profile] Fetch User Profile'; diff --git a/src/app/features/profile/store/profile.model.ts b/src/app/features/profile/store/profile.model.ts index 6533a0323..87d4feee1 100644 --- a/src/app/features/profile/store/profile.model.ts +++ b/src/app/features/profile/store/profile.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, UserModel } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { UserModel } from '@osf/shared/models/user/user.models'; export interface ProfileStateModel { userProfile: AsyncStateModel; diff --git a/src/app/features/profile/store/profile.selectors.ts b/src/app/features/profile/store/profile.selectors.ts index f35eba217..48869e8c3 100644 --- a/src/app/features/profile/store/profile.selectors.ts +++ b/src/app/features/profile/store/profile.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { UserModel } from '@osf/shared/models'; +import { UserModel } from '@osf/shared/models/user/user.models'; import { ProfileStateModel } from './profile.model'; import { ProfileState } from '.'; diff --git a/src/app/features/profile/store/profile.state.ts b/src/app/features/profile/store/profile.state.ts index e30037674..94af564be 100644 --- a/src/app/features/profile/store/profile.state.ts +++ b/src/app/features/profile/store/profile.state.ts @@ -5,8 +5,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { UserService } from '@core/services'; -import { handleSectionError } from '@osf/shared/helpers'; +import { UserService } from '@core/services/user.service'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { FetchUserProfile, SetUserProfile } from './profile.actions'; import { PROFILE_STATE_DEFAULTS, ProfileStateModel } from './profile.model'; diff --git a/src/app/features/project/linked-services/linked-services.component.spec.ts b/src/app/features/project/linked-services/linked-services.component.spec.ts index 011fc0289..329f582f2 100644 --- a/src/app/features/project/linked-services/linked-services.component.spec.ts +++ b/src/app/features/project/linked-services/linked-services.component.spec.ts @@ -4,15 +4,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components'; -import { AddonsSelectors } from '@shared/stores/addons'; -import { CurrentResourceSelectors } from '@shared/stores/current-resource'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { AddonsSelectors } from '@osf/shared/stores/addons'; +import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { LinkedServicesComponent } from './linked-services.component'; import { getConfiguredAddonsMappedData } from '@testing/data/addons/addons.configured.data'; import { getResourceReferencesData } from '@testing/data/files/resource-references.data'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/project/linked-services/linked-services.component.ts b/src/app/features/project/linked-services/linked-services.component.ts index aea781e17..c73316f3e 100644 --- a/src/app/features/project/linked-services/linked-services.component.ts +++ b/src/app/features/project/linked-services/linked-services.component.ts @@ -8,11 +8,12 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject, OnInit } import { ActivatedRoute, RouterLink } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; -import { AddonServiceNames } from '@shared/enums'; -import { convertCamelCaseToNormal } from '@shared/helpers'; -import { AddonsSelectors, GetAddonsResourceReference, GetConfiguredLinkAddons } from '@shared/stores/addons'; -import { CurrentResourceSelectors } from '@shared/stores/current-resource'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { AddonServiceNames } from '@osf/shared/enums/addon-service-names.enum'; +import { convertCamelCaseToNormal } from '@osf/shared/helpers/camel-case-to-normal.helper'; +import { AddonsSelectors, GetAddonsResourceReference, GetConfiguredLinkAddons } from '@osf/shared/stores/addons'; +import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; @Component({ selector: 'osf-linked-services', diff --git a/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts b/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts index 16e23d9cc..dee6481af 100644 --- a/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts +++ b/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; + import { AddComponentDialogComponent } from './add-component-dialog.component'; describe('AddComponentComponent', () => { @@ -8,7 +12,7 @@ describe('AddComponentComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddComponentDialogComponent], + imports: [AddComponentDialogComponent, MockComponent(AffiliatedInstitutionSelectComponent)], }).compileComponents(); fixture = TestBed.createComponent(AddComponentDialogComponent); diff --git a/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.ts b/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.ts index a996a4cfe..9a113f97f 100644 --- a/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.ts +++ b/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.ts @@ -14,13 +14,14 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { UserSelectors } from '@core/store/user'; -import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components'; -import { ComponentFormControls } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ComponentForm, Institution } from '@osf/shared/models'; -import { ToastService } from '@osf/shared/services'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; +import { ComponentFormControls } from '@osf/shared/enums/create-component-form-controls.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; import { FetchUserInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions'; import { FetchRegions, RegionsSelectors } from '@osf/shared/stores/regions'; +import { ComponentForm } from '@shared/models/create-component-form.model'; +import { Institution } from '@shared/models/institutions/institutions.models'; import { CreateComponent, GetComponents, ProjectOverviewSelectors } from '../../store'; diff --git a/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.spec.ts b/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.spec.ts index b0b072344..ce617b191 100644 --- a/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.spec.ts +++ b/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.spec.ts @@ -1,5 +1,10 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { CitationCollectionItemComponent } from '../citation-collection-item/citation-collection-item.component'; +import { CitationItemComponent } from '../citation-item/citation-item.component'; + import { CitationAddonCardComponent } from './citation-addon-card.component'; describe.skip('CitationAddonCardComponent', () => { @@ -8,7 +13,7 @@ describe.skip('CitationAddonCardComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [CitationAddonCardComponent], + imports: [CitationAddonCardComponent, ...MockComponents(CitationItemComponent, CitationCollectionItemComponent)], }).compileComponents(); fixture = TestBed.createComponent(CitationAddonCardComponent); diff --git a/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.ts b/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.ts index d8e56fdf6..da7641660 100644 --- a/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.ts +++ b/src/app/features/project/overview/components/citation-addon-card/citation-addon-card.component.ts @@ -20,16 +20,21 @@ import { } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { DEFAULT_CITATION_STYLE } from '@osf/features/project/overview/constants'; -import { OperationNames, StorageItemType } from '@shared/enums'; -import { formatCitation, getItemUrl } from '@shared/helpers'; -import { CitationStyle, ConfiguredAddonModel, CustomOption, StorageItem } from '@shared/models'; -import { AddonOperationInvocationService, CslStyleManagerService } from '@shared/services'; -import { AddonsSelectors, CreateCitationAddonOperationInvocation } from '@shared/stores/addons'; -import { CitationsSelectors, GetCitationStyles } from '@shared/stores/citations'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { StorageItemType } from '@osf/shared/enums/storage-item-type.enum'; +import { formatCitation, getItemUrl } from '@osf/shared/helpers/citation-formatter.helper'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { StorageItem } from '@osf/shared/models/addons/storage-item.model'; +import { CitationStyle } from '@osf/shared/models/citations/citation-style.model'; +import { CustomOption } from '@osf/shared/models/select-option.model'; +import { AddonOperationInvocationService } from '@osf/shared/services/addons/addon-operation-invocation.service'; +import { CslStyleManagerService } from '@osf/shared/services/csl-style-manager.service'; +import { AddonsSelectors, CreateCitationAddonOperationInvocation } from '@osf/shared/stores/addons'; +import { CitationsSelectors, GetCitationStyles } from '@osf/shared/stores/citations'; import '@citation-js/plugin-csl'; +import { DEFAULT_CITATION_STYLE } from '../../constants'; import { FormattedCitationItem } from '../../models'; import { CitationCollectionItemComponent } from '../citation-collection-item/citation-collection-item.component'; import { CitationItemComponent } from '../citation-item/citation-item.component'; diff --git a/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.spec.ts b/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.spec.ts index 50b2825db..99f54343d 100644 --- a/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.spec.ts +++ b/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.spec.ts @@ -2,9 +2,10 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { IconComponent } from '@shared/components'; -import { StorageItemType } from '@shared/enums'; -import { AddonOperationInvocationService, AddonsService } from '@shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { StorageItemType } from '@osf/shared/enums/storage-item-type.enum'; +import { AddonOperationInvocationService } from '@osf/shared/services/addons/addon-operation-invocation.service'; +import { AddonsService } from '@osf/shared/services/addons/addons.service'; import { CitationItemComponent } from '../citation-item/citation-item.component'; diff --git a/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.ts b/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.ts index 4674e1bec..ce48fbf40 100644 --- a/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.ts +++ b/src/app/features/project/overview/components/citation-collection-item/citation-collection-item.component.ts @@ -1,10 +1,14 @@ import { ChangeDetectionStrategy, Component, computed, inject, input, OnInit, signal } from '@angular/core'; -import { IconComponent } from '@shared/components'; -import { OperationNames, StorageItemType } from '@shared/enums'; -import { formatCitation, getItemUrl } from '@shared/helpers'; -import { ConfiguredAddonModel, OperationInvocation, StorageItem } from '@shared/models'; -import { AddonOperationInvocationService, AddonsService } from '@shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { StorageItemType } from '@osf/shared/enums/storage-item-type.enum'; +import { formatCitation, getItemUrl } from '@osf/shared/helpers/citation-formatter.helper'; +import { AddonOperationInvocationService } from '@osf/shared/services/addons/addon-operation-invocation.service'; +import { AddonsService } from '@osf/shared/services/addons/addons.service'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; +import { OperationInvocation } from '@shared/models/addons/operation-invocation.model'; +import { StorageItem } from '@shared/models/addons/storage-item.model'; import { AddonTreeItem, FormattedCitationItem } from '../../models'; import { CitationItemComponent } from '../citation-item/citation-item.component'; diff --git a/src/app/features/project/overview/components/citation-item/citation-item.component.spec.ts b/src/app/features/project/overview/components/citation-item/citation-item.component.spec.ts index a3a66cd0e..35a6b5581 100644 --- a/src/app/features/project/overview/components/citation-item/citation-item.component.spec.ts +++ b/src/app/features/project/overview/components/citation-item/citation-item.component.spec.ts @@ -3,12 +3,13 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { Clipboard } from '@angular/cdk/clipboard'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { IconComponent } from '@shared/components'; -import { TranslateServiceMock } from '@shared/mocks'; -import { ToastService } from '@shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { ToastService } from '@shared/services/toast.service'; import { CitationItemComponent } from './citation-item.component'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; + describe('CitationItemComponent', () => { let component: CitationItemComponent; let fixture: ComponentFixture; diff --git a/src/app/features/project/overview/components/citation-item/citation-item.component.ts b/src/app/features/project/overview/components/citation-item/citation-item.component.ts index 02eaa158c..9b86bb89b 100644 --- a/src/app/features/project/overview/components/citation-item/citation-item.component.ts +++ b/src/app/features/project/overview/components/citation-item/citation-item.component.ts @@ -5,8 +5,8 @@ import { Tooltip } from 'primeng/tooltip'; import { Clipboard } from '@angular/cdk/clipboard'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; -import { IconComponent } from '@shared/components'; -import { ToastService } from '@shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { ToastService } from '@osf/shared/services/toast.service'; @Component({ selector: 'osf-citation-item', diff --git a/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.ts b/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.ts index fcbd08125..ae96bb45a 100644 --- a/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.ts +++ b/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.ts @@ -13,9 +13,10 @@ import { FormsModule } from '@angular/forms'; import { DeleteProject, SettingsSelectors } from '@osf/features/project/settings/store'; import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; -import { ScientistsNames } from '@osf/shared/constants'; -import { ResourceType, UserPermissions } from '@osf/shared/enums'; -import { ToastService } from '@osf/shared/services'; +import { ScientistsNames } from '@osf/shared/constants/scientists.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { GetComponents, ProjectOverviewSelectors } from '../../store'; @@ -30,16 +31,19 @@ import { GetComponents, ProjectOverviewSelectors } from '../../store'; export class DeleteComponentDialogComponent { private dialogConfig = inject(DynamicDialogConfig); private toastService = inject(ToastService); + dialogRef = inject(DynamicDialogRef); destroyRef = inject(DestroyRef); - private componentId = signal(this.dialogConfig.data.componentId); + scientistNames = ScientistsNames; + project = select(ProjectOverviewSelectors.getProject); registration = select(RegistryOverviewSelectors.getRegistry); isSubmitting = select(SettingsSelectors.isSettingsSubmitting); isLoading = select(CurrentResourceSelectors.isResourceWithChildrenLoading); components = select(CurrentResourceSelectors.getResourceWithChildren); userInput = signal(''); + selectedScientist = computed(() => { const names = Object.values(this.scientistNames); return names[Math.floor(Math.random() * names.length)]; diff --git a/src/app/features/project/overview/components/delete-node-link-dialog/delete-node-link-dialog.component.ts b/src/app/features/project/overview/components/delete-node-link-dialog/delete-node-link-dialog.component.ts index 78311fe83..5fd2ff58e 100644 --- a/src/app/features/project/overview/components/delete-node-link-dialog/delete-node-link-dialog.component.ts +++ b/src/app/features/project/overview/components/delete-node-link-dialog/delete-node-link-dialog.component.ts @@ -7,7 +7,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, DestroyRef, inject } from '@angular/core'; -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeleteNodeLink, GetLinkedResources, NodeLinksSelectors } from '@osf/shared/stores/node-links'; import { ProjectOverviewSelectors } from '../../store'; @@ -24,6 +24,7 @@ export class DeleteNodeLinkDialogComponent { private dialogConfig = inject(DynamicDialogConfig); dialogRef = inject(DynamicDialogRef); destroyRef = inject(DestroyRef); + currentProject = select(ProjectOverviewSelectors.getProject); isSubmitting = select(NodeLinksSelectors.getNodeLinksSubmitting); diff --git a/src/app/features/project/overview/components/duplicate-dialog/duplicate-dialog.component.ts b/src/app/features/project/overview/components/duplicate-dialog/duplicate-dialog.component.ts index 36ae89d50..bfb41ddac 100644 --- a/src/app/features/project/overview/components/duplicate-dialog/duplicate-dialog.component.ts +++ b/src/app/features/project/overview/components/duplicate-dialog/duplicate-dialog.component.ts @@ -8,7 +8,7 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, DestroyRef, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DuplicateProject, ProjectOverviewSelectors } from '../../store'; @@ -24,6 +24,7 @@ export class DuplicateDialogComponent { private toastService = inject(ToastService); dialogRef = inject(DynamicDialogRef); destroyRef = inject(DestroyRef); + isSubmitting = select(ProjectOverviewSelectors.getDuplicateProjectSubmitting); handleDuplicateConfirm(): void { diff --git a/src/app/features/project/overview/components/files-widget/files-widget.component.spec.ts b/src/app/features/project/overview/components/files-widget/files-widget.component.spec.ts index e6cf5e013..aa2ef7e01 100644 --- a/src/app/features/project/overview/components/files-widget/files-widget.component.spec.ts +++ b/src/app/features/project/overview/components/files-widget/files-widget.component.spec.ts @@ -1,5 +1,10 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; + import { FilesWidgetComponent } from './files-widget.component'; describe.skip('FilesWidgetComponent', () => { @@ -8,7 +13,7 @@ describe.skip('FilesWidgetComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FilesWidgetComponent], + imports: [FilesWidgetComponent, ...MockComponents(SelectComponent, FilesTreeComponent)], }).compileComponents(); fixture = TestBed.createComponent(FilesWidgetComponent); diff --git a/src/app/features/project/overview/components/files-widget/files-widget.component.ts b/src/app/features/project/overview/components/files-widget/files-widget.component.ts index 5da1d3314..be019d008 100644 --- a/src/app/features/project/overview/components/files-widget/files-widget.component.ts +++ b/src/app/features/project/overview/components/files-widget/files-widget.component.ts @@ -29,17 +29,17 @@ import { ResetState, SetCurrentFolder, } from '@osf/features/files/store'; -import { FilesTreeComponent, SelectComponent } from '@osf/shared/components'; -import { getViewOnlyParamFromUrl, hasViewOnlyParam, Primitive } from '@osf/shared/helpers'; -import { - ConfiguredAddonModel, - FileFolderModel, - FileLabelModel, - FileModel, - NodeShortInfoModel, - SelectOption, -} from '@osf/shared/models'; -import { ProjectModel } from '@osf/shared/models/projects'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { Primitive } from '@osf/shared/helpers/types.helper'; +import { getViewOnlyParamFromUrl, hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { FileLabelModel } from '@osf/shared/models/files/file-label.model'; +import { NodeShortInfoModel } from '@osf/shared/models/nodes/node-with-children.model'; +import { ProjectModel } from '@osf/shared/models/projects/projects.models'; +import { SelectOption } from '@osf/shared/models/select-option.model'; @Component({ selector: 'osf-files-widget', diff --git a/src/app/features/project/overview/components/fork-dialog/fork-dialog.component.ts b/src/app/features/project/overview/components/fork-dialog/fork-dialog.component.ts index ef8236097..07db006ea 100644 --- a/src/app/features/project/overview/components/fork-dialog/fork-dialog.component.ts +++ b/src/app/features/project/overview/components/fork-dialog/fork-dialog.component.ts @@ -10,8 +10,8 @@ import { finalize } from 'rxjs'; import { ChangeDetectionStrategy, Component, DestroyRef, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { ToolbarResource } from '@osf/shared/models'; -import { ToastService } from '@osf/shared/services'; +import { ToolbarResource } from '@osf/shared/models/toolbar-resource.model'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ForkResource, ProjectOverviewSelectors } from '../../store'; diff --git a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.spec.ts b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.spec.ts index 056e11a86..d50e2396f 100644 --- a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.spec.ts +++ b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; + import { LinkResourceDialogComponent } from './link-resource-dialog.component'; describe('LinkProjectDialogComponent', () => { @@ -8,7 +12,7 @@ describe('LinkProjectDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [LinkResourceDialogComponent], + imports: [LinkResourceDialogComponent, ...MockComponents(SearchInputComponent)], }).compileComponents(); fixture = TestBed.createComponent(LinkResourceDialogComponent); diff --git a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts index d0625131a..7c880f723 100644 --- a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts +++ b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts @@ -25,11 +25,13 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule } from '@angular/forms'; -import { SearchInputComponent } from '@osf/shared/components'; -import { ResourceSearchMode, ResourceType } from '@osf/shared/enums'; -import { MyResourcesItem, MyResourcesSearchFilters } from '@osf/shared/models'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { ResourceSearchMode } from '@osf/shared/enums/resource-search-mode.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { GetMyProjects, GetMyRegistrations, MyResourcesSelectors } from '@osf/shared/stores/my-resources'; import { CreateNodeLink, DeleteNodeLink, GetLinkedResources, NodeLinksSelectors } from '@osf/shared/stores/node-links'; +import { MyResourcesItem } from '@shared/models/my-resources/my-resources.models'; +import { MyResourcesSearchFilters } from '@shared/models/my-resources/my-resources-search-filters.models'; import { ProjectOverviewSelectors } from '../../store'; diff --git a/src/app/features/project/overview/components/linked-resources/linked-resources.component.spec.ts b/src/app/features/project/overview/components/linked-resources/linked-resources.component.spec.ts index 87c5617ea..d3d067689 100644 --- a/src/app/features/project/overview/components/linked-resources/linked-resources.component.spec.ts +++ b/src/app/features/project/overview/components/linked-resources/linked-resources.component.spec.ts @@ -1,5 +1,11 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; + import { LinkedResourcesComponent } from './linked-resources.component'; describe('LinkedProjectsComponent', () => { @@ -8,7 +14,10 @@ describe('LinkedProjectsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [LinkedResourcesComponent], + imports: [ + LinkedResourcesComponent, + ...MockComponents(TruncatedTextComponent, IconComponent, ContributorsListComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(LinkedResourcesComponent); diff --git a/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts b/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts index 503e1f984..eee5c3f0b 100644 --- a/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts +++ b/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts @@ -7,8 +7,10 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; -import { ContributorsListComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { CustomDialogService } from '@osf/shared/services'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { NodeLinksSelectors } from '@osf/shared/stores/node-links'; import { DeleteNodeLinkDialogComponent } from '../delete-node-link-dialog/delete-node-link-dialog.component'; diff --git a/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts b/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts index addec8fa1..3001f29d7 100644 --- a/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts +++ b/src/app/features/project/overview/components/overview-collections/overview-collections.component.ts @@ -12,8 +12,9 @@ import { Router } from '@angular/router'; import { collectionFilterNames } from '@osf/features/collections/constants'; import { SubmissionReviewStatus } from '@osf/features/moderation/enums'; -import { StopPropagationDirective } from '@osf/shared/directives'; -import { CollectionSubmission, ResourceOverview } from '@osf/shared/models'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; +import { CollectionSubmission } from '@osf/shared/models/collections/collections.models'; +import { ResourceOverview } from '@osf/shared/models/resource-overview.model'; import { CollectionsSelectors, GetProjectSubmissions } from '@osf/shared/stores/collections'; @Component({ diff --git a/src/app/features/project/overview/components/overview-components/overview-components.component.spec.ts b/src/app/features/project/overview/components/overview-components/overview-components.component.spec.ts index db6a1f441..c491ceee6 100644 --- a/src/app/features/project/overview/components/overview-components/overview-components.component.spec.ts +++ b/src/app/features/project/overview/components/overview-components/overview-components.component.spec.ts @@ -1,5 +1,11 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; + import { OverviewComponentsComponent } from './overview-components.component'; describe('ProjectComponentsComponent', () => { @@ -8,7 +14,10 @@ describe('ProjectComponentsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [OverviewComponentsComponent], + imports: [ + OverviewComponentsComponent, + ...MockComponents(TruncatedTextComponent, IconComponent, ContributorsListComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(OverviewComponentsComponent); diff --git a/src/app/features/project/overview/components/overview-components/overview-components.component.ts b/src/app/features/project/overview/components/overview-components/overview-components.component.ts index 3f08be57b..f440c8476 100644 --- a/src/app/features/project/overview/components/overview-components/overview-components.component.ts +++ b/src/app/features/project/overview/components/overview-components/overview-components.component.ts @@ -9,11 +9,15 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; import { Router } from '@angular/router'; -import { ContributorsListComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components'; -import { ResourceType, UserPermissions } from '@osf/shared/enums'; -import { CustomDialogService, LoaderService } from '@osf/shared/services'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { GetResourceWithChildren } from '@osf/shared/stores/current-resource'; -import { ComponentOverview } from '@shared/models'; +import { ComponentOverview } from '@shared/models/components/components.models'; import { LoadMoreComponents, ProjectOverviewSelectors } from '../../store'; import { AddComponentDialogComponent } from '../add-component-dialog/add-component-dialog.component'; diff --git a/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.spec.ts b/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.spec.ts index 81bbf3d6d..849f3a136 100644 --- a/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.spec.ts +++ b/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.spec.ts @@ -1,5 +1,11 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; + import { OverviewParentProjectComponent } from './overview-parent-project.component'; describe.skip('OverviewParentProjectComponent', () => { @@ -8,7 +14,10 @@ describe.skip('OverviewParentProjectComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [OverviewParentProjectComponent], + imports: [ + OverviewParentProjectComponent, + ...MockComponents(TruncatedTextComponent, IconComponent, ContributorsListComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(OverviewParentProjectComponent); diff --git a/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.ts b/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.ts index 38bc8177a..a9a12d3c5 100644 --- a/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.ts +++ b/src/app/features/project/overview/components/overview-parent-project/overview-parent-project.component.ts @@ -10,7 +10,9 @@ import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core import { Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { ContributorsListComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; import { ProjectOverview } from '../../models'; diff --git a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.spec.ts b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.spec.ts index 39174c9be..2bbf37687 100644 --- a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.spec.ts +++ b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { SocialsShareButtonComponent } from '@osf/shared/components/socials-share-button/socials-share-button.component'; + import { OverviewToolbarComponent } from './overview-toolbar.component'; describe('OverviewToolbarComponent', () => { @@ -8,7 +12,7 @@ describe('OverviewToolbarComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [OverviewToolbarComponent], + imports: [OverviewToolbarComponent, MockComponent(SocialsShareButtonComponent)], }).compileComponents(); fixture = TestBed.createComponent(OverviewToolbarComponent); diff --git a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts index 907acd44f..3fc03c67e 100644 --- a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts +++ b/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts @@ -17,14 +17,15 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { UserSelectors } from '@core/store/user'; import { ClearDuplicatedProject, ProjectOverviewSelectors } from '@osf/features/project/overview/store'; -import { SocialsShareButtonComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { ToolbarResource } from '@osf/shared/models'; -import { FileSizePipe } from '@osf/shared/pipes'; -import { CustomDialogService, ToastService } from '@osf/shared/services'; +import { SocialsShareButtonComponent } from '@osf/shared/components/socials-share-button/socials-share-button.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { ToolbarResource } from '@osf/shared/models/toolbar-resource.model'; +import { FileSizePipe } from '@osf/shared/pipes/file-size.pipe'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddResourceToBookmarks, BookmarksSelectors, RemoveResourceFromBookmarks } from '@osf/shared/stores/bookmarks'; import { GetMyBookmarks, MyResourcesSelectors } from '@osf/shared/stores/my-resources'; -import { hasViewOnlyParam } from '@shared/helpers'; import { DuplicateDialogComponent } from '../duplicate-dialog/duplicate-dialog.component'; import { ForkDialogComponent } from '../fork-dialog/fork-dialog.component'; diff --git a/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.spec.ts b/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.spec.ts index 6c27150d3..c74ebc7c5 100644 --- a/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.spec.ts +++ b/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.spec.ts @@ -1,5 +1,10 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MarkdownComponent } from '@osf/shared/components/markdown/markdown.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; + import { OverviewWikiComponent } from './overview-wiki.component'; describe('ProjectWikiComponent', () => { @@ -8,7 +13,7 @@ describe('ProjectWikiComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [OverviewWikiComponent], + imports: [OverviewWikiComponent, ...MockComponents(TruncatedTextComponent, MarkdownComponent)], }).compileComponents(); fixture = TestBed.createComponent(OverviewWikiComponent); diff --git a/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.ts b/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.ts index ee38257ec..ff8f18716 100644 --- a/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.ts +++ b/src/app/features/project/overview/components/overview-wiki/overview-wiki.component.ts @@ -8,7 +8,8 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core'; import { Router } from '@angular/router'; -import { MarkdownComponent, TruncatedTextComponent } from '@osf/shared/components'; +import { MarkdownComponent } from '@osf/shared/components/markdown/markdown.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; import { WikiSelectors } from '@osf/shared/stores/wiki'; @Component({ diff --git a/src/app/features/project/overview/components/recent-activity/recent-activity.component.spec.ts b/src/app/features/project/overview/components/recent-activity/recent-activity.component.spec.ts index 4ee925800..472d68ae9 100644 --- a/src/app/features/project/overview/components/recent-activity/recent-activity.component.spec.ts +++ b/src/app/features/project/overview/components/recent-activity/recent-activity.component.spec.ts @@ -1,6 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslateService } from '@ngx-translate/core'; +import { MockComponent } from 'ng-mocks'; import { of } from 'rxjs'; @@ -9,7 +10,8 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { ActivityLogDisplayService } from '@shared/services'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { ActivityLogDisplayService } from '@osf/shared/services/activity-logs'; import { GetActivityLogs } from '@shared/stores/activity-logs'; import { ActivityLogsState } from '@shared/stores/activity-logs/activity-logs.state'; @@ -21,13 +23,11 @@ describe('RecentActivityComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RecentActivityComponent], + imports: [RecentActivityComponent, MockComponent(CustomPaginatorComponent)], providers: [ provideStore([ActivityLogsState]), - provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), - { provide: TranslateService, useValue: { @@ -39,7 +39,6 @@ describe('RecentActivityComponent', () => { onTranslationChange: of({}), }, }, - { provide: ActivatedRoute, useValue: { snapshot: { params: { id: 'proj123' } }, parent: null } }, { provide: ActivityLogDisplayService, useValue: { getActivityDisplay: jest.fn().mockReturnValue('FMT') } }, ], diff --git a/src/app/features/project/overview/components/recent-activity/recent-activity.component.ts b/src/app/features/project/overview/components/recent-activity/recent-activity.component.ts index 7b363709d..eb2b434f4 100644 --- a/src/app/features/project/overview/components/recent-activity/recent-activity.component.ts +++ b/src/app/features/project/overview/components/recent-activity/recent-activity.component.ts @@ -9,8 +9,8 @@ import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { CustomPaginatorComponent } from '@osf/shared/components'; -import { ActivityLogDisplayService } from '@osf/shared/services'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { ActivityLogDisplayService } from '@osf/shared/services/activity-logs/activity-log-display.service'; import { ActivityLogsSelectors, GetActivityLogs } from '@osf/shared/stores/activity-logs'; @Component({ diff --git a/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.spec.ts b/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.spec.ts index a20f8649d..2317769dd 100644 --- a/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.spec.ts +++ b/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.spec.ts @@ -1,5 +1,10 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentsSelectionListComponent } from '@osf/shared/components/components-selection-list/components-selection-list.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; + import { TogglePublicityDialogComponent } from './toggle-publicity-dialog.component'; describe('TogglePublicityDialogComponent', () => { @@ -8,7 +13,10 @@ describe('TogglePublicityDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [TogglePublicityDialogComponent], + imports: [ + TogglePublicityDialogComponent, + ...MockComponents(ComponentsSelectionListComponent, LoadingSpinnerComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(TogglePublicityDialogComponent); diff --git a/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.ts b/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.ts index 615be3309..6391c7499 100644 --- a/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.ts +++ b/src/app/features/project/overview/components/toggle-publicity-dialog/toggle-publicity-dialog.component.ts @@ -17,11 +17,12 @@ import { } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { ComponentsSelectionListComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { UserPermissions } from '@osf/shared/enums'; -import { ComponentCheckboxItemModel } from '@osf/shared/models'; -import { ToastService } from '@osf/shared/services'; +import { ComponentsSelectionListComponent } from '@osf/shared/components/components-selection-list/components-selection-list.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; +import { ComponentCheckboxItemModel } from '@shared/models/component-checkbox-item.model'; import { TogglePublicityStep } from '../../enums'; import { PrivacyStatusModel } from '../../models'; diff --git a/src/app/features/project/overview/mappers/project-overview.mapper.ts b/src/app/features/project/overview/mappers/project-overview.mapper.ts index 2869c9820..90b7ce0e1 100644 --- a/src/app/features/project/overview/mappers/project-overview.mapper.ts +++ b/src/app/features/project/overview/mappers/project-overview.mapper.ts @@ -1,5 +1,6 @@ -import { ContributorsMapper, InstitutionsMapper } from '@shared/mappers'; -import { LicenseModel } from '@shared/models'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; +import { InstitutionsMapper } from '@osf/shared/mappers/institutions'; +import { LicenseModel } from '@shared/models/license/license.model'; import { ProjectOverview, ProjectOverviewGetResponseJsonApi } from '../models'; diff --git a/src/app/features/project/overview/models/addon-tree-item.model.ts b/src/app/features/project/overview/models/addon-tree-item.model.ts index 9d6855c72..c71088ab1 100644 --- a/src/app/features/project/overview/models/addon-tree-item.model.ts +++ b/src/app/features/project/overview/models/addon-tree-item.model.ts @@ -1,4 +1,4 @@ -import { StorageItem } from '@shared/models'; +import { StorageItem } from '@osf/shared/models/addons/storage-item.model'; export interface AddonTreeItem { item: StorageItem; diff --git a/src/app/features/project/overview/models/formatted-citation-item.model.ts b/src/app/features/project/overview/models/formatted-citation-item.model.ts index a6f96bf52..68700f233 100644 --- a/src/app/features/project/overview/models/formatted-citation-item.model.ts +++ b/src/app/features/project/overview/models/formatted-citation-item.model.ts @@ -1,4 +1,4 @@ -import { StorageItem } from '@shared/models'; +import { StorageItem } from '@osf/shared/models/addons/storage-item.model'; export interface FormattedCitationItem { item: StorageItem; diff --git a/src/app/features/project/overview/models/project-overview.models.ts b/src/app/features/project/overview/models/project-overview.models.ts index 8fedc266b..1654c6a61 100644 --- a/src/app/features/project/overview/models/project-overview.models.ts +++ b/src/app/features/project/overview/models/project-overview.models.ts @@ -1,16 +1,12 @@ -import { UserPermissions } from '@osf/shared/enums'; -import { - ContributorDataJsonApi, - ContributorModel, - Identifier, - IdTypeModel, - Institution, - InstitutionsJsonApiResponse, - JsonApiResponseWithMeta, - LicenseModel, - LicensesOption, - MetaAnonymousJsonApi, -} from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { IdTypeModel } from '@shared/models/common/id-type.model'; +import { JsonApiResponseWithMeta, MetaAnonymousJsonApi } from '@shared/models/common/json-api.model'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorDataJsonApi } from '@shared/models/contributors/contributor-response-json-api.model'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; +import { InstitutionsJsonApiResponse } from '@shared/models/institutions/institution-json-api.model'; +import { Institution } from '@shared/models/institutions/institutions.models'; +import { LicenseModel, LicensesOption } from '@shared/models/license/license.model'; export interface ProjectOverview { id: string; @@ -37,7 +33,7 @@ export interface ProjectOverview { storageLimitStatus: string; storageUsage: string; }; - identifiers?: Identifier[]; + identifiers?: IdentifierModel[]; supplements?: ProjectSupplements[]; analyticsKey: string; currentUserCanComment: boolean; diff --git a/src/app/features/project/overview/project-overview.component.spec.ts b/src/app/features/project/overview/project-overview.component.spec.ts index fc7b4fd53..17909dcbc 100644 --- a/src/app/features/project/overview/project-overview.component.spec.ts +++ b/src/app/features/project/overview/project-overview.component.spec.ts @@ -1,6 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslateService } from '@ngx-translate/core'; +import { MockComponents } from 'ng-mocks'; import { DialogService } from 'primeng/dynamicdialog'; @@ -11,10 +12,25 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { MetaTagsService, ToastService } from '@osf/shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { GetActivityLogs } from '@shared/stores/activity-logs'; +import { OverviewParentProjectComponent } from './components/overview-parent-project/overview-parent-project.component'; +import { + CitationAddonCardComponent, + FilesWidgetComponent, + LinkedResourcesComponent, + OverviewComponentsComponent, + OverviewToolbarComponent, + OverviewWikiComponent, + RecentActivityComponent, +} from './components'; import { ProjectOverviewComponent } from './project-overview.component'; import { DataciteMockFactory } from '@testing/mocks/datacite.service.mock'; @@ -29,16 +45,29 @@ describe('ProjectOverviewComponent', () => { TestBed.overrideComponent(ProjectOverviewComponent, { set: { template: '' } }); dataciteService = DataciteMockFactory(); await TestBed.configureTestingModule({ - imports: [ProjectOverviewComponent], + imports: [ + ProjectOverviewComponent, + ...MockComponents( + SubHeaderComponent, + LoadingSpinnerComponent, + OverviewWikiComponent, + OverviewComponentsComponent, + LinkedResourcesComponent, + RecentActivityComponent, + OverviewToolbarComponent, + ResourceMetadataComponent, + FilesWidgetComponent, + ViewOnlyLinkMessageComponent, + OverviewParentProjectComponent, + CitationAddonCardComponent + ), + ], providers: [ provideStore([]), - { provide: ActivatedRoute, useValue: { snapshot: { params: { id: 'proj123' } }, parent: null } }, - provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), { provide: DataciteService, useValue: dataciteService }, - { provide: DialogService, useValue: { open: () => ({ onClose: of(null) }) } }, { provide: TranslateService, useValue: { instant: (k: string) => k } }, { provide: ToastService, useValue: { showSuccess: jest.fn() } }, diff --git a/src/app/features/project/overview/project-overview.component.ts b/src/app/features/project/overview/project-overview.component.ts index 291cb4254..76f2bf562 100644 --- a/src/app/features/project/overview/project-overview.component.ts +++ b/src/app/features/project/overview/project-overview.component.ts @@ -29,10 +29,18 @@ import { CollectionsModerationSelectors, GetSubmissionsReviewActions, } from '@osf/features/moderation/store/collections-moderation'; -import { Mode, ResourceType } from '@osf/shared/enums'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; -import { MapProjectOverview } from '@osf/shared/mappers'; -import { CustomDialogService, MetaTagsService, ToastService } from '@osf/shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { MakeDecisionDialogComponent } from '@osf/shared/components/make-decision-dialog/make-decision-dialog.component'; +import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { Mode } from '@osf/shared/enums/mode.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { MapProjectOverview } from '@osf/shared/mappers/resource-overview.mappers'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { GetActivityLogs } from '@osf/shared/stores/activity-logs'; import { AddonsSelectors, @@ -53,13 +61,6 @@ import { CurrentResourceSelectors, GetResourceWithChildren } from '@osf/shared/s import { GetLinkedResources } from '@osf/shared/stores/node-links'; import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects'; import { ClearWiki, GetHomeWiki } from '@osf/shared/stores/wiki'; -import { - LoadingSpinnerComponent, - MakeDecisionDialogComponent, - ResourceMetadataComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@shared/components'; import { AnalyticsService } from '@shared/services/analytics.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; diff --git a/src/app/features/project/overview/services/project-overview.service.ts b/src/app/features/project/overview/services/project-overview.service.ts index eb8bf543a..ff98df198 100644 --- a/src/app/features/project/overview/services/project-overview.service.ts +++ b/src/app/features/project/overview/services/project-overview.service.ts @@ -6,17 +6,15 @@ import { inject, Injectable } from '@angular/core'; import { BYPASS_ERROR_INTERCEPTOR } from '@core/interceptors/error-interceptor.tokens'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { BaseNodeMapper, ComponentsMapper } from '@osf/shared/mappers'; -import { - BaseNodeDataJsonApi, - BaseNodeModel, - ComponentGetResponseJsonApi, - ComponentOverview, - JsonApiResponse, - PaginatedData, - ResponseJsonApi, -} from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { ComponentsMapper } from '@osf/shared/mappers/components'; +import { BaseNodeMapper } from '@osf/shared/mappers/nodes'; +import { JsonApiResponse, ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { ComponentGetResponseJsonApi } from '@osf/shared/models/components/component-json-api.model'; +import { ComponentOverview } from '@osf/shared/models/components/components.models'; +import { BaseNodeModel } from '@osf/shared/models/nodes/base-node.model'; +import { BaseNodeDataJsonApi } from '@osf/shared/models/nodes/base-node-data-json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { ProjectOverviewMapper } from '../mappers'; import { PrivacyStatusModel, ProjectOverviewResponseJsonApi, ProjectOverviewWithMeta } from '../models'; diff --git a/src/app/features/project/overview/store/project-overview.actions.ts b/src/app/features/project/overview/store/project-overview.actions.ts index 7c812c118..0dd4b7ff8 100644 --- a/src/app/features/project/overview/store/project-overview.actions.ts +++ b/src/app/features/project/overview/store/project-overview.actions.ts @@ -1,5 +1,5 @@ -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ResourceType } from '@shared/enums'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ResourceType } from '@shared/enums/resource-type.enum'; import { PrivacyStatusModel } from '../models'; diff --git a/src/app/features/project/overview/store/project-overview.model.ts b/src/app/features/project/overview/store/project-overview.model.ts index 7bafca3fc..1d84b6de5 100644 --- a/src/app/features/project/overview/store/project-overview.model.ts +++ b/src/app/features/project/overview/store/project-overview.model.ts @@ -1,4 +1,7 @@ -import { AsyncStateModel, AsyncStateWithTotalCount, BaseNodeModel, ComponentOverview } from '@osf/shared/models'; +import { ComponentOverview } from '@osf/shared/models/components/components.models'; +import { BaseNodeModel } from '@osf/shared/models/nodes/base-node.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { ProjectOverview } from '../models'; diff --git a/src/app/features/project/overview/store/project-overview.selectors.ts b/src/app/features/project/overview/store/project-overview.selectors.ts index a0948c18f..6cf5bfc92 100644 --- a/src/app/features/project/overview/store/project-overview.selectors.ts +++ b/src/app/features/project/overview/store/project-overview.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { ProjectOverviewStateModel } from './project-overview.model'; import { ProjectOverviewState } from './project-overview.state'; diff --git a/src/app/features/project/overview/store/project-overview.state.ts b/src/app/features/project/overview/store/project-overview.state.ts index 0ba05b25c..b701970a4 100644 --- a/src/app/features/project/overview/store/project-overview.state.ts +++ b/src/app/features/project/overview/store/project-overview.state.ts @@ -4,8 +4,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { ResourceType } from '@shared/enums'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { ResourceType } from '@shared/enums/resource-type.enum'; import { ProjectOverviewService } from '../services'; diff --git a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.spec.ts b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.spec.ts index 182e23e10..4d90a86ee 100644 --- a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.spec.ts +++ b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.spec.ts @@ -1,5 +1,7 @@ import { provideStore } from '@ngxs/store'; +import { MockComponents } from 'ng-mocks'; + import { MessageService } from 'primeng/api'; import { of } from 'rxjs'; @@ -8,6 +10,8 @@ import { HttpTestingController } from '@angular/common/http/testing'; import { ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; +import { StorageItemSelectorComponent } from '@osf/shared/components/addons/storage-item-selector/storage-item-selector.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { AddonsState } from '@osf/shared/stores/addons'; import { ConfigureAddonComponent } from './configure-addon.component'; @@ -57,7 +61,11 @@ describe.skip('Component: Configure Addon', () => { } as unknown as Router; await TestBed.configureTestingModule({ - imports: [OSFTestingModule, ConfigureAddonComponent], + imports: [ + OSFTestingModule, + ConfigureAddonComponent, + ...MockComponents(SubHeaderComponent, StorageItemSelectorComponent), + ], providers: [ provideStore([AddonsState]), ToastServiceMock, diff --git a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts index 20a3b1cce..8471df83d 100644 --- a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts +++ b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts @@ -21,12 +21,17 @@ import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { StorageItemSelectorComponent } from '@osf/shared/components/addons'; -import { AddonServiceNames, AddonType, OperationNames } from '@osf/shared/enums'; -import { getAddonTypeString } from '@osf/shared/helpers'; -import { AddonModel, ConfiguredAddonModel } from '@osf/shared/models'; -import { AddonFormService, AddonOperationInvocationService, ToastService } from '@osf/shared/services'; +import { StorageItemSelectorComponent } from '@osf/shared/components/addons/storage-item-selector/storage-item-selector.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { AddonServiceNames } from '@osf/shared/enums/addon-service-names.enum'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { getAddonTypeString } from '@osf/shared/helpers/addon-type.helper'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { AddonFormService } from '@osf/shared/services/addons/addon-form.service'; +import { AddonOperationInvocationService } from '@osf/shared/services/addons/addon-operation-invocation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddonsSelectors, ClearOperationInvocations, diff --git a/src/app/features/project/project-addons/components/confirm-account-connection-modal/confirm-account-connection-modal.component.ts b/src/app/features/project/project-addons/components/confirm-account-connection-modal/confirm-account-connection-modal.component.ts index 8ea7fda4b..ceb0de46f 100644 --- a/src/app/features/project/project-addons/components/confirm-account-connection-modal/confirm-account-connection-modal.component.ts +++ b/src/app/features/project/project-addons/components/confirm-account-connection-modal/confirm-account-connection-modal.component.ts @@ -8,9 +8,9 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; -import { AddonOperationInvocationService } from '@osf/shared/services'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { AddonOperationInvocationService } from '@osf/shared/services/addons/addon-operation-invocation.service'; import { AddonsSelectors, CreateAddonOperationInvocation } from '@osf/shared/stores/addons'; -import { OperationNames } from '@shared/enums'; @Component({ selector: 'osf-confirm-account-connection-modal', diff --git a/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.spec.ts b/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.spec.ts index 3265fb48a..90806b9ff 100644 --- a/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.spec.ts +++ b/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.spec.ts @@ -1,7 +1,7 @@ import { Store } from '@ngxs/store'; import { TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; +import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -9,10 +9,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { provideNoopAnimations } from '@angular/platform-browser/animations'; import { ActivatedRoute, Navigation, Router, UrlTree } from '@angular/router'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { CredentialsFormat } from '@shared/enums'; -import { AddonModel } from '@shared/models'; -import { AddonsSelectors } from '@shared/stores/addons'; +import { AddonSetupAccountFormComponent } from '@osf/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component'; +import { StorageItemSelectorComponent } from '@osf/shared/components/addons/storage-item-selector/storage-item-selector.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CredentialsFormat } from '@osf/shared/enums/addons-credentials-format.enum'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; +import { AddonsSelectors } from '@osf/shared/stores/addons'; import { ConnectConfiguredAddonComponent } from './connect-configured-addon.component'; @@ -44,7 +46,11 @@ describe.skip('ConnectAddonComponent', () => { }; await TestBed.configureTestingModule({ - imports: [ConnectConfiguredAddonComponent, MockComponent(SubHeaderComponent), MockPipe(TranslatePipe)], + imports: [ + ConnectConfiguredAddonComponent, + ...MockComponents(SubHeaderComponent, AddonSetupAccountFormComponent, StorageItemSelectorComponent), + MockPipe(TranslatePipe), + ], providers: [ provideNoopAnimations(), MockProvider(Store, { diff --git a/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts b/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts index 05d1575ee..672c1d02d 100644 --- a/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts +++ b/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts @@ -14,21 +14,23 @@ import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { - AddonSetupAccountFormComponent, - AddonTermsComponent, - StorageItemSelectorComponent, -} from '@osf/shared/components/addons'; -import { AddonServiceNames, AddonType, OperationNames, ProjectAddonsStepperValue } from '@osf/shared/enums'; -import { getAddonTypeString } from '@osf/shared/helpers'; -import { AddonModel, AddonTerm, AuthorizedAccountModel, AuthorizedAddonRequestJsonApi } from '@osf/shared/models'; -import { - AddonFormService, - AddonOAuthService, - AddonOperationInvocationService, - ToastService, -} from '@osf/shared/services'; +import { AddonSetupAccountFormComponent } from '@osf/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component'; +import { AddonTermsComponent } from '@osf/shared/components/addons/addon-terms/addon-terms.component'; +import { StorageItemSelectorComponent } from '@osf/shared/components/addons/storage-item-selector/storage-item-selector.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { AddonServiceNames } from '@osf/shared/enums/addon-service-names.enum'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { ProjectAddonsStepperValue } from '@osf/shared/enums/profile-addons-stepper.enum'; +import { getAddonTypeString } from '@osf/shared/helpers/addon-type.helper'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; +import { AuthorizedAddonRequestJsonApi } from '@osf/shared/models/addons/addon-json-api.models'; +import { AddonTerm } from '@osf/shared/models/addons/addon-utils.models'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; +import { AddonFormService } from '@osf/shared/services/addons/addon-form.service'; +import { AddonOAuthService } from '@osf/shared/services/addons/addon-oauth.service'; +import { AddonOperationInvocationService } from '@osf/shared/services/addons/addon-operation-invocation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddonsSelectors, CreateAddonOperationInvocation, diff --git a/src/app/features/project/project-addons/components/disconnect-addon-modal/disconnect-addon-modal.component.ts b/src/app/features/project/project-addons/components/disconnect-addon-modal/disconnect-addon-modal.component.ts index 56ed5e320..9395b4b6d 100644 --- a/src/app/features/project/project-addons/components/disconnect-addon-modal/disconnect-addon-modal.component.ts +++ b/src/app/features/project/project-addons/components/disconnect-addon-modal/disconnect-addon-modal.component.ts @@ -7,8 +7,8 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; -import { AddonType } from '@osf/shared/enums'; -import { getAddonTypeString } from '@osf/shared/helpers'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { getAddonTypeString } from '@osf/shared/helpers/addon-type.helper'; import { AddonsSelectors, DeleteConfiguredAddon } from '@osf/shared/stores/addons'; @Component({ diff --git a/src/app/features/project/project-addons/models/addon-config-actions.model.ts b/src/app/features/project/project-addons/models/addon-config-actions.model.ts index 59a4313e4..aa4b2645d 100644 --- a/src/app/features/project/project-addons/models/addon-config-actions.model.ts +++ b/src/app/features/project/project-addons/models/addon-config-actions.model.ts @@ -1,6 +1,6 @@ import { Observable } from 'rxjs'; -import { AuthorizedAccountModel } from '@shared/models'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; export interface AddonConfigActions { getAddons: () => Observable; diff --git a/src/app/features/project/project-addons/project-addons.component.spec.ts b/src/app/features/project/project-addons/project-addons.component.spec.ts index e4f6b109b..000118b8b 100644 --- a/src/app/features/project/project-addons/project-addons.component.spec.ts +++ b/src/app/features/project/project-addons/project-addons.component.spec.ts @@ -1,9 +1,16 @@ import { provideStore } from '@ngxs/store'; +import { MockComponents } from 'ng-mocks'; + import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserSelectors, UserState } from '@core/store/user'; +import { AddonCardListComponent } from '@osf/shared/components/addons/addon-card-list/addon-card-list.component'; +import { AddonsToolbarComponent } from '@osf/shared/components/addons/addons-toolbar/addons-toolbar.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { AddonsState } from '@osf/shared/stores/addons'; import { ProjectAddonsComponent } from './project-addons.component'; @@ -16,7 +23,17 @@ describe.skip('Component: Addons', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ProjectAddonsComponent, OSFTestingModule], + imports: [ + ProjectAddonsComponent, + OSFTestingModule, + ...MockComponents( + AddonCardListComponent, + AddonsToolbarComponent, + SubHeaderComponent, + LoadingSpinnerComponent, + SelectComponent + ), + ], providers: [ provideStore([UserState, AddonsState]), { diff --git a/src/app/features/project/project-addons/project-addons.component.ts b/src/app/features/project/project-addons/project-addons.component.ts index 2adad4aac..5ad91d482 100644 --- a/src/app/features/project/project-addons/project-addons.component.ts +++ b/src/app/features/project/project-addons/project-addons.component.ts @@ -23,13 +23,18 @@ import { FormControl, FormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { createAddonCardModel, sortAddonCardsAlphabetically } from '@osf/shared/helpers'; -import { LoadingSpinnerComponent, SelectComponent, SubHeaderComponent } from '@shared/components'; -import { AddonCardListComponent, AddonsToolbarComponent } from '@shared/components/addons'; -import { ADDON_CATEGORY_OPTIONS, ADDON_TAB_OPTIONS } from '@shared/constants'; -import { AddonCategory, AddonTabValue } from '@shared/enums'; -import { isAddonServiceConfigured } from '@shared/helpers'; -import { AddonCardModel } from '@shared/models'; +import { AddonCardListComponent } from '@osf/shared/components/addons/addon-card-list/addon-card-list.component'; +import { AddonsToolbarComponent } from '@osf/shared/components/addons/addons-toolbar/addons-toolbar.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ADDON_CATEGORY_OPTIONS } from '@osf/shared/constants/addons-category-options.const'; +import { ADDON_TAB_OPTIONS } from '@osf/shared/constants/addons-tab-options.const'; +import { AddonTabValue } from '@osf/shared/enums/addon-tab.enum'; +import { AddonCategory } from '@osf/shared/enums/addons-category.enum'; +import { createAddonCardModel, sortAddonCardsAlphabetically } from '@osf/shared/helpers/addon-card.helper'; +import { isAddonServiceConfigured } from '@osf/shared/helpers/addon-type.helper'; +import { AddonCardModel } from '@shared/models/addons/addon-card.model'; import { AddonsQueryParamsService } from '@shared/services/addons-query-params.service'; import { AddonsSelectors, diff --git a/src/app/features/project/project-addons/services/addon-dialog.service.ts b/src/app/features/project/project-addons/services/addon-dialog.service.ts index dc324b48b..e72a58aad 100644 --- a/src/app/features/project/project-addons/services/addon-dialog.service.ts +++ b/src/app/features/project/project-addons/services/addon-dialog.service.ts @@ -6,8 +6,9 @@ import { Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { AddonServiceNames } from '@osf/shared/enums'; -import { AuthorizedAccountModel, ConfiguredAddonModel } from '@osf/shared/models'; +import { AddonServiceNames } from '@osf/shared/enums/addon-service-names.enum'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; import { ConfirmAccountConnectionModalComponent } from '../components/confirm-account-connection-modal/confirm-account-connection-modal.component'; import { DisconnectAddonModalComponent } from '../components/disconnect-addon-modal/disconnect-addon-modal.component'; diff --git a/src/app/features/project/project.component.ts b/src/app/features/project/project.component.ts index b331f2ac3..9fd8a6ad0 100644 --- a/src/app/features/project/project.component.ts +++ b/src/app/features/project/project.component.ts @@ -1,4 +1,3 @@ -import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, HostBinding, inject, OnDestroy } from '@angular/core'; import { RouterOutlet } from '@angular/router'; @@ -6,7 +5,7 @@ import { HelpScoutService } from '@core/services/help-scout.service'; @Component({ selector: 'osf-project', - imports: [RouterOutlet, CommonModule], + imports: [RouterOutlet], templateUrl: './project.component.html', styleUrl: './project.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/project/project.routes.ts b/src/app/features/project/project.routes.ts index a6af0de78..9ff14161f 100644 --- a/src/app/features/project/project.routes.ts +++ b/src/app/features/project/project.routes.ts @@ -2,23 +2,21 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; -import { viewOnlyGuard } from '@osf/core/guards'; -import { ResourceType } from '@osf/shared/enums'; -import { LicensesService } from '@osf/shared/services'; +import { viewOnlyGuard } from '@core/guards/view-only.guard'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { ActivityLogsState } from '@osf/shared/stores/activity-logs'; import { CitationsState } from '@osf/shared/stores/citations'; import { CollectionsState } from '@osf/shared/stores/collections'; import { DuplicatesState } from '@osf/shared/stores/duplicates'; +import { LinkedProjectsState } from '@osf/shared/stores/linked-projects'; import { NodeLinksState } from '@osf/shared/stores/node-links'; import { SubjectsState } from '@osf/shared/stores/subjects'; import { ViewOnlyLinkState } from '@osf/shared/stores/view-only-links'; import { AnalyticsState } from '../analytics/store'; import { CollectionsModerationState } from '../moderation/store/collections-moderation'; -import { RegistriesState } from '../registries/store'; -import { LicensesHandlers, ProjectsHandlers, ProvidersHandlers } from '../registries/store/handlers'; -import { FilesHandlers } from '../registries/store/handlers/files.handlers'; +import { RegistrationsState } from './registrations/store'; import { SettingsState } from './settings/store'; export const projectRoutes: Routes = [ @@ -62,14 +60,7 @@ export const projectRoutes: Routes = [ { path: 'registrations', canActivate: [viewOnlyGuard], - providers: [ - provideStates([RegistriesState]), - ProvidersHandlers, - ProjectsHandlers, - LicensesService, - LicensesHandlers, - FilesHandlers, - ], + providers: [provideStates([RegistrationsState])], loadComponent: () => import('../project/registrations/registrations.component').then((mod) => mod.RegistrationsComponent), }, @@ -99,7 +90,7 @@ export const projectRoutes: Routes = [ import('../analytics/components/view-linked-projects/view-linked-projects.component').then( (mod) => mod.ViewLinkedProjectsComponent ), - providers: [provideStates([DuplicatesState])], + providers: [provideStates([LinkedProjectsState])], }, { path: 'analytics/duplicates', diff --git a/src/app/features/project/registrations/registrations.component.spec.ts b/src/app/features/project/registrations/registrations.component.spec.ts index 8880a5043..286e5b545 100644 --- a/src/app/features/project/registrations/registrations.component.spec.ts +++ b/src/app/features/project/registrations/registrations.component.spec.ts @@ -1,8 +1,13 @@ -import { MockComponent } from 'ng-mocks'; +import { TranslatePipe } from '@ngx-translate/core'; +import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FormsModule } from '@angular/forms'; -import { SubHeaderComponent } from '@osf/shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { RegistrationCardComponent } from '@osf/shared/components/registration-card/registration-card.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { RegistrationsComponent } from './registrations.component'; @@ -12,7 +17,17 @@ describe('RegistrationsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RegistrationsComponent, MockComponent(SubHeaderComponent)], + imports: [ + RegistrationsComponent, + ...MockComponents( + RegistrationCardComponent, + SubHeaderComponent, + FormsModule, + TranslatePipe, + LoadingSpinnerComponent, + CustomPaginatorComponent + ), + ], }).compileComponents(); fixture = TestBed.createComponent(RegistrationsComponent); diff --git a/src/app/features/project/registrations/registrations.component.ts b/src/app/features/project/registrations/registrations.component.ts index bf0102113..c40fee384 100644 --- a/src/app/features/project/registrations/registrations.component.ts +++ b/src/app/features/project/registrations/registrations.component.ts @@ -12,12 +12,10 @@ import { FormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { - CustomPaginatorComponent, - LoadingSpinnerComponent, - RegistrationCardComponent, - SubHeaderComponent, -} from '@osf/shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { RegistrationCardComponent } from '@osf/shared/components/registration-card/registration-card.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { CurrentResourceSelectors } from '@shared/stores/current-resource'; import { GetRegistrations, RegistrationsSelectors } from './store'; diff --git a/src/app/features/project/registrations/services/registrations.service.ts b/src/app/features/project/registrations/services/registrations.service.ts index 93ed14834..c1945dd94 100644 --- a/src/app/features/project/registrations/services/registrations.service.ts +++ b/src/app/features/project/registrations/services/registrations.service.ts @@ -4,8 +4,11 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { RegistrationMapper } from '@osf/shared/mappers/registration'; -import { PaginatedData, RegistrationCard, RegistrationDataJsonApi, ResponseJsonApi } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { RegistrationCard } from '@osf/shared/models/registration/registration-card.model'; +import { RegistrationDataJsonApi } from '@osf/shared/models/registration/registration-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/project/registrations/store/registrations.model.ts b/src/app/features/project/registrations/store/registrations.model.ts index 31a0ea5c0..422997fac 100644 --- a/src/app/features/project/registrations/store/registrations.model.ts +++ b/src/app/features/project/registrations/store/registrations.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateWithTotalCount, RegistrationCard } from '@osf/shared/models'; +import { RegistrationCard } from '@osf/shared/models/registration/registration-card.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface RegistrationsStateModel { registrations: AsyncStateWithTotalCount; diff --git a/src/app/features/project/registrations/store/registrations.state.ts b/src/app/features/project/registrations/store/registrations.state.ts index a6cc768f9..57c576daa 100644 --- a/src/app/features/project/registrations/store/registrations.state.ts +++ b/src/app/features/project/registrations/store/registrations.state.ts @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { RegistrationsService } from '../services'; diff --git a/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.spec.ts b/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.spec.ts new file mode 100644 index 000000000..3d9593542 --- /dev/null +++ b/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.spec.ts @@ -0,0 +1,44 @@ +import { MockProvider } from 'ng-mocks'; + +import { DynamicDialogRef } from 'primeng/dynamicdialog'; + +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ToastService } from '@osf/shared/services/toast.service'; +import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; + +import { SettingsSelectors } from '../../store'; + +import { DeleteProjectDialogComponent } from './delete-project-dialog.component'; + +import { OSFTestingModule } from '@testing/osf.testing.module'; +import { provideMockStore } from '@testing/providers/store-provider.mock'; + +describe('DeleteProjectDialogComponent', () => { + let component: DeleteProjectDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [DeleteProjectDialogComponent, OSFTestingModule], + providers: [ + MockProvider(ToastService), + MockProvider(DynamicDialogRef), + provideMockStore({ + signals: [ + { selector: CurrentResourceSelectors.isResourceWithChildrenLoading, value: false }, + { selector: CurrentResourceSelectors.getResourceWithChildren, value: [] }, + { selector: SettingsSelectors.isSettingsSubmitting, value: false }, + ], + }), + ], + }).compileComponents(); + + fixture = TestBed.createComponent(DeleteProjectDialogComponent); + component = fixture.componentInstance; + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.ts b/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.ts index 39cdb738e..ec54ab464 100644 --- a/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.ts +++ b/src/app/features/project/settings/components/delete-project-dialog/delete-project-dialog.component.ts @@ -12,9 +12,9 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { Router } from '@angular/router'; -import { ScientistsNames } from '@osf/shared/constants'; -import { UserPermissions } from '@osf/shared/enums'; -import { ToastService } from '@osf/shared/services'; +import { ScientistsNames } from '@osf/shared/constants/scientists.const'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { DeleteProject, SettingsSelectors } from '../../store'; diff --git a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts index 028d9b986..59acd3066 100644 --- a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts +++ b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts @@ -2,7 +2,7 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { SelectComponent } from '@shared/components'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { ProjectDetailSettingAccordionComponent } from './project-detail-setting-accordion.component'; diff --git a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts index 0d24079e9..f95e6ed6e 100644 --- a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts +++ b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts @@ -5,7 +5,7 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, input, output, signal } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { SelectComponent } from '@osf/shared/components'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; import { RightControl } from '../../models'; diff --git a/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.spec.ts b/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.spec.ts index b3261b871..a47fe699b 100644 --- a/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.spec.ts +++ b/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.spec.ts @@ -2,13 +2,15 @@ import { MockComponent, MockPipe } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProjectDetailSettingAccordionComponent } from '@osf/features/project/settings/components'; -import { NotificationDescriptionPipe } from '@osf/features/project/settings/pipes'; -import { SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; + +import { NotificationDescriptionPipe } from '../../pipes'; +import { ProjectDetailSettingAccordionComponent } from '../project-detail-setting-accordion/project-detail-setting-accordion.component'; import { ProjectSettingNotificationsComponent } from './project-setting-notifications.component'; -import { MOCK_NOTIFICATION_SUBSCRIPTIONS } from '@testing/mocks'; +import { MOCK_NOTIFICATION_SUBSCRIPTIONS } from '@testing/mocks/notification-subscription.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('ProjectSettingNotificationsComponent', () => { @@ -54,7 +56,7 @@ describe('ProjectSettingNotificationsComponent', () => { fixture.detectChanges(); expect(component.allAccordionData).toBeDefined(); - expect(component.allAccordionData?.length).toBe(4); + expect(component.allAccordionData?.length).toBe(3); if (component.allAccordionData) { expect(component.allAccordionData[0]).toEqual({ @@ -111,7 +113,6 @@ describe('ProjectSettingNotificationsComponent', () => { if (component.allAccordionData) { expect(component.allAccordionData[0].event).toBe(SubscriptionEvent.FileUpdated); expect(component.allAccordionData[1].event).toBe(SubscriptionEvent.GlobalFileUpdated); - expect(component.allAccordionData[2].event).toBe(SubscriptionEvent.GlobalMentions); } }); }); diff --git a/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts b/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts index c00d70582..db78d8652 100644 --- a/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts +++ b/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts @@ -4,8 +4,9 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, effect, input, output } from '@angular/core'; -import { SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums'; -import { NotificationSubscription } from '@osf/shared/models'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; import { RightControl } from '../../models'; import { NotificationDescriptionPipe } from '../../pipes'; @@ -26,6 +27,7 @@ export class ProjectSettingNotificationsComponent { allAccordionData: RightControl[] | undefined = []; readonly subscriptionEvent = SubscriptionEvent; + subscriptionFrequencyOptions = Object.entries(SubscriptionFrequency).map(([key, value]) => ({ label: key, value, diff --git a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.spec.ts b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.spec.ts index 85f9371a3..ab05020fb 100644 --- a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.spec.ts +++ b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Institution } from '@osf/shared/models'; import { InstitutionsSelectors } from '@osf/shared/stores/institutions'; +import { Institution } from '@shared/models/institutions/institutions.models'; import { SettingsProjectAffiliationComponent } from './settings-project-affiliation.component'; -import { MOCK_INSTITUTION } from '@testing/mocks'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts index 9e764d439..cb57d1a0f 100644 --- a/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts +++ b/src/app/features/project/settings/components/settings-project-affiliation/settings-project-affiliation.component.ts @@ -8,7 +8,7 @@ import { Card } from 'primeng/card'; import { NgOptimizedImage } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input, OnInit, output } from '@angular/core'; -import { Institution } from '@osf/shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; import { FetchUserInstitutions, InstitutionsSelectors } from '@shared/stores/institutions'; @Component({ diff --git a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.spec.ts b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.spec.ts index 21b9bf67a..7429159fa 100644 --- a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.spec.ts +++ b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.spec.ts @@ -1,17 +1,18 @@ -import { MockComponent, MockDirective } from 'ng-mocks'; +import { TranslatePipe } from '@ngx-translate/core'; +import { MockComponent, MockDirective, MockPipe } from 'ng-mocks'; import { Textarea } from 'primeng/textarea'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TextInputComponent } from '@osf/shared/components'; -import { ProjectFormControls } from '@osf/shared/enums'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; import { NodeDetailsModel } from '../../models'; import { SettingsProjectFormCardComponent } from './settings-project-form-card.component'; -import { MOCK_NODE_DETAILS } from '@testing/mocks'; +import { MOCK_NODE_DETAILS } from '@testing/mocks/node-details.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('SettingsProjectFormCardComponent', () => { @@ -26,6 +27,7 @@ describe('SettingsProjectFormCardComponent', () => { SettingsProjectFormCardComponent, OSFTestingModule, MockComponent(TextInputComponent), + MockPipe(TranslatePipe), MockDirective(Textarea), ], }).compileComponents(); diff --git a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts index df198ca1a..06621b004 100644 --- a/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts +++ b/src/app/features/project/settings/components/settings-project-form-card/settings-project-form-card.component.ts @@ -7,10 +7,10 @@ import { Textarea } from 'primeng/textarea'; import { ChangeDetectionStrategy, Component, computed, effect, input, output } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { ProjectFormControls } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { NodeDetailsModel, ProjectDetailsModel } from '../../models'; diff --git a/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.spec.ts b/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.spec.ts index 3886cae9f..72f72e818 100644 --- a/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.spec.ts +++ b/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.spec.ts @@ -2,12 +2,12 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ViewOnlyTableComponent } from '@osf/shared/components'; -import { PaginatedViewOnlyLinksModel } from '@osf/shared/models'; +import { ViewOnlyTableComponent } from '@osf/shared/components/view-only-table/view-only-table.component'; +import { PaginatedViewOnlyLinksModel } from '@shared/models/view-only-links/view-only-link.model'; import { SettingsViewOnlyLinksCardComponent } from './settings-view-only-links-card.component'; -import { MOCK_PAGINATED_VIEW_ONLY_LINKS, MOCK_VIEW_ONLY_LINK } from '@testing/mocks'; +import { MOCK_PAGINATED_VIEW_ONLY_LINKS, MOCK_VIEW_ONLY_LINK } from '@testing/mocks/view-only-link.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('SettingsViewOnlyLinksCardComponent', () => { diff --git a/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.ts b/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.ts index 47d7b8e34..f3ba1bf04 100644 --- a/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.ts +++ b/src/app/features/project/settings/components/settings-view-only-links-card/settings-view-only-links-card.component.ts @@ -4,8 +4,11 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { ViewOnlyTableComponent } from '@osf/shared/components'; -import { PaginatedViewOnlyLinksModel, ViewOnlyLinkModel } from '@osf/shared/models'; +import { ViewOnlyTableComponent } from '@osf/shared/components/view-only-table/view-only-table.component'; +import { + PaginatedViewOnlyLinksModel, + ViewOnlyLinkModel, +} from '@osf/shared/models/view-only-links/view-only-link.model'; @Component({ selector: 'osf-settings-view-only-links-card', diff --git a/src/app/features/project/settings/mappers/settings.mapper.ts b/src/app/features/project/settings/mappers/settings.mapper.ts index ea05448a0..3dec5f603 100644 --- a/src/app/features/project/settings/mappers/settings.mapper.ts +++ b/src/app/features/project/settings/mappers/settings.mapper.ts @@ -1,7 +1,7 @@ -import { UserPermissions } from '@osf/shared/enums'; -import { InstitutionsMapper } from '@osf/shared/mappers'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { InstitutionsMapper } from '@osf/shared/mappers/institutions'; import { RegionsMapper } from '@osf/shared/mappers/regions'; -import { BaseNodeDataJsonApi } from '@shared/models'; +import { BaseNodeDataJsonApi } from '@shared/models/nodes/base-node-data-json-api.model'; import { NodeDetailsModel, diff --git a/src/app/features/project/settings/models/node-details.model.ts b/src/app/features/project/settings/models/node-details.model.ts index 1afbb872d..483791011 100644 --- a/src/app/features/project/settings/models/node-details.model.ts +++ b/src/app/features/project/settings/models/node-details.model.ts @@ -1,12 +1,13 @@ -import { UserPermissions } from '@osf/shared/enums'; -import { IdName, Institution } from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { IdNameModel } from '@shared/models/common/id-name.model'; +import { Institution } from '@shared/models/institutions/institutions.models'; export interface NodeDetailsModel { id: string; title: string; description: string; isPublic: boolean; - region: IdName | null; + region: IdNameModel | null; affiliatedInstitutions: Institution[]; currentUserPermissions: UserPermissions[]; rootId?: string; diff --git a/src/app/features/project/settings/models/right-control.model.ts b/src/app/features/project/settings/models/right-control.model.ts index a37e7f44a..77e0af7fc 100644 --- a/src/app/features/project/settings/models/right-control.model.ts +++ b/src/app/features/project/settings/models/right-control.model.ts @@ -1,5 +1,5 @@ -import { SubscriptionEvent } from '@osf/shared/enums'; -import { SelectOption } from '@osf/shared/models'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SelectOption } from '@osf/shared/models/select-option.model'; export interface RightControl { type: 'dropdown'; diff --git a/src/app/features/project/settings/pipes/notification-description.pipe.ts b/src/app/features/project/settings/pipes/notification-description.pipe.ts index f57499a6c..effec7c6b 100644 --- a/src/app/features/project/settings/pipes/notification-description.pipe.ts +++ b/src/app/features/project/settings/pipes/notification-description.pipe.ts @@ -1,6 +1,7 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { SubscriptionEvent, SubscriptionFrequency } from '@shared/enums'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; @Pipe({ name: 'notificationDescription', diff --git a/src/app/features/project/settings/services/settings.service.ts b/src/app/features/project/settings/services/settings.service.ts index 08d2188c3..07e03d6e4 100644 --- a/src/app/features/project/settings/services/settings.service.ts +++ b/src/app/features/project/settings/services/settings.service.ts @@ -3,18 +3,15 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SubscriptionFrequency } from '@osf/shared/enums'; -import { NotificationSubscriptionMapper } from '@osf/shared/mappers'; -import { - BaseNodeDataJsonApi, - NodeResponseJsonApi, - NodeShortInfoModel, - NotificationSubscription, - NotificationSubscriptionGetResponseJsonApi, - ResponseJsonApi, - UpdateNodeRequestModel, -} from '@osf/shared/models'; -import { JsonApiService } from '@shared/services'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { NotificationSubscriptionMapper } from '@osf/shared/mappers/notification-subscription.mapper'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { BaseNodeDataJsonApi } from '@osf/shared/models/nodes/base-node-data-json-api.model'; +import { NodeShortInfoModel } from '@osf/shared/models/nodes/node-with-children.model'; +import { NodeResponseJsonApi, UpdateNodeRequestModel } from '@osf/shared/models/nodes/nodes-json-api.model'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; +import { NotificationSubscriptionGetResponseJsonApi } from '@osf/shared/models/notifications/notification-subscription-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { SettingsMapper } from '../mappers'; import { diff --git a/src/app/features/project/settings/settings.component.spec.ts b/src/app/features/project/settings/settings.component.spec.ts index ed275c037..6efcd5fb4 100644 --- a/src/app/features/project/settings/settings.component.spec.ts +++ b/src/app/features/project/settings/settings.component.spec.ts @@ -3,6 +3,13 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ViewOnlyLinkSelectors } from '@osf/shared/stores/view-only-links'; + import { ProjectSettingNotificationsComponent, SettingsAccessRequestsCardComponent, @@ -11,15 +18,11 @@ import { SettingsStorageLocationCardComponent, SettingsViewOnlyLinksCardComponent, SettingsWikiCardComponent, -} from '@osf/features/project/settings/components'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; -import { ViewOnlyLinkSelectors } from '@osf/shared/stores/view-only-links'; - +} from './components'; import { SettingsComponent } from './settings.component'; import { SettingsSelectors } from './store'; -import { MOCK_VIEW_ONLY_LINK } from '@testing/mocks'; +import { MOCK_VIEW_ONLY_LINK } from '@testing/mocks/view-only-link.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomConfirmationServiceMockBuilder } from '@testing/providers/custom-confirmation-provider.mock'; import { ActivatedRouteMockBuilder } from '@testing/providers/route-provider.mock'; diff --git a/src/app/features/project/settings/settings.component.ts b/src/app/features/project/settings/settings.component.ts index 51cba11f5..5ad55cc42 100644 --- a/src/app/features/project/settings/settings.component.ts +++ b/src/app/features/project/settings/settings.component.ts @@ -10,10 +10,18 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components'; -import { ResourceType, SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums'; -import { Institution, UpdateNodeRequestModel, ViewOnlyLinkModel } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, LoaderService, ToastService } from '@osf/shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { UpdateNodeRequestModel } from '@osf/shared/models/nodes/nodes-json-api.model'; +import { ViewOnlyLinkModel } from '@osf/shared/models/view-only-links/view-only-link.model'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { GetResource, GetResourceWithChildren } from '@osf/shared/stores/current-resource'; import { DeleteViewOnlyLink, FetchViewOnlyLinks, ViewOnlyLinkSelectors } from '@osf/shared/stores/view-only-links'; diff --git a/src/app/features/project/settings/store/settings.actions.ts b/src/app/features/project/settings/store/settings.actions.ts index 49694e925..58022e8f0 100644 --- a/src/app/features/project/settings/store/settings.actions.ts +++ b/src/app/features/project/settings/store/settings.actions.ts @@ -1,5 +1,6 @@ -import { SubscriptionFrequency } from '@osf/shared/enums'; -import { NodeShortInfoModel, UpdateNodeRequestModel } from '@shared/models'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { NodeShortInfoModel } from '@shared/models/nodes/node-with-children.model'; +import { UpdateNodeRequestModel } from '@shared/models/nodes/nodes-json-api.model'; import { ProjectSettingsDataJsonApi } from '../models'; diff --git a/src/app/features/project/settings/store/settings.model.ts b/src/app/features/project/settings/store/settings.model.ts index 0b882c8c6..062cea4bf 100644 --- a/src/app/features/project/settings/store/settings.model.ts +++ b/src/app/features/project/settings/store/settings.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, NotificationSubscription } from '@osf/shared/models'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { NodeDetailsModel, ProjectSettingsModel } from '../models'; diff --git a/src/app/features/project/settings/store/settings.selectors.ts b/src/app/features/project/settings/store/settings.selectors.ts index 6e81dd5e6..d6f18961d 100644 --- a/src/app/features/project/settings/store/settings.selectors.ts +++ b/src/app/features/project/settings/store/settings.selectors.ts @@ -1,7 +1,7 @@ import { Selector } from '@ngxs/store'; -import { UserPermissions } from '@osf/shared/enums'; -import { NotificationSubscription } from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { NotificationSubscription } from '@shared/models/notifications/notification-subscription.model'; import { SettingsStateModel } from './settings.model'; import { SettingsState } from './settings.state'; diff --git a/src/app/features/project/settings/store/settings.state.ts b/src/app/features/project/settings/store/settings.state.ts index 99d016cfa..21b038480 100644 --- a/src/app/features/project/settings/store/settings.state.ts +++ b/src/app/features/project/settings/store/settings.state.ts @@ -6,8 +6,8 @@ import { catchError, tap } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { NotificationSubscription } from '@osf/shared/models'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; import { SettingsService } from '../services'; diff --git a/src/app/features/project/wiki/legacy-wiki-redirect.component.ts b/src/app/features/project/wiki/legacy-wiki-redirect.component.ts index fc4515624..964147eb5 100644 --- a/src/app/features/project/wiki/legacy-wiki-redirect.component.ts +++ b/src/app/features/project/wiki/legacy-wiki-redirect.component.ts @@ -6,8 +6,8 @@ import { Component, DestroyRef, inject } from '@angular/core'; import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { ResourceType } from '@osf/shared/enums'; -import { LoaderService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { GetWikiList, WikiSelectors } from '@osf/shared/stores/wiki'; @Component({ @@ -22,9 +22,7 @@ export class LegacyWikiRedirectComponent { readonly projectId = toSignal(this.route.parent?.params.pipe(map((params) => params['id'])) ?? of(undefined)); wikiList = select(WikiSelectors.getWikiList); - actions = createDispatchMap({ - getWikiList: GetWikiList, - }); + actions = createDispatchMap({ getWikiList: GetWikiList }); constructor() { this.loaderService.show(); diff --git a/src/app/features/project/wiki/wiki.component.spec.ts b/src/app/features/project/wiki/wiki.component.spec.ts index a9f76c326..bb4a2054c 100644 --- a/src/app/features/project/wiki/wiki.component.spec.ts +++ b/src/app/features/project/wiki/wiki.component.spec.ts @@ -1,7 +1,6 @@ import { provideStore } from '@ngxs/store'; -import { TranslatePipe } from '@ngx-translate/core'; -import { MockComponent, MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -10,16 +9,16 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { WikiComponent } from '@osf/features/project/wiki/wiki.component'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { ToastService } from '@osf/shared/services'; -import { - CompareSectionComponent, - EditSectionComponent, - ViewSectionComponent, - WikiListComponent, -} from '@shared/components/wiki'; -import { WikiState } from '@shared/stores/wiki'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { CompareSectionComponent } from '@osf/shared/components/wiki/compare-section/compare-section.component'; +import { EditSectionComponent } from '@osf/shared/components/wiki/edit-section/edit-section.component'; +import { ViewSectionComponent } from '@osf/shared/components/wiki/view-section/view-section.component'; +import { WikiListComponent } from '@osf/shared/components/wiki/wiki-list/wiki-list.component'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { WikiState } from '@osf/shared/stores/wiki'; + +import { WikiComponent } from './wiki.component'; describe('WikiComponent', () => { let component: WikiComponent; @@ -29,12 +28,14 @@ describe('WikiComponent', () => { await TestBed.configureTestingModule({ imports: [ WikiComponent, - MockComponent(SubHeaderComponent), - MockComponent(WikiListComponent), - MockComponent(ViewSectionComponent), - MockComponent(EditSectionComponent), - MockComponent(CompareSectionComponent), - TranslatePipe, + ...MockComponents( + SubHeaderComponent, + WikiListComponent, + ViewSectionComponent, + EditSectionComponent, + CompareSectionComponent, + ViewOnlyLinkMessageComponent + ), provideStore([WikiState]), provideHttpClient(), provideHttpClientTesting(), diff --git a/src/app/features/project/wiki/wiki.component.ts b/src/app/features/project/wiki/wiki.component.ts index 38eedf314..71b31364e 100644 --- a/src/app/features/project/wiki/wiki.component.ts +++ b/src/app/features/project/wiki/wiki.component.ts @@ -11,17 +11,15 @@ import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject } from import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { - CompareSectionComponent, - EditSectionComponent, - ViewSectionComponent, - WikiListComponent, -} from '@osf/shared/components/wiki'; -import { ResourceType } from '@osf/shared/enums'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; -import { WikiModes } from '@osf/shared/models'; -import { ToastService } from '@osf/shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CompareSectionComponent } from '@osf/shared/components/wiki/compare-section/compare-section.component'; +import { EditSectionComponent } from '@osf/shared/components/wiki/edit-section/edit-section.component'; +import { ViewSectionComponent } from '@osf/shared/components/wiki/view-section/view-section.component'; +import { WikiListComponent } from '@osf/shared/components/wiki/wiki-list/wiki-list.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { WikiModes } from '@osf/shared/models/wiki/wiki.model'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; import { ClearWiki, diff --git a/src/app/features/registries/components/custom-step/custom-step.component.spec.ts b/src/app/features/registries/components/custom-step/custom-step.component.spec.ts index 47202c0e5..1b287987e 100644 --- a/src/app/features/registries/components/custom-step/custom-step.component.spec.ts +++ b/src/app/features/registries/components/custom-step/custom-step.component.spec.ts @@ -3,9 +3,10 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { FilesControlComponent } from '@osf/features/registries/components/files-control/files-control.component'; -import { RegistriesSelectors } from '@osf/features/registries/store'; -import { InfoIconComponent } from '@osf/shared/components'; +import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; + +import { RegistriesSelectors } from '../../store'; +import { FilesControlComponent } from '../files-control/files-control.component'; import { CustomStepComponent } from './custom-step.component'; diff --git a/src/app/features/registries/components/custom-step/custom-step.component.ts b/src/app/features/registries/components/custom-step/custom-step.component.ts index 1766f5493..af774ec20 100644 --- a/src/app/features/registries/components/custom-step/custom-step.component.ts +++ b/src/app/features/registries/components/custom-step/custom-step.component.ts @@ -28,12 +28,16 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { InfoIconComponent } from '@osf/shared/components'; -import { FILE_COUNT_ATTACHMENTS_LIMIT, INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { FieldType } from '@osf/shared/enums'; -import { CustomValidators, findChangedFields } from '@osf/shared/helpers'; -import { FileModel, FilePayloadJsonApi, PageSchema } from '@osf/shared/models'; -import { ToastService } from '@osf/shared/services'; +import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; +import { FILE_COUNT_ATTACHMENTS_LIMIT } from '@osf/shared/constants/files-limits.const'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { FileModel } from '@shared/models/files/file.model'; +import { FilePayloadJsonApi } from '@shared/models/files/file-payload-json-api.model'; +import { PageSchema } from '@shared/models/registration/page-schema.model'; import { FilesMapper } from '../../mappers/files.mapper'; import { RegistriesSelectors, SetUpdatedFields, UpdateStepState } from '../../store'; diff --git a/src/app/features/registries/components/drafts/drafts.component.spec.ts b/src/app/features/registries/components/drafts/drafts.component.spec.ts index a38d7d65c..98221ba90 100644 --- a/src/app/features/registries/components/drafts/drafts.component.spec.ts +++ b/src/app/features/registries/components/drafts/drafts.component.spec.ts @@ -5,10 +5,12 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; -import { RegistriesSelectors } from '@osf/features/registries/store'; -import { StepperComponent, SubHeaderComponent } from '@osf/shared/components'; -import { ContributorsSelectors } from '@shared/stores/contributors'; -import { SubjectsSelectors } from '@shared/stores/subjects'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ContributorsSelectors } from '@osf/shared/stores/contributors'; +import { SubjectsSelectors } from '@osf/shared/stores/subjects'; + +import { RegistriesSelectors } from '../../store'; import { DraftsComponent } from './drafts.component'; diff --git a/src/app/features/registries/components/drafts/drafts.component.ts b/src/app/features/registries/components/drafts/drafts.component.ts index ad9c6262c..5edbcd1b2 100644 --- a/src/app/features/registries/components/drafts/drafts.component.ts +++ b/src/app/features/registries/components/drafts/drafts.component.ts @@ -18,10 +18,12 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router'; -import { StepperComponent, SubHeaderComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { PageSchema, Question, StepOption } from '@osf/shared/models'; -import { LoaderService } from '@osf/shared/services'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { PageSchema, Question } from '@osf/shared/models/registration/page-schema.model'; +import { StepOption } from '@osf/shared/models/step-option.model'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { ContributorsSelectors, GetAllContributors } from '@osf/shared/stores/contributors'; import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects'; diff --git a/src/app/features/registries/components/files-control/files-control.component.spec.ts b/src/app/features/registries/components/files-control/files-control.component.spec.ts index 202cf396b..f2ffee399 100644 --- a/src/app/features/registries/components/files-control/files-control.component.spec.ts +++ b/src/app/features/registries/components/files-control/files-control.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of, Subject } from 'rxjs'; @@ -6,7 +6,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { HelpScoutService } from '@core/services/help-scout.service'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { CustomConfirmationService, CustomDialogService, FilesService, ToastService } from '@osf/shared/services'; +import { FileUploadDialogComponent } from '@osf/shared/components/file-upload-dialog/file-upload-dialog.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { FilesControlComponent } from './files-control.component'; @@ -36,7 +41,11 @@ describe('Component: File Control', () => { mockCustomConfirmationService = CustomConfirmationServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [FilesControlComponent, OSFTestingModule], + imports: [ + FilesControlComponent, + OSFTestingModule, + ...MockComponents(LoadingSpinnerComponent, FileUploadDialogComponent), + ], providers: [ MockProvider(FilesService, mockFilesService), MockProvider(CustomDialogService, mockDialogService), diff --git a/src/app/features/registries/components/files-control/files-control.component.ts b/src/app/features/registries/components/files-control/files-control.component.ts index bc767b0ff..7536210c1 100644 --- a/src/app/features/registries/components/files-control/files-control.component.ts +++ b/src/app/features/registries/components/files-control/files-control.component.ts @@ -24,11 +24,16 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HelpScoutService } from '@core/services/help-scout.service'; import { CreateFolderDialogComponent } from '@osf/features/files/components'; -import { FilesTreeComponent, FileUploadDialogComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { FILE_SIZE_LIMIT } from '@osf/shared/constants'; -import { ClearFileDirective } from '@osf/shared/directives'; -import { FileFolderModel, FileModel } from '@osf/shared/models'; -import { CustomDialogService, FilesService, ToastService } from '@osf/shared/services'; +import { FileUploadDialogComponent } from '@osf/shared/components/file-upload-dialog/file-upload-dialog.component'; +import { FilesTreeComponent } from '@osf/shared/components/files-tree/files-tree.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { FILE_SIZE_LIMIT } from '@osf/shared/constants/files-limits.const'; +import { ClearFileDirective } from '@osf/shared/directives/clear-file.directive'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { FileModel } from '@shared/models/files/file.model'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; import { CreateFolder, diff --git a/src/app/features/registries/components/justification-review/justification-review.component.spec.ts b/src/app/features/registries/components/justification-review/justification-review.component.spec.ts index 3055059f1..1f74c49f9 100644 --- a/src/app/features/registries/components/justification-review/justification-review.component.spec.ts +++ b/src/app/features/registries/components/justification-review/justification-review.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -7,8 +7,11 @@ import { ActivatedRoute, Router } from '@angular/router'; import { SchemaActionTrigger } from '@osf/features/registries/enums'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { RevisionReviewStates } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { JustificationReviewComponent } from './justification-review.component'; @@ -45,7 +48,7 @@ describe('JustificationReviewComponent', () => { mockToastService = ToastServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [JustificationReviewComponent, OSFTestingModule], + imports: [JustificationReviewComponent, OSFTestingModule, MockComponent(RegistrationBlocksDataComponent)], providers: [ MockProvider(ActivatedRoute, mockActivatedRoute), MockProvider(Router, mockRouter), diff --git a/src/app/features/registries/components/justification-review/justification-review.component.ts b/src/app/features/registries/components/justification-review/justification-review.component.ts index 015c67152..26cb214f7 100644 --- a/src/app/features/registries/components/justification-review/justification-review.component.ts +++ b/src/app/features/registries/components/justification-review/justification-review.component.ts @@ -9,10 +9,13 @@ import { Message } from 'primeng/message'; import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { RegistrationBlocksDataComponent } from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { FieldType, RevisionReviewStates } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { SchemaActionTrigger } from '../../enums'; import { ClearState, DeleteSchemaResponse, HandleSchemaResponse, RegistriesSelectors } from '../../store'; diff --git a/src/app/features/registries/components/justification-step/justification-step.component.spec.ts b/src/app/features/registries/components/justification-step/justification-step.component.spec.ts index 66b167279..c3b98e705 100644 --- a/src/app/features/registries/components/justification-step/justification-step.component.spec.ts +++ b/src/app/features/registries/components/justification-step/justification-step.component.spec.ts @@ -6,7 +6,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { JustificationStepComponent } from './justification-step.component'; diff --git a/src/app/features/registries/components/justification-step/justification-step.component.ts b/src/app/features/registries/components/justification-step/justification-step.component.ts index 19f780e26..eee067b61 100644 --- a/src/app/features/registries/components/justification-step/justification-step.component.ts +++ b/src/app/features/registries/components/justification-step/justification-step.component.ts @@ -12,9 +12,12 @@ import { ChangeDetectionStrategy, Component, effect, inject, OnDestroy } from '@ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { INPUT_VALIDATION_MESSAGES, InputLimits } from '@osf/shared/constants'; -import { CustomValidators, findChangedFields } from '@osf/shared/helpers'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ClearState, diff --git a/src/app/features/registries/components/new-registration/new-registration.component.spec.ts b/src/app/features/registries/components/new-registration/new-registration.component.spec.ts index 72c81e8b8..ff8f9c3ee 100644 --- a/src/app/features/registries/components/new-registration/new-registration.component.spec.ts +++ b/src/app/features/registries/components/new-registration/new-registration.component.spec.ts @@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { SubHeaderComponent } from '@shared/components'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { NewRegistrationComponent } from './new-registration.component'; diff --git a/src/app/features/registries/components/new-registration/new-registration.component.ts b/src/app/features/registries/components/new-registration/new-registration.component.ts index 3fbccff19..952ee73f8 100644 --- a/src/app/features/registries/components/new-registration/new-registration.component.ts +++ b/src/app/features/registries/components/new-registration/new-registration.component.ts @@ -14,8 +14,8 @@ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { ToastService } from '@osf/shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { GetRegistryProvider } from '@shared/stores/registration-provider'; import { CreateDraft, GetProjects, GetProviderSchemas, RegistriesSelectors } from '../../store'; diff --git a/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.spec.ts b/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.spec.ts index 1ca5f56ba..385ae946b 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.spec.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.spec.ts @@ -1,6 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; import { InstitutionsSelectors } from '@osf/shared/stores/institutions'; import { RegistriesAffiliatedInstitutionComponent } from './registries-affiliated-institution.component'; @@ -18,7 +21,11 @@ describe('RegistriesAffiliatedInstitutionComponent', () => { mockActivatedRoute = ActivatedRouteMockBuilder.create().withParams({ id: 'draft-1' }).build(); await TestBed.configureTestingModule({ - imports: [RegistriesAffiliatedInstitutionComponent, OSFTestingModule], + imports: [ + RegistriesAffiliatedInstitutionComponent, + OSFTestingModule, + MockComponent(AffiliatedInstitutionSelectComponent), + ], providers: [ { provide: ActivatedRoute, useValue: mockActivatedRoute }, provideMockStore({ diff --git a/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.ts b/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.ts index 261eceddb..11741ffba 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.ts @@ -7,9 +7,9 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, effect, inject, OnInit, signal } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; -import { Institution } from '@osf/shared/models'; +import { AffiliatedInstitutionSelectComponent } from '@osf/shared/components/affiliated-institution-select/affiliated-institution-select.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; import { FetchResourceInstitutions, FetchUserInstitutions, diff --git a/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.spec.ts b/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.spec.ts index bbef5fbd3..1ee6a31b7 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.spec.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.spec.ts @@ -7,8 +7,10 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { UserSelectors } from '@core/store/user'; -import { ResourceType } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ContributorsSelectors } from '@osf/shared/stores/contributors/contributors.selectors'; import { ContributorsTableComponent } from '@shared/components/contributors/contributors-table/contributors-table.component'; diff --git a/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.ts b/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.ts index 1a8a71f66..9423f6a95 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.ts @@ -29,11 +29,13 @@ import { AddUnregisteredContributorDialogComponent, ContributorsTableComponent, } from '@osf/shared/components/contributors'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { AddContributorType, ResourceType } from '@osf/shared/enums'; -import { findChangedItems } from '@osf/shared/helpers'; -import { ContributorDialogAddModel, ContributorModel, TableParameters } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { findChangedItems } from '@osf/shared/helpers/find-changed-items.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddContributor, BulkAddContributors, @@ -44,6 +46,9 @@ import { LoadMoreContributors, ResetContributorsState, } from '@osf/shared/stores/contributors'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; @Component({ selector: 'osf-registries-contributors', diff --git a/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.spec.ts b/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.spec.ts index d9ed36813..bd5a86de0 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.spec.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.spec.ts @@ -1,8 +1,11 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, FormGroup } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; +import { LicenseComponent } from '@osf/shared/components/license/license.component'; import { RegistriesLicenseComponent } from './registries-license.component'; @@ -19,7 +22,7 @@ describe('RegistriesLicenseComponent', () => { mockActivatedRoute = ActivatedRouteMockBuilder.create().withParams({ id: 'draft-1' }).build(); await TestBed.configureTestingModule({ - imports: [RegistriesLicenseComponent, OSFTestingModule], + imports: [RegistriesLicenseComponent, OSFTestingModule, MockComponent(LicenseComponent)], providers: [ { provide: ActivatedRoute, useValue: mockActivatedRoute }, provideMockStore({ diff --git a/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.ts b/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.ts index bbe927a7b..fdfaac181 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-license/registries-license.component.ts @@ -11,9 +11,10 @@ import { ActivatedRoute } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { FetchLicenses, RegistriesSelectors, SaveLicense } from '@osf/features/registries/store'; -import { LicenseComponent } from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES, InputLimits } from '@osf/shared/constants'; -import { LicenseModel, LicenseOptions } from '@osf/shared/models'; +import { LicenseComponent } from '@osf/shared/components/license/license.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; @Component({ selector: 'osf-registries-license', diff --git a/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.spec.ts b/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.spec.ts index cac750345..eeba314cb 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.spec.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.spec.ts @@ -3,14 +3,15 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { CustomConfirmationService } from '@osf/shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; import { ContributorsSelectors } from '@osf/shared/stores/contributors'; import { InstitutionsSelectors } from '@osf/shared/stores/institutions'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; -import { TextInputComponent } from '@shared/components'; import { RegistriesSelectors } from '../../store'; +import { RegistriesAffiliatedInstitutionComponent } from './registries-affiliated-institution/registries-affiliated-institution.component'; import { RegistriesContributorsComponent } from './registries-contributors/registries-contributors.component'; import { RegistriesLicenseComponent } from './registries-license/registries-license.component'; import { RegistriesSubjectsComponent } from './registries-subjects/registries-subjects.component'; @@ -37,11 +38,12 @@ describe.skip('RegistriesMetadataStepComponent', () => { RegistriesMetadataStepComponent, OSFTestingModule, ...MockComponents( + TextInputComponent, RegistriesContributorsComponent, - RegistriesLicenseComponent, RegistriesSubjectsComponent, RegistriesTagsComponent, - TextInputComponent + RegistriesLicenseComponent, + RegistriesAffiliatedInstitutionComponent ), ], providers: [ diff --git a/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.ts b/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.ts index 2ca52b2ab..bfcc1e5f0 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-metadata-step.component.ts @@ -13,14 +13,18 @@ import { ChangeDetectionStrategy, Component, computed, effect, inject, OnDestroy import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { TextInputComponent } from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES, InputLimits } from '@osf/shared/constants'; -import { CustomValidators, findChangedFields } from '@osf/shared/helpers'; -import { ContributorModel, DraftRegistrationModel, SubjectModel } from '@osf/shared/models'; -import { CustomConfirmationService } from '@osf/shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; import { ContributorsSelectors } from '@osf/shared/stores/contributors'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; -import { UserPermissions } from '@shared/enums'; +import { UserPermissions } from '@shared/enums/user-permissions.enum'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { DraftRegistrationModel } from '@shared/models/registration/draft-registration.model'; +import { SubjectModel } from '@shared/models/subject/subject.model'; import { ClearState, DeleteDraft, RegistriesSelectors, UpdateDraft, UpdateStepState } from '../../store'; diff --git a/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.spec.ts b/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.spec.ts index 822320ac4..9c8ecbff4 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.spec.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -7,7 +7,8 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { ResourceType } from '@osf/shared/enums'; +import { SubjectsComponent } from '@osf/shared/components/subjects/subjects.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; import { RegistriesSubjectsComponent } from './registries-subjects.component'; @@ -24,7 +25,7 @@ describe('RegistriesSubjectsComponent', () => { beforeEach(async () => { mockActivatedRoute = ActivatedRouteMockBuilder.create().withParams({ id: 'draft-1' }).build(); await TestBed.configureTestingModule({ - imports: [RegistriesSubjectsComponent, OSFTestingModule], + imports: [RegistriesSubjectsComponent, OSFTestingModule, MockComponent(SubjectsComponent)], providers: [ MockProvider(ActivatedRoute, mockActivatedRoute), provideMockStore({ diff --git a/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.ts b/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.ts index e7ad85599..01915ab96 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-subjects/registries-subjects.component.ts @@ -10,10 +10,9 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { SubjectsComponent } from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectsComponent } from '@osf/shared/components/subjects/subjects.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { FetchChildrenSubjects, FetchSelectedSubjects, @@ -21,6 +20,7 @@ import { SubjectsSelectors, UpdateResourceSubjects, } from '@osf/shared/stores/subjects'; +import { SubjectModel } from '@shared/models/subject/subject.model'; @Component({ selector: 'osf-registries-subjects', diff --git a/src/app/features/registries/components/registries-metadata-step/registries-tags/registries-tags.component.ts b/src/app/features/registries/components/registries-metadata-step/registries-tags/registries-tags.component.ts index 977316404..5c8c32cd1 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-tags/registries-tags.component.ts +++ b/src/app/features/registries/components/registries-metadata-step/registries-tags/registries-tags.component.ts @@ -8,7 +8,7 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { RegistriesSelectors, UpdateDraft } from '@osf/features/registries/store'; -import { TagsInputComponent } from '@osf/shared/components'; +import { TagsInputComponent } from '@osf/shared/components/tags-input/tags-input.component'; @Component({ selector: 'osf-registries-tags', diff --git a/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.spec.ts b/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.spec.ts index ec4f81f98..781b8bcc1 100644 --- a/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.spec.ts +++ b/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.spec.ts @@ -3,9 +3,9 @@ import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { CustomDialogService } from '@osf/shared/services'; -import { SearchInputComponent } from '@shared/components'; -import { DecodeHtmlPipe } from '@shared/pipes'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { DecodeHtmlPipe } from '@shared/pipes/decode-html.pipe'; import { RegistryProviderHeroComponent } from './registry-provider-hero.component'; diff --git a/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.ts b/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.ts index cfe83aa9a..52f770e9f 100644 --- a/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.ts +++ b/src/app/features/registries/components/registry-provider-hero/registry-provider-hero.component.ts @@ -9,11 +9,12 @@ import { FormControl } from '@angular/forms'; import { Router } from '@angular/router'; import { PreprintsHelpDialogComponent } from '@osf/features/preprints/components'; -import { HeaderStyleHelper } from '@osf/shared/helpers'; -import { RegistryProviderDetails } from '@osf/shared/models'; -import { SearchInputComponent } from '@shared/components'; -import { DecodeHtmlPipe } from '@shared/pipes'; -import { BrandService, CustomDialogService } from '@shared/services'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { HeaderStyleHelper } from '@osf/shared/helpers/header-style.helper'; +import { BrandService } from '@osf/shared/services/brand.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { RegistryProviderDetails } from '@shared/models/provider/registry-provider.model'; +import { DecodeHtmlPipe } from '@shared/pipes/decode-html.pipe'; @Component({ selector: 'osf-registry-provider-hero', diff --git a/src/app/features/registries/components/registry-services/registry-services.component.ts b/src/app/features/registries/components/registry-services/registry-services.component.ts index c7c66a518..0c57afbd6 100644 --- a/src/app/features/registries/components/registry-services/registry-services.component.ts +++ b/src/app/features/registries/components/registry-services/registry-services.component.ts @@ -5,7 +5,7 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { RegistryServiceIcons } from '@shared/constants'; +import { RegistryServiceIcons } from '@shared/constants/registry-services-icons.const'; @Component({ selector: 'osf-registry-services', diff --git a/src/app/features/registries/components/review/review.component.spec.ts b/src/app/features/registries/components/review/review.component.spec.ts index 2b9752afd..510605975 100644 --- a/src/app/features/registries/components/review/review.component.spec.ts +++ b/src/app/features/registries/components/review/review.component.spec.ts @@ -6,14 +6,13 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { - ContributorsListComponent, - LoadingSpinnerComponent, - RegistrationBlocksDataComponent, - SubHeaderComponent, -} from '@osf/shared/components'; -import { FieldType } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ContributorsSelectors } from '@osf/shared/stores/contributors'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; @@ -50,12 +49,7 @@ describe('ReviewComponent', () => { imports: [ ReviewComponent, OSFTestingModule, - ...MockComponents( - RegistrationBlocksDataComponent, - ContributorsListComponent, - SubHeaderComponent, - LoadingSpinnerComponent - ), + ...MockComponents(RegistrationBlocksDataComponent, ContributorsListComponent, LicenseDisplayComponent), ], providers: [ MockProvider(Router, mockRouter), diff --git a/src/app/features/registries/components/review/review.component.ts b/src/app/features/registries/components/review/review.component.ts index 2d230bb86..0d9f2c339 100644 --- a/src/app/features/registries/components/review/review.component.ts +++ b/src/app/features/registries/components/review/review.component.ts @@ -14,14 +14,17 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { - ContributorsListComponent, - LicenseDisplayComponent, - RegistrationBlocksDataComponent, -} from '@osf/shared/components'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { FieldType, ResourceType, UserPermissions } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { LicenseDisplayComponent } from '@osf/shared/components/license-display/license-display.component'; +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ContributorsSelectors, GetAllContributors, @@ -29,7 +32,6 @@ import { ResetContributorsState, } from '@osf/shared/stores/contributors'; import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects'; -import { FixSpecialCharPipe } from '@shared/pipes'; import { ClearState, diff --git a/src/app/features/registries/constants/default-steps.ts b/src/app/features/registries/constants/default-steps.ts index 9b7503166..d5d553d73 100644 --- a/src/app/features/registries/constants/default-steps.ts +++ b/src/app/features/registries/constants/default-steps.ts @@ -1,4 +1,4 @@ -import { StepOption } from '@osf/shared/models'; +import { StepOption } from '@osf/shared/models/step-option.model'; export const DEFAULT_STEPS: StepOption[] = [ { diff --git a/src/app/features/registries/constants/registrations-tabs.ts b/src/app/features/registries/constants/registrations-tabs.ts index f1866fb61..accf00f00 100644 --- a/src/app/features/registries/constants/registrations-tabs.ts +++ b/src/app/features/registries/constants/registrations-tabs.ts @@ -1,4 +1,4 @@ -import { TabOption } from '@osf/shared/models'; +import { TabOption } from '@osf/shared/models/tab-option.model'; import { RegistrationTab } from '../enums'; diff --git a/src/app/features/registries/mappers/files.mapper.ts b/src/app/features/registries/mappers/files.mapper.ts index 40ac9a1fe..825968f88 100644 --- a/src/app/features/registries/mappers/files.mapper.ts +++ b/src/app/features/registries/mappers/files.mapper.ts @@ -1,4 +1,5 @@ -import { FileModel, FilePayloadJsonApi } from '@osf/shared/models'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FilePayloadJsonApi } from '@osf/shared/models/files/file-payload-json-api.model'; export class FilesMapper { static toFilePayload(file: FileModel): FilePayloadJsonApi { diff --git a/src/app/features/registries/mappers/licenses.mapper.ts b/src/app/features/registries/mappers/licenses.mapper.ts index 8072bc716..afac806d9 100644 --- a/src/app/features/registries/mappers/licenses.mapper.ts +++ b/src/app/features/registries/mappers/licenses.mapper.ts @@ -1,4 +1,5 @@ -import { LicenseModel, LicensesResponseJsonApi } from '@osf/shared/models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { LicensesResponseJsonApi } from '@osf/shared/models/license/licenses-json-api.model'; export class LicensesMapper { static fromLicensesResponse(response: LicensesResponseJsonApi): LicenseModel[] { diff --git a/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.spec.ts b/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.spec.ts index 5b2151e10..b446b84b5 100644 --- a/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.spec.ts +++ b/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.spec.ts @@ -1,8 +1,12 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; +import { CustomStepComponent } from '../../components/custom-step/custom-step.component'; + import { DraftRegistrationCustomStepComponent } from './draft-registration-custom-step.component'; import { MOCK_REGISTRIES_PAGE } from '@testing/mocks/registries.mock'; @@ -22,7 +26,7 @@ describe.skip('DraftRegistrationCustomStepComponent', () => { mockRouter = RouterMockBuilder.create().withUrl('/registries/prov-1/draft/draft-1/custom').build(); await TestBed.configureTestingModule({ - imports: [DraftRegistrationCustomStepComponent, OSFTestingModule], + imports: [DraftRegistrationCustomStepComponent, OSFTestingModule, MockComponent(CustomStepComponent)], providers: [ { provide: ActivatedRoute, useValue: mockActivatedRoute }, { provide: Router, useValue: mockRouter }, diff --git a/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.ts b/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.ts index afdad0264..527cb7ce3 100644 --- a/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.ts +++ b/src/app/features/registries/pages/draft-registration-custom-step/draft-registration-custom-step.component.ts @@ -3,7 +3,7 @@ import { createDispatchMap, select } from '@ngxs/store'; import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { DraftRegistrationAttributesJsonApi } from '@osf/shared/models'; +import { DraftRegistrationAttributesJsonApi } from '@osf/shared/models/registration/registration-json-api.model'; import { CustomStepComponent } from '../../components/custom-step/custom-step.component'; import { RegistriesSelectors, UpdateDraft } from '../../store'; diff --git a/src/app/features/registries/pages/justification/justification.component.spec.ts b/src/app/features/registries/pages/justification/justification.component.spec.ts index d6f239047..ddbee0e57 100644 --- a/src/app/features/registries/pages/justification/justification.component.spec.ts +++ b/src/app/features/registries/pages/justification/justification.component.spec.ts @@ -1,10 +1,12 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { LoaderService } from '@osf/shared/services'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { JustificationComponent } from './justification.component'; @@ -28,7 +30,7 @@ describe('JustificationComponent', () => { mockRouter = RouterMockBuilder.create().withUrl('/registries/revisions/rev-1/justification').build(); await TestBed.configureTestingModule({ - imports: [JustificationComponent, OSFTestingModule], + imports: [JustificationComponent, OSFTestingModule, ...MockComponents(StepperComponent, SubHeaderComponent)], providers: [ MockProvider(ActivatedRoute, mockActivatedRoute), MockProvider(Router, mockRouter), diff --git a/src/app/features/registries/pages/justification/justification.component.ts b/src/app/features/registries/pages/justification/justification.component.ts index d73a2aa32..cc5a5e6f7 100644 --- a/src/app/features/registries/pages/justification/justification.component.ts +++ b/src/app/features/registries/pages/justification/justification.component.ts @@ -18,10 +18,11 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router'; -import { StepperComponent, SubHeaderComponent } from '@osf/shared/components'; -import { RevisionReviewStates } from '@osf/shared/enums'; -import { StepOption } from '@osf/shared/models'; -import { LoaderService } from '@osf/shared/services'; +import { StepperComponent } from '@osf/shared/components/stepper/stepper.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { StepOption } from '@shared/models/step-option.model'; import { ClearState, FetchSchemaBlocks, FetchSchemaResponse, RegistriesSelectors, UpdateStepState } from '../../store'; diff --git a/src/app/features/registries/pages/my-registrations/my-registrations.component.spec.ts b/src/app/features/registries/pages/my-registrations/my-registrations.component.spec.ts index 340110df5..5cff08442 100644 --- a/src/app/features/registries/pages/my-registrations/my-registrations.component.spec.ts +++ b/src/app/features/registries/pages/my-registrations/my-registrations.component.spec.ts @@ -1,11 +1,16 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { UserSelectors } from '@core/store/user'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { RegistrationCardComponent } from '@osf/shared/components/registration-card/registration-card.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { MyRegistrationsComponent } from './my-registrations.component'; @@ -24,7 +29,11 @@ describe('MyRegistrationsComponent', () => { mockActivatedRoute = { snapshot: { queryParams: {} } } as any; await TestBed.configureTestingModule({ - imports: [MyRegistrationsComponent, OSFTestingModule], + imports: [ + MyRegistrationsComponent, + OSFTestingModule, + ...MockComponents(SubHeaderComponent, SelectComponent, RegistrationCardComponent, CustomPaginatorComponent), + ], providers: [ { provide: Router, useValue: mockRouter }, { provide: ActivatedRoute, useValue: mockActivatedRoute }, diff --git a/src/app/features/registries/pages/my-registrations/my-registrations.component.ts b/src/app/features/registries/pages/my-registrations/my-registrations.component.ts index bcbb17c1e..89c8e10e8 100644 --- a/src/app/features/registries/pages/my-registrations/my-registrations.component.ts +++ b/src/app/features/registries/pages/my-registrations/my-registrations.component.ts @@ -15,14 +15,13 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { UserSelectors } from '@core/store/user'; -import { - CustomPaginatorComponent, - RegistrationCardComponent, - SelectComponent, - SubHeaderComponent, -} from '@osf/shared/components'; -import { IS_XSMALL } from '@osf/shared/helpers'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; +import { RegistrationCardComponent } from '@osf/shared/components/registration-card/registration-card.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_XSMALL } from '@osf/shared/helpers/breakpoints.tokens'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { REGISTRATIONS_TABS } from '../../constants'; import { RegistrationTab } from '../../enums'; diff --git a/src/app/features/registries/pages/registries-landing/registries-landing.component.spec.ts b/src/app/features/registries/pages/registries-landing/registries-landing.component.spec.ts index 7a4f91e7a..aec8f82ea 100644 --- a/src/app/features/registries/pages/registries-landing/registries-landing.component.spec.ts +++ b/src/app/features/registries/pages/registries-landing/registries-landing.component.spec.ts @@ -5,13 +5,11 @@ import { Router } from '@angular/router'; import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled-banner/scheduled-banner.component'; import { RegistryServicesComponent } from '@osf/features/registries/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { ResourceCardComponent } from '@osf/shared/components/resource-card/resource-card.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { RegistrationProviderSelectors } from '@osf/shared/stores/registration-provider'; -import { - LoadingSpinnerComponent, - ResourceCardComponent, - SearchInputComponent, - SubHeaderComponent, -} from '@shared/components'; import { RegistriesSelectors } from '../../store'; 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 fce7c13d3..7bf1f2830 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 @@ -11,19 +11,17 @@ import { Router } from '@angular/router'; import { ScheduledBannerComponent } from '@core/components/osf-banners/scheduled-banner/scheduled-banner.component'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ClearCurrentProvider } from '@core/store/provider'; -import { - LoadingSpinnerComponent, - ResourceCardComponent, - SearchInputComponent, - SubHeaderComponent, -} from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { ResourceCardComponent } from '@osf/shared/components/resource-card/resource-card.component'; +import { SearchInputComponent } from '@osf/shared/components/search-input/search-input.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { normalizeQuotes } from '@osf/shared/helpers/normalize-quotes'; import { ClearRegistryProvider, GetRegistryProvider, RegistrationProviderSelectors, } from '@osf/shared/stores/registration-provider'; -import { normalizeQuotes } from '@shared/helpers'; import { RegistryServicesComponent } from '../../components'; import { GetRegistries, RegistriesSelectors } from '../../store'; diff --git a/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.spec.ts b/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.spec.ts index b8d8fd76d..6498fed94 100644 --- a/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.spec.ts +++ b/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.spec.ts @@ -4,9 +4,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { RegistryProviderHeroComponent } from '@osf/features/registries/components/registry-provider-hero/registry-provider-hero.component'; -import { CustomDialogService } from '@osf/shared/services'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { RegistrationProviderSelectors } from '@osf/shared/stores/registration-provider'; -import { GlobalSearchComponent } from '@shared/components'; import { RegistriesProviderSearchComponent } from './registries-provider-search.component'; diff --git a/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.ts b/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.ts index 89c3272a2..2825d7783 100644 --- a/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.ts +++ b/src/app/features/registries/pages/registries-provider-search/registries-provider-search.component.ts @@ -5,8 +5,8 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { ClearCurrentProvider } from '@core/store/provider'; -import { GlobalSearchComponent } from '@osf/shared/components'; -import { ResourceType } from '@osf/shared/enums'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { SetDefaultFilterValue, SetResourceType } from '@osf/shared/stores/global-search'; import { ClearRegistryProvider, diff --git a/src/app/features/registries/pages/revisions-custom-step/revisions-custom-step.component.spec.ts b/src/app/features/registries/pages/revisions-custom-step/revisions-custom-step.component.spec.ts index dc883e7b5..6411524f3 100644 --- a/src/app/features/registries/pages/revisions-custom-step/revisions-custom-step.component.spec.ts +++ b/src/app/features/registries/pages/revisions-custom-step/revisions-custom-step.component.spec.ts @@ -3,8 +3,8 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { CustomStepComponent } from '@osf/features/registries/components/custom-step/custom-step.component'; -import { RegistriesSelectors } from '@osf/features/registries/store'; +import { CustomStepComponent } from '../../components/custom-step/custom-step.component'; +import { RegistriesSelectors } from '../../store'; import { RevisionsCustomStepComponent } from './revisions-custom-step.component'; diff --git a/src/app/features/registries/registries.routes.ts b/src/app/features/registries/registries.routes.ts index ecff049e7..6ecd937bb 100644 --- a/src/app/features/registries/registries.routes.ts +++ b/src/app/features/registries/registries.routes.ts @@ -2,8 +2,8 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; +import { authGuard } from '@core/guards/auth.guard'; import { registrationModerationGuard } from '@core/guards/registration-moderation.guard'; -import { authGuard } from '@osf/core/guards'; import { RegistriesComponent } from '@osf/features/registries/registries.component'; import { RegistriesState } from '@osf/features/registries/store'; import { CitationsState } from '@osf/shared/stores/citations'; diff --git a/src/app/features/registries/services/licenses.service.ts b/src/app/features/registries/services/licenses.service.ts index e20ac47ee..944637ac0 100644 --- a/src/app/features/registries/services/licenses.service.ts +++ b/src/app/features/registries/services/licenses.service.ts @@ -4,15 +4,14 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { RegistrationMapper } from '@osf/shared/mappers/registration'; +import { LicenseModel, LicenseOptions } from '@osf/shared/models/license/license.model'; +import { LicensesResponseJsonApi } from '@osf/shared/models/license/licenses-json-api.model'; +import { DraftRegistrationModel } from '@osf/shared/models/registration/draft-registration.model'; import { CreateRegistrationPayloadJsonApi, DraftRegistrationDataJsonApi, - DraftRegistrationModel, - LicenseModel, - LicenseOptions, - LicensesResponseJsonApi, -} from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +} from '@osf/shared/models/registration/registration-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { LicensesMapper } from '../mappers'; diff --git a/src/app/features/registries/services/registries.service.ts b/src/app/features/registries/services/registries.service.ts index cd43f80ca..ba29bd3d8 100644 --- a/src/app/features/registries/services/registries.service.ts +++ b/src/app/features/registries/services/registries.service.ts @@ -4,26 +4,26 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { PageSchemaMapper, RegistrationMapper } from '@osf/shared/mappers/registration'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { DraftRegistrationModel } from '@osf/shared/models/registration/draft-registration.model'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { RegistrationModel } from '@osf/shared/models/registration/registration.model'; +import { RegistrationCard } from '@osf/shared/models/registration/registration-card.model'; import { DraftRegistrationDataJsonApi, - DraftRegistrationModel, DraftRegistrationRelationshipsJsonApi, DraftRegistrationResponseJsonApi, - PageSchema, - PaginatedData, RegistrationAttributesJsonApi, - RegistrationCard, RegistrationDataJsonApi, - RegistrationModel, RegistrationResponseJsonApi, - ResponseJsonApi, - SchemaBlocksResponseJsonApi, - SchemaResponse, SchemaResponseDataJsonApi, SchemaResponseJsonApi, SchemaResponsesJsonApi, -} from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +} from '@osf/shared/models/registration/registration-json-api.model'; +import { SchemaBlocksResponseJsonApi } from '@osf/shared/models/registration/schema-blocks-json-api.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { SchemaActionTrigger } from '../enums'; diff --git a/src/app/features/registries/store/handlers/files.handlers.ts b/src/app/features/registries/store/handlers/files.handlers.ts index aa2e1a7a6..478dd1e8e 100644 --- a/src/app/features/registries/store/handlers/files.handlers.ts +++ b/src/app/features/registries/store/handlers/files.handlers.ts @@ -4,8 +4,8 @@ import { catchError, finalize, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { FilesService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { FilesService } from '@osf/shared/services/files.service'; import { CreateFolder, GetFiles, GetRootFolders } from '../registries.actions'; import { RegistriesStateModel } from '../registries.model'; diff --git a/src/app/features/registries/store/handlers/licenses.handlers.ts b/src/app/features/registries/store/handlers/licenses.handlers.ts index affceefcd..b3cc42dc0 100644 --- a/src/app/features/registries/store/handlers/licenses.handlers.ts +++ b/src/app/features/registries/store/handlers/licenses.handlers.ts @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { LicensesService } from '../../services'; import { SaveLicense } from '../registries.actions'; diff --git a/src/app/features/registries/store/handlers/projects.handlers.ts b/src/app/features/registries/store/handlers/projects.handlers.ts index 000f4898b..9738d8442 100644 --- a/src/app/features/registries/store/handlers/projects.handlers.ts +++ b/src/app/features/registries/store/handlers/projects.handlers.ts @@ -2,7 +2,7 @@ import { StateContext } from '@ngxs/store'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { ProjectsService } from '@osf/shared/services/projects.service'; import { ProjectShortInfoModel } from '../../models'; diff --git a/src/app/features/registries/store/registries.actions.ts b/src/app/features/registries/store/registries.actions.ts index 0b7d8c431..3c410a411 100644 --- a/src/app/features/registries/store/registries.actions.ts +++ b/src/app/features/registries/store/registries.actions.ts @@ -1,9 +1,9 @@ +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { LicenseOptions } from '@osf/shared/models/license/license.model'; import { DraftRegistrationAttributesJsonApi, DraftRegistrationRelationshipsJsonApi, - FileFolderModel, - LicenseOptions, -} from '@osf/shared/models'; +} from '@osf/shared/models/registration/registration-json-api.model'; import { SchemaActionTrigger } from '../enums'; diff --git a/src/app/features/registries/store/registries.model.ts b/src/app/features/registries/store/registries.model.ts index 1f457fdb5..f83ee5291 100644 --- a/src/app/features/registries/store/registries.model.ts +++ b/src/app/features/registries/store/registries.model.ts @@ -1,17 +1,15 @@ -import { - AsyncStateModel, - AsyncStateWithTotalCount, - DraftRegistrationModel, - FileFolderModel, - FileModel, - LicenseModel, - PageSchema, - ProviderSchema, - RegistrationCard, - RegistrationModel, - ResourceModel, - SchemaResponse, -} from '@shared/models'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { DraftRegistrationModel } from '@osf/shared/models/registration/draft-registration.model'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { ProviderSchema } from '@osf/shared/models/registration/provider-schema.model'; +import { RegistrationModel } from '@osf/shared/models/registration/registration.model'; +import { RegistrationCard } from '@osf/shared/models/registration/registration-card.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { ProjectShortInfoModel } from '../models'; diff --git a/src/app/features/registries/store/registries.selectors.ts b/src/app/features/registries/store/registries.selectors.ts index 82b37c498..3335b9191 100644 --- a/src/app/features/registries/store/registries.selectors.ts +++ b/src/app/features/registries/store/registries.selectors.ts @@ -1,17 +1,15 @@ import { Selector } from '@ngxs/store'; -import { - DraftRegistrationModel, - FileFolderModel, - FileModel, - LicenseModel, - PageSchema, - ProviderSchema, - RegistrationCard, - RegistrationModel, - ResourceModel, - SchemaResponse, -} from '@shared/models'; +import { FileModel } from '@osf/shared/models/files/file.model'; +import { FileFolderModel } from '@osf/shared/models/files/file-folder.model'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { DraftRegistrationModel } from '@osf/shared/models/registration/draft-registration.model'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { ProviderSchema } from '@osf/shared/models/registration/provider-schema.model'; +import { RegistrationModel } from '@osf/shared/models/registration/registration.model'; +import { RegistrationCard } from '@osf/shared/models/registration/registration-card.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; import { ProjectShortInfoModel } from '../models'; diff --git a/src/app/features/registries/store/registries.state.ts b/src/app/features/registries/store/registries.state.ts index 95addb8eb..c2a228be4 100644 --- a/src/app/features/registries/store/registries.state.ts +++ b/src/app/features/registries/store/registries.state.ts @@ -5,9 +5,10 @@ import { catchError, tap } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '@osf/shared/enums'; -import { getResourceTypeStringFromEnum, handleSectionError } from '@osf/shared/helpers'; -import { GlobalSearchService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { getResourceTypeStringFromEnum } from '@osf/shared/helpers/get-resource-types.helper'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { GlobalSearchService } from '@osf/shared/services/global-search.service'; import { RegistriesService } from '../services'; diff --git a/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.spec.ts b/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.spec.ts index 0d45a41b3..3def8b45c 100644 --- a/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.spec.ts +++ b/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.spec.ts @@ -1,5 +1,12 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; + +import { ResourceFormComponent } from '../resource-form/resource-form.component'; + import { AddResourceDialogComponent } from './add-resource-dialog.component'; describe('AddResourceDialogComponent', () => { @@ -8,7 +15,10 @@ describe('AddResourceDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddResourceDialogComponent], + imports: [ + AddResourceDialogComponent, + ...MockComponents(LoadingSpinnerComponent, ResourceFormComponent, IconComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(AddResourceDialogComponent); diff --git a/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.ts b/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.ts index 1bd9a0ad6..814a8cdf8 100644 --- a/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.ts +++ b/src/app/features/registry/components/add-resource-dialog/add-resource-dialog.component.ts @@ -10,11 +10,12 @@ import { finalize, take } from 'rxjs'; import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { IconComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { RegistryResourceType } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; -import { SelectOption } from '@osf/shared/models'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { RegistryResourceType } from '@osf/shared/enums/registry-resource.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { SelectOption } from '@shared/models/select-option.model'; import { resourceTypeOptions } from '../../constants'; import { AddResource, ConfirmAddResource, RegistryResourceFormModel } from '../../models'; diff --git a/src/app/features/registry/components/archiving-message/archiving-message.component.spec.ts b/src/app/features/registry/components/archiving-message/archiving-message.component.spec.ts index 29c91755a..a13adc258 100644 --- a/src/app/features/registry/components/archiving-message/archiving-message.component.spec.ts +++ b/src/app/features/registry/components/archiving-message/archiving-message.component.spec.ts @@ -2,10 +2,10 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ShortRegistrationInfoComponent } from '@osf/features/registry/components/short-registration-info/short-registration-info.component'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { RegistryOverview } from '../../models'; +import { ShortRegistrationInfoComponent } from '../short-registration-info/short-registration-info.component'; import { ArchivingMessageComponent } from './archiving-message.component'; diff --git a/src/app/features/registry/components/archiving-message/archiving-message.component.ts b/src/app/features/registry/components/archiving-message/archiving-message.component.ts index c34f9931e..8e3e96293 100644 --- a/src/app/features/registry/components/archiving-message/archiving-message.component.ts +++ b/src/app/features/registry/components/archiving-message/archiving-message.component.ts @@ -6,7 +6,7 @@ import { Divider } from 'primeng/divider'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { IconComponent } from '@osf/shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { RegistryOverview } from '../../models'; import { ShortRegistrationInfoComponent } from '../short-registration-info/short-registration-info.component'; diff --git a/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.spec.ts b/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.spec.ts index 6acef847c..9d1d9e8ef 100644 --- a/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.spec.ts +++ b/src/app/features/registry/components/edit-resource-dialog/edit-resource-dialog.component.spec.ts @@ -4,9 +4,10 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceFormComponent } from '@osf/features/registry/components'; -import { RegistryResourcesSelectors } from '@osf/features/registry/store/registry-resources'; -import { LoadingSpinnerComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; + +import { RegistryResourcesSelectors } from '../../store/registry-resources'; +import { ResourceFormComponent } from '../resource-form/resource-form.component'; import { EditResourceDialogComponent } from './edit-resource-dialog.component'; 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 39915fcdf..a6e84c692 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 @@ -7,8 +7,8 @@ import { finalize, take } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { LoadingSpinnerComponent } from '@osf/shared/components'; -import { CustomValidators } from '@osf/shared/helpers'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { AddResource, RegistryResource } from '../../models'; import { RegistryResourcesSelectors, UpdateResource } from '../../store/registry-resources'; diff --git a/src/app/features/registry/components/registration-links-card/registration-links-card.component.spec.ts b/src/app/features/registry/components/registration-links-card/registration-links-card.component.spec.ts index fb9304bcd..d7d2d81bb 100644 --- a/src/app/features/registry/components/registration-links-card/registration-links-card.component.spec.ts +++ b/src/app/features/registry/components/registration-links-card/registration-links-card.component.spec.ts @@ -1,5 +1,12 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { DataResourcesComponent } from '@osf/shared/components/data-resources/data-resources.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; + import { RegistrationLinksCardComponent } from './registration-links-card.component'; describe('RegistrationLinksCardComponent', () => { @@ -8,7 +15,10 @@ describe('RegistrationLinksCardComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RegistrationLinksCardComponent], + imports: [ + RegistrationLinksCardComponent, + ...MockComponents(DataResourcesComponent, TruncatedTextComponent, IconComponent, ContributorsListComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(RegistrationLinksCardComponent); 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 a5b50c72e..a050662ce 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 @@ -6,13 +6,11 @@ import { Card } from 'primeng/card'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; -import { - ContributorsListComponent, - DataResourcesComponent, - IconComponent, - TruncatedTextComponent, -} from '@osf/shared/components'; -import { RevisionReviewStates } from '@osf/shared/enums'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { DataResourcesComponent } from '@osf/shared/components/data-resources/data-resources.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; import { LinkedNode, LinkedRegistration, RegistryComponentModel } from '../../models'; diff --git a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts index 8bcebc001..10a78ca3e 100644 --- a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts +++ b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts @@ -6,14 +6,11 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { - ModerationDecisionFormControls, - RegistrationReviewStates, - ReviewActionTrigger, - RevisionReviewStates, - SchemaResponseActionTrigger, -} from '@osf/shared/enums'; -import { DateAgoPipe } from '@shared/pipes'; +import { ModerationDecisionFormControls } from '@osf/shared/enums/moderation-decision-form-controls.enum'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { ReviewActionTrigger, SchemaResponseActionTrigger } from '@osf/shared/enums/trigger-action.enum'; +import { DateAgoPipe } from '@shared/pipes/date-ago.pipe'; import { RegistryMakeDecisionComponent } from './registry-make-decision.component'; 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 028ffa539..25e80e226 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 @@ -16,15 +16,13 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; import { SubmissionReviewStatus } from '@osf/features/moderation/enums'; -import { INPUT_VALIDATION_MESSAGES, InputLimits } from '@osf/shared/constants'; -import { - ModerationDecisionFormControls, - RegistrationReviewStates, - ReviewActionTrigger, - RevisionReviewStates, - SchemaResponseActionTrigger, -} from '@osf/shared/enums'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { ModerationDecisionFormControls } from '@osf/shared/enums/moderation-decision-form-controls.enum'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { ReviewActionTrigger, SchemaResponseActionTrigger } from '@osf/shared/enums/trigger-action.enum'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { RegistryOverview } from '../../models'; import { RegistryOverviewSelectors, SubmitDecision } from '../../store/registry-overview'; diff --git a/src/app/features/registry/components/registry-revisions/registry-revisions.component.spec.ts b/src/app/features/registry/components/registry-revisions/registry-revisions.component.spec.ts index f245a4030..cc073e6a8 100644 --- a/src/app/features/registry/components/registry-revisions/registry-revisions.component.spec.ts +++ b/src/app/features/registry/components/registry-revisions/registry-revisions.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; import { RegistryRevisionsComponent } from './registry-revisions.component'; 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 be870a199..6795f54a2 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 @@ -7,8 +7,8 @@ import { ChangeDetectionStrategy, Component, computed, HostBinding, input, outpu import { RouterLink } from '@angular/router'; import { RegistryOverview } from '@osf/features/registry/models'; -import { RegistrationReviewStates } from '@osf/shared/enums'; -import { RevisionReviewStates } from '@shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; @Component({ selector: 'osf-registry-revisions', diff --git a/src/app/features/registry/components/registry-statuses/registry-statuses.component.spec.ts b/src/app/features/registry/components/registry-statuses/registry-statuses.component.spec.ts index f054aef59..00d18b3d6 100644 --- a/src/app/features/registry/components/registry-statuses/registry-statuses.component.spec.ts +++ b/src/app/features/registry/components/registry-statuses/registry-statuses.component.spec.ts @@ -2,8 +2,9 @@ import { MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { RegistrationReviewStates, RegistryStatus } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService } from '@osf/shared/services'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { RegistryStatusesComponent } from './registry-statuses.component'; 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 94d0b32da..4b67b8e02 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,8 +9,11 @@ import { ChangeDetectionStrategy, Component, computed, HostBinding, inject, inpu import { RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; -import { CustomConfirmationService, CustomDialogService } from '@osf/shared/services'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { RegistryOverview } from '../../models'; import { MakePublic } from '../../store/registry-overview'; diff --git a/src/app/features/registry/components/resource-form/resource-form.component.spec.ts b/src/app/features/registry/components/resource-form/resource-form.component.spec.ts index ca952d600..dca4279b0 100644 --- a/src/app/features/registry/components/resource-form/resource-form.component.spec.ts +++ b/src/app/features/registry/components/resource-form/resource-form.component.spec.ts @@ -1,9 +1,10 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; +import { FormControl, FormGroup } from '@angular/forms'; -import { FormSelectComponent, TextInputComponent } from '@shared/components'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { RegistryResourceFormModel } from '../../models'; @@ -23,12 +24,7 @@ describe('ResourceFormComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - ResourceFormComponent, - OSFTestingModule, - ReactiveFormsModule, - ...MockComponents(TextInputComponent, FormSelectComponent), - ], + imports: [ResourceFormComponent, OSFTestingModule, ...MockComponents(TextInputComponent, FormSelectComponent)], }).compileComponents(); fixture = TestBed.createComponent(ResourceFormComponent); diff --git a/src/app/features/registry/components/resource-form/resource-form.component.ts b/src/app/features/registry/components/resource-form/resource-form.component.ts index 8229f83e8..98db1e4fa 100644 --- a/src/app/features/registry/components/resource-form/resource-form.component.ts +++ b/src/app/features/registry/components/resource-form/resource-form.component.ts @@ -6,9 +6,10 @@ import { Textarea } from 'primeng/textarea'; import { ChangeDetectionStrategy, Component, input, output, signal } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { FormSelectComponent, TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { SelectOption } from '@osf/shared/models'; +import { FormSelectComponent } from '@osf/shared/components/form-select/form-select.component'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { SelectOption } from '@shared/models/select-option.model'; import { resourceTypeOptions } from '../../constants'; import { RegistryResourceFormModel } from '../../models'; diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.spec.ts b/src/app/features/registry/components/short-registration-info/short-registration-info.component.spec.ts index e925a7ab9..12209c783 100644 --- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.spec.ts +++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.spec.ts @@ -2,8 +2,8 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorsListComponent } from '@shared/components'; -import { RegistryStatus } from '@shared/enums'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; import { RegistryOverview } from '../../models'; 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 b859aec99..1f384f319 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 @@ -5,7 +5,7 @@ import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core import { RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ContributorsListComponent } from '@osf/shared/components'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; import { RegistryOverview } from '../../models'; diff --git a/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.spec.ts b/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.spec.ts index c874c52c2..1d65c6ad3 100644 --- a/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.spec.ts +++ b/src/app/features/registry/components/withdraw-dialog/withdraw-dialog.component.spec.ts @@ -4,7 +4,7 @@ import { DynamicDialogConfig } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { WithdrawDialogComponent } from './withdraw-dialog.component'; 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 8d0339eee..7b0b85ca2 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 @@ -11,9 +11,9 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { WithdrawRegistration } from '@osf/features/registry/store/registry-overview'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; @Component({ selector: 'osf-withdraw-dialog', diff --git a/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.spec.ts b/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.spec.ts index 4d4b83009..fd5edd72f 100644 --- a/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.spec.ts +++ b/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.spec.ts @@ -2,10 +2,10 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ShortRegistrationInfoComponent } from '@osf/features/registry/components/short-registration-info/short-registration-info.component'; -import { IconComponent } from '@shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { RegistryOverview } from '../../models'; +import { ShortRegistrationInfoComponent } from '../short-registration-info/short-registration-info.component'; import { WithdrawnMessageComponent } from './withdrawn-message.component'; diff --git a/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.ts b/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.ts index b2ce06a94..abd091be7 100644 --- a/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.ts +++ b/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.ts @@ -6,7 +6,7 @@ import { Divider } from 'primeng/divider'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { IconComponent } from '@osf/shared/components'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { RegistryOverview } from '../../models'; import { ShortRegistrationInfoComponent } from '../short-registration-info/short-registration-info.component'; diff --git a/src/app/features/registry/constants/resource-type-options.constant.ts b/src/app/features/registry/constants/resource-type-options.constant.ts index 4de962591..82027d9d4 100644 --- a/src/app/features/registry/constants/resource-type-options.constant.ts +++ b/src/app/features/registry/constants/resource-type-options.constant.ts @@ -1,5 +1,5 @@ -import { RegistryResourceType } from '@shared/enums'; -import { SelectOption } from '@shared/models'; +import { RegistryResourceType } from '@shared/enums/registry-resource.enum'; +import { SelectOption } from '@shared/models/select-option.model'; export const resourceTypeOptions: SelectOption[] = [ { diff --git a/src/app/features/registry/mappers/linked-nodes.mapper.ts b/src/app/features/registry/mappers/linked-nodes.mapper.ts index cfc31289e..441996057 100644 --- a/src/app/features/registry/mappers/linked-nodes.mapper.ts +++ b/src/app/features/registry/mappers/linked-nodes.mapper.ts @@ -1,4 +1,4 @@ -import { ContributorsMapper } from '@osf/shared/mappers'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; import { LinkedNode, LinkedNodeJsonApi } from '../models'; diff --git a/src/app/features/registry/mappers/linked-registrations.mapper.ts b/src/app/features/registry/mappers/linked-registrations.mapper.ts index a7d1f527e..c61b4e7da 100644 --- a/src/app/features/registry/mappers/linked-registrations.mapper.ts +++ b/src/app/features/registry/mappers/linked-registrations.mapper.ts @@ -1,4 +1,4 @@ -import { ContributorsMapper } from '@osf/shared/mappers'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; import { LinkedRegistration, LinkedRegistrationJsonApi } from '../models'; diff --git a/src/app/features/registry/mappers/registry-components.mapper.ts b/src/app/features/registry/mappers/registry-components.mapper.ts index 6d61f983d..5e8339323 100644 --- a/src/app/features/registry/mappers/registry-components.mapper.ts +++ b/src/app/features/registry/mappers/registry-components.mapper.ts @@ -1,4 +1,4 @@ -import { ContributorsMapper } from '@osf/shared/mappers'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; import { RegistryComponentJsonApi, RegistryComponentModel } from '../models'; diff --git a/src/app/features/registry/mappers/registry-overview.mapper.ts b/src/app/features/registry/mappers/registry-overview.mapper.ts index 34f611f00..c74b94110 100644 --- a/src/app/features/registry/mappers/registry-overview.mapper.ts +++ b/src/app/features/registry/mappers/registry-overview.mapper.ts @@ -1,4 +1,6 @@ -import { ContributorsMapper, IdentifiersMapper, LicensesMapper } from '@osf/shared/mappers'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; +import { IdentifiersMapper } from '@osf/shared/mappers/identifiers.mapper'; +import { LicensesMapper } from '@osf/shared/mappers/licenses.mapper'; import { MapRegistryStatus, RegistrationMapper, RegistrationNodeMapper } from '@osf/shared/mappers/registration'; import { RegistryOverview, RegistryOverviewJsonApiData } from '../models'; diff --git a/src/app/features/registry/models/get-registry-overview-json-api.model.ts b/src/app/features/registry/models/get-registry-overview-json-api.model.ts index 79bc04867..31a36dcb5 100644 --- a/src/app/features/registry/models/get-registry-overview-json-api.model.ts +++ b/src/app/features/registry/models/get-registry-overview-json-api.model.ts @@ -1,16 +1,17 @@ -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; import { ApiData, - ContributorDataJsonApi, - IdentifiersJsonApiData, JsonApiResponseWithMeta, - LicenseDataJsonApi, MetaAnonymousJsonApi, - RegistrationNodeAttributesJsonApi, - RegistryProviderDetailsJsonApi, ResponseJsonApi, - SchemaResponseDataJsonApi, -} from '@osf/shared/models'; +} from '@shared/models/common/json-api.model'; +import { ContributorDataJsonApi } from '@shared/models/contributors/contributor-response-json-api.model'; +import { IdentifiersJsonApiData } from '@shared/models/identifiers/identifier-json-api.model'; +import { LicenseDataJsonApi } from '@shared/models/license/licenses-json-api.model'; +import { RegistryProviderDetailsJsonApi } from '@shared/models/provider/registration-provider-json-api.model'; +import { SchemaResponseDataJsonApi } from '@shared/models/registration/registration-json-api.model'; +import { RegistrationNodeAttributesJsonApi } from '@shared/models/registration/registration-node-json-api.model'; export type GetRegistryOverviewJsonApi = JsonApiResponseWithMeta< RegistryOverviewJsonApiData, diff --git a/src/app/features/registry/models/linked-nodes-json-api.model.ts b/src/app/features/registry/models/linked-nodes-json-api.model.ts index d1b672cea..ce77cfc30 100644 --- a/src/app/features/registry/models/linked-nodes-json-api.model.ts +++ b/src/app/features/registry/models/linked-nodes-json-api.model.ts @@ -1,4 +1,6 @@ -import { BaseNodeAttributesJsonApi, ContributorDataJsonApi, MetaJsonApi } from '@osf/shared/models'; +import { MetaJsonApi } from '@osf/shared/models/common/json-api.model'; +import { ContributorDataJsonApi } from '@osf/shared/models/contributors/contributor-response-json-api.model'; +import { BaseNodeAttributesJsonApi } from '@osf/shared/models/nodes/base-node-attributes-json-api.model'; export interface LinkedNodeJsonApi { id: string; diff --git a/src/app/features/registry/models/linked-nodes.models.ts b/src/app/features/registry/models/linked-nodes.models.ts index 105fe3e14..f7795e9b4 100644 --- a/src/app/features/registry/models/linked-nodes.models.ts +++ b/src/app/features/registry/models/linked-nodes.models.ts @@ -1,5 +1,5 @@ -import { ContributorModel } from '@osf/shared/models'; -import { RegistrationReviewStates } from '@shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; export interface LinkedNode { id: string; diff --git a/src/app/features/registry/models/linked-registrations-json-api.model.ts b/src/app/features/registry/models/linked-registrations-json-api.model.ts index 6c34b8090..5e00b1a11 100644 --- a/src/app/features/registry/models/linked-registrations-json-api.model.ts +++ b/src/app/features/registry/models/linked-registrations-json-api.model.ts @@ -1,4 +1,6 @@ -import { ContributorDataJsonApi, MetaJsonApi, RegistrationNodeAttributesJsonApi } from '@osf/shared/models'; +import { MetaJsonApi } from '@osf/shared/models/common/json-api.model'; +import { ContributorDataJsonApi } from '@osf/shared/models/contributors/contributor-response-json-api.model'; +import { RegistrationNodeAttributesJsonApi } from '@osf/shared/models/registration/registration-node-json-api.model'; export interface LinkedRegistrationJsonApi { id: string; diff --git a/src/app/features/registry/models/linked-response.models.ts b/src/app/features/registry/models/linked-response.models.ts index 81e9d5a6c..8a3afd70d 100644 --- a/src/app/features/registry/models/linked-response.models.ts +++ b/src/app/features/registry/models/linked-response.models.ts @@ -1,4 +1,4 @@ -import { MetaJsonApi } from '@osf/shared/models'; +import { MetaJsonApi } from '@osf/shared/models/common/json-api.model'; import { LinkedNode, LinkedRegistration } from './linked-nodes.models'; diff --git a/src/app/features/registry/models/registry-components-json-api.model.ts b/src/app/features/registry/models/registry-components-json-api.model.ts index fb298d250..766b24e35 100644 --- a/src/app/features/registry/models/registry-components-json-api.model.ts +++ b/src/app/features/registry/models/registry-components-json-api.model.ts @@ -1,4 +1,6 @@ -import { ContributorDataJsonApi, MetaJsonApi, RegistrationNodeAttributesJsonApi } from '@osf/shared/models'; +import { MetaJsonApi } from '@osf/shared/models/common/json-api.model'; +import { ContributorDataJsonApi } from '@osf/shared/models/contributors/contributor-response-json-api.model'; +import { RegistrationNodeAttributesJsonApi } from '@osf/shared/models/registration/registration-node-json-api.model'; import { RegistryComponentModel } from './registry-components.models'; diff --git a/src/app/features/registry/models/registry-components.models.ts b/src/app/features/registry/models/registry-components.models.ts index b1f0158d3..ed7b7dcd5 100644 --- a/src/app/features/registry/models/registry-components.models.ts +++ b/src/app/features/registry/models/registry-components.models.ts @@ -1,4 +1,4 @@ -import { ContributorModel } from '@osf/shared/models'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; export interface RegistryComponentModel { id: string; diff --git a/src/app/features/registry/models/registry-overview.models.ts b/src/app/features/registry/models/registry-overview.models.ts index 1031f5c57..6af2bdbb3 100644 --- a/src/app/features/registry/models/registry-overview.models.ts +++ b/src/app/features/registry/models/registry-overview.models.ts @@ -1,17 +1,16 @@ -import { - ContributorModel, - Identifier, - IdTypeModel, - LicenseModel, - LicensesOption, - MetaAnonymousJsonApi, - ProviderShortInfoModel, - RegistrationNodeModel, - RegistrationResponses, - SchemaResponse, - SubjectModel, -} from '@osf/shared/models'; -import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates, UserPermissions } from '@shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { IdTypeModel } from '@shared/models/common/id-type.model'; +import { MetaAnonymousJsonApi } from '@shared/models/common/json-api.model'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; +import { LicenseModel, LicensesOption } from '@shared/models/license/license.model'; +import { ProviderShortInfoModel } from '@shared/models/provider/provider.model'; +import { RegistrationNodeModel, RegistrationResponses } from '@shared/models/registration/registration-node.model'; +import { SchemaResponse } from '@shared/models/registration/schema-response.model'; +import { SubjectModel } from '@shared/models/subject/subject.model'; export interface RegistryOverview { id: string; @@ -35,7 +34,7 @@ export interface RegistryOverview { nodeLicense?: LicensesOption; license?: LicenseModel; licenseUrl?: string; - identifiers?: Identifier[]; + identifiers?: IdentifierModel[]; analyticsKey: string; currentUserCanComment: boolean; currentUserPermissions: UserPermissions[]; @@ -74,7 +73,7 @@ export interface RegistrationOverviewModel extends RegistrationNodeModel { provider?: ProviderShortInfoModel; contributors: ContributorModel[]; license?: LicenseModel; - identifiers?: Identifier[]; + identifiers?: IdentifierModel[]; schemaResponses: SchemaResponse[]; status: RegistryStatus; } diff --git a/src/app/features/registry/models/resources/add-resource-response-json-api.model.ts b/src/app/features/registry/models/resources/add-resource-response-json-api.model.ts index c271e9501..436599c9e 100644 --- a/src/app/features/registry/models/resources/add-resource-response-json-api.model.ts +++ b/src/app/features/registry/models/resources/add-resource-response-json-api.model.ts @@ -1,5 +1,5 @@ -import { RegistryResourceType } from '@shared/enums'; -import { ApiData, JsonApiResponse } from '@shared/models'; +import { RegistryResourceType } from '@shared/enums/registry-resource.enum'; +import { ApiData, JsonApiResponse } from '@shared/models/common/json-api.model'; export type AddResourceJsonApi = JsonApiResponse; diff --git a/src/app/features/registry/models/resources/get-registry-resources-json-api.model.ts b/src/app/features/registry/models/resources/get-registry-resources-json-api.model.ts index 1460e39f4..56045739f 100644 --- a/src/app/features/registry/models/resources/get-registry-resources-json-api.model.ts +++ b/src/app/features/registry/models/resources/get-registry-resources-json-api.model.ts @@ -1,4 +1,4 @@ import { RegistryResourceDataJsonApi } from '@osf/features/registry/models/resources/add-resource-response-json-api.model'; -import { JsonApiResponse } from '@shared/models'; +import { JsonApiResponse } from '@shared/models/common/json-api.model'; export type GetRegistryResourcesJsonApi = JsonApiResponse; diff --git a/src/app/features/registry/models/resources/registry-resource.model.ts b/src/app/features/registry/models/resources/registry-resource.model.ts index 5ed0e36f1..03e7338ad 100644 --- a/src/app/features/registry/models/resources/registry-resource.model.ts +++ b/src/app/features/registry/models/resources/registry-resource.model.ts @@ -1,4 +1,4 @@ -import { RegistryResourceType } from '@shared/enums'; +import { RegistryResourceType } from '@osf/shared/enums/registry-resource.enum'; export interface RegistryResource { id: string; diff --git a/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.spec.ts b/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.spec.ts index be42f705e..18a25b67b 100644 --- a/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.spec.ts +++ b/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.spec.ts @@ -9,7 +9,7 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { ActivityLogDisplayService } from '@shared/services'; +import { ActivityLogDisplayService } from '@osf/shared/services/activity-logs/activity-log-display.service'; import { ClearActivityLogsStore, GetRegistrationActivityLogs } from '@shared/stores/activity-logs'; import { ActivityLogsState } from '@shared/stores/activity-logs/activity-logs.state'; @@ -24,10 +24,8 @@ describe('RegistrationRecentActivityComponent', () => { imports: [RegistrationRecentActivityComponent], providers: [ provideStore([ActivityLogsState]), - provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting(), - { provide: TranslateService, useValue: { @@ -39,12 +37,10 @@ describe('RegistrationRecentActivityComponent', () => { onTranslationChange: of({}), }, }, - { provide: ActivityLogDisplayService, useValue: { getActivityDisplay: jest.fn(() => 'formatted') }, }, - { provide: ActivatedRoute, useValue: { snapshot: { params: { id: 'reg123' } }, parent: null } }, ], }).compileComponents(); diff --git a/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.ts b/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.ts index 47f4e0d78..2ca855c53 100644 --- a/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.ts +++ b/src/app/features/registry/pages/registration-recent-activity/registration-recent-activity.component.ts @@ -10,7 +10,7 @@ import { ChangeDetectionStrategy, Component, computed, inject, OnDestroy, signal import { ActivatedRoute } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { CustomPaginatorComponent } from '@shared/components'; +import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { ACTIVITY_LOGS_DEFAULT_PAGE_SIZE } from '@shared/constants/activity-logs'; import { ActivityLogsSelectors, diff --git a/src/app/features/registry/pages/registry-components/registry-components.component.spec.ts b/src/app/features/registry/pages/registry-components/registry-components.component.spec.ts index 0862afd2b..f4c92add5 100644 --- a/src/app/features/registry/pages/registry-components/registry-components.component.spec.ts +++ b/src/app/features/registry/pages/registry-components/registry-components.component.spec.ts @@ -3,9 +3,12 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { RegistrationLinksCardComponent } from '@osf/features/registry/components'; -import { RegistryComponentsSelectors } from '@osf/features/registry/store/registry-components'; -import { LoadingSpinnerComponent, SubHeaderComponent, ViewOnlyLinkMessageComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; + +import { RegistrationLinksCardComponent } from '../../components/registration-links-card/registration-links-card.component'; +import { RegistryComponentsSelectors } from '../../store/registry-components'; import { RegistryComponentsComponent } from './registry-components.component'; 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 6f8170b59..55c7ec4ce 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,8 +5,10 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, computed, inject, OnInit, signal } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { LoadingSpinnerComponent, SubHeaderComponent, ViewOnlyLinkMessageComponent } from '@osf/shared/components'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; import { RegistrationLinksCardComponent } from '../../components'; import { GetRegistryComponents, RegistryComponentsSelectors } from '../../store/registry-components'; diff --git a/src/app/features/registry/pages/registry-links/registry-links.component.spec.ts b/src/app/features/registry/pages/registry-links/registry-links.component.spec.ts index 8783713d7..0be278e44 100644 --- a/src/app/features/registry/pages/registry-links/registry-links.component.spec.ts +++ b/src/app/features/registry/pages/registry-links/registry-links.component.spec.ts @@ -4,10 +4,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { RegistrationLinksCardComponent } from '@osf/features/registry/components'; -import { RegistryLinksSelectors } from '@osf/features/registry/store/registry-links'; -import { LoaderService } from '@osf/shared/services'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { LoaderService } from '@osf/shared/services/loader.service'; + +import { RegistrationLinksCardComponent } from '../../components'; +import { RegistryLinksSelectors } from '../../store/registry-links'; import { RegistryLinksComponent } from './registry-links.component'; 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 bc4bdb5c6..7f65e86dc 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,8 +8,9 @@ import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@ang import { ActivatedRoute, Router } from '@angular/router'; import { FetchAllSchemaResponses, RegistriesSelectors } from '@osf/features/registries/store'; -import { LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components'; -import { LoaderService } from '@osf/shared/services'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { RegistrationLinksCardComponent } from '../../components'; import { GetLinkedNodes, GetLinkedRegistrations, RegistryLinksSelectors } from '../../store/registry-links'; diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts b/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts index 4be112eea..a99c6fbb4 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts @@ -4,19 +4,17 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { OverviewToolbarComponent } from '@osf/features/project/overview/components'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { WithdrawnMessageComponent } from '@osf/features/registry/components/withdrawn-message/withdrawn-message.component'; -import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; -import { - DataResourcesComponent, - LoadingSpinnerComponent, - RegistrationBlocksDataComponent, - ResourceMetadataComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@osf/shared/components'; -import { CustomDialogService } from '@osf/shared/services'; +import { DataResourcesComponent } from '@osf/shared/components/data-resources/data-resources.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ArchivingMessageComponent, RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components'; +import { WithdrawnMessageComponent } from '../../components/withdrawn-message/withdrawn-message.component'; +import { RegistryOverviewSelectors } from '../../store/registry-overview'; import { RegistryOverviewComponent } from './registry-overview.component'; diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts index dddd713b2..883bd397d 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts @@ -22,19 +22,21 @@ import { ActivatedRoute, Router } from '@angular/router'; import { OverviewToolbarComponent } from '@osf/features/project/overview/components'; import { CreateSchemaResponse, FetchAllSchemaResponses, RegistriesSelectors } from '@osf/features/registries/store'; -import { - DataResourcesComponent, - LoadingSpinnerComponent, - RegistrationBlocksDataComponent, - ResourceMetadataComponent, - SubHeaderComponent, - ViewOnlyLinkMessageComponent, -} from '@osf/shared/components'; -import { RegistrationReviewStates, ResourceType, RevisionReviewStates, UserPermissions } from '@osf/shared/enums'; -import { hasViewOnlyParam, toCamelCase } from '@osf/shared/helpers'; -import { MapRegistryOverview } from '@osf/shared/mappers'; -import { SchemaResponse, ToolbarResource } from '@osf/shared/models'; -import { CustomDialogService, ToastService } from '@osf/shared/services'; +import { DataResourcesComponent } from '@osf/shared/components/data-resources/data-resources.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { toCamelCase } from '@osf/shared/helpers/camel-case'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { MapRegistryOverview } from '@osf/shared/mappers/resource-overview.mappers'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks'; import { ContributorsSelectors, @@ -42,6 +44,8 @@ import { LoadMoreBibliographicContributors, } from '@osf/shared/stores/contributors'; import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects'; +import { SchemaResponse } from '@shared/models/registration/schema-response.model'; +import { ToolbarResource } from '@shared/models/toolbar-resource.model'; import { ArchivingMessageComponent, RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components'; import { RegistryMakeDecisionComponent } from '../../components/registry-make-decision/registry-make-decision.component'; diff --git a/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts b/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts index 7cc64e8a2..a1a581ab0 100644 --- a/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts +++ b/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts @@ -6,10 +6,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { MetadataSelectors } from '@osf/features/metadata/store'; -import { RegistryResourcesSelectors } from '@osf/features/registry/store/registry-resources'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; -import { IconComponent, LoadingSpinnerComponent, SubHeaderComponent } from '@shared/components'; -import { UserPermissions } from '@shared/enums'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; + +import { RegistryResourcesSelectors } from '../../store/registry-resources'; import { RegistryResourcesComponent } from './registry-resources.component'; 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 beaff82f8..06d521f71 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 @@ -11,9 +11,14 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute } from '@angular/router'; import { GetResourceMetadata, MetadataSelectors } from '@osf/features/metadata/store'; -import { IconComponent, LoadingSpinnerComponent, SubHeaderComponent } from '@osf/shared/components'; -import { CustomConfirmationService, CustomDialogService, ToastService } from '@osf/shared/services'; -import { ResourceType, UserPermissions } from '@shared/enums'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AddResourceDialogComponent, EditResourceDialogComponent } from '../../components'; import { RegistryResource } from '../../models'; diff --git a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.spec.ts b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.spec.ts index 7259a5d1f..6c40a0960 100644 --- a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.spec.ts +++ b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.spec.ts @@ -4,10 +4,13 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; -import { WikiModes } from '@osf/shared/models'; -import { SubHeaderComponent, ViewOnlyLinkMessageComponent } from '@shared/components'; -import { CompareSectionComponent, ViewSectionComponent, WikiListComponent } from '@shared/components/wiki'; -import { WikiSelectors } from '@shared/stores/wiki'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { CompareSectionComponent } from '@osf/shared/components/wiki/compare-section/compare-section.component'; +import { ViewSectionComponent } from '@osf/shared/components/wiki/view-section/view-section.component'; +import { WikiListComponent } from '@osf/shared/components/wiki/wiki-list/wiki-list.component'; +import { WikiModes } from '@osf/shared/models/wiki/wiki.model'; +import { WikiSelectors } from '@osf/shared/stores/wiki'; import { RegistryWikiComponent } from './registry-wiki.component'; diff --git a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts index f8493272a..fe74f18b7 100644 --- a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts +++ b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts @@ -11,11 +11,14 @@ import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject } from import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { SubHeaderComponent, ViewOnlyLinkMessageComponent } from '@osf/shared/components'; -import { CompareSectionComponent, ViewSectionComponent, WikiListComponent } from '@osf/shared/components/wiki'; -import { ResourceType } from '@osf/shared/enums'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; -import { WikiModes } from '@osf/shared/models'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; +import { CompareSectionComponent } from '@osf/shared/components/wiki/compare-section/compare-section.component'; +import { ViewSectionComponent } from '@osf/shared/components/wiki/view-section/view-section.component'; +import { WikiListComponent } from '@osf/shared/components/wiki/wiki-list/wiki-list.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { WikiModes } from '@osf/shared/models/wiki/wiki.model'; import { ClearWiki, GetCompareVersionContent, diff --git a/src/app/features/registry/registry.component.spec.ts b/src/app/features/registry/registry.component.spec.ts index 09dcb255a..7e8e7d99a 100644 --- a/src/app/features/registry/registry.component.spec.ts +++ b/src/app/features/registry/registry.component.spec.ts @@ -4,7 +4,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; -import { AnalyticsService, MetaTagsService } from '@osf/shared/services'; +import { AnalyticsService } from '@osf/shared/services/analytics.service'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { RegistryComponent } from './registry.component'; diff --git a/src/app/features/registry/registry.component.ts b/src/app/features/registry/registry.component.ts index 03ff2b96f..10ad5ba82 100644 --- a/src/app/features/registry/registry.component.ts +++ b/src/app/features/registry/registry.component.ts @@ -9,8 +9,9 @@ import { ActivatedRoute, RouterOutlet } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ClearCurrentProvider } from '@core/store/provider'; -import { pathJoin } from '@osf/shared/helpers'; -import { AnalyticsService, MetaTagsService } from '@osf/shared/services'; +import { pathJoin } from '@osf/shared/helpers/path-join.helper'; +import { AnalyticsService } from '@osf/shared/services/analytics.service'; +import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { GetRegistryById, RegistryOverviewSelectors } from './store/registry-overview'; diff --git a/src/app/features/registry/registry.routes.ts b/src/app/features/registry/registry.routes.ts index 31815be3e..b75c158bf 100644 --- a/src/app/features/registry/registry.routes.ts +++ b/src/app/features/registry/registry.routes.ts @@ -2,9 +2,8 @@ import { provideStates } from '@ngxs/store'; import { Routes } from '@angular/router'; -import { viewOnlyGuard } from '@osf/core/guards'; -import { ResourceType } from '@osf/shared/enums'; -import { LicensesService } from '@osf/shared/services'; +import { viewOnlyGuard } from '@core/guards/view-only.guard'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { CitationsState } from '@osf/shared/stores/citations'; import { DuplicatesState } from '@osf/shared/stores/duplicates'; import { SubjectsState } from '@osf/shared/stores/subjects'; @@ -12,6 +11,7 @@ import { ViewOnlyLinkState } from '@osf/shared/stores/view-only-links'; import { ActivityLogsState } from '@shared/stores/activity-logs'; import { AnalyticsState } from '../analytics/store'; +import { LicensesService } from '../registries/services'; import { RegistriesState } from '../registries/store'; import { LicensesHandlers, ProjectsHandlers, ProvidersHandlers } from '../registries/store/handlers'; import { FilesHandlers } from '../registries/store/handlers/files.handlers'; diff --git a/src/app/features/registry/services/registry-components.service.ts b/src/app/features/registry/services/registry-components.service.ts index 5832f7ce5..c91e7e26a 100644 --- a/src/app/features/registry/services/registry-components.service.ts +++ b/src/app/features/registry/services/registry-components.service.ts @@ -4,7 +4,7 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiService } from '@osf/shared/services'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { RegistryComponentsMapper } from '../mappers'; import { RegistryComponentsJsonApiResponse, RegistryComponentsResponseJsonApi } from '../models'; diff --git a/src/app/features/registry/services/registry-links.service.ts b/src/app/features/registry/services/registry-links.service.ts index fd5fd0194..64880d6ea 100644 --- a/src/app/features/registry/services/registry-links.service.ts +++ b/src/app/features/registry/services/registry-links.service.ts @@ -4,7 +4,7 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiService } from '@osf/shared/services'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { LinkedNodesMapper, LinkedRegistrationsMapper } from '../mappers'; import { diff --git a/src/app/features/registry/services/registry-overview.service.ts b/src/app/features/registry/services/registry-overview.service.ts index 933352ed1..98f9ce91b 100644 --- a/src/app/features/registry/services/registry-overview.service.ts +++ b/src/app/features/registry/services/registry-overview.service.ts @@ -5,18 +5,23 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { RegistryModerationMapper } from '@osf/features/moderation/mappers'; import { ReviewAction, ReviewActionsResponseJsonApi } from '@osf/features/moderation/models'; -import { MapRegistryOverview } from '@osf/features/registry/mappers'; +import { InstitutionsMapper } from '@osf/shared/mappers/institutions'; +import { PageSchemaMapper } from '@osf/shared/mappers/registration'; +import { ReviewActionsMapper } from '@osf/shared/mappers/review-actions.mapper'; +import { InstitutionsJsonApiResponse } from '@osf/shared/models/institutions/institution-json-api.model'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { SchemaBlocksResponseJsonApi } from '@osf/shared/models/registration/schema-blocks-json-api.model'; +import { ReviewActionPayload } from '@osf/shared/models/review-action/review-action-payload.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; + +import { MapRegistryOverview } from '../mappers'; import { GetRegistryOverviewJsonApi, RegistryOverview, RegistryOverviewJsonApiData, RegistryOverviewWithMeta, -} from '@osf/features/registry/models'; -import { InstitutionsMapper, ReviewActionsMapper } from '@osf/shared/mappers'; -import { PageSchemaMapper } from '@osf/shared/mappers/registration'; -import { Institution, InstitutionsJsonApiResponse, PageSchema, SchemaBlocksResponseJsonApi } from '@osf/shared/models'; -import { ReviewActionPayload } from '@osf/shared/models/review-action'; -import { JsonApiService } from '@shared/services'; +} from '../models'; @Injectable({ providedIn: 'root', diff --git a/src/app/features/registry/services/registry-resources.service.ts b/src/app/features/registry/services/registry-resources.service.ts index 9d6c6012c..8c70dc07e 100644 --- a/src/app/features/registry/services/registry-resources.service.ts +++ b/src/app/features/registry/services/registry-resources.service.ts @@ -3,15 +3,17 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MapAddResourceRequest, MapRegistryResource, toAddResourceRequestBody } from '@osf/features/registry/mappers'; -import { GetRegistryResourcesJsonApi, RegistryResource } from '@osf/features/registry/models'; -import { AddResource } from '@osf/features/registry/models/resources/add-resource.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; + +import { MapAddResourceRequest, MapRegistryResource, toAddResourceRequestBody } from '../mappers'; import { + AddResource, AddResourceJsonApi, + ConfirmAddResource, + GetRegistryResourcesJsonApi, + RegistryResource, RegistryResourceDataJsonApi, -} from '@osf/features/registry/models/resources/add-resource-response-json-api.model'; -import { ConfirmAddResource } from '@osf/features/registry/models/resources/confirm-add-resource.model'; -import { JsonApiService } from '@shared/services'; +} from '../models'; @Injectable({ providedIn: 'root', 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 d07b37b34..84f320fa1 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 @@ -1,4 +1,4 @@ -import { AsyncStateWithTotalCount } from '@shared/models'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; import { RegistryComponentModel } from '../../models'; 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 d3914fcbd..007289f5f 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 @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { RegistryComponentsService } from '../../services/registry-components.service'; 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 d183b97a2..554fb15c8 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 @@ -1,4 +1,4 @@ -import { AsyncStateModel } from '@shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { LinkedNode, LinkedRegistration } from '../../models'; 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 a7a22d86e..71ed14cbd 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 @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { RegistryLinksService } from '../../services/registry-links.service'; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.actions.ts b/src/app/features/registry/store/registry-overview/registry-overview.actions.ts index 782242af0..1083536fe 100644 --- a/src/app/features/registry/store/registry-overview/registry-overview.actions.ts +++ b/src/app/features/registry/store/registry-overview/registry-overview.actions.ts @@ -1,4 +1,4 @@ -import { ReviewActionPayload } from '@osf/shared/models/review-action'; +import { ReviewActionPayload } from '@osf/shared/models/review-action/review-action-payload.model'; export class GetRegistryById { static readonly type = '[Registry Overview] Get Registry By Id'; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.model.ts b/src/app/features/registry/store/registry-overview/registry-overview.model.ts index 78cf5c475..754d3ea9b 100644 --- a/src/app/features/registry/store/registry-overview/registry-overview.model.ts +++ b/src/app/features/registry/store/registry-overview/registry-overview.model.ts @@ -1,5 +1,7 @@ import { ReviewAction } from '@osf/features/moderation/models'; -import { AsyncStateModel, Institution, PageSchema } from '@osf/shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { RegistryOverview } from '../../models'; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts b/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts index 7486da84f..f2e0f3565 100644 --- a/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts +++ b/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts @@ -2,8 +2,9 @@ import { Selector } from '@ngxs/store'; import { ReviewAction } from '@osf/features/moderation/models'; import { RegistryOverview } from '@osf/features/registry/models'; -import { UserPermissions } from '@osf/shared/enums'; -import { Institution, PageSchema } from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { Institution } from '@shared/models/institutions/institutions.models'; +import { PageSchema } from '@shared/models/registration/page-schema.model'; import { RegistryOverviewStateModel } from './registry-overview.model'; import { RegistryOverviewState } from './registry-overview.state'; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.state.ts b/src/app/features/registry/store/registry-overview/registry-overview.state.ts index e43385cf7..312a8b817 100644 --- a/src/app/features/registry/store/registry-overview/registry-overview.state.ts +++ b/src/app/features/registry/store/registry-overview/registry-overview.state.ts @@ -6,8 +6,8 @@ import { catchError } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { SetCurrentProvider } from '@core/store/provider'; -import { CurrentResourceType } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { RegistryOverviewService } from '../../services'; diff --git a/src/app/features/registry/store/registry-resources/registry-resources.model.ts b/src/app/features/registry/store/registry-resources/registry-resources.model.ts index 00ca172bc..f51349805 100644 --- a/src/app/features/registry/store/registry-resources/registry-resources.model.ts +++ b/src/app/features/registry/store/registry-resources/registry-resources.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateModel } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { RegistryResource } from '../../models'; diff --git a/src/app/features/registry/store/registry-resources/registry-resources.state.ts b/src/app/features/registry/store/registry-resources/registry-resources.state.ts index 01c8932f3..c54223f86 100644 --- a/src/app/features/registry/store/registry-resources/registry-resources.state.ts +++ b/src/app/features/registry/store/registry-resources/registry-resources.state.ts @@ -5,7 +5,7 @@ import { catchError } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { RegistryResourcesService } from '../../services'; diff --git a/src/app/features/search/search.component.spec.ts b/src/app/features/search/search.component.spec.ts index 1930c08db..bbc554ebc 100644 --- a/src/app/features/search/search.component.spec.ts +++ b/src/app/features/search/search.component.spec.ts @@ -7,7 +7,7 @@ import { of } from 'rxjs'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { GlobalSearchComponent } from '@osf/shared/components'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; import { SearchComponent } from './search.component'; diff --git a/src/app/features/search/search.component.ts b/src/app/features/search/search.component.ts index cce94e232..b2aa8ca09 100644 --- a/src/app/features/search/search.component.ts +++ b/src/app/features/search/search.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { GlobalSearchComponent } from '@shared/components'; -import { SEARCH_TAB_OPTIONS } from '@shared/constants'; +import { GlobalSearchComponent } from '@osf/shared/components/global-search/global-search.component'; +import { SEARCH_TAB_OPTIONS } from '@osf/shared/constants/search-tab-options.const'; @Component({ selector: 'osf-search-page', diff --git a/src/app/features/settings/account-settings/account-settings.component.spec.ts b/src/app/features/settings/account-settings/account-settings.component.spec.ts index 6a8cfd3c9..f2e84d1b8 100644 --- a/src/app/features/settings/account-settings/account-settings.component.spec.ts +++ b/src/app/features/settings/account-settings/account-settings.component.spec.ts @@ -9,8 +9,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { provideNoopAnimations } from '@angular/platform-browser/animations'; import { UserSelectors } from '@osf/core/store/user'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { ToastService } from '@osf/shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { RegionsSelectors } from '@osf/shared/stores/regions'; import { AccountSettingsComponent } from './account-settings.component'; @@ -26,7 +26,10 @@ import { } from './components'; import { AccountSettingsSelectors } from './store'; -import { MOCK_STORE, MOCK_USER, MockCustomConfirmationServiceProvider, TranslateServiceMock } from '@testing/mocks'; +import { MockCustomConfirmationServiceProvider } from '@testing/mocks/custom-confirmation.service.mock'; +import { MOCK_USER } from '@testing/mocks/data.mock'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('AccountSettingsComponent', () => { let component: AccountSettingsComponent; diff --git a/src/app/features/settings/account-settings/account-settings.component.ts b/src/app/features/settings/account-settings/account-settings.component.ts index 36882cb61..fdc2d26bf 100644 --- a/src/app/features/settings/account-settings/account-settings.component.ts +++ b/src/app/features/settings/account-settings/account-settings.component.ts @@ -7,7 +7,7 @@ import { ReactiveFormsModule } from '@angular/forms'; import { GetEmails } from '@core/store/user-emails'; import { UserSelectors } from '@osf/core/store/user'; -import { SubHeaderComponent } from '@osf/shared/components'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { FetchRegions } from '@osf/shared/stores/regions'; import { diff --git a/src/app/features/settings/account-settings/components/add-email/add-email.component.spec.ts b/src/app/features/settings/account-settings/components/add-email/add-email.component.spec.ts index 3d7b238fe..d11698206 100644 --- a/src/app/features/settings/account-settings/components/add-email/add-email.component.spec.ts +++ b/src/app/features/settings/account-settings/components/add-email/add-email.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProviders } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProviders } from 'ng-mocks'; import { DynamicDialogRef } from 'primeng/dynamicdialog'; @@ -10,13 +10,14 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserEmailsState } from '@core/store/user-emails'; -import { ToastService } from '@shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsState } from '../../store'; import { AddEmailComponent } from './add-email.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('AddEmailComponent', () => { let component: AddEmailComponent; @@ -25,7 +26,7 @@ describe('AddEmailComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddEmailComponent, MockPipe(TranslatePipe)], + imports: [AddEmailComponent, MockComponent(TextInputComponent), MockPipe(TranslatePipe)], providers: [ provideStore([AccountSettingsState, UserEmailsState]), MockProviders(DynamicDialogRef, ToastService), diff --git a/src/app/features/settings/account-settings/components/add-email/add-email.component.ts b/src/app/features/settings/account-settings/components/add-email/add-email.component.ts index 126609877..acdc676b3 100644 --- a/src/app/features/settings/account-settings/components/add-email/add-email.component.ts +++ b/src/app/features/settings/account-settings/components/add-email/add-email.component.ts @@ -9,10 +9,10 @@ import { ChangeDetectionStrategy, Component, effect, inject } from '@angular/cor import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { AddEmail, UserEmailsSelectors } from '@core/store/user-emails'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ToastService } from '@osf/shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; @Component({ selector: 'osf-confirmation-sent-dialog', diff --git a/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.spec.ts b/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.spec.ts index 77fd549f0..64cabfb37 100644 --- a/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.spec.ts +++ b/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProviders } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProviders } from 'ng-mocks'; import { DynamicDialogRef } from 'primeng/dynamicdialog'; @@ -10,7 +10,9 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserState } from '@osf/core/store/user'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { ReadonlyInputComponent } from '@osf/shared/components/readonly-input/readonly-input.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsState } from '../../store'; @@ -26,7 +28,7 @@ describe('AffiliatedInstitutionsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AffiliatedInstitutionsComponent, MockPipe(TranslatePipe)], + imports: [AffiliatedInstitutionsComponent, MockComponent(ReadonlyInputComponent), MockPipe(TranslatePipe)], providers: [ provideStore([AccountSettingsState, UserState]), MockProviders(CustomConfirmationService, ToastService, DynamicDialogRef), diff --git a/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.ts b/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.ts index b9412784a..3168e20f1 100644 --- a/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.ts +++ b/src/app/features/settings/account-settings/components/affiliated-institutions/affiliated-institutions.component.ts @@ -9,9 +9,11 @@ import { finalize } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { UserSelectors } from '@osf/core/store/user'; -import { ReadonlyInputComponent } from '@osf/shared/components'; -import { Institution } from '@osf/shared/models'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { ReadonlyInputComponent } from '@osf/shared/components/readonly-input/readonly-input.component'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsSelectors, DeleteUserInstitution } from '../../store'; diff --git a/src/app/features/settings/account-settings/components/cancel-deactivation/cancel-deactivation.component.spec.ts b/src/app/features/settings/account-settings/components/cancel-deactivation/cancel-deactivation.component.spec.ts index 4bf3cdab8..a436a5bd4 100644 --- a/src/app/features/settings/account-settings/components/cancel-deactivation/cancel-deactivation.component.spec.ts +++ b/src/app/features/settings/account-settings/components/cancel-deactivation/cancel-deactivation.component.spec.ts @@ -9,7 +9,7 @@ import { provideHttpClient } from '@angular/common/http'; import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AccountSettingsState } from '@osf/features/settings/account-settings/store'; +import { AccountSettingsState } from '../../store'; import { CancelDeactivationComponent } from './cancel-deactivation.component'; diff --git a/src/app/features/settings/account-settings/components/change-password/change-password.component.spec.ts b/src/app/features/settings/account-settings/components/change-password/change-password.component.spec.ts index d79435993..cdfbe1f58 100644 --- a/src/app/features/settings/account-settings/components/change-password/change-password.component.spec.ts +++ b/src/app/features/settings/account-settings/components/change-password/change-password.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProvider } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { of, throwError } from 'rxjs'; @@ -9,13 +9,15 @@ import { HttpErrorResponse, provideHttpClient } from '@angular/common/http'; import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { LoaderService, ToastService } from '@shared/services'; +import { PasswordInputHintComponent } from '@osf/shared/components/password-input-hint/password-input-hint.component'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsState } from '../../store'; import { ChangePasswordComponent } from './change-password.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('ChangePasswordComponent', () => { let component: ChangePasswordComponent; @@ -24,7 +26,7 @@ describe('ChangePasswordComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ChangePasswordComponent, MockPipe(TranslatePipe)], + imports: [ChangePasswordComponent, MockComponent(PasswordInputHintComponent), MockPipe(TranslatePipe)], providers: [ provideStore([AccountSettingsState]), provideHttpClient(), diff --git a/src/app/features/settings/account-settings/components/change-password/change-password.component.ts b/src/app/features/settings/account-settings/components/change-password/change-password.component.ts index 16e9d4237..288d7a414 100644 --- a/src/app/features/settings/account-settings/components/change-password/change-password.component.ts +++ b/src/app/features/settings/account-settings/components/change-password/change-password.component.ts @@ -19,10 +19,13 @@ import { Validators, } from '@angular/forms'; -import { AuthService } from '@osf/core/services'; -import { PasswordInputHintComponent } from '@osf/shared/components'; -import { CustomValidators, FormValidationHelper, PASSWORD_REGEX } from '@osf/shared/helpers'; -import { LoaderService, ToastService } from '@osf/shared/services'; +import { AuthService } from '@core/services/auth.service'; +import { PasswordInputHintComponent } from '@osf/shared/components/password-input-hint/password-input-hint.component'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { FormValidationHelper } from '@osf/shared/helpers/form-validation.helper'; +import { PASSWORD_REGEX } from '@osf/shared/helpers/password.helper'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsPasswordForm, AccountSettingsPasswordFormControls } from '../../models'; import { UpdatePassword } from '../../store'; diff --git a/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.spec.ts b/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.spec.ts index 124b8ad83..648e2d22a 100644 --- a/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.spec.ts +++ b/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { MockPipe, MockProviders } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProviders } from 'ng-mocks'; import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; @@ -12,16 +12,20 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { DestroyRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { SetCurrentUser, UserState } from '@core/store/user'; import { UserEmailsState } from '@core/store/user-emails'; -import { SetCurrentUser, UserState } from '@osf/core/store/user'; -import { AddEmailComponent, ConfirmationSentDialogComponent } from '@osf/features/settings/account-settings/components'; -import { CustomConfirmationService, LoaderService, ToastService } from '@shared/services'; +import { ReadonlyInputComponent } from '@osf/shared/components/readonly-input/readonly-input.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; -import { AccountSettingsState } from '../../store'; +import { AddEmailComponent } from '../add-email/add-email.component'; +import { ConfirmationSentDialogComponent } from '../confirmation-sent-dialog/confirmation-sent-dialog.component'; import { ConnectedEmailsComponent } from './connected-emails.component'; -import { MOCK_USER, MockCustomConfirmationServiceProvider } from '@testing/mocks'; +import { MockCustomConfirmationServiceProvider } from '@testing/mocks/custom-confirmation.service.mock'; +import { MOCK_USER } from '@testing/mocks/data.mock'; describe('ConnectedEmailsComponent', () => { let component: ConnectedEmailsComponent; @@ -42,9 +46,9 @@ describe('ConnectedEmailsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ConnectedEmailsComponent, MockPipe(TranslatePipe)], + imports: [ConnectedEmailsComponent, MockComponent(ReadonlyInputComponent), MockPipe(TranslatePipe)], providers: [ - provideStore([AccountSettingsState, UserState, UserEmailsState]), + provideStore([UserState, UserEmailsState]), provideHttpClient(), provideHttpClientTesting(), MockProviders(DialogService, TranslateService, DestroyRef, LoaderService, ToastService), diff --git a/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.ts b/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.ts index 030c2b832..0a5443cbd 100644 --- a/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.ts +++ b/src/app/features/settings/account-settings/components/connected-emails/connected-emails.component.ts @@ -13,13 +13,16 @@ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { DeleteEmail, GetEmails, MakePrimary, ResendConfirmation, UserEmailsSelectors } from '@core/store/user-emails'; import { UserSelectors } from '@osf/core/store/user'; -import { ReadonlyInputComponent } from '@osf/shared/components'; -import { IS_SMALL } from '@osf/shared/helpers'; -import { CustomConfirmationService, CustomDialogService, LoaderService, ToastService } from '@osf/shared/services'; +import { ReadonlyInputComponent } from '@osf/shared/components/readonly-input/readonly-input.component'; +import { IS_SMALL } from '@osf/shared/helpers/breakpoints.tokens'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountEmail } from '../../models'; +import { AddEmailComponent } from '../add-email/add-email.component'; import { ConfirmationSentDialogComponent } from '../confirmation-sent-dialog/confirmation-sent-dialog.component'; -import { AddEmailComponent } from '../'; @Component({ selector: 'osf-connected-emails', diff --git a/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.spec.ts b/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.spec.ts index ce2807bc8..ce53a417a 100644 --- a/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.spec.ts +++ b/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProviders } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProviders } from 'ng-mocks'; import { of } from 'rxjs'; @@ -9,9 +9,12 @@ import { provideHttpClient } from '@angular/common/http'; import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ExternalIdentity } from '@osf/features/settings/account-settings/models'; -import { CustomConfirmationService, LoaderService, ToastService } from '@shared/services'; +import { ReadonlyInputComponent } from '@osf/shared/components/readonly-input/readonly-input.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ExternalIdentity } from '../../models'; import { AccountSettingsState } from '../../store/account-settings.state'; import { ConnectedIdentitiesComponent } from './connected-identities.component'; @@ -30,7 +33,7 @@ describe('ConnectedIdentitiesComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ConnectedIdentitiesComponent, MockPipe(TranslatePipe)], + imports: [ConnectedIdentitiesComponent, MockComponent(ReadonlyInputComponent), MockPipe(TranslatePipe)], providers: [ provideStore([AccountSettingsState]), provideHttpClient(), diff --git a/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.ts b/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.ts index 1809e7ecf..fa57af0ae 100644 --- a/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.ts +++ b/src/app/features/settings/account-settings/components/connected-identities/connected-identities.component.ts @@ -8,8 +8,10 @@ import { finalize } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; -import { ReadonlyInputComponent } from '@osf/shared/components'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { ReadonlyInputComponent } from '@osf/shared/components/readonly-input/readonly-input.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ExternalIdentity } from '../../models'; import { AccountSettingsSelectors, DeleteExternalIdentity } from '../../store'; diff --git a/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.spec.ts b/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.spec.ts index 72ac328cd..b2e591f8b 100644 --- a/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.spec.ts +++ b/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.spec.ts @@ -12,16 +12,15 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { provideNoopAnimations } from '@angular/platform-browser/animations'; -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; -import { AccountSettingsService } from '../../services'; import { AccountSettingsSelectors } from '../../store'; import { CancelDeactivationComponent } from '../cancel-deactivation/cancel-deactivation.component'; import { DeactivationWarningComponent } from '../deactivation-warning/deactivation-warning.component'; import { DeactivateAccountComponent } from './deactivate-account.component'; -import { MOCK_STORE } from '@testing/mocks'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; describe('DeactivateAccountComponent', () => { let component: DeactivateAccountComponent; @@ -47,14 +46,6 @@ describe('DeactivateAccountComponent', () => { return () => MOCK_ACCOUNT_SETTINGS; } - if (selector === AccountSettingsSelectors.getEmails) { - return () => []; - } - - if (selector === AccountSettingsSelectors.getRegions) { - return () => []; - } - return () => null; }); @@ -69,7 +60,7 @@ describe('DeactivateAccountComponent', () => { MockProvider(Store, store), provideHttpClient(), provideHttpClientTesting(), - MockProviders(DynamicDialogRef, DialogService, TranslateService, ToastService, AccountSettingsService), + MockProviders(DynamicDialogRef, DialogService, TranslateService, ToastService), ], }).compileComponents(); diff --git a/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.ts b/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.ts index e3520abd1..814385dee 100644 --- a/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.ts +++ b/src/app/features/settings/account-settings/components/deactivate-account/deactivate-account.component.ts @@ -10,7 +10,9 @@ import { filter } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; -import { CustomDialogService, LoaderService, ToastService } from '@osf/shared/services'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsSelectors, CancelDeactivationRequest, DeactivateAccount } from '../../store'; import { CancelDeactivationComponent } from '../cancel-deactivation/cancel-deactivation.component'; diff --git a/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.spec.ts b/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.spec.ts index 072034d2b..f5c6abcf1 100644 --- a/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.spec.ts +++ b/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.spec.ts @@ -9,14 +9,15 @@ import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserSelectors, UserState } from '@osf/core/store/user'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { RegionsSelectors, RegionsState } from '@osf/shared/stores/regions'; -import { LoaderService, ToastService } from '@shared/services'; import { AccountSettingsState } from '../../store'; import { DefaultStorageLocationComponent } from './default-storage-location.component'; -import { MOCK_STORE } from '@testing/mocks'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; describe('DefaultStorageLocationComponent', () => { let component: DefaultStorageLocationComponent; diff --git a/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.ts b/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.ts index c3cfff597..3f6dffd23 100644 --- a/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.ts +++ b/src/app/features/settings/account-settings/components/default-storage-location/default-storage-location.component.ts @@ -12,8 +12,9 @@ import { ChangeDetectionStrategy, Component, effect, inject, signal } from '@ang import { FormsModule } from '@angular/forms'; import { UserSelectors } from '@osf/core/store/user'; -import { IdName } from '@osf/shared/models'; -import { LoaderService, ToastService } from '@osf/shared/services'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { RegionsSelectors } from '@osf/shared/stores/regions'; import { UpdateRegion } from '../../store'; @@ -32,7 +33,7 @@ export class DefaultStorageLocationComponent { readonly currentUser = select(UserSelectors.getCurrentUser); readonly regions = select(RegionsSelectors.getRegions); - selectedRegion = signal(undefined); + selectedRegion = signal(undefined); constructor() { effect(() => { diff --git a/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.spec.ts b/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.spec.ts index 4cdeaf304..a8c409736 100644 --- a/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.spec.ts +++ b/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.spec.ts @@ -8,7 +8,7 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserState } from '@osf/core/store/user'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ShareIndexingComponent } from './share-indexing.component'; diff --git a/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.ts b/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.ts index dd5383740..6a9752680 100644 --- a/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.ts +++ b/src/app/features/settings/account-settings/components/share-indexing/share-indexing.component.ts @@ -12,7 +12,8 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { UserSelectors } from '@osf/core/store/user'; -import { LoaderService, ToastService } from '@osf/shared/services'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { UpdateIndexing } from '../../store'; diff --git a/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.spec.ts b/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.spec.ts index 3699f5a87..8cfb0500f 100644 --- a/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.spec.ts +++ b/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore, Store } from '@ngxs/store'; import { TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { MockPipe, MockProviders } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProviders } from 'ng-mocks'; import { MessageService } from 'primeng/api'; import { DialogService } from 'primeng/dynamicdialog'; @@ -13,13 +13,14 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { UserState } from '@osf/core/store/user'; -import { CustomConfirmationService } from '@shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; import { AccountSettingsState } from '../../store'; import { TwoFactorAuthComponent } from './two-factor-auth.component'; -import { MockCustomConfirmationServiceProvider } from '@testing/mocks'; +import { MockCustomConfirmationServiceProvider } from '@testing/mocks/custom-confirmation.service.mock'; +import { QRCodeComponent } from 'angularx-qrcode'; describe('TwoFactorAuthComponent', () => { let component: TwoFactorAuthComponent; @@ -29,7 +30,7 @@ describe('TwoFactorAuthComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [TwoFactorAuthComponent, MockPipe(TranslatePipe)], + imports: [TwoFactorAuthComponent, MockComponent(QRCodeComponent), MockPipe(TranslatePipe)], providers: [ provideStore([UserState, AccountSettingsState]), provideHttpClient(), diff --git a/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.ts b/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.ts index 15da34387..78d4525ce 100644 --- a/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.ts +++ b/src/app/features/settings/account-settings/components/two-factor-auth/two-factor-auth.component.ts @@ -11,8 +11,10 @@ import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/c import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { UserSelectors } from '@osf/core/store/user'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettingsSelectors, DisableTwoFactorAuth, EnableTwoFactorAuth, VerifyTwoFactorAuth } from '../../store'; diff --git a/src/app/features/settings/account-settings/mappers/external-identities.mapper.ts b/src/app/features/settings/account-settings/mappers/external-identities.mapper.ts index c78d01602..c9764c97e 100644 --- a/src/app/features/settings/account-settings/mappers/external-identities.mapper.ts +++ b/src/app/features/settings/account-settings/mappers/external-identities.mapper.ts @@ -1,4 +1,4 @@ -import { ApiData } from '@osf/shared/models'; +import { ApiData } from '@osf/shared/models/common/json-api.model'; import { ExternalIdentity, ExternalIdentityResponseJsonApi } from '../models'; diff --git a/src/app/features/settings/account-settings/models/responses/account-settings-response-json-api.model.ts b/src/app/features/settings/account-settings/models/responses/account-settings-response-json-api.model.ts index 6689ceb08..378c155c0 100644 --- a/src/app/features/settings/account-settings/models/responses/account-settings-response-json-api.model.ts +++ b/src/app/features/settings/account-settings/models/responses/account-settings-response-json-api.model.ts @@ -1,4 +1,4 @@ -import { ResponseDataJsonApi } from '@osf/shared/models'; +import { ResponseDataJsonApi } from '@osf/shared/models/common/json-api.model'; export type AccountSettingsResponseJsonApi = ResponseDataJsonApi; diff --git a/src/app/features/settings/account-settings/models/responses/list-identities-response.model.ts b/src/app/features/settings/account-settings/models/responses/list-identities-response.model.ts index 6c737b631..db2130601 100644 --- a/src/app/features/settings/account-settings/models/responses/list-identities-response.model.ts +++ b/src/app/features/settings/account-settings/models/responses/list-identities-response.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@osf/shared/models'; +import { ApiData, JsonApiResponse } from '@osf/shared/models/common/json-api.model'; export type ListIdentitiesResponseJsonApi = JsonApiResponse< ApiData[], diff --git a/src/app/features/settings/account-settings/services/account-settings.service.ts b/src/app/features/settings/account-settings/services/account-settings.service.ts index 55a7529f5..227cd29a0 100644 --- a/src/app/features/settings/account-settings/services/account-settings.service.ts +++ b/src/app/features/settings/account-settings/services/account-settings.service.ts @@ -3,9 +3,10 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { UserMapper } from '@osf/shared/mappers'; -import { UserDataJsonApi, UserModel } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { UserMapper } from '@osf/shared/mappers/user'; +import { UserModel } from '@osf/shared/models/user/user.models'; +import { UserDataJsonApi } from '@osf/shared/models/user/user-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { AccountSettingsMapper, MapExternalIdentities } from '../mappers'; import { diff --git a/src/app/features/settings/account-settings/store/account-settings.model.ts b/src/app/features/settings/account-settings/store/account-settings.model.ts index f65ca59a6..a81ac14ac 100644 --- a/src/app/features/settings/account-settings/store/account-settings.model.ts +++ b/src/app/features/settings/account-settings/store/account-settings.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { AccountSettings, ExternalIdentity } from '../models'; diff --git a/src/app/features/settings/account-settings/store/account-settings.selectors.ts b/src/app/features/settings/account-settings/store/account-settings.selectors.ts index ca7a1298b..bd418f0f0 100644 --- a/src/app/features/settings/account-settings/store/account-settings.selectors.ts +++ b/src/app/features/settings/account-settings/store/account-settings.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; import { AccountSettings, ExternalIdentity } from '../models'; diff --git a/src/app/features/settings/account-settings/store/account-settings.state.ts b/src/app/features/settings/account-settings/store/account-settings.state.ts index 500db92d3..eee615405 100644 --- a/src/app/features/settings/account-settings/store/account-settings.state.ts +++ b/src/app/features/settings/account-settings/store/account-settings.state.ts @@ -5,8 +5,8 @@ import { catchError, tap, throwError } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { SetCurrentUser, UserSelectors } from '@core/store/user'; -import { handleSectionError } from '@osf/shared/helpers'; -import { InstitutionsService } from '@shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { InstitutionsService } from '@osf/shared/services/institutions.service'; import { AccountSettingsMapper } from '../mappers'; import { AccountSettingsService } from '../services'; diff --git a/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.spec.ts b/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.spec.ts index 073496eb1..f07616d89 100644 --- a/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.spec.ts +++ b/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.spec.ts @@ -1,7 +1,7 @@ import { provideStore } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProviders } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProviders } from 'ng-mocks'; import { DynamicDialogRef } from 'primeng/dynamicdialog'; @@ -9,13 +9,14 @@ import { provideHttpClient } from '@angular/common/http'; import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ToastService } from '@shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperAppsState } from '../../store'; import { DeveloperAppAddEditFormComponent } from './developer-app-add-edit-form.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('CreateDeveloperAppComponent', () => { let component: DeveloperAppAddEditFormComponent; @@ -23,7 +24,7 @@ describe('CreateDeveloperAppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [DeveloperAppAddEditFormComponent, MockPipe(TranslatePipe)], + imports: [DeveloperAppAddEditFormComponent, MockComponent(TextInputComponent), MockPipe(TranslatePipe)], providers: [ provideHttpClient(), provideHttpClientTesting(), diff --git a/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.ts b/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.ts index 99932c866..beaadd301 100644 --- a/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.ts +++ b/src/app/features/settings/developer-apps/components/developer-app-add-edit-form/developer-app-add-edit-form.component.ts @@ -9,10 +9,10 @@ import { ChangeDetectionStrategy, Component, effect, inject, input, OnInit } fro import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ToastService } from '@osf/shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperApp, DeveloperAppCreateUpdate, DeveloperAppForm, DeveloperAppFormFormControls } from '../../models'; import { CreateDeveloperApp, DeveloperAppsSelectors, UpdateDeveloperApp } from '../../store'; diff --git a/src/app/features/settings/developer-apps/developer-apps-container.component.spec.ts b/src/app/features/settings/developer-apps/developer-apps-container.component.spec.ts index 3c3a0df8f..5223da761 100644 --- a/src/app/features/settings/developer-apps/developer-apps-container.component.spec.ts +++ b/src/app/features/settings/developer-apps/developer-apps-container.component.spec.ts @@ -1,5 +1,5 @@ import { TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { MockPipe, MockProvider } from 'ng-mocks'; +import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; @@ -8,11 +8,12 @@ import { Subject } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DeveloperAppAddEditFormComponent } from '@osf/features/settings/developer-apps/components'; -import { ToastService } from '@shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperAppsContainerComponent } from './developer-apps-container.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('DeveloperAppsContainerComponent', () => { let component: DeveloperAppsContainerComponent; @@ -27,7 +28,7 @@ describe('DeveloperAppsContainerComponent', () => { dialogRefMock = { onClose: new Subject() }; await TestBed.configureTestingModule({ - imports: [DeveloperAppsContainerComponent, MockPipe(TranslatePipe)], + imports: [DeveloperAppsContainerComponent, MockComponent(SubHeaderComponent), MockPipe(TranslatePipe)], providers: [MockProvider(DialogService), MockProvider(ToastService), TranslateServiceMock], }).compileComponents(); diff --git a/src/app/features/settings/developer-apps/developer-apps-container.component.ts b/src/app/features/settings/developer-apps/developer-apps-container.component.ts index aa08a715b..f50ea1b8d 100644 --- a/src/app/features/settings/developer-apps/developer-apps-container.component.ts +++ b/src/app/features/settings/developer-apps/developer-apps-container.component.ts @@ -6,8 +6,8 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { Router, RouterOutlet } from '@angular/router'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { CustomDialogService } from '@osf/shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { DeveloperAppAddEditFormComponent } from './components'; diff --git a/src/app/features/settings/developer-apps/models/developer-app-form.model.ts b/src/app/features/settings/developer-apps/models/developer-app-form.model.ts index 700935b29..199db88fc 100644 --- a/src/app/features/settings/developer-apps/models/developer-app-form.model.ts +++ b/src/app/features/settings/developer-apps/models/developer-app-form.model.ts @@ -1,6 +1,6 @@ import { FormControl, FormGroup } from '@angular/forms'; -import { StringOrNull } from '@osf/shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; export enum DeveloperAppFormFormControls { AppName = 'name', diff --git a/src/app/features/settings/developer-apps/models/developer-app-json-api.model.ts b/src/app/features/settings/developer-apps/models/developer-app-json-api.model.ts index 2faee1108..9b6d0ba48 100644 --- a/src/app/features/settings/developer-apps/models/developer-app-json-api.model.ts +++ b/src/app/features/settings/developer-apps/models/developer-app-json-api.model.ts @@ -1,4 +1,4 @@ -import { StringOrNull } from '@osf/shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; export interface DeveloperAppCreateRequestJsonApi { data: { diff --git a/src/app/features/settings/developer-apps/models/developer-apps.models.ts b/src/app/features/settings/developer-apps/models/developer-apps.models.ts index 82e4aab80..4f0912898 100644 --- a/src/app/features/settings/developer-apps/models/developer-apps.models.ts +++ b/src/app/features/settings/developer-apps/models/developer-apps.models.ts @@ -1,4 +1,4 @@ -import { StringOrNull } from '@osf/shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; export interface DeveloperApp { id: string; diff --git a/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.spec.ts b/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.spec.ts index e59555ae9..baa7c445f 100644 --- a/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.spec.ts +++ b/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.spec.ts @@ -12,7 +12,8 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperAppsState } from '../../store'; diff --git a/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.ts b/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.ts index eee6130bd..050c9242b 100644 --- a/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.ts +++ b/src/app/features/settings/developer-apps/pages/developer-app-details/developer-app-details.component.ts @@ -15,8 +15,11 @@ import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@a import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; -import { CopyButtonComponent, IconComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CopyButtonComponent } from '@osf/shared/components/copy-button/copy-button.component'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperAppAddEditFormComponent } from '../../components'; import { DeleteDeveloperApp, DeveloperAppsSelectors, GetDeveloperAppDetails, ResetClientSecret } from '../../store'; diff --git a/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.spec.ts b/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.spec.ts index 6a70960de..0d67ee7da 100644 --- a/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.spec.ts +++ b/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.spec.ts @@ -9,7 +9,8 @@ import { provideHttpClient } from '@angular/common/http'; import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperAppsState } from '../../store'; diff --git a/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.ts b/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.ts index 9916fe92e..74d6017db 100644 --- a/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.ts +++ b/src/app/features/settings/developer-apps/pages/developer-apps-list/developer-apps-list.component.ts @@ -9,7 +9,8 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { DeveloperApp } from '../../models'; import { DeleteDeveloperApp, DeveloperAppsSelectors, GetDeveloperApps } from '../../store'; diff --git a/src/app/features/settings/developer-apps/services/developer-apps.service.ts b/src/app/features/settings/developer-apps/services/developer-apps.service.ts index 7fb183628..55da7ae38 100644 --- a/src/app/features/settings/developer-apps/services/developer-apps.service.ts +++ b/src/app/features/settings/developer-apps/services/developer-apps.service.ts @@ -3,8 +3,8 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiResponse } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { DeveloperAppMapper } from '../mappers'; import { DeveloperApp, DeveloperAppCreateUpdate, DeveloperAppGetResponseJsonApi } from '../models'; diff --git a/src/app/features/settings/developer-apps/store/developer-apps.state-model.ts b/src/app/features/settings/developer-apps/store/developer-apps.state-model.ts index f4c70b6d7..e1e8c7ea5 100644 --- a/src/app/features/settings/developer-apps/store/developer-apps.state-model.ts +++ b/src/app/features/settings/developer-apps/store/developer-apps.state-model.ts @@ -1,4 +1,4 @@ -import { AsyncStateModel } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { DeveloperApp } from '../models'; diff --git a/src/app/features/settings/notifications/constants/notifications-constants.ts b/src/app/features/settings/notifications/constants/notifications-constants.ts index 943f9a041..1988f384c 100644 --- a/src/app/features/settings/notifications/constants/notifications-constants.ts +++ b/src/app/features/settings/notifications/constants/notifications-constants.ts @@ -1,4 +1,4 @@ -import { SubscriptionEvent } from '@shared/enums'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; import { SubscriptionEventModel } from '../models'; diff --git a/src/app/features/settings/notifications/models/subscription-event.model.ts b/src/app/features/settings/notifications/models/subscription-event.model.ts index 73d5428ac..d18970bf7 100644 --- a/src/app/features/settings/notifications/models/subscription-event.model.ts +++ b/src/app/features/settings/notifications/models/subscription-event.model.ts @@ -1,4 +1,4 @@ -import { SubscriptionEvent } from '@osf/shared/enums'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; export interface SubscriptionEventModel { event: SubscriptionEvent; diff --git a/src/app/features/settings/notifications/notifications.component.spec.ts b/src/app/features/settings/notifications/notifications.component.spec.ts index f05761011..20bbb53af 100644 --- a/src/app/features/settings/notifications/notifications.component.spec.ts +++ b/src/app/features/settings/notifications/notifications.component.spec.ts @@ -1,7 +1,7 @@ import { Store } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProvider } from 'ng-mocks'; +import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -9,11 +9,15 @@ import { provideHttpClient } from '@angular/common/http'; import { provideHttpClientTesting } from '@angular/common/http/testing'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { FormBuilder } from '@angular/forms'; import { UserSelectors } from '@osf/core/store/user'; -import { LoaderService, ToastService } from '@osf/shared/services'; -import { SubscriptionEvent, SubscriptionFrequency } from '@shared/enums'; +import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettings } from '../account-settings/models'; import { AccountSettingsSelectors } from '../account-settings/store'; @@ -21,7 +25,9 @@ import { AccountSettingsSelectors } from '../account-settings/store'; import { NotificationsComponent } from './notifications.component'; import { NotificationSubscriptionSelectors } from './store'; -import { MOCK_STORE, MOCK_USER, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { ToastServiceMockBuilder } from '@testing/providers/toast-provider.mock'; describe('NotificationsComponent', () => { @@ -36,10 +42,10 @@ describe('NotificationsComponent', () => { }; const mockNotificationSubscriptions = [ - { id: 'id1', event: SubscriptionEvent.GlobalMentions, frequency: SubscriptionFrequency.Daily }, + { id: 'id1', event: SubscriptionEvent.GlobalFileUpdated, frequency: SubscriptionFrequency.Daily }, { id: 'id2', - event: SubscriptionEvent.GlobalMentions, + event: SubscriptionEvent.GlobalFileUpdated, frequency: SubscriptionFrequency.Instant, }, ]; @@ -74,7 +80,11 @@ describe('NotificationsComponent', () => { MOCK_STORE.dispatch.mockImplementation(() => of()); await TestBed.configureTestingModule({ - imports: [NotificationsComponent, MockPipe(TranslatePipe), ReactiveFormsModule], + imports: [ + NotificationsComponent, + ...MockComponents(InfoIconComponent, SubHeaderComponent), + MockPipe(TranslatePipe), + ], providers: [ provideHttpClient(), provideHttpClientTesting(), @@ -126,7 +136,7 @@ describe('NotificationsComponent', () => { it('should call dispatch only once per subscription change', () => { const mockDispatch = jest.fn().mockReturnValue(of({})); MOCK_STORE.dispatch.mockImplementation(mockDispatch); - const event = SubscriptionEvent.GlobalMentions; + const event = SubscriptionEvent.GlobalFileUpdated; const frequency = SubscriptionFrequency.Daily; component.onSubscriptionChange(event, frequency); diff --git a/src/app/features/settings/notifications/notifications.component.ts b/src/app/features/settings/notifications/notifications.component.ts index 6a38717e6..327ae68ec 100644 --- a/src/app/features/settings/notifications/notifications.component.ts +++ b/src/app/features/settings/notifications/notifications.component.ts @@ -11,9 +11,12 @@ import { ChangeDetectionStrategy, Component, effect, HostBinding, inject, OnInit import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { UserSelectors } from '@core/store/user'; -import { InfoIconComponent, SubHeaderComponent } from '@osf/shared/components'; -import { SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums'; -import { LoaderService, ToastService } from '@osf/shared/services'; +import { InfoIconComponent } from '@osf/shared/components/info-icon/info-icon.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { AccountSettings } from '../account-settings/models'; import { AccountSettingsSelectors, GetAccountSettings, UpdateAccountSettings } from '../account-settings/store'; diff --git a/src/app/features/settings/notifications/services/notification-subscription.service.ts b/src/app/features/settings/notifications/services/notification-subscription.service.ts index b6461ea0b..061856ef4 100644 --- a/src/app/features/settings/notifications/services/notification-subscription.service.ts +++ b/src/app/features/settings/notifications/services/notification-subscription.service.ts @@ -3,14 +3,12 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SubscriptionFrequency } from '@osf/shared/enums'; -import { NotificationSubscriptionMapper } from '@osf/shared/mappers'; -import { - JsonApiResponse, - NotificationSubscription, - NotificationSubscriptionGetResponseJsonApi, -} from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { NotificationSubscriptionMapper } from '@osf/shared/mappers/notification-subscription.mapper'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; +import { NotificationSubscriptionGetResponseJsonApi } from '@osf/shared/models/notifications/notification-subscription-json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; @Injectable({ providedIn: 'root', @@ -25,7 +23,7 @@ export class NotificationSubscriptionService { getAllGlobalNotificationSubscriptions(): Observable { const params: Record = { - 'filter[event_name]': 'global_reviews,global_comments,global_comment_replies,global_file_updated,global_mentions', + 'filter[event_name]': 'global_reviews,global_file_updated', }; return this.jsonApiService diff --git a/src/app/features/settings/notifications/store/notification-subscription.actions.ts b/src/app/features/settings/notifications/store/notification-subscription.actions.ts index dd987411f..e7e3a8904 100644 --- a/src/app/features/settings/notifications/store/notification-subscription.actions.ts +++ b/src/app/features/settings/notifications/store/notification-subscription.actions.ts @@ -1,4 +1,4 @@ -import { SubscriptionFrequency } from '@shared/enums'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; export class GetAllGlobalNotificationSubscriptions { static readonly type = '[Notification Subscriptions] Get All Global'; diff --git a/src/app/features/settings/notifications/store/notification-subscription.model.ts b/src/app/features/settings/notifications/store/notification-subscription.model.ts index b76894743..d4c5df22c 100644 --- a/src/app/features/settings/notifications/store/notification-subscription.model.ts +++ b/src/app/features/settings/notifications/store/notification-subscription.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, NotificationSubscription } from '@osf/shared/models'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface NotificationSubscriptionStateModel { notificationSubscriptions: AsyncStateModel; diff --git a/src/app/features/settings/notifications/store/notification-subscription.selectors.ts b/src/app/features/settings/notifications/store/notification-subscription.selectors.ts index caf6c19e5..d4037ed95 100644 --- a/src/app/features/settings/notifications/store/notification-subscription.selectors.ts +++ b/src/app/features/settings/notifications/store/notification-subscription.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { NotificationSubscription } from '@osf/shared/models'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; import { NotificationSubscriptionStateModel } from './notification-subscription.model'; import { NotificationSubscriptionState } from './notification-subscription.state'; diff --git a/src/app/features/settings/notifications/store/notification-subscription.state.ts b/src/app/features/settings/notifications/store/notification-subscription.state.ts index daad47f5c..1c264ec12 100644 --- a/src/app/features/settings/notifications/store/notification-subscription.state.ts +++ b/src/app/features/settings/notifications/store/notification-subscription.state.ts @@ -5,8 +5,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { NotificationSubscription } from '@osf/shared/models'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; import { NotificationSubscriptionService } from '../services'; diff --git a/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.spec.ts b/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.spec.ts index b2cd9ce4a..792a425ed 100644 --- a/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.spec.ts @@ -4,11 +4,11 @@ import { MockPipes } from 'ng-mocks'; import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CitationFormatPipe } from '@shared/pipes'; +import { CitationFormatPipe } from '@shared/pipes/citation-format.pipe'; import { CitationPreviewComponent } from './citation-preview.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; describe('CitationPreviewComponent', () => { let component: CitationPreviewComponent; diff --git a/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.ts b/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.ts index 0bd778274..f7b4dde33 100644 --- a/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.ts +++ b/src/app/features/settings/profile-settings/components/citation-preview/citation-preview.component.ts @@ -2,8 +2,8 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { UserModel } from '@osf/shared/models'; -import { CitationFormatPipe } from '@osf/shared/pipes'; +import { UserModel } from '@osf/shared/models/user/user.models'; +import { CitationFormatPipe } from '@osf/shared/pipes/citation-format.pipe'; @Component({ selector: 'osf-citation-preview', diff --git a/src/app/features/settings/profile-settings/components/education-form/education-form.component.spec.ts b/src/app/features/settings/profile-settings/components/education-form/education-form.component.spec.ts index 1ab1563a2..b93bda627 100644 --- a/src/app/features/settings/profile-settings/components/education-form/education-form.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/education-form/education-form.component.spec.ts @@ -5,11 +5,11 @@ import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, FormGroup } from '@angular/forms'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { EducationFormComponent } from './education-form.component'; -import { MOCK_EDUCATION } from '@testing/mocks'; +import { MOCK_EDUCATION } from '@testing/mocks/user-employment-education.mock'; describe('EducationFormComponent', () => { let component: EducationFormComponent; diff --git a/src/app/features/settings/profile-settings/components/education-form/education-form.component.ts b/src/app/features/settings/profile-settings/components/education-form/education-form.component.ts index 2a498431c..6a6af659e 100644 --- a/src/app/features/settings/profile-settings/components/education-form/education-form.component.ts +++ b/src/app/features/settings/profile-settings/components/education-form/education-form.component.ts @@ -10,8 +10,8 @@ import { ChangeDetectionStrategy, Component, DestroyRef, inject, input, OnInit, import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; import { MAX_DATE, MIN_DATE } from '../../constants'; diff --git a/src/app/features/settings/profile-settings/components/education/education.component.spec.ts b/src/app/features/settings/profile-settings/components/education/education.component.spec.ts index e76cae717..958a758f4 100644 --- a/src/app/features/settings/profile-settings/components/education/education.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/education/education.component.spec.ts @@ -9,17 +9,18 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UpdateProfileSettingsEducation, UserSelectors } from '@core/store/user'; -import { EducationFormComponent } from '@osf/features/settings/profile-settings/components'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; + +import { EducationFormComponent } from '../education-form/education-form.component'; import { EducationComponent } from './education.component'; import { CustomConfirmationServiceMock, - MOCK_EDUCATION, MockCustomConfirmationServiceProvider, - TranslateServiceMock, -} from '@testing/mocks'; +} from '@testing/mocks/custom-confirmation.service.mock'; +import { MOCK_EDUCATION } from '@testing/mocks/education.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('EducationComponent', () => { let component: EducationComponent; diff --git a/src/app/features/settings/profile-settings/components/education/education.component.ts b/src/app/features/settings/profile-settings/components/education/education.component.ts index f203c6524..43ce2b43a 100644 --- a/src/app/features/settings/profile-settings/components/education/education.component.ts +++ b/src/app/features/settings/profile-settings/components/education/education.component.ts @@ -17,8 +17,10 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormArray, FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { UpdateProfileSettingsEducation, UserSelectors } from '@osf/core/store/user'; -import { CustomValidators } from '@osf/shared/helpers'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { hasEducationChanges, mapEducationToForm, mapFormToEducation } from '../../helpers'; import { EducationForm } from '../../models'; diff --git a/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.spec.ts b/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.spec.ts index da9d5ab01..6b2f33d0b 100644 --- a/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.spec.ts @@ -5,11 +5,11 @@ import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, FormGroup } from '@angular/forms'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { EmploymentFormComponent } from './employment-form.component'; -import { MOCK_EDUCATION, MOCK_EMPLOYMENT } from '@testing/mocks'; +import { MOCK_EDUCATION, MOCK_EMPLOYMENT } from '@testing/mocks/user-employment-education.mock'; describe('EmploymentFormComponent', () => { let component: EmploymentFormComponent; diff --git a/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.ts b/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.ts index 30105abaa..fe74581b5 100644 --- a/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.ts +++ b/src/app/features/settings/profile-settings/components/employment-form/employment-form.component.ts @@ -10,8 +10,8 @@ import { ChangeDetectionStrategy, Component, DestroyRef, inject, input, OnInit, import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; import { MAX_DATE, MIN_DATE } from '../../constants'; diff --git a/src/app/features/settings/profile-settings/components/employment/employment.component.spec.ts b/src/app/features/settings/profile-settings/components/employment/employment.component.spec.ts index 3adbf381d..21bba0011 100644 --- a/src/app/features/settings/profile-settings/components/employment/employment.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/employment/employment.component.spec.ts @@ -10,12 +10,17 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UpdateProfileSettingsEmployment, UserSelectors } from '@core/store/user'; -import { EmploymentFormComponent } from '@osf/features/settings/profile-settings/components'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; + +import { EmploymentFormComponent } from '../employment-form/employment-form.component'; import { EmploymentComponent } from './employment.component'; -import { CustomConfirmationServiceMock, MOCK_EMPLOYMENT, MockCustomConfirmationServiceProvider } from '@testing/mocks'; +import { + CustomConfirmationServiceMock, + MockCustomConfirmationServiceProvider, +} from '@testing/mocks/custom-confirmation.service.mock'; +import { MOCK_EMPLOYMENT } from '@testing/mocks/employment.mock'; describe('EmploymentComponent', () => { let component: EmploymentComponent; @@ -39,7 +44,6 @@ describe('EmploymentComponent', () => { MockProvider(ToastService), provideHttpClient(), provideHttpClientTesting(), - MockProvider(TranslatePipe), MockProvider(Store, mockStore), ], }).compileComponents(); @@ -80,14 +84,14 @@ describe('EmploymentComponent', () => { expect(component.positions.length).toBe(initialLength + 1); - const newEducation = component.positions.at(initialLength); - expect(newEducation).toBeDefined(); - expect(newEducation.get('title')?.value).toBe(''); - expect(newEducation.get('institution')?.value).toBe(''); - expect(newEducation.get('department')?.value).toBe(''); - expect(newEducation.get('startDate')?.value).toBe(null); - expect(newEducation.get('endDate')?.value).toBe(null); - expect(newEducation.get('ongoing')?.value).toBe(false); + const newEmployment = component.positions.at(initialLength); + expect(newEmployment).toBeDefined(); + expect(newEmployment.get('title')?.value).toBe(''); + expect(newEmployment.get('institution')?.value).toBe(''); + expect(newEmployment.get('department')?.value).toBe(''); + expect(newEmployment.get('startDate')?.value).toBe(null); + expect(newEmployment.get('endDate')?.value).toBe(null); + expect(newEmployment.get('ongoing')?.value).toBe(false); }); it('should detect changes when form field is modified', () => { @@ -109,14 +113,14 @@ describe('EmploymentComponent', () => { expect(component.positions.at(1).get('title')?.touched).toBe(true); }); - it('should map form data to correct education format', () => { - const education = component.positions.at(0); - education.get('title')?.setValue('Software Engineer Intern'); - education.get('institution')?.setValue('Test University'); - education.get('department')?.setValue('Engineering'); - education.get('startDate')?.setValue(new Date(2020, 0)); - education.get('endDate')?.setValue(new Date(2024, 5)); - education.get('ongoing')?.setValue(false); + it('should map form data to correct employment format', () => { + const employment = component.positions.at(0); + employment.get('title')?.setValue('Software Engineer Intern'); + employment.get('institution')?.setValue('Test University'); + employment.get('department')?.setValue('Engineering'); + employment.get('startDate')?.setValue(new Date(2020, 0)); + employment.get('endDate')?.setValue(new Date(2024, 5)); + employment.get('ongoing')?.setValue(false); component.saveEmployment(); diff --git a/src/app/features/settings/profile-settings/components/employment/employment.component.ts b/src/app/features/settings/profile-settings/components/employment/employment.component.ts index 77c7863f9..8d33e940e 100644 --- a/src/app/features/settings/profile-settings/components/employment/employment.component.ts +++ b/src/app/features/settings/profile-settings/components/employment/employment.component.ts @@ -17,8 +17,10 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormArray, FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { UpdateProfileSettingsEmployment, UserSelectors } from '@osf/core/store/user'; -import { CustomValidators } from '@osf/shared/helpers'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { hasEmploymentChanges, mapEmploymentToForm, mapFormToEmployment } from '../../helpers'; import { EmploymentForm } from '../../models'; diff --git a/src/app/features/settings/profile-settings/components/name-form/name-form.component.spec.ts b/src/app/features/settings/profile-settings/components/name-form/name-form.component.spec.ts index 45ef3fdfe..00792f1c5 100644 --- a/src/app/features/settings/profile-settings/components/name-form/name-form.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/name-form/name-form.component.spec.ts @@ -5,7 +5,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, FormGroup } from '@angular/forms'; import { NameForm } from '@osf/features/settings/profile-settings/models'; -import { TextInputComponent } from '@shared/components'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { NameFormComponent } from './name-form.component'; diff --git a/src/app/features/settings/profile-settings/components/name-form/name-form.component.ts b/src/app/features/settings/profile-settings/components/name-form/name-form.component.ts index 0b916296d..6fc762727 100644 --- a/src/app/features/settings/profile-settings/components/name-form/name-form.component.ts +++ b/src/app/features/settings/profile-settings/components/name-form/name-form.component.ts @@ -3,8 +3,8 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; import { NameForm } from '../../models'; diff --git a/src/app/features/settings/profile-settings/components/name/name.component.spec.ts b/src/app/features/settings/profile-settings/components/name/name.component.spec.ts index b90b717b1..e4290c6e9 100644 --- a/src/app/features/settings/profile-settings/components/name/name.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/name/name.component.spec.ts @@ -10,12 +10,16 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UpdateProfileSettingsUser, UserSelectors } from '@core/store/user'; -import { CitationPreviewComponent, NameFormComponent } from '@osf/features/settings/profile-settings/components'; -import { CustomConfirmationService, ToastService } from '@shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; + +import { CitationPreviewComponent } from '../citation-preview/citation-preview.component'; +import { NameFormComponent } from '../name-form/name-form.component'; import { NameComponent } from './name.component'; -import { MOCK_USER, MockCustomConfirmationServiceProvider } from '@testing/mocks'; +import { MockCustomConfirmationServiceProvider } from '@testing/mocks/custom-confirmation.service.mock'; +import { MOCK_USER } from '@testing/mocks/data.mock'; describe('NameComponent', () => { let component: NameComponent; diff --git a/src/app/features/settings/profile-settings/components/name/name.component.ts b/src/app/features/settings/profile-settings/components/name/name.component.ts index 17a114cce..4d821b540 100644 --- a/src/app/features/settings/profile-settings/components/name/name.component.ts +++ b/src/app/features/settings/profile-settings/components/name/name.component.ts @@ -9,10 +9,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder } from '@angular/forms'; import { UpdateProfileSettingsUser, UserSelectors } from '@osf/core/store/user'; -import { forbiddenFileNameCharacters } from '@osf/shared/constants'; -import { CustomValidators } from '@osf/shared/helpers'; -import { UserModel } from '@osf/shared/models'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { forbiddenFileNameCharacters } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { UserModel } from '@shared/models/user/user.models'; import { hasNameChanges } from '../../helpers'; import { NameForm } from '../../models'; diff --git a/src/app/features/settings/profile-settings/components/social-form/social-form.component.ts b/src/app/features/settings/profile-settings/components/social-form/social-form.component.ts index 119696a44..106cda311 100644 --- a/src/app/features/settings/profile-settings/components/social-form/social-form.component.ts +++ b/src/app/features/settings/profile-settings/components/social-form/social-form.component.ts @@ -3,16 +3,15 @@ import { TranslatePipe } from '@ngx-translate/core'; import { InputGroup } from 'primeng/inputgroup'; import { InputGroupAddon } from 'primeng/inputgroupaddon'; import { InputText } from 'primeng/inputtext'; -import { SelectModule } from 'primeng/select'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; import { FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { InputLimits } from '@osf/shared/constants'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; @Component({ selector: 'osf-social-form', - imports: [SelectModule, InputGroup, InputGroupAddon, InputText, ReactiveFormsModule, TranslatePipe], + imports: [InputGroup, InputGroupAddon, InputText, ReactiveFormsModule, TranslatePipe], templateUrl: './social-form.component.html', styleUrl: './social-form.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/settings/profile-settings/components/social/social.component.spec.ts b/src/app/features/settings/profile-settings/components/social/social.component.spec.ts index 1b7087e9c..06a51c93d 100644 --- a/src/app/features/settings/profile-settings/components/social/social.component.spec.ts +++ b/src/app/features/settings/profile-settings/components/social/social.component.spec.ts @@ -1,47 +1,50 @@ -import { Store } from '@ngxs/store'; - import { TranslatePipe } from '@ngx-translate/core'; -import { MockPipe, MockProvider } from 'ng-mocks'; - -import { of } from 'rxjs'; +import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; -import { provideHttpClient } from '@angular/common/http'; -import { provideHttpClientTesting } from '@angular/common/http/testing'; -import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { UserSelectors } from '@osf/core/store/user'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; + +import { SocialFormComponent } from '../social-form/social-form.component'; + import { SocialComponent } from './social.component'; -import { MOCK_STORE } from '@testing/mocks'; +import { MockCustomConfirmationServiceProvider } from '@testing/mocks/custom-confirmation.service.mock'; +import { MOCK_USER } from '@testing/mocks/data.mock'; +import { provideMockStore } from '@testing/providers/store-provider.mock'; -describe.skip('SocialComponent', () => { +describe('SocialComponent', () => { let component: SocialComponent; let fixture: ComponentFixture; beforeEach(async () => { - const store = MOCK_STORE; - store.selectSignal.mockImplementation(() => { - return signal([]); - }); - store.dispatch.mockImplementation(() => { - return of(); - }); + jest.clearAllMocks(); await TestBed.configureTestingModule({ - imports: [SocialComponent, MockPipe(TranslatePipe)], + imports: [SocialComponent, MockComponent(SocialFormComponent), MockPipe(TranslatePipe)], providers: [ - provideHttpClient(), - provideHttpClientTesting(), - MockProvider(TranslatePipe), - MockProvider(Store, store), + provideMockStore({ + signals: [{ selector: UserSelectors.getSocialLinks, value: MOCK_USER.social }], + }), + MockProvider(ToastService), + MockProvider(LoaderService), + { provide: CustomConfirmationService, useValue: MockCustomConfirmationServiceProvider }, ], }).compileComponents(); fixture = TestBed.createComponent(SocialComponent); component = fixture.componentInstance; + fixture.detectChanges(); }); + afterEach(() => { + jest.clearAllMocks(); + }); + it('should create', () => { expect(component).toBeTruthy(); }); diff --git a/src/app/features/settings/profile-settings/components/social/social.component.ts b/src/app/features/settings/profile-settings/components/social/social.component.ts index bb6c24ad7..5499e59df 100644 --- a/src/app/features/settings/profile-settings/components/social/social.component.ts +++ b/src/app/features/settings/profile-settings/components/social/social.component.ts @@ -17,9 +17,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormArray, FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { UpdateProfileSettingsSocialLinks, UserSelectors } from '@osf/core/store/user'; -import { SOCIAL_LINKS } from '@osf/shared/constants'; -import { SocialLinksForm, SocialModel } from '@osf/shared/models'; -import { CustomConfirmationService, LoaderService, ToastService } from '@osf/shared/services'; +import { SOCIAL_LINKS } from '@osf/shared/constants/social-links.const'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { SocialModel } from '@shared/models/user/social.model'; +import { SocialLinksForm } from '@shared/models/user/social-links.model'; import { hasSocialLinkChanges, mapSocialLinkToPayload } from '../../helpers'; import { SocialFormComponent } from '../social-form/social-form.component'; diff --git a/src/app/features/settings/profile-settings/constants/profile-settings-tab-options.const.ts b/src/app/features/settings/profile-settings/constants/profile-settings-tab-options.const.ts index 9a0ea2b87..1f3757002 100644 --- a/src/app/features/settings/profile-settings/constants/profile-settings-tab-options.const.ts +++ b/src/app/features/settings/profile-settings/constants/profile-settings-tab-options.const.ts @@ -1,4 +1,4 @@ -import { TabOption } from '@osf/shared/models'; +import { TabOption } from '@osf/shared/models/tab-option.model'; import { ProfileSettingsTabOption } from '../enums'; diff --git a/src/app/features/settings/profile-settings/helpers/education-comparison.helper.ts b/src/app/features/settings/profile-settings/helpers/education-comparison.helper.ts index cd14eced9..0c6cc3da4 100644 --- a/src/app/features/settings/profile-settings/helpers/education-comparison.helper.ts +++ b/src/app/features/settings/profile-settings/helpers/education-comparison.helper.ts @@ -1,5 +1,5 @@ -import { findChangedFields } from '@osf/shared/helpers'; -import { Education } from '@osf/shared/models'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { Education } from '@osf/shared/models/user/education.model'; import { EducationForm } from '../models'; diff --git a/src/app/features/settings/profile-settings/helpers/employment-comparison.helper.ts b/src/app/features/settings/profile-settings/helpers/employment-comparison.helper.ts index d268ea806..49f9c70b9 100644 --- a/src/app/features/settings/profile-settings/helpers/employment-comparison.helper.ts +++ b/src/app/features/settings/profile-settings/helpers/employment-comparison.helper.ts @@ -1,5 +1,5 @@ -import { findChangedFields } from '@osf/shared/helpers'; -import { Employment } from '@osf/shared/models'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { Employment } from '@osf/shared/models/user/employment.model'; import { EmploymentForm } from '../models'; diff --git a/src/app/features/settings/profile-settings/helpers/name-comparison.helper.ts b/src/app/features/settings/profile-settings/helpers/name-comparison.helper.ts index cfb982861..c82d60fc8 100644 --- a/src/app/features/settings/profile-settings/helpers/name-comparison.helper.ts +++ b/src/app/features/settings/profile-settings/helpers/name-comparison.helper.ts @@ -1,5 +1,5 @@ -import { findChangedFields } from '@osf/shared/helpers'; -import { UserModel } from '@osf/shared/models'; +import { findChangedFields } from '@osf/shared/helpers/find-changed-fields'; +import { UserModel } from '@osf/shared/models/user/user.models'; import { NameForm } from '../models'; diff --git a/src/app/features/settings/profile-settings/helpers/social-comparison.helper.ts b/src/app/features/settings/profile-settings/helpers/social-comparison.helper.ts index 174625d82..fa1b02316 100644 --- a/src/app/features/settings/profile-settings/helpers/social-comparison.helper.ts +++ b/src/app/features/settings/profile-settings/helpers/social-comparison.helper.ts @@ -1,4 +1,10 @@ -import { SOCIAL_KEYS, SocialLinksForm, SocialLinksKeys, SocialLinksModel, SocialModel } from '@osf/shared/models'; +import { SocialModel } from '@osf/shared/models/user/social.model'; +import { + SOCIAL_KEYS, + SocialLinksForm, + SocialLinksKeys, + SocialLinksModel, +} from '@osf/shared/models/user/social-links.model'; export function normalizeValue(value: unknown, key: SocialLinksKeys): unknown { if (SOCIAL_KEYS.includes(key)) { diff --git a/src/app/features/settings/profile-settings/profile-settings.component.spec.ts b/src/app/features/settings/profile-settings/profile-settings.component.spec.ts index 6421f12cc..59ceb5b48 100644 --- a/src/app/features/settings/profile-settings/profile-settings.component.spec.ts +++ b/src/app/features/settings/profile-settings/profile-settings.component.spec.ts @@ -6,8 +6,9 @@ import { BehaviorSubject } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { IS_MEDIUM } from '@osf/shared/helpers'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { EducationComponent, EmploymentComponent, NameComponent, SocialComponent } from './components'; import { ProfileSettingsComponent } from './profile-settings.component'; @@ -24,7 +25,14 @@ describe('ProfileSettingsComponent', () => { imports: [ ProfileSettingsComponent, MockPipe(TranslatePipe), - ...MockComponents(SubHeaderComponent, NameComponent, SocialComponent, EmploymentComponent, EducationComponent), + ...MockComponents( + SubHeaderComponent, + EducationComponent, + EmploymentComponent, + NameComponent, + SocialComponent, + SelectComponent + ), ], providers: [MockProvider(IS_MEDIUM, isMedium), MockProvider(TranslateService)], }).compileComponents(); diff --git a/src/app/features/settings/profile-settings/profile-settings.component.ts b/src/app/features/settings/profile-settings/profile-settings.component.ts index c61b6c068..c82e2f10d 100644 --- a/src/app/features/settings/profile-settings/profile-settings.component.ts +++ b/src/app/features/settings/profile-settings/profile-settings.component.ts @@ -6,8 +6,9 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { SelectComponent, SubHeaderComponent } from '@osf/shared/components'; -import { IS_MEDIUM } from '@osf/shared/helpers'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { EducationComponent, EmploymentComponent, NameComponent, SocialComponent } from './components'; import { PROFILE_SETTINGS_TAB_OPTIONS } from './constants'; diff --git a/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.spec.ts b/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.spec.ts index b666a5baf..e4720655a 100644 --- a/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.spec.ts +++ b/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.spec.ts @@ -1,7 +1,7 @@ import { Store } from '@ngxs/store'; import { TranslatePipe, TranslateService } from '@ngx-translate/core'; -import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; +import { MockComponents, MockPipe, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; @@ -9,12 +9,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { provideNoopAnimations } from '@angular/platform-browser/animations'; import { ActivatedRoute, Navigation, Router, UrlTree } from '@angular/router'; -import { SubHeaderComponent } from '@osf/shared/components'; +import { AddonSetupAccountFormComponent } from '@osf/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component'; +import { AddonTermsComponent } from '@osf/shared/components/addons/addon-terms/addon-terms.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { AddonsSelectors } from '@shared/stores/addons'; import { ConnectAddonComponent } from './connect-addon.component'; -import { MOCK_ADDON } from '@testing/mocks'; +import { MOCK_ADDON } from '@testing/mocks/addon.mock'; describe.skip('ConnectAddonComponent', () => { let component: ConnectAddonComponent; @@ -33,7 +35,11 @@ describe.skip('ConnectAddonComponent', () => { }; await TestBed.configureTestingModule({ - imports: [ConnectAddonComponent, MockComponent(SubHeaderComponent), MockPipe(TranslatePipe)], + imports: [ + ConnectAddonComponent, + ...MockComponents(SubHeaderComponent, AddonTermsComponent, AddonSetupAccountFormComponent), + MockPipe(TranslatePipe), + ], providers: [ provideNoopAnimations(), MockProvider(Store, { diff --git a/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.ts b/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.ts index d30efac78..4e6b67bad 100644 --- a/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.ts +++ b/src/app/features/settings/settings-addons/components/connect-addon/connect-addon.component.ts @@ -10,12 +10,19 @@ import { Component, computed, DestroyRef, effect, inject, signal, viewChild } fr import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { Router, RouterLink } from '@angular/router'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { AddonServiceNames, AddonType, ProjectAddonsStepperValue } from '@osf/shared/enums'; -import { getAddonTypeString, isAuthorizedAddon } from '@osf/shared/helpers'; -import { AddonSetupAccountFormComponent, AddonTermsComponent } from '@shared/components/addons'; -import { AddonModel, AddonTerm, AuthorizedAccountModel, AuthorizedAddonRequestJsonApi } from '@shared/models'; -import { AddonOAuthService, ToastService } from '@shared/services'; +import { AddonSetupAccountFormComponent } from '@osf/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component'; +import { AddonTermsComponent } from '@osf/shared/components/addons/addon-terms/addon-terms.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { AddonServiceNames } from '@osf/shared/enums/addon-service-names.enum'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { ProjectAddonsStepperValue } from '@osf/shared/enums/profile-addons-stepper.enum'; +import { getAddonTypeString, isAuthorizedAddon } from '@osf/shared/helpers/addon-type.helper'; +import { AddonOAuthService } from '@osf/shared/services/addons/addon-oauth.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { AddonModel } from '@shared/models/addons/addon.model'; +import { AuthorizedAddonRequestJsonApi } from '@shared/models/addons/addon-json-api.models'; +import { AddonTerm } from '@shared/models/addons/addon-utils.models'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; import { AddonsSelectors, CreateAuthorizedAddon, UpdateAuthorizedAddon } from '@shared/stores/addons'; @Component({ diff --git a/src/app/features/settings/settings-addons/settings-addons.component.spec.ts b/src/app/features/settings/settings-addons/settings-addons.component.spec.ts index d79efd313..053693d79 100644 --- a/src/app/features/settings/settings-addons/settings-addons.component.spec.ts +++ b/src/app/features/settings/settings-addons/settings-addons.component.spec.ts @@ -5,13 +5,16 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserSelectors } from '@osf/core/store/user'; -import { SearchInputComponent, SubHeaderComponent } from '@osf/shared/components'; -import { AddonCardListComponent } from '@shared/components/addons'; +import { AddonCardListComponent } from '@osf/shared/components/addons/addon-card-list/addon-card-list.component'; +import { AddonsToolbarComponent } from '@osf/shared/components/addons/addons-toolbar/addons-toolbar.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { AddonsSelectors } from '@shared/stores/addons'; import { SettingsAddonsComponent } from './settings-addons.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe.skip('AddonsComponent', () => { let component: SettingsAddonsComponent; @@ -21,11 +24,16 @@ describe.skip('AddonsComponent', () => { await TestBed.configureTestingModule({ imports: [ SettingsAddonsComponent, - ...MockComponents(SubHeaderComponent, SearchInputComponent, AddonCardListComponent), + ...MockComponents( + SubHeaderComponent, + AddonsToolbarComponent, + AddonCardListComponent, + LoadingSpinnerComponent, + SelectComponent + ), ], providers: [ TranslateServiceMock, - MockProvider(Store, { selectSignal: jest.fn().mockImplementation((selector) => { if (selector === UserSelectors.getCurrentUser) { diff --git a/src/app/features/settings/settings-addons/settings-addons.component.ts b/src/app/features/settings/settings-addons/settings-addons.component.ts index 7460b81e2..6b967c8a5 100644 --- a/src/app/features/settings/settings-addons/settings-addons.component.ts +++ b/src/app/features/settings/settings-addons/settings-addons.component.ts @@ -23,11 +23,16 @@ import { FormControl, FormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { UserSelectors } from '@osf/core/store/user'; -import { LoadingSpinnerComponent, SelectComponent, SubHeaderComponent } from '@osf/shared/components'; -import { sortAddonCardsAlphabetically } from '@osf/shared/helpers'; -import { AddonCardListComponent, AddonsToolbarComponent } from '@shared/components/addons'; -import { ADDON_CATEGORY_OPTIONS, ADDON_TAB_OPTIONS } from '@shared/constants'; -import { AddonCategory, AddonTabValue } from '@shared/enums'; +import { AddonCardListComponent } from '@osf/shared/components/addons/addon-card-list/addon-card-list.component'; +import { AddonsToolbarComponent } from '@osf/shared/components/addons/addons-toolbar/addons-toolbar.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { SelectComponent } from '@osf/shared/components/select/select.component'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { ADDON_CATEGORY_OPTIONS } from '@osf/shared/constants/addons-category-options.const'; +import { ADDON_TAB_OPTIONS } from '@osf/shared/constants/addons-tab-options.const'; +import { AddonTabValue } from '@osf/shared/enums/addon-tab.enum'; +import { AddonCategory } from '@osf/shared/enums/addons-category.enum'; +import { sortAddonCardsAlphabetically } from '@osf/shared/helpers/addon-card.helper'; import { AddonsQueryParamsService } from '@shared/services/addons-query-params.service'; import { AddonsSelectors, diff --git a/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.spec.ts b/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.spec.ts index 7cfde1067..aa56cc5a4 100644 --- a/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.spec.ts +++ b/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.spec.ts @@ -1,26 +1,29 @@ import { Store } from '@ngxs/store'; import { TranslateService } from '@ngx-translate/core'; -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { TokenCreatedDialogComponent } from '@osf/features/settings/tokens/components'; -import { InputLimits } from '@osf/shared/constants'; -import { ToastService } from '@shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { ToastService } from '@osf/shared/services/toast.service'; import { TokenFormControls, TokenModel } from '../../models'; import { CreateToken, TokensSelectors } from '../../store'; import { TokenAddEditFormComponent } from './token-add-edit-form.component'; -import { MOCK_SCOPES, MOCK_STORE, MOCK_TOKEN, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; +import { MOCK_SCOPES } from '@testing/mocks/scope.mock'; +import { MOCK_TOKEN } from '@testing/mocks/token.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; import { OSFTestingStoreModule } from '@testing/osf.testing.module'; import { ToastServiceMockBuilder } from '@testing/providers/toast-provider.mock'; @@ -74,7 +77,7 @@ describe('TokenAddEditFormComponent', () => { toastServiceMock = ToastServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [TokenAddEditFormComponent, ReactiveFormsModule, OSFTestingStoreModule], + imports: [TokenAddEditFormComponent, OSFTestingStoreModule, MockComponent(TextInputComponent)], providers: [ TranslateServiceMock, MockProvider(Store, MOCK_STORE), diff --git a/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.ts b/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.ts index 2abd3b83e..3dc2046da 100644 --- a/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.ts +++ b/src/app/features/settings/tokens/components/token-add-edit-form/token-add-edit-form.component.ts @@ -13,9 +13,10 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { TextInputComponent } from '@osf/shared/components'; -import { InputLimits } from '@osf/shared/constants'; -import { CustomDialogService, ToastService } from '@osf/shared/services'; +import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { TokenForm, TokenFormControls, TokenModel } from '../../models'; import { CreateToken, GetTokens, TokensSelectors, UpdateToken } from '../../store'; diff --git a/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.spec.ts b/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.spec.ts index 455b2f0de..21ebd2cb5 100644 --- a/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.spec.ts +++ b/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.spec.ts @@ -5,11 +5,11 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { NgZone } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CopyButtonComponent } from '@shared/components'; +import { CopyButtonComponent } from '@osf/shared/components/copy-button/copy-button.component'; import { TokenCreatedDialogComponent } from './token-created-dialog.component'; -import { MOCK_TOKEN } from '@testing/mocks'; +import { MOCK_TOKEN } from '@testing/mocks/token.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('TokenCreatedDialogComponent', () => { diff --git a/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.ts b/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.ts index e377692b3..e7d66b381 100644 --- a/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.ts +++ b/src/app/features/settings/tokens/components/token-created-dialog/token-created-dialog.component.ts @@ -16,7 +16,7 @@ import { viewChild, } from '@angular/core'; -import { CopyButtonComponent } from '@shared/components'; +import { CopyButtonComponent } from '@osf/shared/components/copy-button/copy-button.component'; @Component({ selector: 'osf-token-created-dialog', diff --git a/src/app/features/settings/tokens/pages/token-details/token-details.component.spec.ts b/src/app/features/settings/tokens/pages/token-details/token-details.component.spec.ts index d4ebaeb3b..a092cc94a 100644 --- a/src/app/features/settings/tokens/pages/token-details/token-details.component.spec.ts +++ b/src/app/features/settings/tokens/pages/token-details/token-details.component.spec.ts @@ -1,14 +1,18 @@ import { Store } from '@ngxs/store'; -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { CustomConfirmationService, CustomDialogService } from '@shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { TokenAddEditFormComponent } from '../../components'; import { TokenModel } from '../../models'; import { TokensSelectors } from '../../store'; @@ -25,6 +29,7 @@ describe('TokenDetailsComponent', () => { const mockToken: TokenModel = { id: '1', + tokenId: '2', name: 'Test Token', scopes: ['read', 'write'], }; @@ -53,7 +58,11 @@ describe('TokenDetailsComponent', () => { }; await TestBed.configureTestingModule({ - imports: [TokenDetailsComponent, OSFTestingModule], + imports: [ + TokenDetailsComponent, + OSFTestingModule, + ...MockComponents(TokenAddEditFormComponent, IconComponent, LoadingSpinnerComponent), + ], providers: [ MockProvider(Store, storeMock), MockProvider(CustomConfirmationService, confirmationService), diff --git a/src/app/features/settings/tokens/pages/token-details/token-details.component.ts b/src/app/features/settings/tokens/pages/token-details/token-details.component.ts index 107d978dd..59f78cced 100644 --- a/src/app/features/settings/tokens/pages/token-details/token-details.component.ts +++ b/src/app/features/settings/tokens/pages/token-details/token-details.component.ts @@ -8,8 +8,10 @@ import { Card } from 'primeng/card'; import { ChangeDetectionStrategy, Component, computed, inject, OnInit, signal } from '@angular/core'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; -import { IconComponent, LoadingSpinnerComponent } from '@osf/shared/components'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { IconComponent } from '@osf/shared/components/icon/icon.component'; +import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { TokenAddEditFormComponent } from '../../components'; import { DeleteToken, GetTokenById, TokensSelectors } from '../../store'; diff --git a/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.spec.ts b/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.spec.ts index d97150ef1..2f7941111 100644 --- a/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.spec.ts +++ b/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.spec.ts @@ -17,9 +17,6 @@ import { TokenModel } from '../../models'; import { TokensListComponent } from './tokens-list.component'; -jest.mock('@core/store/user', () => ({})); -jest.mock('@osf/shared/stores/collections', () => ({})); -jest.mock('@osf/shared/stores/addons', () => ({})); jest.mock('../../store', () => ({ TokensSelectors: { isTokensLoading: function isTokensLoading() {}, diff --git a/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.ts b/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.ts index 46c794d28..d7a8a76bd 100644 --- a/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.ts +++ b/src/app/features/settings/tokens/pages/tokens-list/tokens-list.component.ts @@ -9,7 +9,8 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { CustomConfirmationService, ToastService } from '@osf/shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { ToastService } from '@osf/shared/services/toast.service'; import { TokenModel } from '../../models'; import { DeleteToken, GetTokens, TokensSelectors } from '../../store'; diff --git a/src/app/features/settings/tokens/services/tokens.service.spec.ts b/src/app/features/settings/tokens/services/tokens.service.spec.ts index d8aa7b31b..1c29bf6f2 100644 --- a/src/app/features/settings/tokens/services/tokens.service.spec.ts +++ b/src/app/features/settings/tokens/services/tokens.service.spec.ts @@ -2,8 +2,8 @@ import { of } from 'rxjs'; import { TestBed } from '@angular/core/testing'; -import { JsonApiResponse } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { ScopeMapper, TokenMapper } from '../mappers'; import { ScopeJsonApi, ScopeModel, TokenGetResponseJsonApi, TokenModel } from '../models'; diff --git a/src/app/features/settings/tokens/services/tokens.service.ts b/src/app/features/settings/tokens/services/tokens.service.ts index 41f0bd75f..78701d9ef 100644 --- a/src/app/features/settings/tokens/services/tokens.service.ts +++ b/src/app/features/settings/tokens/services/tokens.service.ts @@ -4,8 +4,8 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiResponse } from '@osf/shared/models'; -import { JsonApiService } from '@osf/shared/services'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; +import { JsonApiService } from '@osf/shared/services/json-api.service'; import { ScopeMapper, TokenMapper } from '../mappers'; import { ScopeJsonApi, ScopeModel, TokenGetResponseJsonApi, TokenModel } from '../models'; diff --git a/src/app/features/settings/tokens/store/tokens.models.ts b/src/app/features/settings/tokens/store/tokens.models.ts index fcbd2c285..dfcef044e 100644 --- a/src/app/features/settings/tokens/store/tokens.models.ts +++ b/src/app/features/settings/tokens/store/tokens.models.ts @@ -1,4 +1,4 @@ -import { AsyncStateModel } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; import { ScopeModel, TokenModel } from '../models'; diff --git a/src/app/features/settings/tokens/store/tokens.state.ts b/src/app/features/settings/tokens/store/tokens.state.ts index 2230aab44..aefcfa212 100644 --- a/src/app/features/settings/tokens/store/tokens.state.ts +++ b/src/app/features/settings/tokens/store/tokens.state.ts @@ -4,7 +4,7 @@ import { catchError, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { TokenModel } from '../models'; import { TokensService } from '../services'; diff --git a/src/app/features/settings/tokens/tokens.component.spec.ts b/src/app/features/settings/tokens/tokens.component.spec.ts index 44090e96a..81759e221 100644 --- a/src/app/features/settings/tokens/tokens.component.spec.ts +++ b/src/app/features/settings/tokens/tokens.component.spec.ts @@ -1,17 +1,18 @@ import { Store } from '@ngxs/store'; -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DialogService } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomDialogService } from '@shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { GetScopes } from './store'; import { TokensComponent } from './tokens.component'; -import { MOCK_STORE } from '@testing/mocks'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; import { DialogServiceMockBuilder } from '@testing/providers/dialog-provider.mock'; @@ -27,7 +28,7 @@ describe('TokensComponent', () => { mockDialogService = DialogServiceMockBuilder.create().withOpenMock().build(); await TestBed.configureTestingModule({ - imports: [TokensComponent, OSFTestingModule], + imports: [TokensComponent, OSFTestingModule, MockComponent(SubHeaderComponent)], providers: [ MockProvider(Store, MOCK_STORE), MockProvider(CustomDialogService, mockCustomDialogService), diff --git a/src/app/features/settings/tokens/tokens.component.ts b/src/app/features/settings/tokens/tokens.component.ts index 4cb0d2dbf..d227a335c 100644 --- a/src/app/features/settings/tokens/tokens.component.ts +++ b/src/app/features/settings/tokens/tokens.component.ts @@ -8,8 +8,8 @@ import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/cor import { toSignal } from '@angular/core/rxjs-interop'; import { Router, RouterOutlet } from '@angular/router'; -import { SubHeaderComponent } from '@osf/shared/components'; -import { CustomDialogService } from '@osf/shared/services'; +import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { TokenAddEditFormComponent } from './components'; import { GetScopes } from './store'; diff --git a/src/app/shared/components/add-project-form/add-project-form.component.spec.ts b/src/app/shared/components/add-project-form/add-project-form.component.spec.ts index a066932db..54336feae 100644 --- a/src/app/shared/components/add-project-form/add-project-form.component.spec.ts +++ b/src/app/shared/components/add-project-form/add-project-form.component.spec.ts @@ -7,18 +7,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { UserSelectors } from '@core/store/user'; -import { ProjectFormControls } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ProjectForm } from '@osf/shared/models'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; import { ProjectModel } from '@osf/shared/models/projects'; import { InstitutionsSelectors } from '@osf/shared/stores/institutions'; import { ProjectsSelectors } from '@osf/shared/stores/projects'; import { RegionsSelectors } from '@osf/shared/stores/regions'; -import { AffiliatedInstitutionSelectComponent, ProjectSelectorComponent } from '@shared/components'; +import { ProjectForm } from '@shared/models/projects/create-project-form.model'; + +import { AffiliatedInstitutionSelectComponent } from '../affiliated-institution-select/affiliated-institution-select.component'; +import { ProjectSelectorComponent } from '../project-selector/project-selector.component'; import { AddProjectFormComponent } from './add-project-form.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/shared/components/add-project-form/add-project-form.component.ts b/src/app/shared/components/add-project-form/add-project-form.component.ts index 876e92273..fc74e9c01 100644 --- a/src/app/shared/components/add-project-form/add-project-form.component.ts +++ b/src/app/shared/components/add-project-form/add-project-form.component.ts @@ -2,9 +2,7 @@ import { createDispatchMap, select } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; -import { ButtonModule } from 'primeng/button'; -import { CheckboxModule } from 'primeng/checkbox'; -import { InputTextModule } from 'primeng/inputtext'; +import { InputText } from 'primeng/inputtext'; import { Select } from 'primeng/select'; import { Textarea } from 'primeng/textarea'; @@ -14,10 +12,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormGroup, ReactiveFormsModule } from '@angular/forms'; import { UserSelectors } from '@core/store/user'; -import { ProjectFormControls } from '@osf/shared/enums'; -import { Institution, ProjectForm, ProjectModel } from '@osf/shared/models'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; import { FetchUserInstitutions, InstitutionsSelectors } from '@osf/shared/stores/institutions'; import { FetchRegions, RegionsSelectors } from '@osf/shared/stores/regions'; +import { Institution } from '@shared/models/institutions/institutions.models'; +import { ProjectForm } from '@shared/models/projects/create-project-form.model'; +import { ProjectModel } from '@shared/models/projects/projects.models'; import { AffiliatedInstitutionSelectComponent } from '../affiliated-institution-select/affiliated-institution-select.component'; import { ProjectSelectorComponent } from '../project-selector/project-selector.component'; @@ -27,9 +27,7 @@ import { ProjectSelectorComponent } from '../project-selector/project-selector.c imports: [ CommonModule, ReactiveFormsModule, - ButtonModule, - InputTextModule, - CheckboxModule, + InputText, Select, Textarea, TranslatePipe, diff --git a/src/app/shared/components/addons/addon-card-list/addon-card-list.component.spec.ts b/src/app/shared/components/addons/addon-card-list/addon-card-list.component.spec.ts index 59d44b776..3b1edca54 100644 --- a/src/app/shared/components/addons/addon-card-list/addon-card-list.component.spec.ts +++ b/src/app/shared/components/addons/addon-card-list/addon-card-list.component.spec.ts @@ -2,7 +2,7 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AddonCardComponent } from '@shared/components/addons'; +import { AddonCardComponent } from '../addon-card/addon-card.component'; import { AddonCardListComponent } from './addon-card-list.component'; diff --git a/src/app/shared/components/addons/addon-card-list/addon-card-list.component.ts b/src/app/shared/components/addons/addon-card-list/addon-card-list.component.ts index 546b49fd2..f11e9b560 100644 --- a/src/app/shared/components/addons/addon-card-list/addon-card-list.component.ts +++ b/src/app/shared/components/addons/addon-card-list/addon-card-list.component.ts @@ -2,7 +2,10 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Component, input } from '@angular/core'; -import { AddonCardModel, AddonModel, AuthorizedAccountModel, ConfiguredAddonModel } from '@shared/models'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; +import { AddonCardModel } from '@osf/shared/models/addons/addon-card.model'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; import { AddonCardComponent } from '../addon-card/addon-card.component'; diff --git a/src/app/shared/components/addons/addon-card/addon-card.component.spec.ts b/src/app/shared/components/addons/addon-card/addon-card.component.spec.ts index ba39dc842..e75532ca7 100644 --- a/src/app/shared/components/addons/addon-card/addon-card.component.spec.ts +++ b/src/app/shared/components/addons/addon-card/addon-card.component.spec.ts @@ -3,9 +3,9 @@ import { MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { CredentialsFormat } from '@shared/enums'; -import { AddonModel } from '@shared/models'; -import { CustomConfirmationService } from '@shared/services'; +import { CredentialsFormat } from '@osf/shared/enums/addons-credentials-format.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { AddonModel } from '@shared/models/addons/addon.model'; import { AddonCardComponent } from './addon-card.component'; diff --git a/src/app/shared/components/addons/addon-card/addon-card.component.ts b/src/app/shared/components/addons/addon-card/addon-card.component.ts index 7c1ef612d..9b969c5bd 100644 --- a/src/app/shared/components/addons/addon-card/addon-card.component.ts +++ b/src/app/shared/components/addons/addon-card/addon-card.component.ts @@ -7,9 +7,13 @@ import { Button } from 'primeng/button'; import { Component, computed, inject, input } from '@angular/core'; import { Router } from '@angular/router'; -import { getAddonTypeString, isConfiguredAddon } from '@osf/shared/helpers'; -import { CustomConfirmationService, LoaderService } from '@osf/shared/services'; -import { AddonCardModel, AddonModel, AuthorizedAccountModel, ConfiguredAddonModel } from '@shared/models'; +import { getAddonTypeString, isConfiguredAddon } from '@osf/shared/helpers/addon-type.helper'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; +import { AddonModel } from '@shared/models/addons/addon.model'; +import { AddonCardModel } from '@shared/models/addons/addon-card.model'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; import { DeleteAuthorizedAddon } from '@shared/stores/addons'; @Component({ diff --git a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.spec.ts b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.spec.ts index 0e6a88ed6..defb44471 100644 --- a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.spec.ts +++ b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.spec.ts @@ -3,12 +3,13 @@ import { MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, FormGroup } from '@angular/forms'; -import { AddonFormControls } from '@shared/enums'; +import { AddonFormControls } from '@osf/shared/enums/addon-form-controls.enum'; import { AddonFormService } from '@shared/services/addons/addon-form.service'; import { AddonSetupAccountFormComponent } from './addon-setup-account-form.component'; -import { MOCK_ADDON, MOCK_USER } from '@testing/mocks'; +import { MOCK_ADDON } from '@testing/mocks/addon.mock'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('AddonSetupAccountFormComponent', () => { diff --git a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts index cbcb857eb..0a3250ab4 100644 --- a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts +++ b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts @@ -9,8 +9,12 @@ import { Component, computed, inject, input, output } from '@angular/core'; import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterLink } from '@angular/router'; -import { AddonFormControls, CredentialsFormat } from '@shared/enums'; -import { AddonForm, AddonModel, AuthorizedAccountModel, AuthorizedAddonRequestJsonApi } from '@shared/models'; +import { AddonFormControls } from '@osf/shared/enums/addon-form-controls.enum'; +import { CredentialsFormat } from '@osf/shared/enums/addons-credentials-format.enum'; +import { AddonModel } from '@shared/models/addons/addon.model'; +import { AuthorizedAddonRequestJsonApi } from '@shared/models/addons/addon-json-api.models'; +import { AddonForm } from '@shared/models/addons/addon-utils.models'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; import { AddonFormService } from '@shared/services/addons/addon-form.service'; @Component({ diff --git a/src/app/shared/components/addons/addon-terms/addon-terms.component.spec.ts b/src/app/shared/components/addons/addon-terms/addon-terms.component.spec.ts index 8a8278304..60ded4b2f 100644 --- a/src/app/shared/components/addons/addon-terms/addon-terms.component.spec.ts +++ b/src/app/shared/components/addons/addon-terms/addon-terms.component.spec.ts @@ -1,14 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { isCitationAddon } from '@osf/shared/helpers'; -import { AddonTermsComponent } from '@shared/components/addons'; -import { ADDON_TERMS } from '@shared/constants'; -import { AddonModel, AddonTerm } from '@shared/models'; +import { ADDON_TERMS } from '@osf/shared/constants/addon-terms.const'; +import { isCitationAddon } from '@osf/shared/helpers/addon-type.helper'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; +import { AddonTerm } from '@osf/shared/models/addons/addon-utils.models'; -import { MOCK_ADDON } from '@testing/mocks'; +import { AddonTermsComponent } from './addon-terms.component'; + +import { MOCK_ADDON } from '@testing/mocks/addon.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; -jest.mock('@shared/helpers', () => ({ +jest.mock('@shared/helpers/addon-type.helper.ts', () => ({ isCitationAddon: jest.fn(), })); diff --git a/src/app/shared/components/addons/addon-terms/addon-terms.component.ts b/src/app/shared/components/addons/addon-terms/addon-terms.component.ts index a97b0a0cf..5945f03dd 100644 --- a/src/app/shared/components/addons/addon-terms/addon-terms.component.ts +++ b/src/app/shared/components/addons/addon-terms/addon-terms.component.ts @@ -5,9 +5,11 @@ import { TableModule } from 'primeng/table'; import { NgClass } from '@angular/common'; import { Component, computed, input } from '@angular/core'; -import { isCitationAddon } from '@osf/shared/helpers'; -import { ADDON_TERMS as addonTerms } from '@shared/constants'; -import { AddonModel, AddonTerm, AuthorizedAccountModel } from '@shared/models'; +import { ADDON_TERMS } from '@osf/shared/constants/addon-terms.const'; +import { isCitationAddon } from '@osf/shared/helpers/addon-type.helper'; +import { AddonModel } from '@shared/models/addons/addon.model'; +import { AddonTerm } from '@shared/models/addons/addon-utils.models'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; @Component({ selector: 'osf-addon-terms', @@ -30,7 +32,7 @@ export class AddonTermsComponent { const provider = addon.providerName; const isCitationService = isCitationAddon(addon); - const relevantTerms = isCitationService ? addonTerms.filter((term) => term.citation) : addonTerms; + const relevantTerms = isCitationService ? ADDON_TERMS.filter((term) => term.citation) : ADDON_TERMS; return relevantTerms.map((term) => { const feature = term.supportedFeature; diff --git a/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.spec.ts b/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.spec.ts index 7f4902f2f..2c394c908 100644 --- a/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.spec.ts +++ b/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.spec.ts @@ -1,9 +1,12 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; +import { SearchInputComponent } from '../../search-input/search-input.component'; +import { SelectComponent } from '../../select/select.component'; + import { AddonsToolbarComponent } from './addons-toolbar.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -18,7 +21,7 @@ describe('AddonsToolbarComponent', () => { activatedRouteMock = ActivatedRouteMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [AddonsToolbarComponent, OSFTestingModule], + imports: [AddonsToolbarComponent, OSFTestingModule, ...MockComponents(SearchInputComponent, SelectComponent)], providers: [MockProvider(ActivatedRoute, activatedRouteMock)], }).compileComponents(); diff --git a/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.ts b/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.ts index 5012affb2..03accc599 100644 --- a/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.ts +++ b/src/app/shared/components/addons/addons-toolbar/addons-toolbar.component.ts @@ -4,10 +4,12 @@ import { ChangeDetectionStrategy, Component, effect, inject, input, model, OnIni import { FormControl, FormsModule } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { SearchInputComponent, SelectComponent } from '@osf/shared/components'; -import { SelectOption } from '@osf/shared/models'; +import { SelectOption } from '@osf/shared/models/select-option.model'; import { AddonsQueryParamsService } from '@osf/shared/services/addons-query-params.service'; +import { SearchInputComponent } from '../../search-input/search-input.component'; +import { SelectComponent } from '../../select/select.component'; + @Component({ selector: 'osf-addons-toolbar', imports: [SearchInputComponent, SelectComponent, FormsModule, TranslatePipe], diff --git a/src/app/shared/components/addons/index.ts b/src/app/shared/components/addons/index.ts deleted file mode 100644 index 62f0c981d..000000000 --- a/src/app/shared/components/addons/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { AddonCardComponent } from './addon-card/addon-card.component'; -export { AddonCardListComponent } from './addon-card-list/addon-card-list.component'; -export { AddonSetupAccountFormComponent } from './addon-setup-account-form/addon-setup-account-form.component'; -export { AddonTermsComponent } from './addon-terms/addon-terms.component'; -export { AddonsToolbarComponent } from './addons-toolbar/addons-toolbar.component'; -export { StorageItemSelectorComponent } from './storage-item-selector/storage-item-selector.component'; diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.spec.ts b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.spec.ts index 18b50ae71..2e3797ea6 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.spec.ts +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.spec.ts @@ -4,11 +4,14 @@ import { DialogService } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { GoogleFilePickerComponent, SelectComponent } from '@shared/components'; -import { StorageItemSelectorComponent } from '@shared/components/addons'; -import { OperationNames } from '@shared/enums'; +import { OperationNames } from '@shared/enums/operation-names.enum'; import { AddonsSelectors } from '@shared/stores/addons'; +import { GoogleFilePickerComponent } from '../../google-file-picker/google-file-picker.component'; +import { SelectComponent } from '../../select/select.component'; + +import { StorageItemSelectorComponent } from './storage-item-selector.component'; + import { OSFTestingModule } from '@testing/osf.testing.module'; import { DialogServiceMockBuilder } from '@testing/providers/dialog-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts index ffcd24dd5..b5fb14896 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts @@ -26,11 +26,15 @@ import { import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { AddonType, OperationNames, StorageItemType } from '@osf/shared/enums'; -import { convertCamelCaseToNormal, IS_XSMALL } from '@osf/shared/helpers'; -import { OperationInvokeData, StorageItem } from '@osf/shared/models'; -import { CustomDialogService } from '@osf/shared/services'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { StorageItemType } from '@osf/shared/enums/storage-item-type.enum'; +import { IS_XSMALL } from '@osf/shared/helpers/breakpoints.tokens'; +import { convertCamelCaseToNormal } from '@osf/shared/helpers/camel-case-to-normal.helper'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { AddonsSelectors, ClearOperationInvocations } from '@osf/shared/stores/addons'; +import { OperationInvokeData } from '@shared/models/addons/addon-utils.models'; +import { StorageItem } from '@shared/models/addons/storage-item.model'; import { GoogleFilePickerComponent } from '../../google-file-picker/google-file-picker.component'; import { SelectComponent } from '../../select/select.component'; diff --git a/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts b/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts index 61d331525..91a90646d 100644 --- a/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts +++ b/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts @@ -1,10 +1,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Institution } from '@shared/models'; +import { Institution } from '@shared/models/institutions/institutions.models'; import { AffiliatedInstitutionSelectComponent } from './affiliated-institution-select.component'; -import { MOCK_INSTITUTION } from '@testing/mocks'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('AffiliatedInstitutionSelectComponent', () => { diff --git a/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.ts b/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.ts index ee718598b..9f7b0d4e7 100644 --- a/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.ts +++ b/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.ts @@ -8,7 +8,7 @@ import { NgOptimizedImage } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input, model } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; @Component({ selector: 'osf-affiliated-institution-select', diff --git a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts index 00668028d..c076d3026 100644 --- a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts +++ b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts @@ -1,10 +1,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Institution } from '@shared/models'; +import { Institution } from '@shared/models/institutions/institutions.models'; import { AffiliatedInstitutionsViewComponent } from './affiliated-institutions-view.component'; -import { MOCK_INSTITUTION } from '@testing/mocks'; +import { MOCK_INSTITUTION } from '@testing/mocks/institution.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('AffiliatedInstitutionsViewComponent', () => { diff --git a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts index 3c60e7802..6f7e2bd2e 100644 --- a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts +++ b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts @@ -5,7 +5,7 @@ import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; @Component({ selector: 'osf-affiliated-institutions-view', diff --git a/src/app/shared/components/bar-chart/bar-chart.component.spec.ts b/src/app/shared/components/bar-chart/bar-chart.component.spec.ts index 00f662bcf..dee95b220 100644 --- a/src/app/shared/components/bar-chart/bar-chart.component.spec.ts +++ b/src/app/shared/components/bar-chart/bar-chart.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; + import { BarChartComponent } from './bar-chart.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -10,7 +14,7 @@ describe('BarChartComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [BarChartComponent, OSFTestingModule], + imports: [BarChartComponent, OSFTestingModule, MockComponent(LoadingSpinnerComponent)], }).compileComponents(); fixture = TestBed.createComponent(BarChartComponent); diff --git a/src/app/shared/components/bar-chart/bar-chart.component.ts b/src/app/shared/components/bar-chart/bar-chart.component.ts index 297f98779..e1184f9e7 100644 --- a/src/app/shared/components/bar-chart/bar-chart.component.ts +++ b/src/app/shared/components/bar-chart/bar-chart.component.ts @@ -6,8 +6,8 @@ import { ChartModule } from 'primeng/chart'; import { isPlatformBrowser } from '@angular/common'; import { ChangeDetectionStrategy, Component, inject, input, OnInit, PLATFORM_ID, signal } from '@angular/core'; -import { PIE_CHART_PALETTE } from '@osf/shared/constants'; -import { DatasetInput } from '@osf/shared/models'; +import { PIE_CHART_PALETTE } from '@osf/shared/constants/pie-chart-palette'; +import { DatasetInput } from '@shared/models/charts/dataset-input'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; diff --git a/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.spec.ts b/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.spec.ts index 776a1f51f..11f2c131a 100644 --- a/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.spec.ts +++ b/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { InfoIconComponent } from '../info-icon/info-icon.component'; + import { ComponentCheckboxItemComponent } from './component-checkbox-item.component'; describe('ComponentCheckboxItemComponent', () => { @@ -8,7 +12,7 @@ describe('ComponentCheckboxItemComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ComponentCheckboxItemComponent], + imports: [ComponentCheckboxItemComponent, MockComponent(InfoIconComponent)], }).compileComponents(); fixture = TestBed.createComponent(ComponentCheckboxItemComponent); diff --git a/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.ts b/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.ts index a7d3ed756..2d9437877 100644 --- a/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.ts +++ b/src/app/shared/components/component-checkbox-item/component-checkbox-item.component.ts @@ -5,7 +5,7 @@ import { Checkbox } from 'primeng/checkbox'; import { ChangeDetectionStrategy, Component, input, model } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { ComponentCheckboxItemModel } from '@osf/shared/models'; +import { ComponentCheckboxItemModel } from '@osf/shared/models/component-checkbox-item.model'; import { InfoIconComponent } from '../info-icon/info-icon.component'; diff --git a/src/app/shared/components/components-selection-list/components-selection-list.component.spec.ts b/src/app/shared/components/components-selection-list/components-selection-list.component.spec.ts index 7944f902a..db5bc73b8 100644 --- a/src/app/shared/components/components-selection-list/components-selection-list.component.spec.ts +++ b/src/app/shared/components/components-selection-list/components-selection-list.component.spec.ts @@ -1,6 +1,10 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ComponentCheckboxItemModel } from '@shared/models'; +import { ComponentCheckboxItemModel } from '@osf/shared/models/component-checkbox-item.model'; + +import { ComponentCheckboxItemComponent } from '../component-checkbox-item/component-checkbox-item.component'; import { ComponentsSelectionListComponent } from './components-selection-list.component'; @@ -18,7 +22,7 @@ describe('ComponentsSelectionListComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ComponentsSelectionListComponent, OSFTestingModule], + imports: [ComponentsSelectionListComponent, OSFTestingModule, MockComponent(ComponentCheckboxItemComponent)], }).compileComponents(); fixture = TestBed.createComponent(ComponentsSelectionListComponent); diff --git a/src/app/shared/components/components-selection-list/components-selection-list.component.ts b/src/app/shared/components/components-selection-list/components-selection-list.component.ts index 8cde80d41..ce829eb6d 100644 --- a/src/app/shared/components/components-selection-list/components-selection-list.component.ts +++ b/src/app/shared/components/components-selection-list/components-selection-list.component.ts @@ -4,7 +4,7 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, computed, input, model } from '@angular/core'; -import { ComponentCheckboxItemModel } from '@osf/shared/models'; +import { ComponentCheckboxItemModel } from '@osf/shared/models/component-checkbox-item.model'; import { ComponentCheckboxItemComponent } from '../component-checkbox-item/component-checkbox-item.component'; diff --git a/src/app/shared/components/confirm-email/confirm-email.component.spec.ts b/src/app/shared/components/confirm-email/confirm-email.component.spec.ts index 9841ba450..63d1a186d 100644 --- a/src/app/shared/components/confirm-email/confirm-email.component.spec.ts +++ b/src/app/shared/components/confirm-email/confirm-email.component.spec.ts @@ -1,4 +1,4 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; @@ -6,8 +6,10 @@ import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserEmailsSelectors } from '@core/store/user-emails'; -import { AccountEmailModel } from '@shared/models'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { AccountEmailModel } from '@shared/models/emails/account-email.model'; + +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { ConfirmEmailComponent } from './confirm-email.component'; @@ -36,7 +38,7 @@ describe('ConfirmEmailComponent', () => { mockToastService = ToastServiceMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [ConfirmEmailComponent, OSFTestingModule], + imports: [ConfirmEmailComponent, OSFTestingModule, MockComponent(LoadingSpinnerComponent)], providers: [ provideMockStore({ signals: [{ selector: UserEmailsSelectors.isEmailsSubmitting, value: signal(false) }], diff --git a/src/app/shared/components/confirm-email/confirm-email.component.ts b/src/app/shared/components/confirm-email/confirm-email.component.ts index d82f238b5..0c34d813c 100644 --- a/src/app/shared/components/confirm-email/confirm-email.component.ts +++ b/src/app/shared/components/confirm-email/confirm-email.component.ts @@ -10,8 +10,8 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { DeleteEmail, UserEmailsSelectors, VerifyEmail } from '@core/store/user-emails'; -import { AccountEmailModel } from '@osf/shared/models'; -import { ToastService } from '@osf/shared/services'; +import { AccountEmailModel } from '@osf/shared/models/emails/account-email.model'; +import { ToastService } from '@osf/shared/services/toast.service'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; diff --git a/src/app/shared/components/contributors-list/contributors-list.component.spec.ts b/src/app/shared/components/contributors-list/contributors-list.component.spec.ts index ad89fde0f..b45612c08 100644 --- a/src/app/shared/components/contributors-list/contributors-list.component.spec.ts +++ b/src/app/shared/components/contributors-list/contributors-list.component.spec.ts @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ContributorsListComponent } from './contributors-list.component'; -import { MOCK_CONTRIBUTOR } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('ContributorsListComponent', () => { diff --git a/src/app/shared/components/contributors-list/contributors-list.component.ts b/src/app/shared/components/contributors-list/contributors-list.component.ts index b84335abc..01a644989 100644 --- a/src/app/shared/components/contributors-list/contributors-list.component.ts +++ b/src/app/shared/components/contributors-list/contributors-list.component.ts @@ -6,7 +6,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { ContributorModel } from '@shared/models'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; @Component({ selector: 'osf-contributors-list', diff --git a/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.spec.ts b/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.spec.ts index 32817212b..040a6ddaf 100644 --- a/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.spec.ts +++ b/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.spec.ts @@ -5,12 +5,17 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomPaginatorComponent, LoadingSpinnerComponent, SearchInputComponent } from '@shared/components'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { AddDialogState } from '@osf/shared/enums/contributors/add-dialog-state.enum'; +import { ContributorAddModel } from '@osf/shared/models/contributors/contributor-add.model'; import { AddContributorItemComponent } from '@shared/components/contributors/add-contributor-item/add-contributor-item.component'; -import { AddContributorType, AddDialogState } from '@shared/enums/contributors'; -import { ContributorAddModel } from '@shared/models'; import { ContributorsSelectors } from '@shared/stores/contributors'; +import { ComponentsSelectionListComponent } from '../../components-selection-list/components-selection-list.component'; +import { CustomPaginatorComponent } from '../../custom-paginator/custom-paginator.component'; +import { LoadingSpinnerComponent } from '../../loading-spinner/loading-spinner.component'; +import { SearchInputComponent } from '../../search-input/search-input.component'; + import { AddContributorDialogComponent } from './add-contributor-dialog.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -31,7 +36,8 @@ describe('AddContributorDialogComponent', () => { SearchInputComponent, LoadingSpinnerComponent, CustomPaginatorComponent, - AddContributorItemComponent + AddContributorItemComponent, + ComponentsSelectionListComponent ), ], providers: [ diff --git a/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.ts b/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.ts index d03750147..fd4d1dd00 100644 --- a/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.ts +++ b/src/app/shared/components/contributors/add-contributor-dialog/add-contributor-dialog.component.ts @@ -23,10 +23,13 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule } from '@angular/forms'; -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { AddContributorType, AddDialogState } from '@osf/shared/enums'; -import { ComponentCheckboxItemModel, ContributorAddModel, ContributorDialogAddModel } from '@osf/shared/models'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { AddDialogState } from '@osf/shared/enums/contributors/add-dialog-state.enum'; import { ClearUsers, ContributorsSelectors, SearchUsers } from '@osf/shared/stores/contributors'; +import { ComponentCheckboxItemModel } from '@shared/models/component-checkbox-item.model'; +import { ContributorAddModel } from '@shared/models/contributors/contributor-add.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; import { ComponentsSelectionListComponent } from '../../components-selection-list/components-selection-list.component'; import { CustomPaginatorComponent } from '../../custom-paginator/custom-paginator.component'; diff --git a/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.spec.ts b/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.spec.ts index 67267535b..e8fe8fb39 100644 --- a/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.spec.ts +++ b/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorAddModel } from '@shared/models'; +import { ContributorAddModel } from '@osf/shared/models/contributors/contributor-add.model'; import { AddContributorItemComponent } from './add-contributor-item.component'; diff --git a/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.ts b/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.ts index ee2a51e57..c2eeb1960 100644 --- a/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.ts +++ b/src/app/shared/components/contributors/add-contributor-item/add-contributor-item.component.ts @@ -6,8 +6,8 @@ import { Select } from 'primeng/select'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { PERMISSION_OPTIONS } from '@osf/shared/constants'; -import { ContributorAddModel } from '@osf/shared/models'; +import { PERMISSION_OPTIONS } from '@osf/shared/constants/contributors.constants'; +import { ContributorAddModel } from '@shared/models/contributors/contributor-add.model'; @Component({ selector: 'osf-add-contributor-item', diff --git a/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.spec.ts b/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.spec.ts index 55f7c367b..110925251 100644 --- a/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.spec.ts +++ b/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.spec.ts @@ -1,12 +1,15 @@ -import { MockProviders } from 'ng-mocks'; +import { MockComponent, MockProviders } from 'ng-mocks'; import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { InputLimits } from '@shared/constants'; -import { AddContributorType, ContributorPermission } from '@shared/enums/contributors'; -import { ContributorAddModel } from '@shared/models'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ContributorAddModel } from '@shared/models/contributors/contributor-add.model'; + +import { TextInputComponent } from '../../text-input/text-input.component'; import { AddUnregisteredContributorDialogComponent } from './add-unregistered-contributor-dialog.component'; @@ -20,7 +23,7 @@ describe('AddUnregisteredContributorDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddUnregisteredContributorDialogComponent, OSFTestingModule], + imports: [AddUnregisteredContributorDialogComponent, OSFTestingModule, MockComponent(TextInputComponent)], providers: [MockProviders(DynamicDialogRef)], }).compileComponents(); diff --git a/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.ts b/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.ts index 946250911..ed86b90fb 100644 --- a/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.ts +++ b/src/app/shared/components/contributors/add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component.ts @@ -6,10 +6,13 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { InputLimits } from '@osf/shared/constants'; -import { AddContributorType, ContributorPermission } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ContributorAddModel, ContributorDialogAddModel, UnregisteredContributorForm } from '@osf/shared/models'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { ContributorAddModel } from '@shared/models/contributors/contributor-add.model'; +import { ContributorDialogAddModel } from '@shared/models/contributors/contributor-dialog-add.model'; +import { UnregisteredContributorForm } from '@shared/models/contributors/unregistered-contributor-form.model'; import { TextInputComponent } from '../../text-input/text-input.component'; diff --git a/src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts b/src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts index 76db9a235..ec825b314 100644 --- a/src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts +++ b/src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts @@ -1,15 +1,20 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { DialogService } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorPermission } from '@osf/shared/enums'; -import { ContributorModel, TableParameters } from '@osf/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; + +import { IconComponent } from '../../icon/icon.component'; +import { InfoIconComponent } from '../../info-icon/info-icon.component'; +import { SelectComponent } from '../../select/select.component'; import { ContributorsTableComponent } from './contributors-table.component'; -import { MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY } from '@testing/mocks/contributors.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { DialogServiceMockBuilder } from '@testing/providers/dialog-provider.mock'; @@ -33,7 +38,11 @@ describe('ContributorsTableComponent', () => { mockDialogService = DialogServiceMockBuilder.create().withOpenMock().build(); await TestBed.configureTestingModule({ - imports: [ContributorsTableComponent, OSFTestingModule], + imports: [ + ContributorsTableComponent, + OSFTestingModule, + ...MockComponents(SelectComponent, IconComponent, InfoIconComponent), + ], providers: [MockProvider(DialogService, mockDialogService)], }).compileComponents(); diff --git a/src/app/shared/components/contributors/contributors-table/contributors-table.component.ts b/src/app/shared/components/contributors/contributors-table/contributors-table.component.ts index d9776cbbb..80fcb5528 100644 --- a/src/app/shared/components/contributors/contributors-table/contributors-table.component.ts +++ b/src/app/shared/components/contributors/contributors-table/contributors-table.component.ts @@ -10,10 +10,13 @@ import { ChangeDetectionStrategy, Component, computed, inject, input, model, out import { FormsModule } from '@angular/forms'; import { SelectComponent } from '@osf/shared/components/select/select.component'; -import { PERMISSION_OPTIONS } from '@osf/shared/constants'; -import { ContributorPermission, ResourceType } from '@osf/shared/enums'; -import { ContributorModel, SelectOption, TableParameters } from '@osf/shared/models'; -import { CustomDialogService } from '@osf/shared/services'; +import { PERMISSION_OPTIONS } from '@osf/shared/constants/contributors.constants'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { SelectOption } from '@shared/models/select-option.model'; +import { TableParameters } from '@shared/models/table-parameters.model'; import { EducationHistoryDialogComponent } from '../../education-history-dialog/education-history-dialog.component'; import { EmploymentHistoryDialogComponent } from '../../employment-history-dialog/employment-history-dialog.component'; diff --git a/src/app/shared/components/contributors/request-access-table/request-access-table.component.spec.ts b/src/app/shared/components/contributors/request-access-table/request-access-table.component.spec.ts index ffb16ec43..7b505fe83 100644 --- a/src/app/shared/components/contributors/request-access-table/request-access-table.component.spec.ts +++ b/src/app/shared/components/contributors/request-access-table/request-access-table.component.spec.ts @@ -1,15 +1,18 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DialogService } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContributorPermission, ResourceType } from '@osf/shared/enums'; -import { RequestAccessModel } from '@osf/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { RequestAccessModel } from '@shared/models/request-access/request-access.model'; + +import { SelectComponent } from '../../select/select.component'; import { RequestAccessTableComponent } from './request-access-table.component'; -import { MOCK_USER } from '@testing/mocks'; +import { MOCK_USER } from '@testing/mocks/data.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { DialogServiceMockBuilder } from '@testing/providers/dialog-provider.mock'; @@ -50,7 +53,7 @@ describe('RequestAccessTableComponent', () => { mockDialogService = DialogServiceMockBuilder.create().withOpenMock().build(); await TestBed.configureTestingModule({ - imports: [RequestAccessTableComponent, OSFTestingModule], + imports: [RequestAccessTableComponent, OSFTestingModule, MockComponent(SelectComponent)], providers: [MockProvider(DialogService, mockDialogService)], }).compileComponents(); @@ -184,7 +187,7 @@ describe('RequestAccessTableComponent', () => { expect.objectContaining({ header: 'project.contributors.table.headers.education', width: '552px', - data: mockRequestAccessItem.creator.education, + data: mockRequestAccessItem?.creator?.education, }) ); }); @@ -197,7 +200,7 @@ describe('RequestAccessTableComponent', () => { expect.objectContaining({ header: 'project.contributors.table.headers.employment', width: '552px', - data: mockRequestAccessItem.creator.employment, + data: mockRequestAccessItem?.creator?.employment, }) ); }); diff --git a/src/app/shared/components/contributors/request-access-table/request-access-table.component.ts b/src/app/shared/components/contributors/request-access-table/request-access-table.component.ts index ba1166298..dfab11897 100644 --- a/src/app/shared/components/contributors/request-access-table/request-access-table.component.ts +++ b/src/app/shared/components/contributors/request-access-table/request-access-table.component.ts @@ -9,10 +9,11 @@ import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, computed, inject, input, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { PERMISSION_OPTIONS } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { RequestAccessModel, SelectOption } from '@osf/shared/models'; -import { CustomDialogService } from '@osf/shared/services'; +import { PERMISSION_OPTIONS } from '@osf/shared/constants/contributors.constants'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { RequestAccessModel } from '@shared/models/request-access/request-access.model'; +import { SelectOption } from '@shared/models/select-option.model'; import { EducationHistoryDialogComponent } from '../../education-history-dialog/education-history-dialog.component'; import { EmploymentHistoryDialogComponent } from '../../employment-history-dialog/employment-history-dialog.component'; diff --git a/src/app/shared/components/copy-button/copy-button.component.spec.ts b/src/app/shared/components/copy-button/copy-button.component.spec.ts index 4ab1e9b6d..db190f212 100644 --- a/src/app/shared/components/copy-button/copy-button.component.spec.ts +++ b/src/app/shared/components/copy-button/copy-button.component.spec.ts @@ -3,7 +3,7 @@ import { MockProviders } from 'ng-mocks'; import { Clipboard } from '@angular/cdk/clipboard'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CopyButtonComponent } from './copy-button.component'; diff --git a/src/app/shared/components/copy-button/copy-button.component.ts b/src/app/shared/components/copy-button/copy-button.component.ts index da15a6240..94f44f60b 100644 --- a/src/app/shared/components/copy-button/copy-button.component.ts +++ b/src/app/shared/components/copy-button/copy-button.component.ts @@ -6,8 +6,8 @@ import { Tooltip } from 'primeng/tooltip'; import { Clipboard } from '@angular/cdk/clipboard'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; -import { ToastService } from '@osf/shared/services'; -import { SeverityType } from '@shared/models'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { SeverityType } from '@shared/models/severity.type'; @Component({ selector: 'osf-copy-button', diff --git a/src/app/shared/components/data-resources/data-resources.component.spec.ts b/src/app/shared/components/data-resources/data-resources.component.spec.ts index 0cf471a09..1b07b61d4 100644 --- a/src/app/shared/components/data-resources/data-resources.component.spec.ts +++ b/src/app/shared/components/data-resources/data-resources.component.spec.ts @@ -1,8 +1,10 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; +import { IconComponent } from '../icon/icon.component'; + import { DataResourcesComponent } from './data-resources.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -17,7 +19,7 @@ describe('DataResourcesComponent', () => { activatedRouteMock = ActivatedRouteMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [DataResourcesComponent, OSFTestingModule], + imports: [DataResourcesComponent, OSFTestingModule, MockComponent(IconComponent)], providers: [MockProvider(ActivatedRoute, activatedRouteMock)], }).compileComponents(); diff --git a/src/app/shared/components/datacite-tracker/datacite-tracker.component.ts b/src/app/shared/components/datacite-tracker/datacite-tracker.component.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/shared/components/doughnut-chart/doughnut-chart.component.spec.ts b/src/app/shared/components/doughnut-chart/doughnut-chart.component.spec.ts index 57ea57371..20b8545ad 100644 --- a/src/app/shared/components/doughnut-chart/doughnut-chart.component.spec.ts +++ b/src/app/shared/components/doughnut-chart/doughnut-chart.component.spec.ts @@ -1,8 +1,10 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { PLATFORM_ID } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; + import { DoughnutChartComponent } from './doughnut-chart.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -13,7 +15,7 @@ describe('DoughnutChartComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [DoughnutChartComponent, OSFTestingModule], + imports: [DoughnutChartComponent, OSFTestingModule, MockComponent(LoadingSpinnerComponent)], providers: [MockProvider(PLATFORM_ID, 'server')], }).compileComponents(); diff --git a/src/app/shared/components/doughnut-chart/doughnut-chart.component.ts b/src/app/shared/components/doughnut-chart/doughnut-chart.component.ts index 88b4f6755..edf3b3123 100644 --- a/src/app/shared/components/doughnut-chart/doughnut-chart.component.ts +++ b/src/app/shared/components/doughnut-chart/doughnut-chart.component.ts @@ -6,8 +6,8 @@ import { ChartModule } from 'primeng/chart'; import { isPlatformBrowser } from '@angular/common'; import { ChangeDetectionStrategy, Component, inject, input, OnInit, PLATFORM_ID, signal } from '@angular/core'; -import { PIE_CHART_PALETTE } from '@osf/shared/constants'; -import { DatasetInput } from '@osf/shared/models'; +import { PIE_CHART_PALETTE } from '@osf/shared/constants/pie-chart-palette'; +import { DatasetInput } from '@shared/models/charts/dataset-input'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; diff --git a/src/app/shared/components/education-history-dialog/education-history-dialog.component.spec.ts b/src/app/shared/components/education-history-dialog/education-history-dialog.component.spec.ts index 341702e14..2c7034e56 100644 --- a/src/app/shared/components/education-history-dialog/education-history-dialog.component.spec.ts +++ b/src/app/shared/components/education-history-dialog/education-history-dialog.component.spec.ts @@ -1,9 +1,11 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { EducationHistoryComponent } from '../education-history/education-history.component'; + import { EducationHistoryDialogComponent } from './education-history-dialog.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -14,7 +16,7 @@ describe('EducationHistoryDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [EducationHistoryDialogComponent, OSFTestingModule], + imports: [EducationHistoryDialogComponent, OSFTestingModule, MockComponent(EducationHistoryComponent)], providers: [MockProvider(DynamicDialogRef), MockProvider(DynamicDialogConfig)], }).compileComponents(); diff --git a/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts b/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts index 95a0dbea8..01c41709e 100644 --- a/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts +++ b/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts @@ -8,7 +8,7 @@ import { timer } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { Education } from '@osf/shared/models'; +import { Education } from '@osf/shared/models/user/education.model'; import { EducationHistoryComponent } from '../education-history/education-history.component'; diff --git a/src/app/shared/components/education-history/education-history.component.spec.ts b/src/app/shared/components/education-history/education-history.component.spec.ts index bb03f958d..34e09a370 100644 --- a/src/app/shared/components/education-history/education-history.component.spec.ts +++ b/src/app/shared/components/education-history/education-history.component.spec.ts @@ -1,8 +1,12 @@ +import { MockPipe } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MonthYearPipe } from '@osf/shared/pipes/month-year.pipe'; + import { EducationHistoryComponent } from './education-history.component'; -import { MOCK_EDUCATION } from '@testing/mocks'; +import { MOCK_EDUCATION } from '@testing/mocks/user-employment-education.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('EducationHistoryComponent', () => { @@ -11,7 +15,7 @@ describe('EducationHistoryComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [EducationHistoryComponent, OSFTestingModule], + imports: [EducationHistoryComponent, OSFTestingModule, MockPipe(MonthYearPipe)], }).compileComponents(); fixture = TestBed.createComponent(EducationHistoryComponent); diff --git a/src/app/shared/components/education-history/education-history.component.ts b/src/app/shared/components/education-history/education-history.component.ts index eff189e85..88d95b9bf 100644 --- a/src/app/shared/components/education-history/education-history.component.ts +++ b/src/app/shared/components/education-history/education-history.component.ts @@ -4,8 +4,8 @@ import { AccordionModule } from 'primeng/accordion'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { Education } from '@osf/shared/models'; -import { MonthYearPipe } from '@osf/shared/pipes'; +import { Education } from '@osf/shared/models/user/education.model'; +import { MonthYearPipe } from '@osf/shared/pipes/month-year.pipe'; @Component({ selector: 'osf-education-history', diff --git a/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.spec.ts b/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.spec.ts index 4a30c3496..ed86a2705 100644 --- a/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.spec.ts +++ b/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.spec.ts @@ -1,9 +1,11 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { EmploymentHistoryComponent } from '../employment-history/employment-history.component'; + import { EmploymentHistoryDialogComponent } from './employment-history-dialog.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -14,7 +16,7 @@ describe('EmploymentHistoryDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [EmploymentHistoryDialogComponent, OSFTestingModule], + imports: [EmploymentHistoryDialogComponent, OSFTestingModule, MockComponent(EmploymentHistoryComponent)], providers: [MockProvider(DynamicDialogRef), MockProvider(DynamicDialogConfig)], }).compileComponents(); diff --git a/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts b/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts index f57360660..f66595d9a 100644 --- a/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts +++ b/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts @@ -8,7 +8,7 @@ import { timer } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { Employment } from '@osf/shared/models'; +import { Employment } from '@osf/shared/models/user/employment.model'; import { EmploymentHistoryComponent } from '../employment-history/employment-history.component'; diff --git a/src/app/shared/components/employment-history/employment-history.component.spec.ts b/src/app/shared/components/employment-history/employment-history.component.spec.ts index ccf19200e..8a84fb151 100644 --- a/src/app/shared/components/employment-history/employment-history.component.spec.ts +++ b/src/app/shared/components/employment-history/employment-history.component.spec.ts @@ -1,9 +1,13 @@ +import { MockPipe } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; +import { MonthYearPipe } from '@osf/shared/pipes/month-year.pipe'; + import { EmploymentHistoryComponent } from './employment-history.component'; -import { MOCK_EMPLOYMENT } from '@testing/mocks'; +import { MOCK_EMPLOYMENT } from '@testing/mocks/user-employment-education.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('EmploymentHistoryComponent', () => { @@ -12,7 +16,7 @@ describe('EmploymentHistoryComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [EmploymentHistoryComponent, OSFTestingModule], + imports: [EmploymentHistoryComponent, OSFTestingModule, MockPipe(MonthYearPipe)], }).compileComponents(); fixture = TestBed.createComponent(EmploymentHistoryComponent); diff --git a/src/app/shared/components/employment-history/employment-history.component.ts b/src/app/shared/components/employment-history/employment-history.component.ts index af46163f1..cb4088d0e 100644 --- a/src/app/shared/components/employment-history/employment-history.component.ts +++ b/src/app/shared/components/employment-history/employment-history.component.ts @@ -4,8 +4,8 @@ import { AccordionModule } from 'primeng/accordion'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { Employment } from '@osf/shared/models'; -import { MonthYearPipe } from '@osf/shared/pipes'; +import { Employment } from '@osf/shared/models/user/employment.model'; +import { MonthYearPipe } from '@osf/shared/pipes/month-year.pipe'; @Component({ selector: 'osf-employment-history', diff --git a/src/app/shared/components/file-menu/file-menu.component.ts b/src/app/shared/components/file-menu/file-menu.component.ts index 7f42aa2eb..6135fb4bc 100644 --- a/src/app/shared/components/file-menu/file-menu.component.ts +++ b/src/app/shared/components/file-menu/file-menu.component.ts @@ -7,10 +7,10 @@ import { TieredMenu } from 'primeng/tieredmenu'; import { Component, computed, inject, input, output, viewChild } from '@angular/core'; import { Router } from '@angular/router'; -import { FileMenuType } from '@osf/shared/enums'; -import { FileMenuAction, FileMenuData, FileMenuFlags } from '@osf/shared/models'; -import { MenuManagerService } from '@osf/shared/services'; -import { hasViewOnlyParam } from '@shared/helpers'; +import { FileMenuType } from '@osf/shared/enums/file-menu-type.enum'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { MenuManagerService } from '@osf/shared/services/menu-manager.service'; +import { FileMenuAction, FileMenuData, FileMenuFlags } from '@shared/models/files/file-menu-action.model'; @Component({ selector: 'osf-file-menu', diff --git a/src/app/shared/components/file-select-destination/file-select-destination.component.spec.ts b/src/app/shared/components/file-select-destination/file-select-destination.component.spec.ts index 6bde243c2..a6f8e9198 100644 --- a/src/app/shared/components/file-select-destination/file-select-destination.component.spec.ts +++ b/src/app/shared/components/file-select-destination/file-select-destination.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { SelectComponent } from '../select/select.component'; + import { FileSelectDestinationComponent } from './file-select-destination.component'; describe.skip('FileSelectDestinationComponent', () => { @@ -8,7 +12,7 @@ describe.skip('FileSelectDestinationComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FileSelectDestinationComponent], + imports: [FileSelectDestinationComponent, MockComponent(SelectComponent)], }).compileComponents(); fixture = TestBed.createComponent(FileSelectDestinationComponent); diff --git a/src/app/shared/components/file-select-destination/file-select-destination.component.ts b/src/app/shared/components/file-select-destination/file-select-destination.component.ts index 33a5f57d1..b88134e4c 100644 --- a/src/app/shared/components/file-select-destination/file-select-destination.component.ts +++ b/src/app/shared/components/file-select-destination/file-select-destination.component.ts @@ -35,8 +35,11 @@ import { } from '@osf/features/files/store'; import { SupportedFeature } from '@osf/shared/enums/addon-supported-features.enum'; import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; -import { Primitive } from '@osf/shared/helpers'; -import { ConfiguredAddonModel, FileLabelModel, NodeShortInfoModel, SelectOption } from '@osf/shared/models'; +import { Primitive } from '@osf/shared/helpers/types.helper'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { FileLabelModel } from '@osf/shared/models/files/file-label.model'; +import { NodeShortInfoModel } from '@osf/shared/models/nodes/node-with-children.model'; +import { SelectOption } from '@osf/shared/models/select-option.model'; import { SelectComponent } from '../select/select.component'; diff --git a/src/app/shared/components/file-upload-dialog/file-upload-dialog.component.spec.ts b/src/app/shared/components/file-upload-dialog/file-upload-dialog.component.spec.ts index 2e21e75f6..88d76cde2 100644 --- a/src/app/shared/components/file-upload-dialog/file-upload-dialog.component.spec.ts +++ b/src/app/shared/components/file-upload-dialog/file-upload-dialog.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; + import { FileUploadDialogComponent } from './file-upload-dialog.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -10,7 +14,7 @@ describe('FileUploadDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FileUploadDialogComponent, OSFTestingModule], + imports: [FileUploadDialogComponent, OSFTestingModule, MockComponent(LoadingSpinnerComponent)], }).compileComponents(); fixture = TestBed.createComponent(FileUploadDialogComponent); diff --git a/src/app/shared/components/files-tree/files-tree.component.spec.ts b/src/app/shared/components/files-tree/files-tree.component.spec.ts index 1251d90e0..4190c6f9d 100644 --- a/src/app/shared/components/files-tree/files-tree.component.spec.ts +++ b/src/app/shared/components/files-tree/files-tree.component.spec.ts @@ -1,15 +1,21 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { DialogService } from 'primeng/dynamicdialog'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FileKind } from '@shared/enums'; -import { FileFolderModel, FileLabelModel } from '@shared/models'; -import { CustomConfirmationService, FilesService, ToastService } from '@shared/services'; -import { DataciteService } from '@shared/services/datacite/datacite.service'; -import { CurrentResourceSelectors } from '@shared/stores/current-resource'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { CurrentResourceSelectors } from '@osf/shared/stores/current-resource'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; +import { FileLabelModel } from '@shared/models/files/file-label.model'; + +import { FileMenuComponent } from '../file-menu/file-menu.component'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { FilesTreeComponent } from './files-tree.component'; @@ -37,7 +43,7 @@ describe('FilesTreeComponent', () => { beforeEach(async () => { dataciteMock = DataciteMockFactory(); await TestBed.configureTestingModule({ - imports: [FilesTreeComponent, OSFTestingModule], + imports: [FilesTreeComponent, OSFTestingModule, ...MockComponents(LoadingSpinnerComponent, FileMenuComponent)], providers: [ provideMockStore({ signals: [{ selector: CurrentResourceSelectors.getCurrentResource, value: signal(null) }], diff --git a/src/app/shared/components/files-tree/files-tree.component.ts b/src/app/shared/components/files-tree/files-tree.component.ts index 27fceacad..e24542c2a 100644 --- a/src/app/shared/components/files-tree/files-tree.component.ts +++ b/src/app/shared/components/files-tree/files-tree.component.ts @@ -30,14 +30,21 @@ import { ENVIRONMENT } from '@core/provider/environment.provider'; import { MoveFileDialogComponent } from '@osf/features/files/components/move-file-dialog/move-file-dialog.component'; import { RenameFileDialogComponent } from '@osf/features/files/components/rename-file-dialog/rename-file-dialog.component'; import { embedDynamicJs, embedStaticHtml } from '@osf/features/files/constants'; -import { StopPropagationDirective } from '@osf/shared/directives'; -import { FileKind, FileMenuType } from '@osf/shared/enums'; -import { hasViewOnlyParam } from '@osf/shared/helpers'; -import { FilesMapper } from '@osf/shared/mappers'; -import { FileFolderModel, FileLabelModel, FileMenuAction, FileMenuFlags, FileModel } from '@osf/shared/models'; -import { FileSizePipe } from '@osf/shared/pipes'; -import { CustomConfirmationService, CustomDialogService, FilesService, ToastService } from '@osf/shared/services'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; +import { FileMenuType } from '@osf/shared/enums/file-menu-type.enum'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { FilesMapper } from '@osf/shared/mappers/files/files.mapper'; +import { FileSizePipe } from '@osf/shared/pipes/file-size.pipe'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { DataciteService } from '@osf/shared/services/datacite/datacite.service'; +import { FilesService } from '@osf/shared/services/files.service'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { FileModel } from '@shared/models/files/file.model'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; +import { FileLabelModel } from '@shared/models/files/file-label.model'; +import { FileMenuAction, FileMenuFlags } from '@shared/models/files/file-menu-action.model'; import { CurrentResourceSelectors } from '@shared/stores/current-resource'; import { FileMenuComponent } from '../file-menu/file-menu.component'; diff --git a/src/app/shared/components/filter-chips/filter-chips.component.spec.ts b/src/app/shared/components/filter-chips/filter-chips.component.spec.ts index 8667731a2..1fec74fc0 100644 --- a/src/app/shared/components/filter-chips/filter-chips.component.spec.ts +++ b/src/app/shared/components/filter-chips/filter-chips.component.spec.ts @@ -1,6 +1,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { DiscoverableFilter, FilterOperator, FilterOption } from '@shared/models'; +import { + DiscoverableFilter, + FilterOperatorOption, + FilterOption, +} from '@osf/shared/models/search/discaverable-filter.model'; import { FilterChipsComponent } from './filter-chips.component'; @@ -14,7 +18,7 @@ describe('FilterChipsComponent', () => { { key: 'subject', label: 'Subject', - operator: FilterOperator.IsPresent, + operator: FilterOperatorOption.IsPresent, resultCount: 100, options: [ { label: 'Psychology', value: 'psychology', cardSearchResultCount: 50 }, @@ -24,7 +28,7 @@ describe('FilterChipsComponent', () => { { key: 'resourceType', label: 'Resource Type', - operator: FilterOperator.IsPresent, + operator: FilterOperatorOption.IsPresent, resultCount: 75, options: [ { label: 'Project', value: 'project', cardSearchResultCount: 40 }, @@ -94,8 +98,8 @@ describe('FilterChipsComponent', () => { it('should filter out filters without key or label', () => { const filtersWithMissing: DiscoverableFilter[] = [ ...mockFilters, - { key: '', label: 'No Key', operator: FilterOperator.IsPresent, resultCount: 10, options: [] }, - { key: 'noLabel', label: '', operator: FilterOperator.IsPresent, resultCount: 10, options: [] }, + { key: '', label: 'No Key', operator: FilterOperatorOption.IsPresent, resultCount: 10, options: [] }, + { key: 'noLabel', label: '', operator: FilterOperatorOption.IsPresent, resultCount: 10, options: [] }, ]; fixture.componentRef.setInput('filters', filtersWithMissing); diff --git a/src/app/shared/components/filter-chips/filter-chips.component.ts b/src/app/shared/components/filter-chips/filter-chips.component.ts index dcac25ed6..4550c4d62 100644 --- a/src/app/shared/components/filter-chips/filter-chips.component.ts +++ b/src/app/shared/components/filter-chips/filter-chips.component.ts @@ -3,7 +3,7 @@ import { Chip } from 'primeng/chip'; import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; -import { DiscoverableFilter, FilterOption } from '@shared/models'; +import { DiscoverableFilter, FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; @Component({ selector: 'osf-filter-chips', diff --git a/src/app/shared/components/form-select/form-select.component.spec.ts b/src/app/shared/components/form-select/form-select.component.spec.ts index 2cd460bc4..e055630c5 100644 --- a/src/app/shared/components/form-select/form-select.component.spec.ts +++ b/src/app/shared/components/form-select/form-select.component.spec.ts @@ -2,7 +2,7 @@ import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; -import { SelectOption } from '@osf/shared/models'; +import { SelectOption } from '@osf/shared/models/select-option.model'; import { FormSelectComponent } from './form-select.component'; diff --git a/src/app/shared/components/form-select/form-select.component.ts b/src/app/shared/components/form-select/form-select.component.ts index 4fa0daefb..4b3431124 100644 --- a/src/app/shared/components/form-select/form-select.component.ts +++ b/src/app/shared/components/form-select/form-select.component.ts @@ -5,7 +5,7 @@ import { Select } from 'primeng/select'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { SelectOption } from '@osf/shared/models'; +import { SelectOption } from '@osf/shared/models/select-option.model'; @Component({ selector: 'osf-form-select', diff --git a/src/app/shared/components/full-screen-loader/full-screen-loader.component.spec.ts b/src/app/shared/components/full-screen-loader/full-screen-loader.component.spec.ts index a7619006b..0d6588302 100644 --- a/src/app/shared/components/full-screen-loader/full-screen-loader.component.spec.ts +++ b/src/app/shared/components/full-screen-loader/full-screen-loader.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { LoaderService } from '@shared/services'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { FullScreenLoaderComponent } from './full-screen-loader.component'; -import { LoaderServiceMock } from '@testing/mocks'; +import { LoaderServiceMock } from '@testing/mocks/loader-service.mock'; describe('FullScreenLoaderComponent', () => { let component: FullScreenLoaderComponent; diff --git a/src/app/shared/components/full-screen-loader/full-screen-loader.component.ts b/src/app/shared/components/full-screen-loader/full-screen-loader.component.ts index eb7c7a579..8d97c4217 100644 --- a/src/app/shared/components/full-screen-loader/full-screen-loader.component.ts +++ b/src/app/shared/components/full-screen-loader/full-screen-loader.component.ts @@ -2,7 +2,7 @@ import { ProgressSpinner } from 'primeng/progressspinner'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; -import { LoaderService } from '@osf/shared/services'; +import { LoaderService } from '@osf/shared/services/loader.service'; @Component({ selector: 'osf-full-screen-loader', diff --git a/src/app/shared/components/generic-filter/generic-filter.component.spec.ts b/src/app/shared/components/generic-filter/generic-filter.component.spec.ts index f78de0227..1152ec047 100644 --- a/src/app/shared/components/generic-filter/generic-filter.component.spec.ts +++ b/src/app/shared/components/generic-filter/generic-filter.component.spec.ts @@ -1,8 +1,12 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { FilterOperator, FilterOption } from '@shared/models'; +import { FilterOperatorOption, FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; + +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { GenericFilterComponent } from './generic-filter.component'; @@ -21,7 +25,7 @@ describe('GenericFilterComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [GenericFilterComponent, OSFTestingModule], + imports: [GenericFilterComponent, OSFTestingModule, MockComponent(LoadingSpinnerComponent)], }).compileComponents(); fixture = TestBed.createComponent(GenericFilterComponent); @@ -43,7 +47,7 @@ describe('GenericFilterComponent', () => { expect(component.isSearchLoading()).toBe(false); expect(component.selectedOptions()).toEqual([]); expect(component.placeholder()).toBe(''); - expect(component.filterOperator()).toBe(FilterOperator.AnyOf); + expect(component.filterOperator()).toBe(FilterOperatorOption.AnyOf); }); it('should accept options input', () => { @@ -68,10 +72,10 @@ describe('GenericFilterComponent', () => { }); it('should accept filterOperator input', () => { - componentRef.setInput('filterOperator', FilterOperator.Date); + componentRef.setInput('filterOperator', FilterOperatorOption.Date); fixture.detectChanges(); - expect(component.filterOperator()).toBe(FilterOperator.Date); + expect(component.filterOperator()).toBe(FilterOperatorOption.Date); }); it('should accept selectedOptions input', () => { diff --git a/src/app/shared/components/generic-filter/generic-filter.component.ts b/src/app/shared/components/generic-filter/generic-filter.component.ts index 9b002559b..482e2227b 100644 --- a/src/app/shared/components/generic-filter/generic-filter.component.ts +++ b/src/app/shared/components/generic-filter/generic-filter.component.ts @@ -17,7 +17,7 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; -import { FilterOperator, FilterOption } from '@shared/models'; +import { FilterOperatorOption, FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; @@ -37,7 +37,7 @@ export class GenericFilterComponent { isSearchLoading = input(false); selectedOptions = input([]); placeholder = input(''); - filterOperator = input(FilterOperator.AnyOf); + filterOperator = input(FilterOperatorOption.AnyOf); selectedOptionsChanged = output(); searchTextChanged = output(); diff --git a/src/app/shared/components/global-search/global-search.component.spec.ts b/src/app/shared/components/global-search/global-search.component.spec.ts index d1b3f54ab..6e4887249 100644 --- a/src/app/shared/components/global-search/global-search.component.spec.ts +++ b/src/app/shared/components/global-search/global-search.component.spec.ts @@ -1,14 +1,23 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; -import { NO_ERRORS_SCHEMA, signal } from '@angular/core'; +import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { ResourceType } from '@shared/enums'; -import { DiscoverableFilter, FilterOperator, FilterOption } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { + DiscoverableFilter, + FilterOperatorOption, + FilterOption, +} from '@shared/models/search/discaverable-filter.model'; import { GlobalSearchSelectors } from '@shared/stores/global-search'; +import { FilterChipsComponent } from '../filter-chips/filter-chips.component'; +import { SearchFiltersComponent } from '../search-filters/search-filters.component'; +import { SearchHelpTutorialComponent } from '../search-help-tutorial/search-help-tutorial.component'; +import { SearchInputComponent } from '../search-input/search-input.component'; + import { GlobalSearchComponent } from './global-search.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -25,7 +34,7 @@ describe('GlobalSearchComponent', () => { const mockFilter: DiscoverableFilter = { key: 'subject', label: 'Subject', - operator: FilterOperator.AnyOf, + operator: FilterOperatorOption.AnyOf, options: [], }; @@ -40,8 +49,16 @@ describe('GlobalSearchComponent', () => { mockActivatedRoute = ActivatedRouteMockBuilder.create().build(); await TestBed.configureTestingModule({ - imports: [GlobalSearchComponent, OSFTestingModule], - schemas: [NO_ERRORS_SCHEMA], + imports: [ + GlobalSearchComponent, + OSFTestingModule, + ...MockComponents( + FilterChipsComponent, + SearchInputComponent, + SearchFiltersComponent, + SearchHelpTutorialComponent + ), + ], providers: [ provideMockStore({ signals: [ diff --git a/src/app/shared/components/global-search/global-search.component.ts b/src/app/shared/components/global-search/global-search.component.ts index 21eb74dca..8032c0126 100644 --- a/src/app/shared/components/global-search/global-search.component.ts +++ b/src/app/shared/components/global-search/global-search.component.ts @@ -19,10 +19,11 @@ import { FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; +import { normalizeQuotes } from '@osf/shared/helpers/normalize-quotes'; import { SearchFiltersComponent } from '@shared/components/search-filters/search-filters.component'; -import { ResourceType } from '@shared/enums'; -import { normalizeQuotes } from '@shared/helpers'; -import { DiscoverableFilter, FilterOption, TabOption } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { DiscoverableFilter, FilterOption } from '@shared/models/search/discaverable-filter.model'; +import { TabOption } from '@shared/models/tab-option.model'; import { ClearFilterSearchResults, FetchResources, diff --git a/src/app/shared/components/google-file-picker/google-file-picker.component.spec.ts b/src/app/shared/components/google-file-picker/google-file-picker.component.spec.ts index 00c4fd8b8..b9e46b9a8 100644 --- a/src/app/shared/components/google-file-picker/google-file-picker.component.spec.ts +++ b/src/app/shared/components/google-file-picker/google-file-picker.component.spec.ts @@ -5,7 +5,7 @@ import { Observable, of, throwError } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; -import { GoogleFilePickerDownloadService } from '@shared/services'; +import { GoogleFilePickerDownloadService } from '@osf/shared/services/google-file-picker.download.service'; import { GoogleFilePickerComponent } from './google-file-picker.component'; diff --git a/src/app/shared/components/google-file-picker/google-file-picker.component.ts b/src/app/shared/components/google-file-picker/google-file-picker.component.ts index b49154bde..5ba8e6825 100644 --- a/src/app/shared/components/google-file-picker/google-file-picker.component.ts +++ b/src/app/shared/components/google-file-picker/google-file-picker.component.ts @@ -1,6 +1,6 @@ import { Store } from '@ngxs/store'; -import { TranslateModule, TranslateService } from '@ngx-translate/core'; +import { TranslatePipe, TranslateService } from '@ngx-translate/core'; import { Button } from 'primeng/button'; @@ -8,19 +8,18 @@ import { ChangeDetectionStrategy, Component, inject, input, OnInit, signal } fro import { ENVIRONMENT } from '@core/provider/environment.provider'; import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; -import { AddonType } from '@shared/enums'; -import { StorageItem } from '@shared/models'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { GoogleFilePickerDownloadService } from '@osf/shared/services/google-file-picker.download.service'; +import { StorageItem } from '@shared/models/addons/storage-item.model'; import { GoogleFileDataModel } from '@shared/models/files/google-file.data.model'; import { GoogleFilePickerModel } from '@shared/models/files/google-file.picker.model'; -import { GoogleFilePickerDownloadService } from '@shared/services'; import { AddonsSelectors, GetAuthorizedStorageOauthToken } from '@shared/stores/addons'; @Component({ selector: 'osf-google-file-picker', - imports: [TranslateModule, Button], + imports: [TranslatePipe, Button], templateUrl: './google-file-picker.component.html', styleUrl: './google-file-picker.component.scss', - providers: [], changeDetection: ChangeDetectionStrategy.OnPush, }) export class GoogleFilePickerComponent implements OnInit { diff --git a/src/app/shared/components/index.ts b/src/app/shared/components/index.ts deleted file mode 100644 index e1f7408f7..000000000 --- a/src/app/shared/components/index.ts +++ /dev/null @@ -1,60 +0,0 @@ -export { AddProjectFormComponent } from './add-project-form/add-project-form.component'; -export { AffiliatedInstitutionSelectComponent } from './affiliated-institution-select/affiliated-institution-select.component'; -export { AffiliatedInstitutionsViewComponent } from './affiliated-institutions-view/affiliated-institutions-view.component'; -export { BarChartComponent } from './bar-chart/bar-chart.component'; -export { ComponentCheckboxItemComponent } from './component-checkbox-item/component-checkbox-item.component'; -export { ComponentsSelectionListComponent } from './components-selection-list/components-selection-list.component'; -export { ConfirmEmailComponent } from './confirm-email/confirm-email.component'; -export { ContributorsListComponent } from './contributors-list/contributors-list.component'; -export { CopyButtonComponent } from './copy-button/copy-button.component'; -export { CustomPaginatorComponent } from './custom-paginator/custom-paginator.component'; -export { DataResourcesComponent } from './data-resources/data-resources.component'; -export { EducationHistoryComponent } from './education-history/education-history.component'; -export { EducationHistoryDialogComponent } from './education-history-dialog/education-history-dialog.component'; -export { EmploymentHistoryComponent } from './employment-history/employment-history.component'; -export { EmploymentHistoryDialogComponent } from './employment-history-dialog/employment-history-dialog.component'; -export { FileMenuComponent } from './file-menu/file-menu.component'; -export { FileSelectDestinationComponent } from './file-select-destination/file-select-destination.component'; -export { FileUploadDialogComponent } from './file-upload-dialog/file-upload-dialog.component'; -export { FilesTreeComponent } from './files-tree/files-tree.component'; -export { FilterChipsComponent } from './filter-chips/filter-chips.component'; -export { FormSelectComponent } from './form-select/form-select.component'; -export { FullScreenLoaderComponent } from './full-screen-loader/full-screen-loader.component'; -export { GenericFilterComponent } from './generic-filter/generic-filter.component'; -export { GlobalSearchComponent } from './global-search/global-search.component'; -export { GoogleFilePickerComponent } from './google-file-picker/google-file-picker.component'; -export { IconComponent } from './icon/icon.component'; -export { InfoIconComponent } from './info-icon/info-icon.component'; -export { LicenseComponent } from './license/license.component'; -export { LicenseDisplayComponent } from './license-display/license-display.component'; -export { LineChartComponent } from './line-chart/line-chart.component'; -export { ListInfoShortenerComponent } from './list-info-shortener/list-info-shortener.component'; -export { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component'; -export { MakeDecisionDialogComponent } from './make-decision-dialog/make-decision-dialog.component'; -export { MarkdownComponent } from './markdown/markdown.component'; -export { MetadataTabsComponent } from './metadata-tabs/metadata-tabs.component'; -export { MyProjectsTableComponent } from './my-projects-table/my-projects-table.component'; -export { PasswordInputHintComponent } from './password-input-hint/password-input-hint.component'; -export { PieChartComponent } from './pie-chart/pie-chart.component'; -export { ProjectSelectorComponent } from './project-selector/project-selector.component'; -export { ReadonlyInputComponent } from './readonly-input/readonly-input.component'; -export { RegistrationBlocksDataComponent } from './registration-blocks-data/registration-blocks-data.component'; -export { RegistrationCardComponent } from './registration-card/registration-card.component'; -export { ResourceCardComponent } from './resource-card/resource-card.component'; -export { ResourceMetadataComponent } from './resource-metadata/resource-metadata.component'; -export { SearchFiltersComponent } from './search-filters/search-filters.component'; -export { SearchHelpTutorialComponent } from './search-help-tutorial/search-help-tutorial.component'; -export { SearchInputComponent } from './search-input/search-input.component'; -export { SearchResultsContainerComponent } from './search-results-container/search-results-container.component'; -export { SelectComponent } from './select/select.component'; -export { SocialsShareButtonComponent } from './socials-share-button/socials-share-button.component'; -export { StatisticCardComponent } from './statistic-card/statistic-card.component'; -export { StepperComponent } from './stepper/stepper.component'; -export { SubHeaderComponent } from './sub-header/sub-header.component'; -export { SubjectsComponent } from './subjects/subjects.component'; -export { TagsInputComponent } from './tags-input/tags-input.component'; -export { TextInputComponent } from './text-input/text-input.component'; -export { ToastComponent } from './toast/toast.component'; -export { TruncatedTextComponent } from './truncated-text/truncated-text.component'; -export { ViewOnlyLinkMessageComponent } from './view-only-link-message/view-only-link-message.component'; -export { ViewOnlyTableComponent } from './view-only-table/view-only-table.component'; diff --git a/src/app/shared/components/info-icon/info-icon.component.spec.ts b/src/app/shared/components/info-icon/info-icon.component.spec.ts index e82e56d95..1a6b7623a 100644 --- a/src/app/shared/components/info-icon/info-icon.component.spec.ts +++ b/src/app/shared/components/info-icon/info-icon.component.spec.ts @@ -5,7 +5,7 @@ import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { TooltipPosition } from '@shared/models'; +import { TooltipPosition } from '@osf/shared/models/tooltip-position.model'; import { InfoIconComponent } from './info-icon.component'; diff --git a/src/app/shared/components/info-icon/info-icon.component.ts b/src/app/shared/components/info-icon/info-icon.component.ts index 2db436fd7..abb45ca3a 100644 --- a/src/app/shared/components/info-icon/info-icon.component.ts +++ b/src/app/shared/components/info-icon/info-icon.component.ts @@ -4,7 +4,7 @@ import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { TooltipPosition } from '@osf/shared/models'; +import { TooltipPosition } from '@osf/shared/models/tooltip-position.model'; @Component({ selector: 'osf-info-icon', diff --git a/src/app/shared/components/license-display/license-display.component.spec.ts b/src/app/shared/components/license-display/license-display.component.spec.ts index bddc86557..336af6cfd 100644 --- a/src/app/shared/components/license-display/license-display.component.spec.ts +++ b/src/app/shared/components/license-display/license-display.component.spec.ts @@ -2,12 +2,12 @@ import { MockPipe } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { LicenseModel } from '@osf/shared/models'; -import { InterpolatePipe } from '@osf/shared/pipes'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { InterpolatePipe } from '@osf/shared/pipes/interpolate.pipe'; import { LicenseDisplayComponent } from './license-display.component'; -import { MOCK_LICENSE } from '@testing/mocks'; +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('LicenseDisplayComponent', () => { diff --git a/src/app/shared/components/license-display/license-display.component.ts b/src/app/shared/components/license-display/license-display.component.ts index 72b6b7864..4bbb271a6 100644 --- a/src/app/shared/components/license-display/license-display.component.ts +++ b/src/app/shared/components/license-display/license-display.component.ts @@ -2,8 +2,8 @@ import { Accordion, AccordionContent, AccordionHeader, AccordionPanel } from 'pr import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { LicenseModel } from '@osf/shared/models'; -import { InterpolatePipe } from '@osf/shared/pipes'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { InterpolatePipe } from '@osf/shared/pipes/interpolate.pipe'; @Component({ selector: 'osf-license-display', diff --git a/src/app/shared/components/license/license.component.spec.ts b/src/app/shared/components/license/license.component.spec.ts index 7d8cbc5b6..eb9ee62d9 100644 --- a/src/app/shared/components/license/license.component.spec.ts +++ b/src/app/shared/components/license/license.component.spec.ts @@ -2,10 +2,14 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { LicenseComponent, TextInputComponent } from '@shared/components'; -import { LicenseModel, LicenseOptions } from '@shared/models'; +import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; -import { MOCK_LICENSE } from '@testing/mocks'; +import { TextInputComponent } from '../text-input/text-input.component'; +import { TruncatedTextComponent } from '../truncated-text/truncated-text.component'; + +import { LicenseComponent } from './license.component'; + +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('LicenseComponent', () => { @@ -30,7 +34,7 @@ describe('LicenseComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [LicenseComponent, ...MockComponents(TextInputComponent), OSFTestingModule], + imports: [LicenseComponent, ...MockComponents(TextInputComponent, TruncatedTextComponent), OSFTestingModule], }).compileComponents(); fixture = TestBed.createComponent(LicenseComponent); diff --git a/src/app/shared/components/license/license.component.ts b/src/app/shared/components/license/license.component.ts index f99a0a552..e81226cfb 100644 --- a/src/app/shared/components/license/license.component.ts +++ b/src/app/shared/components/license/license.component.ts @@ -9,10 +9,12 @@ import { ChangeDetectionStrategy, Component, effect, input, model, output, signa import { toSignal } from '@angular/core/rxjs-interop'; import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CustomValidators, StringOrNullOrUndefined } from '@osf/shared/helpers'; -import { InputLimits } from '@shared/constants'; -import { LicenseForm, LicenseModel, LicenseOptions } from '@shared/models'; -import { InterpolatePipe } from '@shared/pipes'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { StringOrNullOrUndefined } from '@osf/shared/helpers/types.helper'; +import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; +import { LicenseForm } from '@shared/models/license/license-form.models'; +import { InterpolatePipe } from '@shared/pipes/interpolate.pipe'; import { TextInputComponent } from '../text-input/text-input.component'; import { TruncatedTextComponent } from '../truncated-text/truncated-text.component'; diff --git a/src/app/shared/components/line-chart/line-chart.component.spec.ts b/src/app/shared/components/line-chart/line-chart.component.spec.ts index 07c80e730..77ea0e99f 100644 --- a/src/app/shared/components/line-chart/line-chart.component.spec.ts +++ b/src/app/shared/components/line-chart/line-chart.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; + import { LineChartComponent } from './line-chart.component'; describe('LineChartComponent', () => { @@ -8,7 +12,7 @@ describe('LineChartComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [LineChartComponent], + imports: [LineChartComponent, MockComponent(LoadingSpinnerComponent)], }).compileComponents(); fixture = TestBed.createComponent(LineChartComponent); diff --git a/src/app/shared/components/line-chart/line-chart.component.ts b/src/app/shared/components/line-chart/line-chart.component.ts index fe6ce3438..fac02dab3 100644 --- a/src/app/shared/components/line-chart/line-chart.component.ts +++ b/src/app/shared/components/line-chart/line-chart.component.ts @@ -14,7 +14,7 @@ import { signal, } from '@angular/core'; -import { DatasetInput } from '@osf/shared/models'; +import { DatasetInput } from '@osf/shared/models/charts/dataset-input'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; diff --git a/src/app/shared/components/list-info-shortener/list-info-shortener.component.ts b/src/app/shared/components/list-info-shortener/list-info-shortener.component.ts index 002b0e8a4..6de6cd5e9 100644 --- a/src/app/shared/components/list-info-shortener/list-info-shortener.component.ts +++ b/src/app/shared/components/list-info-shortener/list-info-shortener.component.ts @@ -4,7 +4,7 @@ import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { IdName } from '@shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; @Component({ selector: 'osf-list-info-shortener', @@ -14,6 +14,6 @@ import { IdName } from '@shared/models'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class ListInfoShortenerComponent { - data = input([]); + data = input([]); limit = input(2); } diff --git a/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.spec.ts b/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.spec.ts index 973428d1f..9fdd56e65 100644 --- a/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.spec.ts +++ b/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.spec.ts @@ -7,7 +7,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ModerationType, SubmissionReviewStatus } from '@osf/features/moderation/enums'; import { CollectionsModerationSelectors } from '@osf/features/moderation/store/collections-moderation'; -import { ModerationDecisionFormControls, ModerationSubmitType } from '@osf/shared/enums'; +import { ModerationDecisionFormControls } from '@osf/shared/enums/moderation-decision-form-controls.enum'; +import { ModerationSubmitType } from '@osf/shared/enums/moderation-submit-type.enum'; import { CollectionsSelectors } from '@osf/shared/stores/collections'; import { MakeDecisionDialogComponent } from './make-decision-dialog.component'; diff --git a/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.ts b/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.ts index e67247b1e..f8f0c76f2 100644 --- a/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.ts +++ b/src/app/shared/components/make-decision-dialog/make-decision-dialog.component.ts @@ -15,9 +15,10 @@ import { CollectionsModerationSelectors, CreateCollectionSubmissionAction, } from '@osf/features/moderation/store/collections-moderation'; -import { InputLimits } from '@osf/shared/constants'; -import { ModerationDecisionFormControls, ModerationSubmitType } from '@osf/shared/enums'; -import { DateAgoPipe } from '@osf/shared/pipes'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { ModerationDecisionFormControls } from '@osf/shared/enums/moderation-decision-form-controls.enum'; +import { ModerationSubmitType } from '@osf/shared/enums/moderation-submit-type.enum'; +import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { CollectionsSelectors } from '@osf/shared/stores/collections'; @Component({ @@ -31,9 +32,11 @@ export class MakeDecisionDialogComponent implements OnInit { private readonly fb = inject(FormBuilder); readonly config = inject(DynamicDialogConfig); readonly dialogRef = inject(DynamicDialogRef); + readonly ModerationSubmitType = ModerationSubmitType; readonly SubmissionReviewStatus = SubmissionReviewStatus; readonly ModerationDecisionFormControls = ModerationDecisionFormControls; + collectionProvider = select(CollectionsSelectors.getCollectionProvider); currentReviewAction = select(CollectionsModerationSelectors.getCurrentReviewAction); diff --git a/src/app/shared/components/metadata-tabs/metadata-tabs.component.spec.ts b/src/app/shared/components/metadata-tabs/metadata-tabs.component.spec.ts index 09ca0bbe4..38a68f4ad 100644 --- a/src/app/shared/components/metadata-tabs/metadata-tabs.component.spec.ts +++ b/src/app/shared/components/metadata-tabs/metadata-tabs.component.spec.ts @@ -1,13 +1,18 @@ +import { MockComponents } from 'ng-mocks'; + import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { CedarTemplateFormComponent } from '@osf/features/metadata/components'; import { CedarMetadataDataTemplateJsonApi, CedarRecordDataBinding } from '@osf/features/metadata/models'; -import { MetadataResourceEnum } from '@osf/shared/enums'; -import { MetadataTabsModel } from '@osf/shared/models'; +import { MetadataResourceEnum } from '@osf/shared/enums/metadata-resource.enum'; +import { MetadataTabsModel } from '@shared/models/metadata-tabs.model'; + +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { MetadataTabsComponent } from './metadata-tabs.component'; -import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks'; +import { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from '@testing/mocks/cedar-metadata-data-template-json-api.mock'; import { MOCK_CEDAR_METADATA_RECORD_DATA } from '@testing/mocks/cedar-metadata-record.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; @@ -27,7 +32,11 @@ describe('MetadataTabsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [MetadataTabsComponent, OSFTestingModule], + imports: [ + MetadataTabsComponent, + OSFTestingModule, + ...MockComponents(LoadingSpinnerComponent, CedarTemplateFormComponent), + ], schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); diff --git a/src/app/shared/components/metadata-tabs/metadata-tabs.component.ts b/src/app/shared/components/metadata-tabs/metadata-tabs.component.ts index d9ac7eb2f..31aa15c6c 100644 --- a/src/app/shared/components/metadata-tabs/metadata-tabs.component.ts +++ b/src/app/shared/components/metadata-tabs/metadata-tabs.component.ts @@ -10,7 +10,7 @@ import { CedarMetadataRecordData, CedarRecordDataBinding, } from '@osf/features/metadata/models'; -import { MetadataTabsModel } from '@osf/shared/models'; +import { MetadataTabsModel } from '@osf/shared/models/metadata-tabs.model'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; diff --git a/src/app/shared/components/my-projects-table/my-projects-table.component.spec.ts b/src/app/shared/components/my-projects-table/my-projects-table.component.spec.ts index 0843ffe6a..b750bf06d 100644 --- a/src/app/shared/components/my-projects-table/my-projects-table.component.spec.ts +++ b/src/app/shared/components/my-projects-table/my-projects-table.component.spec.ts @@ -10,7 +10,8 @@ import { IconComponent } from '../icon/icon.component'; import { MyProjectsTableComponent } from './my-projects-table.component'; -import { MOCK_CONTRIBUTOR, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_CONTRIBUTOR } from '@testing/mocks/contributors.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('MyProjectsTableComponent', () => { let component: MyProjectsTableComponent; diff --git a/src/app/shared/components/my-projects-table/my-projects-table.component.ts b/src/app/shared/components/my-projects-table/my-projects-table.component.ts index 9ae8553aa..8d868ea60 100644 --- a/src/app/shared/components/my-projects-table/my-projects-table.component.ts +++ b/src/app/shared/components/my-projects-table/my-projects-table.component.ts @@ -7,9 +7,10 @@ import { TableModule, TablePageEvent } from 'primeng/table'; import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { SortOrder } from '@osf/shared/enums'; -import { MyResourcesItem, TableParameters } from '@osf/shared/models'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { SortOrder } from '@osf/shared/enums/sort-order.enum'; +import { MyResourcesItem } from '@osf/shared/models/my-resources/my-resources.models'; +import { TableParameters } from '@osf/shared/models/table-parameters.model'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; import { IconComponent } from '../icon/icon.component'; diff --git a/src/app/shared/components/password-input-hint/password-input-hint.component.ts b/src/app/shared/components/password-input-hint/password-input-hint.component.ts index dab3cfe2f..57e1c513f 100644 --- a/src/app/shared/components/password-input-hint/password-input-hint.component.ts +++ b/src/app/shared/components/password-input-hint/password-input-hint.component.ts @@ -1,12 +1,11 @@ import { TranslatePipe } from '@ngx-translate/core'; -import { CommonModule } from '@angular/common'; import { Component, input } from '@angular/core'; import { AbstractControl } from '@angular/forms'; @Component({ selector: 'osf-password-input-hint', - imports: [TranslatePipe, CommonModule], + imports: [TranslatePipe], templateUrl: './password-input-hint.component.html', styleUrl: './password-input-hint.component.scss', }) diff --git a/src/app/shared/components/pie-chart/pie-chart.component.spec.ts b/src/app/shared/components/pie-chart/pie-chart.component.spec.ts index ee3b2dc12..0e52768ea 100644 --- a/src/app/shared/components/pie-chart/pie-chart.component.spec.ts +++ b/src/app/shared/components/pie-chart/pie-chart.component.spec.ts @@ -1,5 +1,9 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; + import { PieChartComponent } from './pie-chart.component'; describe('PieChartComponent', () => { @@ -8,7 +12,7 @@ describe('PieChartComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [PieChartComponent], + imports: [PieChartComponent, MockComponent(LoadingSpinnerComponent)], }).compileComponents(); fixture = TestBed.createComponent(PieChartComponent); diff --git a/src/app/shared/components/pie-chart/pie-chart.component.ts b/src/app/shared/components/pie-chart/pie-chart.component.ts index 88144f29c..2c36e139f 100644 --- a/src/app/shared/components/pie-chart/pie-chart.component.ts +++ b/src/app/shared/components/pie-chart/pie-chart.component.ts @@ -14,8 +14,8 @@ import { signal, } from '@angular/core'; -import { PIE_CHART_PALETTE } from '@osf/shared/constants'; -import { DatasetInput } from '@osf/shared/models'; +import { PIE_CHART_PALETTE } from '@osf/shared/constants/pie-chart-palette'; +import { DatasetInput } from '@shared/models/charts/dataset-input'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; diff --git a/src/app/shared/components/project-selector/project-selector.component.spec.ts b/src/app/shared/components/project-selector/project-selector.component.spec.ts index 9b33e2e3e..4c3cfe41a 100644 --- a/src/app/shared/components/project-selector/project-selector.component.spec.ts +++ b/src/app/shared/components/project-selector/project-selector.component.spec.ts @@ -5,7 +5,7 @@ import { MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UserState } from '@core/store/user'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ProjectsState } from '@shared/stores/projects'; import { ProjectSelectorComponent } from './project-selector.component'; diff --git a/src/app/shared/components/project-selector/project-selector.component.ts b/src/app/shared/components/project-selector/project-selector.component.ts index 7ece1bfdf..d150dc205 100644 --- a/src/app/shared/components/project-selector/project-selector.component.ts +++ b/src/app/shared/components/project-selector/project-selector.component.ts @@ -22,8 +22,8 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { UserSelectors } from '@core/store/user'; -import { CustomOption } from '@shared/models'; -import { ProjectModel } from '@shared/models/projects'; +import { ProjectModel } from '@shared/models/projects/projects.models'; +import { CustomOption } from '@shared/models/select-option.model'; import { GetProjects, ProjectsSelectors } from '@shared/stores/projects'; @Component({ diff --git a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.spec.ts b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.spec.ts index 282461d08..798ac1001 100644 --- a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.spec.ts +++ b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.spec.ts @@ -1,11 +1,12 @@ -import { TranslateModule } from '@ngx-translate/core'; +import { TranslatePipe } from '@ngx-translate/core'; +import { MockPipe } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { RegistrationBlocksDataComponent } from './registration-blocks-data.component'; -import { MOCK_REVIEW } from '@testing/mocks'; +import { MOCK_REVIEW } from '@testing/mocks/review.mock'; describe('RegistrationBlocksDataComponent', () => { let component: RegistrationBlocksDataComponent; @@ -15,7 +16,7 @@ describe('RegistrationBlocksDataComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RegistrationBlocksDataComponent, TranslateModule.forRoot()], + imports: [RegistrationBlocksDataComponent, MockPipe(TranslatePipe)], }).compileComponents(); fixture = TestBed.createComponent(RegistrationBlocksDataComponent); diff --git a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts index 096ad56bf..d1c49eb2f 100644 --- a/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts +++ b/src/app/shared/components/registration-blocks-data/registration-blocks-data.component.ts @@ -5,10 +5,10 @@ import { Tag } from 'primeng/tag'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { FieldType } from '@osf/shared/enums'; -import { Question } from '@osf/shared/models'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; +import { Question } from '@osf/shared/models/registration/page-schema.model'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; @Component({ selector: 'osf-registration-blocks-data', diff --git a/src/app/shared/components/registration-card/registration-card.component.spec.ts b/src/app/shared/components/registration-card/registration-card.component.spec.ts index 380f1a70a..adc8720ef 100644 --- a/src/app/shared/components/registration-card/registration-card.component.spec.ts +++ b/src/app/shared/components/registration-card/registration-card.component.spec.ts @@ -1,16 +1,22 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; -import { NO_ERRORS_SCHEMA, signal } from '@angular/core'; +import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { RegistriesSelectors } from '@osf/features/registries/store'; -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; -import { RegistrationCard } from '@osf/shared/models'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { RegistrationCard } from '@shared/models/registration/registration-card.model'; + +import { ContributorsListComponent } from '../contributors-list/contributors-list.component'; +import { DataResourcesComponent } from '../data-resources/data-resources.component'; +import { IconComponent } from '../icon/icon.component'; +import { StatusBadgeComponent } from '../status-badge/status-badge.component'; import { RegistrationCardComponent } from './registration-card.component'; -import { MOCK_REGISTRATION } from '@testing/mocks'; +import { MOCK_REGISTRATION } from '@testing/mocks/registration.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; @@ -22,8 +28,11 @@ describe('RegistrationCardComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [RegistrationCardComponent, OSFTestingModule], - schemas: [NO_ERRORS_SCHEMA], + imports: [ + RegistrationCardComponent, + OSFTestingModule, + ...MockComponents(StatusBadgeComponent, DataResourcesComponent, IconComponent, ContributorsListComponent), + ], providers: [ provideMockStore({ signals: [{ selector: RegistriesSelectors.getSchemaResponse, value: signal(null) }], diff --git a/src/app/shared/components/registration-card/registration-card.component.ts b/src/app/shared/components/registration-card/registration-card.component.ts index 346c7ab6b..e9ba0f72a 100644 --- a/src/app/shared/components/registration-card/registration-card.component.ts +++ b/src/app/shared/components/registration-card/registration-card.component.ts @@ -12,9 +12,11 @@ import { ChangeDetectionStrategy, Component, inject, input, output } from '@angu import { Router, RouterLink } from '@angular/router'; import { CreateSchemaResponse, FetchAllSchemaResponses, RegistriesSelectors } from '@osf/features/registries/store'; -import { RegistrationReviewStates, RevisionReviewStates, UserPermissions } from '@osf/shared/enums'; -import { RegistrationCard } from '@osf/shared/models'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { RegistrationCard } from '@osf/shared/models/registration/registration-card.model'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; import { ContributorsListComponent } from '../contributors-list/contributors-list.component'; import { DataResourcesComponent } from '../data-resources/data-resources.component'; @@ -44,6 +46,7 @@ import { TruncatedTextComponent } from '../truncated-text/truncated-text.compone export class RegistrationCardComponent { RevisionReviewStates = RevisionReviewStates; RegistrationReviewStates = RegistrationReviewStates; + readonly isDraft = input(false); readonly registrationData = input.required(); readonly deleteDraft = output(); diff --git a/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.spec.ts b/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.spec.ts index d55082887..fd9c5984e 100644 --- a/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.spec.ts +++ b/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceModel } from '@shared/models/search/resource.model'; import { FileSecondaryMetadataComponent } from './file-secondary-metadata.component'; -import { MOCK_RESOURCE } from '@testing/mocks'; +import { MOCK_RESOURCE } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('FileSecondaryMetadataComponent', () => { diff --git a/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.ts b/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.ts index f015564bf..96cdc6269 100644 --- a/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.ts +++ b/src/app/shared/components/resource-card/components/file-secondary-metadata/file-secondary-metadata.component.ts @@ -2,7 +2,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { ResourceModel } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; @Component({ selector: 'osf-file-secondary-metadata', diff --git a/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.spec.ts b/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.spec.ts index e138b6b4f..c2f9776c4 100644 --- a/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.spec.ts +++ b/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceModel } from '@shared/models/search/resource.model'; import { PreprintSecondaryMetadataComponent } from './preprint-secondary-metadata.component'; -import { MOCK_RESOURCE } from '@testing/mocks'; +import { MOCK_RESOURCE } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('PreprintSecondaryMetadataComponent', () => { diff --git a/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.ts b/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.ts index aaac6b0f7..5c9658941 100644 --- a/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.ts +++ b/src/app/shared/components/resource-card/components/preprint-secondary-metadata/preprint-secondary-metadata.component.ts @@ -2,7 +2,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { ResourceModel } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; @Component({ selector: 'osf-preprint-secondary-metadata', diff --git a/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.spec.ts b/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.spec.ts index 3a045bec2..beb0316e1 100644 --- a/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.spec.ts +++ b/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceModel } from '@shared/models/search/resource.model'; import { ProjectSecondaryMetadataComponent } from './project-secondary-metadata.component'; -import { MOCK_RESOURCE } from '@testing/mocks'; +import { MOCK_RESOURCE } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('ProjectSecondaryMetadataComponent', () => { diff --git a/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.ts b/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.ts index 49eebe9f3..7d3c7a568 100644 --- a/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.ts +++ b/src/app/shared/components/resource-card/components/project-secondary-metadata/project-secondary-metadata.component.ts @@ -2,8 +2,8 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; -import { languageCodes } from '@shared/constants'; -import { ResourceModel } from '@shared/models'; +import { languageCodes } from '@osf/shared/constants/language.const'; +import { ResourceModel } from '@shared/models/search/resource.model'; @Component({ selector: 'osf-project-secondary-metadata', diff --git a/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.spec.ts b/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.spec.ts index 5e7c7405d..ea861554c 100644 --- a/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.spec.ts +++ b/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceModel } from '@shared/models/search/resource.model'; import { RegistrationSecondaryMetadataComponent } from './registration-secondary-metadata.component'; -import { MOCK_RESOURCE } from '@testing/mocks'; +import { MOCK_RESOURCE } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('RegistrationSecondaryMetadataComponent', () => { diff --git a/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.ts b/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.ts index b5a610a09..aee4f388d 100644 --- a/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.ts +++ b/src/app/shared/components/resource-card/components/registration-secondary-metadata/registration-secondary-metadata.component.ts @@ -2,7 +2,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { ResourceModel } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; @Component({ selector: 'osf-registration-secondary-metadata', diff --git a/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.spec.ts b/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.spec.ts index 66fa6ab68..ef77b5c06 100644 --- a/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.spec.ts +++ b/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.spec.ts @@ -1,11 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceModel } from '@shared/models/search/resource.model'; import { UserSecondaryMetadataComponent } from './user-secondary-metadata.component'; -import { MOCK_AGENT_RESOURCE } from '@testing/mocks'; +import { MOCK_AGENT_RESOURCE } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('UserSecondaryMetadataComponent', () => { diff --git a/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.ts b/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.ts index 93f131d1d..40eca1a87 100644 --- a/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.ts +++ b/src/app/shared/components/resource-card/components/user-secondary-metadata/user-secondary-metadata.component.ts @@ -4,7 +4,8 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { ResourceModel, UserRelatedCounts } from '@shared/models'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { UserRelatedCounts } from '@osf/shared/models/user-related-counts/user-related-counts.model'; @Component({ selector: 'osf-user-secondary-metadata', diff --git a/src/app/shared/components/resource-card/resource-card.component.spec.ts b/src/app/shared/components/resource-card/resource-card.component.spec.ts index bb9364623..ebec3c9f3 100644 --- a/src/app/shared/components/resource-card/resource-card.component.spec.ts +++ b/src/app/shared/components/resource-card/resource-card.component.spec.ts @@ -1,16 +1,25 @@ -import { MockProvider } from 'ng-mocks'; +import { MockComponents, MockProvider } from 'ng-mocks'; import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { IS_XSMALL } from '@osf/shared/helpers'; -import { ResourceCardComponent } from '@shared/components'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel } from '@shared/models'; -import { ResourceCardService } from '@shared/services'; +import { IS_XSMALL } from '@osf/shared/helpers/breakpoints.tokens'; +import { ResourceCardService } from '@osf/shared/services/resource-card.service'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceModel } from '@shared/models/search/resource.model'; -import { MOCK_AGENT_RESOURCE, MOCK_RESOURCE, MOCK_USER_RELATED_COUNTS } from '@testing/mocks'; +import { DataResourcesComponent } from '../data-resources/data-resources.component'; + +import { FileSecondaryMetadataComponent } from './components/file-secondary-metadata/file-secondary-metadata.component'; +import { PreprintSecondaryMetadataComponent } from './components/preprint-secondary-metadata/preprint-secondary-metadata.component'; +import { ProjectSecondaryMetadataComponent } from './components/project-secondary-metadata/project-secondary-metadata.component'; +import { RegistrationSecondaryMetadataComponent } from './components/registration-secondary-metadata/registration-secondary-metadata.component'; +import { UserSecondaryMetadataComponent } from './components/user-secondary-metadata/user-secondary-metadata.component'; +import { ResourceCardComponent } from './resource-card.component'; + +import { MOCK_USER_RELATED_COUNTS } from '@testing/mocks/data.mock'; +import { MOCK_AGENT_RESOURCE, MOCK_RESOURCE } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; describe('ResourceCardComponent', () => { @@ -24,7 +33,18 @@ describe('ResourceCardComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ResourceCardComponent, OSFTestingModule], + imports: [ + ResourceCardComponent, + OSFTestingModule, + ...MockComponents( + DataResourcesComponent, + UserSecondaryMetadataComponent, + RegistrationSecondaryMetadataComponent, + ProjectSecondaryMetadataComponent, + PreprintSecondaryMetadataComponent, + FileSecondaryMetadataComponent + ), + ], providers: [ MockProvider(ResourceCardService, { getUserRelatedCounts: jest.fn().mockReturnValue(of(mockUserCounts)), diff --git a/src/app/shared/components/resource-card/resource-card.component.ts b/src/app/shared/components/resource-card/resource-card.component.ts index 1c5b1dd44..d4b6429a5 100644 --- a/src/app/shared/components/resource-card/resource-card.component.ts +++ b/src/app/shared/components/resource-card/resource-card.component.ts @@ -11,13 +11,15 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { getPreprintDocumentType } from '@osf/features/preprints/helpers'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { CardLabelTranslationKeys } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { getSortedContributorsByPermissions, IS_XSMALL } from '@osf/shared/helpers'; -import { ResourceModel, UserRelatedCounts } from '@osf/shared/models'; -import { ResourceCardService } from '@osf/shared/services'; -import { StopPropagationDirective } from '@shared/directives'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { CardLabelTranslationKeys } from '@osf/shared/constants/resource-card-labels.const'; +import { StopPropagationDirective } from '@osf/shared/directives/stop-propagation.directive'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { IS_XSMALL } from '@osf/shared/helpers/breakpoints.tokens'; +import { getSortedContributorsByPermissions } from '@osf/shared/helpers/sort-contributors-by-permissions'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { UserRelatedCounts } from '@osf/shared/models/user-related-counts/user-related-counts.model'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; +import { ResourceCardService } from '@osf/shared/services/resource-card.service'; import { DataResourcesComponent } from '../data-resources/data-resources.component'; diff --git a/src/app/shared/components/resource-citations/resource-citations.component.spec.ts b/src/app/shared/components/resource-citations/resource-citations.component.spec.ts index 1a412fda0..afb3d80e0 100644 --- a/src/app/shared/components/resource-citations/resource-citations.component.spec.ts +++ b/src/app/shared/components/resource-citations/resource-citations.component.spec.ts @@ -4,13 +4,13 @@ import { Clipboard } from '@angular/cdk/clipboard'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceOverview } from '@shared/models'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { ResourceOverview } from '@shared/models/resource-overview.model'; import { CitationsSelectors } from '@shared/stores/citations'; import { ResourceCitationsComponent } from './resource-citations.component'; -import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks'; +import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { provideMockStore } from '@testing/providers/store-provider.mock'; import { ToastServiceMockBuilder } from '@testing/providers/toast-provider.mock'; diff --git a/src/app/shared/components/resource-citations/resource-citations.component.ts b/src/app/shared/components/resource-citations/resource-citations.component.ts index e3f73d608..ddadf3715 100644 --- a/src/app/shared/components/resource-citations/resource-citations.component.ts +++ b/src/app/shared/components/resource-citations/resource-citations.component.ts @@ -26,9 +26,11 @@ import { import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { Router } from '@angular/router'; -import { hasViewOnlyParam } from '@shared/helpers'; -import { CitationStyle, CustomOption, ResourceOverview } from '@shared/models'; -import { ToastService } from '@shared/services'; +import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { CitationStyle } from '@shared/models/citations/citation-style.model'; +import { ResourceOverview } from '@shared/models/resource-overview.model'; +import { CustomOption } from '@shared/models/select-option.model'; import { CitationsSelectors, ClearStyledCitation, diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts b/src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts index 41a000381..bf93d77f3 100644 --- a/src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts +++ b/src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts @@ -1,10 +1,18 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceOverview } from '@shared/models'; +import { OverviewCollectionsComponent } from '@osf/features/project/overview/components/overview-collections/overview-collections.component'; +import { ResourceOverview } from '@shared/models/resource-overview.model'; + +import { AffiliatedInstitutionsViewComponent } from '../affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '../contributors-list/contributors-list.component'; +import { ResourceCitationsComponent } from '../resource-citations/resource-citations.component'; +import { TruncatedTextComponent } from '../truncated-text/truncated-text.component'; import { ResourceMetadataComponent } from './resource-metadata.component'; -import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks'; +import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks/resource.mock'; describe('ResourceMetadataComponent', () => { let component: ResourceMetadataComponent; @@ -14,7 +22,16 @@ describe('ResourceMetadataComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ResourceMetadataComponent], + imports: [ + ResourceMetadataComponent, + MockComponents( + TruncatedTextComponent, + ResourceCitationsComponent, + OverviewCollectionsComponent, + AffiliatedInstitutionsViewComponent, + ContributorsListComponent + ), + ], }).compileComponents(); fixture = TestBed.createComponent(ResourceMetadataComponent); diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.ts b/src/app/shared/components/resource-metadata/resource-metadata.component.ts index b83423090..049dd7f91 100644 --- a/src/app/shared/components/resource-metadata/resource-metadata.component.ts +++ b/src/app/shared/components/resource-metadata/resource-metadata.component.ts @@ -9,8 +9,9 @@ import { Router, RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { OverviewCollectionsComponent } from '@osf/features/project/overview/components/overview-collections/overview-collections.component'; -import { CurrentResourceType } from '@osf/shared/enums'; -import { ContributorModel, ResourceOverview } from '@shared/models'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ResourceOverview } from '@shared/models/resource-overview.model'; import { AffiliatedInstitutionsViewComponent } from '../affiliated-institutions-view/affiliated-institutions-view.component'; import { ContributorsListComponent } from '../contributors-list/contributors-list.component'; diff --git a/src/app/shared/components/search-filters/search-filters.component.spec.ts b/src/app/shared/components/search-filters/search-filters.component.spec.ts index 90885f1eb..1177919c0 100644 --- a/src/app/shared/components/search-filters/search-filters.component.spec.ts +++ b/src/app/shared/components/search-filters/search-filters.component.spec.ts @@ -1,7 +1,16 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { + DiscoverableFilter, + FilterOperatorOption, + FilterOption, +} from '@osf/shared/models/search/discaverable-filter.model'; import { FILTER_PLACEHOLDERS } from '@shared/constants/filter-placeholders'; -import { DiscoverableFilter, FilterOperator, FilterOption } from '@shared/models'; + +import { GenericFilterComponent } from '../generic-filter/generic-filter.component'; +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { SearchFiltersComponent } from './search-filters.component'; @@ -15,7 +24,7 @@ describe('SearchFiltersComponent', () => { { key: 'subject', label: 'Subject', - operator: FilterOperator.IsPresent, + operator: FilterOperatorOption.IsPresent, resultCount: 150, options: [ { label: 'Psychology', value: 'psychology', cardSearchResultCount: 10 }, @@ -25,7 +34,7 @@ describe('SearchFiltersComponent', () => { { key: 'resourceType', label: 'Resource Type', - operator: FilterOperator.IsPresent, + operator: FilterOperatorOption.IsPresent, resultCount: 100, options: [ { label: 'Project', value: 'project', cardSearchResultCount: 50 }, @@ -35,7 +44,7 @@ describe('SearchFiltersComponent', () => { { key: 'hasData', label: 'Has Data', - operator: FilterOperator.IsPresent, + operator: FilterOperatorOption.IsPresent, resultCount: 75, }, ]; @@ -46,7 +55,11 @@ describe('SearchFiltersComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [SearchFiltersComponent, OSFTestingModule], + imports: [ + SearchFiltersComponent, + OSFTestingModule, + ...MockComponents(GenericFilterComponent, LoadingSpinnerComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(SearchFiltersComponent); @@ -90,11 +103,11 @@ describe('SearchFiltersComponent', () => { it('should filter out invalid filters in visibleFilters', () => { const filtersWithInvalid = [ ...mockFilters, - { key: '', label: 'Invalid', operator: FilterOperator.IsPresent } as DiscoverableFilter, + { key: '', label: 'Invalid', operator: FilterOperatorOption.IsPresent } as DiscoverableFilter, { key: 'noCount', label: 'No Count', - operator: FilterOperator.IsPresent, + operator: FilterOperatorOption.IsPresent, resultCount: 0, options: [], } as DiscoverableFilter, @@ -116,7 +129,7 @@ describe('SearchFiltersComponent', () => { expect(splitFilters.individual.length).toBe(0); expect(splitFilters.grouped.length).toBe(3); - expect(splitFilters.grouped[0].operator).toBe(FilterOperator.IsPresent); + expect(splitFilters.grouped[0].operator).toBe(FilterOperatorOption.IsPresent); }); it('should compute selectedOptionValues from selectedOptions', () => { diff --git a/src/app/shared/components/search-filters/search-filters.component.ts b/src/app/shared/components/search-filters/search-filters.component.ts index 5c5fb3239..f8999fcf1 100644 --- a/src/app/shared/components/search-filters/search-filters.component.ts +++ b/src/app/shared/components/search-filters/search-filters.component.ts @@ -11,8 +11,12 @@ import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject, input import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { FILTER_PLACEHOLDERS } from '@osf/shared/constants'; -import { DiscoverableFilter, FilterOperator, FilterOption } from '@osf/shared/models'; +import { FILTER_PLACEHOLDERS } from '@osf/shared/constants/filter-placeholders'; +import { + DiscoverableFilter, + FilterOperatorOption, + FilterOption, +} from '@shared/models/search/discaverable-filter.model'; import { GenericFilterComponent } from '../generic-filter/generic-filter.component'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; @@ -81,7 +85,7 @@ export class SearchFiltersComponent { const groupedFilters: DiscoverableFilter[] = []; filters.forEach((filter) => { - if (filter.operator === FilterOperator.IsPresent) { + if (filter.operator === FilterOperatorOption.IsPresent) { groupedFilters.push(filter); } else { individualFilters.push(filter); diff --git a/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.html b/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.html index 70c7ad960..4faf30679 100644 --- a/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.html +++ b/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.html @@ -10,10 +10,10 @@

{{ step.title | translate }}

@if ($index + 1 !== steps().length) { - - + + } @else { - + }
diff --git a/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.spec.ts b/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.spec.ts index ba5745abd..01c26344d 100644 --- a/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.spec.ts +++ b/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { SEARCH_TUTORIAL_STEPS } from '@shared/constants'; -import { TutorialStep } from '@shared/models'; +import { SEARCH_TUTORIAL_STEPS } from '@osf/shared/constants/search-tutorial-steps.const'; +import { TutorialStep } from '@shared/models/tutorial-step.model'; import { SearchHelpTutorialComponent } from './search-help-tutorial.component'; diff --git a/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.ts b/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.ts index ac46c14a4..bc4d90aa4 100644 --- a/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.ts +++ b/src/app/shared/components/search-help-tutorial/search-help-tutorial.component.ts @@ -2,17 +2,17 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Button } from 'primeng/button'; -import { CommonModule } from '@angular/common'; +import { NgStyle } from '@angular/common'; import { ChangeDetectionStrategy, Component, inject, model, signal } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; -import { SEARCH_TUTORIAL_STEPS } from '@osf/shared/constants'; -import { TutorialStep } from '@osf/shared/models'; -import { IS_MEDIUM } from '@shared/helpers'; +import { SEARCH_TUTORIAL_STEPS } from '@osf/shared/constants/search-tutorial-steps.const'; +import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; +import { TutorialStep } from '@shared/models/tutorial-step.model'; @Component({ selector: 'osf-search-help-tutorial', - imports: [Button, TranslatePipe, CommonModule], + imports: [Button, TranslatePipe, NgStyle], templateUrl: './search-help-tutorial.component.html', styleUrl: './search-help-tutorial.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/shared/components/search-input/search-input.component.spec.ts b/src/app/shared/components/search-input/search-input.component.spec.ts index d77f68456..cbe1ef082 100644 --- a/src/app/shared/components/search-input/search-input.component.spec.ts +++ b/src/app/shared/components/search-input/search-input.component.spec.ts @@ -1,6 +1,10 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl } from '@angular/forms'; +import { IconComponent } from '../icon/icon.component'; + import { SearchInputComponent } from './search-input.component'; describe('SearchInputComponent', () => { @@ -9,7 +13,7 @@ describe('SearchInputComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [SearchInputComponent], + imports: [SearchInputComponent, MockComponent(IconComponent)], }).compileComponents(); fixture = TestBed.createComponent(SearchInputComponent); diff --git a/src/app/shared/components/search-results-container/search-results-container.component.spec.ts b/src/app/shared/components/search-results-container/search-results-container.component.spec.ts index cd9935688..91206fd6e 100644 --- a/src/app/shared/components/search-results-container/search-results-container.component.spec.ts +++ b/src/app/shared/components/search-results-container/search-results-container.component.spec.ts @@ -1,7 +1,13 @@ +import { MockComponents } from 'ng-mocks'; + import { ComponentRef } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@shared/enums'; +import { ResourceType } from '@shared/enums/resource-type.enum'; + +import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; +import { ResourceCardComponent } from '../resource-card/resource-card.component'; +import { SelectComponent } from '../select/select.component'; import { SearchResultsContainerComponent } from './search-results-container.component'; @@ -14,7 +20,11 @@ describe('SearchResultsContainerComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [SearchResultsContainerComponent, OSFTestingModule], + imports: [ + SearchResultsContainerComponent, + OSFTestingModule, + ...MockComponents(ResourceCardComponent, SelectComponent, LoadingSpinnerComponent), + ], }).compileComponents(); fixture = TestBed.createComponent(SearchResultsContainerComponent); diff --git a/src/app/shared/components/search-results-container/search-results-container.component.ts b/src/app/shared/components/search-results-container/search-results-container.component.ts index 39d24c5cb..507311b46 100644 --- a/src/app/shared/components/search-results-container/search-results-container.component.ts +++ b/src/app/shared/components/search-results-container/search-results-container.component.ts @@ -18,9 +18,11 @@ import { import { FormsModule } from '@angular/forms'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { searchSortingOptions } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { DiscoverableFilter, FilterOption, ResourceModel, TabOption } from '@osf/shared/models'; +import { searchSortingOptions } from '@osf/shared/constants/search-sort-options.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { DiscoverableFilter, FilterOption } from '@shared/models/search/discaverable-filter.model'; +import { ResourceModel } from '@shared/models/search/resource.model'; +import { TabOption } from '@shared/models/tab-option.model'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { ResourceCardComponent } from '../resource-card/resource-card.component'; diff --git a/src/app/shared/components/select/select.component.spec.ts b/src/app/shared/components/select/select.component.spec.ts index 74845d3d0..273c86ec2 100644 --- a/src/app/shared/components/select/select.component.spec.ts +++ b/src/app/shared/components/select/select.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Primitive } from '@shared/helpers'; -import { SelectOption } from '@shared/models'; +import { SelectOption } from '@shared/models/select-option.model'; import { SelectComponent } from './select.component'; diff --git a/src/app/shared/components/select/select.component.ts b/src/app/shared/components/select/select.component.ts index 1f259df01..9478cdfa8 100644 --- a/src/app/shared/components/select/select.component.ts +++ b/src/app/shared/components/select/select.component.ts @@ -5,9 +5,9 @@ import { Select } from 'primeng/select'; import { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { Primitive } from '@osf/shared/helpers'; -import { SelectOption } from '@osf/shared/models'; -import { FixSpecialCharPipe } from '@shared/pipes'; +import { Primitive } from '@osf/shared/helpers/types.helper'; +import { SelectOption } from '@osf/shared/models/select-option.model'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; @Component({ selector: 'osf-select', diff --git a/src/app/shared/components/socials-share-button/socials-share-button.component.spec.ts b/src/app/shared/components/socials-share-button/socials-share-button.component.spec.ts index d13d418b0..036d5acea 100644 --- a/src/app/shared/components/socials-share-button/socials-share-button.component.spec.ts +++ b/src/app/shared/components/socials-share-button/socials-share-button.component.spec.ts @@ -3,8 +3,8 @@ import { MockComponent, MockPipe, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ResourceType } from '@osf/shared/enums'; -import { SocialShareService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SocialShareService } from '@osf/shared/services/social-share.service'; import { IconComponent } from '../icon/icon.component'; diff --git a/src/app/shared/components/socials-share-button/socials-share-button.component.ts b/src/app/shared/components/socials-share-button/socials-share-button.component.ts index 5906560d6..23ed332eb 100644 --- a/src/app/shared/components/socials-share-button/socials-share-button.component.ts +++ b/src/app/shared/components/socials-share-button/socials-share-button.component.ts @@ -6,9 +6,9 @@ import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core'; -import { ResourceType } from '@osf/shared/enums'; -import { SocialShareContentModel } from '@osf/shared/models'; -import { SocialShareService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SocialShareContentModel } from '@osf/shared/models/socials/social-share-content.model'; +import { SocialShareService } from '@osf/shared/services/social-share.service'; import { IconComponent } from '../icon/icon.component'; diff --git a/src/app/shared/components/statistic-card/statistic-card.component.ts b/src/app/shared/components/statistic-card/statistic-card.component.ts index d549716ba..dfadbb826 100644 --- a/src/app/shared/components/statistic-card/statistic-card.component.ts +++ b/src/app/shared/components/statistic-card/statistic-card.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { Primitive } from '@shared/helpers'; +import { Primitive } from '@osf/shared/helpers/types.helper'; @Component({ selector: 'osf-statistic-card', diff --git a/src/app/shared/components/status-badge/status-badge.component.spec.ts b/src/app/shared/components/status-badge/status-badge.component.spec.ts index 589b06267..732b6d463 100644 --- a/src/app/shared/components/status-badge/status-badge.component.spec.ts +++ b/src/app/shared/components/status-badge/status-badge.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { RegistryStatus } from '@osf/shared/enums'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; import { StatusBadgeComponent } from './status-badge.component'; diff --git a/src/app/shared/components/status-badge/status-badge.component.ts b/src/app/shared/components/status-badge/status-badge.component.ts index dfcc56bd8..39e13c512 100644 --- a/src/app/shared/components/status-badge/status-badge.component.ts +++ b/src/app/shared/components/status-badge/status-badge.component.ts @@ -4,9 +4,9 @@ import { Tag } from 'primeng/tag'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; -import { RegistryStatusMap } from '@osf/shared/constants'; -import { RegistryStatus } from '@osf/shared/enums'; -import { SeverityType } from '@osf/shared/models'; +import { RegistryStatusMap } from '@osf/shared/constants/registration-statuses'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { SeverityType } from '@shared/models/severity.type'; @Component({ selector: 'osf-status-badge', diff --git a/src/app/shared/components/stepper/stepper.component.spec.ts b/src/app/shared/components/stepper/stepper.component.spec.ts index e92a8f7b5..aa1550679 100644 --- a/src/app/shared/components/stepper/stepper.component.spec.ts +++ b/src/app/shared/components/stepper/stepper.component.spec.ts @@ -1,7 +1,12 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { StepperComponent } from '@shared/components'; -import { StepOption } from '@shared/models'; +import { StepOption } from '@shared/models/step-option.model'; + +import { IconComponent } from '../icon/icon.component'; + +import { StepperComponent } from './stepper.component'; describe('StepperComponent', () => { let component: StepperComponent; @@ -17,7 +22,7 @@ describe('StepperComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [StepperComponent], + imports: [StepperComponent, MockComponent(IconComponent)], }).compileComponents(); fixture = TestBed.createComponent(StepperComponent); diff --git a/src/app/shared/components/stepper/stepper.component.ts b/src/app/shared/components/stepper/stepper.component.ts index 9b9ea5f11..382fe0e74 100644 --- a/src/app/shared/components/stepper/stepper.component.ts +++ b/src/app/shared/components/stepper/stepper.component.ts @@ -2,7 +2,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input, model } from '@angular/core'; -import { StepOption } from '@shared/models'; +import { StepOption } from '@shared/models/step-option.model'; import { IconComponent } from '../icon/icon.component'; diff --git a/src/app/shared/components/sub-header/sub-header.component.spec.ts b/src/app/shared/components/sub-header/sub-header.component.spec.ts index a8fd72506..fadd15d00 100644 --- a/src/app/shared/components/sub-header/sub-header.component.spec.ts +++ b/src/app/shared/components/sub-header/sub-header.component.spec.ts @@ -1,5 +1,11 @@ +import { MockPipes } from 'ng-mocks'; + +import { SafeHtmlPipe } from 'primeng/menu'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; + import { SubHeaderComponent } from './sub-header.component'; describe('SubHeaderComponent', () => { @@ -8,7 +14,7 @@ describe('SubHeaderComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [SubHeaderComponent], + imports: [SubHeaderComponent, ...MockPipes(SafeHtmlPipe, FixSpecialCharPipe)], }).compileComponents(); fixture = TestBed.createComponent(SubHeaderComponent); diff --git a/src/app/shared/components/sub-header/sub-header.component.ts b/src/app/shared/components/sub-header/sub-header.component.ts index 62649318c..e0150cc8f 100644 --- a/src/app/shared/components/sub-header/sub-header.component.ts +++ b/src/app/shared/components/sub-header/sub-header.component.ts @@ -5,7 +5,7 @@ import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; -import { FixSpecialCharPipe } from '@osf/shared/pipes'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; @Component({ selector: 'osf-sub-header', diff --git a/src/app/shared/components/subjects/subjects.component.spec.ts b/src/app/shared/components/subjects/subjects.component.spec.ts index 54b62ea68..5bd39eb59 100644 --- a/src/app/shared/components/subjects/subjects.component.spec.ts +++ b/src/app/shared/components/subjects/subjects.component.spec.ts @@ -1,7 +1,11 @@ +import { MockComponent } from 'ng-mocks'; + import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; +import { SearchInputComponent } from '../search-input/search-input.component'; + import { SubjectsComponent } from './subjects.component'; import { OSFTestingStoreModule } from '@testing/osf.testing.module'; @@ -13,7 +17,7 @@ describe('SubjectsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [SubjectsComponent, OSFTestingStoreModule], + imports: [SubjectsComponent, OSFTestingStoreModule, MockComponent(SearchInputComponent)], providers: [ provideMockStore({ signals: [ diff --git a/src/app/shared/components/subjects/subjects.component.ts b/src/app/shared/components/subjects/subjects.component.ts index 63f86297b..966742a8b 100644 --- a/src/app/shared/components/subjects/subjects.component.ts +++ b/src/app/shared/components/subjects/subjects.component.ts @@ -14,7 +14,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs'; import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; import { FormControl, FormsModule } from '@angular/forms'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; import { SearchInputComponent } from '../search-input/search-input.component'; diff --git a/src/app/shared/components/text-input/text-input.component.spec.ts b/src/app/shared/components/text-input/text-input.component.spec.ts index 90a390777..a820f858b 100644 --- a/src/app/shared/components/text-input/text-input.component.spec.ts +++ b/src/app/shared/components/text-input/text-input.component.spec.ts @@ -1,8 +1,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormControl, Validators } from '@angular/forms'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { TextInputComponent } from '@shared/components'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; + +import { TextInputComponent } from './text-input.component'; import { OSFTestingModule } from '@testing/osf.testing.module'; diff --git a/src/app/shared/components/text-input/text-input.component.ts b/src/app/shared/components/text-input/text-input.component.ts index b1c708bb8..29156ae12 100644 --- a/src/app/shared/components/text-input/text-input.component.ts +++ b/src/app/shared/components/text-input/text-input.component.ts @@ -6,8 +6,8 @@ import { MessageModule } from 'primeng/message'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants'; -import { ValidationParams } from '@osf/shared/models'; +import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants/input-validation-messages.const'; +import { ValidationParams } from '@shared/models/validation-params.model'; @Component({ selector: 'osf-text-input', diff --git a/src/app/shared/components/toast/toast.component.spec.ts b/src/app/shared/components/toast/toast.component.spec.ts index f70be3841..0a64d913c 100644 --- a/src/app/shared/components/toast/toast.component.spec.ts +++ b/src/app/shared/components/toast/toast.component.spec.ts @@ -4,11 +4,11 @@ import { ToastModule } from 'primeng/toast'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ToastService } from '@shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; import { ToastComponent } from './toast.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('ToastComponent', () => { let component: ToastComponent; diff --git a/src/app/shared/components/truncated-text/truncated-text.component.spec.ts b/src/app/shared/components/truncated-text/truncated-text.component.spec.ts index d953c0e85..cf1b72f87 100644 --- a/src/app/shared/components/truncated-text/truncated-text.component.spec.ts +++ b/src/app/shared/components/truncated-text/truncated-text.component.spec.ts @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TruncatedTextComponent } from './truncated-text.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('TruncatedTextComponent', () => { let component: TruncatedTextComponent; diff --git a/src/app/shared/components/truncated-text/truncated-text.component.ts b/src/app/shared/components/truncated-text/truncated-text.component.ts index b6c7d3d10..63d2e4afe 100644 --- a/src/app/shared/components/truncated-text/truncated-text.component.ts +++ b/src/app/shared/components/truncated-text/truncated-text.component.ts @@ -4,15 +4,14 @@ import { Button } from 'primeng/button'; import { timer } from 'rxjs'; -import { CommonModule } from '@angular/common'; import { AfterViewInit, Component, effect, ElementRef, inject, input, signal, viewChild } from '@angular/core'; import { Router } from '@angular/router'; @Component({ selector: 'osf-truncated-text', + imports: [TranslatePipe, Button], templateUrl: './truncated-text.component.html', styleUrls: ['./truncated-text.component.scss'], - imports: [CommonModule, TranslatePipe, Button], }) export class TruncatedTextComponent implements AfterViewInit { readonly text = input(''); diff --git a/src/app/shared/components/view-only-table/view-only-table.component.spec.ts b/src/app/shared/components/view-only-table/view-only-table.component.spec.ts index 308b86eb0..47a22eb90 100644 --- a/src/app/shared/components/view-only-table/view-only-table.component.spec.ts +++ b/src/app/shared/components/view-only-table/view-only-table.component.spec.ts @@ -2,12 +2,14 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CopyButtonComponent } from '@shared/components'; -import { PaginatedViewOnlyLinksModel } from '@shared/models'; +import { PaginatedViewOnlyLinksModel } from '@shared/models/view-only-links/view-only-link.model'; + +import { CopyButtonComponent } from '../copy-button/copy-button.component'; import { ViewOnlyTableComponent } from './view-only-table.component'; -import { MOCK_PAGINATED_VIEW_ONLY_LINKS, MOCK_VIEW_ONLY_LINK, TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; +import { MOCK_PAGINATED_VIEW_ONLY_LINKS, MOCK_VIEW_ONLY_LINK } from '@testing/mocks/view-only-link.mock'; describe('ViewOnlyTableComponent', () => { let component: ViewOnlyTableComponent; diff --git a/src/app/shared/components/view-only-table/view-only-table.component.ts b/src/app/shared/components/view-only-table/view-only-table.component.ts index 974286825..c04b01b3c 100644 --- a/src/app/shared/components/view-only-table/view-only-table.component.ts +++ b/src/app/shared/components/view-only-table/view-only-table.component.ts @@ -9,7 +9,10 @@ import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; -import { PaginatedViewOnlyLinksModel, ViewOnlyLinkModel } from '@osf/shared/models'; +import { + PaginatedViewOnlyLinksModel, + ViewOnlyLinkModel, +} from '@osf/shared/models/view-only-links/view-only-link.model'; import { CopyButtonComponent } from '../copy-button/copy-button.component'; diff --git a/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.spec.ts b/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.spec.ts index 06ea0bf4d..be22defa6 100644 --- a/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.spec.ts +++ b/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.spec.ts @@ -1,18 +1,20 @@ import { Store } from '@ngxs/store'; -import { MockProvider } from 'ng-mocks'; +import { MockComponent, MockProvider } from 'ng-mocks'; import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ReactiveFormsModule } from '@angular/forms'; +import { ToastService } from '@osf/shared/services/toast.service'; import { WikiSelectors } from '@osf/shared/stores/wiki'; -import { ToastService } from '@shared/services'; + +import { TextInputComponent } from '../../text-input/text-input.component'; import { AddWikiDialogComponent } from './add-wiki-dialog.component'; -import { MOCK_STORE, TranslateServiceMock } from '@testing/mocks'; +import { MOCK_STORE } from '@testing/mocks/mock-store.mock'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('AddWikiDialogComponent', () => { let component: AddWikiDialogComponent; @@ -27,7 +29,7 @@ describe('AddWikiDialogComponent', () => { }); await TestBed.configureTestingModule({ - imports: [AddWikiDialogComponent, ReactiveFormsModule], + imports: [AddWikiDialogComponent, MockComponent(TextInputComponent)], providers: [ TranslateServiceMock, MockProvider(DynamicDialogRef), diff --git a/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.ts b/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.ts index 4e80244de..1a42cf2f8 100644 --- a/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.ts +++ b/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.ts @@ -8,10 +8,10 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms'; -import { InputLimits } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { CustomValidators } from '@osf/shared/helpers'; -import { ToastService } from '@osf/shared/services'; +import { InputLimits } from '@osf/shared/constants/input-limits.const'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; +import { ToastService } from '@osf/shared/services/toast.service'; import { CreateWiki, WikiSelectors } from '@osf/shared/stores/wiki'; import { TextInputComponent } from '../../text-input/text-input.component'; diff --git a/src/app/shared/components/wiki/compare-section/compare-section.component.spec.ts b/src/app/shared/components/wiki/compare-section/compare-section.component.spec.ts index ea89c3925..45b8e8aec 100644 --- a/src/app/shared/components/wiki/compare-section/compare-section.component.spec.ts +++ b/src/app/shared/components/wiki/compare-section/compare-section.component.spec.ts @@ -1,12 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormsModule } from '@angular/forms'; import { provideNoopAnimations } from '@angular/platform-browser/animations'; -import { WikiVersion } from '@shared/models'; +import { WikiVersion } from '@shared/models/wiki/wiki.model'; import { CompareSectionComponent } from './compare-section.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('CompareSectionComponent', () => { let component: CompareSectionComponent; @@ -30,7 +29,7 @@ describe('CompareSectionComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [CompareSectionComponent, FormsModule], + imports: [CompareSectionComponent], providers: [TranslateServiceMock, provideNoopAnimations()], }).compileComponents(); diff --git a/src/app/shared/components/wiki/compare-section/compare-section.component.ts b/src/app/shared/components/wiki/compare-section/compare-section.component.ts index 36bd6d22a..6142ba17d 100644 --- a/src/app/shared/components/wiki/compare-section/compare-section.component.ts +++ b/src/app/shared/components/wiki/compare-section/compare-section.component.ts @@ -7,7 +7,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, effect, input, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { WikiVersion } from '@osf/shared/models'; +import { WikiVersion } from '@osf/shared/models/wiki/wiki.model'; import * as Diff from 'diff'; diff --git a/src/app/shared/components/wiki/edit-section/edit-section.component.spec.ts b/src/app/shared/components/wiki/edit-section/edit-section.component.spec.ts index 5eea079be..b9f9faa9b 100644 --- a/src/app/shared/components/wiki/edit-section/edit-section.component.spec.ts +++ b/src/app/shared/components/wiki/edit-section/edit-section.component.spec.ts @@ -2,7 +2,7 @@ import { MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CustomDialogService } from '@shared/services'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { EditSectionComponent } from './edit-section.component'; diff --git a/src/app/shared/components/wiki/edit-section/edit-section.component.ts b/src/app/shared/components/wiki/edit-section/edit-section.component.ts index df05a7c9e..1a4d84894 100644 --- a/src/app/shared/components/wiki/edit-section/edit-section.component.ts +++ b/src/app/shared/components/wiki/edit-section/edit-section.component.ts @@ -8,7 +8,7 @@ import { Panel } from 'primeng/panel'; import { ChangeDetectionStrategy, Component, effect, inject, input, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { CustomDialogService } from '@osf/shared/services'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import 'ace-builds/src-noconflict/ext-language_tools'; diff --git a/src/app/shared/components/wiki/index.ts b/src/app/shared/components/wiki/index.ts deleted file mode 100644 index 79047f684..000000000 --- a/src/app/shared/components/wiki/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './add-wiki-dialog/add-wiki-dialog.component'; -export * from './compare-section/compare-section.component'; -export * from './edit-section/edit-section.component'; -export * from './view-section/view-section.component'; -export * from './wiki-list/wiki-list.component'; -export * from './wiki-syntax-help-dialog/wiki-syntax-help-dialog.component'; diff --git a/src/app/shared/components/wiki/view-section/view-section.component.spec.ts b/src/app/shared/components/wiki/view-section/view-section.component.spec.ts index cc4b16ee1..7b8efd281 100644 --- a/src/app/shared/components/wiki/view-section/view-section.component.spec.ts +++ b/src/app/shared/components/wiki/view-section/view-section.component.spec.ts @@ -3,12 +3,13 @@ import { MockComponent } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { provideNoopAnimations } from '@angular/platform-browser/animations'; -import { MarkdownComponent } from '@shared/components'; -import { WikiVersion } from '@shared/models'; +import { WikiVersion } from '@shared/models/wiki/wiki.model'; + +import { MarkdownComponent } from '../../markdown/markdown.component'; import { ViewSectionComponent } from './view-section.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('ViewSectionComponent', () => { let component: ViewSectionComponent; diff --git a/src/app/shared/components/wiki/view-section/view-section.component.ts b/src/app/shared/components/wiki/view-section/view-section.component.ts index 45c33345c..1be0f88e9 100644 --- a/src/app/shared/components/wiki/view-section/view-section.component.ts +++ b/src/app/shared/components/wiki/view-section/view-section.component.ts @@ -7,7 +7,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, effect, input, output, signal } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { WikiVersion } from '@osf/shared/models'; +import { WikiVersion } from '@osf/shared/models/wiki/wiki.model'; import { MarkdownComponent } from '../../markdown/markdown.component'; diff --git a/src/app/shared/components/wiki/wiki-list/wiki-list.component.spec.ts b/src/app/shared/components/wiki/wiki-list/wiki-list.component.spec.ts index cd81c07c2..847a87c59 100644 --- a/src/app/shared/components/wiki/wiki-list/wiki-list.component.spec.ts +++ b/src/app/shared/components/wiki/wiki-list/wiki-list.component.spec.ts @@ -3,8 +3,10 @@ import { MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { ComponentWiki, Wiki, WikiItemType } from '@shared/models'; -import { CustomConfirmationService, CustomDialogService } from '@shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ComponentWiki, WikiModel } from '@shared/models/wiki/wiki.model'; +import { WikiItemType } from '@shared/models/wiki/wiki-type.model'; import { WikiListComponent } from './wiki-list.component'; @@ -20,7 +22,7 @@ describe('WikiListComponent', () => { let mockCustomConfirmationService: ReturnType; let mockRouter: ReturnType; - const mockWikiList: Wiki[] = [ + const mockWikiList: WikiModel[] = [ { id: 'wiki1', name: 'Home', kind: 'Home content' }, { id: 'wiki2', name: 'Getting Started', kind: 'Getting started content' }, { id: 'wiki3', name: 'API Documentation', kind: 'API docs' }, 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 f65d26d75..7c55dec8e 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 @@ -8,8 +8,12 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, inject, input, output, signal } from '@angular/core'; import { Router } from '@angular/router'; -import { ComponentWiki, Wiki, WikiItemType, WikiMenuItem } from '@osf/shared/models'; -import { CustomConfirmationService, CustomDialogService } from '@osf/shared/services'; +import { WikiModel } from '@osf/shared/models/wiki/wiki.model'; +import { WikiMenuItem } from '@osf/shared/models/wiki/wiki-menu.model'; +import { WikiItemType } from '@osf/shared/models/wiki/wiki-type.model'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { ComponentWiki } from '@osf/shared/stores/wiki'; import { AddWikiDialogComponent } from '../add-wiki-dialog/add-wiki-dialog.component'; @@ -21,7 +25,7 @@ import { AddWikiDialogComponent } from '../add-wiki-dialog/add-wiki-dialog.compo changeDetection: ChangeDetectionStrategy.OnPush, }) export class WikiListComponent { - readonly list = input.required(); + readonly list = input.required(); readonly resourceId = input.required(); readonly currentWikiId = input.required(); readonly componentsList = input.required(); diff --git a/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.html b/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.html index 09b500b35..7b474041b 100644 --- a/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.html +++ b/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.html @@ -10,5 +10,5 @@

- +
diff --git a/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.spec.ts b/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.spec.ts index c172730b3..e5b1465de 100644 --- a/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.spec.ts +++ b/src/app/shared/components/wiki/wiki-syntax-help-dialog/wiki-syntax-help-dialog.component.spec.ts @@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { WikiSyntaxHelpDialogComponent } from './wiki-syntax-help-dialog.component'; -import { TranslateServiceMock } from '@testing/mocks'; +import { TranslateServiceMock } from '@testing/mocks/translate.service.mock'; describe('WikiSyntaxHelpDialogComponent', () => { let component: WikiSyntaxHelpDialogComponent; diff --git a/src/app/shared/constants/addon-terms.const.ts b/src/app/shared/constants/addon-terms.const.ts index f69a2fe31..936331982 100644 --- a/src/app/shared/constants/addon-terms.const.ts +++ b/src/app/shared/constants/addon-terms.const.ts @@ -1,4 +1,4 @@ -import { Term } from '@shared/models'; +import { Term } from '../models/addons/addon-utils.models'; export const ADDON_TERMS: Term[] = [ { diff --git a/src/app/shared/constants/addons-category-options.const.ts b/src/app/shared/constants/addons-category-options.const.ts index 7d36a88f3..0db918573 100644 --- a/src/app/shared/constants/addons-category-options.const.ts +++ b/src/app/shared/constants/addons-category-options.const.ts @@ -1,5 +1,5 @@ import { AddonCategory } from '@shared/enums/addons-category.enum'; -import { SelectOption } from '@shared/models'; +import { SelectOption } from '@shared/models/select-option.model'; export const ADDON_CATEGORY_OPTIONS: SelectOption[] = [ { diff --git a/src/app/shared/constants/addons-tab-options.const.ts b/src/app/shared/constants/addons-tab-options.const.ts index 5f85df2f4..9db4a138c 100644 --- a/src/app/shared/constants/addons-tab-options.const.ts +++ b/src/app/shared/constants/addons-tab-options.const.ts @@ -1,5 +1,5 @@ import { AddonTabValue } from '@shared/enums/addon-tab.enum'; -import { SelectOption } from '@shared/models'; +import { SelectOption } from '@shared/models/select-option.model'; export const ADDON_TAB_OPTIONS: SelectOption[] = [ { diff --git a/src/app/shared/constants/contributors.constants.ts b/src/app/shared/constants/contributors.constants.ts index 8e4b5f474..420f852b3 100644 --- a/src/app/shared/constants/contributors.constants.ts +++ b/src/app/shared/constants/contributors.constants.ts @@ -1,5 +1,5 @@ -import { ContributorPermission } from '@osf/shared/enums'; -import { SelectOption } from '@osf/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { SelectOption } from '@osf/shared/models/select-option.model'; export const PERMISSION_OPTIONS: SelectOption[] = [ { diff --git a/src/app/shared/constants/default-citation-titles.const.ts b/src/app/shared/constants/default-citation-titles.const.ts index 0f543dcc7..d0756f96f 100644 --- a/src/app/shared/constants/default-citation-titles.const.ts +++ b/src/app/shared/constants/default-citation-titles.const.ts @@ -1,4 +1,4 @@ -import { CitationTypes } from '@shared/enums'; +import { CitationTypes } from '../enums/citation-types.enum'; export const CITATION_TITLES: Record = { [CitationTypes.APA]: 'APA', diff --git a/src/app/shared/constants/default-table-params.constants.ts b/src/app/shared/constants/default-table-params.constants.ts index fc16beb3b..228d306c8 100644 --- a/src/app/shared/constants/default-table-params.constants.ts +++ b/src/app/shared/constants/default-table-params.constants.ts @@ -1,4 +1,4 @@ -import { TableParameters } from '@shared/models'; +import { TableParameters } from '../models/table-parameters.model'; export const DEFAULT_TABLE_PARAMS: TableParameters = { rows: 10, diff --git a/src/app/shared/constants/index.ts b/src/app/shared/constants/index.ts deleted file mode 100644 index 0fb592994..000000000 --- a/src/app/shared/constants/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -export * from './addon-terms.const'; -export * from './addons-category-options.const'; -export * from './addons-tab-options.const'; -export * from './built-in-citation-styles.const'; -export * from './contributors.constants'; -export * from './default-citation-titles.const'; -export * from './default-table-params.constants'; -export * from './files-limits.const'; -export * from './filter-placeholders'; -export * from './input-limits.const'; -export * from './input-validation-messages.const'; -export * from './language.const'; -export * from './pie-chart-palette'; -export * from './registration-statuses'; -export * from './registry-services-icons.const'; -export * from './resource-card-labels.const'; -export * from './resource-types.const'; -export * from './scientists.const'; -export * from './search-sort-options.const'; -export * from './search-tab-options.const'; -export * from './search-tutorial-steps.const'; -export * from './social-links.const'; -export * from './social-links.const'; -export * from './social-platforms.const'; -export * from './social-share.config'; -export * from './sort-options.const'; diff --git a/src/app/shared/constants/registration-statuses.ts b/src/app/shared/constants/registration-statuses.ts index f57867033..d83bd52e5 100644 --- a/src/app/shared/constants/registration-statuses.ts +++ b/src/app/shared/constants/registration-statuses.ts @@ -1,5 +1,5 @@ -import { RegistryStatus } from '../enums'; -import { StatusInfo } from '../models'; +import { RegistryStatus } from '../enums/registry-status.enum'; +import { StatusInfo } from '../models/status-info.model'; export const RegistryStatusMap: Record = { [RegistryStatus.None]: { label: '', severity: null }, diff --git a/src/app/shared/constants/resource-card-labels.const.ts b/src/app/shared/constants/resource-card-labels.const.ts index 7b002e21c..ed6c45d67 100644 --- a/src/app/shared/constants/resource-card-labels.const.ts +++ b/src/app/shared/constants/resource-card-labels.const.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '../enums'; +import { ResourceType } from '../enums/resource-type.enum'; export const CardLabelTranslationKeys: Partial> = { [ResourceType.Project]: 'resourceCard.type.project', diff --git a/src/app/shared/constants/search-tab-options.const.ts b/src/app/shared/constants/search-tab-options.const.ts index 8e60c41a8..95211266d 100644 --- a/src/app/shared/constants/search-tab-options.const.ts +++ b/src/app/shared/constants/search-tab-options.const.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '../enums'; -import { TabOption } from '../models'; +import { ResourceType } from '../enums/resource-type.enum'; +import { TabOption } from '../models/tab-option.model'; export const SEARCH_TAB_OPTIONS: TabOption[] = [ { label: 'common.search.tabs.all', value: ResourceType.Null }, diff --git a/src/app/shared/constants/search-tutorial-steps.const.ts b/src/app/shared/constants/search-tutorial-steps.const.ts index 14895ee02..f84de4dc7 100644 --- a/src/app/shared/constants/search-tutorial-steps.const.ts +++ b/src/app/shared/constants/search-tutorial-steps.const.ts @@ -1,4 +1,4 @@ -import { TutorialStep } from '../models'; +import { TutorialStep } from '../models/tutorial-step.model'; export const SEARCH_TUTORIAL_STEPS: TutorialStep[] = [ { diff --git a/src/app/shared/constants/social-links.const.ts b/src/app/shared/constants/social-links.const.ts index 56e3352f6..eb39182a2 100644 --- a/src/app/shared/constants/social-links.const.ts +++ b/src/app/shared/constants/social-links.const.ts @@ -1,4 +1,4 @@ -import { SocialLinksModel } from '../models'; +import { SocialLinksModel } from '../models/user/social-links.model'; export const SOCIAL_LINKS: SocialLinksModel[] = [ { diff --git a/src/app/shared/constants/social-platforms.const.ts b/src/app/shared/constants/social-platforms.const.ts index a1689fad3..9b594d681 100644 --- a/src/app/shared/constants/social-platforms.const.ts +++ b/src/app/shared/constants/social-platforms.const.ts @@ -1,4 +1,4 @@ -import { SocialPlatformConfig } from '../models'; +import { SocialPlatformConfig } from '../models/socials/social-platform-config.model'; export const SOCIAL_PLATFORMS: SocialPlatformConfig[] = [ { diff --git a/src/app/shared/constants/sort-options.const.ts b/src/app/shared/constants/sort-options.const.ts index 36485c0cf..338850799 100644 --- a/src/app/shared/constants/sort-options.const.ts +++ b/src/app/shared/constants/sort-options.const.ts @@ -1,5 +1,5 @@ -import { SortType } from '../enums'; -import { CustomOption } from '../models'; +import { SortType } from '../enums/sort-type.enum'; +import { CustomOption } from '../models/select-option.model'; export const ALL_SORT_OPTIONS: CustomOption[] = [ { diff --git a/src/app/shared/directives/index.ts b/src/app/shared/directives/index.ts deleted file mode 100644 index b08fc7ae2..000000000 --- a/src/app/shared/directives/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { ClearFileDirective } from './clear-file.directive'; -export { ScrollTopOnRouteChangeDirective } from './scroll-top.directive'; -export { StopPropagationDirective } from './stop-propagation.directive'; diff --git a/src/app/shared/enums/contributors/index.ts b/src/app/shared/enums/contributors/index.ts deleted file mode 100644 index 3f08f1f18..000000000 --- a/src/app/shared/enums/contributors/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { AddContributorType } from './add-contributor-type.enum'; -export { AddDialogState } from './add-dialog-state.enum'; -export { ContributorPermission } from './contributor-permission.enum'; diff --git a/src/app/shared/models/datacite/datacite-event.enum.ts b/src/app/shared/enums/datacite/datacite-event.enum.ts similarity index 100% rename from src/app/shared/models/datacite/datacite-event.enum.ts rename to src/app/shared/enums/datacite/datacite-event.enum.ts diff --git a/src/app/shared/enums/index.ts b/src/app/shared/enums/index.ts deleted file mode 100644 index 05460f357..000000000 --- a/src/app/shared/enums/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -export * from './addon-form-controls.enum'; -export * from './addon-service-names.enum'; -export * from './addon-supported-features.enum'; -export * from './addon-tab.enum'; -export * from './addon-type.enum'; -export * from './addons-category.enum'; -export * from './addons-credentials-format.enum'; -export * from './block-type.enum'; -export * from './breakpoint-queries.enum'; -export * from './citation-types.enum'; -export * from './contributors'; -export * from './create-component-form-controls.enum'; -export * from './create-project-form-controls.enum'; -export * from './field-type.enum'; -export * from './file-kind.enum'; -export * from './file-menu-type.enum'; -export * from './filter-type.enum'; -export * from './get-resources-request-type.enum'; -export * from './metadata-record-format.enum'; -export * from './metadata-resource.enum'; -export * from './mode.enum'; -export * from './moderation-decision-form-controls.enum'; -export * from './moderation-submit-type.enum'; -export * from './operation-names.enum'; -export * from './profile-addons-stepper.enum'; -export * from './profile-settings-key.enum'; -export * from './registration-review-states.enum'; -export * from './registry-resource.enum'; -export * from './registry-status.enum'; -export * from './request-access-trigger.enum'; -export * from './request-access-type.enum'; -export * from './resource-search-mode.enum'; -export * from './resource-type.enum'; -export * from './reusable-filter-type.enum'; -export * from './review-permissions.enum'; -export * from './revision-review-states.enum'; -export * from './share-indexing.enum'; -export * from './sort-order.enum'; -export * from './sort-type.enum'; -export * from './storage-item-type.enum'; -export * from './subscriptions'; -export * from './trigger-action.enum'; -export * from './user-permissions.enum'; diff --git a/src/app/shared/enums/subscriptions/index.ts b/src/app/shared/enums/subscriptions/index.ts deleted file mode 100644 index 64dbd8be9..000000000 --- a/src/app/shared/enums/subscriptions/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './subscription-event.enum'; -export * from './subscription-frequency.enum'; -export * from './subscription-type.enum'; diff --git a/src/app/shared/enums/subscriptions/subscription-event.enum.ts b/src/app/shared/enums/subscriptions/subscription-event.enum.ts index f3913133f..3ce040bfe 100644 --- a/src/app/shared/enums/subscriptions/subscription-event.enum.ts +++ b/src/app/shared/enums/subscriptions/subscription-event.enum.ts @@ -1,6 +1,5 @@ export enum SubscriptionEvent { GlobalFileUpdated = 'global_file_updated', - GlobalMentions = 'global_mentions', GlobalReviews = 'global_reviews', FileUpdated = 'file_updated', } diff --git a/src/app/shared/guards/confirm-leaving.guard.ts b/src/app/shared/guards/confirm-leaving.guard.ts index 1bdf3dab9..7b2bfa372 100644 --- a/src/app/shared/guards/confirm-leaving.guard.ts +++ b/src/app/shared/guards/confirm-leaving.guard.ts @@ -3,8 +3,9 @@ import { Subject } from 'rxjs'; import { inject } from '@angular/core'; import { CanDeactivateFn } from '@angular/router'; -import { CanDeactivateComponent } from '@shared/models'; -import { CustomConfirmationService } from '@shared/services'; +import { CanDeactivateComponent } from '@shared/models/can-deactivate.interface'; + +import { CustomConfirmationService } from '../services/custom-confirmation.service'; export const ConfirmLeavingGuard: CanDeactivateFn = (component) => { const confirmationService = inject(CustomConfirmationService); diff --git a/src/app/shared/helpers/addon-card.helper.ts b/src/app/shared/helpers/addon-card.helper.ts index 092b6ffcb..e71c1e815 100644 --- a/src/app/shared/helpers/addon-card.helper.ts +++ b/src/app/shared/helpers/addon-card.helper.ts @@ -1,4 +1,6 @@ -import { AddonCardModel, AddonModel, ConfiguredAddonModel } from '../models'; +import { AddonModel } from '../models/addons/addon.model'; +import { AddonCardModel } from '../models/addons/addon-card.model'; +import { ConfiguredAddonModel } from '../models/addons/configured-addon.model'; export function createAddonCardModel( addon: AddonModel, diff --git a/src/app/shared/helpers/addon-type.helper.ts b/src/app/shared/helpers/addon-type.helper.ts index beea10396..2b4c65f11 100644 --- a/src/app/shared/helpers/addon-type.helper.ts +++ b/src/app/shared/helpers/addon-type.helper.ts @@ -1,5 +1,9 @@ -import { AddonCategory, AddonType, AuthorizedAccountType, ConfiguredAddonType } from '@shared/enums'; -import { AddonModel, AuthorizedAccountModel, ConfiguredAddonModel } from '@shared/models'; +import { AddonModel } from '@shared/models/addons/addon.model'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; + +import { AddonType, AuthorizedAccountType, ConfiguredAddonType } from '../enums/addon-type.enum'; +import { AddonCategory } from '../enums/addons-category.enum'; export function isStorageAddon(addon: AddonModel | AuthorizedAccountModel | ConfiguredAddonModel | null): boolean { if (!addon) return false; diff --git a/src/app/shared/helpers/breakpoints.tokens.ts b/src/app/shared/helpers/breakpoints.tokens.ts index 7e7f910f0..d89eaeaac 100644 --- a/src/app/shared/helpers/breakpoints.tokens.ts +++ b/src/app/shared/helpers/breakpoints.tokens.ts @@ -3,7 +3,7 @@ import { map, Observable } from 'rxjs'; import { BreakpointObserver } from '@angular/cdk/layout'; import { inject, InjectionToken } from '@angular/core'; -import { BreakpointQueries } from '@osf/shared/enums'; +import { BreakpointQueries } from '../enums/breakpoint-queries.enum'; function createBreakpointToken(query: string): InjectionToken> { return new InjectionToken>(`Breakpoint ${query}`, { diff --git a/src/app/shared/helpers/citation-formatter.helper.ts b/src/app/shared/helpers/citation-formatter.helper.ts index 5591e8290..1139ea7ca 100644 --- a/src/app/shared/helpers/citation-formatter.helper.ts +++ b/src/app/shared/helpers/citation-formatter.helper.ts @@ -1,4 +1,4 @@ -import { StorageItem } from '@shared/models'; +import { StorageItem } from '../models/addons/storage-item.model'; import { Cite } from '@citation-js/core'; diff --git a/src/app/shared/helpers/get-resource-types.helper.ts b/src/app/shared/helpers/get-resource-types.helper.ts index 942a7724b..4dc60b462 100644 --- a/src/app/shared/helpers/get-resource-types.helper.ts +++ b/src/app/shared/helpers/get-resource-types.helper.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; export function getResourceTypeStringFromEnum(resourceTab: ResourceType): string { switch (resourceTab) { diff --git a/src/app/shared/helpers/http.helper.ts b/src/app/shared/helpers/http.helper.ts index 09b8c526e..d44e37207 100644 --- a/src/app/shared/helpers/http.helper.ts +++ b/src/app/shared/helpers/http.helper.ts @@ -1,7 +1,8 @@ import { Params } from '@angular/router'; -import { SortOrder } from '@osf/shared/enums'; -import { QueryParams } from '@osf/shared/models'; +import { QueryParams } from '@shared/models/query-params.model'; + +import { SortOrder } from '../enums/sort-order.enum'; export const parseQueryFilterParams = (params: Params): QueryParams => { const page = parseInt(params['page'], 10) || 1; diff --git a/src/app/shared/helpers/index.ts b/src/app/shared/helpers/index.ts deleted file mode 100644 index 468122427..000000000 --- a/src/app/shared/helpers/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -export * from './addon-card.helper'; -export * from './addon-type.helper'; -export * from './addons-query-params.helper'; -export * from './breakpoints.tokens'; -export * from './browser-tab.helper'; -export * from './camel-case'; -export * from './camel-case-to-normal.helper'; -export * from './citation-formatter.helper'; -export * from './convert-to-snake-case.helper'; -export * from './custom-form-validators.helper'; -export * from './find-changed-fields'; -export * from './find-changed-items.helper'; -export * from './form-validation.helper'; -export * from './get-resource-types.helper'; -export * from './header-style.helper'; -export * from './http.helper'; -export * from './normalize-quotes'; -export * from './password.helper'; -export * from './path-join.helper'; -export * from './remove-nullable.helper'; -export * from './search-pref-to-json-api-query-params.helper'; -export * from './sort-contributors-by-permissions'; -export * from './state-error.handler'; -export * from './types.helper'; -export * from './url-param.helper'; -export * from './view-only.helper'; diff --git a/src/app/shared/helpers/search-pref-to-json-api-query-params.helper.ts b/src/app/shared/helpers/search-pref-to-json-api-query-params.helper.ts index 465ab1b76..ac5e321a7 100644 --- a/src/app/shared/helpers/search-pref-to-json-api-query-params.helper.ts +++ b/src/app/shared/helpers/search-pref-to-json-api-query-params.helper.ts @@ -1,5 +1,5 @@ -import { SortOrder } from '@shared/enums'; -import { SearchFilters } from '@shared/models'; +import { SortOrder } from '@shared/enums/sort-order.enum'; +import { SearchFilters } from '@shared/models/search-filters.model'; export function searchPreferencesToJsonApiQueryParams( params: Record, diff --git a/src/app/shared/helpers/sort-contributors-by-permissions.ts b/src/app/shared/helpers/sort-contributors-by-permissions.ts index cb9e8b730..553d9094e 100644 --- a/src/app/shared/helpers/sort-contributors-by-permissions.ts +++ b/src/app/shared/helpers/sort-contributors-by-permissions.ts @@ -1,4 +1,4 @@ -import { Creator, IsContainedBy, QualifiedAttribution, ResourceModel } from '@shared/models'; +import { Creator, IsContainedBy, QualifiedAttribution, ResourceModel } from '../models/search/resource.model'; export function getSortedContributorsByPermissions(base: ResourceModel | IsContainedBy) { const objectOrder = Object.fromEntries( diff --git a/src/app/shared/mappers/activity-logs.mapper.ts b/src/app/shared/mappers/activity-logs.mapper.ts index 2a5a4fff4..d0b7877a6 100644 --- a/src/app/shared/mappers/activity-logs.mapper.ts +++ b/src/app/shared/mappers/activity-logs.mapper.ts @@ -1,13 +1,8 @@ -import { DEFAULT_TABLE_PARAMS } from '../constants'; -import { - ActivityLog, - ActivityLogJsonApi, - JsonApiResponseWithMeta, - LogContributor, - LogContributorJsonApi, - MetaAnonymousJsonApi, - PaginatedData, -} from '../models'; +import { DEFAULT_TABLE_PARAMS } from '../constants/default-table-params.constants'; +import { ActivityLog, LogContributor } from '../models/activity-logs/activity-logs.model'; +import { ActivityLogJsonApi, LogContributorJsonApi } from '../models/activity-logs/activity-logs-json-api.model'; +import { JsonApiResponseWithMeta, MetaAnonymousJsonApi } from '../models/common/json-api.model'; +import { PaginatedData } from '../models/paginated-data.model'; export class ActivityLogsMapper { static fromActivityLogJsonApi(log: ActivityLogJsonApi, isAnonymous?: boolean): ActivityLog { diff --git a/src/app/shared/mappers/addon.mapper.ts b/src/app/shared/mappers/addon.mapper.ts index fa3c4d73d..3298ce98f 100644 --- a/src/app/shared/mappers/addon.mapper.ts +++ b/src/app/shared/mappers/addon.mapper.ts @@ -1,16 +1,19 @@ -import { AddonCategory, AuthorizedAccountType, ConfiguredAddonType } from '../enums'; +import { AuthorizedAccountType, ConfiguredAddonType } from '../enums/addon-type.enum'; +import { AddonCategory } from '../enums/addons-category.enum'; +import { AddonModel } from '../models/addons/addon.model'; import { AddonGetResponseJsonApi, - AddonModel, - AuthorizedAccountModel, AuthorizedAddonGetResponseJsonApi, ConfiguredAddonGetResponseJsonApi, - ConfiguredAddonModel, IncludedAddonData, - OperationInvocation, +} from '../models/addons/addon-json-api.models'; +import { OperationInvocationResponseJsonApi, StorageItemResponseJsonApi, -} from '../models'; +} from '../models/addons/addon-operations-json-api.models'; +import { AuthorizedAccountModel } from '../models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '../models/addons/configured-addon.model'; +import { OperationInvocation } from '../models/addons/operation-invocation.model'; export class AddonMapper { static fromResponse(response: AddonGetResponseJsonApi): AddonModel { diff --git a/src/app/shared/mappers/citations.mapper.ts b/src/app/shared/mappers/citations.mapper.ts index c70dbb1ce..5ae176049 100644 --- a/src/app/shared/mappers/citations.mapper.ts +++ b/src/app/shared/mappers/citations.mapper.ts @@ -1,13 +1,11 @@ -import { CITATION_TITLES } from '../constants'; -import { CitationTypes } from '../enums'; -import { - CitationStyle, - CitationStyleJsonApi, - CustomCitationPayload, - CustomCitationPayloadJsonApi, - StyledCitation, - StyledCitationJsonApi, -} from '../models'; +import { CITATION_TITLES } from '../constants/default-citation-titles.const'; +import { CitationTypes } from '../enums/citation-types.enum'; +import { CitationStyle } from '../models/citations/citation-style.model'; +import { CitationStyleJsonApi } from '../models/citations/citation-style-json-api.model'; +import { CustomCitationPayload } from '../models/citations/custom-citation-payload.model'; +import { CustomCitationPayloadJsonApi } from '../models/citations/custom-citation-payload-json-api.model'; +import { StyledCitation } from '../models/citations/styled-citation.model'; +import { StyledCitationJsonApi } from '../models/citations/styled-citation-json-api.model'; export class CitationsMapper { static fromGetCitationStylesResponse(response: CitationStyleJsonApi[]): CitationStyle[] { diff --git a/src/app/shared/mappers/collections/collections.mapper.ts b/src/app/shared/mappers/collections/collections.mapper.ts index 22969da39..b0fb73392 100644 --- a/src/app/shared/mappers/collections/collections.mapper.ts +++ b/src/app/shared/mappers/collections/collections.mapper.ts @@ -2,22 +2,24 @@ import { CollectionSubmissionReviewAction, CollectionSubmissionReviewActionJsonApi, } from '@osf/features/moderation/models'; -import { convertToSnakeCase } from '@osf/shared/helpers'; +import { convertToSnakeCase } from '@osf/shared/helpers/convert-to-snake-case.helper'; +import { CollectionSubmissionPayload } from '@osf/shared/models/collections/collection-submission-payload.model'; +import { CollectionSubmissionPayloadJsonApi } from '@osf/shared/models/collections/collection-submission-payload-json-api.model'; import { CollectionDetails, - CollectionDetailsResponseJsonApi, CollectionProvider, - CollectionProviderResponseJsonApi, CollectionSubmission, - CollectionSubmissionJsonApi, - CollectionSubmissionPayload, - CollectionSubmissionPayloadJsonApi, CollectionSubmissionWithGuid, +} from '@osf/shared/models/collections/collections.models'; +import { + CollectionDetailsResponseJsonApi, + CollectionProviderResponseJsonApi, + CollectionSubmissionJsonApi, CollectionSubmissionWithGuidJsonApi, - ContributorModel, - PaginatedData, - ResponseJsonApi, -} from '@osf/shared/models'; +} from '@osf/shared/models/collections/collections-json-api.models'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { UserMapper } from '../user'; diff --git a/src/app/shared/mappers/components/components.mapper.ts b/src/app/shared/mappers/components/components.mapper.ts index 65bc72edc..14cb0f5a3 100644 --- a/src/app/shared/mappers/components/components.mapper.ts +++ b/src/app/shared/mappers/components/components.mapper.ts @@ -1,4 +1,5 @@ -import { ComponentGetResponseJsonApi, ComponentOverview } from '@shared/models'; +import { ComponentGetResponseJsonApi } from '@osf/shared/models/components/component-json-api.model'; +import { ComponentOverview } from '@osf/shared/models/components/components.models'; import { ContributorsMapper } from '../contributors'; diff --git a/src/app/shared/mappers/contributors/contributors.mapper.ts b/src/app/shared/mappers/contributors/contributors.mapper.ts index bf44ed469..b0546f98e 100644 --- a/src/app/shared/mappers/contributors/contributors.mapper.ts +++ b/src/app/shared/mappers/contributors/contributors.mapper.ts @@ -1,14 +1,14 @@ -import { AddContributorType, ContributorPermission } from '@osf/shared/enums'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { ContributorModel, ContributorShortInfoModel } from '@osf/shared/models/contributors/contributor.model'; +import { ContributorAddModel } from '@osf/shared/models/contributors/contributor-add.model'; import { - ContributorAddModel, ContributorAddRequestModel, ContributorDataJsonApi, - ContributorModel, - ContributorShortInfoModel, - PaginatedData, - ResponseJsonApi, - UserDataJsonApi, -} from '@osf/shared/models'; +} from '@osf/shared/models/contributors/contributor-response-json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; +import { UserDataJsonApi } from '@osf/shared/models/user/user-json-api.model'; export class ContributorsMapper { static getContributors(response: ContributorDataJsonApi[] | undefined): ContributorModel[] { diff --git a/src/app/shared/mappers/emails.mapper.ts b/src/app/shared/mappers/emails.mapper.ts index 78d2c39e5..f87111ea0 100644 --- a/src/app/shared/mappers/emails.mapper.ts +++ b/src/app/shared/mappers/emails.mapper.ts @@ -1,4 +1,5 @@ -import { AccountEmailModel, EmailsDataJsonApi } from '../models/emails'; +import { AccountEmailModel } from '../models/emails/account-email.model'; +import { EmailsDataJsonApi } from '../models/emails/account-emails-json-api.model'; export function MapEmails(emails: EmailsDataJsonApi[]): AccountEmailModel[] { return emails.map((item) => MapEmail(item)); diff --git a/src/app/shared/mappers/files/files.mapper.ts b/src/app/shared/mappers/files/files.mapper.ts index 95ecf6f8d..f792acf78 100644 --- a/src/app/shared/mappers/files/files.mapper.ts +++ b/src/app/shared/mappers/files/files.mapper.ts @@ -1,19 +1,15 @@ -import { FileKind } from '@osf/shared/enums'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; +import { FileDetailsModel, FileExtraModel, FileLinksModel, FileModel } from '@shared/models/files/file.model'; +import { FileFolderLinks, FileFolderModel } from '@shared/models/files/file-folder.model'; +import { FileFolderDataJsonApi } from '@shared/models/files/file-folder-json-api.model'; import { FileDataJsonApi, FileDetailsDataJsonApi, - FileDetailsModel, FileExtraJsonApi, - FileExtraModel, - FileFolderDataJsonApi, - FileFolderLinks, - FileFolderModel, FileLinksJsonApi, - FileLinksModel, - FileModel, - FileVersionModel, - FileVersionsResponseJsonApi, -} from '@osf/shared/models'; +} from '@shared/models/files/file-json-api.model'; +import { FileVersionModel } from '@shared/models/files/file-version.model'; +import { FileVersionsResponseJsonApi } from '@shared/models/files/file-version-json-api.model'; import { BaseNodeMapper } from '../nodes'; diff --git a/src/app/shared/mappers/filters/filter-option.mapper.ts b/src/app/shared/mappers/filters/filter-option.mapper.ts index 9b78e8c53..21fd54c13 100644 --- a/src/app/shared/mappers/filters/filter-option.mapper.ts +++ b/src/app/shared/mappers/filters/filter-option.mapper.ts @@ -1,4 +1,6 @@ -import { FilterOption, FilterOptionItem, SearchResultDataJsonApi } from '@shared/models'; +import { FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; +import { FilterOptionItem } from '@osf/shared/models/search/filter-options-json-api.models'; +import { SearchResultDataJsonApi } from '@osf/shared/models/search/index-card-search-json-api.models'; export function mapFilterOptions( searchResultItems: SearchResultDataJsonApi[], diff --git a/src/app/shared/mappers/filters/filters.mapper.ts b/src/app/shared/mappers/filters/filters.mapper.ts index 05e104a93..dde219558 100644 --- a/src/app/shared/mappers/filters/filters.mapper.ts +++ b/src/app/shared/mappers/filters/filters.mapper.ts @@ -1,9 +1,8 @@ +import { DiscoverableFilter, FilterOperatorOption } from '@osf/shared/models/search/discaverable-filter.model'; import { - DiscoverableFilter, - FilterOperator, IndexCardSearchResponseJsonApi, RelatedPropertyPathDataJsonApi, -} from '@shared/models'; +} from '@osf/shared/models/search/index-card-search-json-api.models'; export function MapFilters(indexCardSearchResponseJsonApi: IndexCardSearchResponseJsonApi): DiscoverableFilter[] { const relatedPropertiesIds = indexCardSearchResponseJsonApi.data.relationships.relatedProperties.data.map( @@ -21,7 +20,7 @@ export function MapFilters(indexCardSearchResponseJsonApi: IndexCardSearchRespon export function RelatedPropertyPathMapper(relatedPropertyPath: RelatedPropertyPathDataJsonApi): DiscoverableFilter { const key = relatedPropertyPath.attributes.propertyPathKey; - const operator = relatedPropertyPath.attributes.suggestedFilterOperator as FilterOperator; + const operator = relatedPropertyPath.attributes.suggestedFilterOperator as FilterOperatorOption; const propertyPath = relatedPropertyPath.attributes.propertyPath?.at(-1); const label = propertyPath?.displayLabel?.[0]?.['@value'] ?? key; diff --git a/src/app/shared/mappers/identifiers.mapper.ts b/src/app/shared/mappers/identifiers.mapper.ts index 04d5cdaca..2ada05fd8 100644 --- a/src/app/shared/mappers/identifiers.mapper.ts +++ b/src/app/shared/mappers/identifiers.mapper.ts @@ -1,7 +1,8 @@ -import { Identifier, IdentifiersResponseJsonApi } from '@shared/models'; +import { IdentifierModel } from '../models/identifiers/identifier.model'; +import { IdentifiersResponseJsonApi } from '../models/identifiers/identifier-json-api.model'; export class IdentifiersMapper { - static fromJsonApi(response: IdentifiersResponseJsonApi | undefined): Identifier[] { + static fromJsonApi(response: IdentifiersResponseJsonApi | undefined): IdentifierModel[] { if (!response || !response.data) { return []; } diff --git a/src/app/shared/mappers/index.ts b/src/app/shared/mappers/index.ts deleted file mode 100644 index 53015bb65..000000000 --- a/src/app/shared/mappers/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -export * from './activity-logs.mapper'; -export * from './addon.mapper'; -export * from './citations.mapper'; -export * from './collections'; -export * from './components'; -export * from './contributors'; -export * from './emails.mapper'; -export * from './files/files.mapper'; -export * from './filters/filter-option.mapper'; -export * from './filters/filters.mapper'; -export * from './identifiers.mapper'; -export * from './institutions'; -export * from './licenses.mapper'; -export * from './nodes'; -export * from './notification-subscription.mapper'; -export * from './registration-provider.mapper'; -export * from './resource-overview.mappers'; -export * from './review-actions.mapper'; -export * from './subjects'; -export * from './user'; -export * from './user-related-counts'; -export * from './view-only-links.mapper'; diff --git a/src/app/shared/mappers/institutions/institutions.mapper.ts b/src/app/shared/mappers/institutions/institutions.mapper.ts index 53ee7f8e1..56cb294f4 100644 --- a/src/app/shared/mappers/institutions/institutions.mapper.ts +++ b/src/app/shared/mappers/institutions/institutions.mapper.ts @@ -1,10 +1,9 @@ import { - Institution, InstitutionDataJsonApi, InstitutionsJsonApiResponse, InstitutionsWithMetaJsonApiResponse, - InstitutionsWithTotalCount, -} from '@shared/models'; +} from '@osf/shared/models/institutions/institution-json-api.model'; +import { Institution, InstitutionsWithTotalCount } from '@osf/shared/models/institutions/institutions.models'; export class InstitutionsMapper { static fromInstitutionsResponse(response: InstitutionsJsonApiResponse): Institution[] { diff --git a/src/app/shared/mappers/licenses.mapper.ts b/src/app/shared/mappers/licenses.mapper.ts index f4726cfb3..253da04dc 100644 --- a/src/app/shared/mappers/licenses.mapper.ts +++ b/src/app/shared/mappers/licenses.mapper.ts @@ -1,4 +1,5 @@ -import { LicenseDataJsonApi, LicenseModel, LicensesResponseJsonApi } from '../models'; +import { LicenseModel } from '../models/license/license.model'; +import { LicenseDataJsonApi, LicensesResponseJsonApi } from '../models/license/licenses-json-api.model'; export class LicensesMapper { static fromLicensesResponse(response: LicensesResponseJsonApi): LicenseModel[] { diff --git a/src/app/shared/mappers/nodes/base-node.mapper.ts b/src/app/shared/mappers/nodes/base-node.mapper.ts index 771005e2b..3fc17f94b 100644 --- a/src/app/shared/mappers/nodes/base-node.mapper.ts +++ b/src/app/shared/mappers/nodes/base-node.mapper.ts @@ -1,12 +1,10 @@ -import { - BaseNodeDataJsonApi, - BaseNodeModel, - NodeModel, - NodeShortInfoModel, - PaginatedData, - ResponseJsonApi, -} from '@osf/shared/models'; -import { ContributorsMapper } from '@shared/mappers'; +import { ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; +import { BaseNodeModel, NodeModel } from '@osf/shared/models/nodes/base-node.model'; +import { BaseNodeDataJsonApi } from '@osf/shared/models/nodes/base-node-data-json-api.model'; +import { NodeShortInfoModel } from '@osf/shared/models/nodes/node-with-children.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; + +import { ContributorsMapper } from '../contributors'; export class BaseNodeMapper { static getNodesData(data: BaseNodeDataJsonApi[]): BaseNodeModel[] { diff --git a/src/app/shared/mappers/notification-subscription.mapper.ts b/src/app/shared/mappers/notification-subscription.mapper.ts index bd0bcc6c9..6ccb5bb37 100644 --- a/src/app/shared/mappers/notification-subscription.mapper.ts +++ b/src/app/shared/mappers/notification-subscription.mapper.ts @@ -1,9 +1,11 @@ -import { SubscriptionEvent, SubscriptionFrequency, SubscriptionType } from '../enums'; +import { SubscriptionEvent } from '../enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '../enums/subscriptions/subscription-frequency.enum'; +import { SubscriptionType } from '../enums/subscriptions/subscription-type.enum'; +import { NotificationSubscription } from '../models/notifications/notification-subscription.model'; import { - NotificationSubscription, NotificationSubscriptionGetResponseJsonApi, NotificationSubscriptionUpdateRequestJsonApi, -} from '../models'; +} from '../models/notifications/notification-subscription-json-api.model'; export class NotificationSubscriptionMapper { static fromGetResponse(response: NotificationSubscriptionGetResponseJsonApi): NotificationSubscription { diff --git a/src/app/shared/mappers/projects/projects.mapper.ts b/src/app/shared/mappers/projects/projects.mapper.ts index 86ee52697..51cbfa73e 100644 --- a/src/app/shared/mappers/projects/projects.mapper.ts +++ b/src/app/shared/mappers/projects/projects.mapper.ts @@ -1,6 +1,7 @@ import { CollectionSubmissionMetadataPayloadJsonApi } from '@osf/features/collections/models'; -import { ProjectMetadataUpdatePayload } from '@osf/shared/models'; -import { ProjectJsonApi, ProjectModel, ProjectsResponseJsonApi } from '@osf/shared/models/projects'; +import { ProjectMetadataUpdatePayload } from '@osf/shared/models/project-metadata-update-payload.model'; +import { ProjectModel } from '@osf/shared/models/projects/projects.models'; +import { ProjectJsonApi, ProjectsResponseJsonApi } from '@osf/shared/models/projects/projects-json-api.models'; export class ProjectsMapper { static fromGetAllProjectsResponse(response: ProjectsResponseJsonApi): ProjectModel[] { diff --git a/src/app/shared/mappers/regions/regions-mapper.ts b/src/app/shared/mappers/regions/regions-mapper.ts index 4b2c371c6..a06e609a8 100644 --- a/src/app/shared/mappers/regions/regions-mapper.ts +++ b/src/app/shared/mappers/regions/regions-mapper.ts @@ -1,14 +1,15 @@ -import { IdName, RegionDataJsonApi, RegionsResponseJsonApi } from '@osf/shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; +import { RegionDataJsonApi, RegionsResponseJsonApi } from '@osf/shared/models/regions/regions.json-api.model'; export class RegionsMapper { - static fromRegionsResponseJsonApi(response: RegionsResponseJsonApi): IdName[] { + static fromRegionsResponseJsonApi(response: RegionsResponseJsonApi): IdNameModel[] { return response.data.map((data) => ({ id: data.id, name: data.attributes.name, })); } - static getRegion(data: RegionDataJsonApi): IdName { + static getRegion(data: RegionDataJsonApi): IdNameModel { return { id: data.id, name: data.attributes.name, diff --git a/src/app/shared/mappers/registration-provider.mapper.ts b/src/app/shared/mappers/registration-provider.mapper.ts index 884cd4708..6c6505520 100644 --- a/src/app/shared/mappers/registration-provider.mapper.ts +++ b/src/app/shared/mappers/registration-provider.mapper.ts @@ -1,9 +1,7 @@ -import { - ProviderSchema, - ProvidersResponseJsonApi, - RegistryProviderDetails, - RegistryProviderDetailsJsonApi, -} from '@osf/shared/models'; +import { ProvidersResponseJsonApi } from '../models/provider/providers-json-api.model'; +import { RegistryProviderDetailsJsonApi } from '../models/provider/registration-provider-json-api.model'; +import { RegistryProviderDetails } from '../models/provider/registry-provider.model'; +import { ProviderSchema } from '../models/registration/provider-schema.model'; export class RegistrationProviderMapper { static fromProvidersResponse(response: ProvidersResponseJsonApi): ProviderSchema[] { diff --git a/src/app/shared/mappers/registration/map-registry-status.mapper.ts b/src/app/shared/mappers/registration/map-registry-status.mapper.ts index 7761172e4..05515bf4d 100644 --- a/src/app/shared/mappers/registration/map-registry-status.mapper.ts +++ b/src/app/shared/mappers/registration/map-registry-status.mapper.ts @@ -1,6 +1,8 @@ import { RegistryOverviewJsonApiAttributes } from '@osf/features/registry/models'; -import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; -import { RegistrationAttributesJsonApi } from '@osf/shared/models'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { RegistrationAttributesJsonApi } from '@shared/models/registration/registration-json-api.model'; export function MapRegistryStatus( registry: RegistryOverviewJsonApiAttributes | RegistrationAttributesJsonApi diff --git a/src/app/shared/mappers/registration/page-schema.mapper.ts b/src/app/shared/mappers/registration/page-schema.mapper.ts index e5207c49a..84c57a97f 100644 --- a/src/app/shared/mappers/registration/page-schema.mapper.ts +++ b/src/app/shared/mappers/registration/page-schema.mapper.ts @@ -1,5 +1,7 @@ -import { BlockType, FieldType } from '@osf/shared/enums'; -import { PageSchema, Question, SchemaBlocksResponseJsonApi, Section } from '@osf/shared/models'; +import { BlockType } from '@osf/shared/enums/block-type.enum'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; +import { PageSchema, Question, Section } from '@shared/models/registration/page-schema.model'; +import { SchemaBlocksResponseJsonApi } from '@shared/models/registration/schema-blocks-json-api.model'; export class PageSchemaMapper { static fromSchemaBlocksResponse(response: SchemaBlocksResponseJsonApi): PageSchema[] { diff --git a/src/app/shared/mappers/registration/registration-node.mapper.ts b/src/app/shared/mappers/registration/registration-node.mapper.ts index 8f09fb332..feae85630 100644 --- a/src/app/shared/mappers/registration/registration-node.mapper.ts +++ b/src/app/shared/mappers/registration/registration-node.mapper.ts @@ -1,12 +1,11 @@ -import { CurrentResourceType } from '@osf/shared/enums'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ProviderShortInfoModel } from '@shared/models/provider/provider.model'; +import { RegistryProviderDetailsJsonApi } from '@shared/models/provider/registration-provider-json-api.model'; +import { RegistrationNodeModel, RegistrationResponses } from '@shared/models/registration/registration-node.model'; import { - ProviderShortInfoModel, RegistrationNodeAttributesJsonApi, - RegistrationNodeModel, - RegistrationResponses, RegistrationResponsesJsonApi, - RegistryProviderDetailsJsonApi, -} from '@osf/shared/models'; +} from '@shared/models/registration/registration-node-json-api.model'; export class RegistrationNodeMapper { static getRegistrationNodeAttributes( diff --git a/src/app/shared/mappers/registration/registration.mapper.ts b/src/app/shared/mappers/registration/registration.mapper.ts index 304f49b22..966b9fafa 100644 --- a/src/app/shared/mappers/registration/registration.mapper.ts +++ b/src/app/shared/mappers/registration/registration.mapper.ts @@ -1,13 +1,13 @@ -import { RegistryStatus } from '@osf/shared/enums'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { DraftRegistrationModel } from '@shared/models/registration/draft-registration.model'; +import { RegistrationModel } from '@shared/models/registration/registration.model'; +import { RegistrationCard } from '@shared/models/registration/registration-card.model'; import { DraftRegistrationDataJsonApi, - DraftRegistrationModel, - RegistrationCard, RegistrationDataJsonApi, - RegistrationModel, - SchemaResponse, SchemaResponseDataJsonApi, -} from '@osf/shared/models'; +} from '@shared/models/registration/registration-json-api.model'; +import { SchemaResponse } from '@shared/models/registration/schema-response.model'; import { ContributorsMapper } from '../contributors'; diff --git a/src/app/shared/mappers/request-access/request-access.mapper.ts b/src/app/shared/mappers/request-access/request-access.mapper.ts index 9acfc6849..475d0b8e9 100644 --- a/src/app/shared/mappers/request-access/request-access.mapper.ts +++ b/src/app/shared/mappers/request-access/request-access.mapper.ts @@ -1,5 +1,9 @@ -import { ContributorPermission, RequestAccessTrigger, RequestAccessType } from '@osf/shared/enums'; -import { RequestAccessDataJsonApi, RequestAccessModel, RequestAccessPayload } from '@osf/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { RequestAccessTrigger } from '@osf/shared/enums/request-access-trigger.enum'; +import { RequestAccessType } from '@osf/shared/enums/request-access-type.enum'; +import { RequestAccessModel } from '@shared/models/request-access/request-access.model'; +import { RequestAccessDataJsonApi } from '@shared/models/request-access/request-access-json-api.model'; +import { RequestAccessPayload } from '@shared/models/request-access/request-access-payload.model'; import { UserMapper } from '../user'; diff --git a/src/app/shared/mappers/resource-overview.mappers.ts b/src/app/shared/mappers/resource-overview.mappers.ts index cb4a69622..8a1ef1fac 100644 --- a/src/app/shared/mappers/resource-overview.mappers.ts +++ b/src/app/shared/mappers/resource-overview.mappers.ts @@ -1,7 +1,10 @@ import { ProjectOverview } from '@osf/features/project/overview/models'; import { RegistryOverview } from '@osf/features/registry/models'; -import { ContributorModel, Institution, ResourceOverview, SubjectModel } from '../models'; +import { ContributorModel } from '../models/contributors/contributor.model'; +import { Institution } from '../models/institutions/institutions.models'; +import { ResourceOverview } from '../models/resource-overview.model'; +import { SubjectModel } from '../models/subject/subject.model'; export function MapProjectOverview( project: ProjectOverview, diff --git a/src/app/shared/mappers/review-actions.mapper.ts b/src/app/shared/mappers/review-actions.mapper.ts index 99ec01e80..4e04573e1 100644 --- a/src/app/shared/mappers/review-actions.mapper.ts +++ b/src/app/shared/mappers/review-actions.mapper.ts @@ -1,4 +1,5 @@ -import { ReviewActionPayload, ReviewActionPayloadJsonApi } from '../models/review-action'; +import { ReviewActionPayload } from '../models/review-action/review-action-payload.model'; +import { ReviewActionPayloadJsonApi } from '../models/review-action/review-action-payload-json-api.model'; export class ReviewActionsMapper { static toReviewActionPayloadJsonApi( diff --git a/src/app/shared/mappers/search/search.mapper.ts b/src/app/shared/mappers/search/search.mapper.ts index f36ebbbe2..1ee0cd9a7 100644 --- a/src/app/shared/mappers/search/search.mapper.ts +++ b/src/app/shared/mappers/search/search.mapper.ts @@ -1,10 +1,10 @@ -import { ResourceType } from '@shared/enums'; +import { ResourceType } from '@shared/enums/resource-type.enum'; import { IndexCardDataJsonApi, IndexCardSearchResponseJsonApi, - ResourceModel, SearchResultDataJsonApi, -} from '@shared/models'; +} from '@shared/models/search/index-card-search-json-api.models'; +import { ResourceModel } from '@shared/models/search/resource.model'; export function MapResources(indexCardSearchResponseJsonApi: IndexCardSearchResponseJsonApi): ResourceModel[] { const searchResultIds = indexCardSearchResponseJsonApi.data.relationships.searchResultPage.data.map((obj) => obj.id); diff --git a/src/app/shared/mappers/subjects/subject-mapper.ts b/src/app/shared/mappers/subjects/subject-mapper.ts index 2f36bff8e..2a70f5fcb 100644 --- a/src/app/shared/mappers/subjects/subject-mapper.ts +++ b/src/app/shared/mappers/subjects/subject-mapper.ts @@ -1,4 +1,5 @@ -import { SubjectDataJsonApi, SubjectModel, SubjectsResponseJsonApi } from '@shared/models'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; +import { SubjectDataJsonApi, SubjectsResponseJsonApi } from '@osf/shared/models/subject/subjects-json-api.model'; export class SubjectMapper { static fromSubjectsResponseJsonApi(response: SubjectsResponseJsonApi): SubjectModel[] { diff --git a/src/app/shared/mappers/user-related-counts/user-counts.mapper.ts b/src/app/shared/mappers/user-related-counts/user-counts.mapper.ts index 8d664bcc2..c4ebd518f 100644 --- a/src/app/shared/mappers/user-related-counts/user-counts.mapper.ts +++ b/src/app/shared/mappers/user-related-counts/user-counts.mapper.ts @@ -1,4 +1,5 @@ -import { UserRelatedCounts, UserRelatedCountsResponseJsonApi } from '@osf/shared/models'; +import { UserRelatedCounts } from '@osf/shared/models/user-related-counts/user-related-counts.model'; +import { UserRelatedCountsResponseJsonApi } from '@osf/shared/models/user-related-counts/user-related-counts-json-api.model'; export function MapUserCounts(response: UserRelatedCountsResponseJsonApi): UserRelatedCounts { return { diff --git a/src/app/shared/mappers/user/user.mapper.ts b/src/app/shared/mappers/user/user.mapper.ts index 42d395554..50b7b8b71 100644 --- a/src/app/shared/mappers/user/user.mapper.ts +++ b/src/app/shared/mappers/user/user.mapper.ts @@ -1,12 +1,11 @@ +import { UserData, UserModel } from '@osf/shared/models/user/user.models'; import { UserAcceptedTermsOfServiceJsonApi, UserAttributesJsonApi, - UserData, UserDataErrorResponseJsonApi, UserDataJsonApi, UserDataResponseJsonApi, - UserModel, -} from '@osf/shared/models'; +} from '@osf/shared/models/user/user-json-api.model'; export class UserMapper { static fromUserDataGetResponse(response: UserDataResponseJsonApi): UserData { diff --git a/src/app/shared/mappers/view-only-links.mapper.ts b/src/app/shared/mappers/view-only-links.mapper.ts index 3d56a1c4d..e31b339cc 100644 --- a/src/app/shared/mappers/view-only-links.mapper.ts +++ b/src/app/shared/mappers/view-only-links.mapper.ts @@ -1,10 +1,12 @@ import { PaginatedViewOnlyLinksModel, - ViewOnlyLinkJsonApi, ViewOnlyLinkModel, ViewOnlyLinkNodeModel, +} from '../models/view-only-links/view-only-link.model'; +import { + ViewOnlyLinkJsonApi, ViewOnlyLinksResponseJsonApi, -} from '../models'; +} from '../models/view-only-links/view-only-link-response.model'; import { UserMapper } from './user'; diff --git a/src/app/shared/mappers/wiki/wiki.mapper.ts b/src/app/shared/mappers/wiki/wiki.mapper.ts index e02ed964c..aa79c9911 100644 --- a/src/app/shared/mappers/wiki/wiki.mapper.ts +++ b/src/app/shared/mappers/wiki/wiki.mapper.ts @@ -1,16 +1,16 @@ import { ComponentsWikiGetResponse, - ComponentWiki, HomeWiki, HomeWikiGetResponse, - Wiki, WikiGetResponse, + WikiModel, WikiVersion, WikiVersionJsonApi, -} from '@osf/shared/models'; +} from '@osf/shared/models/wiki/wiki.model'; +import { ComponentWiki } from '@osf/shared/stores/wiki'; export class WikiMapper { - static fromCreateWikiResponse(response: WikiGetResponse): Wiki { + static fromCreateWikiResponse(response: WikiGetResponse): WikiModel { return { id: response.id, name: response.attributes.name, @@ -27,7 +27,7 @@ export class WikiMapper { }; } - static fromGetWikiResponse(response: WikiGetResponse): Wiki { + static fromGetWikiResponse(response: WikiGetResponse): WikiModel { return { id: response.id, name: response.attributes.name, @@ -51,7 +51,7 @@ export class WikiMapper { }; } - static fromCreateWikiVersionResponse(response: WikiGetResponse): Wiki { + static fromCreateWikiVersionResponse(response: WikiGetResponse): WikiModel { return { id: response.id, name: response.attributes.name, diff --git a/src/app/shared/models/activity-logs/activity-logs.model.ts b/src/app/shared/models/activity-logs/activity-logs.model.ts index 44a65a312..1b729eaf0 100644 --- a/src/app/shared/models/activity-logs/activity-logs.model.ts +++ b/src/app/shared/models/activity-logs/activity-logs.model.ts @@ -1,5 +1,5 @@ -import { IdName } from '../common'; -import { LicensesOption } from '../license.model'; +import { IdNameModel } from '../common/id-name.model'; +import { LicensesOption } from '../license/license.model'; export interface ActivityLog { id: string; @@ -10,7 +10,7 @@ export interface ActivityLog { contributors: LogContributor[]; license?: string; tag?: string; - institution?: IdName; + institution?: IdNameModel; paramsNode: { id: string; title: string }; paramsProject: null; pointer: Pointer | null; diff --git a/src/app/shared/models/activity-logs/index.ts b/src/app/shared/models/activity-logs/index.ts deleted file mode 100644 index 93274a749..000000000 --- a/src/app/shared/models/activity-logs/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './activity-log-with-display.model'; -export * from './activity-logs.model'; -export * from './activity-logs-json-api.model'; diff --git a/src/app/shared/models/addons/addon-card.model.ts b/src/app/shared/models/addons/addon-card.model.ts index c5bf0df24..1bc3d0a74 100644 --- a/src/app/shared/models/addons/addon-card.model.ts +++ b/src/app/shared/models/addons/addon-card.model.ts @@ -1,4 +1,5 @@ -import { AddonModel, ConfiguredAddonModel } from '@shared/models'; +import { AddonModel } from './addon.model'; +import { ConfiguredAddonModel } from './configured-addon.model'; export interface AddonCardModel { id: string; diff --git a/src/app/shared/models/addons/addon-utils.models.ts b/src/app/shared/models/addons/addon-utils.models.ts index ac17caac5..2c0194832 100644 --- a/src/app/shared/models/addons/addon-utils.models.ts +++ b/src/app/shared/models/addons/addon-utils.models.ts @@ -1,7 +1,8 @@ import { FormControl } from '@angular/forms'; -import { AddonFormControls, OperationNames } from '@shared/enums'; -import { AuthorizedAccountModel } from '@shared/models'; +import { AddonFormControls } from '@osf/shared/enums/addon-form-controls.enum'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; export interface AddonForm { [AddonFormControls.AccessKey]?: FormControl; diff --git a/src/app/shared/models/addons-query-params.model.ts b/src/app/shared/models/addons/addons-query-params.model.ts similarity index 100% rename from src/app/shared/models/addons-query-params.model.ts rename to src/app/shared/models/addons/addons-query-params.model.ts diff --git a/src/app/shared/models/addons/authorized-account.model.ts b/src/app/shared/models/addons/authorized-account.model.ts index 749621aab..26d4654d5 100644 --- a/src/app/shared/models/addons/authorized-account.model.ts +++ b/src/app/shared/models/addons/authorized-account.model.ts @@ -1,4 +1,4 @@ -import { AddonModel } from '@shared/models'; +import { AddonModel } from './addon.model'; export interface AuthorizedAccountModel extends AddonModel { authUrl: string | null; diff --git a/src/app/shared/models/addons/configured-addon.model.ts b/src/app/shared/models/addons/configured-addon.model.ts index b987d0c74..9c58895fc 100644 --- a/src/app/shared/models/addons/configured-addon.model.ts +++ b/src/app/shared/models/addons/configured-addon.model.ts @@ -1,4 +1,4 @@ -import { AddonModel } from '@shared/models'; +import { AddonModel } from './addon.model'; export interface ConfiguredAddonModel extends AddonModel { connectedCapabilities: string[]; diff --git a/src/app/shared/models/addons/index.ts b/src/app/shared/models/addons/index.ts deleted file mode 100644 index ab6a6d664..000000000 --- a/src/app/shared/models/addons/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from './addon.model'; -export * from './addon-card.model'; -export * from './addon-json-api.models'; -export * from './addon-operations-json-api.models'; -export * from './addon-utils.models'; -export * from './authorized-account.model'; -export * from './configured-addon.model'; -export * from './operation-invocation.model'; -export * from './storage-item.model'; diff --git a/src/app/shared/models/addons/operation-invocation.model.ts b/src/app/shared/models/addons/operation-invocation.model.ts index c12943986..395ab68b1 100644 --- a/src/app/shared/models/addons/operation-invocation.model.ts +++ b/src/app/shared/models/addons/operation-invocation.model.ts @@ -1,4 +1,4 @@ -import { StorageItem } from '@shared/models'; +import { StorageItem } from './storage-item.model'; export interface OperationInvocation { id: string; diff --git a/src/app/shared/models/brand.json-api.model.ts b/src/app/shared/models/brand/brand.json-api.model.ts similarity index 100% rename from src/app/shared/models/brand.json-api.model.ts rename to src/app/shared/models/brand/brand.json-api.model.ts diff --git a/src/app/shared/models/brand.model.ts b/src/app/shared/models/brand/brand.model.ts similarity index 87% rename from src/app/shared/models/brand.model.ts rename to src/app/shared/models/brand/brand.model.ts index 8e0adb77f..77ccdb3e6 100644 --- a/src/app/shared/models/brand.model.ts +++ b/src/app/shared/models/brand/brand.model.ts @@ -1,4 +1,4 @@ -export interface Brand { +export interface BrandModel { id: string; name: string; heroLogoImageUrl: string; diff --git a/src/app/shared/models/charts/index.ts b/src/app/shared/models/charts/index.ts deleted file mode 100644 index 2d34ca989..000000000 --- a/src/app/shared/models/charts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dataset-input'; diff --git a/src/app/shared/models/citations/index.ts b/src/app/shared/models/citations/index.ts deleted file mode 100644 index 2e1e085f4..000000000 --- a/src/app/shared/models/citations/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './citation-style.model'; -export * from './citation-style-json-api.model'; -export * from './custom-citation-payload.model'; -export * from './custom-citation-payload-json-api.model'; -export * from './styled-citation.model'; -export * from './styled-citation-json-api.model'; diff --git a/src/app/shared/models/collections/collections-json-api.models.ts b/src/app/shared/models/collections/collections-json-api.models.ts index aae2c8536..63fbd2eda 100644 --- a/src/app/shared/models/collections/collections-json-api.models.ts +++ b/src/app/shared/models/collections/collections-json-api.models.ts @@ -1,10 +1,8 @@ -import { - BaseNodeDataJsonApi, - BrandDataJsonApi, - CollectionsProviderAttributesJsonApi, - JsonApiResponse, - UserDataErrorResponseJsonApi, -} from '@shared/models'; +import { BrandDataJsonApi } from '../brand/brand.json-api.model'; +import { JsonApiResponse } from '../common/json-api.model'; +import { BaseNodeDataJsonApi } from '../nodes/base-node-data-json-api.model'; +import { CollectionsProviderAttributesJsonApi } from '../provider/collections-provider-json-api.model'; +import { UserDataErrorResponseJsonApi } from '../user/user-json-api.model'; export interface CollectionProviderResponseJsonApi { id: string; diff --git a/src/app/shared/models/collections/collections.models.ts b/src/app/shared/models/collections/collections.models.ts index eba654ae7..887851807 100644 --- a/src/app/shared/models/collections/collections.models.ts +++ b/src/app/shared/models/collections/collections.models.ts @@ -1,8 +1,8 @@ import { CollectionSubmissionReviewAction } from '@osf/features/moderation/models'; -import { Brand } from '../brand.model'; -import { ContributorModel } from '../contributors'; -import { BaseProviderModel } from '../provider'; +import { BrandModel } from '../brand/brand.model'; +import { ContributorModel } from '../contributors/contributor.model'; +import { BaseProviderModel } from '../provider/provider.model'; export interface CollectionProvider extends BaseProviderModel { assets: { @@ -15,7 +15,7 @@ export interface CollectionProvider extends BaseProviderModel { id: string; type: string; }; - brand: Brand | null; + brand: BrandModel | null; } export interface CollectionFilters { diff --git a/src/app/shared/models/collections/index.ts b/src/app/shared/models/collections/index.ts deleted file mode 100644 index 7f8a3362e..000000000 --- a/src/app/shared/models/collections/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './collection-submission-payload.model'; -export * from './collection-submission-payload-json-api.model'; -export * from './collections.models'; -export * from './collections-filters.model'; -export * from './collections-json-api.models'; diff --git a/src/app/shared/models/common/id-name.model.ts b/src/app/shared/models/common/id-name.model.ts index cffbdf870..1ca69b971 100644 --- a/src/app/shared/models/common/id-name.model.ts +++ b/src/app/shared/models/common/id-name.model.ts @@ -1,4 +1,4 @@ -export interface IdName { +export interface IdNameModel { id: string; name: string; } diff --git a/src/app/shared/models/common/index.ts b/src/app/shared/models/common/index.ts deleted file mode 100644 index 3a7369809..000000000 --- a/src/app/shared/models/common/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './id-name.model'; -export * from './id-type.model'; -export * from './json-api.model'; diff --git a/src/app/shared/models/components/component-json-api.model.ts b/src/app/shared/models/components/component-json-api.model.ts index 3e865e94d..6930d78e8 100644 --- a/src/app/shared/models/components/component-json-api.model.ts +++ b/src/app/shared/models/components/component-json-api.model.ts @@ -1,5 +1,5 @@ -import { ContributorDataJsonApi } from '../contributors'; -import { BaseNodeDataJsonApi } from '../nodes'; +import { ContributorDataJsonApi } from '../contributors/contributor-response-json-api.model'; +import { BaseNodeDataJsonApi } from '../nodes/base-node-data-json-api.model'; export interface ComponentGetResponseJsonApi extends BaseNodeDataJsonApi { embeds: { diff --git a/src/app/shared/models/components/components.models.ts b/src/app/shared/models/components/components.models.ts index 64869b1ac..517a7098c 100644 --- a/src/app/shared/models/components/components.models.ts +++ b/src/app/shared/models/components/components.models.ts @@ -1,6 +1,6 @@ -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; -import { ContributorModel } from '../contributors'; +import { ContributorModel } from '../contributors/contributor.model'; export interface ComponentOverview { id: string; diff --git a/src/app/shared/models/components/index.ts b/src/app/shared/models/components/index.ts deleted file mode 100644 index c64708a72..000000000 --- a/src/app/shared/models/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './component-json-api.model'; -export * from './components.models'; diff --git a/src/app/shared/models/contributors/contributor-dialog-add.model.ts b/src/app/shared/models/contributors/contributor-dialog-add.model.ts index 16997aa41..2b634c431 100644 --- a/src/app/shared/models/contributors/contributor-dialog-add.model.ts +++ b/src/app/shared/models/contributors/contributor-dialog-add.model.ts @@ -1,4 +1,4 @@ -import { AddContributorType } from '@osf/shared/enums'; +import { AddContributorType } from '@osf/shared/enums/contributors/add-contributor-type.enum'; import { ContributorAddModel } from './contributor-add.model'; diff --git a/src/app/shared/models/contributors/contributor-response-json-api.model.ts b/src/app/shared/models/contributors/contributor-response-json-api.model.ts index 8563eca08..295d8608c 100644 --- a/src/app/shared/models/contributors/contributor-response-json-api.model.ts +++ b/src/app/shared/models/contributors/contributor-response-json-api.model.ts @@ -1,5 +1,7 @@ -import { ContributorPermission } from '@osf/shared/enums'; -import { ResponseJsonApi, UserDataJsonApi, UserErrorResponseJsonApi } from '@osf/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; + +import { ResponseJsonApi } from '../common/json-api.model'; +import { UserDataJsonApi, UserErrorResponseJsonApi } from '../user/user-json-api.model'; export type ContributorResponseJsonApi = ResponseJsonApi; export type ContributorsResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/contributors/contributor.model.ts b/src/app/shared/models/contributors/contributor.model.ts index 8034565d6..74af72eaa 100644 --- a/src/app/shared/models/contributors/contributor.model.ts +++ b/src/app/shared/models/contributors/contributor.model.ts @@ -1,5 +1,6 @@ -import { ContributorPermission } from '@osf/shared/enums'; -import { Education, Employment } from '@osf/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { Education } from '@osf/shared/models/user/education.model'; +import { Employment } from '@osf/shared/models/user/employment.model'; export interface ContributorModel { id: string; diff --git a/src/app/shared/models/contributors/index.ts b/src/app/shared/models/contributors/index.ts deleted file mode 100644 index 7baca95c9..000000000 --- a/src/app/shared/models/contributors/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './contributor.model'; -export * from './contributor-add.model'; -export * from './contributor-dialog-add.model'; -export * from './contributor-response-json-api.model'; -export * from './unregistered-contributor-form.model'; diff --git a/src/app/shared/models/current-resource.model.ts b/src/app/shared/models/current-resource.model.ts index db1ab3faf..0bd36f242 100644 --- a/src/app/shared/models/current-resource.model.ts +++ b/src/app/shared/models/current-resource.model.ts @@ -1,4 +1,4 @@ -import { UserPermissions } from '../enums'; +import { UserPermissions } from '../enums/user-permissions.enum'; export interface CurrentResource { id: string; diff --git a/src/app/shared/models/emails/account-emails-json-api.model.ts b/src/app/shared/models/emails/account-emails-json-api.model.ts index 6ac4ba918..9abfca42d 100644 --- a/src/app/shared/models/emails/account-emails-json-api.model.ts +++ b/src/app/shared/models/emails/account-emails-json-api.model.ts @@ -1,4 +1,4 @@ -import { ResponseDataJsonApi, ResponseJsonApi } from '@osf/shared/models'; +import { ResponseDataJsonApi, ResponseJsonApi } from '../common/json-api.model'; export type EmailsResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/emails/index.ts b/src/app/shared/models/emails/index.ts deleted file mode 100644 index 7e1b93b2b..000000000 --- a/src/app/shared/models/emails/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './account-email.model'; -export * from './account-emails-json-api.model'; diff --git a/src/app/shared/models/files/file-folder-json-api.model.ts b/src/app/shared/models/files/file-folder-json-api.model.ts index a6d9544af..ce00e4671 100644 --- a/src/app/shared/models/files/file-folder-json-api.model.ts +++ b/src/app/shared/models/files/file-folder-json-api.model.ts @@ -1,6 +1,6 @@ -import { FileKind } from '@osf/shared/enums'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; -import { ResponseJsonApi } from '../common'; +import { ResponseJsonApi } from '../common/json-api.model'; export type FileFolderResponseJsonApi = ResponseJsonApi; export type FileFoldersResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/files/file-folder.model.ts b/src/app/shared/models/files/file-folder.model.ts index fd0477cbd..6b14648fd 100644 --- a/src/app/shared/models/files/file-folder.model.ts +++ b/src/app/shared/models/files/file-folder.model.ts @@ -1,4 +1,4 @@ -import { FileKind } from '@osf/shared/enums'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; export interface FileFolderModel { id: string; diff --git a/src/app/shared/models/files/file-json-api.model.ts b/src/app/shared/models/files/file-json-api.model.ts index dc9db310b..e49c428b6 100644 --- a/src/app/shared/models/files/file-json-api.model.ts +++ b/src/app/shared/models/files/file-json-api.model.ts @@ -1,7 +1,7 @@ -import { FileKind } from '@osf/shared/enums'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; -import { ResponseJsonApi } from '../common'; -import { BaseNodeDataJsonApi } from '../nodes'; +import { ResponseJsonApi } from '../common/json-api.model'; +import { BaseNodeDataJsonApi } from '../nodes/base-node-data-json-api.model'; export type FileResponseJsonApi = ResponseJsonApi; export type FilesResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/files/file-menu-action.model.ts b/src/app/shared/models/files/file-menu-action.model.ts index f151e2f0e..3af0199df 100644 --- a/src/app/shared/models/files/file-menu-action.model.ts +++ b/src/app/shared/models/files/file-menu-action.model.ts @@ -1,4 +1,4 @@ -import { FileMenuType } from '@osf/shared/enums'; +import { FileMenuType } from '@osf/shared/enums/file-menu-type.enum'; export interface FileMenuAction { value: FileMenuType; diff --git a/src/app/shared/models/files/file-version-json-api.model.ts b/src/app/shared/models/files/file-version-json-api.model.ts index 74448c706..ba0ded78a 100644 --- a/src/app/shared/models/files/file-version-json-api.model.ts +++ b/src/app/shared/models/files/file-version-json-api.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@shared/models'; +import { ApiData, JsonApiResponse } from '../common/json-api.model'; export type FileVersionsResponseJsonApi = JsonApiResponse< ApiData[], diff --git a/src/app/shared/models/files/file.model.ts b/src/app/shared/models/files/file.model.ts index 66f138fcf..c60efe6e8 100644 --- a/src/app/shared/models/files/file.model.ts +++ b/src/app/shared/models/files/file.model.ts @@ -1,4 +1,4 @@ -import { BaseNodeModel } from '../nodes'; +import { BaseNodeModel } from '../nodes/base-node.model'; import { FileKind } from './../../enums/file-kind.enum'; diff --git a/src/app/shared/models/files/index.ts b/src/app/shared/models/files/index.ts deleted file mode 100644 index b7b6c2288..000000000 --- a/src/app/shared/models/files/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './file.model'; -export * from './file-folder.model'; -export * from './file-folder-json-api.model'; -export * from './file-json-api.model'; -export * from './file-label.model'; -export * from './file-menu-action.model'; -export * from './file-payload-json-api.model'; -export * from './file-version.model'; -export * from './file-version-json-api.model'; -export * from './resource-files-links.model'; diff --git a/src/app/shared/models/guid-response-json-api.model.ts b/src/app/shared/models/guid-response-json-api.model.ts index 375488956..708c61e77 100644 --- a/src/app/shared/models/guid-response-json-api.model.ts +++ b/src/app/shared/models/guid-response-json-api.model.ts @@ -1,6 +1,6 @@ -import { UserPermissions } from '../enums'; +import { UserPermissions } from '../enums/user-permissions.enum'; -import { JsonApiResponse } from './common'; +import { JsonApiResponse } from './common/json-api.model'; export type GuidedResponseJsonApi = JsonApiResponse; diff --git a/src/app/shared/models/identifiers/identifier-json-api.model.ts b/src/app/shared/models/identifiers/identifier-json-api.model.ts index 9f3b6524b..c62a4d9b5 100644 --- a/src/app/shared/models/identifiers/identifier-json-api.model.ts +++ b/src/app/shared/models/identifiers/identifier-json-api.model.ts @@ -1,4 +1,4 @@ -import { ApiData, ResponseJsonApi } from '@shared/models'; +import { ApiData, ResponseJsonApi } from '../common/json-api.model'; export type IdentifiersResponseJsonApi = ResponseJsonApi; export type IdentifiersJsonApiData = ApiData; diff --git a/src/app/shared/models/identifiers/identifier.model.ts b/src/app/shared/models/identifiers/identifier.model.ts index c15b35688..3095322ee 100644 --- a/src/app/shared/models/identifiers/identifier.model.ts +++ b/src/app/shared/models/identifiers/identifier.model.ts @@ -1,4 +1,4 @@ -export interface Identifier { +export interface IdentifierModel { id: string; type: string; category: string; diff --git a/src/app/shared/models/identifiers/index.ts b/src/app/shared/models/identifiers/index.ts deleted file mode 100644 index 7b4388155..000000000 --- a/src/app/shared/models/identifiers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './identifier.model'; -export * from './identifier-json-api.model'; diff --git a/src/app/shared/models/index.ts b/src/app/shared/models/index.ts deleted file mode 100644 index 789b99b07..000000000 --- a/src/app/shared/models/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -export * from './activity-logs'; -export * from './addons'; -export * from './addons-query-params.model'; -export * from './brand.json-api.model'; -export * from './brand.model'; -export * from './can-deactivate.interface'; -export * from './charts'; -export * from './citations'; -export * from './collections'; -export * from './common'; -export * from './component-checkbox-item.model'; -export * from './components'; -export * from './confirmation-options.model'; -export * from './contributors'; -export * from './create-component-form.model'; -export * from './current-resource.model'; -export * from './emails'; -export * from './files'; -export * from './google-drive-folder.model'; -export * from './guid-response-json-api.model'; -export * from './identifiers'; -export * from './institutions'; -export * from './language-code.model'; -export * from './license'; -export * from './license.model'; -export * from './licenses-json-api.model'; -export * from './meta-tags'; -export * from './metadata-tabs.model'; -export * from './my-resources'; -export * from './nodes'; -export * from './notifications'; -export * from './paginated-data.model'; -export * from './pagination-links.model'; -export * from './profile-settings-update.model'; -export * from './project-metadata-update-payload.model'; -export * from './projects'; -export * from './provider'; -export * from './query-params.model'; -export * from './regions'; -export * from './registration'; -export * from './request-access'; -export * from './resource-metadata.model'; -export * from './resource-overview.model'; -export * from './search'; -export * from './search-filters.model'; -export * from './select-option.model'; -export * from './severity.type'; -export * from './socials'; -export * from './status-info.model'; -export * from './step-option.model'; -export * from './store'; -export * from './subject'; -export * from './tab-option.model'; -export * from './table-parameters.model'; -export * from './toolbar-resource.model'; -export * from './tooltip-position.model'; -export * from './tutorial-step.model'; -export * from './user'; -export * from './user-related-counts'; -export * from './validation-params.model'; -export * from './view-only-links'; -export * from './wiki'; diff --git a/src/app/shared/models/institutions/index.ts b/src/app/shared/models/institutions/index.ts deleted file mode 100644 index 1078a676e..000000000 --- a/src/app/shared/models/institutions/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './institution-json-api.model'; -export * from './institutions.models'; diff --git a/src/app/shared/models/institutions/institution-json-api.model.ts b/src/app/shared/models/institutions/institution-json-api.model.ts index 9cadd88df..16f4b4226 100644 --- a/src/app/shared/models/institutions/institution-json-api.model.ts +++ b/src/app/shared/models/institutions/institution-json-api.model.ts @@ -1,4 +1,6 @@ -import { ApiData, InstitutionAssets, JsonApiResponse, ResponseJsonApi } from '@shared/models'; +import { ApiData, JsonApiResponse, ResponseJsonApi } from '../common/json-api.model'; + +import { InstitutionAssets } from './institutions.models'; export type InstitutionsJsonApiResponse = JsonApiResponse; export type InstitutionsWithMetaJsonApiResponse = ResponseJsonApi; diff --git a/src/app/shared/models/license/index.ts b/src/app/shared/models/license/index.ts deleted file mode 100644 index 10c39d296..000000000 --- a/src/app/shared/models/license/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './license-form.models'; diff --git a/src/app/shared/models/license.model.ts b/src/app/shared/models/license/license.model.ts similarity index 100% rename from src/app/shared/models/license.model.ts rename to src/app/shared/models/license/license.model.ts diff --git a/src/app/shared/models/licenses-json-api.model.ts b/src/app/shared/models/license/licenses-json-api.model.ts similarity index 84% rename from src/app/shared/models/licenses-json-api.model.ts rename to src/app/shared/models/license/licenses-json-api.model.ts index 38cdd75c1..62dac41ce 100644 --- a/src/app/shared/models/licenses-json-api.model.ts +++ b/src/app/shared/models/license/licenses-json-api.model.ts @@ -1,4 +1,4 @@ -import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from './common'; +import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common/json-api.model'; export interface LicensesResponseJsonApi { data: LicenseDataJsonApi[]; diff --git a/src/app/shared/models/meta-tags/index.ts b/src/app/shared/models/meta-tags/index.ts deleted file mode 100644 index 3a2e07d5e..000000000 --- a/src/app/shared/models/meta-tags/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './head-tag-def.model'; -export * from './meta-tag-author.model'; -export * from './meta-tags-data.model'; diff --git a/src/app/shared/models/metadata-tabs.model.ts b/src/app/shared/models/metadata-tabs.model.ts index 6f48b1db2..36e952364 100644 --- a/src/app/shared/models/metadata-tabs.model.ts +++ b/src/app/shared/models/metadata-tabs.model.ts @@ -1,4 +1,4 @@ -import { MetadataResourceEnum } from '../enums'; +import { MetadataResourceEnum } from '../enums/metadata-resource.enum'; export interface MetadataTabsModel { id: string | 'osf'; diff --git a/src/app/shared/models/my-resources/index.ts b/src/app/shared/models/my-resources/index.ts deleted file mode 100644 index e007cc622..000000000 --- a/src/app/shared/models/my-resources/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './my-resources.models'; -export * from './my-resources-endpoint.type'; -export * from './my-resources-search-filters.models'; diff --git a/src/app/shared/models/my-resources/my-resources-search-filters.models.ts b/src/app/shared/models/my-resources/my-resources-search-filters.models.ts index d148d0c25..3e36d41b2 100644 --- a/src/app/shared/models/my-resources/my-resources-search-filters.models.ts +++ b/src/app/shared/models/my-resources/my-resources-search-filters.models.ts @@ -1,4 +1,4 @@ -import { SortOrder } from '@shared/enums'; +import { SortOrder } from '@shared/enums/sort-order.enum'; export type SearchField = 'tags' | 'title' | 'description'; diff --git a/src/app/shared/models/my-resources/my-resources.models.ts b/src/app/shared/models/my-resources/my-resources.models.ts index e5f268377..6503e5fe2 100644 --- a/src/app/shared/models/my-resources/my-resources.models.ts +++ b/src/app/shared/models/my-resources/my-resources.models.ts @@ -1,4 +1,6 @@ -import { ContributorDataJsonApi, ContributorModel, ResponseJsonApi } from '@shared/models'; +import { ResponseJsonApi } from '../common/json-api.model'; +import { ContributorModel } from '../contributors/contributor.model'; +import { ContributorDataJsonApi } from '../contributors/contributor-response-json-api.model'; export type MyResourcesItemResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/node-links/index.ts b/src/app/shared/models/node-links/index.ts deleted file mode 100644 index 90243b652..000000000 --- a/src/app/shared/models/node-links/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './node-link.model'; -export * from './node-link-json-api.model'; diff --git a/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts b/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts index 0c7491853..416cf0b6c 100644 --- a/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts +++ b/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts @@ -1,4 +1,4 @@ -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; export interface BaseNodeAttributesJsonApi { access_requests_enabled: boolean; diff --git a/src/app/shared/models/nodes/base-node-data-json-api.model.ts b/src/app/shared/models/nodes/base-node-data-json-api.model.ts index 89dfe5693..2c245943a 100644 --- a/src/app/shared/models/nodes/base-node-data-json-api.model.ts +++ b/src/app/shared/models/nodes/base-node-data-json-api.model.ts @@ -1,6 +1,5 @@ -import { BaseNodeEmbedsJsonApi } from '@shared/models'; - import { BaseNodeAttributesJsonApi } from './base-node-attributes-json-api.model'; +import { BaseNodeEmbedsJsonApi } from './base-node-embeds-json-api.model'; import { BaseNodeLinksJsonApi } from './base-node-links-json-api.model'; import { BaseNodeRelationships } from './base-node-relationships-json-api.model'; diff --git a/src/app/shared/models/nodes/base-node-embeds-json-api.model.ts b/src/app/shared/models/nodes/base-node-embeds-json-api.model.ts index ae0c580be..9d669401c 100644 --- a/src/app/shared/models/nodes/base-node-embeds-json-api.model.ts +++ b/src/app/shared/models/nodes/base-node-embeds-json-api.model.ts @@ -1,12 +1,10 @@ -import { - BaseNodeDataJsonApi, - ContributorDataJsonApi, - IdentifierAttributes, - IdentifiersJsonApiData, - InstitutionDataJsonApi, - LicenseDataJsonApi, - RegionDataJsonApi, -} from '@shared/models'; +import { ContributorDataJsonApi } from '../contributors/contributor-response-json-api.model'; +import { IdentifierAttributes, IdentifiersJsonApiData } from '../identifiers/identifier-json-api.model'; +import { InstitutionDataJsonApi } from '../institutions/institution-json-api.model'; +import { LicenseDataJsonApi } from '../license/licenses-json-api.model'; +import { RegionDataJsonApi } from '../regions/regions.json-api.model'; + +import { BaseNodeDataJsonApi } from './base-node-data-json-api.model'; export interface BaseNodeEmbedsJsonApi { affiliated_institutions?: { diff --git a/src/app/shared/models/nodes/base-node.model.ts b/src/app/shared/models/nodes/base-node.model.ts index 0ef9ccb0d..eabe83d65 100644 --- a/src/app/shared/models/nodes/base-node.model.ts +++ b/src/app/shared/models/nodes/base-node.model.ts @@ -1,6 +1,6 @@ -import { ContributorModel } from '@shared/models'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; -import { LicensesOption } from '../license.model'; +import { LicensesOption } from '../license/license.model'; export interface BaseNodeModel { id: string; diff --git a/src/app/shared/models/nodes/index.ts b/src/app/shared/models/nodes/index.ts deleted file mode 100644 index 6f4b86606..000000000 --- a/src/app/shared/models/nodes/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './base-node.model'; -export * from './base-node-attributes-json-api.model'; -export * from './base-node-data-json-api.model'; -export * from './base-node-embeds-json-api.model'; -export * from './base-node-links-json-api.model'; -export * from './base-node-relationships-json-api.model'; -export * from './node-with-children.model'; -export * from './nodes-json-api.model'; diff --git a/src/app/shared/models/nodes/node-with-children.model.ts b/src/app/shared/models/nodes/node-with-children.model.ts index aef8c02bc..273e7c268 100644 --- a/src/app/shared/models/nodes/node-with-children.model.ts +++ b/src/app/shared/models/nodes/node-with-children.model.ts @@ -1,4 +1,4 @@ -import { UserPermissions } from '@osf/shared/enums'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; export interface NodeShortInfoModel { id: string; diff --git a/src/app/shared/models/nodes/nodes-json-api.model.ts b/src/app/shared/models/nodes/nodes-json-api.model.ts index 82b4ae0a6..a991acf70 100644 --- a/src/app/shared/models/nodes/nodes-json-api.model.ts +++ b/src/app/shared/models/nodes/nodes-json-api.model.ts @@ -1,4 +1,4 @@ -import { ResponseJsonApi } from '../common'; +import { ResponseJsonApi } from '../common/json-api.model'; import { BaseNodeDataJsonApi } from './base-node-data-json-api.model'; diff --git a/src/app/shared/models/notifications/index.ts b/src/app/shared/models/notifications/index.ts deleted file mode 100644 index 91dcdba7c..000000000 --- a/src/app/shared/models/notifications/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './notification-subscription.model'; -export * from './notification-subscription-json-api.model'; diff --git a/src/app/shared/models/notifications/notification-subscription-json-api.model.ts b/src/app/shared/models/notifications/notification-subscription-json-api.model.ts index a3afd5695..61bc1781b 100644 --- a/src/app/shared/models/notifications/notification-subscription-json-api.model.ts +++ b/src/app/shared/models/notifications/notification-subscription-json-api.model.ts @@ -1,4 +1,4 @@ -import { SubscriptionFrequency } from '@osf/shared/enums'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; export interface NotificationSubscriptionGetResponseJsonApi { id: string; diff --git a/src/app/shared/models/notifications/notification-subscription.model.ts b/src/app/shared/models/notifications/notification-subscription.model.ts index 7cbefa654..931bde2f2 100644 --- a/src/app/shared/models/notifications/notification-subscription.model.ts +++ b/src/app/shared/models/notifications/notification-subscription.model.ts @@ -1,4 +1,5 @@ -import { SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; export interface NotificationSubscription { id: string; diff --git a/src/app/shared/models/profile-settings-update.model.ts b/src/app/shared/models/profile-settings-update.model.ts index df4068c77..a80257609 100644 --- a/src/app/shared/models/profile-settings-update.model.ts +++ b/src/app/shared/models/profile-settings-update.model.ts @@ -1,4 +1,7 @@ -import { Education, Employment, SocialModel, UserModel } from './user'; +import { Education } from './user/education.model'; +import { Employment } from './user/employment.model'; +import { SocialModel } from './user/social.model'; +import { UserModel } from './user/user.models'; export type ProfileSettingsUpdate = | Partial[] diff --git a/src/app/shared/models/project-metadata-update-payload.model.ts b/src/app/shared/models/project-metadata-update-payload.model.ts index d74e14fa2..c8ecb81a7 100644 --- a/src/app/shared/models/project-metadata-update-payload.model.ts +++ b/src/app/shared/models/project-metadata-update-payload.model.ts @@ -1,4 +1,4 @@ -import { LicenseOptions } from './license.model'; +import { LicenseOptions } from './license/license.model'; export interface ProjectMetadataUpdatePayload { id: string; diff --git a/src/app/shared/models/projects/create-project-form.model.ts b/src/app/shared/models/projects/create-project-form.model.ts index 9eb174c5d..4575b3572 100644 --- a/src/app/shared/models/projects/create-project-form.model.ts +++ b/src/app/shared/models/projects/create-project-form.model.ts @@ -1,6 +1,6 @@ import { FormControl } from '@angular/forms'; -import { ProjectFormControls } from '@shared/enums'; +import { ProjectFormControls } from '@osf/shared/enums/create-project-form-controls.enum'; export interface ProjectForm { [ProjectFormControls.Title]: FormControl; diff --git a/src/app/shared/models/projects/index.ts b/src/app/shared/models/projects/index.ts deleted file mode 100644 index ee6b89a9f..000000000 --- a/src/app/shared/models/projects/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './create-project-form.model'; -export * from './projects.models'; -export * from './projects-json-api.models'; diff --git a/src/app/shared/models/projects/projects-json-api.models.ts b/src/app/shared/models/projects/projects-json-api.models.ts index 7336470ad..f8522ccf4 100644 --- a/src/app/shared/models/projects/projects-json-api.models.ts +++ b/src/app/shared/models/projects/projects-json-api.models.ts @@ -1,5 +1,5 @@ -import { JsonApiResponse, MetaJsonApi, PaginationLinksJsonApi } from '../common'; -import { LicenseRecordJsonApi } from '../licenses-json-api.model'; +import { JsonApiResponse, MetaJsonApi, PaginationLinksJsonApi } from '../common/json-api.model'; +import { LicenseRecordJsonApi } from '../license/licenses-json-api.model'; export interface ProjectJsonApi { id: string; diff --git a/src/app/shared/models/projects/projects.models.ts b/src/app/shared/models/projects/projects.models.ts index 68be33269..cbb49d689 100644 --- a/src/app/shared/models/projects/projects.models.ts +++ b/src/app/shared/models/projects/projects.models.ts @@ -1,6 +1,6 @@ -import { StringOrNull } from '@osf/shared/helpers'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; -import { LicenseOptions } from '../license.model'; +import { LicenseOptions } from '../license/license.model'; export interface ProjectModel { id: string; diff --git a/src/app/shared/models/provider/base-provider-json-api.model.ts b/src/app/shared/models/provider/base-provider-json-api.model.ts index 09c066b9c..29ab8c054 100644 --- a/src/app/shared/models/provider/base-provider-json-api.model.ts +++ b/src/app/shared/models/provider/base-provider-json-api.model.ts @@ -1,4 +1,4 @@ -import { ReviewPermissions } from '@osf/shared/enums'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; export interface BaseProviderAttributesJsonApi { advisory_board: string; diff --git a/src/app/shared/models/provider/index.ts b/src/app/shared/models/provider/index.ts deleted file mode 100644 index 5968ef0a6..000000000 --- a/src/app/shared/models/provider/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './base-provider-json-api.model'; -export * from './collections-provider-json-api.model'; -export * from './preprints-provider-json-api.model'; -export * from './provider.model'; -export * from './providers-json-api.model'; -export * from './registration-provider-json-api.model'; -export * from './registry-provider.model'; diff --git a/src/app/shared/models/provider/provider.model.ts b/src/app/shared/models/provider/provider.model.ts index 68b9a860b..4ee7774f6 100644 --- a/src/app/shared/models/provider/provider.model.ts +++ b/src/app/shared/models/provider/provider.model.ts @@ -1,4 +1,5 @@ -import { CurrentResourceType, ReviewPermissions } from '@osf/shared/enums'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; export interface ProviderShortInfoModel { id: string; diff --git a/src/app/shared/models/provider/providers-json-api.model.ts b/src/app/shared/models/provider/providers-json-api.model.ts index c31bb99f4..7ed7a2ac5 100644 --- a/src/app/shared/models/provider/providers-json-api.model.ts +++ b/src/app/shared/models/provider/providers-json-api.model.ts @@ -1,6 +1,6 @@ -import { ReviewPermissions } from '@osf/shared/enums'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; -import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common'; +import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common/json-api.model'; export interface ProvidersResponseJsonApi { data: ProviderDataJsonApi[]; diff --git a/src/app/shared/models/provider/registration-provider-json-api.model.ts b/src/app/shared/models/provider/registration-provider-json-api.model.ts index b78154747..7135381b3 100644 --- a/src/app/shared/models/provider/registration-provider-json-api.model.ts +++ b/src/app/shared/models/provider/registration-provider-json-api.model.ts @@ -1,4 +1,4 @@ -import { BrandDataJsonApi } from '../brand.json-api.model'; +import { BrandDataJsonApi } from '../brand/brand.json-api.model'; import { BaseProviderAttributesJsonApi } from './base-provider-json-api.model'; diff --git a/src/app/shared/models/provider/registry-provider.model.ts b/src/app/shared/models/provider/registry-provider.model.ts index c42f193e3..fabd9d824 100644 --- a/src/app/shared/models/provider/registry-provider.model.ts +++ b/src/app/shared/models/provider/registry-provider.model.ts @@ -1,12 +1,13 @@ -import { ReviewPermissions } from '@osf/shared/enums'; -import { Brand } from '@shared/models'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; + +import { BrandModel } from '../brand/brand.model'; export interface RegistryProviderDetails { id: string; name: string; descriptionHtml: string; permissions: ReviewPermissions[]; - brand: Brand | null; + brand: BrandModel | null; iri: string; reviewsWorkflow: string; } diff --git a/src/app/shared/models/query-params.model.ts b/src/app/shared/models/query-params.model.ts index 2c70770d2..3a2567f88 100644 --- a/src/app/shared/models/query-params.model.ts +++ b/src/app/shared/models/query-params.model.ts @@ -1,4 +1,4 @@ -import { SortOrder } from '@shared/enums'; +import { SortOrder } from '@shared/enums/sort-order.enum'; export interface QueryParams { page: number; diff --git a/src/app/shared/models/regions/index.ts b/src/app/shared/models/regions/index.ts deleted file mode 100644 index a87050d50..000000000 --- a/src/app/shared/models/regions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './regions.json-api.model'; diff --git a/src/app/shared/models/regions/regions.json-api.model.ts b/src/app/shared/models/regions/regions.json-api.model.ts index 290151b26..87645a2ae 100644 --- a/src/app/shared/models/regions/regions.json-api.model.ts +++ b/src/app/shared/models/regions/regions.json-api.model.ts @@ -1,4 +1,4 @@ -import { ResponseJsonApi } from '../common'; +import { ResponseJsonApi } from '../common/json-api.model'; export type RegionsResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/registration/draft-registration.model.ts b/src/app/shared/models/registration/draft-registration.model.ts index 1e56b9efd..4d0230e0d 100644 --- a/src/app/shared/models/registration/draft-registration.model.ts +++ b/src/app/shared/models/registration/draft-registration.model.ts @@ -1,7 +1,7 @@ -import { UserPermissions } from '@shared/enums'; +import { UserPermissions } from '@shared/enums/user-permissions.enum'; -import { LicenseOptions } from '../license.model'; -import { ProjectModel } from '../projects'; +import { LicenseOptions } from '../license/license.model'; +import { ProjectModel } from '../projects/projects.models'; export interface DraftRegistrationModel { id: string; diff --git a/src/app/shared/models/registration/index.ts b/src/app/shared/models/registration/index.ts deleted file mode 100644 index 26cb515b6..000000000 --- a/src/app/shared/models/registration/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './draft-registration.model'; -export * from './page-schema.model'; -export * from './provider-schema.model'; -export * from './registration.model'; -export * from './registration-card.model'; -export * from './registration-json-api.model'; -export * from './registration-node.model'; -export * from './registration-node-json-api.model'; -export * from './schema-blocks-json-api.model'; -export * from './schema-response.model'; diff --git a/src/app/shared/models/registration/page-schema.model.ts b/src/app/shared/models/registration/page-schema.model.ts index a235f5a92..0325972f4 100644 --- a/src/app/shared/models/registration/page-schema.model.ts +++ b/src/app/shared/models/registration/page-schema.model.ts @@ -1,4 +1,4 @@ -import { FieldType } from '@osf/shared/enums'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; export interface PageSchema { id: string; diff --git a/src/app/shared/models/registration/registration-card.model.ts b/src/app/shared/models/registration/registration-card.model.ts index af67f9011..65c5dd6cd 100644 --- a/src/app/shared/models/registration/registration-card.model.ts +++ b/src/app/shared/models/registration/registration-card.model.ts @@ -1,6 +1,9 @@ -import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates, UserPermissions } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; -import { ContributorModel } from '../contributors'; +import { ContributorModel } from '../contributors/contributor.model'; export interface RegistrationCard { id: string; diff --git a/src/app/shared/models/registration/registration-json-api.model.ts b/src/app/shared/models/registration/registration-json-api.model.ts index 3b710fffb..1a6d64e12 100644 --- a/src/app/shared/models/registration/registration-json-api.model.ts +++ b/src/app/shared/models/registration/registration-json-api.model.ts @@ -1,8 +1,10 @@ -import { RegistrationReviewStates, RevisionReviewStates, UserPermissions } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; -import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common'; -import { ContributorDataJsonApi } from '../contributors'; -import { LicenseRecordJsonApi } from '../licenses-json-api.model'; +import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common/json-api.model'; +import { ContributorDataJsonApi } from '../contributors/contributor-response-json-api.model'; +import { LicenseRecordJsonApi } from '../license/licenses-json-api.model'; export interface DraftRegistrationResponseJsonApi { data: DraftRegistrationDataJsonApi; diff --git a/src/app/shared/models/registration/registration-node-json-api.model.ts b/src/app/shared/models/registration/registration-node-json-api.model.ts index f7f19b08d..f8402b799 100644 --- a/src/app/shared/models/registration/registration-node-json-api.model.ts +++ b/src/app/shared/models/registration/registration-node-json-api.model.ts @@ -1,6 +1,7 @@ -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; -import { BaseNodeAttributesJsonApi } from '../nodes'; +import { BaseNodeAttributesJsonApi } from '../nodes/base-node-attributes-json-api.model'; export interface RegistrationNodeAttributesJsonApi extends BaseNodeAttributesJsonApi { archiving: boolean; diff --git a/src/app/shared/models/registration/registration-node.model.ts b/src/app/shared/models/registration/registration-node.model.ts index 08f80bce3..9f7dda0f2 100644 --- a/src/app/shared/models/registration/registration-node.model.ts +++ b/src/app/shared/models/registration/registration-node.model.ts @@ -1,6 +1,7 @@ -import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; -import { BaseNodeModel } from '../nodes'; +import { BaseNodeModel } from '../nodes/base-node.model'; export interface RegistrationNodeModel extends BaseNodeModel { archiving: boolean; diff --git a/src/app/shared/models/registration/registration.model.ts b/src/app/shared/models/registration/registration.model.ts index 864605bb3..5178078b8 100644 --- a/src/app/shared/models/registration/registration.model.ts +++ b/src/app/shared/models/registration/registration.model.ts @@ -1,9 +1,10 @@ -import { RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; -import { IdTypeModel } from '../common'; -import { ContributorModel } from '../contributors'; -import { LicensesOption } from '../license.model'; -import { SubjectModel } from '../subject'; +import { IdTypeModel } from '../common/id-type.model'; +import { ContributorModel } from '../contributors/contributor.model'; +import { LicensesOption } from '../license/license.model'; +import { SubjectModel } from '../subject/subject.model'; export type RegistrationQuestions = Record; diff --git a/src/app/shared/models/registration/schema-blocks-json-api.model.ts b/src/app/shared/models/registration/schema-blocks-json-api.model.ts index ac6241eb1..f9c03177b 100644 --- a/src/app/shared/models/registration/schema-blocks-json-api.model.ts +++ b/src/app/shared/models/registration/schema-blocks-json-api.model.ts @@ -1,6 +1,6 @@ -import { BlockType } from '@osf/shared/enums'; +import { BlockType } from '@osf/shared/enums/block-type.enum'; -import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common'; +import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common/json-api.model'; export interface SchemaBlocksResponseJsonApi { data: SchemaBlockJsonApi[]; diff --git a/src/app/shared/models/registration/schema-response.model.ts b/src/app/shared/models/registration/schema-response.model.ts index 9aacbe3f4..085c8fddc 100644 --- a/src/app/shared/models/registration/schema-response.model.ts +++ b/src/app/shared/models/registration/schema-response.model.ts @@ -1,4 +1,4 @@ -import { RevisionReviewStates } from '@osf/shared/enums'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; export interface SchemaResponse { id: string; diff --git a/src/app/shared/models/request-access/index.ts b/src/app/shared/models/request-access/index.ts deleted file mode 100644 index 6cdbb5f96..000000000 --- a/src/app/shared/models/request-access/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './request-access.model'; -export * from './request-access-json-api.model'; -export * from './request-access-payload.model'; diff --git a/src/app/shared/models/request-access/request-access-json-api.model.ts b/src/app/shared/models/request-access/request-access-json-api.model.ts index 02539ed84..83765b57e 100644 --- a/src/app/shared/models/request-access/request-access-json-api.model.ts +++ b/src/app/shared/models/request-access/request-access-json-api.model.ts @@ -1,7 +1,7 @@ -import { ContributorPermission } from '@osf/shared/enums'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; -import { ResponseJsonApi } from '../common'; -import { UserDataErrorResponseJsonApi } from '../user'; +import { ResponseJsonApi } from '../common/json-api.model'; +import { UserDataErrorResponseJsonApi } from '../user/user-json-api.model'; export type RequestAccessResponseJsonApi = ResponseJsonApi; diff --git a/src/app/shared/models/request-access/request-access-payload.model.ts b/src/app/shared/models/request-access/request-access-payload.model.ts index d1617aed2..18c32a379 100644 --- a/src/app/shared/models/request-access/request-access-payload.model.ts +++ b/src/app/shared/models/request-access/request-access-payload.model.ts @@ -1,4 +1,4 @@ -import { ContributorPermission } from '@osf/shared/enums'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; export interface RequestAccessPayload { permissions: ContributorPermission; diff --git a/src/app/shared/models/request-access/request-access.model.ts b/src/app/shared/models/request-access/request-access.model.ts index a7752b795..0b3b5cf39 100644 --- a/src/app/shared/models/request-access/request-access.model.ts +++ b/src/app/shared/models/request-access/request-access.model.ts @@ -1,6 +1,6 @@ -import { ContributorPermission } from '@osf/shared/enums'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; -import { UserModel } from '../user'; +import { UserModel } from '../user/user.models'; export interface RequestAccessModel { id: string; diff --git a/src/app/shared/models/resource-metadata.model.ts b/src/app/shared/models/resource-metadata.model.ts index 411f6a845..b187fdb9a 100644 --- a/src/app/shared/models/resource-metadata.model.ts +++ b/src/app/shared/models/resource-metadata.model.ts @@ -1,4 +1,4 @@ -import { Identifier } from './identifiers'; +import { IdentifierModel } from './identifiers/identifier.model'; export interface ResourceMetadata { title: string; @@ -7,7 +7,7 @@ export interface ResourceMetadata { dateModified: Date; language: string; resourceTypeGeneral: string; - identifiers: Identifier[]; + identifiers: IdentifierModel[]; funders: { funderName: string; funderIdentifier: string; diff --git a/src/app/shared/models/resource-overview.model.ts b/src/app/shared/models/resource-overview.model.ts index 7d0dfa7ff..0b0bf5a16 100644 --- a/src/app/shared/models/resource-overview.model.ts +++ b/src/app/shared/models/resource-overview.model.ts @@ -1,9 +1,9 @@ -import { IdTypeModel } from './common'; -import { ContributorModel } from './contributors'; -import { Identifier } from './identifiers'; -import { Institution } from './institutions'; -import { LicensesOption } from './license.model'; -import { SubjectModel } from './subject'; +import { IdTypeModel } from './common/id-type.model'; +import { ContributorModel } from './contributors/contributor.model'; +import { IdentifierModel } from './identifiers/identifier.model'; +import { Institution } from './institutions/institutions.models'; +import { LicensesOption } from './license/license.model'; +import { SubjectModel } from './subject/subject.model'; export interface ResourceOverview { id: string; @@ -33,7 +33,7 @@ export interface ResourceOverview { storageLimitStatus: string; storageUsage: string; }; - identifiers?: Identifier[]; + identifiers?: IdentifierModel[]; supplements?: { id: string; type: string; diff --git a/src/app/shared/models/review-action/index.ts b/src/app/shared/models/review-action/index.ts deleted file mode 100644 index 5caee8c27..000000000 --- a/src/app/shared/models/review-action/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './review-action-payload.model'; -export * from './review-action-payload-json-api.model'; diff --git a/src/app/shared/models/review-action/review-action-payload-json-api.model.ts b/src/app/shared/models/review-action/review-action-payload-json-api.model.ts index 308b3d7f0..4b13022dd 100644 --- a/src/app/shared/models/review-action/review-action-payload-json-api.model.ts +++ b/src/app/shared/models/review-action/review-action-payload-json-api.model.ts @@ -1,4 +1,4 @@ -import { ReviewActionTrigger } from '@osf/shared/enums'; +import { ReviewActionTrigger } from '@osf/shared/enums/trigger-action.enum'; export interface ReviewActionPayloadJsonApi { data: { diff --git a/src/app/shared/models/review-action/review-action-payload.model.ts b/src/app/shared/models/review-action/review-action-payload.model.ts index 54360e253..b32b1de71 100644 --- a/src/app/shared/models/review-action/review-action-payload.model.ts +++ b/src/app/shared/models/review-action/review-action-payload.model.ts @@ -1,4 +1,4 @@ -import { ReviewActionTrigger } from '@osf/shared/enums'; +import { ReviewActionTrigger } from '@osf/shared/enums/trigger-action.enum'; export interface ReviewActionPayload { targetId: string; diff --git a/src/app/shared/models/search-filters.model.ts b/src/app/shared/models/search-filters.model.ts index 1ce3562c3..1c7ecdb77 100644 --- a/src/app/shared/models/search-filters.model.ts +++ b/src/app/shared/models/search-filters.model.ts @@ -1,4 +1,4 @@ -import { SortOrder } from '@shared/enums'; +import { SortOrder } from '../enums/sort-order.enum'; export interface SearchFilters { searchValue: string; diff --git a/src/app/shared/models/search/discaverable-filter.model.ts b/src/app/shared/models/search/discaverable-filter.model.ts index 1f0b5259e..fb313ee49 100644 --- a/src/app/shared/models/search/discaverable-filter.model.ts +++ b/src/app/shared/models/search/discaverable-filter.model.ts @@ -1,7 +1,7 @@ export interface DiscoverableFilter { key: string; label: string; - operator: FilterOperator; + operator: FilterOperatorOption; options?: FilterOption[]; description?: string; helpLink?: string; @@ -13,7 +13,7 @@ export interface DiscoverableFilter { isSearchLoading?: boolean; } -export enum FilterOperator { +export enum FilterOperatorOption { AnyOf = 'any-of', Date = 'trove:at-date', IsPresent = 'is-present', diff --git a/src/app/shared/models/search/filter-options-json-api.models.ts b/src/app/shared/models/search/filter-options-json-api.models.ts index 256be1d45..d9de2d9dd 100644 --- a/src/app/shared/models/search/filter-options-json-api.models.ts +++ b/src/app/shared/models/search/filter-options-json-api.models.ts @@ -1,6 +1,6 @@ -import { SearchResultDataJsonApi } from '@shared/models'; +import { ApiData } from '../common/json-api.model'; -import { ApiData } from '../common'; +import { SearchResultDataJsonApi } from './index-card-search-json-api.models'; export interface FilterOptionsResponseJsonApi { data: FilterOptionsResponseData; diff --git a/src/app/shared/models/search/index-card-search-json-api.models.ts b/src/app/shared/models/search/index-card-search-json-api.models.ts index 340e4359e..331f98d75 100644 --- a/src/app/shared/models/search/index-card-search-json-api.models.ts +++ b/src/app/shared/models/search/index-card-search-json-api.models.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '@shared/models'; +import { ApiData, JsonApiResponse } from '../common/json-api.model'; export type IndexCardSearchResponseJsonApi = JsonApiResponse< { diff --git a/src/app/shared/models/search/index.ts b/src/app/shared/models/search/index.ts deleted file mode 100644 index 17f45f1de..000000000 --- a/src/app/shared/models/search/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './discaverable-filter.model'; -export * from './filter-options-json-api.models'; -export * from './index-card-search-json-api.models'; -export * from './resource.model'; diff --git a/src/app/shared/models/search/resource.model.ts b/src/app/shared/models/search/resource.model.ts index 542c095da..d5b9ba320 100644 --- a/src/app/shared/models/search/resource.model.ts +++ b/src/app/shared/models/search/resource.model.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@osf/shared/enums'; -import { StringOrNull } from '@shared/helpers'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; import { DiscoverableFilter } from './discaverable-filter.model'; diff --git a/src/app/shared/models/select-option.model.ts b/src/app/shared/models/select-option.model.ts index 6768f2d38..652d0a778 100644 --- a/src/app/shared/models/select-option.model.ts +++ b/src/app/shared/models/select-option.model.ts @@ -1,4 +1,4 @@ -import { Primitive } from '../helpers'; +import { Primitive } from '../helpers/types.helper'; export interface SelectOption { label: string; diff --git a/src/app/shared/models/socials/index.ts b/src/app/shared/models/socials/index.ts deleted file mode 100644 index 39949c806..000000000 --- a/src/app/shared/models/socials/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './social-icon.model'; -export * from './social-platform-config.model'; -export * from './social-share-content.model'; -export * from './social-share-links.model'; -export * from './socials-share-action-item.model'; diff --git a/src/app/shared/models/store/index.ts b/src/app/shared/models/store/index.ts deleted file mode 100644 index 3b5469b1b..000000000 --- a/src/app/shared/models/store/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type { AsyncStateModel } from './async-state.model'; -export type { AsyncStateWithTotalCount } from './async-state-with-total-count.model'; diff --git a/src/app/shared/models/subject/index.ts b/src/app/shared/models/subject/index.ts deleted file mode 100644 index 0088c2e47..000000000 --- a/src/app/shared/models/subject/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './subject.model'; -export * from './subjects-json-api.model'; diff --git a/src/app/shared/models/subject/subjects-json-api.model.ts b/src/app/shared/models/subject/subjects-json-api.model.ts index c6b3e01e5..4e181fa38 100644 --- a/src/app/shared/models/subject/subjects-json-api.model.ts +++ b/src/app/shared/models/subject/subjects-json-api.model.ts @@ -1,4 +1,4 @@ -import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common'; +import { ApiData, MetaJsonApi, PaginationLinksJsonApi } from '../common/json-api.model'; export interface SubjectsResponseJsonApi { data: SubjectDataJsonApi[]; diff --git a/src/app/shared/models/table-parameters.model.ts b/src/app/shared/models/table-parameters.model.ts index 97617946d..d806da52b 100644 --- a/src/app/shared/models/table-parameters.model.ts +++ b/src/app/shared/models/table-parameters.model.ts @@ -1,4 +1,4 @@ -import { SortOrder } from '../enums'; +import { SortOrder } from '../enums/sort-order.enum'; export interface TableParameters { rows: number; diff --git a/src/app/shared/models/toolbar-resource.model.ts b/src/app/shared/models/toolbar-resource.model.ts index dd3f5b108..0d9e850e0 100644 --- a/src/app/shared/models/toolbar-resource.model.ts +++ b/src/app/shared/models/toolbar-resource.model.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@shared/enums'; +import { ResourceType } from '@shared/enums/resource-type.enum'; export interface ToolbarResource { id: string; diff --git a/src/app/shared/models/user-related-counts/index.ts b/src/app/shared/models/user-related-counts/index.ts deleted file mode 100644 index 8688435f7..000000000 --- a/src/app/shared/models/user-related-counts/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './user-related-counts.model'; -export * from './user-related-counts-json-api.model'; diff --git a/src/app/shared/models/user-related-counts/user-related-counts-json-api.model.ts b/src/app/shared/models/user-related-counts/user-related-counts-json-api.model.ts index 6d5ed6c67..4aa5586be 100644 --- a/src/app/shared/models/user-related-counts/user-related-counts-json-api.model.ts +++ b/src/app/shared/models/user-related-counts/user-related-counts-json-api.model.ts @@ -1,4 +1,4 @@ -import { ApiData, JsonApiResponse } from '../common'; +import { ApiData, JsonApiResponse } from '../common/json-api.model'; export type UserRelatedCountsResponseJsonApi = JsonApiResponse< ApiData< diff --git a/src/app/shared/models/user/index.ts b/src/app/shared/models/user/index.ts deleted file mode 100644 index 2fb58f7e0..000000000 --- a/src/app/shared/models/user/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './date-sortable.model'; -export * from './education.model'; -export * from './employment.model'; -export * from './social.model'; -export * from './social-link-view.model'; -export * from './social-links.model'; -export * from './user.models'; -export * from './user-json-api.model'; diff --git a/src/app/shared/models/user/social-links.model.ts b/src/app/shared/models/user/social-links.model.ts index f8ffb3ba3..7293ec76a 100644 --- a/src/app/shared/models/user/social-links.model.ts +++ b/src/app/shared/models/user/social-links.model.ts @@ -1,4 +1,4 @@ -import { SocialModel } from '@osf/shared/models'; +import { SocialModel } from './social.model'; export type SocialLinksKeys = keyof SocialModel; diff --git a/src/app/shared/models/user/user-json-api.model.ts b/src/app/shared/models/user/user-json-api.model.ts index 083d7dce7..fd2fc083f 100644 --- a/src/app/shared/models/user/user-json-api.model.ts +++ b/src/app/shared/models/user/user-json-api.model.ts @@ -1,4 +1,4 @@ -import { ResponseDataJsonApi } from '../common'; +import { ResponseDataJsonApi } from '../common/json-api.model'; import { Education } from './education.model'; import { Employment } from './employment.model'; diff --git a/src/app/shared/models/view-only-links/index.ts b/src/app/shared/models/view-only-links/index.ts deleted file mode 100644 index 8bc5e3616..000000000 --- a/src/app/shared/models/view-only-links/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './view-only-link.model'; -export * from './view-only-link-response.model'; diff --git a/src/app/shared/models/view-only-links/view-only-link-response.model.ts b/src/app/shared/models/view-only-links/view-only-link-response.model.ts index 6e29a67fc..06bbfb1a9 100644 --- a/src/app/shared/models/view-only-links/view-only-link-response.model.ts +++ b/src/app/shared/models/view-only-links/view-only-link-response.model.ts @@ -1,6 +1,6 @@ -import { MetaJsonApi } from '../common'; -import { BaseNodeDataJsonApi } from '../nodes'; -import { UserDataErrorResponseJsonApi } from '../user'; +import { MetaJsonApi } from '../common/json-api.model'; +import { BaseNodeDataJsonApi } from '../nodes/base-node-data-json-api.model'; +import { UserDataErrorResponseJsonApi } from '../user/user-json-api.model'; export interface ViewOnlyLinksResponseJsonApi { data: ViewOnlyLinkJsonApi[]; diff --git a/src/app/shared/models/wiki/index.ts b/src/app/shared/models/wiki/index.ts deleted file mode 100644 index 2d69f6ed8..000000000 --- a/src/app/shared/models/wiki/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './wiki.model'; -export * from './wiki-menu.model'; -export * from './wiki-type.model'; diff --git a/src/app/shared/models/wiki/wiki.model.ts b/src/app/shared/models/wiki/wiki.model.ts index 2d9d16320..6223fde49 100644 --- a/src/app/shared/models/wiki/wiki.model.ts +++ b/src/app/shared/models/wiki/wiki.model.ts @@ -1,4 +1,4 @@ -import { JsonApiResponse, JsonApiResponseWithMeta, MetaAnonymousJsonApi } from '../common'; +import { JsonApiResponse, JsonApiResponseWithMeta, MetaAnonymousJsonApi } from '../common/json-api.model'; export enum WikiModes { View = 'view', @@ -6,14 +6,14 @@ export enum WikiModes { Compare = 'compare', } -export interface Wiki { +export interface WikiModel { id: string; name: string; kind: string; } export interface WikisWithMeta { - wikis: Wiki[]; + wikis: WikiModel[]; meta: MetaAnonymousJsonApi; } @@ -26,7 +26,7 @@ export interface WikiVersion { export interface ComponentWiki { id: string; title: string; - list: Wiki[]; + list: WikiModel[]; } export interface HomeWiki { diff --git a/src/app/shared/pipes/citation-format.pipe.ts b/src/app/shared/pipes/citation-format.pipe.ts index 5f385fdaf..bee6f5c2f 100644 --- a/src/app/shared/pipes/citation-format.pipe.ts +++ b/src/app/shared/pipes/citation-format.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { UserModel } from '@osf/shared/models'; +import { UserModel } from '@osf/shared/models/user/user.models'; import { GENERATIONAL_SUFFIXES, ORDINAL_SUFFIXES } from '../constants/citation-suffix.const'; diff --git a/src/app/shared/pipes/index.ts b/src/app/shared/pipes/index.ts deleted file mode 100644 index e2cd6c283..000000000 --- a/src/app/shared/pipes/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export { CitationFormatPipe } from './citation-format.pipe'; -export { DateAgoPipe } from './date-ago.pipe'; -export { DecodeHtmlPipe } from './decode-html.pipe'; -export { FileSizePipe } from './file-size.pipe'; -export { FixSpecialCharPipe } from './fix-special-char.pipe'; -export { InterpolatePipe } from './interpolate.pipe'; -export { MonthYearPipe } from './month-year.pipe'; -export { SafeHtmlPipe } from './safe-html.pipe'; -export { SafeUrlPipe } from './safe-url.pipe'; -export { SortByDatePipe } from './sort-by-date.pipe'; -export { WrapFnPipe } from './wrap-fn.pipe'; diff --git a/src/app/shared/pipes/sort-by-date.pipe.ts b/src/app/shared/pipes/sort-by-date.pipe.ts index 653ffa268..d8a749454 100644 --- a/src/app/shared/pipes/sort-by-date.pipe.ts +++ b/src/app/shared/pipes/sort-by-date.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { DateSortable } from '../models'; +import { DateSortable } from '../models/user/date-sortable.model'; @Pipe({ name: 'sortByDate', diff --git a/src/app/shared/services/activity-logs/activity-log-display.service.ts b/src/app/shared/services/activity-logs/activity-log-display.service.ts index 808188d54..c1ebff194 100644 --- a/src/app/shared/services/activity-logs/activity-log-display.service.ts +++ b/src/app/shared/services/activity-logs/activity-log-display.service.ts @@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core'; import { inject, Injectable } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; -import { ActivityLog } from '@shared/models'; +import { ActivityLog } from '@osf/shared/models/activity-logs/activity-logs.model'; import { ActivityLogFormatterService } from './activity-log-formatter.service'; diff --git a/src/app/shared/services/activity-logs/activity-log-formatter.service.ts b/src/app/shared/services/activity-logs/activity-log-formatter.service.ts index 65d486d8a..7e3d026dc 100644 --- a/src/app/shared/services/activity-logs/activity-log-formatter.service.ts +++ b/src/app/shared/services/activity-logs/activity-log-formatter.service.ts @@ -2,7 +2,7 @@ import { TranslateService } from '@ngx-translate/core'; import { inject, Injectable } from '@angular/core'; -import { ActivityLog } from '@shared/models'; +import { ActivityLog } from '@osf/shared/models/activity-logs/activity-logs.model'; import { ActivityLogUrlBuilderService } from './activity-log-url-builder.service'; diff --git a/src/app/shared/services/activity-logs/activity-log-url-builder.service.ts b/src/app/shared/services/activity-logs/activity-log-url-builder.service.ts index 90436c7c2..761d70e53 100644 --- a/src/app/shared/services/activity-logs/activity-log-url-builder.service.ts +++ b/src/app/shared/services/activity-logs/activity-log-url-builder.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -import { ActivityLog } from '@shared/models'; +import { ActivityLog } from '@osf/shared/models/activity-logs/activity-logs.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/activity-logs/activity-logs.service.spec.ts b/src/app/shared/services/activity-logs/activity-logs.service.spec.ts index c2b6908a2..4b32f5ba7 100644 --- a/src/app/shared/services/activity-logs/activity-logs.service.spec.ts +++ b/src/app/shared/services/activity-logs/activity-logs.service.spec.ts @@ -1,8 +1,7 @@ import { HttpTestingController } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; -import { ActivityLogDisplayService } from '@shared/services'; - +import { ActivityLogDisplayService } from './activity-log-display.service'; import { ActivityLogsService } from './activity-logs.service'; import { diff --git a/src/app/shared/services/activity-logs/activity-logs.service.ts b/src/app/shared/services/activity-logs/activity-logs.service.ts index cc9ea64ad..98f26c473 100644 --- a/src/app/shared/services/activity-logs/activity-logs.service.ts +++ b/src/app/shared/services/activity-logs/activity-logs.service.ts @@ -4,15 +4,12 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ActivityLogsMapper } from '@osf/shared/mappers'; -import { - ActivityLog, - ActivityLogJsonApi, - ActivityLogWithDisplay, - JsonApiResponseWithMeta, - MetaAnonymousJsonApi, - PaginatedData, -} from '@osf/shared/models'; +import { ActivityLogsMapper } from '@osf/shared/mappers/activity-logs.mapper'; +import { ActivityLogWithDisplay } from '@osf/shared/models/activity-logs/activity-log-with-display.model'; +import { ActivityLog } from '@osf/shared/models/activity-logs/activity-logs.model'; +import { ActivityLogJsonApi } from '@osf/shared/models/activity-logs/activity-logs-json-api.model'; +import { JsonApiResponseWithMeta, MetaAnonymousJsonApi } from '@osf/shared/models/common/json-api.model'; +import { PaginatedData } from '@osf/shared/models/paginated-data.model'; import { JsonApiService } from '../json-api.service'; diff --git a/src/app/shared/services/activity-logs/index.ts b/src/app/shared/services/activity-logs/index.ts deleted file mode 100644 index af659c147..000000000 --- a/src/app/shared/services/activity-logs/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { ActivityLogDisplayService } from './activity-log-display.service'; -export { ActivityLogFormatterService } from './activity-log-formatter.service'; -export { ActivityLogUrlBuilderService } from './activity-log-url-builder.service'; -export { ActivityLogsService } from './activity-logs.service'; diff --git a/src/app/shared/services/addons-query-params.service.ts b/src/app/shared/services/addons-query-params.service.ts index d9a35cf8a..8f390daae 100644 --- a/src/app/shared/services/addons-query-params.service.ts +++ b/src/app/shared/services/addons-query-params.service.ts @@ -1,9 +1,11 @@ import { inject, Injectable } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { AddonCategory, AddonTabValue, AddonType } from '@shared/enums'; -import { addonCategoryToQueryParam, queryParamToAddonCategory } from '@shared/helpers'; -import { AddonsQueryParams } from '@shared/models'; +import { AddonTabValue } from '../enums/addon-tab.enum'; +import { AddonType } from '../enums/addon-type.enum'; +import { AddonCategory } from '../enums/addons-category.enum'; +import { addonCategoryToQueryParam, queryParamToAddonCategory } from '../helpers/addons-query-params.helper'; +import { AddonsQueryParams } from '../models/addons/addons-query-params.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/addons/addon-form.service.ts b/src/app/shared/services/addons/addon-form.service.ts index 9f164b626..51285c9e6 100644 --- a/src/app/shared/services/addons/addon-form.service.ts +++ b/src/app/shared/services/addons/addon-form.service.ts @@ -1,16 +1,18 @@ import { inject, Injectable } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { isAuthorizedAddon } from '@osf/shared/helpers'; -import { AddonFormControls, AddonType, CredentialsFormat } from '@shared/enums'; +import { AddonFormControls } from '@osf/shared/enums/addon-form-controls.enum'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { CredentialsFormat } from '@osf/shared/enums/addons-credentials-format.enum'; +import { isAuthorizedAddon } from '@osf/shared/helpers/addon-type.helper'; +import { AddonModel } from '@shared/models/addons/addon.model'; import { - AddonForm, - AddonModel, - AuthorizedAccountModel, AuthorizedAddonRequestJsonApi, - ConfiguredAddonModel, ConfiguredAddonRequestJsonApi, -} from '@shared/models'; +} from '@shared/models/addons/addon-json-api.models'; +import { AddonForm } from '@shared/models/addons/addon-utils.models'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/addons/addon-oauth.service.ts b/src/app/shared/services/addons/addon-oauth.service.ts index 5d9275254..d95fa3f48 100644 --- a/src/app/shared/services/addons/addon-oauth.service.ts +++ b/src/app/shared/services/addons/addon-oauth.service.ts @@ -3,8 +3,9 @@ import { createDispatchMap, select } from '@ngxs/store'; import { DestroyRef, inject, Injectable, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { AuthorizedAccountModel, OAuthCallbacks } from '@shared/models'; -import { AddonsSelectors, DeleteAuthorizedAddon, GetAuthorizedStorageOauthToken } from '@shared/stores/addons'; +import { OAuthCallbacks } from '@osf/shared/models/addons/addon-utils.models'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; +import { AddonsSelectors, DeleteAuthorizedAddon, GetAuthorizedStorageOauthToken } from '@osf/shared/stores/addons'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/addons/addon-operation-invocation.service.ts b/src/app/shared/services/addons/addon-operation-invocation.service.ts index d44f9c317..193f3cb57 100644 --- a/src/app/shared/services/addons/addon-operation-invocation.service.ts +++ b/src/app/shared/services/addons/addon-operation-invocation.service.ts @@ -1,8 +1,11 @@ import { Injectable } from '@angular/core'; -import { OperationNames, StorageItemType } from '@osf/shared/enums'; -import { isCitationAddon } from '@osf/shared/helpers'; -import { AuthorizedAccountModel, ConfiguredAddonModel, OperationInvocationRequestJsonApi } from '@shared/models'; +import { OperationNames } from '@osf/shared/enums/operation-names.enum'; +import { StorageItemType } from '@osf/shared/enums/storage-item-type.enum'; +import { isCitationAddon } from '@osf/shared/helpers/addon-type.helper'; +import { OperationInvocationRequestJsonApi } from '@shared/models/addons/addon-operations-json-api.models'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@shared/models/addons/configured-addon.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/addons/addons.service.ts b/src/app/shared/services/addons/addons.service.ts index 1827c9ea4..d2e5c6ef7 100644 --- a/src/app/shared/services/addons/addons.service.ts +++ b/src/app/shared/services/addons/addons.service.ts @@ -8,26 +8,28 @@ import { inject, Injectable } from '@angular/core'; import { BYPASS_ERROR_INTERCEPTOR } from '@core/interceptors/error-interceptor.tokens'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { UserSelectors } from '@core/store/user'; -import { AddonMapper } from '@osf/shared/mappers'; +import { AddonMapper } from '@osf/shared/mappers/addon.mapper'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; import { AddonGetResponseJsonApi, - AddonModel, - AuthorizedAccountModel, AuthorizedAddonGetResponseJsonApi, AuthorizedAddonRequestJsonApi, AuthorizedAddonResponseJsonApi, ConfiguredAddonGetResponseJsonApi, - ConfiguredAddonModel, ConfiguredAddonRequestJsonApi, ConfiguredAddonResponseJsonApi, IncludedAddonData, - JsonApiResponse, - OperationInvocation, - OperationInvocationRequestJsonApi, - OperationInvocationResponseJsonApi, ResourceReferenceJsonApi, UserReferenceJsonApi, -} from '@osf/shared/models'; +} from '@osf/shared/models/addons/addon-json-api.models'; +import { + OperationInvocationRequestJsonApi, + OperationInvocationResponseJsonApi, +} from '@osf/shared/models/addons/addon-operations-json-api.models'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { OperationInvocation } from '@osf/shared/models/addons/operation-invocation.model'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; import { JsonApiService } from '../json-api.service'; diff --git a/src/app/shared/services/addons/index.ts b/src/app/shared/services/addons/index.ts deleted file mode 100644 index 65ad799f6..000000000 --- a/src/app/shared/services/addons/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { AddonFormService } from './addon-form.service'; -export { AddonOAuthService } from './addon-oauth.service'; -export { AddonOperationInvocationService } from './addon-operation-invocation.service'; -export { AddonsService } from './addons.service'; diff --git a/src/app/shared/services/analytics.service.ts b/src/app/shared/services/analytics.service.ts index b7500870e..50364a5f1 100644 --- a/src/app/shared/services/analytics.service.ts +++ b/src/app/shared/services/analytics.service.ts @@ -3,7 +3,8 @@ import { Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiService } from '@osf/shared/services'; + +import { JsonApiService } from './json-api.service'; @Injectable({ providedIn: 'root' }) export class AnalyticsService { diff --git a/src/app/shared/services/banners.service.ts b/src/app/shared/services/banners.service.ts index 4a48f613c..5589094b4 100644 --- a/src/app/shared/services/banners.service.ts +++ b/src/app/shared/services/banners.service.ts @@ -6,8 +6,8 @@ import { ENVIRONMENT } from '@core/provider/environment.provider'; import { BannerModel } from '../../core/components/osf-banners/models/banner.model'; import { BannerMapper } from '../mappers/banner.mapper'; -import { JsonApiResponse } from '../models'; import { BannerJsonApi } from '../models/banner.json-api.model'; +import { JsonApiResponse } from '../models/common/json-api.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/bookmarks.service.ts b/src/app/shared/services/bookmarks.service.ts index 4e5de6275..ccf89670c 100644 --- a/src/app/shared/services/bookmarks.service.ts +++ b/src/app/shared/services/bookmarks.service.ts @@ -4,8 +4,8 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '../enums'; -import { SparseCollectionsResponseJsonApi } from '../models'; +import { ResourceType } from '../enums/resource-type.enum'; +import { SparseCollectionsResponseJsonApi } from '../models/collections/collections-json-api.models'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/brand.service.ts b/src/app/shared/services/brand.service.ts index 054dab0c9..72740585d 100644 --- a/src/app/shared/services/brand.service.ts +++ b/src/app/shared/services/brand.service.ts @@ -1,7 +1,7 @@ -import { Brand } from '@shared/models'; +import { BrandModel } from '../models/brand/brand.model'; export class BrandService { - static applyBranding(brand: Brand): void { + static applyBranding(brand: BrandModel): void { const root = document.documentElement; root.style.setProperty('--branding-primary-color', brand.primaryColor); diff --git a/src/app/shared/services/citations.service.ts b/src/app/shared/services/citations.service.ts index d9a4ac815..b979fd4de 100644 --- a/src/app/shared/services/citations.service.ts +++ b/src/app/shared/services/citations.service.ts @@ -5,16 +5,14 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '../enums'; -import { CitationsMapper } from '../mappers'; -import { - CitationStyle, - CitationStyleJsonApi, - CustomCitationPayload, - JsonApiResponse, - StyledCitation, - StyledCitationJsonApi, -} from '../models'; +import { ResourceType } from '../enums/resource-type.enum'; +import { CitationsMapper } from '../mappers/citations.mapper'; +import { CitationStyle } from '../models/citations/citation-style.model'; +import { CitationStyleJsonApi } from '../models/citations/citation-style-json-api.model'; +import { CustomCitationPayload } from '../models/citations/custom-citation-payload.model'; +import { StyledCitation } from '../models/citations/styled-citation.model'; +import { StyledCitationJsonApi } from '../models/citations/styled-citation-json-api.model'; +import { JsonApiResponse } from '../models/common/json-api.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/collections.service.ts b/src/app/shared/services/collections.service.ts index 61923a48a..7c45394dc 100644 --- a/src/app/shared/services/collections.service.ts +++ b/src/app/shared/services/collections.service.ts @@ -12,28 +12,32 @@ import { CollectionSubmissionReviewActionJsonApi, } from '@osf/features/moderation/models'; -import { CollectionsMapper, ContributorsMapper, ReviewActionsMapper } from '../mappers'; +import { CollectionsMapper } from '../mappers/collections'; +import { ContributorsMapper } from '../mappers/contributors'; +import { ReviewActionsMapper } from '../mappers/review-actions.mapper'; import { CollectionDetails, - CollectionDetailsGetResponseJsonApi, - CollectionDetailsResponseJsonApi, CollectionProvider, - CollectionProviderResponseJsonApi, CollectionSubmission, CollectionSubmissionActionType, - CollectionSubmissionJsonApi, - CollectionSubmissionsSearchPayloadJsonApi, CollectionSubmissionTargetType, CollectionSubmissionWithGuid, +} from '../models/collections/collections.models'; +import { + CollectionDetailsGetResponseJsonApi, + CollectionDetailsResponseJsonApi, + CollectionProviderResponseJsonApi, + CollectionSubmissionJsonApi, + CollectionSubmissionsSearchPayloadJsonApi, CollectionSubmissionWithGuidJsonApi, - ContributorModel, - ContributorsResponseJsonApi, - JsonApiResponse, - PaginatedData, - ResponseJsonApi, -} from '../models'; -import { ReviewActionPayload, ReviewActionPayloadJsonApi } from '../models/review-action'; -import { SetTotalSubmissions } from '../stores/collections'; +} from '../models/collections/collections-json-api.models'; +import { JsonApiResponse, ResponseJsonApi } from '../models/common/json-api.model'; +import { ContributorModel } from '../models/contributors/contributor.model'; +import { ContributorsResponseJsonApi } from '../models/contributors/contributor-response-json-api.model'; +import { PaginatedData } from '../models/paginated-data.model'; +import { ReviewActionPayload } from '../models/review-action/review-action-payload.model'; +import { ReviewActionPayloadJsonApi } from '../models/review-action/review-action-payload-json-api.model'; +import { SetTotalSubmissions } from '../stores/collections/collections.actions'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/contributors.service.ts b/src/app/shared/services/contributors.service.ts index 7735c7f85..97c0fdcfb 100644 --- a/src/app/shared/services/contributors.service.ts +++ b/src/app/shared/services/contributors.service.ts @@ -4,18 +4,19 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { AddContributorType, ResourceType } from '../enums'; -import { ContributorsMapper } from '../mappers'; +import { AddContributorType } from '../enums/contributors/add-contributor-type.enum'; +import { ResourceType } from '../enums/resource-type.enum'; +import { ContributorsMapper } from '../mappers/contributors'; +import { ResponseJsonApi } from '../models/common/json-api.model'; +import { ContributorModel } from '../models/contributors/contributor.model'; +import { ContributorAddModel } from '../models/contributors/contributor-add.model'; import { - ContributorAddModel, ContributorDataJsonApi, - ContributorModel, ContributorResponseJsonApi, ContributorsResponseJsonApi, - PaginatedData, - ResponseJsonApi, - UserDataJsonApi, -} from '../models'; +} from '../models/contributors/contributor-response-json-api.model'; +import { PaginatedData } from '../models/paginated-data.model'; +import { UserDataJsonApi } from '../models/user/user-json-api.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/csl-style-manager.service.ts b/src/app/shared/services/csl-style-manager.service.ts index 794d530ab..633f4a843 100644 --- a/src/app/shared/services/csl-style-manager.service.ts +++ b/src/app/shared/services/csl-style-manager.service.ts @@ -2,7 +2,7 @@ import { catchError, from, Observable, of, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { BUILT_IN_STYLES } from '@shared/constants'; +import { BUILT_IN_STYLES } from '../constants/built-in-citation-styles.const'; import { CitationsService } from './citations.service'; diff --git a/src/app/shared/services/custom-confirmation.service.ts b/src/app/shared/services/custom-confirmation.service.ts index 8fbe16693..c02165f47 100644 --- a/src/app/shared/services/custom-confirmation.service.ts +++ b/src/app/shared/services/custom-confirmation.service.ts @@ -4,7 +4,11 @@ import { ConfirmationService } from 'primeng/api'; import { inject, Injectable } from '@angular/core'; -import { AcceptConfirmationOptions, ContinueConfirmationOptions, DeleteConfirmationOptions } from '../models'; +import { + AcceptConfirmationOptions, + ContinueConfirmationOptions, + DeleteConfirmationOptions, +} from '../models/confirmation-options.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/datacite/datacite.service.spec.ts b/src/app/shared/services/datacite/datacite.service.spec.ts index 6f13a7da6..229f0db72 100644 --- a/src/app/shared/services/datacite/datacite.service.spec.ts +++ b/src/app/shared/services/datacite/datacite.service.spec.ts @@ -6,13 +6,13 @@ import { TestBed } from '@angular/core/testing'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { SENTRY_TOKEN } from '@core/provider/sentry.provider'; -import { Identifier } from '@shared/models'; -import { DataciteEvent } from '@shared/models/datacite/datacite-event.enum'; +import { DataciteEvent } from '@osf/shared/enums/datacite/datacite-event.enum'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; import { DataciteService } from './datacite.service'; function buildObservable(doi: string) { - return new Observable<{ identifiers?: Identifier[] } | null>((subscriber) => { + return new Observable<{ identifiers?: IdentifierModel[] } | null>((subscriber) => { subscriber.next({}); subscriber.next({ identifiers: [] }); subscriber.next({ diff --git a/src/app/shared/services/datacite/datacite.service.ts b/src/app/shared/services/datacite/datacite.service.ts index 565e4674d..935333b5c 100644 --- a/src/app/shared/services/datacite/datacite.service.ts +++ b/src/app/shared/services/datacite/datacite.service.ts @@ -5,8 +5,9 @@ import { inject, Injectable } from '@angular/core'; import { BYPASS_ERROR_INTERCEPTOR } from '@core/interceptors/error-interceptor.tokens'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { Identifier, IdentifiersResponseJsonApi } from '@osf/shared/models'; -import { DataciteEvent } from '@osf/shared/models/datacite/datacite-event.enum'; +import { DataciteEvent } from '@osf/shared/enums/datacite/datacite-event.enum'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; +import { IdentifiersResponseJsonApi } from '@osf/shared/models/identifiers/identifier-json-api.model'; @Injectable({ providedIn: 'root', @@ -27,11 +28,11 @@ export class DataciteService { return this.environment.dataciteTrackerRepoId; } - logIdentifiableView(trackable: Observable<{ identifiers?: Identifier[] } | null>) { + logIdentifiableView(trackable: Observable<{ identifiers?: IdentifierModel[] } | null>) { return this.watchIdentifiable(trackable, DataciteEvent.VIEW); } - logIdentifiableDownload(trackable: Observable<{ identifiers?: Identifier[] } | null>) { + logIdentifiableDownload(trackable: Observable<{ identifiers?: IdentifierModel[] } | null>) { return this.watchIdentifiable(trackable, DataciteEvent.DOWNLOAD); } @@ -44,7 +45,7 @@ export class DataciteService { } private watchIdentifiable( - trackable: Observable<{ identifiers?: Identifier[] } | null>, + trackable: Observable<{ identifiers?: IdentifierModel[] } | null>, event: DataciteEvent ): Observable { return trackable.pipe( @@ -60,7 +61,7 @@ export class DataciteService { const url = `${this.apiDomainUrl}/v2/${targetType}/${targetId}/identifiers`; return this.http.get(url).pipe( map((item) => ({ - identifiers: item.data.map((identifierData) => ({ + identifiers: item.data.map((identifierData) => ({ id: identifierData.id, type: identifierData.type, category: identifierData.attributes.category, diff --git a/src/app/shared/services/duplicates.service.ts b/src/app/shared/services/duplicates.service.ts index df29dc98e..b4c779424 100644 --- a/src/app/shared/services/duplicates.service.ts +++ b/src/app/shared/services/duplicates.service.ts @@ -5,8 +5,11 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { BaseNodeMapper } from '../mappers'; -import { BaseNodeDataJsonApi, NodeModel, PaginatedData, ResponseJsonApi } from '../models'; +import { BaseNodeMapper } from '../mappers/nodes'; +import { ResponseJsonApi } from '../models/common/json-api.model'; +import { NodeModel } from '../models/nodes/base-node.model'; +import { BaseNodeDataJsonApi } from '../models/nodes/base-node-data-json-api.model'; +import { PaginatedData } from '../models/paginated-data.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/files.service.ts b/src/app/shared/services/files.service.ts index 5d16ed623..988adbcc1 100644 --- a/src/app/shared/services/files.service.ts +++ b/src/app/shared/services/files.service.ts @@ -16,41 +16,39 @@ import { OsfFileRevision, PatchFileMetadata, } from '@osf/features/files/models'; + +import { FileKind } from '../enums/file-kind.enum'; +import { AddonMapper } from '../mappers/addon.mapper'; +import { ContributorsMapper } from '../mappers/contributors'; +import { FilesMapper } from '../mappers/files/files.mapper'; +import { AddonModel } from '../models/addons/addon.model'; +import { AddonGetResponseJsonApi, ConfiguredAddonGetResponseJsonApi } from '../models/addons/addon-json-api.models'; +import { ConfiguredAddonModel } from '../models/addons/configured-addon.model'; +import { ApiData, JsonApiResponse, MetaJsonApi } from '../models/common/json-api.model'; +import { ContributorModel } from '../models/contributors/contributor.model'; +import { ContributorsResponseJsonApi } from '../models/contributors/contributor-response-json-api.model'; +import { FileDetailsModel, FileModel } from '../models/files/file.model'; +import { FileFolderModel } from '../models/files/file-folder.model'; import { - AddonGetResponseJsonApi, - AddonModel, - ApiData, - ConfiguredAddonGetResponseJsonApi, - ConfiguredAddonModel, - ContributorModel, - ContributorsResponseJsonApi, - FileDetailsModel, - FileDetailsResponseJsonApi, FileFolderDataJsonApi, - FileFolderModel, FileFolderResponseJsonApi, FileFoldersResponseJsonApi, - FileModel, +} from '../models/files/file-folder-json-api.model'; +import { + FileDetailsResponseJsonApi, FileResponseJsonApi, FilesResponseJsonApi, - FileVersionModel, - FileVersionsResponseJsonApi, - JsonApiResponse, - MetaJsonApi, -} from '@shared/models'; - -import { FileKind } from '../enums'; -import { AddonMapper, ContributorsMapper, FilesMapper } from '../mappers'; +} from '../models/files/file-json-api.model'; +import { FileVersionModel } from '../models/files/file-version.model'; +import { FileVersionsResponseJsonApi } from '../models/files/file-version-json-api.model'; import { JsonApiService } from './json-api.service'; -import { ToastService } from './toast.service'; @Injectable({ providedIn: 'root', }) export class FilesService { readonly jsonApiService = inject(JsonApiService); - readonly toastService = inject(ToastService); private readonly environment = inject(ENVIRONMENT); get apiUrl() { diff --git a/src/app/shared/services/global-search.service.ts b/src/app/shared/services/global-search.service.ts index 3271bf229..dce5596df 100644 --- a/src/app/shared/services/global-search.service.ts +++ b/src/app/shared/services/global-search.service.ts @@ -3,17 +3,17 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MapResources } from '@shared/mappers/search'; + +import { mapFilterOptions } from '../mappers/filters/filter-option.mapper'; +import { MapFilters } from '../mappers/filters/filters.mapper'; +import { MapResources } from '../mappers/search'; +import { FilterOption } from '../models/search/discaverable-filter.model'; +import { FilterOptionItem, FilterOptionsResponseJsonApi } from '../models/search/filter-options-json-api.models'; import { - FilterOption, - FilterOptionItem, - FilterOptionsResponseJsonApi, IndexCardSearchResponseJsonApi, - ResourcesData, SearchResultDataJsonApi, -} from '@shared/models'; - -import { mapFilterOptions, MapFilters } from '../mappers'; +} from '../models/search/index-card-search-json-api.models'; +import { ResourcesData } from '../models/search/resource.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/index.ts b/src/app/shared/services/index.ts deleted file mode 100644 index fd60bfa4a..000000000 --- a/src/app/shared/services/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -export * from './activity-logs'; -export * from './addons'; -export { AnalyticsService } from './analytics.service'; -export { BookmarksService } from './bookmarks.service'; -export { BrandService } from './brand.service'; -export { CitationsService } from './citations.service'; -export { CollectionsService } from './collections.service'; -export { ContributorsService } from './contributors.service'; -export { CslStyleManagerService } from './csl-style-manager.service'; -export { CustomConfirmationService } from './custom-confirmation.service'; -export { CustomDialogService } from './custom-dialog.service'; -export { DuplicatesService } from './duplicates.service'; -export { FilesService } from './files.service'; -export { GlobalSearchService } from './global-search.service'; -export { GoogleFilePickerDownloadService } from './google-file-picker.download.service'; -export { InstitutionsService } from './institutions.service'; -export { JsonApiService } from './json-api.service'; -export { LicensesService } from './licenses.service'; -export { LoaderService } from './loader.service'; -export { MenuManagerService } from './menu-manager.service'; -export { MetaTagsService } from './meta-tags.service'; -export { MetadataRecordsService } from './metadata-records.service'; -export { MyResourcesService } from './my-resources.service'; -export { NodeLinksService } from './node-links.service'; -export { ProjectRedirectDialogService } from './project-redirect-dialog.service'; -export { RegionsService } from './regions.service'; -export { RegistrationProviderService } from './registration-provider.service'; -export { RequestAccessService } from './request-access.service'; -export { ResourceGuidService } from './resource.service'; -export { ResourceCardService } from './resource-card.service'; -export { SocialShareService } from './social-share.service'; -export { SubjectsService } from './subjects.service'; -export { ToastService } from './toast.service'; -export { ViewOnlyLinksService } from './view-only-links.service'; -export { WikiService } from './wiki.service'; diff --git a/src/app/shared/services/institutions.service.ts b/src/app/shared/services/institutions.service.ts index 6669a9d37..9858f02f2 100644 --- a/src/app/shared/services/institutions.service.ts +++ b/src/app/shared/services/institutions.service.ts @@ -4,15 +4,15 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ResourceType } from '@shared/enums'; -import { InstitutionsMapper } from '@shared/mappers'; + +import { ResourceType } from '../enums/resource-type.enum'; +import { InstitutionsMapper } from '../mappers/institutions'; import { - Institution, InstitutionJsonApiResponse, InstitutionsJsonApiResponse, InstitutionsWithMetaJsonApiResponse, - InstitutionsWithTotalCount, -} from '@shared/models'; +} from '../models/institutions/institution-json-api.model'; +import { Institution, InstitutionsWithTotalCount } from '../models/institutions/institutions.models'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/json-api.service.ts b/src/app/shared/services/json-api.service.ts index 22f5650eb..cb5735df8 100644 --- a/src/app/shared/services/json-api.service.ts +++ b/src/app/shared/services/json-api.service.ts @@ -3,7 +3,7 @@ import { map, Observable } from 'rxjs'; import { HttpClient, HttpContext, HttpEvent, HttpParams } from '@angular/common/http'; import { inject, Injectable } from '@angular/core'; -import { JsonApiResponse } from '@osf/shared/models'; +import { JsonApiResponse } from '@osf/shared/models/common/json-api.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/licenses.service.ts b/src/app/shared/services/licenses.service.ts index 5d8bbc91b..505b546cc 100644 --- a/src/app/shared/services/licenses.service.ts +++ b/src/app/shared/services/licenses.service.ts @@ -4,8 +4,10 @@ import { HttpClient } from '@angular/common/http'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { LicensesMapper } from '@shared/mappers'; -import { LicenseModel, LicensesResponseJsonApi } from '@shared/models'; + +import { LicensesMapper } from '../mappers/licenses.mapper'; +import { LicenseModel } from '../models/license/license.model'; +import { LicensesResponseJsonApi } from '../models/license/licenses-json-api.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/linked-projects.service.ts b/src/app/shared/services/linked-projects.service.ts index d7ecf265e..0c1ae59c1 100644 --- a/src/app/shared/services/linked-projects.service.ts +++ b/src/app/shared/services/linked-projects.service.ts @@ -5,8 +5,11 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { BaseNodeMapper } from '../mappers'; -import { BaseNodeDataJsonApi, NodeModel, PaginatedData, ResponseJsonApi } from '../models'; +import { BaseNodeMapper } from '../mappers/nodes'; +import { ResponseJsonApi } from '../models/common/json-api.model'; +import { NodeModel } from '../models/nodes/base-node.model'; +import { BaseNodeDataJsonApi } from '../models/nodes/base-node-data-json-api.model'; +import { PaginatedData } from '../models/paginated-data.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/meta-tags.service.ts b/src/app/shared/services/meta-tags.service.ts index 02443477d..d65e90ae9 100644 --- a/src/app/shared/services/meta-tags.service.ts +++ b/src/app/shared/services/meta-tags.service.ts @@ -6,8 +6,10 @@ import { Meta, MetaDefinition, Title } from '@angular/platform-browser'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MetadataRecordFormat } from '../enums'; -import { Content, DataContent, HeadTagDef, MetaTagAuthor, MetaTagsData } from '../models/meta-tags'; +import { MetadataRecordFormat } from '../enums/metadata-record-format.enum'; +import { HeadTagDef } from '../models/meta-tags/head-tag-def.model'; +import { MetaTagAuthor } from '../models/meta-tags/meta-tag-author.model'; +import { Content, DataContent, MetaTagsData } from '../models/meta-tags/meta-tags-data.model'; import { MetadataRecordsService } from './metadata-records.service'; diff --git a/src/app/shared/services/metadata-records.service.ts b/src/app/shared/services/metadata-records.service.ts index 631804167..64e31ef2c 100644 --- a/src/app/shared/services/metadata-records.service.ts +++ b/src/app/shared/services/metadata-records.service.ts @@ -5,7 +5,7 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MetadataRecordFormat } from '../enums'; +import { MetadataRecordFormat } from '../enums/metadata-record-format.enum'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/my-resources.service.ts b/src/app/shared/services/my-resources.service.ts index 60c9d6723..80f06edff 100644 --- a/src/app/shared/services/my-resources.service.ts +++ b/src/app/shared/services/my-resources.service.ts @@ -6,17 +6,19 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { MyResourcesMapper } from '@osf/features/my-projects/mappers'; -import { ResourceSearchMode, ResourceType, SortOrder } from '../enums'; +import { ResourceSearchMode } from '../enums/resource-search-mode.enum'; +import { ResourceType } from '../enums/resource-type.enum'; +import { SortOrder } from '../enums/sort-order.enum'; +import { JsonApiResponse } from '../models/common/json-api.model'; import { - CreateProjectPayloadJsoApi, - EndpointType, - JsonApiResponse, MyResourcesItem, MyResourcesItemGetResponseJsonApi, MyResourcesItemResponseJsonApi, MyResourcesResponseJsonApi, - MyResourcesSearchFilters, -} from '../models'; +} from '../models/my-resources/my-resources.models'; +import { EndpointType } from '../models/my-resources/my-resources-endpoint.type'; +import { MyResourcesSearchFilters } from '../models/my-resources/my-resources-search-filters.models'; +import { CreateProjectPayloadJsoApi } from '../models/nodes/nodes-json-api.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/node-links.service.ts b/src/app/shared/services/node-links.service.ts index cc8070ac0..e2a9c7056 100644 --- a/src/app/shared/services/node-links.service.ts +++ b/src/app/shared/services/node-links.service.ts @@ -5,9 +5,12 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { ComponentsMapper } from '../mappers'; -import { ComponentGetResponseJsonApi, ComponentOverview, JsonApiResponse, MyResourcesItem } from '../models'; -import { NodeLinkJsonApi } from '../models/node-links'; +import { ComponentsMapper } from '../mappers/components'; +import { JsonApiResponse } from '../models/common/json-api.model'; +import { ComponentGetResponseJsonApi } from '../models/components/component-json-api.model'; +import { ComponentOverview } from '../models/components/components.models'; +import { MyResourcesItem } from '../models/my-resources/my-resources.models'; +import { NodeLinkJsonApi } from '../models/node-links/node-link-json-api.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/projects.service.ts b/src/app/shared/services/projects.service.ts index e857b7267..2bf9da1be 100644 --- a/src/app/shared/services/projects.service.ts +++ b/src/app/shared/services/projects.service.ts @@ -5,7 +5,9 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ProjectsMapper } from '../mappers/projects'; -import { ProjectJsonApi, ProjectMetadataUpdatePayload, ProjectModel, ProjectsResponseJsonApi } from '../models'; +import { ProjectMetadataUpdatePayload } from '../models/project-metadata-update-payload.model'; +import { ProjectModel } from '../models/projects/projects.models'; +import { ProjectJsonApi, ProjectsResponseJsonApi } from '../models/projects/projects-json-api.models'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/regions.service.ts b/src/app/shared/services/regions.service.ts index 634bb2de9..0ab2b0ced 100644 --- a/src/app/shared/services/regions.service.ts +++ b/src/app/shared/services/regions.service.ts @@ -6,7 +6,8 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { RegionsMapper } from '../mappers/regions'; -import { IdName, RegionsResponseJsonApi } from '../models'; +import { IdNameModel } from '../models/common/id-name.model'; +import { RegionsResponseJsonApi } from '../models/regions/regions.json-api.model'; @Injectable({ providedIn: 'root', @@ -19,7 +20,7 @@ export class RegionsService { return `${this.environment.apiDomainUrl}/v2`; } - getAllRegions(): Observable { + getAllRegions(): Observable { return this.http .get(`${this.apiUrl}/regions/`) .pipe(map((regions) => RegionsMapper.fromRegionsResponseJsonApi(regions))); diff --git a/src/app/shared/services/registration-provider.service.ts b/src/app/shared/services/registration-provider.service.ts index 6278adacf..d7ee487b9 100644 --- a/src/app/shared/services/registration-provider.service.ts +++ b/src/app/shared/services/registration-provider.service.ts @@ -4,14 +4,12 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { RegistrationProviderMapper } from '../mappers'; -import { - JsonApiResponse, - ProviderSchema, - ProvidersResponseJsonApi, - RegistryProviderDetails, - RegistryProviderDetailsJsonApi, -} from '../models'; +import { RegistrationProviderMapper } from '../mappers/registration-provider.mapper'; +import { JsonApiResponse } from '../models/common/json-api.model'; +import { ProvidersResponseJsonApi } from '../models/provider/providers-json-api.model'; +import { RegistryProviderDetailsJsonApi } from '../models/provider/registration-provider-json-api.model'; +import { RegistryProviderDetails } from '../models/provider/registry-provider.model'; +import { ProviderSchema } from '../models/registration/provider-schema.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/request-access.service.ts b/src/app/shared/services/request-access.service.ts index 57a516a1c..1417188dc 100644 --- a/src/app/shared/services/request-access.service.ts +++ b/src/app/shared/services/request-access.service.ts @@ -4,9 +4,12 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { RequestAccessTrigger, ResourceType } from '../enums'; +import { RequestAccessTrigger } from '../enums/request-access-trigger.enum'; +import { ResourceType } from '../enums/resource-type.enum'; import { RequestAccessMapper } from '../mappers/request-access'; -import { RequestAccessModel, RequestAccessPayload, RequestAccessResponseJsonApi } from '../models'; +import { RequestAccessModel } from '../models/request-access/request-access.model'; +import { RequestAccessResponseJsonApi } from '../models/request-access/request-access-json-api.model'; +import { RequestAccessPayload } from '../models/request-access/request-access-payload.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/resource-card.service.ts b/src/app/shared/services/resource-card.service.ts index fe111dfc7..0451e98b2 100644 --- a/src/app/shared/services/resource-card.service.ts +++ b/src/app/shared/services/resource-card.service.ts @@ -3,8 +3,10 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MapUserCounts } from '@shared/mappers'; -import { UserRelatedCounts, UserRelatedCountsResponseJsonApi } from '@shared/models'; +import { UserRelatedCounts } from '@shared/models/user-related-counts/user-related-counts.model'; +import { UserRelatedCountsResponseJsonApi } from '@shared/models/user-related-counts/user-related-counts-json-api.model'; + +import { MapUserCounts } from '../mappers/user-related-counts'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/resource.service.ts b/src/app/shared/services/resource.service.ts index 839f2194f..ceb161c5a 100644 --- a/src/app/shared/services/resource.service.ts +++ b/src/app/shared/services/resource.service.ts @@ -3,18 +3,15 @@ import { finalize, map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { BaseNodeMapper } from '@osf/shared/mappers'; -import { - BaseNodeDataJsonApi, - BaseNodeModel, - CurrentResource, - GuidedResponseJsonApi, - NodeShortInfoModel, - ResponseDataJsonApi, - ResponseJsonApi, -} from '@osf/shared/models'; -import { CurrentResourceType, ResourceType } from '../enums'; +import { CurrentResourceType, ResourceType } from '../enums/resource-type.enum'; +import { BaseNodeMapper } from '../mappers/nodes'; +import { ResponseDataJsonApi, ResponseJsonApi } from '../models/common/json-api.model'; +import { CurrentResource } from '../models/current-resource.model'; +import { GuidedResponseJsonApi } from '../models/guid-response-json-api.model'; +import { BaseNodeModel } from '../models/nodes/base-node.model'; +import { BaseNodeDataJsonApi } from '../models/nodes/base-node-data-json-api.model'; +import { NodeShortInfoModel } from '../models/nodes/node-with-children.model'; import { JsonApiService } from './json-api.service'; import { LoaderService } from './loader.service'; diff --git a/src/app/shared/services/social-share.service.ts b/src/app/shared/services/social-share.service.ts index 262684cb0..7b821619a 100644 --- a/src/app/shared/services/social-share.service.ts +++ b/src/app/shared/services/social-share.service.ts @@ -2,8 +2,11 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SOCIAL_PLATFORMS, SOCIAL_SHARE_URLS } from '../constants'; -import { SocialShareContentModel, SocialShareLinksModel, SocialsShareActionItem } from '../models'; +import { SOCIAL_PLATFORMS } from '../constants/social-platforms.const'; +import { SOCIAL_SHARE_URLS } from '../constants/social-share.config'; +import { SocialShareContentModel } from '../models/socials/social-share-content.model'; +import { SocialShareLinksModel } from '../models/socials/social-share-links.model'; +import { SocialsShareActionItem } from '../models/socials/socials-share-action-item.model'; @Injectable({ providedIn: 'root', diff --git a/src/app/shared/services/subjects.service.ts b/src/app/shared/services/subjects.service.ts index c534043a0..eee028a8e 100644 --- a/src/app/shared/services/subjects.service.ts +++ b/src/app/shared/services/subjects.service.ts @@ -4,10 +4,11 @@ import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { SubjectMapper } from '@shared/mappers'; -import { SubjectModel, SubjectsResponseJsonApi } from '@shared/models'; +import { SubjectModel } from '@shared/models/subject/subject.model'; +import { SubjectsResponseJsonApi } from '@shared/models/subject/subjects-json-api.model'; -import { ResourceType } from '../enums'; +import { ResourceType } from '../enums/resource-type.enum'; +import { SubjectMapper } from '../mappers/subjects'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/view-only-links.service.ts b/src/app/shared/services/view-only-links.service.ts index 5b70f84fb..32da38445 100644 --- a/src/app/shared/services/view-only-links.service.ts +++ b/src/app/shared/services/view-only-links.service.ts @@ -3,15 +3,15 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiResponse } from '@shared/models'; +import { JsonApiResponse } from '@shared/models/common/json-api.model'; -import { ResourceType } from '../enums'; -import { ViewOnlyLinksMapper } from '../mappers'; +import { ResourceType } from '../enums/resource-type.enum'; +import { ViewOnlyLinksMapper } from '../mappers/view-only-links.mapper'; +import { PaginatedViewOnlyLinksModel } from '../models/view-only-links/view-only-link.model'; import { - PaginatedViewOnlyLinksModel, ViewOnlyLinkJsonApi, ViewOnlyLinksResponseJsonApi, -} from '../models/view-only-links'; +} from '../models/view-only-links/view-only-link-response.model'; import { JsonApiService } from './json-api.service'; diff --git a/src/app/shared/services/wiki.service.ts b/src/app/shared/services/wiki.service.ts index 8d9a22cb3..f2d02a306 100644 --- a/src/app/shared/services/wiki.service.ts +++ b/src/app/shared/services/wiki.service.ts @@ -5,20 +5,21 @@ import { HttpClient } from '@angular/common/http'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { JsonApiResponse, WikisWithMeta } from '@shared/models'; - -import { ResourceType } from '../enums'; -import { WikiMapper } from '../mappers/wiki'; +import { JsonApiResponse } from '@shared/models/common/json-api.model'; import { ComponentsWikiJsonApiResponse, ComponentWiki, HomeWikiJsonApiResponse, - Wiki, WikiGetResponse, WikiJsonApiResponseWithMeta, + WikiModel, + WikisWithMeta, WikiVersion, WikiVersionJsonApiResponse, -} from '../models'; +} from '@shared/models/wiki/wiki.model'; + +import { ResourceType } from '../enums/resource-type.enum'; +import { WikiMapper } from '../mappers/wiki'; import { JsonApiService } from './json-api.service'; @@ -49,7 +50,7 @@ export class WikiService { return `${this.apiUrl}/${resourcePath}/${resourceId}/wikis/`; } - createWiki(projectId: string, name: string): Observable { + createWiki(projectId: string, name: string): Observable { const body = { data: { type: 'wikis', diff --git a/src/app/shared/stores/activity-logs/activity-logs.model.ts b/src/app/shared/stores/activity-logs/activity-logs.model.ts index 9eaaa41ac..8f0f9f6e9 100644 --- a/src/app/shared/stores/activity-logs/activity-logs.model.ts +++ b/src/app/shared/stores/activity-logs/activity-logs.model.ts @@ -1,4 +1,5 @@ -import { ActivityLogWithDisplay, AsyncStateWithTotalCount } from '@osf/shared/models'; +import { ActivityLogWithDisplay } from '@osf/shared/models/activity-logs/activity-log-with-display.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface ActivityLogsStateModel { activityLogs: AsyncStateWithTotalCount; diff --git a/src/app/shared/stores/activity-logs/activity-logs.selectors.ts b/src/app/shared/stores/activity-logs/activity-logs.selectors.ts index c13cbb774..f6c9de8e4 100644 --- a/src/app/shared/stores/activity-logs/activity-logs.selectors.ts +++ b/src/app/shared/stores/activity-logs/activity-logs.selectors.ts @@ -1,6 +1,7 @@ import { Selector } from '@ngxs/store'; -import { ActivityLog, ActivityLogWithDisplay } from '@osf/shared/models'; +import { ActivityLogWithDisplay } from '@osf/shared/models/activity-logs/activity-log-with-display.model'; +import { ActivityLog } from '@osf/shared/models/activity-logs/activity-logs.model'; import { ActivityLogsStateModel } from './activity-logs.model'; import { ActivityLogsState } from './activity-logs.state'; diff --git a/src/app/shared/stores/activity-logs/activity-logs.state.spec.ts b/src/app/shared/stores/activity-logs/activity-logs.state.spec.ts index 95ff16568..96dced6e2 100644 --- a/src/app/shared/stores/activity-logs/activity-logs.state.spec.ts +++ b/src/app/shared/stores/activity-logs/activity-logs.state.spec.ts @@ -4,7 +4,7 @@ import { provideHttpClient } from '@angular/common/http'; import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; import { inject, TestBed } from '@angular/core/testing'; -import { ActivityLogDisplayService } from '@shared/services'; +import { ActivityLogDisplayService } from '@osf/shared/services/activity-logs/activity-log-display.service'; import { ClearActivityLogsStore, GetActivityLogs, GetRegistrationActivityLogs } from './activity-logs.actions'; import { ActivityLogsState } from './activity-logs.state'; diff --git a/src/app/shared/stores/activity-logs/activity-logs.state.ts b/src/app/shared/stores/activity-logs/activity-logs.state.ts index e69be7da8..e73bb69d2 100644 --- a/src/app/shared/stores/activity-logs/activity-logs.state.ts +++ b/src/app/shared/stores/activity-logs/activity-logs.state.ts @@ -5,7 +5,7 @@ import { tap } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { ActivityLogsService } from '@shared/services'; +import { ActivityLogsService } from '@osf/shared/services/activity-logs/activity-logs.service'; import { ClearActivityLogsStore, GetActivityLogs, GetRegistrationActivityLogs } from './activity-logs.actions'; import { ACTIVITY_LOGS_STATE_DEFAULT, ActivityLogsStateModel } from './activity-logs.model'; diff --git a/src/app/shared/stores/addons/addons.actions.ts b/src/app/shared/stores/addons/addons.actions.ts index 24568c0d5..bb37a0fd6 100644 --- a/src/app/shared/stores/addons/addons.actions.ts +++ b/src/app/shared/stores/addons/addons.actions.ts @@ -1,8 +1,8 @@ import { AuthorizedAddonRequestJsonApi, ConfiguredAddonRequestJsonApi, - OperationInvocationRequestJsonApi, -} from '@shared/models'; +} from '@osf/shared/models/addons/addon-json-api.models'; +import { OperationInvocationRequestJsonApi } from '@osf/shared/models/addons/addon-operations-json-api.models'; export class GetStorageAddons { static readonly type = '[Addons] Get Storage Addons'; diff --git a/src/app/shared/stores/addons/addons.models.ts b/src/app/shared/stores/addons/addons.models.ts index 74e128b69..4e795944f 100644 --- a/src/app/shared/stores/addons/addons.models.ts +++ b/src/app/shared/stores/addons/addons.models.ts @@ -1,13 +1,13 @@ +import { AddonModel } from '@osf/shared/models/addons/addon.model'; import { - AddonModel, - AsyncStateModel, - AuthorizedAccountModel, - ConfiguredAddonModel, ConfiguredAddonResponseJsonApi, - OperationInvocation, ResourceReferenceJsonApi, UserReferenceJsonApi, -} from '@osf/shared/models'; +} from '@osf/shared/models/addons/addon-json-api.models'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { OperationInvocation } from '@osf/shared/models/addons/operation-invocation.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface AddonsStateModel { storageAddons: AsyncStateModel; diff --git a/src/app/shared/stores/addons/addons.selectors.ts b/src/app/shared/stores/addons/addons.selectors.ts index 153c9ee06..bd8158094 100644 --- a/src/app/shared/stores/addons/addons.selectors.ts +++ b/src/app/shared/stores/addons/addons.selectors.ts @@ -1,15 +1,15 @@ import { createSelector, Selector } from '@ngxs/store'; +import { AddonModel } from '@osf/shared/models/addons/addon.model'; import { - AddonModel, - AuthorizedAccountModel, - ConfiguredAddonModel, ConfiguredAddonResponseJsonApi, - OperationInvocation, ResourceReferenceJsonApi, - StorageItem, UserReferenceJsonApi, -} from '@shared/models'; +} from '@osf/shared/models/addons/addon-json-api.models'; +import { AuthorizedAccountModel } from '@osf/shared/models/addons/authorized-account.model'; +import { ConfiguredAddonModel } from '@osf/shared/models/addons/configured-addon.model'; +import { OperationInvocation } from '@osf/shared/models/addons/operation-invocation.model'; +import { StorageItem } from '@osf/shared/models/addons/storage-item.model'; import { AddonsStateModel } from './addons.models'; import { AddonsState } from './addons.state'; diff --git a/src/app/shared/stores/addons/addons.state.ts b/src/app/shared/stores/addons/addons.state.ts index 1b3afb253..9f28071f5 100644 --- a/src/app/shared/stores/addons/addons.state.ts +++ b/src/app/shared/stores/addons/addons.state.ts @@ -4,10 +4,10 @@ import { catchError, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { AddonType } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; -import { AuthorizedAccountModel } from '@osf/shared/models'; -import { AddonsService } from '@osf/shared/services'; +import { AddonType } from '@osf/shared/enums/addon-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { AddonsService } from '@osf/shared/services/addons/addons.service'; +import { AuthorizedAccountModel } from '@shared/models/addons/authorized-account.model'; import { ClearAuthorizedAddons, diff --git a/src/app/shared/stores/banners/banners.model.ts b/src/app/shared/stores/banners/banners.model.ts index f62e67152..78afe8db6 100644 --- a/src/app/shared/stores/banners/banners.model.ts +++ b/src/app/shared/stores/banners/banners.model.ts @@ -1,5 +1,5 @@ import { BannerModel } from '@core/components/osf-banners/models/banner.model'; -import { AsyncStateModel } from '@shared/models/store'; +import { AsyncStateModel } from '@shared/models/store/async-state.model'; /** * NGXS State model for managing banner-related data. diff --git a/src/app/shared/stores/banners/banners.state.ts b/src/app/shared/stores/banners/banners.state.ts index 4ffb5b23d..e733e7287 100644 --- a/src/app/shared/stores/banners/banners.state.ts +++ b/src/app/shared/stores/banners/banners.state.ts @@ -5,7 +5,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { BannerModel } from '@core/components/osf-banners/models/banner.model'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { BannersService } from '@osf/shared/services/banners.service'; import { GetCurrentScheduledBanner } from './banners.actions'; diff --git a/src/app/shared/stores/bookmarks/bookmarks.actions.ts b/src/app/shared/stores/bookmarks/bookmarks.actions.ts index 129015edb..28d14ea5c 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.actions.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.actions.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@shared/enums'; +import { ResourceType } from '@shared/enums/resource-type.enum'; export class GetBookmarksCollectionId { static readonly type = '[Bookmarks] Get Bookmarks Collection Id'; diff --git a/src/app/shared/stores/bookmarks/bookmarks.model.ts b/src/app/shared/stores/bookmarks/bookmarks.model.ts index dca9eb9b6..8305c82d4 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.model.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.model.ts @@ -1,4 +1,4 @@ -import { AsyncStateModel } from '@shared/models/store'; +import { AsyncStateModel } from '@shared/models/store/async-state.model'; export interface BookmarksStateModel { bookmarksId: AsyncStateModel; diff --git a/src/app/shared/stores/bookmarks/bookmarks.state.ts b/src/app/shared/stores/bookmarks/bookmarks.state.ts index 90cb96a30..e02ccf142 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.state.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.state.ts @@ -4,8 +4,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; -import { BookmarksService } from '@shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { BookmarksService } from '@osf/shared/services/bookmarks.service'; import { AddResourceToBookmarks, GetBookmarksCollectionId, RemoveResourceFromBookmarks } from './bookmarks.actions'; import { BOOKMARKS_DEFAULTS, BookmarksStateModel } from './bookmarks.model'; diff --git a/src/app/shared/stores/citations/citations.actions.ts b/src/app/shared/stores/citations/citations.actions.ts index e8a65b1d0..bf7d87ad4 100644 --- a/src/app/shared/stores/citations/citations.actions.ts +++ b/src/app/shared/stores/citations/citations.actions.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@shared/enums'; -import { CustomCitationPayload } from '@shared/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { CustomCitationPayload } from '@shared/models/citations/custom-citation-payload.model'; export class GetDefaultCitations { static readonly type = '[Citations] Get Default Citations'; diff --git a/src/app/shared/stores/citations/citations.model.ts b/src/app/shared/stores/citations/citations.model.ts index f7603c56d..d0670395b 100644 --- a/src/app/shared/stores/citations/citations.model.ts +++ b/src/app/shared/stores/citations/citations.model.ts @@ -1,4 +1,6 @@ -import { AsyncStateModel, CitationStyle, StyledCitation } from '@osf/shared/models'; +import { CitationStyle } from '@osf/shared/models/citations/citation-style.model'; +import { StyledCitation } from '@osf/shared/models/citations/styled-citation.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface CitationsStateModel { defaultCitations: AsyncStateModel; diff --git a/src/app/shared/stores/citations/citations.state.ts b/src/app/shared/stores/citations/citations.state.ts index a4feb6eba..73defb513 100644 --- a/src/app/shared/stores/citations/citations.state.ts +++ b/src/app/shared/stores/citations/citations.state.ts @@ -4,8 +4,8 @@ import { catchError, forkJoin, Observable, of, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { CitationTypes } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; +import { CitationTypes } from '@osf/shared/enums/citation-types.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { CitationsService } from '@osf/shared/services/citations.service'; import { diff --git a/src/app/shared/stores/collections/collections.actions.ts b/src/app/shared/stores/collections/collections.actions.ts index 61ce331fb..cf43e1f98 100644 --- a/src/app/shared/stores/collections/collections.actions.ts +++ b/src/app/shared/stores/collections/collections.actions.ts @@ -1,4 +1,4 @@ -import { CollectionsFilters } from '@osf/shared/models'; +import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model'; export class GetCollectionProvider { static readonly type = '[Collections] Get Collection Provider'; diff --git a/src/app/shared/stores/collections/collections.model.ts b/src/app/shared/stores/collections/collections.model.ts index 49dee4ffe..8e17d8581 100644 --- a/src/app/shared/stores/collections/collections.model.ts +++ b/src/app/shared/stores/collections/collections.model.ts @@ -1,11 +1,11 @@ import { CollectionDetails, CollectionProvider, - CollectionsFilters, CollectionSubmission, CollectionSubmissionWithGuid, -} from '@shared/models'; -import { AsyncStateModel } from '@shared/models/store'; +} from '@osf/shared/models/collections/collections.models'; +import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface CollectionsStateModel { currentFilters: CollectionsFilters; diff --git a/src/app/shared/stores/collections/collections.selectors.ts b/src/app/shared/stores/collections/collections.selectors.ts index f2ba6bb69..ca076ada9 100644 --- a/src/app/shared/stores/collections/collections.selectors.ts +++ b/src/app/shared/stores/collections/collections.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { CollectionsFilters } from '@shared/models'; +import { CollectionsFilters } from '@osf/shared/models/collections/collections-filters.model'; import { CollectionsStateModel } from './collections.model'; import { CollectionsState } from './collections.state'; diff --git a/src/app/shared/stores/collections/collections.state.ts b/src/app/shared/stores/collections/collections.state.ts index d1faca597..3e63137b6 100644 --- a/src/app/shared/stores/collections/collections.state.ts +++ b/src/app/shared/stores/collections/collections.state.ts @@ -5,9 +5,9 @@ import { catchError, forkJoin, of, switchMap, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { SetCurrentProvider } from '@core/store/provider'; -import { CurrentResourceType } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; -import { CollectionsService } from '@osf/shared/services'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { CollectionsService } from '@osf/shared/services/collections.service'; import { ClearCollections, diff --git a/src/app/shared/stores/contributors/contributors.actions.ts b/src/app/shared/stores/contributors/contributors.actions.ts index e2654c6c9..2bb634cfc 100644 --- a/src/app/shared/stores/contributors/contributors.actions.ts +++ b/src/app/shared/stores/contributors/contributors.actions.ts @@ -1,6 +1,8 @@ -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ResourceType } from '@osf/shared/enums'; -import { ContributorAddModel, ContributorModel, RequestAccessPayload } from '@osf/shared/models'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorAddModel } from '@shared/models/contributors/contributor-add.model'; +import { RequestAccessPayload } from '@shared/models/request-access/request-access-payload.model'; export class GetAllContributors { static readonly type = '[Contributors] Get All Contributors'; diff --git a/src/app/shared/stores/contributors/contributors.model.ts b/src/app/shared/stores/contributors/contributors.model.ts index 89d34a7fd..28efa9ed3 100644 --- a/src/app/shared/stores/contributors/contributors.model.ts +++ b/src/app/shared/stores/contributors/contributors.model.ts @@ -1,6 +1,9 @@ -import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants'; -import { ContributorAddModel, ContributorModel, RequestAccessModel } from '@osf/shared/models'; -import { AsyncStateModel, AsyncStateWithTotalCount } from '@osf/shared/models/store'; +import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; +import { ContributorModel } from '@shared/models/contributors/contributor.model'; +import { ContributorAddModel } from '@shared/models/contributors/contributor-add.model'; +import { RequestAccessModel } from '@shared/models/request-access/request-access.model'; +import { AsyncStateModel } from '@shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@shared/models/store/async-state-with-total-count.model'; export interface ContributorsList extends AsyncStateWithTotalCount { page: number; diff --git a/src/app/shared/stores/contributors/contributors.state.ts b/src/app/shared/stores/contributors/contributors.state.ts index cd894866a..0e738afec 100644 --- a/src/app/shared/stores/contributors/contributors.state.ts +++ b/src/app/shared/stores/contributors/contributors.state.ts @@ -4,8 +4,9 @@ import { catchError, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { ContributorsService, RequestAccessService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { ContributorsService } from '@osf/shared/services/contributors.service'; +import { RequestAccessService } from '@osf/shared/services/request-access.service'; import { AcceptRequestAccess, diff --git a/src/app/shared/stores/current-resource/current-resource.actions.ts b/src/app/shared/stores/current-resource/current-resource.actions.ts index 3b480c252..f911603e7 100644 --- a/src/app/shared/stores/current-resource/current-resource.actions.ts +++ b/src/app/shared/stores/current-resource/current-resource.actions.ts @@ -1,4 +1,4 @@ -import { ResourceType } from '@osf/shared/enums'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; export class GetResource { static readonly type = '[ResourceType] Get Resource'; diff --git a/src/app/shared/stores/current-resource/current-resource.model.ts b/src/app/shared/stores/current-resource/current-resource.model.ts index 49fa2de55..4f5967861 100644 --- a/src/app/shared/stores/current-resource/current-resource.model.ts +++ b/src/app/shared/stores/current-resource/current-resource.model.ts @@ -1,5 +1,7 @@ -import { BaseNodeModel, CurrentResource, NodeShortInfoModel } from '@osf/shared/models'; -import { AsyncStateModel } from '@shared/models/store'; +import { CurrentResource } from '@osf/shared/models/current-resource.model'; +import { BaseNodeModel } from '@osf/shared/models/nodes/base-node.model'; +import { NodeShortInfoModel } from '@osf/shared/models/nodes/node-with-children.model'; +import { AsyncStateModel } from '@shared/models/store/async-state.model'; export interface CurrentResourceStateModel { currentResource: AsyncStateModel; diff --git a/src/app/shared/stores/current-resource/current-resource.selectors.ts b/src/app/shared/stores/current-resource/current-resource.selectors.ts index 4b4acce0d..c4d7d3b17 100644 --- a/src/app/shared/stores/current-resource/current-resource.selectors.ts +++ b/src/app/shared/stores/current-resource/current-resource.selectors.ts @@ -1,7 +1,9 @@ import { Selector } from '@ngxs/store'; -import { BaseNodeModel, CurrentResource, NodeShortInfoModel } from '@osf/shared/models'; -import { UserPermissions } from '@shared/enums'; +import { UserPermissions } from '@shared/enums/user-permissions.enum'; +import { CurrentResource } from '@shared/models/current-resource.model'; +import { BaseNodeModel } from '@shared/models/nodes/base-node.model'; +import { NodeShortInfoModel } from '@shared/models/nodes/node-with-children.model'; import { CurrentResourceStateModel } from './current-resource.model'; import { CurrentResourceState } from './current-resource.state'; diff --git a/src/app/shared/stores/current-resource/current-resource.state.ts b/src/app/shared/stores/current-resource/current-resource.state.ts index 78fcc8401..199c355d8 100644 --- a/src/app/shared/stores/current-resource/current-resource.state.ts +++ b/src/app/shared/stores/current-resource/current-resource.state.ts @@ -4,8 +4,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { ResourceGuidService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { ResourceGuidService } from '@osf/shared/services/resource.service'; import { GetResource, GetResourceDetails, GetResourceWithChildren } from './current-resource.actions'; import { CURRENT_RESOURCE_DEFAULTS, CurrentResourceStateModel } from './current-resource.model'; diff --git a/src/app/shared/stores/duplicates/duplicates.model.ts b/src/app/shared/stores/duplicates/duplicates.model.ts index bb8867bb2..6ecd20975 100644 --- a/src/app/shared/stores/duplicates/duplicates.model.ts +++ b/src/app/shared/stores/duplicates/duplicates.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateWithTotalCount, NodeModel } from '@osf/shared/models'; +import { NodeModel } from '@osf/shared/models/nodes/base-node.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface DuplicatesStateModel { duplicates: AsyncStateWithTotalCount; diff --git a/src/app/shared/stores/duplicates/duplicates.state.ts b/src/app/shared/stores/duplicates/duplicates.state.ts index e34f64f09..18fd52d91 100644 --- a/src/app/shared/stores/duplicates/duplicates.state.ts +++ b/src/app/shared/stores/duplicates/duplicates.state.ts @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { DuplicatesService } from '@shared/services/duplicates.service'; import { ClearDuplicates, GetAllDuplicates } from './duplicates.actions'; diff --git a/src/app/shared/stores/global-search/global-search.actions.ts b/src/app/shared/stores/global-search/global-search.actions.ts index 49879d6b0..00dfa8d38 100644 --- a/src/app/shared/stores/global-search/global-search.actions.ts +++ b/src/app/shared/stores/global-search/global-search.actions.ts @@ -1,6 +1,6 @@ -import { ResourceType } from '@shared/enums'; -import { StringOrNull } from '@shared/helpers'; -import { FilterOption } from '@shared/models'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { FilterOption } from '@shared/models/search/discaverable-filter.model'; export class FetchResources { static readonly type = '[GlobalSearch] Fetch Resources'; diff --git a/src/app/shared/stores/global-search/global-search.model.ts b/src/app/shared/stores/global-search/global-search.model.ts index 09ba1c69a..2174a080c 100644 --- a/src/app/shared/stores/global-search/global-search.model.ts +++ b/src/app/shared/stores/global-search/global-search.model.ts @@ -1,6 +1,8 @@ -import { ResourceType } from '@osf/shared/enums'; -import { StringOrNull } from '@osf/shared/helpers'; -import { AsyncStateModel, DiscoverableFilter, FilterOption, ResourceModel } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { DiscoverableFilter, FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface GlobalSearchStateModel { resources: AsyncStateModel; diff --git a/src/app/shared/stores/global-search/global-search.selectors.ts b/src/app/shared/stores/global-search/global-search.selectors.ts index d76104f68..01b5add12 100644 --- a/src/app/shared/stores/global-search/global-search.selectors.ts +++ b/src/app/shared/stores/global-search/global-search.selectors.ts @@ -1,8 +1,9 @@ import { Selector } from '@ngxs/store'; -import { ResourceType } from '@osf/shared/enums'; -import { StringOrNull } from '@osf/shared/helpers'; -import { DiscoverableFilter, FilterOption, ResourceModel } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { DiscoverableFilter, FilterOption } from '@osf/shared/models/search/discaverable-filter.model'; +import { ResourceModel } from '@osf/shared/models/search/resource.model'; import { GlobalSearchStateModel } from './global-search.model'; import { GlobalSearchState } from './global-search.state'; diff --git a/src/app/shared/stores/global-search/global-search.state.ts b/src/app/shared/stores/global-search/global-search.state.ts index a4db01970..3839eb796 100644 --- a/src/app/shared/stores/global-search/global-search.state.ts +++ b/src/app/shared/stores/global-search/global-search.state.ts @@ -5,9 +5,10 @@ import { catchError, EMPTY, forkJoin, Observable, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { getResourceTypeStringFromEnum } from '@shared/helpers'; -import { FilterOperator, ResourcesData } from '@shared/models'; -import { GlobalSearchService } from '@shared/services'; +import { getResourceTypeStringFromEnum } from '@osf/shared/helpers/get-resource-types.helper'; +import { GlobalSearchService } from '@osf/shared/services/global-search.service'; +import { FilterOperatorOption } from '@shared/models/search/discaverable-filter.model'; +import { ResourcesData } from '@shared/models/search/resource.model'; import { ClearFilterSearchResults, @@ -303,7 +304,7 @@ export class GlobalSearchState { const firstOptionValue = options[0]?.value; const isOptionValueBoolean = firstOptionValue === 'true' || firstOptionValue === 'false'; - if (filter?.operator === FilterOperator.IsPresent || isOptionValueBoolean) { + if (filter?.operator === FilterOperatorOption.IsPresent || isOptionValueBoolean) { if (firstOptionValue) { filtersParams[`cardSearchFilter[${key}][is-present]`] = firstOptionValue; } diff --git a/src/app/shared/stores/institutions-search/institutions-search.model.ts b/src/app/shared/stores/institutions-search/institutions-search.model.ts index 7d4208344..c319194e2 100644 --- a/src/app/shared/stores/institutions-search/institutions-search.model.ts +++ b/src/app/shared/stores/institutions-search/institutions-search.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, Institution } from '@shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface InstitutionsSearchModel { institution: AsyncStateModel; diff --git a/src/app/shared/stores/institutions-search/institutions-search.state.ts b/src/app/shared/stores/institutions-search/institutions-search.state.ts index 143ecfec5..0600b0231 100644 --- a/src/app/shared/stores/institutions-search/institutions-search.state.ts +++ b/src/app/shared/stores/institutions-search/institutions-search.state.ts @@ -5,9 +5,9 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { Institution } from '@osf/shared/models'; -import { InstitutionsService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { InstitutionsService } from '@osf/shared/services/institutions.service'; import { FetchInstitutionById } from './institutions-search.actions'; import { INSTITUTIONS_SEARCH_STATE_DEFAULTS, InstitutionsSearchModel } from './institutions-search.model'; diff --git a/src/app/shared/stores/institutions/institutions.actions.ts b/src/app/shared/stores/institutions/institutions.actions.ts index 2d05bfd44..7645e7d6b 100644 --- a/src/app/shared/stores/institutions/institutions.actions.ts +++ b/src/app/shared/stores/institutions/institutions.actions.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@shared/enums'; -import { Institution } from '@shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { Institution } from '@shared/models/institutions/institutions.models'; export class FetchUserInstitutions { static readonly type = '[Institutions] Fetch User Institutions'; diff --git a/src/app/shared/stores/institutions/institutions.model.ts b/src/app/shared/stores/institutions/institutions.model.ts index 5eb7bf2aa..984d18a5e 100644 --- a/src/app/shared/stores/institutions/institutions.model.ts +++ b/src/app/shared/stores/institutions/institutions.model.ts @@ -1,4 +1,6 @@ -import { AsyncStateModel, AsyncStateWithTotalCount, Institution } from '@osf/shared/models'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface InstitutionsStateModel { userInstitutions: AsyncStateModel; diff --git a/src/app/shared/stores/institutions/institutions.state.ts b/src/app/shared/stores/institutions/institutions.state.ts index b88b8c7f4..631f9ec56 100644 --- a/src/app/shared/stores/institutions/institutions.state.ts +++ b/src/app/shared/stores/institutions/institutions.state.ts @@ -5,8 +5,8 @@ import { catchError, Observable, tap, throwError } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { InstitutionsService } from '@osf/shared/services'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { InstitutionsService } from '@osf/shared/services/institutions.service'; import { FetchInstitutions, diff --git a/src/app/shared/stores/licenses/licenses.model.ts b/src/app/shared/stores/licenses/licenses.model.ts index 932ebb747..26f0c7629 100644 --- a/src/app/shared/stores/licenses/licenses.model.ts +++ b/src/app/shared/stores/licenses/licenses.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, LicenseModel } from '@osf/shared/models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface LicensesStateModel { licenses: AsyncStateModel; diff --git a/src/app/shared/stores/licenses/licenses.selectors.ts b/src/app/shared/stores/licenses/licenses.selectors.ts index 2d5739743..3fa6ae827 100644 --- a/src/app/shared/stores/licenses/licenses.selectors.ts +++ b/src/app/shared/stores/licenses/licenses.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { LicenseModel } from '@osf/shared/models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; import { LicensesStateModel } from './licenses.model'; import { LicensesState } from './licenses.state'; diff --git a/src/app/shared/stores/licenses/licenses.state.ts b/src/app/shared/stores/licenses/licenses.state.ts index bc078dd80..2a55889fd 100644 --- a/src/app/shared/stores/licenses/licenses.state.ts +++ b/src/app/shared/stores/licenses/licenses.state.ts @@ -5,7 +5,7 @@ import { catchError, tap } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { LicensesService } from '@osf/shared/services'; +import { LicensesService } from '@osf/shared/services/licenses.service'; import { LoadAllLicenses } from './licenses.actions'; import { LICENSES_STATE_DEFAULTS, LicensesStateModel } from './licenses.model'; diff --git a/src/app/shared/stores/linked-projects/linked-projects.model.ts b/src/app/shared/stores/linked-projects/linked-projects.model.ts index a4f1e28d0..c131ea710 100644 --- a/src/app/shared/stores/linked-projects/linked-projects.model.ts +++ b/src/app/shared/stores/linked-projects/linked-projects.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateWithTotalCount, NodeModel } from '@osf/shared/models'; +import { NodeModel } from '@osf/shared/models/nodes/base-node.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface LinkedProjectsStateModel { linkedProjects: AsyncStateWithTotalCount; diff --git a/src/app/shared/stores/linked-projects/linked-projects.state.ts b/src/app/shared/stores/linked-projects/linked-projects.state.ts index 42dcd4c88..ae31adcf4 100644 --- a/src/app/shared/stores/linked-projects/linked-projects.state.ts +++ b/src/app/shared/stores/linked-projects/linked-projects.state.ts @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { LinkedProjectsService } from '@shared/services/linked-projects.service'; import { ClearLinkedProjects, GetAllLinkedProjects } from './linked-projects.actions'; diff --git a/src/app/shared/stores/my-resources/my-resources.actions.ts b/src/app/shared/stores/my-resources/my-resources.actions.ts index bd3e2947f..738358897 100644 --- a/src/app/shared/stores/my-resources/my-resources.actions.ts +++ b/src/app/shared/stores/my-resources/my-resources.actions.ts @@ -1,6 +1,6 @@ -import { ResourceSearchMode, ResourceType } from '@shared/enums'; - -import { MyResourcesSearchFilters } from 'src/app/shared/models/my-resources'; +import { ResourceSearchMode } from '@osf/shared/enums/resource-search-mode.enum'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { MyResourcesSearchFilters } from '@osf/shared/models/my-resources/my-resources-search-filters.models'; export class GetMyProjects { static readonly type = '[My Resources] Get Projects'; diff --git a/src/app/shared/stores/my-resources/my-resources.model.ts b/src/app/shared/stores/my-resources/my-resources.model.ts index b3cc9f276..ad3db88c6 100644 --- a/src/app/shared/stores/my-resources/my-resources.model.ts +++ b/src/app/shared/stores/my-resources/my-resources.model.ts @@ -1,6 +1,5 @@ -import { AsyncStateModel } from '@shared/models'; - -import { MyResourcesItem } from 'src/app/shared/models/my-resources'; +import { MyResourcesItem } from '@osf/shared/models/my-resources/my-resources.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface MyResourcesStateModel { projects: AsyncStateModel; diff --git a/src/app/shared/stores/my-resources/my-resources.selectors.ts b/src/app/shared/stores/my-resources/my-resources.selectors.ts index 2890ffd1c..4a62e3fa5 100644 --- a/src/app/shared/stores/my-resources/my-resources.selectors.ts +++ b/src/app/shared/stores/my-resources/my-resources.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { MyResourcesItem } from '@osf/shared/models'; +import { MyResourcesItem } from '@osf/shared/models/my-resources/my-resources.models'; import { MyResourcesStateModel } from './my-resources.model'; import { MyResourcesState } from './my-resources.state'; diff --git a/src/app/shared/stores/my-resources/my-resources.state.ts b/src/app/shared/stores/my-resources/my-resources.state.ts index a6cbd80e0..61a8c36dc 100644 --- a/src/app/shared/stores/my-resources/my-resources.state.ts +++ b/src/app/shared/stores/my-resources/my-resources.state.ts @@ -4,9 +4,9 @@ import { catchError, forkJoin, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { ResourceType } from '@osf/shared/enums'; -import { handleSectionError } from '@osf/shared/helpers'; -import { MyResourcesService } from '@osf/shared/services'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { MyResourcesService } from '@osf/shared/services/my-resources.service'; import { ClearMyResources, diff --git a/src/app/shared/stores/node-links/node-links.actions.ts b/src/app/shared/stores/node-links/node-links.actions.ts index da48a8ba7..1c4fdc53a 100644 --- a/src/app/shared/stores/node-links/node-links.actions.ts +++ b/src/app/shared/stores/node-links/node-links.actions.ts @@ -1,4 +1,5 @@ -import { ComponentOverview, MyResourcesItem } from '@osf/shared/models'; +import { ComponentOverview } from '@osf/shared/models/components/components.models'; +import { MyResourcesItem } from '@osf/shared/models/my-resources/my-resources.models'; export class CreateNodeLink { static readonly type = '[Node Links] Create Node Link'; diff --git a/src/app/shared/stores/node-links/node-links.model.ts b/src/app/shared/stores/node-links/node-links.model.ts index 91208eb02..eec2c3bc7 100644 --- a/src/app/shared/stores/node-links/node-links.model.ts +++ b/src/app/shared/stores/node-links/node-links.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, ComponentOverview } from '@osf/shared/models'; +import { ComponentOverview } from '@osf/shared/models/components/components.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface NodeLinksStateModel { linkedResources: AsyncStateModel; diff --git a/src/app/shared/stores/node-links/node-links.state.ts b/src/app/shared/stores/node-links/node-links.state.ts index b619970a2..213a2cf4a 100644 --- a/src/app/shared/stores/node-links/node-links.state.ts +++ b/src/app/shared/stores/node-links/node-links.state.ts @@ -4,7 +4,7 @@ import { catchError, forkJoin, tap, throwError } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { NodeLinksService } from '@osf/shared/services'; +import { NodeLinksService } from '@osf/shared/services/node-links.service'; import { ClearNodeLinks, CreateNodeLink, DeleteNodeLink, GetLinkedResources } from './node-links.actions'; import { NODE_LINKS_DEFAULTS, NodeLinksStateModel } from './node-links.model'; diff --git a/src/app/shared/stores/projects/projects.actions.ts b/src/app/shared/stores/projects/projects.actions.ts index 3a7731e12..6896ba6fe 100644 --- a/src/app/shared/stores/projects/projects.actions.ts +++ b/src/app/shared/stores/projects/projects.actions.ts @@ -1,5 +1,5 @@ -import { ProjectMetadataUpdatePayload } from '@shared/models'; -import { ProjectModel } from '@shared/models/projects'; +import { ProjectMetadataUpdatePayload } from '@shared/models/project-metadata-update-payload.model'; +import { ProjectModel } from '@shared/models/projects/projects.models'; export class GetProjects { static readonly type = '[Projects] Get Projects'; diff --git a/src/app/shared/stores/projects/projects.model.ts b/src/app/shared/stores/projects/projects.model.ts index cb8bb5250..13e2862d0 100644 --- a/src/app/shared/stores/projects/projects.model.ts +++ b/src/app/shared/stores/projects/projects.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, ProjectModel } from '@osf/shared/models'; +import { ProjectModel } from '@osf/shared/models/projects/projects.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface ProjectsStateModel { projects: AsyncStateModel; diff --git a/src/app/shared/stores/projects/projects.state.ts b/src/app/shared/stores/projects/projects.state.ts index 37f6b9d94..eaacb71a7 100644 --- a/src/app/shared/stores/projects/projects.state.ts +++ b/src/app/shared/stores/projects/projects.state.ts @@ -4,7 +4,7 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { ProjectsService } from '@osf/shared/services/projects.service'; import { ClearProjects, GetProjects, SetSelectedProject, UpdateProjectMetadata } from './projects.actions'; diff --git a/src/app/shared/stores/regions/regions.model.ts b/src/app/shared/stores/regions/regions.model.ts index e31587434..d8361dc1f 100644 --- a/src/app/shared/stores/regions/regions.model.ts +++ b/src/app/shared/stores/regions/regions.model.ts @@ -1,7 +1,8 @@ -import { AsyncStateModel, IdName } from '@shared/models'; +import { IdNameModel } from '@osf/shared/models/common/id-name.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface RegionsStateModel { - regions: AsyncStateModel; + regions: AsyncStateModel; } export const REGIONS_STATE_DEFAULTS = { diff --git a/src/app/shared/stores/regions/regions.state.ts b/src/app/shared/stores/regions/regions.state.ts index 31f984ab0..30d34cd2c 100644 --- a/src/app/shared/stores/regions/regions.state.ts +++ b/src/app/shared/stores/regions/regions.state.ts @@ -5,8 +5,8 @@ import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { RegionsService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { RegionsService } from '@osf/shared/services/regions.service'; import { FetchRegions } from './regions.actions'; import { REGIONS_STATE_DEFAULTS, RegionsStateModel } from './regions.model'; diff --git a/src/app/shared/stores/registration-provider/registration-provider.model.ts b/src/app/shared/stores/registration-provider/registration-provider.model.ts index 00928acbc..8e5e08343 100644 --- a/src/app/shared/stores/registration-provider/registration-provider.model.ts +++ b/src/app/shared/stores/registration-provider/registration-provider.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, RegistryProviderDetails } from '@shared/models'; +import { RegistryProviderDetails } from '@osf/shared/models/provider/registry-provider.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; export interface RegistrationProviderStateModel { currentBrandedProvider: AsyncStateModel; diff --git a/src/app/shared/stores/registration-provider/registration-provider.state.ts b/src/app/shared/stores/registration-provider/registration-provider.state.ts index 393adbaea..c627a435a 100644 --- a/src/app/shared/stores/registration-provider/registration-provider.state.ts +++ b/src/app/shared/stores/registration-provider/registration-provider.state.ts @@ -5,10 +5,9 @@ import { catchError, of, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { SetCurrentProvider } from '@core/store/provider'; -import { CurrentResourceType } from '@osf/shared/enums'; -import { handleSectionError } from '@shared/helpers'; - -import { RegistrationProviderService } from '../../services'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { RegistrationProviderService } from '@osf/shared/services/registration-provider.service'; import { ClearRegistryProvider, GetRegistryProvider } from './registration-provider.actions'; import { diff --git a/src/app/shared/stores/subjects/subjects.actions.ts b/src/app/shared/stores/subjects/subjects.actions.ts index ac2ef539e..63241f70a 100644 --- a/src/app/shared/stores/subjects/subjects.actions.ts +++ b/src/app/shared/stores/subjects/subjects.actions.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@osf/shared/enums'; -import { SubjectModel } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; export class FetchSubjects { static readonly type = '[Subjects] Fetch Subjects'; diff --git a/src/app/shared/stores/subjects/subjects.model.ts b/src/app/shared/stores/subjects/subjects.model.ts index a412febfc..e4f450880 100644 --- a/src/app/shared/stores/subjects/subjects.model.ts +++ b/src/app/shared/stores/subjects/subjects.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, SubjectModel } from '@shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; export interface SubjectsModel { subjects: AsyncStateModel; diff --git a/src/app/shared/stores/subjects/subjects.selectors.ts b/src/app/shared/stores/subjects/subjects.selectors.ts index f1eea6397..9a8809130 100644 --- a/src/app/shared/stores/subjects/subjects.selectors.ts +++ b/src/app/shared/stores/subjects/subjects.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { SubjectModel } from '@osf/shared/models'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; import { SubjectsModel } from './subjects.model'; import { SubjectsState } from './subjects.state'; diff --git a/src/app/shared/stores/subjects/subjects.state.ts b/src/app/shared/stores/subjects/subjects.state.ts index dc0a9a07b..6dd296910 100644 --- a/src/app/shared/stores/subjects/subjects.state.ts +++ b/src/app/shared/stores/subjects/subjects.state.ts @@ -4,8 +4,8 @@ import { catchError, tap, throwError } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { SubjectModel } from '@osf/shared/models'; -import { SubjectsService } from '@osf/shared/services'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; +import { SubjectsService } from '@osf/shared/services/subjects.service'; import { FetchChildrenSubjects, diff --git a/src/app/shared/stores/view-only-links/view-only-link.actions.ts b/src/app/shared/stores/view-only-links/view-only-link.actions.ts index f19745a1d..91f89a404 100644 --- a/src/app/shared/stores/view-only-links/view-only-link.actions.ts +++ b/src/app/shared/stores/view-only-links/view-only-link.actions.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@osf/shared/enums'; -import { ViewOnlyLinkJsonApi } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ViewOnlyLinkJsonApi } from '@osf/shared/models/view-only-links/view-only-link-response.model'; export class FetchViewOnlyLinks { static readonly type = '[Link] Fetch View Only Links'; diff --git a/src/app/shared/stores/view-only-links/view-only-link.model.ts b/src/app/shared/stores/view-only-links/view-only-link.model.ts index cfd4de2fe..c8331728f 100644 --- a/src/app/shared/stores/view-only-links/view-only-link.model.ts +++ b/src/app/shared/stores/view-only-links/view-only-link.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, PaginatedViewOnlyLinksModel } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { PaginatedViewOnlyLinksModel } from '@osf/shared/models/view-only-links/view-only-link.model'; export interface ViewOnlyLinkStateModel { viewOnlyLinks: AsyncStateModel; diff --git a/src/app/shared/stores/view-only-links/view-only-link.state.ts b/src/app/shared/stores/view-only-links/view-only-link.state.ts index 680148a4f..051813f80 100644 --- a/src/app/shared/stores/view-only-links/view-only-link.state.ts +++ b/src/app/shared/stores/view-only-links/view-only-link.state.ts @@ -6,9 +6,9 @@ import { catchError, tap } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; -import { handleSectionError } from '@osf/shared/helpers'; -import { PaginatedViewOnlyLinksModel } from '@osf/shared/models'; -import { ViewOnlyLinksService } from '@osf/shared/services'; +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { PaginatedViewOnlyLinksModel } from '@osf/shared/models/view-only-links/view-only-link.model'; +import { ViewOnlyLinksService } from '@osf/shared/services/view-only-links.service'; import { CreateViewOnlyLink, DeleteViewOnlyLink, FetchViewOnlyLinks } from './view-only-link.actions'; import { VIEW_ONLY_LINK_STATE_DEFAULTS, ViewOnlyLinkStateModel } from './view-only-link.model'; diff --git a/src/app/shared/stores/wiki/wiki.actions.ts b/src/app/shared/stores/wiki/wiki.actions.ts index ccf9bb1b2..c143793fc 100644 --- a/src/app/shared/stores/wiki/wiki.actions.ts +++ b/src/app/shared/stores/wiki/wiki.actions.ts @@ -1,5 +1,5 @@ -import { ResourceType } from '@osf/shared/enums'; -import { WikiModes } from '@osf/shared/models'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { WikiModes } from '@shared/models/wiki/wiki.model'; export class CreateWiki { static readonly type = '[Wiki] Create Wiki'; diff --git a/src/app/shared/stores/wiki/wiki.model.ts b/src/app/shared/stores/wiki/wiki.model.ts index 3763a1c0f..25a36e9c8 100644 --- a/src/app/shared/stores/wiki/wiki.model.ts +++ b/src/app/shared/stores/wiki/wiki.model.ts @@ -1,4 +1,5 @@ -import { AsyncStateModel, Wiki, WikiVersion } from '@osf/shared/models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { WikiModel, WikiVersion } from '@osf/shared/models/wiki/wiki.model'; export interface WikiModesStateModel { view: boolean; @@ -9,13 +10,13 @@ export interface WikiModesStateModel { export interface ComponentWiki { id: string; title: string; - list: Wiki[]; + list: WikiModel[]; } export interface WikiStateModel { homeWikiContent: AsyncStateModel; wikiModes: WikiModesStateModel; - wikiList: AsyncStateModel; + wikiList: AsyncStateModel; componentsWikiList: AsyncStateModel; currentWikiId: string; previewContent: string; diff --git a/src/app/shared/stores/wiki/wiki.selectors.ts b/src/app/shared/stores/wiki/wiki.selectors.ts index 02315bdf0..1878101a2 100644 --- a/src/app/shared/stores/wiki/wiki.selectors.ts +++ b/src/app/shared/stores/wiki/wiki.selectors.ts @@ -1,6 +1,6 @@ import { Selector } from '@ngxs/store'; -import { Wiki, WikiVersion } from '@osf/shared/models'; +import { WikiModel, WikiVersion } from '@osf/shared/models/wiki/wiki.model'; import { ComponentWiki, WikiModesStateModel, WikiStateModel } from './wiki.model'; import { WikiState } from './wiki.state'; @@ -22,7 +22,7 @@ export class WikiSelectors { } @Selector([WikiState]) - static getWikiList(state: WikiStateModel): Wiki[] { + static getWikiList(state: WikiStateModel): WikiModel[] { return state.wikiList.data; } diff --git a/src/app/shared/stores/wiki/wiki.state.ts b/src/app/shared/stores/wiki/wiki.state.ts index 651c38f5f..86fbf7fd4 100644 --- a/src/app/shared/stores/wiki/wiki.state.ts +++ b/src/app/shared/stores/wiki/wiki.state.ts @@ -2,9 +2,9 @@ import { Action, State, StateContext } from '@ngxs/store'; import { catchError, map, tap, throwError } from 'rxjs'; -import { Injectable } from '@angular/core'; +import { inject, Injectable } from '@angular/core'; -import { WikiService } from '@osf/shared/services'; +import { WikiService } from '@osf/shared/services/wiki.service'; import { ClearWiki, @@ -29,7 +29,7 @@ import { WIKI_STATE_DEFAULTS, WikiStateModel } from './wiki.model'; }) @Injectable() export class WikiState { - constructor(private wikiService: WikiService) {} + private readonly wikiService = inject(WikiService); @Action(CreateWiki) createWiki(ctx: StateContext, action: CreateWiki) { diff --git a/src/testing/data/addons/addons.configured.data.ts b/src/testing/data/addons/addons.configured.data.ts index a6fb9ab59..537cad298 100644 --- a/src/testing/data/addons/addons.configured.data.ts +++ b/src/testing/data/addons/addons.configured.data.ts @@ -1,4 +1,4 @@ -import { AddonMapper } from '@osf/shared/mappers'; +import { AddonMapper } from '@osf/shared/mappers/addon.mapper'; import structuredClone from 'structured-clone'; diff --git a/src/testing/data/dashboard/dasboard.data.ts b/src/testing/data/dashboard/dasboard.data.ts index 38a8177ca..61ea6275a 100644 --- a/src/testing/data/dashboard/dasboard.data.ts +++ b/src/testing/data/dashboard/dasboard.data.ts @@ -1,4 +1,4 @@ -import { MyResourcesItem } from '@shared/models'; +import { MyResourcesItem } from '@shared/models/my-resources/my-resources.models'; import structuredClone from 'structured-clone'; diff --git a/src/testing/data/files/node.data.ts b/src/testing/data/files/node.data.ts index 17f6713b6..1f8208b74 100644 --- a/src/testing/data/files/node.data.ts +++ b/src/testing/data/files/node.data.ts @@ -1,4 +1,4 @@ -import { FilesMapper } from '@osf/shared/mappers'; +import { FilesMapper } from '@osf/shared/mappers/files/files.mapper'; import structuredClone from 'structured-clone'; diff --git a/src/testing/mocks/addon.mock.ts b/src/testing/mocks/addon.mock.ts index 31ff950b4..17577f2b7 100644 --- a/src/testing/mocks/addon.mock.ts +++ b/src/testing/mocks/addon.mock.ts @@ -1,5 +1,5 @@ -import { CredentialsFormat } from '@osf/shared/enums'; -import { AddonModel } from '@osf/shared/models'; +import { CredentialsFormat } from '@osf/shared/enums/addons-credentials-format.enum'; +import { AddonModel } from '@shared/models/addons/addon.model'; export const MOCK_ADDON: AddonModel = { type: 'addon', diff --git a/src/testing/mocks/base-node.mock.ts b/src/testing/mocks/base-node.mock.ts index 29b930448..6ca76c161 100644 --- a/src/testing/mocks/base-node.mock.ts +++ b/src/testing/mocks/base-node.mock.ts @@ -1,4 +1,4 @@ -import { BaseNodeModel } from '../../app/shared/models'; +import { BaseNodeModel } from '@shared/models/nodes/base-node.model'; export const testNode: BaseNodeModel = { id: 'abc123', @@ -24,4 +24,6 @@ export const testNode: BaseNodeModel = { currentUserIsContributor: true, wikiEnabled: true, rootParentId: 'nt29k', + type: 'project', + parent: undefined, }; diff --git a/src/testing/mocks/cedar-artifact-viewer.mock.ts b/src/testing/mocks/cedar-artifact-viewer.mock.ts new file mode 100644 index 000000000..75613c38a --- /dev/null +++ b/src/testing/mocks/cedar-artifact-viewer.mock.ts @@ -0,0 +1,13 @@ +import { CedarEditorElement } from '@osf/features/metadata/models'; + +export class CedarArtifactViewerMock extends HTMLElement implements CedarEditorElement { + instanceObject?: unknown; + currentMetadata?: unknown; + dataQualityReport?: { + isValid: boolean; + }; +} + +if (typeof customElements !== 'undefined' && !customElements.get('cedar-artifact-viewer')) { + customElements.define('cedar-artifact-viewer', CedarArtifactViewerMock); +} diff --git a/src/testing/mocks/cedar-embeddable-editor.mock.ts b/src/testing/mocks/cedar-embeddable-editor.mock.ts new file mode 100644 index 000000000..3ac12441f --- /dev/null +++ b/src/testing/mocks/cedar-embeddable-editor.mock.ts @@ -0,0 +1,13 @@ +import { CedarEditorElement } from '@osf/features/metadata/models'; + +export class CedarEmbeddableEditorMock extends HTMLElement implements CedarEditorElement { + instanceObject?: unknown; + currentMetadata?: unknown; + dataQualityReport?: { + isValid: boolean; + }; +} + +if (typeof customElements !== 'undefined' && !customElements.get('cedar-embeddable-editor')) { + customElements.define('cedar-embeddable-editor', CedarEmbeddableEditorMock); +} diff --git a/src/testing/mocks/citation-style.mock.ts b/src/testing/mocks/citation-style.mock.ts index 48039e7ab..852da01a2 100644 --- a/src/testing/mocks/citation-style.mock.ts +++ b/src/testing/mocks/citation-style.mock.ts @@ -1,4 +1,4 @@ -import { CitationStyle } from '@shared/models'; +import { CitationStyle } from '@osf/shared/models/citations/citation-style.model'; export const CITATION_STYLES_MOCK: CitationStyle[] = [ { diff --git a/src/testing/mocks/collections-submissions.mock.ts b/src/testing/mocks/collections-submissions.mock.ts index 52b907076..db217ecb6 100644 --- a/src/testing/mocks/collections-submissions.mock.ts +++ b/src/testing/mocks/collections-submissions.mock.ts @@ -1,4 +1,4 @@ -import { CollectionSubmissionWithGuid } from '@shared/models'; +import { CollectionSubmissionWithGuid } from '@osf/shared/models/collections/collections.models'; export const MOCK_COLLECTION_SUBMISSION_1: CollectionSubmissionWithGuid = { id: '1', diff --git a/src/testing/mocks/contributors.mock.ts b/src/testing/mocks/contributors.mock.ts index ee62aae1e..81210d08f 100644 --- a/src/testing/mocks/contributors.mock.ts +++ b/src/testing/mocks/contributors.mock.ts @@ -1,6 +1,5 @@ -import { ContributorPermission } from '@shared/enums'; - -import { ContributorModel } from '../../app/shared/models'; +import { ContributorPermission } from '@osf/shared/enums/contributors/contributor-permission.enum'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; export const MOCK_CONTRIBUTOR: ContributorModel = { id: 'contributor-1', diff --git a/src/testing/mocks/custom-confirmation.service.mock.ts b/src/testing/mocks/custom-confirmation.service.mock.ts index 7b99ed9af..ba0ffc956 100644 --- a/src/testing/mocks/custom-confirmation.service.mock.ts +++ b/src/testing/mocks/custom-confirmation.service.mock.ts @@ -1,4 +1,4 @@ -import { CustomConfirmationService } from '@osf/shared/services'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; export const CustomConfirmationServiceMock = { confirmDelete: jest.fn(), diff --git a/src/testing/mocks/data.mock.ts b/src/testing/mocks/data.mock.ts index bdae889ad..7a1fd3c37 100644 --- a/src/testing/mocks/data.mock.ts +++ b/src/testing/mocks/data.mock.ts @@ -1,5 +1,5 @@ -import { UserModel } from '@osf/shared/models'; -import { UserRelatedCounts } from '@shared/models'; +import { UserModel } from '@osf/shared/models/user/user.models'; +import { UserRelatedCounts } from '@osf/shared/models/user-related-counts/user-related-counts.model'; export const MOCK_USER: UserModel = { iri: '', diff --git a/src/testing/mocks/draft-registration.mock.ts b/src/testing/mocks/draft-registration.mock.ts index 65288d761..89c46dc7c 100644 --- a/src/testing/mocks/draft-registration.mock.ts +++ b/src/testing/mocks/draft-registration.mock.ts @@ -1,4 +1,5 @@ -import { DraftRegistrationModel } from '@shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { DraftRegistrationModel } from '@shared/models/registration/draft-registration.model'; export const MOCK_DRAFT_REGISTRATION: DraftRegistrationModel = { branchedFrom: { @@ -23,4 +24,5 @@ export const MOCK_DRAFT_REGISTRATION: DraftRegistrationModel = { }, tags: [], title: 'This is a title', + currentUserPermissions: [UserPermissions.Admin, UserPermissions.Write, UserPermissions.Read], }; diff --git a/src/testing/mocks/education.mock.ts b/src/testing/mocks/education.mock.ts index 23400c19c..70d5098f5 100644 --- a/src/testing/mocks/education.mock.ts +++ b/src/testing/mocks/education.mock.ts @@ -1,4 +1,4 @@ -import { Education } from '@shared/models'; +import { Education } from '@osf/shared/models/user/education.model'; export const MOCK_EDUCATION: Education[] = [ { diff --git a/src/testing/mocks/employment.mock.ts b/src/testing/mocks/employment.mock.ts index 44aff60cd..c116cca9b 100644 --- a/src/testing/mocks/employment.mock.ts +++ b/src/testing/mocks/employment.mock.ts @@ -1,4 +1,4 @@ -import { Employment } from '@shared/models'; +import { Employment } from '@osf/shared/models/user/employment.model'; export const MOCK_EMPLOYMENT: Employment[] = [ { diff --git a/src/testing/mocks/index.ts b/src/testing/mocks/index.ts deleted file mode 100644 index 77e2b09cc..000000000 --- a/src/testing/mocks/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -export { MOCK_ADDON } from './addon.mock'; -export * from './analytics.mock'; -export * from './base-node.mock'; -export { CEDAR_METADATA_DATA_TEMPLATE_JSON_API_MOCK } from './cedar-metadata-data-template-json-api.mock'; -export * from './contributors.mock'; -export * from './custom-confirmation.service.mock'; -export * from './data.mock'; -export { MOCK_EDUCATION } from './education.mock'; -export { MOCK_EMPLOYMENT } from './employment.mock'; -export * from './employment.mock'; -export * from './filters.mock'; -export { MOCK_FUNDERS } from './funder.mock'; -export { MOCK_INSTITUTION } from './institution.mock'; -export * from './license.mock'; -export { MOCK_LICENSE } from './license.mock'; -export { LoaderServiceMock } from './loader-service.mock'; -export * from './meeting.mock'; -export { MOCK_MEETING } from './meeting.mock'; -export { MOCK_STORE } from './mock-store.mock'; -export { MOCK_NODE_DETAILS } from './node-details.mock'; -export { MOCK_NOTIFICATION_SUBSCRIPTIONS } from './notification-subscription.mock'; -export * from './project-overview.mock'; -export { MOCK_PROVIDER } from './provider.mock'; -export { MOCK_REGISTRATION } from './registration.mock'; -export * from './resource.mock'; -export { MOCK_REVIEW } from './review.mock'; -export { MOCK_SCOPES } from './scope.mock'; -export * from './submission.mock'; -export { MOCK_TOKEN } from './token.mock'; -export { TranslateServiceMock } from './translate.service.mock'; -export * from './view-only-link.mock'; -export * from './view-only-link.mock'; diff --git a/src/testing/mocks/license.mock.ts b/src/testing/mocks/license.mock.ts index 089bd710e..459a6a0a8 100644 --- a/src/testing/mocks/license.mock.ts +++ b/src/testing/mocks/license.mock.ts @@ -1,4 +1,4 @@ -import { LicenseModel } from '@shared/models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; export const MOCK_LICENSE: LicenseModel = { id: '5c20a0307f39c2c3df0814ae', diff --git a/src/testing/mocks/node-details.mock.ts b/src/testing/mocks/node-details.mock.ts index 123fcfd91..fa27ff0aa 100644 --- a/src/testing/mocks/node-details.mock.ts +++ b/src/testing/mocks/node-details.mock.ts @@ -1,4 +1,5 @@ import { NodeDetailsModel } from '@osf/features/project/settings/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; export const MOCK_NODE_DETAILS: NodeDetailsModel = { id: 'test-project-1', @@ -7,5 +8,6 @@ export const MOCK_NODE_DETAILS: NodeDetailsModel = { isPublic: true, region: { id: 'us-east-1', name: 'US East' }, affiliatedInstitutions: [], + currentUserPermissions: [UserPermissions.Admin, UserPermissions.Write, UserPermissions.Read], lastFetched: Date.now(), }; diff --git a/src/testing/mocks/notification-subscription.mock.ts b/src/testing/mocks/notification-subscription.mock.ts index ebbcedfba..f2e9f9ddd 100644 --- a/src/testing/mocks/notification-subscription.mock.ts +++ b/src/testing/mocks/notification-subscription.mock.ts @@ -1,5 +1,6 @@ -import { SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums'; -import { NotificationSubscription } from '@osf/shared/models'; +import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription-event.enum'; +import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; +import { NotificationSubscription } from '@shared/models/notifications/notification-subscription.model'; export const MOCK_NOTIFICATION_SUBSCRIPTIONS: NotificationSubscription[] = [ { @@ -12,11 +13,6 @@ export const MOCK_NOTIFICATION_SUBSCRIPTIONS: NotificationSubscription[] = [ event: SubscriptionEvent.GlobalFileUpdated, frequency: SubscriptionFrequency.Daily, }, - { - id: 'mock-notification-3', - event: SubscriptionEvent.GlobalMentions, - frequency: SubscriptionFrequency.Never, - }, { id: 'mock-notification-4', event: SubscriptionEvent.GlobalReviews, diff --git a/src/testing/mocks/osf-file.mock.ts b/src/testing/mocks/osf-file.mock.ts index d2f079b75..d795ad01d 100644 --- a/src/testing/mocks/osf-file.mock.ts +++ b/src/testing/mocks/osf-file.mock.ts @@ -1,5 +1,5 @@ -import { FileKind } from '@shared/enums'; -import { FileFolderModel } from '@shared/models'; +import { FileKind } from '@osf/shared/enums/file-kind.enum'; +import { FileFolderModel } from '@shared/models/files/file-folder.model'; export const OSF_FILE_MOCK: FileFolderModel = { id: 'file-123', diff --git a/src/testing/mocks/preprint-provider-details.ts b/src/testing/mocks/preprint-provider-details.ts index 200549b3d..e70e4c090 100644 --- a/src/testing/mocks/preprint-provider-details.ts +++ b/src/testing/mocks/preprint-provider-details.ts @@ -1,6 +1,6 @@ import { ProviderReviewsWorkflow } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; -import { ReviewPermissions } from '@shared/enums'; +import { ReviewPermissions } from '@shared/enums/review-permissions.enum'; export const PREPRINT_PROVIDER_DETAILS_MOCK: PreprintProviderDetails = { id: 'osf-preprints', diff --git a/src/testing/mocks/preprint-provider-moderation-info.mock.ts b/src/testing/mocks/preprint-provider-moderation-info.mock.ts index b67a24934..6aa456edd 100644 --- a/src/testing/mocks/preprint-provider-moderation-info.mock.ts +++ b/src/testing/mocks/preprint-provider-moderation-info.mock.ts @@ -1,4 +1,5 @@ import { PreprintProviderModerationInfo } from '@osf/features/moderation/models'; +import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum'; export const MOCK_PREPRINT_PROVIDER_MODERATION_INFO: PreprintProviderModerationInfo = { id: 'test-provider-id', @@ -8,4 +9,5 @@ export const MOCK_PREPRINT_PROVIDER_MODERATION_INFO: PreprintProviderModerationI reviewsCommentsPrivate: false, reviewsWorkflow: 'pre_moderation', supportEmail: 'support@test.com', + permissions: [ReviewPermissions.ViewSubmissions, ReviewPermissions.SetUpModeration], }; diff --git a/src/testing/mocks/preprint.mock.ts b/src/testing/mocks/preprint.mock.ts index 9a4d1a867..17f75939d 100644 --- a/src/testing/mocks/preprint.mock.ts +++ b/src/testing/mocks/preprint.mock.ts @@ -1,5 +1,5 @@ import { ReviewsState } from '@osf/features/preprints/enums'; -import { LicenseModel, LicenseOptions } from '@shared/models'; +import { LicenseModel, LicenseOptions } from '@osf/shared/models/license/license.model'; export const PREPRINT_MOCK = { id: 'preprint-1', diff --git a/src/testing/mocks/project-metadata.mock.ts b/src/testing/mocks/project-metadata.mock.ts index 52c9c79d4..6972fc38a 100644 --- a/src/testing/mocks/project-metadata.mock.ts +++ b/src/testing/mocks/project-metadata.mock.ts @@ -1,6 +1,7 @@ import { MetadataModel } from '@osf/features/metadata/models'; -import { UserPermissions } from '@osf/shared/enums'; -import { Identifier, Institution } from '@osf/shared/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; +import { Institution } from '@shared/models/institutions/institutions.models'; export const MOCK_PROJECT_METADATA: MetadataModel = { id: 'project-123', @@ -22,7 +23,7 @@ export const MOCK_PROJECT_METADATA: MetadataModel = { category: 'identifier', value: '10.1234/test.project', }, - ] as Identifier[], + ] as IdentifierModel[], affiliatedInstitutions: [ { id: 'inst-1', diff --git a/src/testing/mocks/project-overview.mock.ts b/src/testing/mocks/project-overview.mock.ts index e8ae18da3..c9128e93d 100644 --- a/src/testing/mocks/project-overview.mock.ts +++ b/src/testing/mocks/project-overview.mock.ts @@ -1,6 +1,5 @@ import { ProjectOverview } from '@osf/features/project/overview/models'; - -import { Identifier } from '../../app/shared/models'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; export const MOCK_PROJECT_AFFILIATED_INSTITUTIONS = [ { @@ -26,7 +25,7 @@ export const MOCK_PROJECT_AFFILIATED_INSTITUTIONS = [ }, ]; -export const MOCK_PROJECT_IDENTIFIERS: Identifier = { +export const MOCK_PROJECT_IDENTIFIERS: IdentifierModel = { id: 'identifier-1', type: 'identifiers', category: 'doi', diff --git a/src/testing/mocks/project.mock.ts b/src/testing/mocks/project.mock.ts index 8ba13a92d..9f5470f8c 100644 --- a/src/testing/mocks/project.mock.ts +++ b/src/testing/mocks/project.mock.ts @@ -1,4 +1,4 @@ -import { ProjectModel } from '@shared/models/projects'; +import { ProjectModel } from '@shared/models/projects/projects.models'; export const MOCK_PROJECT: ProjectModel = { id: 'project-1', diff --git a/src/testing/mocks/registration.mock.ts b/src/testing/mocks/registration.mock.ts index 446970a79..684c0f1c1 100644 --- a/src/testing/mocks/registration.mock.ts +++ b/src/testing/mocks/registration.mock.ts @@ -1,5 +1,10 @@ -import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates, UserPermissions } from '@shared/enums'; -import { RegistrationCard } from '@shared/models'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { RegistrationCard } from '@shared/models/registration/registration-card.model'; + +import { MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY } from './contributors.mock'; export const MOCK_REGISTRATION: RegistrationCard = { id: 'reg-123', @@ -8,10 +13,7 @@ export const MOCK_REGISTRATION: RegistrationCard = { status: RegistryStatus.Pending, dateCreated: '2024-01-15T10:00:00Z', dateModified: '2024-01-20T14:30:00Z', - contributors: [ - { fullName: 'John Doe', id: 'user1' }, - { fullName: 'Jane Smith', id: 'user2' }, - ], + contributors: [MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY], registrationTemplate: 'Test Template', registry: 'Test Registry', public: true, diff --git a/src/testing/mocks/registries.mock.ts b/src/testing/mocks/registries.mock.ts index 946eda6e5..fb5debaa8 100644 --- a/src/testing/mocks/registries.mock.ts +++ b/src/testing/mocks/registries.mock.ts @@ -1,4 +1,4 @@ -import { FieldType } from '@osf/shared/enums'; +import { FieldType } from '@osf/shared/enums/field-type.enum'; export const MOCK_REGISTRIES_PAGE = { id: 'page-1', diff --git a/src/testing/mocks/registry-moderation.mock.ts b/src/testing/mocks/registry-moderation.mock.ts index db664f1e4..5686185a7 100644 --- a/src/testing/mocks/registry-moderation.mock.ts +++ b/src/testing/mocks/registry-moderation.mock.ts @@ -1,5 +1,6 @@ import { RegistryModeration } from '@osf/features/moderation/models'; -import { RegistrationReviewStates, RevisionReviewStates } from '@shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; export const MOCK_REGISTRY_MODERATIONS: RegistryModeration[] = [ { diff --git a/src/testing/mocks/registry-overview.mock.ts b/src/testing/mocks/registry-overview.mock.ts index 00478bcb2..a421ff72e 100644 --- a/src/testing/mocks/registry-overview.mock.ts +++ b/src/testing/mocks/registry-overview.mock.ts @@ -1,5 +1,7 @@ import { RegistryOverview } from '@osf/features/registry/models'; -import { RegistrationReviewStates, RegistryStatus, RevisionReviewStates } from '@osf/shared/enums'; +import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; +import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; +import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; export const MOCK_REGISTRY_OVERVIEW: RegistryOverview = { id: 'test-registry-id', diff --git a/src/testing/mocks/resource.mock.ts b/src/testing/mocks/resource.mock.ts index 9c44df257..91c4efe09 100644 --- a/src/testing/mocks/resource.mock.ts +++ b/src/testing/mocks/resource.mock.ts @@ -1,6 +1,7 @@ -import { ResourceInfoModel } from '@osf/features/project/contributors/models'; -import { ResourceType } from '@shared/enums'; -import { ResourceModel, ResourceOverview } from '@shared/models'; +import { ResourceInfoModel } from '@osf/features/contributors/models'; +import { ResourceType } from '@shared/enums/resource-type.enum'; +import { ResourceOverview } from '@shared/models/resource-overview.model'; +import { ResourceModel } from '@shared/models/search/resource.model'; export const MOCK_RESOURCE: ResourceModel = { absoluteUrl: 'https://api.osf.io/v2/resources/resource-123', @@ -10,8 +11,8 @@ export const MOCK_RESOURCE: ResourceModel = { dateCreated: new Date('2024-01-15'), dateModified: new Date('2024-01-20'), creators: [ - { absoluteUrl: 'https://api.osf.io/v2/users/user1', name: 'John Doe' }, - { absoluteUrl: 'https://api.osf.io/v2/users/user2', name: 'Jane Smith' }, + { absoluteUrl: 'https://api.osf.io/v2/users/user1', name: 'John Doe', affiliationsAbsoluteUrl: [] }, + { absoluteUrl: 'https://api.osf.io/v2/users/user2', name: 'Jane Smith', affiliationsAbsoluteUrl: [] }, ], provider: { absoluteUrl: 'https://api.osf.io/v2/providers/provider1', name: 'Test Provider' }, license: { absoluteUrl: 'https://api.osf.io/v2/licenses/license1', name: 'MIT License' }, @@ -37,8 +38,10 @@ export const MOCK_RESOURCE: ResourceModel = { { agentId: 'agentId', order: 1, + hadRole: '', }, ], + context: '', }; export const MOCK_AGENT_RESOURCE: ResourceModel = { @@ -70,8 +73,10 @@ export const MOCK_AGENT_RESOURCE: ResourceModel = { { agentId: 'agentId', order: 1, + hadRole: '', }, ], + context: '', }; export const MOCK_RESOURCE_OVERVIEW: ResourceOverview = { diff --git a/src/testing/mocks/social-share-links.mock.ts b/src/testing/mocks/social-share-links.mock.ts index c7f9beb6f..ecaaefc98 100644 --- a/src/testing/mocks/social-share-links.mock.ts +++ b/src/testing/mocks/social-share-links.mock.ts @@ -1,4 +1,4 @@ -import { SocialShareLinksModel } from '@shared/models'; +import { SocialShareLinksModel } from '@osf/shared/models/socials/social-share-links.model'; export const SOCIAL_SHARE_LINKS_MOCK: SocialShareLinksModel = { email: diff --git a/src/testing/mocks/subject.mock.ts b/src/testing/mocks/subject.mock.ts index 2440a75ec..2f4b14bc3 100644 --- a/src/testing/mocks/subject.mock.ts +++ b/src/testing/mocks/subject.mock.ts @@ -1,4 +1,4 @@ -import { SubjectModel } from '@shared/models'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; export const SUBJECTS_MOCK: SubjectModel[] = [ { diff --git a/src/testing/mocks/submission.mock.ts b/src/testing/mocks/submission.mock.ts index 22bf9a0c1..d1f601f46 100644 --- a/src/testing/mocks/submission.mock.ts +++ b/src/testing/mocks/submission.mock.ts @@ -1,5 +1,5 @@ import { PreprintSubmissionModel } from '@osf/features/moderation/models'; -import { CollectionSubmissionWithGuid } from '@shared/models'; +import { CollectionSubmissionWithGuid } from '@osf/shared/models/collections/collections.models'; import { MOCK_CONTRIBUTOR } from './contributors.mock'; diff --git a/src/testing/mocks/toast.service.mock.ts b/src/testing/mocks/toast.service.mock.ts index 8718b8af6..7e8435814 100644 --- a/src/testing/mocks/toast.service.mock.ts +++ b/src/testing/mocks/toast.service.mock.ts @@ -1,4 +1,4 @@ -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; /** * A mock implementation of a toast (notification) service for testing purposes. diff --git a/src/testing/mocks/user-employment-education.mock.ts b/src/testing/mocks/user-employment-education.mock.ts index 7fb4e7d96..600c4212f 100644 --- a/src/testing/mocks/user-employment-education.mock.ts +++ b/src/testing/mocks/user-employment-education.mock.ts @@ -1,4 +1,5 @@ -import { Education, Employment } from '@osf/shared/models'; +import { Education } from '@osf/shared/models/user/education.model'; +import { Employment } from '@osf/shared/models/user/employment.model'; export const MOCK_EMPLOYMENT: Employment[] = [ { diff --git a/src/testing/mocks/view-only-link.mock.ts b/src/testing/mocks/view-only-link.mock.ts index 982c6193f..4f9954696 100644 --- a/src/testing/mocks/view-only-link.mock.ts +++ b/src/testing/mocks/view-only-link.mock.ts @@ -1,4 +1,8 @@ -import { ComponentCheckboxItemModel, PaginatedViewOnlyLinksModel, ViewOnlyLinkModel } from '@osf/shared/models'; +import { ComponentCheckboxItemModel } from '@osf/shared/models/component-checkbox-item.model'; +import { + PaginatedViewOnlyLinksModel, + ViewOnlyLinkModel, +} from '@osf/shared/models/view-only-links/view-only-link.model'; export const MOCK_VIEW_ONLY_LINK: ViewOnlyLinkModel = { id: 'test-link-1', diff --git a/src/testing/providers/custom-confirmation-provider.mock.ts b/src/testing/providers/custom-confirmation-provider.mock.ts index e95130886..50d7205cf 100644 --- a/src/testing/providers/custom-confirmation-provider.mock.ts +++ b/src/testing/providers/custom-confirmation-provider.mock.ts @@ -1,5 +1,9 @@ -import { CustomConfirmationService } from '@osf/shared/services'; -import { AcceptConfirmationOptions, ContinueConfirmationOptions, DeleteConfirmationOptions } from '@shared/models'; +import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; +import { + AcceptConfirmationOptions, + ContinueConfirmationOptions, + DeleteConfirmationOptions, +} from '@shared/models/confirmation-options.model'; export type CustomConfirmationServiceMockType = Partial & { confirmDelete: jest.Mock; diff --git a/src/testing/providers/custom-dialog-provider.mock.ts b/src/testing/providers/custom-dialog-provider.mock.ts index 2c00d574e..7cb9de7d9 100644 --- a/src/testing/providers/custom-dialog-provider.mock.ts +++ b/src/testing/providers/custom-dialog-provider.mock.ts @@ -1,6 +1,6 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; -import { CustomDialogService } from '@osf/shared/services'; +import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; export type CustomDialogServiceMockType = Partial & { open: jest.Mock?]>; diff --git a/src/testing/providers/toast-provider.mock.ts b/src/testing/providers/toast-provider.mock.ts index f5db862f2..a0f644a26 100644 --- a/src/testing/providers/toast-provider.mock.ts +++ b/src/testing/providers/toast-provider.mock.ts @@ -1,4 +1,4 @@ -import { ToastService } from '@osf/shared/services'; +import { ToastService } from '@osf/shared/services/toast.service'; export type ToastServiceMockType = Partial & { showSuccess: jest.Mock; From 780d27b786774ce4e1f8295d2eca75721bc61430 Mon Sep 17 00:00:00 2001 From: Oleh Paduchak Date: Wed, 29 Oct 2025 15:46:07 +0200 Subject: [PATCH 18/31] feat(file-tree): implement shift-click functionality --- .../files-tree/files-tree.component.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/app/shared/components/files-tree/files-tree.component.ts b/src/app/shared/components/files-tree/files-tree.component.ts index e24542c2a..4b30a486b 100644 --- a/src/app/shared/components/files-tree/files-tree.component.ts +++ b/src/app/shared/components/files-tree/files-tree.component.ts @@ -111,6 +111,7 @@ export class FilesTreeComponent implements OnDestroy, AfterViewInit { readonly resourceMetadata = select(CurrentResourceSelectors.getCurrentResource); foldersStack: FileFolderModel[] = []; + lastSelectedFile: FileModel | null = null; itemsPerPage = 10; virtualScrollItemSize = 46; @@ -437,7 +438,24 @@ export class FilesTreeComponent implements OnDestroy, AfterViewInit { } onNodeSelect(event: TreeNodeSelectEvent) { - this.selectFile.emit(event.node as FileModel); + const files = this.files(); + const selectedNode = event.node as FileModel; + if ((event.originalEvent as PointerEvent).shiftKey && this.lastSelectedFile) { + const lastIndex = files.indexOf(this.lastSelectedFile); + const currentIndex = files.indexOf(selectedNode); + if (lastIndex == currentIndex) { + return; + } + + const start = Math.min(lastIndex, currentIndex); + const end = Math.max(lastIndex, currentIndex); + + for (const file of files.slice(start, end)) { + this.selectFile.emit(file); + } + } + this.selectFile.emit(selectedNode); + this.lastSelectedFile = selectedNode; } onNodeUnselect(event: TreeNodeSelectEvent) { From f939b576f6b84f12a4fe43ce115deaaacb77a824 Mon Sep 17 00:00:00 2001 From: nsemets Date: Thu, 30 Oct 2025 14:39:00 +0200 Subject: [PATCH 19/31] Fix build errors (#733) * fix(build-error): fixed build errors * fix(warnings): removed warnings for citations package --- angular.json | 4 +++- .../components/configure-addon/configure-addon.component.ts | 2 +- .../connect-configured-addon.component.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/angular.json b/angular.json index 97bef37ee..5108d40ce 100644 --- a/angular.json +++ b/angular.json @@ -30,7 +30,9 @@ "cedar-artifact-viewer", "markdown-it-video", "ace-builds/src-noconflict/ext-language_tools", - "@traptitech/markdown-it-katex" + "@traptitech/markdown-it-katex", + "@citation-js/core", + "@citation-js/plugin-csl" ], "assets": [ "src/favicon.ico", diff --git a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts index 8471df83d..2a5d18810 100644 --- a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts +++ b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts @@ -101,7 +101,7 @@ export class ConfigureAddonComponent implements OnInit { return `${this.environment.webUrl}/${id}`; }); readonly addonTypeString = computed(() => { - return getAddonTypeString(this.addon()); + return getAddonTypeString(this.addon()) as AddonType; }); readonly selectedItemLabel = computed(() => { const addonType = this.addonTypeString(); diff --git a/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts b/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts index 672c1d02d..26d157f23 100644 --- a/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts +++ b/src/app/features/project/project-addons/components/connect-configured-addon/connect-configured-addon.component.ts @@ -144,7 +144,7 @@ export class ConnectConfiguredAddonComponent { return `${this.environment.webUrl}/${id}`; }); - addonTypeString = computed(() => getAddonTypeString(this.addon())); + addonTypeString = computed(() => getAddonTypeString(this.addon()) as AddonType); readonly baseUrl = computed(() => { const currentUrl = this.router.url; From 432ac96171431f719eb0c2bb3a79590fc3da4cfa Mon Sep 17 00:00:00 2001 From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:43:27 -0400 Subject: [PATCH 20/31] fix(addons): Fetch addon icons from GravyValet (#735) ## Purpose - Fetch addon icons from GravyValet so new providers only need updates to GravyValet to show up properly ## Summary of Changes - re-implement what was overwritten in this PR https://github.com/CenterForOpenScience/angular-osf/pull/421 --- .../addons/addon-card/addon-card.component.html | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/app/shared/components/addons/addon-card/addon-card.component.html b/src/app/shared/components/addons/addon-card/addon-card.component.html index 51fd2c4ac..ac7641e28 100644 --- a/src/app/shared/components/addons/addon-card/addon-card.component.html +++ b/src/app/shared/components/addons/addon-card/addon-card.component.html @@ -1,12 +1,7 @@
- @if (actualAddon()?.externalServiceName) { - AddonModel card image + @if (actualAddon()?.iconUrl) { + Addon card image }
From a8f87155aa9da130666bb3f109bc35bc825da03c Mon Sep 17 00:00:00 2001 From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> Date: Thu, 30 Oct 2025 13:20:25 -0400 Subject: [PATCH 21/31] [ENG-9654] Fix translation errors for Azure Blob Storage - Ticket: [ENG-9654] - Feature flag: n/a ## Purpose - Prevent missing translation inputs when adding new addon providers ## Summary of Changes - Add Azure Blob Storage to `AddonServiceNames` enum - Add fallback value when fetching a service's name ## Screenshot(s) - Prevents this issue when updating/removing addon configurations for new providers --- .../components/configure-addon/configure-addon.component.ts | 4 +++- src/app/shared/enums/addon-service-names.enum.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts index 2a5d18810..13c035f44 100644 --- a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts +++ b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts @@ -89,7 +89,9 @@ export class ConfigureAddonComponent implements OnInit { selectedStorageItem = select(AddonsSelectors.getSelectedStorageItem); addonServiceName = computed( - () => AddonServiceNames[this.addon()?.externalServiceName as keyof typeof AddonServiceNames] + () => + AddonServiceNames[this.addon()?.externalServiceName as keyof typeof AddonServiceNames] || + this.addon()?.displayName ); readonly baseUrl = computed(() => { diff --git a/src/app/shared/enums/addon-service-names.enum.ts b/src/app/shared/enums/addon-service-names.enum.ts index d0957f948..e4367b848 100644 --- a/src/app/shared/enums/addon-service-names.enum.ts +++ b/src/app/shared/enums/addon-service-names.enum.ts @@ -1,4 +1,5 @@ export enum AddonServiceNames { + azureblobstorage = 'Azure Blob Storage', figshare = 'figshare', onedrive = 'Onedrive', dropbox = 'Dropbox', From 7e51838cae43cfff021fcd096d1d6bdcfb15085a Mon Sep 17 00:00:00 2001 From: nsemets Date: Mon, 3 Nov 2025 20:01:04 +0200 Subject: [PATCH 22/31] [ENG-8545] Google attempting to index preprint fails with "soft 404" or 5xx responses (#739) - Ticket: [ENG-8545] - Feature flag: n/a ## Summary of Changes 1. Added prerender ready service. --- src/@types/global.d.ts | 6 +++++ .../core/services/prerender-ready.service.ts | 22 +++++++++++++++ .../preprints/mappers/preprints.mapper.ts | 3 +++ .../preprints/models/preprint.models.ts | 1 + .../preprint-details.component.spec.ts | 4 +-- .../preprint-details.component.ts | 24 +++++++++++++---- .../overview/project-overview.component.ts | 4 +++ .../features/registry/registry.component.ts | 4 +++ src/app/shared/services/meta-tags.service.ts | 27 ++++++++++++++++--- src/index.html | 3 +++ src/testing/mocks/preprint.mock.ts | 1 + 11 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 src/app/core/services/prerender-ready.service.ts diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 1d6eba8ad..8890dac2c 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -47,5 +47,11 @@ declare global { */ loggedIn: boolean; }; + + /** + * Flag used by prerender services to determine when a page is fully loaded. + * Set to false initially, then set to true once all AJAX requests and content are loaded. + */ + prerenderReady?: boolean; } } diff --git a/src/app/core/services/prerender-ready.service.ts b/src/app/core/services/prerender-ready.service.ts new file mode 100644 index 000000000..6efdd5ebe --- /dev/null +++ b/src/app/core/services/prerender-ready.service.ts @@ -0,0 +1,22 @@ +import { inject, Injectable } from '@angular/core'; + +import { WINDOW } from '../provider/window.provider'; + +@Injectable({ + providedIn: 'root', +}) +export class PrerenderReadyService { + private readonly window = inject(WINDOW); + + setNotReady(): void { + if (this.window && 'prerenderReady' in this.window) { + this.window.prerenderReady = false; + } + } + + setReady(): void { + if (this.window && 'prerenderReady' in this.window) { + this.window.prerenderReady = true; + } + } +} diff --git a/src/app/features/preprints/mappers/preprints.mapper.ts b/src/app/features/preprints/mappers/preprints.mapper.ts index 6bd45b4b9..283704403 100644 --- a/src/app/features/preprints/mappers/preprints.mapper.ts +++ b/src/app/features/preprints/mappers/preprints.mapper.ts @@ -80,6 +80,7 @@ export class PreprintsMapper { preprintDoiLink: response.links.preprint_doi, articleDoiLink: response.links.doi, embeddedLicense: null, + providerId: response.relationships?.provider?.data?.id, }; } @@ -92,6 +93,7 @@ export class PreprintsMapper { ): PreprintModel { const data = response.data; const links = response.data.links; + const relationships = response?.data?.relationships; return { id: data.id, @@ -137,6 +139,7 @@ export class PreprintsMapper { identifiers: IdentifiersMapper.fromJsonApi(data.embeds?.identifiers), preprintDoiLink: links.preprint_doi, articleDoiLink: links.doi, + providerId: relationships?.provider?.data?.id, }; } diff --git a/src/app/features/preprints/models/preprint.models.ts b/src/app/features/preprints/models/preprint.models.ts index 7a64f138d..f4ad604b4 100644 --- a/src/app/features/preprints/models/preprint.models.ts +++ b/src/app/features/preprints/models/preprint.models.ts @@ -46,6 +46,7 @@ export interface PreprintModel { preprintDoiLink?: string; articleDoiLink?: string; identifiers?: IdentifierModel[]; + providerId: string; } export interface PreprintFilesLinks { diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts b/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts index ceb5bf6e1..80a825706 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.spec.ts @@ -122,11 +122,11 @@ describe('PreprintDetailsComponent', () => { value: false, }, { - selector: ContributorsSelectors.getContributors, + selector: ContributorsSelectors.getBibliographicContributors, value: mockContributors, }, { - selector: ContributorsSelectors.isContributorsLoading, + selector: ContributorsSelectors.isBibliographicContributorsLoading, value: false, }, { diff --git a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts index a6d301206..e8511d9f4 100644 --- a/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts +++ b/src/app/features/preprints/pages/preprint-details/preprint-details.component.ts @@ -25,6 +25,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { HelpScoutService } from '@core/services/help-scout.service'; +import { PrerenderReadyService } from '@core/services/prerender-ready.service'; import { ClearCurrentProvider } from '@core/store/provider'; import { UserSelectors } from '@core/store/user'; import { ResetState } from '@osf/features/files/store'; @@ -101,6 +102,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { private readonly datePipe = inject(DatePipe); private readonly dataciteService = inject(DataciteService); private readonly analyticsService = inject(AnalyticsService); + private readonly prerenderReady = inject(PrerenderReadyService); private readonly environment = inject(ENVIRONMENT); @@ -124,8 +126,8 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { preprint = select(PreprintSelectors.getPreprint); preprint$ = toObservable(select(PreprintSelectors.getPreprint)); isPreprintLoading = select(PreprintSelectors.isPreprintLoading); - contributors = select(ContributorsSelectors.getContributors); - areContributorsLoading = select(ContributorsSelectors.isContributorsLoading); + contributors = select(ContributorsSelectors.getBibliographicContributors); + areContributorsLoading = select(ContributorsSelectors.isBibliographicContributorsLoading); reviewActions = select(PreprintSelectors.getPreprintReviewActions); areReviewActionsLoading = select(PreprintSelectors.arePreprintReviewActionsLoading); withdrawalRequests = select(PreprintSelectors.getPreprintRequests); @@ -138,6 +140,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { areMetricsLoading = select(PreprintSelectors.arePreprintMetricsLoading); isPresentModeratorQueryParam = toSignal(this.route.queryParams.pipe(map((params) => params['mode'] === 'moderator'))); + defaultProvider = this.environment.defaultProvider; moderationMode = computed(() => { const provider = this.preprintProvider(); @@ -170,6 +173,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { constructor() { this.helpScoutService.setResourceType('preprint'); + this.prerenderReady.setNotReady(); effect(() => { const currentPreprint = this.preprint(); @@ -178,6 +182,16 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { this.analyticsService.sendCountedUsage(currentPreprint.id, 'preprint.detail').subscribe(); } }); + + effect(() => { + const preprint = this.preprint(); + const contributors = this.contributors(); + const isLoading = this.isPreprintLoading() || this.areContributorsLoading(); + + if (!isLoading && preprint && contributors.length) { + this.setMetaTags(); + } + }); } private preprintWithdrawableState = computed(() => { @@ -257,7 +271,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { ); }); - isOsfPreprint = computed(() => this.providerId() === 'osf'); + isOsfPreprint = computed(() => this.providerId() === this.defaultProvider); moderationStatusBannerVisible = computed(() => { return ( @@ -351,6 +365,8 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { } fetchPreprint(preprintId: string) { + this.prerenderReady.setNotReady(); + this.actions.fetchPreprintById(preprintId).subscribe({ next: () => { this.checkAndSetVersionToTheUrl(); @@ -370,8 +386,6 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy { }); } } - - this.setMetaTags(); }, }); } diff --git a/src/app/features/project/overview/project-overview.component.ts b/src/app/features/project/overview/project-overview.component.ts index 76f2bf562..2b64641c0 100644 --- a/src/app/features/project/overview/project-overview.component.ts +++ b/src/app/features/project/overview/project-overview.component.ts @@ -23,6 +23,7 @@ import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'; import { FormsModule } from '@angular/forms'; import { ActivatedRoute, NavigationEnd, Router, RouterLink } from '@angular/router'; +import { PrerenderReadyService } from '@core/services/prerender-ready.service'; import { SubmissionReviewStatus } from '@osf/features/moderation/enums'; import { ClearCollectionModeration, @@ -123,6 +124,7 @@ export class ProjectOverviewComponent implements OnInit { private readonly dataciteService = inject(DataciteService); private readonly metaTags = inject(MetaTagsService); private readonly datePipe = inject(DatePipe); + private readonly prerenderReady = inject(PrerenderReadyService); submissions = select(CollectionsModerationSelectors.getCollectionSubmissions); collectionProvider = select(CollectionsSelectors.getCollectionProvider); @@ -271,6 +273,8 @@ export class ProjectOverviewComponent implements OnInit { readonly analyticsService = inject(AnalyticsService); constructor() { + this.prerenderReady.setNotReady(); + this.setupCollectionsEffects(); this.setupCleanup(); this.setupProjectEffects(); diff --git a/src/app/features/registry/registry.component.ts b/src/app/features/registry/registry.component.ts index 10ad5ba82..df0cbcb56 100644 --- a/src/app/features/registry/registry.component.ts +++ b/src/app/features/registry/registry.component.ts @@ -8,6 +8,7 @@ import { takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-i import { ActivatedRoute, RouterOutlet } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; +import { PrerenderReadyService } from '@core/services/prerender-ready.service'; import { ClearCurrentProvider } from '@core/store/provider'; import { pathJoin } from '@osf/shared/helpers/path-join.helper'; import { AnalyticsService } from '@osf/shared/services/analytics.service'; @@ -33,6 +34,7 @@ export class RegistryComponent implements OnDestroy { private readonly destroyRef = inject(DestroyRef); private readonly route = inject(ActivatedRoute); private readonly environment = inject(ENVIRONMENT); + private readonly prerenderReady = inject(PrerenderReadyService); private readonly actions = createDispatchMap({ getRegistryById: GetRegistryById, @@ -47,6 +49,8 @@ export class RegistryComponent implements OnDestroy { readonly analyticsService = inject(AnalyticsService); constructor() { + this.prerenderReady.setNotReady(); + effect(() => { if (this.registryId()) { this.actions.getRegistryById(this.registryId()); diff --git a/src/app/shared/services/meta-tags.service.ts b/src/app/shared/services/meta-tags.service.ts index d65e90ae9..28e1c1ec6 100644 --- a/src/app/shared/services/meta-tags.service.ts +++ b/src/app/shared/services/meta-tags.service.ts @@ -1,10 +1,11 @@ import { catchError, map, Observable, of, switchMap, tap } from 'rxjs'; import { DOCUMENT } from '@angular/common'; -import { DestroyRef, Inject, inject, Injectable } from '@angular/core'; +import { DestroyRef, effect, Inject, inject, Injectable, signal } from '@angular/core'; import { Meta, MetaDefinition, Title } from '@angular/platform-browser'; import { ENVIRONMENT } from '@core/provider/environment.provider'; +import { PrerenderReadyService } from '@core/services/prerender-ready.service'; import { MetadataRecordFormat } from '../enums/metadata-record-format.enum'; import { HeadTagDef } from '../models/meta-tags/head-tag-def.model'; @@ -19,6 +20,7 @@ import { MetadataRecordsService } from './metadata-records.service'; export class MetaTagsService { private readonly metadataRecords: MetadataRecordsService = inject(MetadataRecordsService); private readonly environment = inject(ENVIRONMENT); + private readonly prerenderReady = inject(PrerenderReadyService); get webUrl() { return this.environment.webUrl; @@ -52,11 +54,19 @@ export class MetaTagsService { private metaTagStack: { metaTagsData: MetaTagsData; componentDestroyRef: DestroyRef }[] = []; + areMetaTagsApplied = signal(false); + constructor( private meta: Meta, private title: Title, @Inject(DOCUMENT) private document: Document - ) {} + ) { + effect(() => { + if (this.areMetaTagsApplied()) { + this.prerenderReady.setReady(); + } + }); + } updateMetaTags(metaTagsData: MetaTagsData, componentDestroyRef: DestroyRef): void { this.metaTagStack = [...this.metaTagStackWithout(componentDestroyRef), { metaTagsData, componentDestroyRef }]; @@ -71,6 +81,8 @@ export class MetaTagsService { const elementsToRemove = this.document.querySelectorAll(`.${this.metaTagClass}`); if (elementsToRemove.length === 0) { + this.areMetaTagsApplied.set(false); + this.prerenderReady.setNotReady(); return; } @@ -81,6 +93,8 @@ export class MetaTagsService { }); this.title.setTitle(String(this.defaultMetaTags.siteName)); + this.areMetaTagsApplied.set(false); + this.prerenderReady.setNotReady(); } private metaTagStackWithout(destroyRefToRemove: DestroyRef) { @@ -97,6 +111,8 @@ export class MetaTagsService { } private applyMetaTagsData(metaTagsData: MetaTagsData) { + this.areMetaTagsApplied.set(false); + this.prerenderReady.setNotReady(); const combinedData = { ...this.defaultMetaTags, ...metaTagsData }; const headTags = this.getHeadTags(combinedData); of(metaTagsData.osfGuid) @@ -113,8 +129,11 @@ export class MetaTagsService { ) : of(null) ), - tap(() => this.applyHeadTags(headTags)), - tap(() => this.dispatchZoteroEvent()) + tap(() => { + this.applyHeadTags(headTags); + this.areMetaTagsApplied.set(true); + this.dispatchZoteroEvent(); + }) ) .subscribe(); } diff --git a/src/index.html b/src/index.html index 7c92fb628..717c99e2b 100644 --- a/src/index.html +++ b/src/index.html @@ -11,6 +11,9 @@ + diff --git a/src/testing/mocks/preprint.mock.ts b/src/testing/mocks/preprint.mock.ts index 17f75939d..a10eb7131 100644 --- a/src/testing/mocks/preprint.mock.ts +++ b/src/testing/mocks/preprint.mock.ts @@ -53,4 +53,5 @@ export const PREPRINT_MOCK = { preprintDoiLink: 'https://doi.org/10.1234/sample.doi', articleDoiLink: undefined, identifiers: [], + providerId: 'osf', }; From f193b2b7d2adcf3d10de97aacc4f80623cd3ffeb Mon Sep 17 00:00:00 2001 From: nsemets Date: Mon, 3 Nov 2025 20:08:28 +0200 Subject: [PATCH 23/31] Code improvements (#740) ## Summary of Changes 1. Add missing `destroyRef`for `takeUntilDestroyed`. 2. Renamed analytics service to avoid duplication of services. --- src/app/features/analytics/services/index.ts | 2 +- ...ervice.ts => resource-analytics.service.ts} | 11 +++++++---- .../analytics/store/analytics.state.ts | 4 ++-- .../features/project/wiki/wiki.component.ts | 4 ++-- .../custom-step/custom-step.component.ts | 4 +++- .../components/drafts/drafts.component.ts | 4 +++- .../justification/justification.component.ts | 5 ++++- .../registry-make-decision.component.ts | 6 ++++-- .../registry-overview.component.ts | 2 +- .../registry-wiki/registry-wiki.component.ts | 4 ++-- .../education-history-dialog.component.ts | 8 +++++--- .../employment-history-dialog.component.ts | 8 +++++--- .../truncated-text/truncated-text.component.ts | 18 ++++++++++++++++-- .../shared/directives/scroll-top.directive.ts | 5 +++-- 14 files changed, 58 insertions(+), 27 deletions(-) rename src/app/features/analytics/services/{analytics.service.ts => resource-analytics.service.ts} (84%) diff --git a/src/app/features/analytics/services/index.ts b/src/app/features/analytics/services/index.ts index 58bd2917d..5afbc150a 100644 --- a/src/app/features/analytics/services/index.ts +++ b/src/app/features/analytics/services/index.ts @@ -1 +1 @@ -export { AnalyticsService } from './analytics.service'; +export { ResourceAnalyticsService } from './resource-analytics.service'; diff --git a/src/app/features/analytics/services/analytics.service.ts b/src/app/features/analytics/services/resource-analytics.service.ts similarity index 84% rename from src/app/features/analytics/services/analytics.service.ts rename to src/app/features/analytics/services/resource-analytics.service.ts index 715ad26ce..96a7e1bf6 100644 --- a/src/app/features/analytics/services/analytics.service.ts +++ b/src/app/features/analytics/services/resource-analytics.service.ts @@ -3,16 +3,19 @@ import { map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; +import { AnalyticsMetricsMapper, RelatedCountsMapper } from '@osf/features/analytics/mappers'; +import { + NodeAnalyticsModel, + NodeAnalyticsResponseJsonApi, + RelatedCountsGetResponse, +} from '@osf/features/analytics/models'; import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { JsonApiService } from '@osf/shared/services/json-api.service'; -import { AnalyticsMetricsMapper, RelatedCountsMapper } from '../mappers'; -import { NodeAnalyticsModel, NodeAnalyticsResponseJsonApi, RelatedCountsGetResponse } from '../models'; - @Injectable({ providedIn: 'root', }) -export class AnalyticsService { +export class ResourceAnalyticsService { private readonly jsonApiService = inject(JsonApiService); private readonly environment = inject(ENVIRONMENT); diff --git a/src/app/features/analytics/store/analytics.state.ts b/src/app/features/analytics/store/analytics.state.ts index 064c28310..d4092992e 100644 --- a/src/app/features/analytics/store/analytics.state.ts +++ b/src/app/features/analytics/store/analytics.state.ts @@ -8,7 +8,7 @@ import { inject, Injectable } from '@angular/core'; import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { NodeAnalyticsModel, RelatedCountsModel } from '../models'; -import { AnalyticsService } from '../services'; +import { ResourceAnalyticsService } from '../services'; import { ClearAnalytics, GetMetrics, GetRelatedCounts } from './analytics.actions'; import { ANALYTICS_DEFAULT_STATE, AnalyticsStateModel } from './analytics.model'; @@ -19,7 +19,7 @@ import { ANALYTICS_DEFAULT_STATE, AnalyticsStateModel } from './analytics.model' }) @Injectable() export class AnalyticsState { - private readonly analyticsService = inject(AnalyticsService); + private readonly analyticsService = inject(ResourceAnalyticsService); private readonly REFRESH_INTERVAL = 5 * 60 * 1000; @Action(GetMetrics) diff --git a/src/app/features/project/wiki/wiki.component.ts b/src/app/features/project/wiki/wiki.component.ts index 71b31364e..4c8a6f08b 100644 --- a/src/app/features/project/wiki/wiki.component.ts +++ b/src/app/features/project/wiki/wiki.component.ts @@ -108,7 +108,7 @@ export class WikiComponent { this.actions .getWikiList(ResourceType.Project, this.projectId()) .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), tap(() => { if (!this.wikiIdFromQueryParams) { this.navigateToWiki(this.wikiList()?.[0]?.id || ''); @@ -124,7 +124,7 @@ export class WikiComponent { this.route.queryParams .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), map((params) => params['wiki']), filter((wikiId) => wikiId), tap((wikiId) => { diff --git a/src/app/features/registries/components/custom-step/custom-step.component.ts b/src/app/features/registries/components/custom-step/custom-step.component.ts index af774ec20..98900e02c 100644 --- a/src/app/features/registries/components/custom-step/custom-step.component.ts +++ b/src/app/features/registries/components/custom-step/custom-step.component.ts @@ -17,6 +17,7 @@ import { ChangeDetectionStrategy, Component, computed, + DestroyRef, effect, inject, input, @@ -82,6 +83,7 @@ export class CustomStepComponent implements OnDestroy { private readonly route = inject(ActivatedRoute); private readonly router = inject(Router); private readonly fb = inject(FormBuilder); + private readonly destroyRef = inject(DestroyRef); private toastService = inject(ToastService); readonly pages = select(RegistriesSelectors.getPagesSchema); @@ -105,7 +107,7 @@ export class CustomStepComponent implements OnDestroy { attachedFiles: Record[]> = {}; constructor() { - this.route.params.pipe(takeUntilDestroyed()).subscribe((params) => { + this.route.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => { this.updateStepState(); this.step.set(+params['step']); }); diff --git a/src/app/features/registries/components/drafts/drafts.component.ts b/src/app/features/registries/components/drafts/drafts.component.ts index 5edbcd1b2..353456834 100644 --- a/src/app/features/registries/components/drafts/drafts.component.ts +++ b/src/app/features/registries/components/drafts/drafts.component.ts @@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, + DestroyRef, effect, inject, OnDestroy, @@ -43,6 +44,7 @@ export class DraftsComponent implements OnDestroy { private readonly route = inject(ActivatedRoute); private readonly loaderService = inject(LoaderService); private readonly translateService = inject(TranslateService); + private readonly destroyRef = inject(DestroyRef); readonly pages = select(RegistriesSelectors.getPagesSchema); readonly draftRegistration = select(RegistriesSelectors.getDraftRegistration); @@ -127,7 +129,7 @@ export class DraftsComponent implements OnDestroy { constructor() { this.router.events .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), filter((event): event is NavigationEnd => event instanceof NavigationEnd) ) .subscribe(() => { diff --git a/src/app/features/registries/pages/justification/justification.component.ts b/src/app/features/registries/pages/justification/justification.component.ts index cc5a5e6f7..e196e9038 100644 --- a/src/app/features/registries/pages/justification/justification.component.ts +++ b/src/app/features/registries/pages/justification/justification.component.ts @@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component, computed, + DestroyRef, effect, inject, OnDestroy, @@ -37,9 +38,11 @@ import { ClearState, FetchSchemaBlocks, FetchSchemaResponse, RegistriesSelectors export class JustificationComponent implements OnDestroy { private readonly route = inject(ActivatedRoute); private readonly router = inject(Router); + private readonly destroyRef = inject(DestroyRef); private readonly loaderService = inject(LoaderService); private readonly translateService = inject(TranslateService); + readonly pages = select(RegistriesSelectors.getPagesSchema); readonly stepsState = select(RegistriesSelectors.getStepsState); readonly schemaResponse = select(RegistriesSelectors.getSchemaResponse); @@ -109,7 +112,7 @@ export class JustificationComponent implements OnDestroy { constructor() { this.router.events .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), filter((event): event is NavigationEnd => event instanceof NavigationEnd) ) .subscribe(() => { 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 25e80e226..ff1994ec1 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 @@ -11,7 +11,7 @@ import { Textarea } from 'primeng/textarea'; import { tap } from 'rxjs'; import { DatePipe } from '@angular/common'; -import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; +import { ChangeDetectionStrategy, Component, DestroyRef, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; @@ -46,6 +46,8 @@ import { RegistryOverviewSelectors, SubmitDecision } from '../../store/registry- }) export class RegistryMakeDecisionComponent { private readonly fb = inject(FormBuilder); + private readonly destroyRef = inject(DestroyRef); + readonly config = inject(DynamicDialogConfig); readonly dialogRef = inject(DynamicDialogRef); @@ -118,7 +120,7 @@ export class RegistryMakeDecisionComponent { this.requestForm .get(ModerationDecisionFormControls.Action) - ?.valueChanges.pipe(takeUntilDestroyed()) + ?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)) .subscribe((action) => { this.updateCommentValidators(action); }); diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts index 883bd397d..2f38cb0a9 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts @@ -235,7 +235,7 @@ export class RegistryOverviewComponent { this.actions.getBookmarksId(); this.route.queryParams .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), map((params) => ({ revisionId: params['revisionId'], mode: params['mode'] })), tap(({ revisionId, mode }) => { this.revisionId = revisionId; diff --git a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts index fe74f18b7..322808dfd 100644 --- a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts +++ b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts @@ -87,7 +87,7 @@ export class RegistryWikiComponent { this.actions .getWikiList(ResourceType.Registration, this.resourceId) .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), tap(() => { if (!this.wikiIdFromQueryParams) { this.navigateToWiki(this.wikiList()?.[0]?.id || ''); @@ -100,7 +100,7 @@ export class RegistryWikiComponent { this.route.queryParams .pipe( - takeUntilDestroyed(), + takeUntilDestroyed(this.destroyRef), map((params) => params['wiki']), filter((wikiId) => wikiId), tap((wikiId) => { diff --git a/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts b/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts index 01c41709e..71398bed4 100644 --- a/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts +++ b/src/app/shared/components/education-history-dialog/education-history-dialog.component.ts @@ -5,7 +5,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { timer } from 'rxjs'; -import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, DestroyRef, inject, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Education } from '@osf/shared/models/user/education.model'; @@ -20,8 +20,10 @@ import { EducationHistoryComponent } from '../education-history/education-histor changeDetection: ChangeDetectionStrategy.OnPush, }) export class EducationHistoryDialogComponent { - private readonly config = inject(DynamicDialogConfig); dialogRef = inject(DynamicDialogRef); + private readonly config = inject(DynamicDialogConfig); + private readonly destroyRef = inject(DestroyRef); + readonly educationHistory = signal([]); readonly isContentVisible = signal(false); @@ -29,7 +31,7 @@ export class EducationHistoryDialogComponent { this.educationHistory.set(this.config.data); timer(0) - .pipe(takeUntilDestroyed()) + .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(() => this.isContentVisible.set(true)); } diff --git a/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts b/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts index f66595d9a..6b2918bee 100644 --- a/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts +++ b/src/app/shared/components/employment-history-dialog/employment-history-dialog.component.ts @@ -5,7 +5,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog'; import { timer } from 'rxjs'; -import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, DestroyRef, inject, signal } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Employment } from '@osf/shared/models/user/employment.model'; @@ -20,8 +20,10 @@ import { EmploymentHistoryComponent } from '../employment-history/employment-his changeDetection: ChangeDetectionStrategy.OnPush, }) export class EmploymentHistoryDialogComponent { - private readonly config = inject(DynamicDialogConfig); dialogRef = inject(DynamicDialogRef); + private readonly destroyRef = inject(DestroyRef); + private readonly config = inject(DynamicDialogConfig); + readonly employmentHistory = signal([]); readonly isContentVisible = signal(false); @@ -29,7 +31,7 @@ export class EmploymentHistoryDialogComponent { this.employmentHistory.set(this.config.data); timer(0) - .pipe(takeUntilDestroyed()) + .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(() => this.isContentVisible.set(true)); } diff --git a/src/app/shared/components/truncated-text/truncated-text.component.ts b/src/app/shared/components/truncated-text/truncated-text.component.ts index 63d2e4afe..d821033db 100644 --- a/src/app/shared/components/truncated-text/truncated-text.component.ts +++ b/src/app/shared/components/truncated-text/truncated-text.component.ts @@ -4,7 +4,18 @@ import { Button } from 'primeng/button'; import { timer } from 'rxjs'; -import { AfterViewInit, Component, effect, ElementRef, inject, input, signal, viewChild } from '@angular/core'; +import { + AfterViewInit, + Component, + DestroyRef, + effect, + ElementRef, + inject, + input, + signal, + viewChild, +} from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Router } from '@angular/router'; @Component({ @@ -24,6 +35,7 @@ export class TruncatedTextComponent implements AfterViewInit { readonly contentElement = viewChild('textContent'); private readonly router = inject(Router); + private readonly destroyRef = inject(DestroyRef); isTextExpanded = signal(false); hasOverflowingText = signal(false); @@ -41,7 +53,9 @@ export class TruncatedTextComponent implements AfterViewInit { const currentText = this.text(); if (currentText) { this.isTextExpanded.set(false); - timer(0).subscribe(() => this.checkTextOverflow()); + timer(0) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => this.checkTextOverflow()); } }); } diff --git a/src/app/shared/directives/scroll-top.directive.ts b/src/app/shared/directives/scroll-top.directive.ts index ba9369496..bbd14ea78 100644 --- a/src/app/shared/directives/scroll-top.directive.ts +++ b/src/app/shared/directives/scroll-top.directive.ts @@ -1,6 +1,6 @@ import { filter } from 'rxjs'; -import { Directive, ElementRef, inject } from '@angular/core'; +import { DestroyRef, Directive, ElementRef, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { NavigationEnd, Router } from '@angular/router'; @@ -10,12 +10,13 @@ import { NavigationEnd, Router } from '@angular/router'; export class ScrollTopOnRouteChangeDirective { private el = inject(ElementRef); private router = inject(Router); + private destroyRef = inject(DestroyRef); constructor() { this.router.events .pipe( filter((e) => e instanceof NavigationEnd), - takeUntilDestroyed() + takeUntilDestroyed(this.destroyRef) ) .subscribe(() => { let route = this.router.routerState.root; From 6519689bc30b9325880c41a8d737ddbe8e83526e Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Mon, 3 Nov 2025 15:23:15 -0500 Subject: [PATCH 24/31] chore(addons): Serialize configurableApiRoot property --- src/app/shared/mappers/addon.mapper.ts | 1 + src/app/shared/models/addons/addon-json-api.models.ts | 1 + src/app/shared/models/addons/addon.model.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/app/shared/mappers/addon.mapper.ts b/src/app/shared/mappers/addon.mapper.ts index fa3c4d73d..333fede38 100644 --- a/src/app/shared/mappers/addon.mapper.ts +++ b/src/app/shared/mappers/addon.mapper.ts @@ -26,6 +26,7 @@ export class AddonMapper { credentialsFormat: response.attributes.credentials_format, providerName: response.attributes.display_name, iconUrl: response.attributes.icon_url, + configurableApiRoot: response.attributes.configurable_api_root, }; } diff --git a/src/app/shared/models/addons/addon-json-api.models.ts b/src/app/shared/models/addons/addon-json-api.models.ts index 68ed09b73..78c7a685f 100644 --- a/src/app/shared/models/addons/addon-json-api.models.ts +++ b/src/app/shared/models/addons/addon-json-api.models.ts @@ -10,6 +10,7 @@ export interface AddonGetResponseJsonApi { credentials_format: string; wb_key: string; icon_url: string; + configurable_api_root: boolean; [key: string]: unknown; }; relationships: { diff --git a/src/app/shared/models/addons/addon.model.ts b/src/app/shared/models/addons/addon.model.ts index 90d17e5df..4f6a7c458 100644 --- a/src/app/shared/models/addons/addon.model.ts +++ b/src/app/shared/models/addons/addon.model.ts @@ -7,6 +7,7 @@ export interface AddonModel { supportedFeatures?: string[]; providerName?: string; credentialsFormat?: string; + configurableApiRoot?: boolean; authUrl?: string | null; authorizedCapabilities?: string[]; authorizedOperationNames?: string[]; From ba073d9d7c87d0dc92421321b8a6179af31566f0 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Mon, 3 Nov 2025 15:24:40 -0500 Subject: [PATCH 25/31] refactor(addons): Use configurableApiRoot property to show form inputs --- .../addon-setup-account-form.component.html | 31 ++++++------------- .../addon-setup-account-form.component.ts | 4 +++ .../services/addons/addon-form.service.ts | 6 ++-- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.html b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.html index 9f27832d6..a5b7955aa 100644 --- a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.html +++ b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.html @@ -1,5 +1,15 @@
+ @if (hasConfigurableApiRoot()) { +

+ {{ 'settings.addons.form.fields.hostUrl' | translate }} +

+

+ {{ 'settings.addons.form.fields.hostUrlDescription' | translate }} +

+ + } + @if (isAccessSecretKeysFormat()) {

{{ 'settings.addons.form.fields.accessKey' | translate }} @@ -23,13 +33,6 @@

} @if (isDataverseApiTokenFormat()) { -

- {{ 'settings.addons.form.fields.hostUrl' | translate }} -

-

- {{ 'settings.addons.form.fields.hostUrlDescription' | translate }} -

-

{{ 'settings.addons.form.fields.apiToken' | translate }}

@@ -43,13 +46,6 @@

} @if (isUsernamePasswordFormat()) { -

- {{ 'settings.addons.form.fields.hostUrl' | translate }} -

-

- {{ 'settings.addons.form.fields.hostUrlDescription' | translate }} -

-

{{ 'settings.addons.form.fields.username' | translate }}

@@ -71,13 +67,6 @@

} @if (isRepoTokenFormat()) { -

- {{ 'settings.addons.form.fields.hostUrl' | translate }} -

-

- {{ 'settings.addons.form.fields.hostUrlDescription' | translate }} -

-

{{ 'settings.addons.form.fields.personalAccessToken' | translate }}

diff --git a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts index cbcb857eb..5c3601d81 100644 --- a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts +++ b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts @@ -62,6 +62,10 @@ export class AddonSetupAccountFormComponent { return format === CredentialsFormat.OAUTH2 || format === CredentialsFormat.OAUTH; }); + readonly hasConfigurableApiRoot = computed(() => { + return this.addon().configurableApiRoot === true; + }); + handleSubmit(): void { if (!this.isFormValid) return; diff --git a/src/app/shared/services/addons/addon-form.service.ts b/src/app/shared/services/addons/addon-form.service.ts index 9f164b626..0284dfa4a 100644 --- a/src/app/shared/services/addons/addon-form.service.ts +++ b/src/app/shared/services/addons/addon-form.service.ts @@ -26,6 +26,9 @@ export class AddonFormService { const formControls: Partial = { [AddonFormControls.AccountName]: this.formBuilder.control(addon.displayName || '', Validators.required), }; + if (addon.configurableApiRoot) { + formControls[AddonFormControls.HostUrl] = this.formBuilder.control('', Validators.required); + } switch (addon.credentialsFormat) { case CredentialsFormat.ACCESS_SECRET_KEYS: @@ -33,16 +36,13 @@ export class AddonFormService { formControls[AddonFormControls.SecretKey] = this.formBuilder.control('', Validators.required); break; case CredentialsFormat.DATAVERSE_API_TOKEN: - formControls[AddonFormControls.HostUrl] = this.formBuilder.control('', Validators.required); formControls[AddonFormControls.ApiToken] = this.formBuilder.control('', Validators.required); break; case CredentialsFormat.USERNAME_PASSWORD: - formControls[AddonFormControls.HostUrl] = this.formBuilder.control('', Validators.required); formControls[AddonFormControls.Username] = this.formBuilder.control('', Validators.required); formControls[AddonFormControls.Password] = this.formBuilder.control('', Validators.required); break; case CredentialsFormat.REPO_TOKEN: - formControls[AddonFormControls.HostUrl] = this.formBuilder.control('', Validators.required); formControls[AddonFormControls.PersonalAccessToken] = this.formBuilder.control('', Validators.required); break; } From ae067adfec41568861a3e94846ba3d35ed48c0c9 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Mon, 3 Nov 2025 16:22:04 -0500 Subject: [PATCH 26/31] test(addons): update tests --- src/app/shared/services/addons/addons.service.spec.ts | 1 + src/app/shared/stores/addons/addons.state.spec.ts | 2 ++ src/testing/mocks/addon.mock.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/src/app/shared/services/addons/addons.service.spec.ts b/src/app/shared/services/addons/addons.service.spec.ts index fc00d7d50..45355d7ba 100644 --- a/src/app/shared/services/addons/addons.service.spec.ts +++ b/src/app/shared/services/addons/addons.service.spec.ts @@ -42,6 +42,7 @@ describe('Service: Addons', () => { supportedFeatures: ['DOWNLOAD_AS_ZIP', 'FORKING', 'LOGS', 'PERMISSIONS', 'REGISTERING'], type: 'external-storage-services', wbKey: 'figshare', + configurableApiRoot: false, }) ); diff --git a/src/app/shared/stores/addons/addons.state.spec.ts b/src/app/shared/stores/addons/addons.state.spec.ts index b4bbf9b0c..ebfbf99a8 100644 --- a/src/app/shared/stores/addons/addons.state.spec.ts +++ b/src/app/shared/stores/addons/addons.state.spec.ts @@ -59,6 +59,7 @@ describe('State: Addons', () => { supportedFeatures: ['DOWNLOAD_AS_ZIP', 'FORKING', 'LOGS', 'PERMISSIONS', 'REGISTERING'], type: 'external-storage-services', wbKey: 'figshare', + configurableApiRoot: false, }) ); @@ -76,6 +77,7 @@ describe('State: Addons', () => { supportedFeatures: ['DOWNLOAD_AS_ZIP', 'FORKING', 'LOGS', 'PERMISSIONS', 'REGISTERING'], type: 'external-storage-services', wbKey: 'figshare', + configurableApiRoot: false, }) ); expect(loading()).toBeFalsy(); diff --git a/src/testing/mocks/addon.mock.ts b/src/testing/mocks/addon.mock.ts index 31ff950b4..fd59c6f2f 100644 --- a/src/testing/mocks/addon.mock.ts +++ b/src/testing/mocks/addon.mock.ts @@ -12,4 +12,5 @@ export const MOCK_ADDON: AddonModel = { providerName: 'Test Provider', wbKey: 'github', iconUrl: 'https://test.com/icon.png', + configurableApiRoot: false, }; From 2fbcf46e2663c64f39a12573ff4076a0833de4d9 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 4 Nov 2025 09:44:03 -0500 Subject: [PATCH 27/31] chore(addons): Simplify computed property --- .../addon-setup-account-form.component.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts index 5c3601d81..2a31ca311 100644 --- a/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts +++ b/src/app/shared/components/addons/addon-setup-account-form/addon-setup-account-form.component.ts @@ -62,9 +62,7 @@ export class AddonSetupAccountFormComponent { return format === CredentialsFormat.OAUTH2 || format === CredentialsFormat.OAUTH; }); - readonly hasConfigurableApiRoot = computed(() => { - return this.addon().configurableApiRoot === true; - }); + readonly hasConfigurableApiRoot = computed(() => !!this.addon().configurableApiRoot); handleSubmit(): void { if (!this.isFormValid) return; From a1ee72c99b5c54b6e33e2dc57f1e12ac16384108 Mon Sep 17 00:00:00 2001 From: Oleh Paduchak <158075011+opaduchak@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:05:21 +0200 Subject: [PATCH 28/31] fix(ENG-9260): P12.3 - Google Drive files not loading once root folder selected (#736) * fix(storage-item-selector): allow users to add files from google drive on addon setup * fix(storage-item-selector): replace set timeout with timer --- .../storage-item-selector.component.html | 9 +++++++++ .../storage-item-selector.component.ts | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html index 0d860844d..d2f04b986 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html @@ -44,6 +44,15 @@

[handleFolderSelection]="handleFolderSelection" [rootFolder]="selectedStorageItem()" > + @if (selectedStorageItem() !== null) { + + } } @else {
diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts index b5fb14896..597e887e2 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts @@ -10,6 +10,8 @@ import { InputText } from 'primeng/inputtext'; import { RadioButton } from 'primeng/radiobutton'; import { Skeleton } from 'primeng/skeleton'; +import { timer } from 'rxjs'; + import { ChangeDetectionStrategy, Component, @@ -22,6 +24,7 @@ import { OnInit, output, signal, + viewChild, } from '@angular/core'; import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -60,6 +63,8 @@ import { ResourceTypeInfoDialogComponent } from '../resource-type-info-dialog/re changeDetection: ChangeDetectionStrategy.OnPush, }) export class StorageItemSelectorComponent implements OnInit { + addFilesPicker = viewChild('filePicker'); + private destroyRef = inject(DestroyRef); private customDialogService = inject(CustomDialogService); private translateService = inject(TranslateService); @@ -236,6 +241,11 @@ export class StorageItemSelectorComponent implements OnInit { handleFolderSelection = (folder: StorageItem): void => { this.selectedStorageItem.set(folder); this.hasFolderChanged.set(folder?.itemId !== this.initiallySelectedStorageItem()?.itemId); + if (this.isGoogleFilePicker()) { + timer(1000) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => this.addFilesPicker()?.createPicker()); + } }; private updateBreadcrumbs( From f6109eed7a5aea3f323f203fdc4f694cd26a1199 Mon Sep 17 00:00:00 2001 From: nsemets Date: Wed, 5 Nov 2025 19:40:41 +0200 Subject: [PATCH 29/31] [ENG-9633] Optimize registration initial load (#737) - Ticket: [ENG-9633] ## Purpose Optimize initial page load time of the registration overview page ## Summary of Changes 1. Removed embeds. 2. Split code into smaller components. 3. Update states. --- src/app/app.routes.ts | 2 +- .../nav-menu/nav-menu.component.spec.ts | 2 +- .../view-duplicates.component.spec.ts | 6 +- .../view-duplicates.component.ts | 12 +- .../view-linked-projects.component.spec.ts | 4 +- .../view-linked-projects.component.ts | 10 +- ...ata-affiliated-institutions.component.html | 4 +- src/app/features/my-projects/mappers/index.ts | 1 - .../my-projects/my-projects.component.ts | 20 +- .../additional-info.component.ts | 5 +- .../general-information.component.html | 6 +- .../review-step/review-step.component.html | 9 +- .../delete-component-dialog.component.html | 3 +- .../delete-component-dialog.component.ts | 6 +- .../project/overview/components/index.ts | 7 +- .../project-overview-metadata.component.html | 116 ++++++ .../project-overview-metadata.component.scss} | 0 ...oject-overview-metadata.component.spec.ts} | 29 +- .../project-overview-metadata.component.ts | 68 ++++ .../project-overview-toolbar.component.html} | 6 +- .../project-overview-toolbar.component.scss} | 0 ...roject-overview-toolbar.component.spec.ts} | 12 +- .../project-overview-toolbar.component.ts} | 85 ++-- .../overview/project-overview.component.html | 8 +- .../project-overview.component.spec.ts | 4 +- .../overview/project-overview.component.ts | 8 +- .../configure-addon.component.ts | 5 + .../justification-review.component.html | 2 +- ...ries-affiliated-institution.component.html | 6 +- .../components/review/review.component.html | 2 +- .../archiving-message.component.ts | 4 +- src/app/features/registry/components/index.ts | 1 + ...gistration-overview-toolbar.component.html | 25 ++ ...gistration-overview-toolbar.component.scss | 0 ...tration-overview-toolbar.component.spec.ts | 26 ++ ...registration-overview-toolbar.component.ts | 98 +++++ .../registry-blocks-section.component.html | 47 +++ .../registry-blocks-section.component.scss | 0 .../registry-blocks-section.component.spec.ts | 62 +++ .../registry-blocks-section.component.ts | 22 ++ .../registry-make-decision.component.spec.ts | 6 +- .../registry-make-decision.component.ts | 6 +- .../registry-overview-metadata.component.html | 119 ++++++ .../registry-overview-metadata.component.scss | 0 ...gistry-overview-metadata.component.spec.ts | 22 ++ .../registry-overview-metadata.component.ts | 108 ++++++ .../registry-revisions.component.html | 4 +- .../registry-revisions.component.ts | 14 +- .../registry-statuses.component.ts | 6 +- .../short-registration-info.component.html | 11 +- .../short-registration-info.component.ts | 24 +- .../withdraw-dialog.component.ts | 2 +- .../withdrawn-message.component.html | 5 + .../withdrawn-message.component.ts | 4 +- .../mappers/registry-overview.mapper.ts | 79 +--- .../mappers/registry-resource.mapper.ts | 3 +- .../get-registry-overview-json-api.model.ts | 143 ------- src/app/features/registry/models/index.ts | 2 +- .../registration-overview-json-api.model.ts | 41 ++ .../models/registry-overview.models.ts | 17 +- .../registry-overview.component.html | 72 +--- .../registry-overview.component.scss | 30 +- .../registry-overview.component.spec.ts | 54 ++- .../registry-overview.component.ts | 186 +++------ .../registry-resources.component.spec.ts | 7 +- .../registry-resources.component.ts | 18 +- .../registry/registry.component.spec.ts | 9 +- .../features/registry/registry.component.ts | 97 +++-- src/app/features/registry/registry.routes.ts | 19 +- .../services/registry-overview.service.ts | 105 +++-- .../services/registry-resources.service.ts | 20 +- .../registry/store/registry-overview/index.ts | 4 - .../registry-overview.actions.ts | 59 --- .../registry-overview.model.ts | 39 -- .../registry-overview.selectors.ts | 82 ---- .../registry-overview.state.ts | 255 ------------ .../features/registry/store/registry/index.ts | 4 + .../store/registry/registry.actions.ts | 89 +++++ .../registry/store/registry/registry.model.ts | 66 ++++ .../store/registry/registry.selectors.ts | 115 ++++++ .../registry/store/registry/registry.state.ts | 365 ++++++++++++++++++ .../token-details/token-details.component.ts | 2 + ...ffiliated-institutions-view.component.html | 40 +- ...liated-institutions-view.component.spec.ts | 26 +- .../affiliated-institutions-view.component.ts | 5 +- .../password-input-hint.component.spec.ts | 61 ++- .../resource-citations.component.html | 32 +- .../resource-citations.component.spec.ts | 124 +++--- .../resource-citations.component.ts | 72 ++-- .../resource-doi/resource-doi.component.html | 13 + .../resource-doi/resource-doi.component.scss | 0 .../resource-doi.component.spec.ts | 46 +++ .../resource-doi/resource-doi.component.ts | 19 + .../resource-license.component.html | 5 + .../resource-license.component.scss | 0 .../resource-license.component.spec.ts | 56 +++ .../resource-license.component.ts | 19 + .../resource-metadata.component.html | 178 --------- .../resource-metadata.component.ts | 67 ---- .../subjects-list.component.html | 11 + .../subjects-list.component.scss | 0 .../subjects-list.component.spec.ts | 67 ++++ .../subjects-list/subjects-list.component.ts | 20 + .../subjects/subjects.component.spec.ts | 261 ++++++++++++- .../tags-list/tags-list.component.html | 11 + .../tags-list/tags-list.component.scss | 0 .../tags-list/tags-list.component.spec.ts | 65 ++++ .../tags-list/tags-list.component.ts | 23 ++ .../mappers/my-resources.mapper.ts | 8 +- .../mappers/registration-provider.mapper.ts | 2 +- .../map-registry-status.mapper.ts | 4 +- .../registration/registration-node.mapper.ts | 4 +- .../mappers/resource-overview.mappers.ts | 46 --- .../shared/models/resource-overview.model.ts | 8 +- src/app/shared/services/bookmarks.service.ts | 79 +++- .../shared/services/my-resources.service.ts | 45 +-- .../stores/bookmarks/bookmarks.actions.ts | 24 +- .../stores/bookmarks/bookmarks.model.ts | 16 +- .../stores/bookmarks/bookmarks.selectors.ts | 21 +- .../stores/bookmarks/bookmarks.state.ts | 96 ++++- .../my-resources/my-resources.actions.ts | 13 - .../stores/my-resources/my-resources.model.ts | 25 +- .../my-resources/my-resources.selectors.ts | 21 +- .../stores/my-resources/my-resources.state.ts | 74 +--- .../registration-provider.state.ts | 1 + src/assets/i18n/en.json | 10 +- 126 files changed, 2908 insertions(+), 1856 deletions(-) delete mode 100644 src/app/features/my-projects/mappers/index.ts create mode 100644 src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html rename src/app/{shared/components/resource-metadata/resource-metadata.component.scss => features/project/overview/components/project-overview-metadata/project-overview-metadata.component.scss} (100%) rename src/app/{shared/components/resource-metadata/resource-metadata.component.spec.ts => features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts} (69%) create mode 100644 src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts rename src/app/features/project/overview/components/{overview-toolbar/overview-toolbar.component.html => project-overview-toolbar/project-overview-toolbar.component.html} (94%) rename src/app/features/project/overview/components/{overview-toolbar/overview-toolbar.component.scss => project-overview-toolbar/project-overview-toolbar.component.scss} (100%) rename src/app/features/project/overview/components/{overview-toolbar/overview-toolbar.component.spec.ts => project-overview-toolbar/project-overview-toolbar.component.spec.ts} (53%) rename src/app/features/project/overview/components/{overview-toolbar/overview-toolbar.component.ts => project-overview-toolbar/project-overview-toolbar.component.ts} (72%) create mode 100644 src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.html create mode 100644 src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.scss create mode 100644 src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.spec.ts create mode 100644 src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.ts create mode 100644 src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.html create mode 100644 src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.scss create mode 100644 src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.spec.ts create mode 100644 src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.ts create mode 100644 src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.html create mode 100644 src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.scss create mode 100644 src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.spec.ts create mode 100644 src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.ts delete mode 100644 src/app/features/registry/models/get-registry-overview-json-api.model.ts create mode 100644 src/app/features/registry/models/registration-overview-json-api.model.ts delete mode 100644 src/app/features/registry/store/registry-overview/index.ts delete mode 100644 src/app/features/registry/store/registry-overview/registry-overview.actions.ts delete mode 100644 src/app/features/registry/store/registry-overview/registry-overview.model.ts delete mode 100644 src/app/features/registry/store/registry-overview/registry-overview.selectors.ts delete mode 100644 src/app/features/registry/store/registry-overview/registry-overview.state.ts create mode 100644 src/app/features/registry/store/registry/index.ts create mode 100644 src/app/features/registry/store/registry/registry.actions.ts create mode 100644 src/app/features/registry/store/registry/registry.model.ts create mode 100644 src/app/features/registry/store/registry/registry.selectors.ts create mode 100644 src/app/features/registry/store/registry/registry.state.ts create mode 100644 src/app/shared/components/resource-doi/resource-doi.component.html create mode 100644 src/app/shared/components/resource-doi/resource-doi.component.scss create mode 100644 src/app/shared/components/resource-doi/resource-doi.component.spec.ts create mode 100644 src/app/shared/components/resource-doi/resource-doi.component.ts create mode 100644 src/app/shared/components/resource-license/resource-license.component.html create mode 100644 src/app/shared/components/resource-license/resource-license.component.scss create mode 100644 src/app/shared/components/resource-license/resource-license.component.spec.ts create mode 100644 src/app/shared/components/resource-license/resource-license.component.ts delete mode 100644 src/app/shared/components/resource-metadata/resource-metadata.component.html delete mode 100644 src/app/shared/components/resource-metadata/resource-metadata.component.ts create mode 100644 src/app/shared/components/subjects-list/subjects-list.component.html create mode 100644 src/app/shared/components/subjects-list/subjects-list.component.scss create mode 100644 src/app/shared/components/subjects-list/subjects-list.component.spec.ts create mode 100644 src/app/shared/components/subjects-list/subjects-list.component.ts create mode 100644 src/app/shared/components/tags-list/tags-list.component.html create mode 100644 src/app/shared/components/tags-list/tags-list.component.scss create mode 100644 src/app/shared/components/tags-list/tags-list.component.spec.ts create mode 100644 src/app/shared/components/tags-list/tags-list.component.ts rename src/app/{features/my-projects => shared}/mappers/my-resources.mapper.ts (71%) diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 15ab0b05a..e66d321f2 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -68,8 +68,8 @@ export const routes: Routes = [ path: 'my-projects', loadComponent: () => import('./features/my-projects/my-projects.component').then((mod) => mod.MyProjectsComponent), - providers: [provideStates([BookmarksState, ProjectsState])], canActivate: [authGuard], + providers: [provideStates([BookmarksState, ProjectsState])], }, { path: 'my-registrations', diff --git a/src/app/core/components/nav-menu/nav-menu.component.spec.ts b/src/app/core/components/nav-menu/nav-menu.component.spec.ts index 749818228..5cac85132 100644 --- a/src/app/core/components/nav-menu/nav-menu.component.spec.ts +++ b/src/app/core/components/nav-menu/nav-menu.component.spec.ts @@ -4,8 +4,8 @@ import { NO_ERRORS_SCHEMA, signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; +import { CustomMenuItem } from '@core/models/custom-menu-item.model'; import { AuthService } from '@core/services/auth.service'; -import { CustomMenuItem } from '@osf/core/models'; import { ProviderSelectors } from '@osf/core/store/provider/provider.selectors'; import { UserSelectors } from '@osf/core/store/user/user.selectors'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts index 7ed3672de..52421f0a1 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts @@ -8,7 +8,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { ProjectOverviewSelectors } from '@osf/features/project/overview/store'; -import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; +import { RegistrySelectors } from '@osf/features/registry/store/registry'; import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; @@ -64,8 +64,8 @@ describe('Component: View Duplicates', () => { { selector: DuplicatesSelectors.getDuplicatesTotalCount, value: 0 }, { selector: ProjectOverviewSelectors.getProject, value: MOCK_PROJECT_OVERVIEW }, { selector: ProjectOverviewSelectors.isProjectAnonymous, value: false }, - { selector: RegistryOverviewSelectors.getRegistry, value: undefined }, - { selector: RegistryOverviewSelectors.isRegistryAnonymous, value: false }, + { selector: RegistrySelectors.getRegistry, value: undefined }, + { selector: RegistrySelectors.isRegistryAnonymous, value: false }, ], }), MockProvider(CustomDialogService, mockCustomDialogService), diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts index caf3a9093..b114b3c00 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts @@ -25,11 +25,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { UserSelectors } from '@core/store/user'; import { DeleteComponentDialogComponent, ForkDialogComponent } from '@osf/features/project/overview/components'; import { ClearProjectOverview, GetProjectById, ProjectOverviewSelectors } from '@osf/features/project/overview/store'; -import { - ClearRegistryOverview, - GetRegistryById, - RegistryOverviewSelectors, -} from '@osf/features/registry/store/registry-overview'; +import { ClearRegistry, GetRegistryById, RegistrySelectors } from '@osf/features/registry/store/registry'; import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; @@ -72,9 +68,9 @@ export class ViewDuplicatesComponent { private router = inject(Router); private destroyRef = inject(DestroyRef); private project = select(ProjectOverviewSelectors.getProject); - private registration = select(RegistryOverviewSelectors.getRegistry); + private registration = select(RegistrySelectors.getRegistry); private isProjectAnonymous = select(ProjectOverviewSelectors.isProjectAnonymous); - private isRegistryAnonymous = select(RegistryOverviewSelectors.isRegistryAnonymous); + private isRegistryAnonymous = select(RegistrySelectors.isRegistryAnonymous); duplicates = select(DuplicatesSelectors.getDuplicates); isDuplicatesLoading = select(DuplicatesSelectors.getDuplicatesLoading); @@ -127,7 +123,7 @@ export class ViewDuplicatesComponent { getDuplicates: GetAllDuplicates, clearDuplicates: ClearDuplicates, clearProject: ClearProjectOverview, - clearRegistration: ClearRegistryOverview, + clearRegistration: ClearRegistry, getComponentsTree: GetResourceWithChildren, }); diff --git a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts index 071c60bcd..b93c254ea 100644 --- a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts +++ b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts @@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { ProjectOverviewSelectors } from '@osf/features/project/overview/store'; -import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; +import { RegistrySelectors } from '@osf/features/registry/store/registry'; import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; @@ -54,7 +54,7 @@ describe('Component: View Duplicates', () => { { selector: LinkedProjectsSelectors.getLinkedProjectsLoading, value: false }, { selector: LinkedProjectsSelectors.getLinkedProjectsTotalCount, value: 0 }, { selector: ProjectOverviewSelectors.getProject, value: MOCK_PROJECT_OVERVIEW }, - { selector: RegistryOverviewSelectors.getRegistry, value: undefined }, + { selector: RegistrySelectors.getRegistry, value: undefined }, ], }), MockProvider(ActivatedRoute, activatedRouteMock), diff --git a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts index a87a77c09..6f7bb79bd 100644 --- a/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts +++ b/src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts @@ -22,11 +22,7 @@ import { toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, RouterLink } from '@angular/router'; import { ClearProjectOverview, GetProjectById, ProjectOverviewSelectors } from '@osf/features/project/overview/store'; -import { - ClearRegistryOverview, - GetRegistryById, - RegistryOverviewSelectors, -} from '@osf/features/registry/store/registry-overview'; +import { ClearRegistry, GetRegistryById, RegistrySelectors } from '@osf/features/registry/store/registry'; import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; @@ -59,7 +55,7 @@ export class ViewLinkedProjectsComponent { private route = inject(ActivatedRoute); private destroyRef = inject(DestroyRef); private project = select(ProjectOverviewSelectors.getProject); - private registration = select(RegistryOverviewSelectors.getRegistry); + private registration = select(RegistrySelectors.getRegistry); linkedProjects = select(LinkedProjectsSelectors.getLinkedProjects); isLoading = select(LinkedProjectsSelectors.getLinkedProjectsLoading); @@ -93,7 +89,7 @@ export class ViewLinkedProjectsComponent { getLinkedProjects: GetAllLinkedProjects, clearLinkedProjects: ClearLinkedProjects, clearProject: ClearProjectOverview, - clearRegistration: ClearRegistryOverview, + clearRegistration: ClearRegistry, }); constructor() { diff --git a/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.html b/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.html index 90fb07ee2..b8d7488e4 100644 --- a/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.html +++ b/src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.html @@ -1,6 +1,6 @@
-

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

+

{{ 'common.labels.affiliatedInstitutions' | translate }}

@if (!readonly()) { {{ 'project.overview.metadata.affiliatedInstitutions' | translate }}

- +
diff --git a/src/app/features/my-projects/mappers/index.ts b/src/app/features/my-projects/mappers/index.ts deleted file mode 100644 index 649917ac6..000000000 --- a/src/app/features/my-projects/mappers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { MyResourcesMapper } from './my-resources.mapper'; diff --git a/src/app/features/my-projects/my-projects.component.ts b/src/app/features/my-projects/my-projects.component.ts index 6e87c49cf..89c2af68e 100644 --- a/src/app/features/my-projects/my-projects.component.ts +++ b/src/app/features/my-projects/my-projects.component.ts @@ -28,15 +28,13 @@ import { SearchInputComponent } from '@osf/shared/components/search-input/search import { SelectComponent } from '@osf/shared/components/select/select.component'; import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants'; -import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { SortOrder } from '@osf/shared/enums/sort-order.enum'; import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens'; import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ProjectRedirectDialogService } from '@osf/shared/services/project-redirect-dialog.service'; -import { BookmarksSelectors, GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks'; +import { BookmarksSelectors, GetAllMyBookmarks, GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks'; import { ClearMyResources, - GetMyBookmarks, GetMyPreprints, GetMyProjects, GetMyRegistrations, @@ -82,7 +80,6 @@ export class MyProjectsComponent implements OnInit { readonly queryService = inject(MyProjectsQueryService); readonly tableParamsService = inject(MyProjectsTableParamsService); - readonly bookmarksPageSize = 100; readonly isLoading = signal(false); readonly isMedium = toSignal(inject(IS_MEDIUM)); readonly tabOptions = MY_PROJECTS_TABS; @@ -104,12 +101,13 @@ export class MyProjectsComponent implements OnInit { readonly projects = select(MyResourcesSelectors.getProjects); readonly registrations = select(MyResourcesSelectors.getRegistrations); readonly preprints = select(MyResourcesSelectors.getPreprints); - readonly bookmarks = select(MyResourcesSelectors.getBookmarks); readonly totalProjectsCount = select(MyResourcesSelectors.getTotalProjects); readonly totalRegistrationsCount = select(MyResourcesSelectors.getTotalRegistrations); readonly totalPreprintsCount = select(MyResourcesSelectors.getTotalPreprints); - readonly totalBookmarksCount = select(MyResourcesSelectors.getTotalBookmarks); + + readonly bookmarks = select(BookmarksSelectors.getBookmarks); readonly bookmarksCollectionId = select(BookmarksSelectors.getBookmarksCollectionId); + readonly totalBookmarksCount = select(BookmarksSelectors.getBookmarksTotalCount); readonly isBookmarks = computed(() => this.selectedTab() === MyProjectsTab.Bookmarks); readonly actions = createDispatchMap({ @@ -118,7 +116,7 @@ export class MyProjectsComponent implements OnInit { getMyProjects: GetMyProjects, getMyRegistrations: GetMyRegistrations, getMyPreprints: GetMyPreprints, - getMyBookmarks: GetMyBookmarks, + getMyBookmarks: GetAllMyBookmarks, }); constructor() { @@ -314,13 +312,7 @@ export class MyProjectsComponent implements OnInit { break; case MyProjectsTab.Bookmarks: if (this.bookmarksCollectionId()) { - action$ = this.actions.getMyBookmarks( - this.bookmarksCollectionId(), - pageNumber, - this.bookmarksPageSize, - filters, - ResourceType.Null - ); + action$ = this.actions.getMyBookmarks(this.bookmarksCollectionId(), filters); } break; } diff --git a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts index 2076cd54a..fa1253572 100644 --- a/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts +++ b/src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts @@ -43,9 +43,8 @@ export class AdditionalInfoComponent { if (!preprint) return null; return preprint.embeddedLicense; }); - licenseOptionsRecord = computed(() => { - return (this.preprint()?.licenseOptions ?? {}) as Record; - }); + + licenseOptionsRecord = computed(() => (this.preprint()?.licenseOptions ?? {}) as Record); skeletonData = Array.from({ length: 5 }, () => null); 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 a20d43ff2..06945006e 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 @@ -22,7 +22,11 @@

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

@if (affiliatedInstitutions().length) { - +
+

{{ 'common.labels.affiliatedInstitutions' | translate }}

+ + +
} @if (preprintProvider()?.assertionsEnabled) { diff --git a/src/app/features/preprints/components/stepper/review-step/review-step.component.html b/src/app/features/preprints/components/stepper/review-step/review-step.component.html index 2ae83eb00..345fbe669 100644 --- a/src/app/features/preprints/components/stepper/review-step/review-step.component.html +++ b/src/app/features/preprints/components/stepper/review-step/review-step.component.html @@ -71,7 +71,14 @@

{{ 'common.labels.contributors' | translate }}

@if (affiliatedInstitutions().length) { - +
+

{{ 'common.labels.affiliatedInstitutions' | translate }}

+ + +
} @if (license()) { diff --git a/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.html b/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.html index 1fc424cb5..3e7b3eb6c 100644 --- a/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.html +++ b/src/app/features/project/overview/components/delete-component-dialog/delete-component-dialog.component.html @@ -1,5 +1,5 @@ @if (hasAdminAccessForAllComponents()) { - @if (hasSubcomponents()) { + @if (hasSubComponents()) {

{{ 'project.overview.dialog.deleteComponent.listMessage' | translate }}

@if (isLoading()) { @@ -25,6 +25,7 @@ } @else {

} +
component.permissions?.includes(UserPermissions.Admin)); }); - hasSubcomponents = computed(() => { + hasSubComponents = computed(() => { const components = this.components(); return components && components.length > 1; }); diff --git a/src/app/features/project/overview/components/index.ts b/src/app/features/project/overview/components/index.ts index f1d14c573..8b9a1133d 100644 --- a/src/app/features/project/overview/components/index.ts +++ b/src/app/features/project/overview/components/index.ts @@ -3,14 +3,13 @@ export { CitationAddonCardComponent } from './citation-addon-card/citation-addon export { CitationCollectionItemComponent } from './citation-collection-item/citation-collection-item.component'; export { CitationItemComponent } from './citation-item/citation-item.component'; export { DeleteComponentDialogComponent } from './delete-component-dialog/delete-component-dialog.component'; +export { DeleteNodeLinkDialogComponent } from './delete-node-link-dialog/delete-node-link-dialog.component'; export { DuplicateDialogComponent } from './duplicate-dialog/duplicate-dialog.component'; export { FilesWidgetComponent } from './files-widget/files-widget.component'; export { ForkDialogComponent } from './fork-dialog/fork-dialog.component'; +export { LinkResourceDialogComponent } from './link-resource-dialog/link-resource-dialog.component'; +export { LinkedResourcesComponent } from './linked-resources/linked-resources.component'; export { OverviewComponentsComponent } from './overview-components/overview-components.component'; -export { OverviewToolbarComponent } from './overview-toolbar/overview-toolbar.component'; export { OverviewWikiComponent } from './overview-wiki/overview-wiki.component'; export { RecentActivityComponent } from './recent-activity/recent-activity.component'; export { TogglePublicityDialogComponent } from './toggle-publicity-dialog/toggle-publicity-dialog.component'; -export { DeleteNodeLinkDialogComponent } from '@osf/features/project/overview/components/delete-node-link-dialog/delete-node-link-dialog.component'; -export { LinkResourceDialogComponent } from '@osf/features/project/overview/components/link-resource-dialog/link-resource-dialog.component'; -export { LinkedResourcesComponent } from '@osf/features/project/overview/components/linked-resources/linked-resources.component'; diff --git a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html new file mode 100644 index 000000000..013cba20c --- /dev/null +++ b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.html @@ -0,0 +1,116 @@ +@let resource = currentResource(); + +@if (resource) { + +} diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.scss b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.scss similarity index 100% rename from src/app/shared/components/resource-metadata/resource-metadata.component.scss rename to src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.scss diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts similarity index 69% rename from src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts rename to src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts index bf93d77f3..dc43f0628 100644 --- a/src/app/shared/components/resource-metadata/resource-metadata.component.spec.ts +++ b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.spec.ts @@ -2,28 +2,26 @@ import { MockComponents } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { AffiliatedInstitutionsViewComponent } from '@osf/features/project/overview/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/features/project/overview/components/contributors-list/contributors-list.component'; import { OverviewCollectionsComponent } from '@osf/features/project/overview/components/overview-collections/overview-collections.component'; -import { ResourceOverview } from '@shared/models/resource-overview.model'; - -import { AffiliatedInstitutionsViewComponent } from '../affiliated-institutions-view/affiliated-institutions-view.component'; -import { ContributorsListComponent } from '../contributors-list/contributors-list.component'; -import { ResourceCitationsComponent } from '../resource-citations/resource-citations.component'; -import { TruncatedTextComponent } from '../truncated-text/truncated-text.component'; - -import { ResourceMetadataComponent } from './resource-metadata.component'; +import { ResourceCitationsComponent } from '@osf/features/project/overview/components/resource-citations/resource-citations.component'; +import { ProjectOverviewMetadataComponent } from '@osf/features/project/overview/components/resource-metadata/resource-metadata.component'; +import { TruncatedTextComponent } from '@osf/features/project/overview/components/truncated-text/truncated-text.component'; +import { ResourceOverview } from '@osf/shared/models/resource-overview.model'; import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks/resource.mock'; -describe('ResourceMetadataComponent', () => { - let component: ResourceMetadataComponent; - let fixture: ComponentFixture; +describe('ProjectOverviewMetadataComponent', () => { + let component: ProjectOverviewMetadataComponent; + let fixture: ComponentFixture; const mockResourceOverview: ResourceOverview = MOCK_RESOURCE_OVERVIEW; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - ResourceMetadataComponent, + ProjectOverviewMetadataComponent, MockComponents( TruncatedTextComponent, ResourceCitationsComponent, @@ -34,7 +32,7 @@ describe('ResourceMetadataComponent', () => { ], }).compileComponents(); - fixture = TestBed.createComponent(ResourceMetadataComponent); + fixture = TestBed.createComponent(ProjectOverviewMetadataComponent); component = fixture.componentInstance; }); @@ -84,9 +82,4 @@ describe('ResourceMetadataComponent', () => { fixture.componentRef.setInput('canEdit', false); expect(component.canEdit()).toBe(false); }); - - it('should handle true isCollectionsRoute input', () => { - fixture.componentRef.setInput('isCollectionsRoute', true); - expect(component.isCollectionsRoute()).toBe(true); - }); }); diff --git a/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts new file mode 100644 index 000000000..e91133be7 --- /dev/null +++ b/src/app/features/project/overview/components/project-overview-metadata/project-overview-metadata.component.ts @@ -0,0 +1,68 @@ +import { TranslatePipe } from '@ngx-translate/core'; + +import { Button } from 'primeng/button'; + +import { DatePipe } from '@angular/common'; +import { ChangeDetectionStrategy, Component, inject, input, output } from '@angular/core'; +import { Router, RouterLink } from '@angular/router'; + +import { ENVIRONMENT } from '@core/provider/environment.provider'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { ResourceCitationsComponent } from '@osf/shared/components/resource-citations/resource-citations.component'; +import { ResourceDoiComponent } from '@osf/shared/components/resource-doi/resource-doi.component'; +import { ResourceLicenseComponent } from '@osf/shared/components/resource-license/resource-license.component'; +import { SubjectsListComponent } from '@osf/shared/components/subjects-list/subjects-list.component'; +import { TagsListComponent } from '@osf/shared/components/tags-list/tags-list.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; +import { ResourceOverview } from '@osf/shared/models/resource-overview.model'; + +import { OverviewCollectionsComponent } from '../overview-collections/overview-collections.component'; + +@Component({ + selector: 'osf-project-overview-metadata', + imports: [ + Button, + TranslatePipe, + TruncatedTextComponent, + RouterLink, + DatePipe, + ResourceCitationsComponent, + OverviewCollectionsComponent, + AffiliatedInstitutionsViewComponent, + ContributorsListComponent, + ResourceDoiComponent, + ResourceLicenseComponent, + SubjectsListComponent, + TagsListComponent, + ], + templateUrl: './project-overview-metadata.component.html', + styleUrl: './project-overview-metadata.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ProjectOverviewMetadataComponent { + private readonly environment = inject(ENVIRONMENT); + private readonly router = inject(Router); + + currentResource = input.required(); + canEdit = input.required(); + bibliographicContributors = input([]); + isBibliographicContributorsLoading = input(false); + hasMoreBibliographicContributors = input(false); + loadMoreContributors = output(); + customCitationUpdated = output(); + + readonly resourceType = CurrentResourceType.Projects; + readonly dateFormat = 'MMM d, y, h:mm a'; + readonly webUrl = this.environment.webUrl; + + onCustomCitationUpdated(citation: string): void { + this.customCitationUpdated.emit(citation); + } + + tagClicked(tag: string) { + this.router.navigate(['/search'], { queryParams: { search: tag } }); + } +} diff --git a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html b/src/app/features/project/overview/components/project-overview-toolbar/project-overview-toolbar.component.html similarity index 94% rename from src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html rename to src/app/features/project/overview/components/project-overview-toolbar/project-overview-toolbar.component.html index 221bcb1c1..0687ca960 100644 --- a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.html +++ b/src/app/features/project/overview/components/project-overview-toolbar/project-overview-toolbar.component.html @@ -2,7 +2,7 @@ @if (resource) {
- @if (!isCollectionsRoute() && canEdit() && !isRegistration) { + @if (!isCollectionsRoute() && canEdit()) {
@@ -23,7 +23,7 @@
} - @if ((isCollectionsRoute() || hasViewOnly() || !canEdit()) && !isRegistration) { + @if (isCollectionsRoute() || hasViewOnly() || !canEdit()) { @if (isPublic()) {
@@ -60,7 +60,7 @@ } - @if (resource.resourceType === ResourceType.Project && !hasViewOnly()) { + @if (!hasViewOnly()) { { - let component: OverviewToolbarComponent; - let fixture: ComponentFixture; +describe('ProjectOverviewToolbarComponent', () => { + let component: ProjectOverviewToolbarComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [OverviewToolbarComponent, MockComponent(SocialsShareButtonComponent)], + imports: [ProjectOverviewToolbarComponent, MockComponent(SocialsShareButtonComponent)], }).compileComponents(); - fixture = TestBed.createComponent(OverviewToolbarComponent); + fixture = TestBed.createComponent(ProjectOverviewToolbarComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts b/src/app/features/project/overview/components/project-overview-toolbar/project-overview-toolbar.component.ts similarity index 72% rename from src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts rename to src/app/features/project/overview/components/project-overview-toolbar/project-overview-toolbar.component.ts index 3fc03c67e..24e925800 100644 --- a/src/app/features/project/overview/components/overview-toolbar/overview-toolbar.component.ts +++ b/src/app/features/project/overview/components/project-overview-toolbar/project-overview-toolbar.component.ts @@ -1,4 +1,4 @@ -import { createDispatchMap, select, Store } from '@ngxs/store'; +import { createDispatchMap, select } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; @@ -24,15 +24,19 @@ import { ToolbarResource } from '@osf/shared/models/toolbar-resource.model'; import { FileSizePipe } from '@osf/shared/pipes/file-size.pipe'; import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ToastService } from '@osf/shared/services/toast.service'; -import { AddResourceToBookmarks, BookmarksSelectors, RemoveResourceFromBookmarks } from '@osf/shared/stores/bookmarks'; -import { GetMyBookmarks, MyResourcesSelectors } from '@osf/shared/stores/my-resources'; +import { + AddResourceToBookmarks, + BookmarksSelectors, + GetResourceBookmark, + RemoveResourceFromBookmarks, +} from '@osf/shared/stores/bookmarks'; import { DuplicateDialogComponent } from '../duplicate-dialog/duplicate-dialog.component'; import { ForkDialogComponent } from '../fork-dialog/fork-dialog.component'; import { TogglePublicityDialogComponent } from '../toggle-publicity-dialog/toggle-publicity-dialog.component'; @Component({ - selector: 'osf-overview-toolbar', + selector: 'osf-project-overview-toolbar', imports: [ ToggleSwitch, TranslatePipe, @@ -45,19 +49,18 @@ import { TogglePublicityDialogComponent } from '../toggle-publicity-dialog/toggl FileSizePipe, SocialsShareButtonComponent, ], - templateUrl: './overview-toolbar.component.html', - styleUrl: './overview-toolbar.component.scss', + templateUrl: './project-overview-toolbar.component.html', + styleUrl: './project-overview-toolbar.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class OverviewToolbarComponent { - private store = inject(Store); +export class ProjectOverviewToolbarComponent { private customDialogService = inject(CustomDialogService); private toastService = inject(ToastService); + private destroyRef = inject(DestroyRef); private readonly router = inject(Router); private readonly route = inject(ActivatedRoute); - destroyRef = inject(DestroyRef); isPublic = signal(false); isBookmarked = signal(false); @@ -67,16 +70,22 @@ export class OverviewToolbarComponent { projectDescription = input(''); showViewOnlyLinks = input(true); - isBookmarksLoading = select(MyResourcesSelectors.getBookmarksLoading); - isBookmarksSubmitting = select(BookmarksSelectors.getBookmarksCollectionIdSubmitting); bookmarksCollectionId = select(BookmarksSelectors.getBookmarksCollectionId); - bookmarkedProjects = select(MyResourcesSelectors.getBookmarks); + bookmarks = select(BookmarksSelectors.getBookmarks); + isBookmarksLoading = select(BookmarksSelectors.areBookmarksLoading); + isBookmarksSubmitting = select(BookmarksSelectors.getBookmarksCollectionIdSubmitting); + duplicatedProject = select(ProjectOverviewSelectors.getDuplicatedProject); isAuthenticated = select(UserSelectors.isAuthenticated); hasViewOnly = computed(() => hasViewOnlyParam(this.router)); - actions = createDispatchMap({ clearDuplicatedProject: ClearDuplicatedProject }); + actions = createDispatchMap({ + getResourceBookmark: GetResourceBookmark, + addResourceToBookmarks: AddResourceToBookmarks, + removeResourceFromBookmarks: RemoveResourceFromBookmarks, + clearDuplicatedProject: ClearDuplicatedProject, + }); readonly ResourceType = ResourceType; @@ -97,20 +106,14 @@ export class OverviewToolbarComponent { }, ]; - get isRegistration(): boolean { - return this.currentResource()?.resourceType === ResourceType.Registration; - } - constructor() { effect(() => { const bookmarksId = this.bookmarksCollectionId(); const resource = this.currentResource(); - if (!bookmarksId || !resource) { - return; - } + if (!bookmarksId || !resource) return; - this.store.dispatch(new GetMyBookmarks(bookmarksId, 1, 100, {}, resource.resourceType)); + this.actions.getResourceBookmark(bookmarksId, resource.id, resource.resourceType); }); effect(() => { @@ -122,7 +125,7 @@ export class OverviewToolbarComponent { effect(() => { const resource = this.currentResource(); - const bookmarks = this.bookmarkedProjects(); + const bookmarks = this.bookmarks(); if (!resource || !bookmarks?.length) { this.isBookmarked.set(false); @@ -163,44 +166,33 @@ export class OverviewToolbarComponent { const newBookmarkState = !this.isBookmarked(); - if (!newBookmarkState) { - this.store - .dispatch(new RemoveResourceFromBookmarks(bookmarksId, resource.id, resource.resourceType)) + if (newBookmarkState) { + this.actions + .addResourceToBookmarks(bookmarksId, resource.id, resource.resourceType) .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe({ - next: () => { - this.isBookmarked.set(newBookmarkState); - this.toastService.showSuccess('project.overview.dialog.toast.bookmark.remove'); - }, + .subscribe(() => { + this.isBookmarked.set(newBookmarkState); + this.toastService.showSuccess('project.overview.dialog.toast.bookmark.add'); }); } else { - this.store - .dispatch(new AddResourceToBookmarks(bookmarksId, resource.id, resource.resourceType)) + this.actions + .removeResourceFromBookmarks(bookmarksId, resource.id, resource.resourceType) .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe({ - next: () => { - this.isBookmarked.set(newBookmarkState); - this.toastService.showSuccess('project.overview.dialog.toast.bookmark.add'); - }, + .subscribe(() => { + this.isBookmarked.set(newBookmarkState); + this.toastService.showSuccess('project.overview.dialog.toast.bookmark.remove'); }); } } private handleForkResource(): void { const resource = this.currentResource(); - const headerTranslation = - resource?.resourceType === ResourceType.Project - ? 'project.overview.dialog.fork.headerProject' - : resource?.resourceType === ResourceType.Registration - ? 'project.overview.dialog.fork.headerRegistry' - : ''; + const headerTranslation = 'project.overview.dialog.fork.headerProject'; if (resource) { this.customDialogService.open(ForkDialogComponent, { header: headerTranslation, - data: { - resource: resource, - }, + data: { resource }, }); } } @@ -211,7 +203,6 @@ export class OverviewToolbarComponent { .onClose.subscribe({ next: () => { const duplicatedProject = this.duplicatedProject(); - if (duplicatedProject) { this.router.navigate(['/', duplicatedProject.id]); } diff --git a/src/app/features/project/overview/project-overview.component.html b/src/app/features/project/overview/project-overview.component.html index f65b70d76..818ff3db9 100644 --- a/src/app/features/project/overview/project-overview.component.html +++ b/src/app/features/project/overview/project-overview.component.html @@ -14,7 +14,7 @@ @if (currentProject()) {
-
- { OverviewComponentsComponent, LinkedResourcesComponent, RecentActivityComponent, - OverviewToolbarComponent, + ProjectOverviewToolbarComponent, ResourceMetadataComponent, FilesWidgetComponent, ViewOnlyLinkMessageComponent, diff --git a/src/app/features/project/overview/project-overview.component.ts b/src/app/features/project/overview/project-overview.component.ts index 2b64641c0..9ceabbae3 100644 --- a/src/app/features/project/overview/project-overview.component.ts +++ b/src/app/features/project/overview/project-overview.component.ts @@ -32,7 +32,6 @@ import { } from '@osf/features/moderation/store/collections-moderation'; import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { MakeDecisionDialogComponent } from '@osf/shared/components/make-decision-dialog/make-decision-dialog.component'; -import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; import { Mode } from '@osf/shared/enums/mode.enum'; @@ -66,12 +65,13 @@ import { AnalyticsService } from '@shared/services/analytics.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; import { OverviewParentProjectComponent } from './components/overview-parent-project/overview-parent-project.component'; +import { ProjectOverviewMetadataComponent } from './components/project-overview-metadata/project-overview-metadata.component'; +import { ProjectOverviewToolbarComponent } from './components/project-overview-toolbar/project-overview-toolbar.component'; import { CitationAddonCardComponent, FilesWidgetComponent, LinkedResourcesComponent, OverviewComponentsComponent, - OverviewToolbarComponent, OverviewWikiComponent, RecentActivityComponent, } from './components'; @@ -100,8 +100,8 @@ import { OverviewComponentsComponent, LinkedResourcesComponent, RecentActivityComponent, - OverviewToolbarComponent, - ResourceMetadataComponent, + ProjectOverviewToolbarComponent, + ProjectOverviewMetadataComponent, TranslatePipe, Message, RouterLink, diff --git a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts index 13c035f44..887c3c5ec 100644 --- a/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts +++ b/src/app/features/project/project-addons/components/configure-addon/configure-addon.component.ts @@ -98,19 +98,23 @@ export class ConfigureAddonComponent implements OnInit { const currentUrl = this.router.url; return currentUrl.split('/addons')[0]; }); + readonly resourceUri = computed(() => { const id = this.route.parent?.parent?.snapshot.params['id']; return `${this.environment.webUrl}/${id}`; }); + readonly addonTypeString = computed(() => { return getAddonTypeString(this.addon()) as AddonType; }); + readonly selectedItemLabel = computed(() => { const addonType = this.addonTypeString(); return addonType === AddonType.LINK ? 'settings.addons.configureAddon.linkedItem' : 'settings.addons.configureAddon.selectedFolder'; }); + readonly supportedResourceTypes = computed(() => { if (this.linkAddons().length && this.addonTypeString() === AddonType.LINK) { const addon = this.linkAddons().find((a) => this.addon()?.externalServiceName === a.externalServiceName); @@ -118,6 +122,7 @@ export class ConfigureAddonComponent implements OnInit { } return []; }); + readonly actions = createDispatchMap({ createAddonOperationInvocation: CreateAddonOperationInvocation, updateConfiguredAddon: UpdateConfiguredAddon, diff --git a/src/app/features/registries/components/justification-review/justification-review.component.html b/src/app/features/registries/components/justification-review/justification-review.component.html index 480466477..a282a0fcc 100644 --- a/src/app/features/registries/components/justification-review/justification-review.component.html +++ b/src/app/features/registries/components/justification-review/justification-review.component.html @@ -30,7 +30,7 @@

{{ 'registries.justification.updatedList' | translate }}

{{ page.title }}

@if (page.description) { -

{{ page.description }}

+

{{ page.description }}

} @if (page.questions?.length) { diff --git a/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.html b/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.html index 4e5effc82..e6aee0113 100644 --- a/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.html +++ b/src/app/features/registries/components/registries-metadata-step/registries-affiliated-institution/registries-affiliated-institution.component.html @@ -1,9 +1,11 @@
-

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

+

{{ 'common.labels.affiliatedInstitutions' | translate }}

+

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

+ @if (userInstitutions().length) {
{{ 'project.overview.metadata.affiliatedInstitutions' | translate }} />
} @else { -

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

+

{{ 'common.labels.noAffiliatedInstitutions' | translate }}

}
diff --git a/src/app/features/registries/components/review/review.component.html b/src/app/features/registries/components/review/review.component.html index 524dcea91..2cd5eeba4 100644 --- a/src/app/features/registries/components/review/review.component.html +++ b/src/app/features/registries/components/review/review.component.html @@ -83,7 +83,7 @@

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

{{ page.title }}

@if (page.description) { -

{{ page.description }}

+

{{ page.description }}

} @if (page.questions?.length) { diff --git a/src/app/features/registry/components/archiving-message/archiving-message.component.ts b/src/app/features/registry/components/archiving-message/archiving-message.component.ts index 8e3e96293..3525ed5aa 100644 --- a/src/app/features/registry/components/archiving-message/archiving-message.component.ts +++ b/src/app/features/registry/components/archiving-message/archiving-message.component.ts @@ -8,7 +8,7 @@ import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core import { ENVIRONMENT } from '@core/provider/environment.provider'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; -import { RegistryOverview } from '../../models'; +import { RegistrationOverviewModel } from '../../models'; import { ShortRegistrationInfoComponent } from '../short-registration-info/short-registration-info.component'; @Component({ @@ -21,7 +21,7 @@ import { ShortRegistrationInfoComponent } from '../short-registration-info/short export class ArchivingMessageComponent { private readonly environment = inject(ENVIRONMENT); - registration = input.required(); + registration = input.required(); readonly supportEmail = this.environment.supportEmail; } diff --git a/src/app/features/registry/components/index.ts b/src/app/features/registry/components/index.ts index 0155fd53e..e999974a2 100644 --- a/src/app/features/registry/components/index.ts +++ b/src/app/features/registry/components/index.ts @@ -2,6 +2,7 @@ export * from './add-resource-dialog/add-resource-dialog.component'; export * from './archiving-message/archiving-message.component'; export * from './edit-resource-dialog/edit-resource-dialog.component'; export * from './registration-links-card/registration-links-card.component'; +export * from './registry-blocks-section/registry-blocks-section.component'; export * from './registry-revisions/registry-revisions.component'; export * from './registry-statuses/registry-statuses.component'; export * from './resource-form/resource-form.component'; diff --git a/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.html b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.html new file mode 100644 index 000000000..f60453621 --- /dev/null +++ b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.html @@ -0,0 +1,25 @@ +@if (resourceId()) { +
+ @if (isAuthenticated()) { + + @if (!isBookmarksLoading() && !isBookmarksSubmitting()) { + + } + + } + + @if (isPublic()) { + + } +
+} diff --git a/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.scss b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.spec.ts b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.spec.ts new file mode 100644 index 000000000..8d2935b21 --- /dev/null +++ b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.spec.ts @@ -0,0 +1,26 @@ +import { MockComponent } from 'ng-mocks'; + +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SocialsShareButtonComponent } from '@osf/shared/components/socials-share-button/socials-share-button.component'; + +import { RegistrationOverviewToolbarComponent } from './registration-overview-toolbar.component'; + +describe('RegistrationRegistrationOverviewToolbarComponent', () => { + let component: RegistrationOverviewToolbarComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [RegistrationOverviewToolbarComponent, MockComponent(SocialsShareButtonComponent)], + }).compileComponents(); + + fixture = TestBed.createComponent(RegistrationOverviewToolbarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.ts b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.ts new file mode 100644 index 000000000..0038252f3 --- /dev/null +++ b/src/app/features/registry/components/registration-overview-toolbar/registration-overview-toolbar.component.ts @@ -0,0 +1,98 @@ +import { createDispatchMap, select } from '@ngxs/store'; + +import { TranslatePipe } from '@ngx-translate/core'; + +import { Button } from 'primeng/button'; +import { Tooltip } from 'primeng/tooltip'; + +import { ChangeDetectionStrategy, Component, DestroyRef, effect, inject, input, signal } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; + +import { UserSelectors } from '@core/store/user'; +import { SocialsShareButtonComponent } from '@osf/shared/components/socials-share-button/socials-share-button.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ToastService } from '@osf/shared/services/toast.service'; +import { + AddResourceToBookmarks, + BookmarksSelectors, + GetResourceBookmark, + RemoveResourceFromBookmarks, +} from '@osf/shared/stores/bookmarks'; + +@Component({ + selector: 'osf-registration-overview-toolbar', + imports: [Button, Tooltip, SocialsShareButtonComponent, TranslatePipe], + templateUrl: './registration-overview-toolbar.component.html', + styleUrl: './registration-overview-toolbar.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class RegistrationOverviewToolbarComponent { + private toastService = inject(ToastService); + private destroyRef = inject(DestroyRef); + + resourceId = input.required(); + resourceTitle = input.required(); + isPublic = input(false); + + isBookmarked = signal(false); + resourceType = ResourceType.Registration; + + bookmarksCollectionId = select(BookmarksSelectors.getBookmarksCollectionId); + bookmarks = select(BookmarksSelectors.getBookmarks); + isBookmarksLoading = select(BookmarksSelectors.areBookmarksLoading); + isBookmarksSubmitting = select(BookmarksSelectors.getBookmarksCollectionIdSubmitting); + isAuthenticated = select(UserSelectors.isAuthenticated); + + actions = createDispatchMap({ + getResourceBookmark: GetResourceBookmark, + addResourceToBookmarks: AddResourceToBookmarks, + removeResourceFromBookmarks: RemoveResourceFromBookmarks, + }); + + constructor() { + effect(() => { + const bookmarksCollectionId = this.bookmarksCollectionId(); + + if (!bookmarksCollectionId || !this.resourceId()) return; + + this.actions.getResourceBookmark(bookmarksCollectionId, this.resourceId(), this.resourceType); + }); + + effect(() => { + const bookmarks = this.bookmarks(); + + if (!this.resourceId() || !bookmarks?.length) { + this.isBookmarked.set(false); + return; + } + + this.isBookmarked.set(bookmarks.some((bookmark) => bookmark.id === this.resourceId())); + }); + } + + toggleBookmark(): void { + const bookmarksId = this.bookmarksCollectionId(); + + if (!this.resourceId() || !bookmarksId) return; + + const newBookmarkState = !this.isBookmarked(); + + if (newBookmarkState) { + this.actions + .addResourceToBookmarks(bookmarksId, this.resourceId(), this.resourceType) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => { + this.isBookmarked.set(newBookmarkState); + this.toastService.showSuccess('project.overview.dialog.toast.bookmark.add'); + }); + } else { + this.actions + .removeResourceFromBookmarks(bookmarksId, this.resourceId(), this.resourceType) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => { + this.isBookmarked.set(newBookmarkState); + this.toastService.showSuccess('project.overview.dialog.toast.bookmark.remove'); + }); + } + } +} diff --git a/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.html b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.html new file mode 100644 index 000000000..d45a5d930 --- /dev/null +++ b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.html @@ -0,0 +1,47 @@ +@if (isLoading()) { +
+ +
+} @else if (schemaBlocks()) { + @for (page of schemaBlocks()!; track page.id) { +

{{ page.title }}

+ + @if (page.description) { +

{{ page.description }}

+ } + + @if (page.questions?.length) { + + } + + @if (page.sections?.length) { + @for (section of page.sections; track section.id) { +
+

{{ section.title }}

+ + @if (section.description) { +

{{ section.description }}

+ } + + @if (section.questions?.length) { + + } +
+ } + } + } +} diff --git a/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.scss b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.spec.ts b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.spec.ts new file mode 100644 index 000000000..ad7e78b25 --- /dev/null +++ b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.spec.ts @@ -0,0 +1,62 @@ +import { MockComponents } from 'ng-mocks'; + +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; + +import { RegistryBlocksSectionComponent } from './registry-blocks-section.component'; + +import { OSFTestingModule } from '@testing/osf.testing.module'; + +describe('RegistryBlocksSectionComponent', () => { + let component: RegistryBlocksSectionComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [RegistryBlocksSectionComponent, OSFTestingModule, ...MockComponents(RegistrationBlocksDataComponent)], + }).compileComponents(); + + fixture = TestBed.createComponent(RegistryBlocksSectionComponent); + component = fixture.componentInstance; + + fixture.componentRef.setInput('schemaBlocks', []); + fixture.componentRef.setInput('isSchemaBlocksLoading', false); + fixture.componentRef.setInput('isSchemaResponsesLoading', false); + fixture.componentRef.setInput('schemaResponse', null); + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should compute updatedFields from schemaResponse', () => { + const mockSchemaResponse = { + id: 'test-id', + dateCreated: '2024-01-01', + dateSubmitted: null, + dateModified: '2024-01-01', + revisionJustification: 'test', + revisionResponses: {}, + updatedResponseKeys: ['key1', 'key2'], + reviewsState: 'pending' as any, + isPendingCurrentUserApproval: false, + isOriginalResponse: true, + registrationSchemaId: 'schema-id', + registrationId: 'reg-id', + }; + + fixture.componentRef.setInput('schemaResponse', mockSchemaResponse); + fixture.detectChanges(); + + expect(component.updatedFields()).toEqual(['key1', 'key2']); + }); + + it('should return empty array when schemaResponse is null', () => { + fixture.componentRef.setInput('schemaResponse', null); + fixture.detectChanges(); + + expect(component.updatedFields()).toEqual([]); + }); +}); diff --git a/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.ts b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.ts new file mode 100644 index 000000000..f14773420 --- /dev/null +++ b/src/app/features/registry/components/registry-blocks-section/registry-blocks-section.component.ts @@ -0,0 +1,22 @@ +import { Skeleton } from 'primeng/skeleton'; + +import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; + +import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; + +@Component({ + selector: 'osf-registry-blocks-section', + imports: [Skeleton, RegistrationBlocksDataComponent], + templateUrl: './registry-blocks-section.component.html', + styleUrl: './registry-blocks-section.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class RegistryBlocksSectionComponent { + schemaBlocks = input.required(); + schemaResponse = input.required(); + isLoading = input(false); + + updatedFields = computed(() => (this.schemaResponse() ? this.schemaResponse()!.updatedResponseKeys : [])); +} diff --git a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts index 10a78ca3e..4dea4eade 100644 --- a/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts +++ b/src/app/features/registry/components/registry-make-decision/registry-make-decision.component.spec.ts @@ -12,6 +12,8 @@ import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.e import { ReviewActionTrigger, SchemaResponseActionTrigger } from '@osf/shared/enums/trigger-action.enum'; import { DateAgoPipe } from '@shared/pipes/date-ago.pipe'; +import { RegistrySelectors } from '../../store/registry'; + import { RegistryMakeDecisionComponent } from './registry-make-decision.component'; import { DynamicDialogRefMock } from '@testing/mocks/dynamic-dialog-ref.mock'; @@ -48,8 +50,8 @@ describe('RegistryMakeDecisionComponent', () => { MockProvider(DynamicDialogConfig, mockDialogConfig), provideMockStore({ signals: [ - { selector: 'RegistryOverviewSelectors.getReviewActions', value: [] }, - { selector: 'RegistryOverviewSelectors.isReviewActionSubmitting', value: false }, + { selector: RegistrySelectors.getReviewActions, value: [] }, + { selector: RegistrySelectors.isReviewActionSubmitting, value: false }, ], }), ], 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 ff1994ec1..15db71ed9 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 @@ -25,7 +25,7 @@ import { ReviewActionTrigger, SchemaResponseActionTrigger } from '@osf/shared/en import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe'; import { RegistryOverview } from '../../models'; -import { RegistryOverviewSelectors, SubmitDecision } from '../../store/registry-overview'; +import { RegistrySelectors, SubmitDecision } from '../../store/registry'; @Component({ selector: 'osf-registry-make-decision', @@ -55,9 +55,9 @@ export class RegistryMakeDecisionComponent { readonly SchemaResponseActionTrigger = SchemaResponseActionTrigger; readonly SubmissionReviewStatus = SubmissionReviewStatus; readonly ModerationDecisionFormControls = ModerationDecisionFormControls; - reviewActions = select(RegistryOverviewSelectors.getReviewActions); + reviewActions = select(RegistrySelectors.getReviewActions); - isSubmitting = select(RegistryOverviewSelectors.isReviewActionSubmitting); + isSubmitting = select(RegistrySelectors.isReviewActionSubmitting); requestForm!: FormGroup; actions = createDispatchMap({ submitDecision: SubmitDecision }); diff --git a/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.html b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.html new file mode 100644 index 000000000..2637d5b9b --- /dev/null +++ b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.html @@ -0,0 +1,119 @@ +@let resource = registry(); + +@if (resource && resource.id) { + +} diff --git a/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.scss b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.spec.ts b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.spec.ts new file mode 100644 index 000000000..ba61aaba3 --- /dev/null +++ b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RegistryOverviewMetadataComponent } from './registry-overview-metadata.component'; + +describe('RegistryOverviewMetadataComponent', () => { + let component: RegistryOverviewMetadataComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [RegistryOverviewMetadataComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(RegistryOverviewMetadataComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.ts b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.ts new file mode 100644 index 000000000..ef35929bc --- /dev/null +++ b/src/app/features/registry/components/registry-overview-metadata/registry-overview-metadata.component.ts @@ -0,0 +1,108 @@ +import { createDispatchMap, select } from '@ngxs/store'; + +import { TranslatePipe } from '@ngx-translate/core'; + +import { Button } from 'primeng/button'; + +import { DatePipe } from '@angular/common'; +import { ChangeDetectionStrategy, Component, effect, inject } from '@angular/core'; +import { Router, RouterLink } from '@angular/router'; + +import { ENVIRONMENT } from '@core/provider/environment.provider'; +import { AffiliatedInstitutionsViewComponent } from '@osf/shared/components/affiliated-institutions-view/affiliated-institutions-view.component'; +import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { ResourceCitationsComponent } from '@osf/shared/components/resource-citations/resource-citations.component'; +import { ResourceDoiComponent } from '@osf/shared/components/resource-doi/resource-doi.component'; +import { ResourceLicenseComponent } from '@osf/shared/components/resource-license/resource-license.component'; +import { SubjectsListComponent } from '@osf/shared/components/subjects-list/subjects-list.component'; +import { TagsListComponent } from '@osf/shared/components/tags-list/tags-list.component'; +import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; +import { CurrentResourceType, ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ContributorsSelectors, LoadMoreBibliographicContributors } from '@osf/shared/stores/contributors'; +import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects'; + +import { + GetRegistryIdentifiers, + GetRegistryInstitutions, + GetRegistryLicense, + RegistrySelectors, + SetRegistryCustomCitation, +} from '../../store/registry'; + +@Component({ + selector: 'osf-registry-overview-metadata', + imports: [ + Button, + TranslatePipe, + TruncatedTextComponent, + RouterLink, + DatePipe, + ResourceCitationsComponent, + ResourceDoiComponent, + ResourceLicenseComponent, + AffiliatedInstitutionsViewComponent, + ContributorsListComponent, + SubjectsListComponent, + TagsListComponent, + ], + templateUrl: './registry-overview-metadata.component.html', + styleUrl: './registry-overview-metadata.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class RegistryOverviewMetadataComponent { + private readonly environment = inject(ENVIRONMENT); + private readonly router = inject(Router); + + readonly registry = select(RegistrySelectors.getRegistry); + readonly isAnonymous = select(RegistrySelectors.isRegistryAnonymous); + + canEdit = select(RegistrySelectors.hasWriteAccess); + license = select(RegistrySelectors.getLicense); + isLicenseLoading = select(RegistrySelectors.isLicenseLoading); + identifiers = select(RegistrySelectors.getIdentifiers); + isIdentifiersLoading = select(RegistrySelectors.isIdentifiersLoading); + institutions = select(RegistrySelectors.getInstitutions); + isInstitutionsLoading = select(RegistrySelectors.isInstitutionsLoading); + subjects = select(SubjectsSelectors.getSubjects); + isSubjectsLoading = select(SubjectsSelectors.getSubjectsLoading); + + bibliographicContributors = select(ContributorsSelectors.getBibliographicContributors); + isBibliographicContributorsLoading = select(ContributorsSelectors.isBibliographicContributorsLoading); + hasMoreBibliographicContributors = select(ContributorsSelectors.hasMoreBibliographicContributors); + + readonly currentResourceType = CurrentResourceType.Registrations; + readonly dateFormat = 'MMM d, y, h:mm a'; + readonly webUrl = this.environment.webUrl; + + private readonly actions = createDispatchMap({ + getSubjects: FetchSelectedSubjects, + getInstitutions: GetRegistryInstitutions, + getIdentifiers: GetRegistryIdentifiers, + getLicense: GetRegistryLicense, + setCustomCitation: SetRegistryCustomCitation, + loadMoreBibliographicContributors: LoadMoreBibliographicContributors, + }); + + constructor() { + effect(() => { + if (this.registry()?.id) { + this.actions.getInstitutions(this.registry()!.id); + this.actions.getSubjects(this.registry()!.id, ResourceType.Registration); + this.actions.getLicense(this.registry()!.licenseId); + this.actions.getIdentifiers(this.registry()!.id); + } + }); + } + + onCustomCitationUpdated(citation: string): void { + this.actions.setCustomCitation(citation); + } + + handleLoadMoreContributors(): void { + this.actions.loadMoreBibliographicContributors(this.registry()?.id, ResourceType.Registration); + } + + tagClicked(tag: string) { + this.router.navigate(['/search'], { queryParams: { search: tag } }); + } +} diff --git a/src/app/features/registry/components/registry-revisions/registry-revisions.component.html b/src/app/features/registry/components/registry-revisions/registry-revisions.component.html index ad7a78930..bb338aec3 100644 --- a/src/app/features/registry/components/registry-revisions/registry-revisions.component.html +++ b/src/app/features/registry/components/registry-revisions/registry-revisions.component.html @@ -31,7 +31,7 @@ @@ -40,7 +40,7 @@ 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 6795f54a2..b3ad25218 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 @@ -6,9 +6,10 @@ import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, computed, HostBinding, input, output } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { RegistryOverview } from '@osf/features/registry/models'; +import { RegistrationOverviewModel } from '@osf/features/registry/models'; import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; @Component({ selector: 'osf-registry-revisions', @@ -20,7 +21,8 @@ import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.e export class RegistryRevisionsComponent { @HostBinding('class') classes = 'flex-1 flex'; - registry = input.required(); + registry = input.required(); + schemaResponses = input.required(); selectedRevisionIndex = input.required(); isSubmitting = input(false); isModeration = input(false); @@ -34,7 +36,7 @@ export class RegistryRevisionsComponent { unApprovedRevisionId: string | null = null; revisions = computed(() => { - let schemaResponses = this.registry()?.schemaResponses || []; + let schemaResponses = this.schemaResponses() || []; if (this.registryAcceptedUnapproved) { this.unApprovedRevisionId = @@ -64,16 +66,16 @@ export class RegistryRevisionsComponent { }); get registryInProgress(): boolean { - return this.registry()?.revisionStatus === RevisionReviewStates.RevisionInProgress; + return this.registry()?.revisionState === RevisionReviewStates.RevisionInProgress; } get registryApproved(): boolean { - return this.registry()?.revisionStatus === RevisionReviewStates.Approved; + return this.registry()?.revisionState === RevisionReviewStates.Approved; } get registryAcceptedUnapproved(): boolean { return ( - this.registry()?.revisionStatus === RevisionReviewStates.Unapproved && + this.registry()?.revisionState === RevisionReviewStates.Unapproved && this.registry()?.reviewsState === RegistrationReviewStates.Accepted ); } 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 4b67b8e02..9e53298fd 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 @@ -15,8 +15,8 @@ import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.e import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; -import { RegistryOverview } from '../../models'; -import { MakePublic } from '../../store/registry-overview'; +import { RegistrationOverviewModel } from '../../models'; +import { MakePublic } from '../../store/registry'; import { WithdrawDialogComponent } from '../withdraw-dialog/withdraw-dialog.component'; @Component({ @@ -33,7 +33,7 @@ export class RegistryStatusesComponent { readonly supportEmail = this.environment.supportEmail; - registry = input.required(); + registry = input.required(); canEdit = input(false); isModeration = input(false); diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.html b/src/app/features/registry/components/short-registration-info/short-registration-info.component.html index 4487d7184..a5144f4c0 100644 --- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.html +++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.html @@ -1,7 +1,12 @@

{{ 'common.labels.contributors' | translate }}

- +
@@ -12,7 +17,7 @@

{{ 'common.labels.description' | translate }}

{{ 'registry.overview.metadata.type' | translate }}

-

{{ registration().registrationType }}

+

{{ registration().registrationSupplement }}

@@ -29,6 +34,6 @@

{{ 'registry.archiving.createdDate' | translate }}

{{ 'registry.overview.metadata.associatedProject' | translate }}

- {{ associatedProjectUrl }} + {{ associatedProjectUrl() }}
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 1f384f319..1b20c04f9 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 @@ -1,13 +1,17 @@ +import { createDispatchMap, select } from '@ngxs/store'; + import { TranslatePipe } from '@ngx-translate/core'; import { DatePipe } from '@angular/common'; -import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; +import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core'; import { RouterLink } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { ContributorsSelectors, LoadMoreBibliographicContributors } from '@osf/shared/stores/contributors'; -import { RegistryOverview } from '../../models'; +import { RegistrationOverviewModel } from '../../models'; @Component({ selector: 'osf-short-registration-info', @@ -19,9 +23,19 @@ import { RegistryOverview } from '../../models'; export class ShortRegistrationInfoComponent { private readonly environment = inject(ENVIRONMENT); - registration = input.required(); + registration = input.required(); + + bibliographicContributors = select(ContributorsSelectors.getBibliographicContributors); + isBibliographicContributorsLoading = select(ContributorsSelectors.isBibliographicContributorsLoading); + hasMoreBibliographicContributors = select(ContributorsSelectors.hasMoreBibliographicContributors); + + private readonly actions = createDispatchMap({ + loadMoreBibliographicContributors: LoadMoreBibliographicContributors, + }); + + associatedProjectUrl = computed(() => `${this.environment.webUrl}/${this.registration().associatedProjectId}`); - get associatedProjectUrl(): string { - return `${this.environment.webUrl}/${this.registration().associatedProjectId}`; + handleLoadMoreContributors(): void { + this.actions.loadMoreBibliographicContributors(this.registration()?.id, ResourceType.Registration); } } 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 7b0b85ca2..2a24717e6 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 @@ -10,7 +10,7 @@ import { finalize, take } from 'rxjs'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; -import { WithdrawRegistration } from '@osf/features/registry/store/registry-overview'; +import { WithdrawRegistration } from '@osf/features/registry/store/registry'; import { TextInputComponent } from '@osf/shared/components/text-input/text-input.component'; import { InputLimits } from '@osf/shared/constants/input-limits.const'; import { CustomValidators } from '@osf/shared/helpers/custom-form-validators.helper'; diff --git a/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.html b/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.html index e7ba4e4f7..5f644c72c 100644 --- a/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.html +++ b/src/app/features/registry/components/withdrawn-message/withdrawn-message.component.html @@ -5,17 +5,22 @@

{{ 'registry.withdrawn.title' | translate }}

+

{{ 'registry.withdrawn.dateWithdrawn' | translate }}

{{ registration().dateWithdrawn | date }}

+

{{ 'registry.withdrawn.justificationLabel' | translate }}

{{ registration().withdrawalJustification }}

+
+ @if (registry()?.archiving) {
@@ -76,12 +77,13 @@

@@ -89,58 +91,16 @@

}
- @for (page of schemaBlocks(); track page.id) { -

{{ page.title }}

- - @if (page.description) { -

{{ page.description }}

- } - - @if (page.questions?.length) { - - } - - @if (page.sections?.length) { - @for (section of page.sections; track section.id) { -
-

{{ section.title }}

- @if (section.description) { -

{{ section.description }}

- } - @if (section.questions?.length) { - - } -
- } - } - } +

+
- +
diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.scss b/src/app/features/registry/pages/registry-overview/registry-overview.component.scss index d4b8c0861..33c372ba4 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.scss +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.scss @@ -1,37 +1,19 @@ -@use "styles/mixins" as mix; - .left-section { - flex: 3; display: flex; flex-direction: column; + flex: 3; gap: 1.5rem; } -.accordion-border { - border: 1px solid var(--grey-2); - border-radius: mix.rem(12px); - height: max-content !important; -} - -.blocks-section { +.right-section { border: 1px solid var(--grey-2); - border-radius: mix.rem(12px); + border-radius: 0.75rem; + flex: 1; height: max-content; } -.right-section { - flex: 1; +.blocks-section { border: 1px solid var(--grey-2); - border-radius: mix.rem(12px); + border-radius: 0.75rem; height: max-content; } - -.no-padding { - --p-accordion-header-padding: 0; -} - -.current-revision { - --p-button-info-background: var(--bg-blue-3); - --p-button-info-hover-background: var(--bg-blue-2); - --p-button-info-hover-border-color: transparent; -} diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts b/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts index a99c6fbb4..6176bbe3f 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.spec.ts @@ -2,19 +2,22 @@ import { MockComponents, MockProvider } from 'ng-mocks'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { OverviewToolbarComponent } from '@osf/features/project/overview/components'; -import { RegistriesSelectors } from '@osf/features/registries/store'; import { DataResourcesComponent } from '@osf/shared/components/data-resources/data-resources.component'; import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; -import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; -import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; -import { ArchivingMessageComponent, RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components'; +import { + ArchivingMessageComponent, + RegistryBlocksSectionComponent, + RegistryRevisionsComponent, + RegistryStatusesComponent, +} from '../../components'; +import { RegistrationOverviewToolbarComponent } from '../../components/registration-overview-toolbar/registration-overview-toolbar.component'; +import { RegistryOverviewMetadataComponent } from '../../components/registry-overview-metadata/registry-overview-metadata.component'; import { WithdrawnMessageComponent } from '../../components/withdrawn-message/withdrawn-message.component'; -import { RegistryOverviewSelectors } from '../../store/registry-overview'; +import { RegistrySelectors } from '../../store/registry'; import { RegistryOverviewComponent } from './registry-overview.component'; @@ -35,15 +38,15 @@ describe('RegistryOverviewComponent', () => { OSFTestingModule, ...MockComponents( SubHeaderComponent, - OverviewToolbarComponent, + RegistrationOverviewToolbarComponent, LoadingSpinnerComponent, - ResourceMetadataComponent, + RegistryOverviewMetadataComponent, RegistryRevisionsComponent, RegistryStatusesComponent, DataResourcesComponent, ArchivingMessageComponent, WithdrawnMessageComponent, - RegistrationBlocksDataComponent, + RegistryBlocksSectionComponent, ViewOnlyLinkMessageComponent ), ], @@ -51,21 +54,20 @@ describe('RegistryOverviewComponent', () => { MockProvider(CustomDialogService, mockCustomDialogService), provideMockStore({ signals: [ - { selector: RegistryOverviewSelectors.getRegistry, value: null }, - { selector: RegistryOverviewSelectors.isRegistryLoading, value: false }, - { selector: RegistryOverviewSelectors.isRegistryAnonymous, value: false }, - { selector: RegistryOverviewSelectors.getInstitutions, value: [] }, - { selector: RegistryOverviewSelectors.isInstitutionsLoading, value: false }, - { selector: RegistryOverviewSelectors.getSchemaBlocks, value: [] }, - { selector: RegistryOverviewSelectors.isSchemaBlocksLoading, value: false }, - { selector: RegistryOverviewSelectors.areReviewActionsLoading, value: false }, - { selector: RegistriesSelectors.getSchemaResponse, value: null }, - { selector: RegistriesSelectors.getSchemaResponseLoading, value: false }, - { selector: RegistryOverviewSelectors.hasWriteAccess, value: false }, - { selector: RegistryOverviewSelectors.hasAdminAccess, value: false }, - { selector: RegistryOverviewSelectors.hasNoPermissions, value: true }, - { selector: RegistryOverviewSelectors.getReviewActions, value: [] }, - { selector: RegistryOverviewSelectors.isReviewActionSubmitting, value: false }, + { selector: RegistrySelectors.getRegistry, value: null }, + { selector: RegistrySelectors.isRegistryLoading, value: false }, + { selector: RegistrySelectors.isRegistryAnonymous, value: false }, + { selector: RegistrySelectors.getInstitutions, value: [] }, + { selector: RegistrySelectors.isInstitutionsLoading, value: false }, + { selector: RegistrySelectors.getSchemaBlocks, value: [] }, + { selector: RegistrySelectors.isSchemaBlocksLoading, value: false }, + { selector: RegistrySelectors.areReviewActionsLoading, value: false }, + { selector: RegistrySelectors.getSchemaResponse, value: null }, + { selector: RegistrySelectors.getSchemaResponseLoading, value: false }, + { selector: RegistrySelectors.hasWriteAccess, value: false }, + { selector: RegistrySelectors.hasAdminAccess, value: false }, + { selector: RegistrySelectors.getReviewActions, value: [] }, + { selector: RegistrySelectors.isReviewActionSubmitting, value: false }, ], }), ], @@ -81,16 +83,13 @@ describe('RegistryOverviewComponent', () => { it('should handle loading states', () => { expect(component.isRegistryLoading()).toBe(false); - expect(component.isInstitutionsLoading()).toBe(false); expect(component.isSchemaBlocksLoading()).toBe(false); expect(component.areReviewActionsLoading()).toBe(false); - expect(component.isSchemaResponseLoading()).toBe(false); }); it('should handle registry data', () => { expect(component.registry()).toBeNull(); expect(component.isAnonymous()).toBe(false); - expect(component.institutions()).toEqual([]); expect(component.schemaBlocks()).toEqual([]); expect(component.currentRevision()).toBeNull(); }); @@ -98,7 +97,6 @@ describe('RegistryOverviewComponent', () => { it('should handle permissions', () => { expect(component.hasWriteAccess()).toBe(false); expect(component.hasAdminAccess()).toBe(false); - expect(component.hasNoPermissions()).toBe(true); }); it('should open revision', () => { diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts index 2f38cb0a9..2638f3f5a 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts @@ -20,61 +20,58 @@ import { import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, Router } from '@angular/router'; -import { OverviewToolbarComponent } from '@osf/features/project/overview/components'; -import { CreateSchemaResponse, FetchAllSchemaResponses, RegistriesSelectors } from '@osf/features/registries/store'; import { DataResourcesComponent } from '@osf/shared/components/data-resources/data-resources.component'; import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; -import { RegistrationBlocksDataComponent } from '@osf/shared/components/registration-blocks-data/registration-blocks-data.component'; -import { ResourceMetadataComponent } from '@osf/shared/components/resource-metadata/resource-metadata.component'; import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; import { ViewOnlyLinkMessageComponent } from '@osf/shared/components/view-only-link-message/view-only-link-message.component'; import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; -import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { toCamelCase } from '@osf/shared/helpers/camel-case'; import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; -import { MapRegistryOverview } from '@osf/shared/mappers/resource-overview.mappers'; import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; +import { LoaderService } from '@osf/shared/services/loader.service'; import { ToastService } from '@osf/shared/services/toast.service'; import { GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks'; -import { - ContributorsSelectors, - GetBibliographicContributors, - LoadMoreBibliographicContributors, -} from '@osf/shared/stores/contributors'; -import { FetchSelectedSubjects, SubjectsSelectors } from '@osf/shared/stores/subjects'; +import { ContributorsSelectors, GetBibliographicContributors } from '@osf/shared/stores/contributors'; import { SchemaResponse } from '@shared/models/registration/schema-response.model'; -import { ToolbarResource } from '@shared/models/toolbar-resource.model'; -import { ArchivingMessageComponent, RegistryRevisionsComponent, RegistryStatusesComponent } from '../../components'; +import { + ArchivingMessageComponent, + RegistryBlocksSectionComponent, + RegistryRevisionsComponent, + RegistryStatusesComponent, +} from '../../components'; +import { RegistrationOverviewToolbarComponent } from '../../components/registration-overview-toolbar/registration-overview-toolbar.component'; import { RegistryMakeDecisionComponent } from '../../components/registry-make-decision/registry-make-decision.component'; +import { RegistryOverviewMetadataComponent } from '../../components/registry-overview-metadata/registry-overview-metadata.component'; import { WithdrawnMessageComponent } from '../../components/withdrawn-message/withdrawn-message.component'; import { + CreateSchemaResponse, GetRegistryById, - GetRegistryInstitutions, GetRegistryReviewActions, - RegistryOverviewSelectors, - SetRegistryCustomCitation, -} from '../../store/registry-overview'; + GetRegistrySchemaResponses, + GetSchemaBlocks, + RegistrySelectors, +} from '../../store/registry'; @Component({ selector: 'osf-registry-overview', imports: [ SubHeaderComponent, - OverviewToolbarComponent, LoadingSpinnerComponent, - ResourceMetadataComponent, + RegistryOverviewMetadataComponent, RegistryRevisionsComponent, RegistryStatusesComponent, DataResourcesComponent, ArchivingMessageComponent, TranslatePipe, WithdrawnMessageComponent, - RegistrationBlocksDataComponent, Message, DatePipe, ViewOnlyLinkMessageComponent, + RegistrationOverviewToolbarComponent, + RegistryBlocksSectionComponent, ], templateUrl: './registry-overview.component.html', styleUrl: './registry-overview.component.scss', @@ -87,38 +84,27 @@ export class RegistryOverviewComponent { private readonly destroyRef = inject(DestroyRef); private readonly toastService = inject(ToastService); private readonly customDialogService = inject(CustomDialogService); + private readonly loaderService = inject(LoaderService); + + readonly registry = select(RegistrySelectors.getRegistry); + readonly isRegistryLoading = select(RegistrySelectors.isRegistryLoading); + readonly isAnonymous = select(RegistrySelectors.isRegistryAnonymous); + readonly schemaResponses = select(RegistrySelectors.getSchemaResponses); + readonly isSchemaResponsesLoading = select(RegistrySelectors.isSchemaResponsesLoading); + readonly schemaBlocks = select(RegistrySelectors.getSchemaBlocks); + readonly isSchemaBlocksLoading = select(RegistrySelectors.isSchemaBlocksLoading); + readonly areReviewActionsLoading = select(RegistrySelectors.areReviewActionsLoading); + readonly currentRevision = select(RegistrySelectors.getSchemaResponse); - readonly registry = select(RegistryOverviewSelectors.getRegistry); - readonly isRegistryLoading = select(RegistryOverviewSelectors.isRegistryLoading); - readonly isAnonymous = select(RegistryOverviewSelectors.isRegistryAnonymous); - readonly subjects = select(SubjectsSelectors.getSelectedSubjects); - readonly areSubjectsLoading = select(SubjectsSelectors.areSelectedSubjectsLoading); - readonly institutions = select(RegistryOverviewSelectors.getInstitutions); - readonly isInstitutionsLoading = select(RegistryOverviewSelectors.isInstitutionsLoading); - readonly schemaBlocks = select(RegistryOverviewSelectors.getSchemaBlocks); - readonly isSchemaBlocksLoading = select(RegistryOverviewSelectors.isSchemaBlocksLoading); - readonly areReviewActionsLoading = select(RegistryOverviewSelectors.areReviewActionsLoading); - readonly currentRevision = select(RegistriesSelectors.getSchemaResponse); - readonly isSchemaResponseLoading = select(RegistriesSelectors.getSchemaResponseLoading); bibliographicContributors = select(ContributorsSelectors.getBibliographicContributors); isBibliographicContributorsLoading = select(ContributorsSelectors.isBibliographicContributorsLoading); hasMoreBibliographicContributors = select(ContributorsSelectors.hasMoreBibliographicContributors); - readonly hasWriteAccess = select(RegistryOverviewSelectors.hasWriteAccess); - readonly hasAdminAccess = select(RegistryOverviewSelectors.hasAdminAccess); - readonly hasNoPermissions = select(RegistryOverviewSelectors.hasNoPermissions); + readonly hasWriteAccess = select(RegistrySelectors.hasWriteAccess); + readonly hasAdminAccess = select(RegistrySelectors.hasAdminAccess); revisionInProgress: SchemaResponse | undefined; - isLoading = computed( - () => - this.isRegistryLoading() || - this.isInstitutionsLoading() || - this.isSchemaBlocksLoading() || - this.isSchemaResponseLoading() || - this.areSubjectsLoading() - ); - canMakeDecision = computed(() => !this.registry()?.archiving && !this.registry()?.withdrawn && this.isModeration); isRootRegistration = computed(() => { @@ -129,72 +115,26 @@ export class RegistryOverviewComponent { private registryId = toSignal(this.route.parent?.params.pipe(map((params) => params['id'])) ?? of(undefined)); readonly schemaResponse = computed(() => { - const registry = this.registry(); const index = this.selectedRevisionIndex(); - this.revisionInProgress = registry?.schemaResponses?.find( - (r) => r.reviewsState === RevisionReviewStates.RevisionInProgress - ); + const schemaResponses = this.schemaResponses() || []; - const schemaResponses = registry?.schemaResponses || []; - - if (index !== null) { - return schemaResponses[index]; - } + this.revisionInProgress = schemaResponses?.find((r) => r.reviewsState === RevisionReviewStates.RevisionInProgress); - return null; - }); - - readonly updatedFields = computed(() => { - const schemaResponse = this.schemaResponse(); - if (schemaResponse) { - return schemaResponse.updatedResponseKeys || []; - } - return []; - }); - - readonly resourceOverview = computed(() => { - const registry = this.registry(); - const subjects = this.subjects(); - const institutions = this.institutions(); - - if (registry && subjects && institutions) { - return MapRegistryOverview(registry, subjects, institutions, this.isAnonymous()); - } - - return null; + return index !== null ? schemaResponses[index] : null; }); readonly selectedRevisionIndex = signal(0); showToolbar = computed(() => !this.registry()?.archiving && !this.registry()?.withdrawn); - toolbarResource = computed(() => { - if (this.registry()) { - return { - id: this.registry()!.id, - title: this.registry()?.title, - isPublic: this.registry()!.isPublic, - storage: undefined, - viewOnlyLinksCount: 0, - forksCount: this.registry()!.forksCount, - resourceType: ResourceType.Registration, - isAnonymous: this.isAnonymous(), - } as ToolbarResource; - } - return null; - }); - private readonly actions = createDispatchMap({ getRegistryById: GetRegistryById, getBookmarksId: GetBookmarksCollectionId, - getSubjects: FetchSelectedSubjects, - getInstitutions: GetRegistryInstitutions, - setCustomCitation: SetRegistryCustomCitation, + getSchemaResponses: GetRegistrySchemaResponses, + getSchemaBlocks: GetSchemaBlocks, getRegistryReviewActions: GetRegistryReviewActions, - getSchemaResponse: FetchAllSchemaResponses, createSchemaResponse: CreateSchemaResponse, getBibliographicContributors: GetBibliographicContributors, - loadMoreBibliographicContributors: LoadMoreBibliographicContributors, }); revisionId: string | null = null; @@ -202,15 +142,6 @@ export class RegistryOverviewComponent { hasViewOnly = computed(() => hasViewOnlyParam(this.router)); - canEdit = computed(() => { - const registry = this.registry(); - if (!registry) return false; - return ( - registry.currentUserPermissions.includes(UserPermissions.Admin) || - registry.currentUserPermissions.includes(UserPermissions.Write) - ); - }); - get isInitialState(): boolean { return this.registry()?.reviewsState === RegistrationReviewStates.Initial; } @@ -219,9 +150,9 @@ export class RegistryOverviewComponent { effect(() => { const registry = this.registry(); - if (registry && !registry?.withdrawn) { - this.actions.getSubjects(registry?.id, ResourceType.Registration); - this.actions.getInstitutions(registry?.id); + if (registry?.id && !registry?.withdrawn) { + this.actions.getSchemaBlocks(registry.registrationSchemaLink); + this.actions.getSchemaResponses(registry?.id); } }); @@ -233,9 +164,10 @@ export class RegistryOverviewComponent { }); this.actions.getBookmarksId(); + this.route.queryParams .pipe( - takeUntilDestroyed(this.destroyRef), + takeUntilDestroyed(), map((params) => ({ revisionId: params['revisionId'], mode: params['mode'] })), tap(({ revisionId, mode }) => { this.revisionId = revisionId; @@ -245,19 +177,13 @@ export class RegistryOverviewComponent { .subscribe(); } - navigateToFile(fileId: string): void { - this.router.navigate(['/files', fileId]); - } - openRevision(revisionIndex: number): void { this.selectedRevisionIndex.set(revisionIndex); } - onCustomCitationUpdated(citation: string): void { - this.actions.setCustomCitation(citation); - } - onUpdateRegistration(id: string): void { + this.loaderService.show(); + this.actions .createSchemaResponse(id) .pipe( @@ -270,26 +196,13 @@ export class RegistryOverviewComponent { } onContinueUpdateRegistration(): void { - const { id, unapproved } = { - id: this.registry()?.id || '', - unapproved: this.revisionInProgress?.reviewsState === RevisionReviewStates.Unapproved, - }; - this.actions - .getSchemaResponse(id) - .pipe( - tap(() => { - if (unapproved) { - this.navigateToJustificationReview(); - } else { - this.navigateToJustificationPage(); - } - }) - ) - .subscribe(); - } + const unapproved = this.revisionInProgress?.reviewsState === RevisionReviewStates.Unapproved; - handleLoadMoreContributors(): void { - this.actions.loadMoreBibliographicContributors(this.registry()?.id, ResourceType.Registration); + if (unapproved) { + this.navigateToJustificationReview(); + } else { + this.navigateToJustificationPage(); + } } private navigateToJustificationPage(): void { @@ -325,6 +238,7 @@ export class RegistryOverviewComponent { const action = toCamelCase(data.action); this.toastService.showSuccess(`moderation.makeDecision.${action}Success`); } + const currentUrl = this.router.url.split('?')[0]; this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => { this.router.navigateByUrl(currentUrl); diff --git a/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts b/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts index a1a581ab0..9c574290a 100644 --- a/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts +++ b/src/app/features/registry/pages/registry-resources/registry-resources.component.spec.ts @@ -5,7 +5,6 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { MetadataSelectors } from '@osf/features/metadata/store'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; @@ -14,10 +13,12 @@ import { CustomConfirmationService } from '@osf/shared/services/custom-confirmat import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ToastService } from '@osf/shared/services/toast.service'; +import { RegistrySelectors } from '../../store/registry'; import { RegistryResourcesSelectors } from '../../store/registry-resources'; import { RegistryResourcesComponent } from './registry-resources.component'; +import { MOCK_PROJECT_IDENTIFIERS } from '@testing/mocks/project-overview.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; import { CustomConfirmationServiceMockBuilder } from '@testing/providers/custom-confirmation-provider.mock'; import { CustomDialogServiceMockBuilder } from '@testing/providers/custom-dialog-provider.mock'; @@ -61,7 +62,9 @@ describe('RegistryResourcesComponent', () => { { selector: RegistryResourcesSelectors.getResources, value: [] }, { selector: RegistryResourcesSelectors.isResourcesLoading, value: false }, { selector: RegistryResourcesSelectors.getCurrentResource, value: null }, - { selector: MetadataSelectors.getResourceMetadata, value: mockRegistry }, + { selector: RegistrySelectors.getRegistry, value: mockRegistry }, + { selector: RegistrySelectors.getIdentifiers, value: [MOCK_PROJECT_IDENTIFIERS] }, + { selector: RegistrySelectors.hasWriteAccess, value: true }, ], }), ], 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 06d521f71..e9b92b6da 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 @@ -10,18 +10,16 @@ import { ChangeDetectionStrategy, Component, computed, DestroyRef, HostBinding, import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute } from '@angular/router'; -import { GetResourceMetadata, MetadataSelectors } from '@osf/features/metadata/store'; import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component'; import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component'; -import { ResourceType } from '@osf/shared/enums/resource-type.enum'; -import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; import { CustomDialogService } from '@osf/shared/services/custom-dialog.service'; import { ToastService } from '@osf/shared/services/toast.service'; import { AddResourceDialogComponent, EditResourceDialogComponent } from '../../components'; import { RegistryResource } from '../../models'; +import { RegistrySelectors } from '../../store/registry'; import { AddRegistryResource, DeleteResource, @@ -47,30 +45,24 @@ export class RegistryResourcesComponent { readonly resources = select(RegistryResourcesSelectors.getResources); readonly isResourcesLoading = select(RegistryResourcesSelectors.isResourcesLoading); readonly currentResource = select(RegistryResourcesSelectors.getCurrentResource); - readonly registry = select(MetadataSelectors.getResourceMetadata); + readonly registry = select(RegistrySelectors.getRegistry); + readonly identifiers = select(RegistrySelectors.getIdentifiers); registryId = this.route.snapshot.parent?.params['id']; isAddingResource = signal(false); doiDomain = 'https://doi.org/'; private readonly actions = createDispatchMap({ - fetchRegistryData: GetResourceMetadata, getResources: GetRegistryResources, addResource: AddRegistryResource, deleteResource: DeleteResource, }); - canEdit = computed(() => { - const registry = this.registry(); - if (!registry) return false; + canEdit = select(RegistrySelectors.hasWriteAccess); - return registry.currentUserPermissions.includes(UserPermissions.Write); - }); - - addButtonVisible = computed(() => !!this.registry()?.identifiers?.length && this.canEdit()); + addButtonVisible = computed(() => !!this.identifiers().length && this.canEdit()); constructor() { - this.actions.fetchRegistryData(this.registryId, ResourceType.Registration); this.actions.getResources(this.registryId); } diff --git a/src/app/features/registry/registry.component.spec.ts b/src/app/features/registry/registry.component.spec.ts index 7e8e7d99a..6895b997f 100644 --- a/src/app/features/registry/registry.component.spec.ts +++ b/src/app/features/registry/registry.component.spec.ts @@ -3,7 +3,7 @@ import { of } from 'rxjs'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview'; +import { RegistrySelectors } from '@osf/features/registry/store/registry'; import { AnalyticsService } from '@osf/shared/services/analytics.service'; import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; import { DataciteService } from '@shared/services/datacite/datacite.service'; @@ -56,8 +56,8 @@ describe('RegistryComponent', () => { { provide: AnalyticsService, useValue: analyticsService }, provideMockStore({ signals: [ - { selector: RegistryOverviewSelectors.getRegistry, value: mockRegistry }, - { selector: RegistryOverviewSelectors.isRegistryLoading, value: false }, + { selector: RegistrySelectors.getRegistry, value: mockRegistry }, + { selector: RegistrySelectors.isRegistryLoading, value: false }, ], }), ], @@ -78,7 +78,6 @@ describe('RegistryComponent', () => { it('should have NGXS selectors defined', () => { expect(component.registry).toBeDefined(); expect(component.isRegistryLoading).toBeDefined(); - expect(component.registry$).toBeDefined(); }); it('should have services injected', () => { @@ -90,7 +89,7 @@ describe('RegistryComponent', () => { }); it('should call datacite service on initialization', () => { - expect(dataciteService.logIdentifiableView).toHaveBeenCalledWith(component.registry$); + expect(dataciteService.logIdentifiableView).toHaveBeenCalledWith(component.identifiersForDatacite$); }); it('should handle registry loading effects', () => { diff --git a/src/app/features/registry/registry.component.ts b/src/app/features/registry/registry.component.ts index df0cbcb56..ea5cd3e24 100644 --- a/src/app/features/registry/registry.component.ts +++ b/src/app/features/registry/registry.component.ts @@ -1,21 +1,33 @@ import { createDispatchMap, select } from '@ngxs/store'; -import { map, of } from 'rxjs'; +import { map } from 'rxjs'; import { DatePipe } from '@angular/common'; -import { ChangeDetectionStrategy, Component, DestroyRef, effect, HostBinding, inject, OnDestroy } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + computed, + DestroyRef, + effect, + HostBinding, + inject, + OnDestroy, + signal, +} from '@angular/core'; import { takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-interop'; import { ActivatedRoute, RouterOutlet } from '@angular/router'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { PrerenderReadyService } from '@core/services/prerender-ready.service'; import { ClearCurrentProvider } from '@core/store/provider'; +import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { pathJoin } from '@osf/shared/helpers/path-join.helper'; import { AnalyticsService } from '@osf/shared/services/analytics.service'; import { MetaTagsService } from '@osf/shared/services/meta-tags.service'; +import { ContributorsSelectors, GetBibliographicContributors } from '@osf/shared/stores/contributors'; import { DataciteService } from '@shared/services/datacite/datacite.service'; -import { GetRegistryById, RegistryOverviewSelectors } from './store/registry-overview'; +import { GetRegistryIdentifiers, GetRegistryWithRelatedData, RegistrySelectors } from './store/registry'; @Component({ selector: 'osf-registry', @@ -37,29 +49,58 @@ export class RegistryComponent implements OnDestroy { private readonly prerenderReady = inject(PrerenderReadyService); private readonly actions = createDispatchMap({ - getRegistryById: GetRegistryById, + getRegistryWithRelatedData: GetRegistryWithRelatedData, clearCurrentProvider: ClearCurrentProvider, + getBibliographicContributors: GetBibliographicContributors, + getIdentifiers: GetRegistryIdentifiers, }); - private registryId = toSignal(this.route.params.pipe(map((params) => params['id'])) ?? of(undefined)); + private registryId = toSignal(this.route.params.pipe(map((params) => params['id']))); - readonly registry = select(RegistryOverviewSelectors.getRegistry); - readonly isRegistryLoading = select(RegistryOverviewSelectors.isRegistryLoading); - readonly registry$ = toObservable(select(RegistryOverviewSelectors.getRegistry)); + readonly registry = select(RegistrySelectors.getRegistry); + readonly isRegistryLoading = select(RegistrySelectors.isRegistryLoading); + readonly identifiersForDatacite$ = toObservable(select(RegistrySelectors.getIdentifiers)).pipe( + map((identifiers) => (identifiers?.length ? { identifiers } : null)) + ); readonly analyticsService = inject(AnalyticsService); + readonly bibliographicContributors = select(ContributorsSelectors.getBibliographicContributors); + readonly isBibliographicContributorsLoading = select(ContributorsSelectors.isBibliographicContributorsLoading); + readonly license = select(RegistrySelectors.getLicense); + readonly isLicenseLoading = select(RegistrySelectors.isLicenseLoading); + readonly isIdentifiersLoading = select(RegistrySelectors.isIdentifiersLoading); + + private readonly allDataLoaded = computed( + () => + !this.isRegistryLoading() && + !this.isBibliographicContributorsLoading() && + !this.isLicenseLoading() && + !!this.registry() + ); + + private readonly lastMetaTagsRegistryId = signal(null); constructor() { this.prerenderReady.setNotReady(); effect(() => { - if (this.registryId()) { - this.actions.getRegistryById(this.registryId()); + const id = this.registryId(); + + if (id) { + this.actions.getRegistryWithRelatedData(id); + this.actions.getIdentifiers(id); + this.actions.getBibliographicContributors(id, ResourceType.Registration); } }); effect(() => { - if (!this.isRegistryLoading() && this.registry()) { - this.setMetaTags(); + if (this.allDataLoaded()) { + const currentRegistry = this.registry(); + const currentRegistryId = currentRegistry?.id ?? null; + const lastSetRegistryId = this.lastMetaTagsRegistryId(); + + if (currentRegistryId && currentRegistryId !== lastSetRegistryId) { + this.setMetaTags(); + } } }); @@ -70,7 +111,10 @@ export class RegistryComponent implements OnDestroy { } }); - this.dataciteService.logIdentifiableView(this.registry$).pipe(takeUntilDestroyed(this.destroyRef)).subscribe(); + this.dataciteService + .logIdentifiableView(this.identifiersForDatacite$) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(); } ngOnDestroy(): void { @@ -78,21 +122,24 @@ export class RegistryComponent implements OnDestroy { } private setMetaTags(): void { + const currentRegistry = this.registry(); + if (!currentRegistry) return; + this.metaTags.updateMetaTags( { - osfGuid: this.registry()?.id, - title: this.registry()?.title, - description: this.registry()?.description, - publishedDate: this.datePipe.transform(this.registry()?.dateRegistered, 'yyyy-MM-dd'), - modifiedDate: this.datePipe.transform(this.registry()?.dateModified, 'yyyy-MM-dd'), - url: pathJoin(this.environment.webUrl, this.registry()?.id ?? ''), - identifier: this.registry()?.id, - doi: this.registry()?.doi, - keywords: this.registry()?.tags, + osfGuid: currentRegistry.id, + title: currentRegistry.title, + description: currentRegistry.description, + publishedDate: this.datePipe.transform(currentRegistry.dateRegistered, 'yyyy-MM-dd'), + modifiedDate: this.datePipe.transform(currentRegistry.dateModified, 'yyyy-MM-dd'), + url: pathJoin(this.environment.webUrl, currentRegistry.id ?? ''), + identifier: currentRegistry.id, + doi: currentRegistry.articleDoi, + keywords: currentRegistry.tags, siteName: 'OSF', - license: this.registry()?.license?.name, + license: this.license()?.name, contributors: - this.registry()?.contributors?.map((contributor) => ({ + this.bibliographicContributors()?.map((contributor) => ({ fullName: contributor.fullName, givenName: contributor.givenName, familyName: contributor.familyName, @@ -100,5 +147,7 @@ export class RegistryComponent implements OnDestroy { }, this.destroyRef ); + + this.lastMetaTagsRegistryId.set(currentRegistry.id); } } diff --git a/src/app/features/registry/registry.routes.ts b/src/app/features/registry/registry.routes.ts index b75c158bf..db19cd0af 100644 --- a/src/app/features/registry/registry.routes.ts +++ b/src/app/features/registry/registry.routes.ts @@ -6,19 +6,16 @@ import { viewOnlyGuard } from '@core/guards/view-only.guard'; import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { CitationsState } from '@osf/shared/stores/citations'; import { DuplicatesState } from '@osf/shared/stores/duplicates'; +import { RegistrationProviderState } from '@osf/shared/stores/registration-provider'; import { SubjectsState } from '@osf/shared/stores/subjects'; import { ViewOnlyLinkState } from '@osf/shared/stores/view-only-links'; import { ActivityLogsState } from '@shared/stores/activity-logs'; import { AnalyticsState } from '../analytics/store'; -import { LicensesService } from '../registries/services'; -import { RegistriesState } from '../registries/store'; -import { LicensesHandlers, ProjectsHandlers, ProvidersHandlers } from '../registries/store/handlers'; -import { FilesHandlers } from '../registries/store/handlers/files.handlers'; +import { RegistryState } from './store/registry'; import { RegistryComponentsState } from './store/registry-components'; import { RegistryLinksState } from './store/registry-links'; -import { RegistryOverviewState } from './store/registry-overview'; import { RegistryResourcesState } from './store/registry-resources'; import { RegistryComponent } from './registry.component'; @@ -26,7 +23,7 @@ export const registryRoutes: Routes = [ { path: '', component: RegistryComponent, - providers: [provideStates([RegistryOverviewState, ActivityLogsState])], + providers: [provideStates([RegistryState, RegistrationProviderState])], children: [ { path: '', @@ -37,14 +34,7 @@ export const registryRoutes: Routes = [ path: 'overview', loadComponent: () => import('./pages/registry-overview/registry-overview.component').then((c) => c.RegistryOverviewComponent), - providers: [ - provideStates([RegistriesState, SubjectsState, CitationsState]), - ProvidersHandlers, - ProjectsHandlers, - LicensesHandlers, - FilesHandlers, - LicensesService, - ], + providers: [provideStates([SubjectsState, CitationsState])], }, { path: 'metadata', @@ -116,6 +106,7 @@ export const registryRoutes: Routes = [ import('./pages/registration-recent-activity/registration-recent-activity.component').then( (c) => c.RegistrationRecentActivityComponent ), + providers: [provideStates([ActivityLogsState])], }, ], }, diff --git a/src/app/features/registry/services/registry-overview.service.ts b/src/app/features/registry/services/registry-overview.service.ts index 98f9ce91b..2fabbe51e 100644 --- a/src/app/features/registry/services/registry-overview.service.ts +++ b/src/app/features/registry/services/registry-overview.service.ts @@ -5,21 +5,32 @@ import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { RegistryModerationMapper } from '@osf/features/moderation/mappers'; import { ReviewAction, ReviewActionsResponseJsonApi } from '@osf/features/moderation/models'; +import { IdentifiersMapper } from '@osf/shared/mappers/identifiers.mapper'; import { InstitutionsMapper } from '@osf/shared/mappers/institutions'; -import { PageSchemaMapper } from '@osf/shared/mappers/registration'; +import { LicensesMapper } from '@osf/shared/mappers/licenses.mapper'; +import { PageSchemaMapper, RegistrationMapper } from '@osf/shared/mappers/registration'; import { ReviewActionsMapper } from '@osf/shared/mappers/review-actions.mapper'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; +import { IdentifiersResponseJsonApi } from '@osf/shared/models/identifiers/identifier-json-api.model'; import { InstitutionsJsonApiResponse } from '@osf/shared/models/institutions/institution-json-api.model'; import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { LicenseResponseJsonApi } from '@osf/shared/models/license/licenses-json-api.model'; import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { + SchemaResponseJsonApi, + SchemaResponsesJsonApi, +} from '@osf/shared/models/registration/registration-json-api.model'; import { SchemaBlocksResponseJsonApi } from '@osf/shared/models/registration/schema-blocks-json-api.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; import { ReviewActionPayload } from '@osf/shared/models/review-action/review-action-payload.model'; import { JsonApiService } from '@osf/shared/services/json-api.service'; -import { MapRegistryOverview } from '../mappers'; +import { MapRegistrationOverview } from '../mappers'; import { - GetRegistryOverviewJsonApi, - RegistryOverview, - RegistryOverviewJsonApiData, + RegistrationOverviewDataJsonApi, + RegistrationOverviewModel, + RegistrationOverviewResponse, RegistryOverviewWithMeta, } from '../models'; @@ -35,23 +46,9 @@ export class RegistryOverviewService { } getRegistrationById(id: string): Observable { - const params = { - related_counts: 'forks,linked_nodes,linked_registrations,children,wikis', - 'embed[]': [ - 'bibliographic_contributors', - 'provider', - 'registration_schema', - 'identifiers', - 'root', - 'schema_responses', - 'files', - 'license', - ], - }; - return this.jsonApiService - .get(`${this.apiUrl}/registrations/${id}/`, params) - .pipe(map((response) => ({ registry: MapRegistryOverview(response.data), meta: response.meta }))); + .get(`${this.apiUrl}/registrations/${id}/`) + .pipe(map((response) => ({ registry: MapRegistrationOverview(response.data), meta: response.meta }))); } getInstitutions(registryId: string): Observable { @@ -64,6 +61,18 @@ export class RegistryOverviewService { .pipe(map((response) => InstitutionsMapper.fromInstitutionsResponse(response))); } + getRegistryIdentifiers(registryId: string): Observable { + return this.jsonApiService + .get(`${this.apiUrl}/registrations/${registryId}/identifiers/`) + .pipe(map((response) => IdentifiersMapper.fromJsonApi(response))); + } + + getRegistryLicense(licenseId: string): Observable { + return this.jsonApiService + .get(`${this.apiUrl}/licenses/${licenseId}/`) + .pipe(map((response) => LicensesMapper.fromLicenseDataJsonApi(response.data))); + } + getSchemaBlocks(schemaLink: string): Observable { const params = { 'page[size]': 200, @@ -83,7 +92,41 @@ export class RegistryOverviewService { .pipe(map((response) => PageSchemaMapper.fromSchemaBlocksResponse(response))); } - withdrawRegistration(registryId: string, justification: string): Observable { + getSchemaResponses(registryId: string): Observable { + return this.jsonApiService + .get(`${this.apiUrl}/registrations/${registryId}/schema_responses/`) + .pipe(map((response) => response.data.map((item) => RegistrationMapper.fromSchemaResponse(item)))); + } + + getRegistryReviewActions(id: string): Observable { + const baseUrl = `${this.apiUrl}/registrations/${id}/actions/`; + + return this.jsonApiService + .get(baseUrl) + .pipe(map((response) => response.data.map((x) => RegistryModerationMapper.fromActionResponse(x)))); + } + + createSchemaResponse(registrationId: string): Observable { + const payload = { + data: { + type: 'schema_responses', + relationships: { + registration: { + data: { + type: 'registrations', + id: registrationId, + }, + }, + }, + }, + }; + + return this.jsonApiService + .post(`${this.apiUrl}/schema_responses/`, payload) + .pipe(map((response) => RegistrationMapper.fromSchemaResponse(response.data))); + } + + withdrawRegistration(registryId: string, justification: string): Observable { const payload = { data: { id: registryId, @@ -97,11 +140,11 @@ export class RegistryOverviewService { }; return this.jsonApiService - .patch(`${this.apiUrl}/registrations/${registryId}/`, payload) - .pipe(map((response) => MapRegistryOverview(response))); + .patch(`${this.apiUrl}/registrations/${registryId}/`, payload) + .pipe(map((response) => MapRegistrationOverview(response))); } - makePublic(registryId: string): Observable { + makePublic(registryId: string): Observable { const payload = { data: { id: registryId, @@ -114,16 +157,8 @@ export class RegistryOverviewService { }; return this.jsonApiService - .patch(`${this.apiUrl}/registrations/${registryId}/`, payload) - .pipe(map((response) => MapRegistryOverview(response))); - } - - getRegistryReviewActions(id: string): Observable { - const baseUrl = `${this.apiUrl}/registrations/${id}/actions/`; - - return this.jsonApiService - .get(baseUrl) - .pipe(map((response) => response.data.map((x) => RegistryModerationMapper.fromActionResponse(x)))); + .patch(`${this.apiUrl}/registrations/${registryId}/`, payload) + .pipe(map((response) => MapRegistrationOverview(response))); } submitDecision(payload: ReviewActionPayload, isRevision: boolean): Observable { diff --git a/src/app/features/registry/services/registry-resources.service.ts b/src/app/features/registry/services/registry-resources.service.ts index 8c70dc07e..39366b50b 100644 --- a/src/app/features/registry/services/registry-resources.service.ts +++ b/src/app/features/registry/services/registry-resources.service.ts @@ -39,11 +39,9 @@ export class RegistryResourcesService { addRegistryResource(registryId: string): Observable { const body = toAddResourceRequestBody(registryId); - return this.jsonApiService.post(`${this.apiUrl}/resources/`, body).pipe( - map((response) => { - return MapRegistryResource(response.data); - }) - ); + return this.jsonApiService + .post(`${this.apiUrl}/resources/`, body) + .pipe(map((response) => MapRegistryResource(response.data))); } previewRegistryResource(resourceId: string, resource: AddResource): Observable { @@ -51,11 +49,7 @@ export class RegistryResourcesService { return this.jsonApiService .patch(`${this.apiUrl}/resources/${resourceId}/`, payload) - .pipe( - map((response) => { - return MapRegistryResource(response); - }) - ); + .pipe(map((response) => MapRegistryResource(response))); } confirmAddingResource(resourceId: string, resource: ConfirmAddResource): Observable { @@ -63,11 +57,7 @@ export class RegistryResourcesService { return this.jsonApiService .patch(`${this.apiUrl}/resources/${resourceId}/`, payload) - .pipe( - map((response) => { - return MapRegistryResource(response); - }) - ); + .pipe(map((response) => MapRegistryResource(response))); } deleteResource(resourceId: string): Observable { diff --git a/src/app/features/registry/store/registry-overview/index.ts b/src/app/features/registry/store/registry-overview/index.ts deleted file mode 100644 index 1fb540721..000000000 --- a/src/app/features/registry/store/registry-overview/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './registry-overview.actions'; -export * from './registry-overview.model'; -export * from './registry-overview.selectors'; -export * from './registry-overview.state'; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.actions.ts b/src/app/features/registry/store/registry-overview/registry-overview.actions.ts deleted file mode 100644 index 1083536fe..000000000 --- a/src/app/features/registry/store/registry-overview/registry-overview.actions.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { ReviewActionPayload } from '@osf/shared/models/review-action/review-action-payload.model'; - -export class GetRegistryById { - static readonly type = '[Registry Overview] Get Registry By Id'; - - constructor(public id: string) {} -} - -export class GetRegistryInstitutions { - static readonly type = '[Registry Overview] Get Registry Institutions'; - - constructor(public registryId: string) {} -} - -export class GetSchemaBlocks { - static readonly type = '[Registry Overview] Get Schema Blocks'; - - constructor(public schemaLink: string) {} -} - -export class WithdrawRegistration { - static readonly type = '[Registry Overview] Withdraw Registration'; - - constructor( - public registryId: string, - public justification: string - ) {} -} - -export class MakePublic { - static readonly type = '[Registry Overview] Make Public'; - - constructor(public registryId: string) {} -} - -export class SetRegistryCustomCitation { - static readonly type = '[Registry Overview] Set Registry Custom Citation'; - - constructor(public citation: string) {} -} - -export class GetRegistryReviewActions { - static readonly type = '[Registry Overview] Get Registry Review Actions'; - - constructor(public registryId: string) {} -} - -export class SubmitDecision { - static readonly type = '[Registry Overview] Submit Decision'; - - constructor( - public payload: ReviewActionPayload, - public isRevision: boolean - ) {} -} - -export class ClearRegistryOverview { - static readonly type = '[Registry Overview] Clear Registry Overview'; -} diff --git a/src/app/features/registry/store/registry-overview/registry-overview.model.ts b/src/app/features/registry/store/registry-overview/registry-overview.model.ts deleted file mode 100644 index 754d3ea9b..000000000 --- a/src/app/features/registry/store/registry-overview/registry-overview.model.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ReviewAction } from '@osf/features/moderation/models'; -import { Institution } from '@osf/shared/models/institutions/institutions.models'; -import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; -import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; - -import { RegistryOverview } from '../../models'; - -export interface RegistryOverviewStateModel { - registry: AsyncStateModel; - institutions: AsyncStateModel; - schemaBlocks: AsyncStateModel; - moderationActions: AsyncStateModel; - isAnonymous: boolean; -} - -export const REGISTRY_OVERVIEW_DEFAULTS: RegistryOverviewStateModel = { - registry: { - data: null, - isLoading: false, - error: null, - }, - institutions: { - data: [], - isLoading: false, - error: null, - }, - schemaBlocks: { - data: [], - isLoading: false, - error: null, - }, - moderationActions: { - data: [], - isLoading: false, - isSubmitting: false, - error: null, - }, - isAnonymous: false, -}; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts b/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts deleted file mode 100644 index f2e0f3565..000000000 --- a/src/app/features/registry/store/registry-overview/registry-overview.selectors.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Selector } from '@ngxs/store'; - -import { ReviewAction } from '@osf/features/moderation/models'; -import { RegistryOverview } from '@osf/features/registry/models'; -import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; -import { Institution } from '@shared/models/institutions/institutions.models'; -import { PageSchema } from '@shared/models/registration/page-schema.model'; - -import { RegistryOverviewStateModel } from './registry-overview.model'; -import { RegistryOverviewState } from './registry-overview.state'; - -export class RegistryOverviewSelectors { - @Selector([RegistryOverviewState]) - static getRegistry(state: RegistryOverviewStateModel): RegistryOverview | null { - return state.registry.data; - } - - @Selector([RegistryOverviewState]) - static isRegistryLoading(state: RegistryOverviewStateModel): boolean { - return state.registry.isLoading; - } - - @Selector([RegistryOverviewState]) - static isRegistryAnonymous(state: RegistryOverviewStateModel): boolean { - return state.isAnonymous; - } - - @Selector([RegistryOverviewState]) - static getInstitutions(state: RegistryOverviewStateModel): Institution[] | null { - return state.institutions.data; - } - - @Selector([RegistryOverviewState]) - static isInstitutionsLoading(state: RegistryOverviewStateModel): boolean { - return state.institutions.isLoading; - } - - @Selector([RegistryOverviewState]) - static getSchemaBlocks(state: RegistryOverviewStateModel): PageSchema[] | null { - return state.schemaBlocks.data; - } - - @Selector([RegistryOverviewState]) - static isSchemaBlocksLoading(state: RegistryOverviewStateModel): boolean { - return state.schemaBlocks.isLoading; - } - - @Selector([RegistryOverviewState]) - static getReviewActions(state: RegistryOverviewStateModel): ReviewAction[] { - return state.moderationActions.data; - } - - @Selector([RegistryOverviewState]) - static areReviewActionsLoading(state: RegistryOverviewStateModel): boolean { - return state.moderationActions.isLoading; - } - - @Selector([RegistryOverviewState]) - static isReviewActionSubmitting(state: RegistryOverviewStateModel): boolean { - return state.moderationActions.isSubmitting || false; - } - - @Selector([RegistryOverviewState]) - static hasReadAccess(state: RegistryOverviewStateModel): boolean { - return state.registry.data?.currentUserPermissions.includes(UserPermissions.Read) || false; - } - - @Selector([RegistryOverviewState]) - static hasWriteAccess(state: RegistryOverviewStateModel): boolean { - return state.registry.data?.currentUserPermissions.includes(UserPermissions.Write) || false; - } - - @Selector([RegistryOverviewState]) - static hasAdminAccess(state: RegistryOverviewStateModel): boolean { - return state.registry.data?.currentUserPermissions.includes(UserPermissions.Admin) || false; - } - - @Selector([RegistryOverviewState]) - static hasNoPermissions(state: RegistryOverviewStateModel): boolean { - return !state.registry.data?.currentUserPermissions.length; - } -} diff --git a/src/app/features/registry/store/registry-overview/registry-overview.state.ts b/src/app/features/registry/store/registry-overview/registry-overview.state.ts deleted file mode 100644 index 312a8b817..000000000 --- a/src/app/features/registry/store/registry-overview/registry-overview.state.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { Action, State, StateContext } from '@ngxs/store'; - -import { tap } from 'rxjs'; -import { catchError } from 'rxjs/operators'; - -import { inject, Injectable } from '@angular/core'; - -import { SetCurrentProvider } from '@core/store/provider'; -import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; -import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; - -import { RegistryOverviewService } from '../../services'; - -import { - ClearRegistryOverview, - GetRegistryById, - GetRegistryInstitutions, - GetRegistryReviewActions, - GetSchemaBlocks, - MakePublic, - SetRegistryCustomCitation, - SubmitDecision, - WithdrawRegistration, -} from './registry-overview.actions'; -import { REGISTRY_OVERVIEW_DEFAULTS, RegistryOverviewStateModel } from './registry-overview.model'; - -@Injectable() -@State({ - name: 'registryOverview', - defaults: REGISTRY_OVERVIEW_DEFAULTS, -}) -export class RegistryOverviewState { - private readonly registryOverviewService = inject(RegistryOverviewService); - - @Action(GetRegistryById) - getRegistryById(ctx: StateContext, action: GetRegistryById) { - const state = ctx.getState(); - - if (state.registry.isLoading) { - return; - } - - ctx.patchState({ - registry: { - ...state.registry, - isLoading: true, - }, - }); - - return this.registryOverviewService.getRegistrationById(action.id).pipe( - tap((response) => { - const registryOverview = response.registry; - - if (registryOverview?.provider) { - ctx.dispatch( - new SetCurrentProvider({ - id: registryOverview.provider.id, - name: registryOverview.provider.name, - type: CurrentResourceType.Registrations, - permissions: registryOverview.provider.permissions, - }) - ); - } - - ctx.patchState({ - registry: { - data: registryOverview, - isLoading: false, - error: null, - }, - isAnonymous: response.meta?.anonymous ?? false, - }); - - if (registryOverview?.registrationSchemaLink) { - ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink)); - } - }), - catchError((error) => handleSectionError(ctx, 'registry', error)) - ); - } - - @Action(GetRegistryInstitutions) - getRegistryInstitutions(ctx: StateContext, action: GetRegistryInstitutions) { - const state = ctx.getState(); - ctx.patchState({ - institutions: { - ...state.institutions, - isLoading: true, - }, - }); - - return this.registryOverviewService.getInstitutions(action.registryId).pipe( - tap((institutions) => { - ctx.patchState({ - institutions: { - data: institutions, - isLoading: false, - error: null, - }, - }); - }), - catchError((error) => handleSectionError(ctx, 'institutions', error)) - ); - } - - @Action(GetSchemaBlocks) - getSchemaBlocks(ctx: StateContext, action: GetSchemaBlocks) { - const state = ctx.getState(); - ctx.patchState({ - schemaBlocks: { - ...state.schemaBlocks, - isLoading: true, - }, - }); - - return this.registryOverviewService.getSchemaBlocks(action.schemaLink).pipe( - tap((schemaBlocks) => { - ctx.patchState({ - schemaBlocks: { - data: schemaBlocks, - isLoading: false, - error: null, - }, - }); - }), - catchError((error) => handleSectionError(ctx, 'schemaBlocks', error)) - ); - } - - @Action(WithdrawRegistration) - withdrawRegistration(ctx: StateContext, action: WithdrawRegistration) { - const state = ctx.getState(); - ctx.patchState({ - registry: { - ...state.registry, - isLoading: true, - }, - }); - - return this.registryOverviewService.withdrawRegistration(action.registryId, action.justification).pipe( - tap((registryOverview) => { - ctx.patchState({ - registry: { - data: registryOverview, - isLoading: false, - error: null, - }, - }); - - if (registryOverview?.registrationSchemaLink) { - ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink)); - } - }), - catchError((error) => handleSectionError(ctx, 'registry', error)) - ); - } - - @Action(MakePublic) - makePublic(ctx: StateContext, action: MakePublic) { - const state = ctx.getState(); - ctx.patchState({ - registry: { - ...state.registry, - isLoading: true, - }, - }); - - return this.registryOverviewService.makePublic(action.registryId).pipe( - tap((registryOverview) => { - ctx.patchState({ - registry: { - data: registryOverview, - isLoading: false, - error: null, - }, - }); - - if (registryOverview?.registrationSchemaLink) { - ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink)); - } - }), - catchError((error) => handleSectionError(ctx, 'registry', error)) - ); - } - - @Action(SetRegistryCustomCitation) - setRegistryCustomCitation(ctx: StateContext, action: SetRegistryCustomCitation) { - const state = ctx.getState(); - ctx.patchState({ - registry: { - ...state.registry, - data: { - ...state.registry.data!, - customCitation: action.citation, - }, - }, - }); - } - - @Action(GetRegistryReviewActions) - getRegistryReviewActions(ctx: StateContext, action: GetRegistryReviewActions) { - ctx.patchState({ - moderationActions: { - data: [], - isLoading: true, - isSubmitting: false, - error: null, - }, - }); - - return this.registryOverviewService.getRegistryReviewActions(action.registryId).pipe( - tap((reviewActions) => { - ctx.patchState({ - moderationActions: { - data: reviewActions, - isLoading: false, - error: null, - }, - }); - }), - catchError((error) => handleSectionError(ctx, 'moderationActions', error)) - ); - } - - @Action(SubmitDecision) - submitDecision(ctx: StateContext, action: SubmitDecision) { - ctx.patchState({ - moderationActions: { - data: [], - isLoading: true, - isSubmitting: true, - error: null, - }, - }); - - return this.registryOverviewService.submitDecision(action.payload, action.isRevision).pipe( - tap(() => { - ctx.patchState({ - moderationActions: { - data: [], - isLoading: false, - isSubmitting: false, - error: null, - }, - }); - }), - catchError((error) => handleSectionError(ctx, 'moderationActions', error)) - ); - } - - @Action(ClearRegistryOverview) - clearRegistryOverview(ctx: StateContext) { - ctx.patchState(REGISTRY_OVERVIEW_DEFAULTS); - } -} diff --git a/src/app/features/registry/store/registry/index.ts b/src/app/features/registry/store/registry/index.ts new file mode 100644 index 000000000..cc9be2a13 --- /dev/null +++ b/src/app/features/registry/store/registry/index.ts @@ -0,0 +1,4 @@ +export * from './registry.actions'; +export * from './registry.model'; +export * from './registry.selectors'; +export * from './registry.state'; diff --git a/src/app/features/registry/store/registry/registry.actions.ts b/src/app/features/registry/store/registry/registry.actions.ts new file mode 100644 index 000000000..8a32ffe8c --- /dev/null +++ b/src/app/features/registry/store/registry/registry.actions.ts @@ -0,0 +1,89 @@ +import { ReviewActionPayload } from '@osf/shared/models/review-action/review-action-payload.model'; + +export class GetRegistryById { + static readonly type = '[Registry] Get Registry By Id'; + + constructor(public id: string) {} +} + +export class GetRegistryWithRelatedData { + static readonly type = '[Registry] Get Registry With Related Data'; + + constructor(public id: string) {} +} + +export class GetRegistryInstitutions { + static readonly type = '[Registry] Get Registry Institutions'; + + constructor(public registryId: string) {} +} + +export class GetRegistryIdentifiers { + static readonly type = '[Registry] Get Registry Identifiers'; + + constructor(public registryId: string) {} +} + +export class GetRegistryLicense { + static readonly type = '[Registry] Get Registry License'; + + constructor(public licenseId: string) {} +} + +export class GetSchemaBlocks { + static readonly type = '[Registry] Get Schema Blocks'; + + constructor(public schemaLink: string) {} +} + +export class GetRegistrySchemaResponses { + static readonly type = '[Registry] Get Registry Schema Responses'; + + constructor(public registryId: string) {} +} + +export class CreateSchemaResponse { + static readonly type = '[Registry] Create Schema Response'; + + constructor(public registryId: string) {} +} + +export class GetRegistryReviewActions { + static readonly type = '[Registry] Get Registry Review Actions'; + + constructor(public registryId: string) {} +} + +export class SetRegistryCustomCitation { + static readonly type = '[Registry] Set Registry Custom Citation'; + + constructor(public citation: string) {} +} + +export class WithdrawRegistration { + static readonly type = '[Registry] Withdraw Registration'; + + constructor( + public registryId: string, + public justification: string + ) {} +} + +export class MakePublic { + static readonly type = '[Registry] Make Public'; + + constructor(public registryId: string) {} +} + +export class SubmitDecision { + static readonly type = '[Registry] Submit Decision'; + + constructor( + public payload: ReviewActionPayload, + public isRevision: boolean + ) {} +} + +export class ClearRegistry { + static readonly type = '[Registry] Clear Registry'; +} diff --git a/src/app/features/registry/store/registry/registry.model.ts b/src/app/features/registry/store/registry/registry.model.ts new file mode 100644 index 000000000..027992ed3 --- /dev/null +++ b/src/app/features/registry/store/registry/registry.model.ts @@ -0,0 +1,66 @@ +import { ReviewAction } from '@osf/features/moderation/models'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; +import { Institution } from '@osf/shared/models/institutions/institutions.models'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { PageSchema } from '@osf/shared/models/registration/page-schema.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; + +import { RegistrationOverviewModel } from '../../models'; + +export interface RegistryStateModel { + registry: AsyncStateModel; + institutions: AsyncStateModel; + identifiers: AsyncStateModel; + license: AsyncStateModel; + schemaBlocks: AsyncStateModel; + schemaResponses: AsyncStateModel; + currentSchemaResponse: AsyncStateModel; + moderationActions: AsyncStateModel; + isAnonymous: boolean; +} + +export const REGISTRY_DEFAULTS: RegistryStateModel = { + registry: { + data: null, + isLoading: false, + error: null, + }, + institutions: { + data: [], + isLoading: false, + error: null, + }, + moderationActions: { + data: [], + isLoading: false, + isSubmitting: false, + error: null, + }, + identifiers: { + data: [], + isLoading: false, + error: null, + }, + license: { + data: null, + isLoading: false, + error: null, + }, + schemaBlocks: { + data: [], + isLoading: false, + error: null, + }, + schemaResponses: { + data: [], + isLoading: false, + error: null, + }, + currentSchemaResponse: { + data: null, + isLoading: false, + error: null, + }, + isAnonymous: false, +}; diff --git a/src/app/features/registry/store/registry/registry.selectors.ts b/src/app/features/registry/store/registry/registry.selectors.ts new file mode 100644 index 000000000..3f5e6a729 --- /dev/null +++ b/src/app/features/registry/store/registry/registry.selectors.ts @@ -0,0 +1,115 @@ +import { Selector } from '@ngxs/store'; + +import { ReviewAction } from '@osf/features/moderation/models'; +import { RegistrationOverviewModel } from '@osf/features/registry/models'; +import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; +import { LicenseModel } from '@osf/shared/models/license/license.model'; +import { SchemaResponse } from '@osf/shared/models/registration/schema-response.model'; +import { Institution } from '@shared/models/institutions/institutions.models'; +import { PageSchema } from '@shared/models/registration/page-schema.model'; + +import { RegistryStateModel } from './registry.model'; +import { RegistryState } from './registry.state'; + +export class RegistrySelectors { + @Selector([RegistryState]) + static getRegistry(state: RegistryStateModel): RegistrationOverviewModel | null { + return state.registry.data; + } + + @Selector([RegistryState]) + static isRegistryLoading(state: RegistryStateModel): boolean { + return state.registry.isLoading; + } + + @Selector([RegistryState]) + static isRegistryAnonymous(state: RegistryStateModel): boolean { + return state.isAnonymous; + } + + @Selector([RegistryState]) + static getInstitutions(state: RegistryStateModel): Institution[] | null { + return state.institutions.data; + } + + @Selector([RegistryState]) + static isInstitutionsLoading(state: RegistryStateModel): boolean { + return state.institutions.isLoading; + } + + @Selector([RegistryState]) + static getSchemaBlocks(state: RegistryStateModel): PageSchema[] | null { + return state.schemaBlocks.data; + } + + @Selector([RegistryState]) + static isSchemaBlocksLoading(state: RegistryStateModel): boolean { + return state.schemaBlocks.isLoading; + } + + @Selector([RegistryState]) + static getReviewActions(state: RegistryStateModel): ReviewAction[] { + return state.moderationActions.data; + } + + @Selector([RegistryState]) + static areReviewActionsLoading(state: RegistryStateModel): boolean { + return state.moderationActions.isLoading; + } + + @Selector([RegistryState]) + static isReviewActionSubmitting(state: RegistryStateModel): boolean { + return state.moderationActions.isSubmitting || false; + } + + @Selector([RegistryState]) + static getIdentifiers(state: RegistryStateModel): IdentifierModel[] { + return state.identifiers.data; + } + + @Selector([RegistryState]) + static isIdentifiersLoading(state: RegistryStateModel): boolean { + return state.identifiers.isLoading; + } + + @Selector([RegistryState]) + static getLicense(state: RegistryStateModel): LicenseModel | null { + return state.license.data; + } + + @Selector([RegistryState]) + static isLicenseLoading(state: RegistryStateModel): boolean { + return state.license.isLoading; + } + + @Selector([RegistryState]) + static getSchemaResponses(state: RegistryStateModel): SchemaResponse[] { + return state.schemaResponses.data; + } + + @Selector([RegistryState]) + static isSchemaResponsesLoading(state: RegistryStateModel): boolean { + return state.schemaResponses.isLoading; + } + + @Selector([RegistryState]) + static hasWriteAccess(state: RegistryStateModel): boolean { + return state.registry.data?.currentUserPermissions.includes(UserPermissions.Write) || false; + } + + @Selector([RegistryState]) + static hasAdminAccess(state: RegistryStateModel): boolean { + return state.registry.data?.currentUserPermissions.includes(UserPermissions.Admin) || false; + } + + @Selector([RegistryState]) + static getSchemaResponse(state: RegistryStateModel): SchemaResponse | null { + return state.currentSchemaResponse.data; + } + + @Selector([RegistryState]) + static getSchemaResponseLoading(state: RegistryStateModel): boolean { + return state.currentSchemaResponse.isLoading || !!state.currentSchemaResponse.isSubmitting; + } +} diff --git a/src/app/features/registry/store/registry/registry.state.ts b/src/app/features/registry/store/registry/registry.state.ts new file mode 100644 index 000000000..0540bcff8 --- /dev/null +++ b/src/app/features/registry/store/registry/registry.state.ts @@ -0,0 +1,365 @@ +import { Action, State, StateContext } from '@ngxs/store'; + +import { tap } from 'rxjs'; +import { catchError } from 'rxjs/operators'; + +import { inject, Injectable } from '@angular/core'; + +import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; +import { GetRegistryProvider } from '@osf/shared/stores/registration-provider'; + +import { RegistryOverviewService } from '../../services'; + +import { + ClearRegistry, + CreateSchemaResponse, + GetRegistryById, + GetRegistryIdentifiers, + GetRegistryInstitutions, + GetRegistryLicense, + GetRegistryReviewActions, + GetRegistrySchemaResponses, + GetRegistryWithRelatedData, + GetSchemaBlocks, + MakePublic, + SetRegistryCustomCitation, + SubmitDecision, + WithdrawRegistration, +} from './registry.actions'; +import { REGISTRY_DEFAULTS, RegistryStateModel } from './registry.model'; + +@Injectable() +@State({ + name: 'registry', + defaults: REGISTRY_DEFAULTS, +}) +export class RegistryState { + private readonly registryOverviewService = inject(RegistryOverviewService); + + @Action(GetRegistryById) + getRegistryById(ctx: StateContext, action: GetRegistryById) { + const state = ctx.getState(); + + ctx.patchState({ + registry: { + ...state.registry, + isLoading: true, + }, + }); + + return this.registryOverviewService.getRegistrationById(action.id).pipe( + tap((response) => { + const registryOverview = response.registry; + + ctx.patchState({ + registry: { + data: registryOverview, + isLoading: false, + error: null, + }, + isAnonymous: response.meta?.anonymous ?? false, + }); + }), + catchError((error) => handleSectionError(ctx, 'registry', error)) + ); + } + + @Action(GetRegistryWithRelatedData) + getRegistryWithRelatedData(ctx: StateContext, action: GetRegistryWithRelatedData) { + const state = ctx.getState(); + + ctx.patchState({ + registry: { + ...state.registry, + isLoading: true, + }, + }); + + return this.registryOverviewService.getRegistrationById(action.id).pipe( + tap((response) => { + const registryOverview = response.registry; + + ctx.patchState({ + registry: { + data: registryOverview, + isLoading: false, + error: null, + }, + isAnonymous: response.meta?.anonymous ?? false, + }); + + if (registryOverview.providerId) { + ctx.dispatch(new GetRegistryProvider(registryOverview.providerId)); + } + if (registryOverview.licenseId) { + ctx.dispatch(new GetRegistryLicense(registryOverview.licenseId)); + } + }), + catchError((error) => handleSectionError(ctx, 'registry', error)) + ); + } + + @Action(GetRegistryInstitutions) + getRegistryInstitutions(ctx: StateContext, action: GetRegistryInstitutions) { + const state = ctx.getState(); + ctx.patchState({ + institutions: { + ...state.institutions, + isLoading: true, + }, + }); + + return this.registryOverviewService.getInstitutions(action.registryId).pipe( + tap((institutions) => { + ctx.patchState({ + institutions: { + data: institutions, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'institutions', error)) + ); + } + + @Action(GetRegistryIdentifiers) + getRegistryIdentifiers(ctx: StateContext, action: GetRegistryIdentifiers) { + const state = ctx.getState(); + ctx.patchState({ + identifiers: { + ...state.identifiers, + isLoading: true, + }, + }); + + return this.registryOverviewService.getRegistryIdentifiers(action.registryId).pipe( + tap((identifiers) => { + ctx.patchState({ + identifiers: { + data: identifiers, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'identifiers', error)) + ); + } + + @Action(GetRegistryLicense) + getRegistryLicense(ctx: StateContext, action: GetRegistryLicense) { + const state = ctx.getState(); + ctx.patchState({ + license: { + ...state.license, + isLoading: true, + }, + }); + + return this.registryOverviewService.getRegistryLicense(action.licenseId).pipe( + tap((license) => { + ctx.patchState({ + license: { + data: license, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'license', error)) + ); + } + + @Action(GetSchemaBlocks) + getSchemaBlocks(ctx: StateContext, action: GetSchemaBlocks) { + const state = ctx.getState(); + ctx.patchState({ + schemaBlocks: { + ...state.schemaBlocks, + isLoading: true, + }, + }); + + return this.registryOverviewService.getSchemaBlocks(action.schemaLink).pipe( + tap((schemaBlocks) => { + ctx.patchState({ + schemaBlocks: { + data: schemaBlocks, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'schemaBlocks', error)) + ); + } + + @Action(GetRegistrySchemaResponses) + getSchemaResponses(ctx: StateContext, action: GetRegistrySchemaResponses) { + const state = ctx.getState(); + ctx.patchState({ + schemaResponses: { + ...state.schemaResponses, + isLoading: true, + }, + }); + + return this.registryOverviewService.getSchemaResponses(action.registryId).pipe( + tap((schemaResponses) => { + ctx.patchState({ + schemaResponses: { + data: schemaResponses, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'schemaResponses', error)) + ); + } + + @Action(CreateSchemaResponse) + createSchemaResponse(ctx: StateContext, { registryId }: CreateSchemaResponse) { + const state = ctx.getState(); + + ctx.patchState({ + currentSchemaResponse: { + ...state.currentSchemaResponse, + isLoading: true, + error: null, + }, + }); + + return this.registryOverviewService.createSchemaResponse(registryId).pipe( + tap((schemaResponse) => { + ctx.patchState({ + currentSchemaResponse: { + data: schemaResponse, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'currentSchemaResponse', error)) + ); + } + + @Action(WithdrawRegistration) + withdrawRegistration(ctx: StateContext, action: WithdrawRegistration) { + const state = ctx.getState(); + ctx.patchState({ + registry: { + ...state.registry, + isLoading: true, + }, + }); + + return this.registryOverviewService.withdrawRegistration(action.registryId, action.justification).pipe( + tap((registryOverview) => { + ctx.patchState({ + registry: { + data: registryOverview, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'registry', error)) + ); + } + + @Action(MakePublic) + makePublic(ctx: StateContext, action: MakePublic) { + const state = ctx.getState(); + ctx.patchState({ + registry: { + ...state.registry, + isLoading: true, + }, + }); + + return this.registryOverviewService.makePublic(action.registryId).pipe( + tap((registryOverview) => { + ctx.patchState({ + registry: { + data: registryOverview, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'registry', error)) + ); + } + + @Action(SetRegistryCustomCitation) + setRegistryCustomCitation(ctx: StateContext, action: SetRegistryCustomCitation) { + const state = ctx.getState(); + ctx.patchState({ + registry: { + ...state.registry, + data: { + ...state.registry.data!, + customCitation: action.citation, + }, + }, + }); + } + + @Action(GetRegistryReviewActions) + getRegistryReviewActions(ctx: StateContext, action: GetRegistryReviewActions) { + ctx.patchState({ + moderationActions: { + data: [], + isLoading: true, + isSubmitting: false, + error: null, + }, + }); + + return this.registryOverviewService.getRegistryReviewActions(action.registryId).pipe( + tap((reviewActions) => { + ctx.patchState({ + moderationActions: { + data: reviewActions, + isLoading: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'moderationActions', error)) + ); + } + + @Action(SubmitDecision) + submitDecision(ctx: StateContext, action: SubmitDecision) { + ctx.patchState({ + moderationActions: { + data: [], + isLoading: true, + isSubmitting: true, + error: null, + }, + }); + + return this.registryOverviewService.submitDecision(action.payload, action.isRevision).pipe( + tap(() => { + ctx.patchState({ + moderationActions: { + data: [], + isLoading: false, + isSubmitting: false, + error: null, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'moderationActions', error)) + ); + } + + @Action(ClearRegistry) + clearRegistry(ctx: StateContext) { + ctx.patchState(REGISTRY_DEFAULTS); + } +} diff --git a/src/app/features/settings/tokens/pages/token-details/token-details.component.ts b/src/app/features/settings/tokens/pages/token-details/token-details.component.ts index 59f78cced..85890dd8f 100644 --- a/src/app/features/settings/tokens/pages/token-details/token-details.component.ts +++ b/src/app/features/settings/tokens/pages/token-details/token-details.component.ts @@ -4,6 +4,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Button } from 'primeng/button'; import { Card } from 'primeng/card'; +import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { ChangeDetectionStrategy, Component, computed, inject, OnInit, signal } from '@angular/core'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; @@ -22,6 +23,7 @@ import { DeleteToken, GetTokenById, TokensSelectors } from '../../store'; changeDetection: ChangeDetectionStrategy.OnPush, templateUrl: './token-details.component.html', styleUrls: ['./token-details.component.scss'], + providers: [DynamicDialogRef], }) export class TokenDetailsComponent implements OnInit { private readonly customConfirmationService = inject(CustomConfirmationService); diff --git a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.html b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.html index fda72eac6..fc9f2e2dd 100644 --- a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.html +++ b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.html @@ -1,23 +1,19 @@ -
- @if (showTitle()) { -

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

- } - -
- @if (institutions().length) { - @for (institution of institutions(); track institution.id) { - - institution logo - - } - } @else { -

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

+
+ @if (isLoading()) { + + } @else { + @for (institution of institutions(); track institution.id) { + + Institution logo + + } @empty { +

{{ 'common.labels.noAffiliatedInstitutions' | translate }}

} -
-
+ } +
diff --git a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts index c076d3026..497468a59 100644 --- a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts +++ b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.spec.ts @@ -57,27 +57,27 @@ describe('AffiliatedInstitutionsViewComponent', () => { expect(component.institutions().length).toBe(3); }); - it('should have default true for showTitle', () => { + it('should have default false for isLoading', () => { fixture.componentRef.setInput('institutions', mockInstitutions); fixture.detectChanges(); - expect(component.showTitle()).toBe(true); + expect(component.isLoading()).toBe(false); }); - it('should accept showTitle input as true', () => { + it('should accept isLoading input as true', () => { fixture.componentRef.setInput('institutions', mockInstitutions); - fixture.componentRef.setInput('showTitle', true); + fixture.componentRef.setInput('isLoading', true); fixture.detectChanges(); - expect(component.showTitle()).toBe(true); + expect(component.isLoading()).toBe(true); }); - it('should accept showTitle input as false', () => { + it('should accept isLoading input as false', () => { fixture.componentRef.setInput('institutions', mockInstitutions); - fixture.componentRef.setInput('showTitle', false); + fixture.componentRef.setInput('isLoading', false); fixture.detectChanges(); - expect(component.showTitle()).toBe(false); + expect(component.isLoading()).toBe(false); }); it('should update when institutions input changes', () => { @@ -97,16 +97,16 @@ describe('AffiliatedInstitutionsViewComponent', () => { expect(component.institutions()[0].name).toBe('Updated Institution'); }); - it('should update when showTitle input changes', () => { + it('should update when isLoading input changes', () => { fixture.componentRef.setInput('institutions', mockInstitutions); - fixture.componentRef.setInput('showTitle', true); + fixture.componentRef.setInput('isLoading', false); fixture.detectChanges(); - expect(component.showTitle()).toBe(true); + expect(component.isLoading()).toBe(false); - fixture.componentRef.setInput('showTitle', false); + fixture.componentRef.setInput('isLoading', true); fixture.detectChanges(); - expect(component.showTitle()).toBe(false); + expect(component.isLoading()).toBe(true); }); }); diff --git a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts index 6f7e2bd2e..8edecaf23 100644 --- a/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts +++ b/src/app/shared/components/affiliated-institutions-view/affiliated-institutions-view.component.ts @@ -1,5 +1,6 @@ import { TranslatePipe } from '@ngx-translate/core'; +import { Skeleton } from 'primeng/skeleton'; import { Tooltip } from 'primeng/tooltip'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; @@ -9,12 +10,12 @@ import { Institution } from '@osf/shared/models/institutions/institutions.models @Component({ selector: 'osf-affiliated-institutions-view', - imports: [TranslatePipe, RouterLink, Tooltip], + imports: [TranslatePipe, RouterLink, Tooltip, Skeleton], templateUrl: './affiliated-institutions-view.component.html', styleUrl: './affiliated-institutions-view.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) export class AffiliatedInstitutionsViewComponent { - showTitle = input(true); institutions = input.required(); + isLoading = input(false); } diff --git a/src/app/shared/components/password-input-hint/password-input-hint.component.spec.ts b/src/app/shared/components/password-input-hint/password-input-hint.component.spec.ts index cbb980968..18924152f 100644 --- a/src/app/shared/components/password-input-hint/password-input-hint.component.spec.ts +++ b/src/app/shared/components/password-input-hint/password-input-hint.component.spec.ts @@ -1,4 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FormControl, Validators } from '@angular/forms'; import { PasswordInputHintComponent } from './password-input-hint.component'; @@ -15,16 +16,66 @@ describe('PasswordInputHintComponent', () => { fixture = TestBed.createComponent(PasswordInputHintComponent); component = fixture.componentInstance; - fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); - it('should display password requirements text', () => { - const compiled = fixture.nativeElement as HTMLElement; - const smallElement = compiled.querySelector('small'); - expect(smallElement).toBeTruthy(); + it('should have default control input value as null', () => { + expect(component.control()).toBeNull(); + }); + + it('should set control input correctly', () => { + const mockControl = new FormControl(''); + fixture.componentRef.setInput('control', mockControl); + expect(component.control()).toBe(mockControl); + }); + + it('should return null for validationError when control is null', () => { + fixture.componentRef.setInput('control', null); + expect(component.validationError).toBeNull(); + }); + + it('should return null for validationError when control has no errors', () => { + const mockControl = new FormControl('valid'); + fixture.componentRef.setInput('control', mockControl); + expect(component.validationError).toBeNull(); + }); + + it('should return null for validationError when control is not touched', () => { + const mockControl = new FormControl('', Validators.required); + mockControl.setErrors({ required: true }); + fixture.componentRef.setInput('control', mockControl); + expect(component.validationError).toBeNull(); + }); + + it('should return required for validationError when errors.required exists and control is touched', () => { + const mockControl = new FormControl('', Validators.required); + mockControl.markAsTouched(); + fixture.componentRef.setInput('control', mockControl); + expect(component.validationError).toBe('required'); + }); + + it('should return minlength for validationError when errors.minlength exists and control is touched', () => { + const mockControl = new FormControl('ab', Validators.minLength(5)); + mockControl.markAsTouched(); + fixture.componentRef.setInput('control', mockControl); + expect(component.validationError).toBe('minlength'); + }); + + it('should return pattern for validationError when errors.pattern exists and control is touched', () => { + const mockControl = new FormControl('invalid', Validators.pattern(/[A-Z]/)); + mockControl.markAsTouched(); + fixture.componentRef.setInput('control', mockControl); + expect(component.validationError).toBe('pattern'); + }); + + it('should return null for validationError when control has other errors and is touched', () => { + const mockControl = new FormControl(''); + mockControl.setErrors({ customError: true }); + mockControl.markAsTouched(); + fixture.componentRef.setInput('control', mockControl); + expect(component.validationError).toBeNull(); }); }); diff --git a/src/app/shared/components/resource-citations/resource-citations.component.html b/src/app/shared/components/resource-citations/resource-citations.component.html index 9cdce7d8c..eb4b31678 100644 --- a/src/app/shared/components/resource-citations/resource-citations.component.html +++ b/src/app/shared/components/resource-citations/resource-citations.component.html @@ -1,36 +1,39 @@ -@let resource = currentResource(); +@let customCitation = customCitations(); -@if (resource) { +@if (resourceId()) { } +

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

+ {{ citation.title }} @if (styledCitation()) {

{{ styledCitation()?.citation }}

} + + @if (!hasViewOnly || canEdit()) { } } @@ -87,29 +94,32 @@

{{ citation.title }}

class="w-full" [formControl]="customCitationInput" > +
+ +
diff --git a/src/app/shared/components/resource-citations/resource-citations.component.spec.ts b/src/app/shared/components/resource-citations/resource-citations.component.spec.ts index afb3d80e0..df5fc86f8 100644 --- a/src/app/shared/components/resource-citations/resource-citations.component.spec.ts +++ b/src/app/shared/components/resource-citations/resource-citations.component.spec.ts @@ -3,15 +3,16 @@ import { MockProvider } from 'ng-mocks'; import { Clipboard } from '@angular/cdk/clipboard'; import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { Router } from '@angular/router'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; import { ToastService } from '@osf/shared/services/toast.service'; -import { ResourceOverview } from '@shared/models/resource-overview.model'; import { CitationsSelectors } from '@shared/stores/citations'; import { ResourceCitationsComponent } from './resource-citations.component'; -import { MOCK_RESOURCE_OVERVIEW } from '@testing/mocks/resource.mock'; import { OSFTestingModule } from '@testing/osf.testing.module'; +import { RouterMockBuilder } from '@testing/providers/router-provider.mock'; import { provideMockStore } from '@testing/providers/store-provider.mock'; import { ToastServiceMockBuilder } from '@testing/providers/toast-provider.mock'; @@ -20,14 +21,18 @@ describe('ResourceCitationsComponent', () => { let fixture: ComponentFixture; let mockClipboard: jest.Mocked; let mockToastService: ReturnType; + let mockRouter: ReturnType; - const mockResource: ResourceOverview = MOCK_RESOURCE_OVERVIEW; + const mockResourceId = 'resource-123'; + const mockResourceType = CurrentResourceType.Projects; + const mockCustomCitation = 'Custom citation text'; beforeEach(async () => { mockClipboard = { copy: jest.fn(), } as any; mockToastService = ToastServiceMockBuilder.create().build(); + mockRouter = RouterMockBuilder.create().build(); await TestBed.configureTestingModule({ imports: [ResourceCitationsComponent, OSFTestingModule], @@ -44,6 +49,7 @@ describe('ResourceCitationsComponent', () => { }), MockProvider(Clipboard, mockClipboard), MockProvider(ToastService, mockToastService), + MockProvider(Router, mockRouter), ], }).compileComponents(); @@ -52,24 +58,28 @@ describe('ResourceCitationsComponent', () => { }); it('should create', () => { - fixture.componentRef.setInput('currentResource', mockResource); + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); fixture.detectChanges(); expect(component).toBeTruthy(); }); - it('should have currentResource as required input', () => { - fixture.componentRef.setInput('currentResource', mockResource); + it('should have canEdit input with default value false', () => { + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); fixture.detectChanges(); - expect(component.currentResource()).toEqual(mockResource); + expect(component.canEdit()).toBe(false); }); - it('should have canEdit input with default value false', () => { - fixture.componentRef.setInput('currentResource', mockResource); + it('should have customCitations input', () => { + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); + fixture.componentRef.setInput('customCitations', mockCustomCitation); fixture.detectChanges(); - expect(component.canEdit()).toBe(false); + expect(component.customCitations()).toBe(mockCustomCitation); }); it('should prevent default event and not throw error', () => { @@ -78,74 +88,48 @@ describe('ResourceCitationsComponent', () => { filter: 'apa', } as any; - fixture.componentRef.setInput('currentResource', mockResource); + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); fixture.detectChanges(); expect(() => component.handleCitationStyleFilterSearch(mockEvent)).not.toThrow(); expect(mockEvent.originalEvent.preventDefault).toHaveBeenCalled(); }); - it('should call action when resource exists', () => { - const mockEvent = { - value: { id: 'citation-style-id' }, - } as any; - - fixture.componentRef.setInput('currentResource', mockResource); - fixture.detectChanges(); - - expect(() => component.handleGetStyledCitation(mockEvent)).not.toThrow(); - }); - - it('should not throw when resource is null', () => { + it('should not throw when resourceId is empty', () => { const mockEvent = { value: { id: 'citation-style-id' }, } as any; - fixture.componentRef.setInput('currentResource', null); + fixture.componentRef.setInput('resourceId', ''); + fixture.componentRef.setInput('resourceType', mockResourceType); fixture.detectChanges(); expect(() => component.handleGetStyledCitation(mockEvent)).not.toThrow(); }); - it('should call handleUpdateCustomCitation without errors when citation is valid', () => { - fixture.componentRef.setInput('currentResource', mockResource); - component.customCitationInput.setValue('New custom citation'); - - expect(() => component.handleUpdateCustomCitation()).not.toThrow(); - }); - it('should not emit when citation text is empty', () => { - fixture.componentRef.setInput('currentResource', mockResource); + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); component.customCitationInput.setValue(' '); - const emitSpy = jest.spyOn(component.customCitation, 'emit'); + const emitSpy = jest.spyOn(component.customCitationChange, 'emit'); component.handleUpdateCustomCitation(); expect(emitSpy).not.toHaveBeenCalled(); }); - it('should not throw when resource is null', () => { - fixture.componentRef.setInput('currentResource', null); - component.customCitationInput.setValue('Some citation'); - - expect(() => component.handleUpdateCustomCitation()).not.toThrow(); - }); - - it('should call handleDeleteCustomCitation without errors', () => { - fixture.componentRef.setInput('currentResource', mockResource); - - expect(() => component.handleDeleteCustomCitation()).not.toThrow(); - }); - - it('should not throw handleDeleteCustomCitation when resource is null', () => { - fixture.componentRef.setInput('currentResource', null); + it('should not throw handleDeleteCustomCitation when resourceId is empty', () => { + fixture.componentRef.setInput('resourceId', ''); + fixture.componentRef.setInput('resourceType', mockResourceType); expect(() => component.handleDeleteCustomCitation()).not.toThrow(); }); it('should toggle isEditMode from false to true', () => { - fixture.componentRef.setInput('currentResource', mockResource); + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); fixture.detectChanges(); expect(component.isEditMode()).toBe(false); @@ -156,7 +140,8 @@ describe('ResourceCitationsComponent', () => { }); it('should toggle isEditMode from true to false', () => { - fixture.componentRef.setInput('currentResource', mockResource); + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); fixture.detectChanges(); component.isEditMode.set(true); @@ -166,20 +151,10 @@ describe('ResourceCitationsComponent', () => { expect(component.isEditMode()).toBe(false); }); - it('should call toggleEditMode without errors', () => { - fixture.componentRef.setInput('currentResource', mockResource); - fixture.detectChanges(); - - expect(() => component.toggleEditMode()).not.toThrow(); - }); - - it('should copy citation to clipboard when customCitation exists', () => { - const resourceWithCitation = { - ...mockResource, - customCitation: 'Citation to copy', - }; - - fixture.componentRef.setInput('currentResource', resourceWithCitation); + it('should copy citation to clipboard when customCitations exists', () => { + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); + fixture.componentRef.setInput('customCitations', 'Citation to copy'); fixture.detectChanges(); component.copyCitation(); @@ -188,13 +163,10 @@ describe('ResourceCitationsComponent', () => { expect(mockToastService.showSuccess).toHaveBeenCalledWith('settings.developerApps.messages.copied'); }); - it('should not copy when customCitation is empty', () => { - const resourceWithoutCitation = { - ...mockResource, - customCitation: '', - }; - - fixture.componentRef.setInput('currentResource', resourceWithoutCitation); + it('should not copy when customCitations is empty', () => { + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); + fixture.componentRef.setInput('customCitations', ''); fixture.detectChanges(); component.copyCitation(); @@ -203,11 +175,15 @@ describe('ResourceCitationsComponent', () => { expect(mockToastService.showSuccess).not.toHaveBeenCalled(); }); - it('should not throw when resource is null', () => { - fixture.componentRef.setInput('currentResource', null); + it('should not copy when customCitations is null', () => { + fixture.componentRef.setInput('resourceId', mockResourceId); + fixture.componentRef.setInput('resourceType', mockResourceType); + fixture.componentRef.setInput('customCitations', null); fixture.detectChanges(); - expect(() => component.copyCitation()).not.toThrow(); + component.copyCitation(); + expect(mockClipboard.copy).not.toHaveBeenCalled(); + expect(mockToastService.showSuccess).not.toHaveBeenCalled(); }); }); diff --git a/src/app/shared/components/resource-citations/resource-citations.component.ts b/src/app/shared/components/resource-citations/resource-citations.component.ts index ddadf3715..406c82261 100644 --- a/src/app/shared/components/resource-citations/resource-citations.component.ts +++ b/src/app/shared/components/resource-citations/resource-citations.component.ts @@ -9,7 +9,7 @@ import { Select, SelectChangeEvent, SelectFilterEvent } from 'primeng/select'; import { Skeleton } from 'primeng/skeleton'; import { Textarea } from 'primeng/textarea'; -import { debounceTime, distinctUntilChanged, Subject, takeUntil } from 'rxjs'; +import { debounceTime, distinctUntilChanged, Subject } from 'rxjs'; import { Clipboard } from '@angular/cdk/clipboard'; import { @@ -23,13 +23,14 @@ import { output, signal, } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { Router } from '@angular/router'; +import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; import { hasViewOnlyParam } from '@osf/shared/helpers/view-only.helper'; import { ToastService } from '@osf/shared/services/toast.service'; import { CitationStyle } from '@shared/models/citations/citation-style.model'; -import { ResourceOverview } from '@shared/models/resource-overview.model'; import { CustomOption } from '@shared/models/select-option.model'; import { CitationsSelectors, @@ -63,15 +64,16 @@ export class ResourceCitationsComponent { private readonly destroyRef = inject(DestroyRef); private readonly router = inject(Router); - currentResource = input.required(); + resourceId = input.required(); + resourceType = input.required(); + customCitations = input(); canEdit = input(false); private readonly clipboard = inject(Clipboard); private readonly toastService = inject(ToastService); - private readonly destroy$ = new Subject(); private readonly filterSubject = new Subject(); - customCitation = output(); + customCitationChange = output(); defaultCitations = select(CitationsSelectors.getDefaultCitations); isCitationsLoading = select(CitationsSelectors.getDefaultCitationsLoading); citationStyles = select(CitationsSelectors.getCitationStyles); @@ -102,16 +104,17 @@ export class ResourceCitationsComponent { this.setupFilterDebounce(); this.setupDefaultCitationsEffect(); this.setupCitationStylesEffect(); - this.setupCleanup(); } setupDefaultCitationsEffect(): void { effect(() => { - const resource = this.currentResource(); + const customCitations = this.customCitations(); + const resourceId = this.resourceId(); + const resourceType = this.resourceType(); - if (resource) { - this.actions.getDefaultCitations(resource.type, resource.id); - this.customCitationInput.setValue(resource.customCitation); + if (resourceId && resourceType) { + this.actions.getDefaultCitations(resourceType, resourceId); + this.customCitationInput.setValue(customCitations ?? ''); } }); } @@ -122,27 +125,29 @@ export class ResourceCitationsComponent { } handleGetStyledCitation(event: SelectChangeEvent) { - const resource = this.currentResource(); + const resourceId = this.resourceId(); + const resourceType = this.resourceType(); - if (resource) { - this.actions.getStyledCitation(resource.type, resource.id, event.value.id); + if (resourceId && resourceType) { + this.actions.getStyledCitation(resourceType, resourceId, event.value.id); } } handleUpdateCustomCitation(): void { - const resource = this.currentResource(); + const resourceId = this.resourceId(); + const resourceType = this.resourceType(); const customCitationText = this.customCitationInput.value?.trim(); - if (resource && customCitationText) { + if (resourceId && resourceType && customCitationText) { const payload = { - id: resource.id, - type: resource.type, + id: resourceId, + type: resourceType, citationText: customCitationText, }; this.actions.updateCustomCitation(payload).subscribe({ next: () => { - this.customCitation.emit(customCitationText); + this.customCitationChange.emit(customCitationText); }, complete: () => { this.toggleEditMode(); @@ -152,18 +157,19 @@ export class ResourceCitationsComponent { } handleDeleteCustomCitation(): void { - const resource = this.currentResource(); + const resourceId = this.resourceId(); + const resourceType = this.resourceType(); - if (resource) { + if (resourceId && resourceType) { const payload = { - id: resource.id, - type: resource.type, + id: resourceId, + type: resourceType, citationText: '', }; this.actions.updateCustomCitation(payload).subscribe({ next: () => { - this.customCitation.emit(''); + this.customCitationChange.emit(''); }, complete: () => { this.toggleEditMode(); @@ -180,20 +186,18 @@ export class ResourceCitationsComponent { } copyCitation(): void { - const resource = this.currentResource(); + const customCitations = this.customCitations(); - if (resource?.customCitation) { - this.clipboard.copy(resource.customCitation); + if (customCitations) { + this.clipboard.copy(customCitations); this.toastService.showSuccess('settings.developerApps.messages.copied'); } } private setupFilterDebounce(): void { this.filterSubject - .pipe(debounceTime(300), distinctUntilChanged(), takeUntil(this.destroy$)) - .subscribe((filterValue) => { - this.actions.getCitationStyles(filterValue); - }); + .pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)) + .subscribe((filterValue) => this.actions.getCitationStyles(filterValue)); } private setupCitationStylesEffect(): void { @@ -204,14 +208,8 @@ export class ResourceCitationsComponent { label: style.title, value: style, })); - this.citationStylesOptions.set(options); - }); - } - private setupCleanup(): void { - this.destroyRef.onDestroy(() => { - this.destroy$.next(); - this.destroy$.complete(); + this.citationStylesOptions.set(options); }); } } diff --git a/src/app/shared/components/resource-doi/resource-doi.component.html b/src/app/shared/components/resource-doi/resource-doi.component.html new file mode 100644 index 000000000..7793ad01a --- /dev/null +++ b/src/app/shared/components/resource-doi/resource-doi.component.html @@ -0,0 +1,13 @@ +@if (isLoading()) { + +} @else { + @for (identifier of identifiers(); track identifier.id) { + @if (identifier.category === 'doi') { + + {{ identifier.value }} + + } + } @empty { +

{{ 'common.labels.noDoi' | translate }}

+ } +} diff --git a/src/app/shared/components/resource-doi/resource-doi.component.scss b/src/app/shared/components/resource-doi/resource-doi.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/shared/components/resource-doi/resource-doi.component.spec.ts b/src/app/shared/components/resource-doi/resource-doi.component.spec.ts new file mode 100644 index 000000000..5dbf0fb17 --- /dev/null +++ b/src/app/shared/components/resource-doi/resource-doi.component.spec.ts @@ -0,0 +1,46 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; + +import { ResourceDoiComponent } from './resource-doi.component'; + +import { MOCK_PROJECT_IDENTIFIERS } from '@testing/mocks/project-overview.mock'; + +describe('ResourceDoiComponent', () => { + let component: ResourceDoiComponent; + let fixture: ComponentFixture; + + const mockIdentifiers: IdentifierModel[] = [ + MOCK_PROJECT_IDENTIFIERS, + { + id: 'identifier-2', + type: 'identifiers', + category: 'doi', + value: '10.5678/another.doi', + }, + ]; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ResourceDoiComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(ResourceDoiComponent); + component = fixture.componentInstance; + }); + + it('should have default input values', () => { + expect(component.identifiers()).toEqual([]); + expect(component.isLoading()).toBe(false); + }); + + it('should set identifiers input correctly', () => { + fixture.componentRef.setInput('identifiers', mockIdentifiers); + expect(component.identifiers()).toEqual(mockIdentifiers); + }); + + it('should set isLoading input correctly', () => { + fixture.componentRef.setInput('isLoading', true); + expect(component.isLoading()).toBe(true); + }); +}); diff --git a/src/app/shared/components/resource-doi/resource-doi.component.ts b/src/app/shared/components/resource-doi/resource-doi.component.ts new file mode 100644 index 000000000..df013d293 --- /dev/null +++ b/src/app/shared/components/resource-doi/resource-doi.component.ts @@ -0,0 +1,19 @@ +import { TranslatePipe } from '@ngx-translate/core'; + +import { Skeleton } from 'primeng/skeleton'; + +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; + +import { IdentifierModel } from '@osf/shared/models/identifiers/identifier.model'; + +@Component({ + selector: 'osf-resource-doi', + imports: [Skeleton, TranslatePipe], + templateUrl: './resource-doi.component.html', + styleUrl: './resource-doi.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ResourceDoiComponent { + identifiers = input([]); + isLoading = input(false); +} diff --git a/src/app/shared/components/resource-license/resource-license.component.html b/src/app/shared/components/resource-license/resource-license.component.html new file mode 100644 index 000000000..8a0c6955c --- /dev/null +++ b/src/app/shared/components/resource-license/resource-license.component.html @@ -0,0 +1,5 @@ +@if (isLoading()) { + +} @else { +
{{ license()?.name ?? ('common.labels.noLicense' | translate) }}
+} diff --git a/src/app/shared/components/resource-license/resource-license.component.scss b/src/app/shared/components/resource-license/resource-license.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/shared/components/resource-license/resource-license.component.spec.ts b/src/app/shared/components/resource-license/resource-license.component.spec.ts new file mode 100644 index 000000000..c2765d03e --- /dev/null +++ b/src/app/shared/components/resource-license/resource-license.component.spec.ts @@ -0,0 +1,56 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; + +import { ResourceLicenseComponent } from './resource-license.component'; + +import { MOCK_LICENSE } from '@testing/mocks/license.mock'; +import { OSFTestingModule } from '@testing/osf.testing.module'; + +describe('ResourceLicenseComponent', () => { + let component: ResourceLicenseComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ResourceLicenseComponent, OSFTestingModule], + }).compileComponents(); + + fixture = TestBed.createComponent(ResourceLicenseComponent); + component = fixture.componentInstance; + }); + + it('should have default input values', () => { + expect(component.license()).toBeUndefined(); + expect(component.isLoading()).toBe(false); + }); + + it('should set license input correctly with LicenseModel', () => { + fixture.componentRef.setInput('license', MOCK_LICENSE); + expect(component.license()).toEqual(MOCK_LICENSE); + }); + + it('should set license input correctly with null value', () => { + fixture.componentRef.setInput('license', null); + expect(component.license()).toBeNull(); + }); + + it('should set license input correctly with undefined value', () => { + fixture.componentRef.setInput('license', undefined); + expect(component.license()).toBeUndefined(); + }); + + it('should set isLoading input correctly', () => { + fixture.componentRef.setInput('isLoading', true); + expect(component.isLoading()).toBe(true); + }); + + it('should display license name when license is provided and isLoading is false', () => { + fixture.componentRef.setInput('license', MOCK_LICENSE); + fixture.componentRef.setInput('isLoading', false); + fixture.detectChanges(); + + const divElement = fixture.debugElement.query(By.css('div')); + expect(divElement).toBeTruthy(); + expect(divElement.nativeElement.textContent.trim()).toBe('Apache License, 2.0'); + }); +}); diff --git a/src/app/shared/components/resource-license/resource-license.component.ts b/src/app/shared/components/resource-license/resource-license.component.ts new file mode 100644 index 000000000..cd58b0082 --- /dev/null +++ b/src/app/shared/components/resource-license/resource-license.component.ts @@ -0,0 +1,19 @@ +import { TranslatePipe } from '@ngx-translate/core'; + +import { Skeleton } from 'primeng/skeleton'; + +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; + +import { LicenseModel } from '@osf/shared/models/license/license.model'; + +@Component({ + selector: 'osf-resource-license', + imports: [Skeleton, TranslatePipe], + templateUrl: './resource-license.component.html', + styleUrl: './resource-license.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class ResourceLicenseComponent { + license = input(); + isLoading = input(false); +} diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.html b/src/app/shared/components/resource-metadata/resource-metadata.component.html deleted file mode 100644 index 7e79448a9..000000000 --- a/src/app/shared/components/resource-metadata/resource-metadata.component.html +++ /dev/null @@ -1,178 +0,0 @@ -@let resource = currentResource(); - -@if (resource) { - -} diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.ts b/src/app/shared/components/resource-metadata/resource-metadata.component.ts deleted file mode 100644 index 049dd7f91..000000000 --- a/src/app/shared/components/resource-metadata/resource-metadata.component.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { TranslatePipe } from '@ngx-translate/core'; - -import { Button } from 'primeng/button'; -import { Tag } from 'primeng/tag'; - -import { DatePipe } from '@angular/common'; -import { ChangeDetectionStrategy, Component, computed, inject, input, output } from '@angular/core'; -import { Router, RouterLink } from '@angular/router'; - -import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { OverviewCollectionsComponent } from '@osf/features/project/overview/components/overview-collections/overview-collections.component'; -import { CurrentResourceType } from '@osf/shared/enums/resource-type.enum'; -import { ContributorModel } from '@shared/models/contributors/contributor.model'; -import { ResourceOverview } from '@shared/models/resource-overview.model'; - -import { AffiliatedInstitutionsViewComponent } from '../affiliated-institutions-view/affiliated-institutions-view.component'; -import { ContributorsListComponent } from '../contributors-list/contributors-list.component'; -import { ResourceCitationsComponent } from '../resource-citations/resource-citations.component'; -import { TruncatedTextComponent } from '../truncated-text/truncated-text.component'; - -@Component({ - selector: 'osf-resource-metadata', - imports: [ - Button, - TranslatePipe, - TruncatedTextComponent, - RouterLink, - Tag, - DatePipe, - ResourceCitationsComponent, - OverviewCollectionsComponent, - AffiliatedInstitutionsViewComponent, - ContributorsListComponent, - ], - templateUrl: './resource-metadata.component.html', - styleUrl: './resource-metadata.component.scss', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class ResourceMetadataComponent { - private readonly environment = inject(ENVIRONMENT); - private readonly router = inject(Router); - - currentResource = input.required(); - customCitationUpdated = output(); - isCollectionsRoute = input(false); - canEdit = input.required(); - showEditButton = input(); - bibliographicContributors = input([]); - isBibliographicContributorsLoading = input(false); - hasMoreBibliographicContributors = input(false); - loadMoreContributors = output(); - - readonly resourceTypes = CurrentResourceType; - readonly dateFormat = 'MMM d, y, h:mm a'; - readonly webUrl = this.environment.webUrl; - - isProject = computed(() => this.currentResource()?.type === CurrentResourceType.Projects); - isRegistration = computed(() => this.currentResource()?.type === CurrentResourceType.Registrations); - - onCustomCitationUpdated(citation: string): void { - this.customCitationUpdated.emit(citation); - } - - tagClicked(tag: string) { - this.router.navigate(['/search'], { queryParams: { search: tag } }); - } -} diff --git a/src/app/shared/components/subjects-list/subjects-list.component.html b/src/app/shared/components/subjects-list/subjects-list.component.html new file mode 100644 index 000000000..6afb23da7 --- /dev/null +++ b/src/app/shared/components/subjects-list/subjects-list.component.html @@ -0,0 +1,11 @@ +
+ @if (isLoading()) { + + } @else { + @for (subject of subjects(); track subject.id) { + + } @empty { +

{{ 'common.labels.none' | translate }}

+ } + } +
diff --git a/src/app/shared/components/subjects-list/subjects-list.component.scss b/src/app/shared/components/subjects-list/subjects-list.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/shared/components/subjects-list/subjects-list.component.spec.ts b/src/app/shared/components/subjects-list/subjects-list.component.spec.ts new file mode 100644 index 000000000..9033cb5ea --- /dev/null +++ b/src/app/shared/components/subjects-list/subjects-list.component.spec.ts @@ -0,0 +1,67 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; + +import { SubjectsListComponent } from './subjects-list.component'; + +import { SUBJECTS_MOCK } from '@testing/mocks/subject.mock'; +import { OSFTestingModule } from '@testing/osf.testing.module'; + +describe('SubjectsListComponent', () => { + let component: SubjectsListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [SubjectsListComponent, OSFTestingModule], + }).compileComponents(); + + fixture = TestBed.createComponent(SubjectsListComponent); + component = fixture.componentInstance; + }); + + it('should have default input values', () => { + expect(component.subjects()).toEqual([]); + expect(component.isLoading()).toBe(false); + }); + + it('should set subjects input correctly', () => { + fixture.componentRef.setInput('subjects', SUBJECTS_MOCK); + expect(component.subjects()).toEqual(SUBJECTS_MOCK); + }); + + it('should set isLoading input correctly', () => { + fixture.componentRef.setInput('isLoading', true); + expect(component.isLoading()).toBe(true); + }); + + it('should render subjects when subjects array has items and isLoading is false', () => { + fixture.componentRef.setInput('subjects', SUBJECTS_MOCK); + fixture.componentRef.setInput('isLoading', false); + fixture.detectChanges(); + + const tagElements = fixture.debugElement.queryAll(By.css('p-tag')); + expect(tagElements.length).toBe(2); + }); + + it('should render none message when subjects array is empty and isLoading is false', () => { + fixture.componentRef.setInput('subjects', []); + fixture.componentRef.setInput('isLoading', false); + fixture.detectChanges(); + + const messageElement = fixture.debugElement.query(By.css('p')); + expect(messageElement).toBeTruthy(); + expect(messageElement.nativeElement.textContent).toContain('common.labels.none'); + }); + + it('should show skeleton and not subjects when isLoading is true', () => { + fixture.componentRef.setInput('subjects', SUBJECTS_MOCK); + fixture.componentRef.setInput('isLoading', true); + fixture.detectChanges(); + + const skeleton = fixture.debugElement.query(By.css('p-skeleton')); + const tagElements = fixture.debugElement.queryAll(By.css('p-tag')); + + expect(skeleton).toBeTruthy(); + expect(tagElements.length).toBe(0); + }); +}); diff --git a/src/app/shared/components/subjects-list/subjects-list.component.ts b/src/app/shared/components/subjects-list/subjects-list.component.ts new file mode 100644 index 000000000..0927a649c --- /dev/null +++ b/src/app/shared/components/subjects-list/subjects-list.component.ts @@ -0,0 +1,20 @@ +import { TranslatePipe } from '@ngx-translate/core'; + +import { Skeleton } from 'primeng/skeleton'; +import { Tag } from 'primeng/tag'; + +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; + +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; + +@Component({ + selector: 'osf-subjects-list', + imports: [Tag, Skeleton, TranslatePipe], + templateUrl: './subjects-list.component.html', + styleUrl: './subjects-list.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class SubjectsListComponent { + subjects = input([]); + isLoading = input(false); +} diff --git a/src/app/shared/components/subjects/subjects.component.spec.ts b/src/app/shared/components/subjects/subjects.component.spec.ts index 5bd39eb59..29e8a7866 100644 --- a/src/app/shared/components/subjects/subjects.component.spec.ts +++ b/src/app/shared/components/subjects/subjects.component.spec.ts @@ -1,7 +1,9 @@ import { MockComponent } from 'ng-mocks'; +import { signal } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { SubjectModel } from '@osf/shared/models/subject/subject.model'; import { SubjectsSelectors } from '@osf/shared/stores/subjects'; import { SearchInputComponent } from '../search-input/search-input.component'; @@ -15,16 +17,40 @@ describe('SubjectsComponent', () => { let component: SubjectsComponent; let fixture: ComponentFixture; + const mockParentSubject: SubjectModel = { + id: 'parent-1', + name: 'Parent Subject', + children: [], + parent: null, + }; + + const mockChildSubject: SubjectModel = { + id: 'child-1', + name: 'Child Subject', + children: [], + parent: mockParentSubject, + }; + + const mockSubjectWithChildren: SubjectModel = { + id: 'parent-2', + name: 'Parent with Children', + children: [mockChildSubject], + parent: null, + }; + + const mockSubjects: SubjectModel[] = [mockParentSubject, mockSubjectWithChildren]; + const mockSearchedSubjects: SubjectModel[] = [mockChildSubject]; + beforeEach(async () => { await TestBed.configureTestingModule({ imports: [SubjectsComponent, OSFTestingStoreModule, MockComponent(SearchInputComponent)], providers: [ provideMockStore({ signals: [ - { selector: SubjectsSelectors.getSubjects, value: [] }, - { selector: SubjectsSelectors.getSubjectsLoading, value: false }, - { selector: SubjectsSelectors.getSearchedSubjects, value: [] }, - { selector: SubjectsSelectors.getSearchedSubjectsLoading, value: false }, + { selector: SubjectsSelectors.getSubjects, value: signal(mockSubjects) }, + { selector: SubjectsSelectors.getSubjectsLoading, value: signal(false) }, + { selector: SubjectsSelectors.getSearchedSubjects, value: signal(mockSearchedSubjects) }, + { selector: SubjectsSelectors.getSearchedSubjectsLoading, value: signal(false) }, ], }), ], @@ -32,17 +58,232 @@ describe('SubjectsComponent', () => { fixture = TestBed.createComponent(SubjectsComponent); component = fixture.componentInstance; - fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); - it('should render with label and description', () => { - const headerElement = fixture.nativeElement.querySelector('h2'); - expect(headerElement.textContent).toEqual('shared.subjects.title'); - const descriptionElement = fixture.nativeElement.querySelector('p'); - expect(descriptionElement.textContent).toEqual('shared.subjects.description'); + it('should initialize FormControl with empty string', () => { + expect(component.searchControl.value).toBe(''); + }); + + it('should have default areSubjectsUpdating input value as false', () => { + expect(component.areSubjectsUpdating()).toBe(false); + }); + + it('should have default selected input value as empty array', () => { + expect(component.selected()).toEqual([]); + }); + + it('should have default readonly input value as false', () => { + expect(component.readonly()).toBe(false); + }); + + it('should set areSubjectsUpdating input correctly', () => { + fixture.componentRef.setInput('areSubjectsUpdating', true); + expect(component.areSubjectsUpdating()).toBe(true); + }); + + it('should set selected input correctly', () => { + const selectedSubjects = [mockParentSubject]; + fixture.componentRef.setInput('selected', selectedSubjects); + expect(component.selected()).toEqual(selectedSubjects); + }); + + it('should set readonly input correctly', () => { + fixture.componentRef.setInput('readonly', true); + expect(component.readonly()).toBe(true); + }); + + it('should compute subjectsTree correctly', () => { + fixture.detectChanges(); + const tree = component.subjectsTree(); + expect(tree.length).toBe(2); + expect(tree[0].label).toBe('Parent Subject'); + expect(tree[0].data).toBe(mockParentSubject); + expect(tree[0].key).toBe('parent-1'); + expect(tree[1].children?.length).toBe(1); + }); + + it('should compute selectedTree correctly', () => { + fixture.componentRef.setInput('selected', [mockParentSubject]); + fixture.detectChanges(); + const tree = component.selectedTree(); + expect(tree.length).toBe(1); + expect(tree[0].label).toBe('Parent Subject'); + expect(tree[0].data).toBe(mockParentSubject); + }); + + it('should compute searchedList correctly with parents', () => { + fixture.detectChanges(); + const list = component.searchedList(); + expect(list.length).toBe(1); + expect(list[0].length).toBeGreaterThan(0); + expect(list[0][list[0].length - 1]).toBe(mockChildSubject); + }); + + it('should compute childrenIdsMap correctly', () => { + fixture.detectChanges(); + const map = component.childrenIdsMap(); + expect(map).toBeDefined(); + expect(typeof map).toBe('object'); + }); + + it('should update expanded state and emit loadChildren when loadNode is called with empty children', () => { + const emitSpy = jest.spyOn(component.loadChildren, 'emit'); + const mockTreeNode = { + data: { id: 'parent-1', children: [] }, + } as any; + + component.loadNode(mockTreeNode); + + expect(component.expanded['parent-1']).toBe(true); + expect(emitSpy).toHaveBeenCalledWith('parent-1'); + }); + + it('should not emit loadChildren when loadNode is called with non-empty children', () => { + const emitSpy = jest.spyOn(component.loadChildren, 'emit'); + const mockTreeNode = { + data: { id: 'parent-2', children: [mockChildSubject] }, + } as any; + + component.loadNode(mockTreeNode); + + expect(component.expanded['parent-2']).toBe(true); + expect(emitSpy).not.toHaveBeenCalled(); + }); + + it('should update expanded state when collapseNode is called', () => { + component.expanded['parent-1'] = true; + const mockTreeNode = { + data: { id: 'parent-1' }, + } as any; + + component.collapseNode(mockTreeNode); + + expect(component.expanded['parent-1']).toBe(false); + }); + + it('should emit updateSelection when selectSubject is called and readonly is false', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('readonly', false); + fixture.detectChanges(); + + component.selectSubject(mockParentSubject); + + expect(emitSpy).toHaveBeenCalled(); + }); + + it('should not emit updateSelection when selectSubject is called and readonly is true', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('readonly', true); + fixture.detectChanges(); + + component.selectSubject(mockParentSubject); + + expect(emitSpy).not.toHaveBeenCalled(); + }); + + it('should emit updateSelection when removeSubject is called and readonly is false', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('selected', [mockParentSubject]); + fixture.componentRef.setInput('readonly', false); + fixture.detectChanges(); + + component.removeSubject(mockParentSubject); + + expect(emitSpy).toHaveBeenCalled(); + }); + + it('should not emit updateSelection when removeSubject is called and readonly is true', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('selected', [mockParentSubject]); + fixture.componentRef.setInput('readonly', true); + fixture.detectChanges(); + + component.removeSubject(mockParentSubject); + + expect(emitSpy).not.toHaveBeenCalled(); + }); + + it('should emit updateSelection when selectSearched is called with checked true', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('readonly', false); + fixture.detectChanges(); + + const mockEvent = { + checked: true, + } as any; + + component.selectSearched(mockEvent, [mockParentSubject]); + + expect(emitSpy).toHaveBeenCalled(); + }); + + it('should emit updateSelection when selectSearched is called with checked false', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('selected', [mockParentSubject]); + fixture.componentRef.setInput('readonly', false); + fixture.detectChanges(); + + const mockEvent = { + checked: false, + } as any; + + component.selectSearched(mockEvent, [mockParentSubject]); + + expect(emitSpy).toHaveBeenCalled(); + }); + + it('should not emit updateSelection when selectSearched is called and readonly is true', () => { + const emitSpy = jest.spyOn(component.updateSelection, 'emit'); + fixture.componentRef.setInput('readonly', true); + fixture.detectChanges(); + + const mockEvent = { + checked: true, + } as any; + + component.selectSearched(mockEvent, [mockParentSubject]); + + expect(emitSpy).not.toHaveBeenCalled(); + }); + + it('should return true for isChecked when all subjects are selected', () => { + fixture.componentRef.setInput('selected', [mockParentSubject, mockChildSubject]); + fixture.detectChanges(); + + const result = component.isChecked([mockParentSubject, mockChildSubject]); + + expect(result).toBe(true); + }); + + it('should return false for isChecked when not all subjects are selected', () => { + fixture.componentRef.setInput('selected', [mockParentSubject]); + fixture.detectChanges(); + + const result = component.isChecked([mockParentSubject, mockChildSubject]); + + expect(result).toBe(false); + }); + + it('should return false for isChecked when subjects array is empty', () => { + fixture.detectChanges(); + + const result = component.isChecked([]); + + expect(result).toBe(false); + }); + + it('should emit searchChanged with debounce when searchControl value changes', () => { + jest.useFakeTimers(); + const emitSpy = jest.spyOn(component.searchChanged, 'emit'); + + component.searchControl.setValue('test search'); + jest.advanceTimersByTime(300); + + expect(emitSpy).toHaveBeenCalledWith('test search'); + jest.useRealTimers(); }); }); diff --git a/src/app/shared/components/tags-list/tags-list.component.html b/src/app/shared/components/tags-list/tags-list.component.html new file mode 100644 index 000000000..69ea7d7ec --- /dev/null +++ b/src/app/shared/components/tags-list/tags-list.component.html @@ -0,0 +1,11 @@ +
+ @if (isLoading()) { + + } @else { + @for (tag of tags(); track tag) { + + } @empty { +

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

+ } + } +
diff --git a/src/app/shared/components/tags-list/tags-list.component.scss b/src/app/shared/components/tags-list/tags-list.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/shared/components/tags-list/tags-list.component.spec.ts b/src/app/shared/components/tags-list/tags-list.component.spec.ts new file mode 100644 index 000000000..7ace3f459 --- /dev/null +++ b/src/app/shared/components/tags-list/tags-list.component.spec.ts @@ -0,0 +1,65 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; + +import { TagsListComponent } from './tags-list.component'; + +import { OSFTestingModule } from '@testing/osf.testing.module'; + +describe('TagsListComponent', () => { + let component: TagsListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [TagsListComponent, OSFTestingModule], + }).compileComponents(); + + fixture = TestBed.createComponent(TagsListComponent); + component = fixture.componentInstance; + }); + + it('should have default input values', () => { + expect(component.tags()).toEqual([]); + expect(component.isLoading()).toBe(false); + }); + + it('should set tags input correctly', () => { + const mockTags = ['tag1', 'tag2', 'tag3']; + fixture.componentRef.setInput('tags', mockTags); + expect(component.tags()).toEqual(mockTags); + }); + + it('should set isLoading input correctly', () => { + fixture.componentRef.setInput('isLoading', true); + expect(component.isLoading()).toBe(true); + }); + + it('should render tags when tags array has items and isLoading is false', () => { + const mockTags = ['tag1', 'tag2', 'tag3']; + fixture.componentRef.setInput('tags', mockTags); + fixture.componentRef.setInput('isLoading', false); + fixture.detectChanges(); + + const tagElements = fixture.debugElement.queryAll(By.css('p-tag')); + expect(tagElements.length).toBe(3); + }); + + it('should have tagClick output defined', () => { + expect(component.tagClick).toBeDefined(); + }); + + it('should emit tagClick with correct tag value when tag is clicked', () => { + const mockTags = ['tag1', 'tag2', 'tag3']; + fixture.componentRef.setInput('tags', mockTags); + fixture.componentRef.setInput('isLoading', false); + fixture.detectChanges(); + + const emitSpy = jest.spyOn(component.tagClick, 'emit'); + const tagElements = fixture.debugElement.queryAll(By.css('p-tag')); + + tagElements[0].triggerEventHandler('click', null); + + expect(emitSpy).toHaveBeenCalledTimes(1); + expect(emitSpy).toHaveBeenCalledWith('tag1'); + }); +}); diff --git a/src/app/shared/components/tags-list/tags-list.component.ts b/src/app/shared/components/tags-list/tags-list.component.ts new file mode 100644 index 000000000..b1a3b4a56 --- /dev/null +++ b/src/app/shared/components/tags-list/tags-list.component.ts @@ -0,0 +1,23 @@ +import { TranslatePipe } from '@ngx-translate/core'; + +import { Skeleton } from 'primeng/skeleton'; +import { Tag } from 'primeng/tag'; + +import { ChangeDetectionStrategy, Component, input, output } from '@angular/core'; + +@Component({ + selector: 'osf-tags-list', + imports: [Tag, Skeleton, TranslatePipe], + templateUrl: './tags-list.component.html', + styleUrl: './tags-list.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class TagsListComponent { + tags = input([]); + isLoading = input(false); + tagClick = output(); + + onTagClick(tag: string): void { + this.tagClick.emit(tag); + } +} diff --git a/src/app/features/my-projects/mappers/my-resources.mapper.ts b/src/app/shared/mappers/my-resources.mapper.ts similarity index 71% rename from src/app/features/my-projects/mappers/my-resources.mapper.ts rename to src/app/shared/mappers/my-resources.mapper.ts index 80be683b6..b924d9a5c 100644 --- a/src/app/features/my-projects/mappers/my-resources.mapper.ts +++ b/src/app/shared/mappers/my-resources.mapper.ts @@ -1,8 +1,6 @@ -import { ContributorsMapper } from '@osf/shared/mappers/contributors'; -import { - MyResourcesItem, - MyResourcesItemGetResponseJsonApi, -} from '@osf/shared/models/my-resources/my-resources.models'; +import { MyResourcesItem, MyResourcesItemGetResponseJsonApi } from '../models/my-resources/my-resources.models'; + +import { ContributorsMapper } from './contributors'; export class MyResourcesMapper { static fromResponse(response: MyResourcesItemGetResponseJsonApi): MyResourcesItem { diff --git a/src/app/shared/mappers/registration-provider.mapper.ts b/src/app/shared/mappers/registration-provider.mapper.ts index 6c6505520..36d19175c 100644 --- a/src/app/shared/mappers/registration-provider.mapper.ts +++ b/src/app/shared/mappers/registration-provider.mapper.ts @@ -12,7 +12,7 @@ export class RegistrationProviderMapper { } static fromRegistryProvider(response: RegistryProviderDetailsJsonApi): RegistryProviderDetails { - const brandRaw = response.embeds!.brand.data; + const brandRaw = response.embeds?.brand.data; return { id: response.id, diff --git a/src/app/shared/mappers/registration/map-registry-status.mapper.ts b/src/app/shared/mappers/registration/map-registry-status.mapper.ts index 05515bf4d..308fc334f 100644 --- a/src/app/shared/mappers/registration/map-registry-status.mapper.ts +++ b/src/app/shared/mappers/registration/map-registry-status.mapper.ts @@ -1,11 +1,11 @@ -import { RegistryOverviewJsonApiAttributes } from '@osf/features/registry/models'; import { RegistrationReviewStates } from '@osf/shared/enums/registration-review-states.enum'; import { RegistryStatus } from '@osf/shared/enums/registry-status.enum'; import { RevisionReviewStates } from '@osf/shared/enums/revision-review-states.enum'; +import { RegistrationNodeAttributesJsonApi } from '@osf/shared/models/registration/registration-node-json-api.model'; import { RegistrationAttributesJsonApi } from '@shared/models/registration/registration-json-api.model'; export function MapRegistryStatus( - registry: RegistryOverviewJsonApiAttributes | RegistrationAttributesJsonApi + registry: RegistrationNodeAttributesJsonApi | RegistrationAttributesJsonApi ): RegistryStatus { if (registry.pending_embargo_approval) { return RegistryStatus.PendingEmbargoApproval; diff --git a/src/app/shared/mappers/registration/registration-node.mapper.ts b/src/app/shared/mappers/registration/registration-node.mapper.ts index feae85630..fda7ddd86 100644 --- a/src/app/shared/mappers/registration/registration-node.mapper.ts +++ b/src/app/shared/mappers/registration/registration-node.mapper.ts @@ -65,8 +65,8 @@ export class RegistrationNodeMapper { static getRegistrationResponses(response: RegistrationResponsesJsonApi): RegistrationResponses { return { - summary: response.summary, - uploader: response.uploader.map((uploadItem) => ({ + summary: response?.summary, + uploader: response?.uploader?.map((uploadItem) => ({ fileId: uploadItem.file_id, fileName: uploadItem.file_name, fileUrls: uploadItem.file_urls, diff --git a/src/app/shared/mappers/resource-overview.mappers.ts b/src/app/shared/mappers/resource-overview.mappers.ts index 8a1ef1fac..994327e13 100644 --- a/src/app/shared/mappers/resource-overview.mappers.ts +++ b/src/app/shared/mappers/resource-overview.mappers.ts @@ -1,8 +1,6 @@ import { ProjectOverview } from '@osf/features/project/overview/models'; -import { RegistryOverview } from '@osf/features/registry/models'; import { ContributorModel } from '../models/contributors/contributor.model'; -import { Institution } from '../models/institutions/institutions.models'; import { ResourceOverview } from '../models/resource-overview.model'; import { SubjectModel } from '../models/subject/subject.model'; @@ -48,47 +46,3 @@ export function MapProjectOverview( isAnonymous, }; } - -export function MapRegistryOverview( - registry: RegistryOverview, - subjects: SubjectModel[], - institutions: Institution[], - isAnonymous = false -): ResourceOverview { - return { - id: registry.id, - title: registry.title, - type: registry.type, - description: registry.description, - dateModified: registry.dateModified, - dateCreated: registry.dateCreated, - dateRegistered: registry.dateRegistered, - isPublic: registry.isPublic, - category: registry.category, - isRegistration: true, - isPreprint: false, - isCollection: false, - isFork: registry.isFork, - tags: registry.tags || [], - accessRequestsEnabled: registry.accessRequestsEnabled, - nodeLicense: registry.nodeLicense, - license: registry.license || undefined, - identifiers: registry.identifiers?.filter(Boolean) || undefined, - analyticsKey: registry.analyticsKey, - registrationType: registry.registrationType, - currentUserCanComment: registry.currentUserCanComment, - currentUserPermissions: registry.currentUserPermissions || [], - currentUserIsContributor: registry.currentUserIsContributor, - currentUserIsContributorOrGroupMember: registry.currentUserIsContributorOrGroupMember, - wikiEnabled: registry.wikiEnabled, - contributors: registry.contributors?.filter(Boolean) || [], - region: registry.region || undefined, - forksCount: registry.forksCount, - subjects: subjects, - customCitation: registry.customCitation, - affiliatedInstitutions: institutions, - associatedProjectId: registry.associatedProjectId, - isAnonymous, - iaUrl: registry.iaUrl, - }; -} diff --git a/src/app/shared/models/resource-overview.model.ts b/src/app/shared/models/resource-overview.model.ts index 0b0bf5a16..3eb141058 100644 --- a/src/app/shared/models/resource-overview.model.ts +++ b/src/app/shared/models/resource-overview.model.ts @@ -2,7 +2,7 @@ import { IdTypeModel } from './common/id-type.model'; import { ContributorModel } from './contributors/contributor.model'; import { IdentifierModel } from './identifiers/identifier.model'; import { Institution } from './institutions/institutions.models'; -import { LicensesOption } from './license/license.model'; +import { LicenseModel, LicensesOption } from './license/license.model'; import { SubjectModel } from './subject/subject.model'; export interface ResourceOverview { @@ -22,11 +22,7 @@ export interface ResourceOverview { tags: string[]; accessRequestsEnabled: boolean; nodeLicense?: LicensesOption; - license?: { - name: string; - text: string; - url: string; - }; + license?: LicenseModel; storage?: { id: string; type: string; diff --git a/src/app/shared/services/bookmarks.service.ts b/src/app/shared/services/bookmarks.service.ts index ccf89670c..8fa7885a0 100644 --- a/src/app/shared/services/bookmarks.service.ts +++ b/src/app/shared/services/bookmarks.service.ts @@ -1,11 +1,20 @@ -import { map, Observable } from 'rxjs'; +import { forkJoin, map, Observable } from 'rxjs'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { ResourceType } from '../enums/resource-type.enum'; +import { SortOrder } from '../enums/sort-order.enum'; +import { MyResourcesMapper } from '../mappers/my-resources.mapper'; import { SparseCollectionsResponseJsonApi } from '../models/collections/collections-json-api.models'; +import { + MyResourcesItem, + MyResourcesItemGetResponseJsonApi, + MyResourcesResponseJsonApi, +} from '../models/my-resources/my-resources.models'; +import { MyResourcesSearchFilters } from '../models/my-resources/my-resources-search-filters.models'; +import { PaginatedData } from '../models/paginated-data.model'; import { JsonApiService } from './json-api.service'; @@ -30,6 +39,11 @@ export class BookmarksService { [ResourceType.Registration, 'registrations'], ]); + private sortFieldMap: Record = { + title: 'title', + dateModified: 'date_modified', + }; + getBookmarksCollectionId(): Observable { const params: Record = { 'fields[collections]': 'title,bookmarks', @@ -45,6 +59,35 @@ export class BookmarksService { ); } + getAllBookmarks(collectionId: string, filters?: MyResourcesSearchFilters) { + const params = this.buildCommonParams(filters); + + return forkJoin({ + projects: this.getResourceBookmarks(collectionId, ResourceType.Project, params), + registrations: this.getResourceBookmarks(collectionId, ResourceType.Registration, params), + }).pipe( + map(({ projects, registrations }) => { + const items = [...projects.data, ...registrations.data]; + const data = this.sortBookmarks(items, filters?.sortColumn, filters?.sortOrder); + const totalCount = projects.meta.total + registrations.meta.total; + + return { data, totalCount, pageSize: projects.meta.per_page } as PaginatedData; + }) + ); + } + + getResourceBookmarks(collectionId: string, resourceType: ResourceType, params: Record = {}) { + const url = `${this.apiUrl}/collections/${collectionId}/${this.urlMap.get(resourceType)}/`; + + return this.jsonApiService.get(url, params).pipe( + map((response: MyResourcesResponseJsonApi) => ({ + data: response.data.map((item: MyResourcesItemGetResponseJsonApi) => MyResourcesMapper.fromResponse(item)), + links: response.links, + meta: response.meta, + })) + ); + } + addResourceToBookmarks(bookmarksId: string, resourceId: string, resourceType: ResourceType): Observable { const url = `${this.apiUrl}/collections/${bookmarksId}/relationships/${this.urlMap.get(resourceType)}/`; const payload = { data: [{ type: this.resourceMap.get(resourceType), id: resourceId }] }; @@ -58,4 +101,38 @@ export class BookmarksService { return this.jsonApiService.delete(url, payload); } + + private buildCommonParams(filters?: MyResourcesSearchFilters): Record { + const params: Record = { + 'embed[]': ['bibliographic_contributors'], + pageNumber: 1, + pageSize: 100, + }; + + if (filters?.searchValue && filters.searchFields?.length) { + params[`filter[${filters.searchFields.join(',')}]`] = filters.searchValue; + } + + if (filters?.sortColumn && this.sortFieldMap[filters.sortColumn]) { + const apiField = this.sortFieldMap[filters.sortColumn]; + const sortPrefix = filters.sortOrder === SortOrder.Desc ? '-' : ''; + params['sort'] = `${sortPrefix}${apiField}`; + } else { + params['sort'] = '-date_modified'; + } + + return params; + } + + private sortBookmarks(items: MyResourcesItem[], sortColumn = 'dateModified', direction = SortOrder.Desc) { + return items.sort((a, b) => { + if (sortColumn === 'title') { + return direction * (a.title ?? '').localeCompare(b.title ?? '', undefined, { sensitivity: 'base' }); + } + + const aTime = a.dateModified ? new Date(a.dateModified).getTime() : 0; + const bTime = b.dateModified ? new Date(b.dateModified).getTime() : 0; + return direction * (aTime - bTime); + }); + } } diff --git a/src/app/shared/services/my-resources.service.ts b/src/app/shared/services/my-resources.service.ts index 80f06edff..b36e20f37 100644 --- a/src/app/shared/services/my-resources.service.ts +++ b/src/app/shared/services/my-resources.service.ts @@ -1,14 +1,13 @@ -import { EMPTY, Observable } from 'rxjs'; +import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { inject, Injectable } from '@angular/core'; import { ENVIRONMENT } from '@core/provider/environment.provider'; -import { MyResourcesMapper } from '@osf/features/my-projects/mappers'; import { ResourceSearchMode } from '../enums/resource-search-mode.enum'; -import { ResourceType } from '../enums/resource-type.enum'; import { SortOrder } from '../enums/sort-order.enum'; +import { MyResourcesMapper } from '../mappers/my-resources.mapper'; import { JsonApiResponse } from '../models/common/json-api.model'; import { MyResourcesItem, @@ -29,7 +28,6 @@ export class MyResourcesService { private sortFieldMap: Record = { title: 'title', dateModified: 'date_modified', - dateCreated: 'date_created', }; private readonly jsonApiService = inject(JsonApiService); @@ -94,12 +92,8 @@ export class MyResourcesService { params['filter[root][ne]'] = rootProjectId; } - let url; - if (searchMode === ResourceSearchMode.All) { - url = `${this.apiUrl}/${endpoint}`; - } else { - url = endpoint.startsWith('collections/') ? `${this.apiUrl}/${endpoint}` : `${this.apiUrl}/users/me/${endpoint}`; - } + const url = + searchMode === ResourceSearchMode.All ? `${this.apiUrl}/${endpoint}` : `${this.apiUrl}/users/me/${endpoint}`; if (searchMode === ResourceSearchMode.Component) { params['filter[parent][ne]'] = null; @@ -154,37 +148,6 @@ export class MyResourcesService { return this.getResources('preprints/', filters, pageNumber, pageSize, 'preprints'); } - getMyBookmarks( - collectionId: string, - resourceType: ResourceType, - filters?: MyResourcesSearchFilters, - pageNumber?: number, - pageSize?: number - ): Observable { - switch (resourceType) { - case ResourceType.Project: - return this.getResources(`collections/${collectionId}/linked_nodes/`, filters, pageNumber, pageSize, 'nodes'); - case ResourceType.Registration: - return this.getResources( - `collections/${collectionId}/linked_registrations/`, - filters, - pageNumber, - pageSize, - 'registrations' - ); - case ResourceType.Preprint: - return this.getResources( - `collections/${collectionId}/linked_preprints/`, - filters, - pageNumber, - pageSize, - 'preprints' - ); - default: - return EMPTY; - } - } - createProject( title: string, description: string, diff --git a/src/app/shared/stores/bookmarks/bookmarks.actions.ts b/src/app/shared/stores/bookmarks/bookmarks.actions.ts index 28d14ea5c..12759a916 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.actions.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.actions.ts @@ -1,14 +1,34 @@ import { ResourceType } from '@shared/enums/resource-type.enum'; +import { MyResourcesSearchFilters } from '@shared/models/my-resources/my-resources-search-filters.models'; export class GetBookmarksCollectionId { static readonly type = '[Bookmarks] Get Bookmarks Collection Id'; } +export class GetAllMyBookmarks { + static readonly type = '[Bookmarks] Get Bookmarks'; + + constructor( + public bookmarkCollectionId: string, + public filters?: MyResourcesSearchFilters + ) {} +} + +export class GetResourceBookmark { + static readonly type = '[Bookmarks] Get Resource Bookmark'; + + constructor( + public bookmarkCollectionId: string, + public resourceId: string, + public resourceType: ResourceType + ) {} +} + export class AddResourceToBookmarks { static readonly type = '[Bookmarks] Add Resource To Bookmarks'; constructor( - public bookmarksId: string, + public bookmarkCollectionId: string, public resourceId: string, public resourceType: ResourceType ) {} @@ -18,7 +38,7 @@ export class RemoveResourceFromBookmarks { static readonly type = '[Bookmarks] Remove Resource From Bookmarks'; constructor( - public bookmarksId: string, + public bookmarkCollectionId: string, public resourceId: string, public resourceType: ResourceType ) {} diff --git a/src/app/shared/stores/bookmarks/bookmarks.model.ts b/src/app/shared/stores/bookmarks/bookmarks.model.ts index 8305c82d4..919d2b347 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.model.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.model.ts @@ -1,14 +1,24 @@ -import { AsyncStateModel } from '@shared/models/store/async-state.model'; +import { MyResourcesItem } from '@osf/shared/models/my-resources/my-resources.models'; +import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface BookmarksStateModel { - bookmarksId: AsyncStateModel; + bookmarkCollectionId: AsyncStateModel; + items: AsyncStateWithTotalCount; } export const BOOKMARKS_DEFAULTS: BookmarksStateModel = { - bookmarksId: { + bookmarkCollectionId: { data: '', isLoading: false, isSubmitting: false, error: null, }, + items: { + data: [], + isLoading: false, + isSubmitting: false, + error: null, + totalCount: 0, + }, }; diff --git a/src/app/shared/stores/bookmarks/bookmarks.selectors.ts b/src/app/shared/stores/bookmarks/bookmarks.selectors.ts index bb3781f10..6736207d0 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.selectors.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.selectors.ts @@ -6,16 +6,31 @@ import { BookmarksState } from './bookmarks.state'; export class BookmarksSelectors { @Selector([BookmarksState]) static getBookmarksCollectionId(state: BookmarksStateModel) { - return state.bookmarksId.data; + return state.bookmarkCollectionId.data; } @Selector([BookmarksState]) static getBookmarksCollectionIdLoading(state: BookmarksStateModel) { - return state.bookmarksId.isLoading; + return state.bookmarkCollectionId.isLoading; } @Selector([BookmarksState]) static getBookmarksCollectionIdSubmitting(state: BookmarksStateModel) { - return state.bookmarksId.isSubmitting; + return state.bookmarkCollectionId.isSubmitting; + } + + @Selector([BookmarksState]) + static getBookmarks(state: BookmarksStateModel) { + return state.items.data; + } + + @Selector([BookmarksState]) + static areBookmarksLoading(state: BookmarksStateModel) { + return state.items.isLoading; + } + + @Selector([BookmarksState]) + static getBookmarksTotalCount(state: BookmarksStateModel) { + return state.items.totalCount; } } diff --git a/src/app/shared/stores/bookmarks/bookmarks.state.ts b/src/app/shared/stores/bookmarks/bookmarks.state.ts index e02ccf142..58815a9e3 100644 --- a/src/app/shared/stores/bookmarks/bookmarks.state.ts +++ b/src/app/shared/stores/bookmarks/bookmarks.state.ts @@ -7,7 +7,13 @@ import { inject, Injectable } from '@angular/core'; import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { BookmarksService } from '@osf/shared/services/bookmarks.service'; -import { AddResourceToBookmarks, GetBookmarksCollectionId, RemoveResourceFromBookmarks } from './bookmarks.actions'; +import { + AddResourceToBookmarks, + GetAllMyBookmarks, + GetBookmarksCollectionId, + GetResourceBookmark, + RemoveResourceFromBookmarks, +} from './bookmarks.actions'; import { BOOKMARKS_DEFAULTS, BookmarksStateModel } from './bookmarks.model'; @State({ @@ -16,14 +22,14 @@ import { BOOKMARKS_DEFAULTS, BookmarksStateModel } from './bookmarks.model'; }) @Injectable() export class BookmarksState { - bookmarksService = inject(BookmarksService); + private readonly bookmarksService = inject(BookmarksService); @Action(GetBookmarksCollectionId) getBookmarksCollectionId(ctx: StateContext) { const state = ctx.getState(); ctx.patchState({ - bookmarksId: { - ...state.bookmarksId, + bookmarkCollectionId: { + ...state.bookmarkCollectionId, isLoading: true, }, }); @@ -31,15 +37,67 @@ export class BookmarksState { return this.bookmarksService.getBookmarksCollectionId().pipe( tap((res) => { ctx.patchState({ - bookmarksId: { + bookmarkCollectionId: { data: res, isLoading: false, - isSubmitting: false, error: null, }, }); }), - catchError((error) => handleSectionError(ctx, 'bookmarksId', error)) + catchError((error) => handleSectionError(ctx, 'bookmarkCollectionId', error)) + ); + } + + @Action(GetAllMyBookmarks) + getAllMyBookmarks(ctx: StateContext, action: GetAllMyBookmarks) { + const state = ctx.getState(); + + ctx.patchState({ + items: { + ...state.items, + isLoading: true, + error: null, + }, + }); + + return this.bookmarksService.getAllBookmarks(action.bookmarkCollectionId, action.filters).pipe( + tap((results) => { + ctx.patchState({ + items: { + data: results.data, + isLoading: false, + error: null, + totalCount: results.totalCount, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'items', error)) + ); + } + + @Action(GetResourceBookmark) + getBookmarkResource(ctx: StateContext, action: GetResourceBookmark) { + ctx.patchState({ + items: { + data: [], + isLoading: true, + error: null, + totalCount: 0, + }, + }); + + return this.bookmarksService.getResourceBookmarks(action.bookmarkCollectionId, action.resourceType).pipe( + tap((res) => { + ctx.patchState({ + items: { + data: res.data, + isLoading: false, + error: null, + totalCount: res.meta.total, + }, + }); + }), + catchError((error) => handleSectionError(ctx, 'items', error)) ); } @@ -47,24 +105,24 @@ export class BookmarksState { addResourceToBookmarks(ctx: StateContext, action: AddResourceToBookmarks) { const state = ctx.getState(); ctx.patchState({ - bookmarksId: { - ...state.bookmarksId, + bookmarkCollectionId: { + ...state.bookmarkCollectionId, isSubmitting: true, }, }); return this.bookmarksService - .addResourceToBookmarks(action.bookmarksId, action.resourceId, action.resourceType) + .addResourceToBookmarks(action.bookmarkCollectionId, action.resourceId, action.resourceType) .pipe( tap(() => { ctx.patchState({ - bookmarksId: { - ...state.bookmarksId, + bookmarkCollectionId: { + ...state.bookmarkCollectionId, isSubmitting: false, }, }); }), - catchError((error) => handleSectionError(ctx, 'bookmarksId', error)) + catchError((error) => handleSectionError(ctx, 'bookmarkCollectionId', error)) ); } @@ -72,24 +130,24 @@ export class BookmarksState { removeResourceFromBookmarks(ctx: StateContext, action: RemoveResourceFromBookmarks) { const state = ctx.getState(); ctx.patchState({ - bookmarksId: { - ...state.bookmarksId, + bookmarkCollectionId: { + ...state.bookmarkCollectionId, isSubmitting: true, }, }); return this.bookmarksService - .removeResourceFromBookmarks(action.bookmarksId, action.resourceId, action.resourceType) + .removeResourceFromBookmarks(action.bookmarkCollectionId, action.resourceId, action.resourceType) .pipe( tap(() => { ctx.patchState({ - bookmarksId: { - ...state.bookmarksId, + bookmarkCollectionId: { + ...state.bookmarkCollectionId, isSubmitting: false, }, }); }), - catchError((error) => handleSectionError(ctx, 'bookmarksId', error)) + catchError((error) => handleSectionError(ctx, 'bookmarkCollectionId', error)) ); } } diff --git a/src/app/shared/stores/my-resources/my-resources.actions.ts b/src/app/shared/stores/my-resources/my-resources.actions.ts index 738358897..b56720213 100644 --- a/src/app/shared/stores/my-resources/my-resources.actions.ts +++ b/src/app/shared/stores/my-resources/my-resources.actions.ts @@ -1,5 +1,4 @@ import { ResourceSearchMode } from '@osf/shared/enums/resource-search-mode.enum'; -import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { MyResourcesSearchFilters } from '@osf/shared/models/my-resources/my-resources-search-filters.models'; export class GetMyProjects { @@ -36,18 +35,6 @@ export class GetMyPreprints { ) {} } -export class GetMyBookmarks { - static readonly type = '[My Resources] Get Bookmarks'; - - constructor( - public bookmarksId: string, - public pageNumber: number, - public pageSize: number, - public filters: MyResourcesSearchFilters, - public resourceType: ResourceType - ) {} -} - export class ClearMyResources { static readonly type = '[My Resources] Clear My Resources'; } diff --git a/src/app/shared/stores/my-resources/my-resources.model.ts b/src/app/shared/stores/my-resources/my-resources.model.ts index ad3db88c6..47d41db9f 100644 --- a/src/app/shared/stores/my-resources/my-resources.model.ts +++ b/src/app/shared/stores/my-resources/my-resources.model.ts @@ -1,15 +1,10 @@ import { MyResourcesItem } from '@osf/shared/models/my-resources/my-resources.models'; -import { AsyncStateModel } from '@osf/shared/models/store/async-state.model'; +import { AsyncStateWithTotalCount } from '@osf/shared/models/store/async-state-with-total-count.model'; export interface MyResourcesStateModel { - projects: AsyncStateModel; - registrations: AsyncStateModel; - preprints: AsyncStateModel; - bookmarks: AsyncStateModel; - totalProjects: number; - totalRegistrations: number; - totalPreprints: number; - totalBookmarks: number; + projects: AsyncStateWithTotalCount; + registrations: AsyncStateWithTotalCount; + preprints: AsyncStateWithTotalCount; } export const MY_RESOURCES_STATE_DEFAULTS: MyResourcesStateModel = { @@ -17,24 +12,18 @@ export const MY_RESOURCES_STATE_DEFAULTS: MyResourcesStateModel = { data: [], isLoading: false, error: null, + totalCount: 0, }, registrations: { data: [], isLoading: false, error: null, + totalCount: 0, }, preprints: { data: [], isLoading: false, error: null, + totalCount: 0, }, - bookmarks: { - data: [], - isLoading: false, - error: null, - }, - totalProjects: 0, - totalRegistrations: 0, - totalPreprints: 0, - totalBookmarks: 0, }; diff --git a/src/app/shared/stores/my-resources/my-resources.selectors.ts b/src/app/shared/stores/my-resources/my-resources.selectors.ts index 4a62e3fa5..344e64d3a 100644 --- a/src/app/shared/stores/my-resources/my-resources.selectors.ts +++ b/src/app/shared/stores/my-resources/my-resources.selectors.ts @@ -36,33 +36,18 @@ export class MyResourcesSelectors { return state.preprints.data; } - @Selector([MyResourcesState]) - static getBookmarks(state: MyResourcesStateModel): MyResourcesItem[] { - return state.bookmarks.data; - } - @Selector([MyResourcesState]) static getTotalProjects(state: MyResourcesStateModel): number { - return state.totalProjects; + return state.projects.totalCount; } @Selector([MyResourcesState]) static getTotalRegistrations(state: MyResourcesStateModel): number { - return state.totalRegistrations; + return state.registrations.totalCount; } @Selector([MyResourcesState]) static getTotalPreprints(state: MyResourcesStateModel): number { - return state.totalPreprints; - } - - @Selector([MyResourcesState]) - static getTotalBookmarks(state: MyResourcesStateModel): number { - return state.totalBookmarks; - } - - @Selector([MyResourcesState]) - static getBookmarksLoading(state: MyResourcesStateModel): boolean { - return state.bookmarks.isLoading; + return state.preprints.totalCount; } } diff --git a/src/app/shared/stores/my-resources/my-resources.state.ts b/src/app/shared/stores/my-resources/my-resources.state.ts index 61a8c36dc..8425f9c09 100644 --- a/src/app/shared/stores/my-resources/my-resources.state.ts +++ b/src/app/shared/stores/my-resources/my-resources.state.ts @@ -1,17 +1,15 @@ import { Action, State, StateContext } from '@ngxs/store'; -import { catchError, forkJoin, tap } from 'rxjs'; +import { catchError, tap } from 'rxjs'; import { inject, Injectable } from '@angular/core'; -import { ResourceType } from '@osf/shared/enums/resource-type.enum'; import { handleSectionError } from '@osf/shared/helpers/state-error.handler'; import { MyResourcesService } from '@osf/shared/services/my-resources.service'; import { ClearMyResources, CreateProject, - GetMyBookmarks, GetMyPreprints, GetMyProjects, GetMyRegistrations, @@ -45,8 +43,8 @@ export class MyResourcesState { data: res.data, isLoading: false, error: null, + totalCount: res.meta.total, }, - totalProjects: res.meta.total, }); }), catchError((error) => handleSectionError(ctx, 'projects', error)) @@ -78,8 +76,8 @@ export class MyResourcesState { data: res.data, isLoading: false, error: null, + totalCount: res.meta.total, }, - totalRegistrations: res.meta.total, }); }), catchError((error) => handleSectionError(ctx, 'registrations', error)) @@ -103,76 +101,14 @@ export class MyResourcesState { data: res.data, isLoading: false, error: null, + totalCount: res.meta.total, }, - totalPreprints: res.meta.total, }); }), catchError((error) => handleSectionError(ctx, 'preprints', error)) ); } - @Action(GetMyBookmarks) - getBookmarks(ctx: StateContext, action: GetMyBookmarks) { - const state = ctx.getState(); - ctx.patchState({ - bookmarks: { - ...state.bookmarks, - isLoading: true, - error: null, - }, - }); - - if (action.resourceType !== ResourceType.Null) { - return this.myResourcesService - .getMyBookmarks(action.bookmarksId, action.resourceType, action.filters, action.pageNumber, action.pageSize) - .pipe( - tap((res) => { - ctx.patchState({ - bookmarks: { - data: res.data, - isLoading: false, - error: null, - }, - totalBookmarks: res.meta.total, - }); - }), - catchError((error) => handleSectionError(ctx, 'bookmarks', error)) - ); - } else { - return forkJoin({ - projects: this.myResourcesService.getMyBookmarks( - action.bookmarksId, - ResourceType.Project, - action.filters, - action.pageNumber, - action.pageSize - ), - registrations: this.myResourcesService.getMyBookmarks( - action.bookmarksId, - ResourceType.Registration, - action.filters, - action.pageNumber, - action.pageSize - ), - }).pipe( - tap((results) => { - const allData = [...results.projects.data, ...results.registrations.data]; - const totalCount = results.projects.meta.total + results.registrations.meta.total; - - ctx.patchState({ - bookmarks: { - data: allData, - isLoading: false, - error: null, - }, - totalBookmarks: totalCount, - }); - }), - catchError((error) => handleSectionError(ctx, 'bookmarks', error)) - ); - } - } - @Action(ClearMyResources) clearMyResources(ctx: StateContext) { ctx.patchState(MY_RESOURCES_STATE_DEFAULTS); @@ -198,8 +134,8 @@ export class MyResourcesState { isLoading: false, isSubmitting: false, error: null, + totalCount: state.projects.totalCount + 1, }, - totalProjects: state.totalProjects + 1, }); }), catchError((error) => handleSectionError(ctx, 'projects', error)) diff --git a/src/app/shared/stores/registration-provider/registration-provider.state.ts b/src/app/shared/stores/registration-provider/registration-provider.state.ts index c627a435a..efa235f3d 100644 --- a/src/app/shared/stores/registration-provider/registration-provider.state.ts +++ b/src/app/shared/stores/registration-provider/registration-provider.state.ts @@ -28,6 +28,7 @@ export class RegistrationProviderState { const state = ctx.getState(); const currentProvider = state.currentBrandedProvider.data; + if (currentProvider && currentProvider?.id === action.providerId) { ctx.dispatch( new SetCurrentProvider({ diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 11e832513..70cab840c 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -137,7 +137,12 @@ "updated": "Updated", "dateUpdated": "Date Updated", "dateCreated": "Date Created", - "license": "License" + "license": "License", + "noDoi": "No DOI", + "subjects": "Subjects", + "noLicense": "No License", + "affiliatedInstitutions": "Affiliated Institutions", + "noAffiliatedInstitutions": "No affiliated institutions" }, "deleteConfirmation": { "header": "Delete", @@ -1472,7 +1477,8 @@ "rejectSubmissionSuccess": "Submission has been rejected successfully", "forceWithdrawSuccess": "Submission has been force withdrawn successfully", "removeSuccess": "Submission has been withdrawn successfully", - "justificationPlaceholder": "Provide justification for withdrawal" + "justificationPlaceholder": "Provide justification for withdrawal", + "acceptWithdrawalSuccess": "Submission has been withdrawn successfully" }, "submissionReview": { "submitted": "Submitted", From 238adb432b33af25360419f9d39db9d77074e45e Mon Sep 17 00:00:00 2001 From: mkovalua Date: Wed, 5 Nov 2025 19:44:38 +0200 Subject: [PATCH 30/31] [ENG-9255] Fix wrong < > & encoding (#742) - Ticket: https://openscience.atlassian.net/browse/ENG-9242?focusedCommentId=92381 - Feature flag: n/a ## Purpose Fix wrong < > & encoding --- .../general-information/general-information.component.html | 6 +++--- .../general-information/general-information.component.ts | 2 ++ src/app/shared/helpers/format-bad-encoding.helper.ts | 3 +++ src/app/shared/services/meta-tags.service.ts | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 src/app/shared/helpers/format-bad-encoding.helper.ts 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 06945006e..052197694 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 @@ -38,7 +38,7 @@

{{ 'preprints.preprintStepper.review.sections.authorAssertions.publicData' |

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

} @case (ApplicabilityStatus.Unavailable) { - {{ preprintValue.whyNoData }} + {{ preprintValue.whyNoData | fixSpecialChar }} } @case (ApplicabilityStatus.Applicable) { @for (link of preprintValue.dataLinks; track $index) { @@ -60,7 +60,7 @@

} @case (ApplicabilityStatus.Unavailable) { - {{ preprintValue.whyNoPrereg }} + {{ preprintValue.whyNoPrereg | fixSpecialChar }} } @case (ApplicabilityStatus.Applicable) { @switch (preprintValue.preregLinkInfo) { @@ -105,7 +105,7 @@

{{ 'preprints.details.supplementalMaterials' | translate }}

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

@if (preprintValue.hasCoi) { - {{ preprintValue.coiStatement }} + {{ preprintValue.coiStatement | fixSpecialChar }} } @else {

{{ 'preprints.preprintStepper.review.sections.authorAssertions.noCoi' | 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 cfe1039bd..608628a48 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 @@ -17,6 +17,7 @@ import { ContributorsListComponent } from '@osf/shared/components/contributors-l import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; import { ContributorsSelectors, GetBibliographicContributors, @@ -39,6 +40,7 @@ import { PreprintDoiSectionComponent } from '../preprint-doi-section/preprint-do IconComponent, AffiliatedInstitutionsViewComponent, ContributorsListComponent, + FixSpecialCharPipe, ], templateUrl: './general-information.component.html', styleUrl: './general-information.component.scss', diff --git a/src/app/shared/helpers/format-bad-encoding.helper.ts b/src/app/shared/helpers/format-bad-encoding.helper.ts new file mode 100644 index 000000000..8df1c1d44 --- /dev/null +++ b/src/app/shared/helpers/format-bad-encoding.helper.ts @@ -0,0 +1,3 @@ +export function replaceBadEncodedChars(text: string) { + return text.replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>'); +} diff --git a/src/app/shared/services/meta-tags.service.ts b/src/app/shared/services/meta-tags.service.ts index 28e1c1ec6..8cea2c55d 100644 --- a/src/app/shared/services/meta-tags.service.ts +++ b/src/app/shared/services/meta-tags.service.ts @@ -6,6 +6,7 @@ import { Meta, MetaDefinition, Title } from '@angular/platform-browser'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { PrerenderReadyService } from '@core/services/prerender-ready.service'; +import { replaceBadEncodedChars } from '@osf/shared/helpers/format-bad-encoding.helper'; import { MetadataRecordFormat } from '../enums/metadata-record-format.enum'; import { HeadTagDef } from '../models/meta-tags/head-tag-def.model'; @@ -274,7 +275,8 @@ export class MetaTagsService { const titleTag = headTags.find((tag) => tag.attrs.name === 'citation_title'); if (titleTag?.attrs.content) { - this.title.setTitle(`${String(this.defaultMetaTags.siteName)} | ${String(titleTag.attrs.content)}`); + const title = `${String(this.defaultMetaTags.siteName)} | ${String(titleTag.attrs.content)}`; + this.title.setTitle(replaceBadEncodedChars(title)); } } } From 1b23719d47a8d8092217cad3f97f780ddbad58c5 Mon Sep 17 00:00:00 2001 From: "Brian J. Geiger" Date: Thu, 6 Nov 2025 14:53:17 -0500 Subject: [PATCH 31/31] =?UTF-8?q?Revert=20"fix(ENG-9260):=20P12.3=20-=20Go?= =?UTF-8?q?ogle=20Drive=20files=20not=20loading=20once=20root=20folde?= =?UTF-8?q?=E2=80=A6"=20(#746)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a1ee72c99b5c54b6e33e2dc57f1e12ac16384108. --- .../storage-item-selector.component.html | 9 --------- .../storage-item-selector.component.ts | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html index d2f04b986..0d860844d 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.html @@ -44,15 +44,6 @@

[handleFolderSelection]="handleFolderSelection" [rootFolder]="selectedStorageItem()" > - @if (selectedStorageItem() !== null) { - - } } @else {
diff --git a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts index 597e887e2..b5fb14896 100644 --- a/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts +++ b/src/app/shared/components/addons/storage-item-selector/storage-item-selector.component.ts @@ -10,8 +10,6 @@ import { InputText } from 'primeng/inputtext'; import { RadioButton } from 'primeng/radiobutton'; import { Skeleton } from 'primeng/skeleton'; -import { timer } from 'rxjs'; - import { ChangeDetectionStrategy, Component, @@ -24,7 +22,6 @@ import { OnInit, output, signal, - viewChild, } from '@angular/core'; import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -63,8 +60,6 @@ import { ResourceTypeInfoDialogComponent } from '../resource-type-info-dialog/re changeDetection: ChangeDetectionStrategy.OnPush, }) export class StorageItemSelectorComponent implements OnInit { - addFilesPicker = viewChild('filePicker'); - private destroyRef = inject(DestroyRef); private customDialogService = inject(CustomDialogService); private translateService = inject(TranslateService); @@ -241,11 +236,6 @@ export class StorageItemSelectorComponent implements OnInit { handleFolderSelection = (folder: StorageItem): void => { this.selectedStorageItem.set(folder); this.hasFolderChanged.set(folder?.itemId !== this.initiallySelectedStorageItem()?.itemId); - if (this.isGoogleFilePicker()) { - timer(1000) - .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(() => this.addFilesPicker()?.createPicker()); - } }; private updateBreadcrumbs(