[DURACOM-191] fix circular dependencies

This commit is contained in:
Andrea Barbasso
2024-03-06 15:25:54 +01:00
parent 92c944a8fb
commit 3a5f9cdd63
22 changed files with 65 additions and 62 deletions

View File

@@ -9,7 +9,6 @@ import { hasValue, isNotEmpty } from '../../shared/empty.util';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { BrowseService } from '../../core/browse/browse.service';
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
import { PaginationService } from '../../core/pagination/pagination.service';
import { map } from 'rxjs/operators';
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
@@ -37,6 +36,7 @@ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.comp
import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-by.component';
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
import { StartsWithType } from '../../shared/starts-with/starts-with-type';
@Component({
selector: 'ds-browse-by-date',

View File

@@ -18,7 +18,6 @@ import { Item } from '../../core/shared/item.model';
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
import { getFirstSucceededRemoteData } from '../../core/shared/operators';
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
import { PaginationService } from '../../core/pagination/pagination.service';
import { map } from 'rxjs/operators';
import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
@@ -42,6 +41,7 @@ import { ThemedBrowseByComponent } from 'src/app/shared/browse-by/themed-browse-
import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
import { BrowseByDataType } from '../browse-by-switcher/browse-by-data-type';
import { Context } from '../../core/shared/context.model';
import { StartsWithType } from '../../shared/starts-with/starts-with-type';
export const BBM_PAGINATION_ID = 'bbm';

View File

@@ -9,7 +9,7 @@ import { MarkdownPipe as MarkdownPipe_1 } from '../../../shared/utils/markdown.p
import { RouterLink } from '@angular/router';
import { NgFor, NgTemplateOutlet, NgIf, AsyncPipe } from '@angular/common';
import { MetadataFieldWrapperComponent } from '../../../shared/metadata-field-wrapper/metadata-field-wrapper.component';
import { ImageField } from '../../simple/field-components/specific-field/item-page-field.component';
import { ImageField } from '../../simple/field-components/specific-field/image-field';
import { environment } from '../../../../environments/environment';
/**

View File

@@ -0,0 +1,18 @@
/**
* Interface that encapsulate Image configuration for this component.
*/
export interface ImageField {
/**
* URI that is used to retrieve the image.
*/
URI: string;
/**
* i18n Key that represents the alt text to display
*/
alt: string;
/**
* CSS variable that contains the height of the inline image.
*/
heightVar: string;
}

View File

@@ -12,7 +12,7 @@ import { MetadataValuesComponent } from '../../../../field-components/metadata-v
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { mockItemWithMetadataFieldsAndValue } from '../item-page-field.component.spec';
import { By } from '@angular/platform-browser';
import { ImageField } from '../item-page-field.component';
import { ImageField } from '../image-field';
let component: ItemPageImgFieldComponent;
let fixture: ComponentFixture<ItemPageImgFieldComponent>;

View File

@@ -1,8 +1,9 @@
import { Component, Input } from '@angular/core';
import { ImageField, ItemPageFieldComponent } from '../item-page-field.component';
import { ItemPageFieldComponent } from '../item-page-field.component';
import { Item } from '../../../../../core/shared/item.model';
import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component';
import { AsyncPipe } from '@angular/common';
import { ImageField } from '../image-field';
@Component({
selector: 'ds-item-page-img-field',

View File

@@ -7,24 +7,7 @@ import { BrowseDefinitionDataService } from '../../../../core/browse/browse-defi
import { getRemoteDataPayload } from '../../../../core/shared/operators';
import { MetadataValuesComponent } from '../../../field-components/metadata-values/metadata-values.component';
import { AsyncPipe } from '@angular/common';
/**
* Interface that encapsulate Image configuration for this component.
*/
export interface ImageField {
/**
* URI that is used to retrieve the image.
*/
URI: string;
/**
* i18n Key that represents the alt text to display
*/
alt: string;
/**
* CSS variable that contains the height of the inline image.
*/
heightVar: string;
}
import { ImageField } from './image-field';
/**

View File

@@ -6,10 +6,10 @@ import { Collection } from '../../core/shared/collection.model';
import { take } from 'rxjs/operators';
import { CreateItemParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component';
import { Suggestion } from '../../core/notifications/models/suggestion.model';
import { SuggestionApproveAndImport } from '../suggestion-list-element/suggestion-list-element.component';
import { EntityDropdownComponent } from '../../shared/entity-dropdown/entity-dropdown.component';
import { TranslateModule } from '@ngx-translate/core';
import { NgIf } from '@angular/common';
import { SuggestionApproveAndImport } from '../suggestion-list-element/suggestion-approve-and-import';
/**
* Show and trigger the actions to submit for a suggestion

View File

@@ -0,0 +1,9 @@
import { Suggestion } from '../../core/notifications/models/suggestion.model';
/**
* A simple interface to unite a specific suggestion and the id of the chosen collection
*/
export interface SuggestionApproveAndImport {
suggestion: Suggestion;
collectionId: string;
}

View File

@@ -11,17 +11,9 @@ import {
} from '../../../themes/custom/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
import { SuggestionActionsComponent } from '../suggestion-actions/suggestion-actions.component';
import { SuggestionEvidencesComponent } from './suggestion-evidences/suggestion-evidences.component';
import { SuggestionApproveAndImport } from './suggestion-approve-and-import';
/**
* A simple interface to unite a specific suggestion and the id of the chosen collection
*/
export interface SuggestionApproveAndImport {
suggestion: Suggestion;
collectionId: string;
}
/**
* Show all the suggestions by researcher
*/

View File

@@ -6,7 +6,6 @@ import { SortDirection, SortOptions } from '../../core/cache/models/sort-options
import { fadeIn, fadeInOut } from '../animations/fade';
import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
import { ListableObject } from '../object-collection/shared/listable-object.model';
import { StartsWithType } from '../starts-with/starts-with-decorator';
import { PaginationService } from '../../core/pagination/pagination.service';
import { ViewMode } from '../../core/shared/view-mode.model';
import { RouteService } from '../../core/services/route.service';
@@ -20,6 +19,7 @@ import { ThemedResultsBackButtonComponent } from '../results-back-button/themed-
import { NgClass, NgComponentOutlet, NgIf, AsyncPipe } from '@angular/common';
import { VarDirective } from '../utils/var.directive';
import { StartsWithLoaderComponent } from '../starts-with/starts-with-loader.component';
import { StartsWithType } from '../starts-with/starts-with-type';
@Component({
selector: 'ds-browse-by',

View File

@@ -7,7 +7,7 @@ import { PaginatedList } from '../../core/data/paginated-list.model';
import { ListableObject } from '../object-collection/shared/listable-object.model';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { StartsWithType } from '../starts-with/starts-with-decorator';
import { StartsWithType } from '../starts-with/starts-with-type';
/**
* Themed wrapper for {@link BrowseByComponent}

View File

@@ -1,9 +1,6 @@
import { Component, OnInit, Inject } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { renderStartsWithFor, StartsWithType } from '../starts-with-decorator';
import { Component, OnInit } from '@angular/core';
import { StartsWithAbstractComponent } from '../starts-with-abstract.component';
import { hasValue } from '../../empty.util';
import { PaginationService } from '../../../core/pagination/pagination.service';
import { TranslateModule } from '@ngx-translate/core';
import { NgFor } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

View File

@@ -1,10 +1,10 @@
import { Component, OnDestroy, OnInit, Input } from '@angular/core';
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { hasValue } from '../empty.util';
import { PaginationService } from '../../core/pagination/pagination.service';
import { StartsWithType } from './starts-with-decorator';
import { StartsWithType } from './starts-with-type';
/**
* An abstract component to render StartsWith options

View File

@@ -1,4 +1,5 @@
import { renderStartsWithFor, StartsWithType } from './starts-with-decorator';
import { renderStartsWithFor } from './starts-with-decorator';
import { StartsWithType } from './starts-with-type';
describe('BrowseByStartsWithDecorator', () => {
const textDecorator = renderStartsWithFor(StartsWithType.text);

View File

@@ -1,13 +1,7 @@
import { StartsWithDateComponent } from './date/starts-with-date.component';
import { StartsWithType } from './starts-with-type';
import { StartsWithTextComponent } from './text/starts-with-text.component';
/**
* An enum that defines the type of StartsWith options
*/
export enum StartsWithType {
text = 'Text',
date = 'Date'
}
type StartsWithComponentType = typeof StartsWithDateComponent | typeof StartsWithTextComponent;
export const STARTS_WITH_DECORATOR_MAP = new Map<StartsWithType, StartsWithComponentType>([

View File

@@ -8,10 +8,10 @@ import { Router, ActivatedRoute } from '@angular/router';
import { RouterStub } from '../testing/router.stub';
import { ThemeService } from '../theme-support/theme.service';
import { getMockThemeService } from '../mocks/theme-service.mock';
import { StartsWithType } from './starts-with-decorator';
import { ActivatedRouteStub } from '../testing/active-router.stub';
import { PaginationService } from '../../core/pagination/pagination.service';
import { PaginationServiceStub } from '../testing/pagination-service.stub';
import { StartsWithType } from './starts-with-type';
describe('StartsWithLoaderComponent', () => {
let comp: StartsWithLoaderComponent;

View File

@@ -1,8 +1,9 @@
import { Component, Input, } from '@angular/core';
import { AbstractComponentLoaderComponent } from '../abstract-component-loader/abstract-component-loader.component';
import { GenericConstructor } from '../../core/shared/generic-constructor';
import { getStartsWithComponent, StartsWithType } from './starts-with-decorator';
import { getStartsWithComponent } from './starts-with-decorator';
import { StartsWithAbstractComponent } from './starts-with-abstract.component';
import { StartsWithType } from './starts-with-type';
/**
* Component for loading a {@link StartsWithAbstractComponent} depending on the "type" input

View File

@@ -0,0 +1,8 @@
/**
* An enum that defines the type of StartsWith options
*/
export enum StartsWithType {
text = 'Text',
date = 'Date'
}

View File

@@ -1,8 +1,6 @@
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { SectionModelComponent } from '../models/section.model';
import { renderSectionFor } from '../sections-decorator';
import { SectionsType } from '../sections-type';
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
import { SectionsService } from '../sections.service';
@@ -10,7 +8,11 @@ import { SectionDataObject } from '../models/section-data.model';
import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
import { getFirstCompletedRemoteData, getPaginatedListPayload, getRemoteDataPayload } from '../../../core/shared/operators';
import {
getFirstCompletedRemoteData,
getPaginatedListPayload,
getRemoteDataPayload
} from '../../../core/shared/operators';
import { LdnServicesService } from '../../../admin/admin-ldn-services/ldn-services-data/ldn-services-data.service';
import {
LdnService,
@@ -44,7 +46,6 @@ import { InfiniteScrollModule } from 'ngx-infinite-scroll';
],
providers: [NgbDropdown]
})
@renderSectionFor(SectionsType.CoarNotify)
export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent {
hasSectionData = false;

View File

@@ -29,11 +29,11 @@ import {
SuggestionEvidencesComponent
} from '../notifications/suggestion-list-element/suggestion-evidences/suggestion-evidences.component';
import {
SuggestionApproveAndImport,
SuggestionListElementComponent
} from '../notifications/suggestion-list-element/suggestion-list-element.component';
import { SuggestionsService } from '../notifications/suggestions.service';
import { SuggestionTargetsStateService } from '../notifications/suggestion-targets/suggestion-targets.state.service';
import { SuggestionApproveAndImport } from '../notifications/suggestion-list-element/suggestion-approve-and-import';
describe('SuggestionPageComponent', () => {
let component: SuggestionsPageComponent;

View File

@@ -15,17 +15,14 @@ import { NotificationsService } from '../shared/notifications/notifications.serv
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
import { PaginationService } from '../core/pagination/pagination.service';
import { WorkspaceItem } from '../core/submission/models/workspaceitem.model';
import {FindListOptions} from '../core/data/find-list-options.model';
import {redirectOn4xx} from '../core/shared/authorized.operators';
import {
getWorkspaceItemEditRoute
} from '../workflowitems-edit-page/workflowitems-edit-page-routing-paths';
import { FindListOptions } from '../core/data/find-list-options.model';
import { redirectOn4xx } from '../core/shared/authorized.operators';
import { getWorkspaceItemEditRoute } from '../workflowitems-edit-page/workflowitems-edit-page-routing-paths';
import { Suggestion } from '../core/notifications/models/suggestion.model';
import { SuggestionTarget } from '../core/notifications/models/suggestion-target.model';
import { SuggestionBulkResult, SuggestionsService } from '../notifications/suggestions.service';
import { SuggestionTargetsStateService } from '../notifications/suggestion-targets/suggestion-targets.state.service';
import {
SuggestionApproveAndImport,
SuggestionListElementComponent
} from '../notifications/suggestion-list-element/suggestion-list-element.component';
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
@@ -33,6 +30,7 @@ import { VarDirective } from '../shared/utils/var.directive';
import { SuggestionActionsComponent } from '../notifications/suggestion-actions/suggestion-actions.component';
import { LoadingComponent } from '../shared/loading/loading.component';
import { PaginationComponent } from '../shared/pagination/pagination.component';
import { SuggestionApproveAndImport } from '../notifications/suggestion-list-element/suggestion-approve-and-import';
@Component({
selector: 'ds-suggestion-page',