diff --git a/.github/workflows/label_merge_conflicts.yml b/.github/workflows/label_merge_conflicts.yml new file mode 100644 index 0000000000..dcbab18f1b --- /dev/null +++ b/.github/workflows/label_merge_conflicts.yml @@ -0,0 +1,25 @@ +# This workflow checks open PRs for merge conflicts and labels them when conflicts are found +name: Check for merge conflicts + +# Run whenever the "main" branch is updated +# NOTE: This means merge conflicts are only checked for when a PR is merged to main. +on: + push: + branches: + - main + +jobs: + triage: + runs-on: ubuntu-latest + steps: + # See: https://github.com/mschilde/auto-label-merge-conflicts/ + - name: Auto-label PRs with merge conflicts + uses: mschilde/auto-label-merge-conflicts@v2.0 + # Add "merge conflict" label if a merge conflict is detected. Remove it when resolved. + # Note, the authentication token is created automatically + # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token + with: + CONFLICT_LABEL_NAME: 'merge conflict' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Ignore errors + continue-on-error: true diff --git a/src/app/+admin/admin-access-control/admin-access-control-routing-paths.ts b/src/app/+admin/admin-access-control/admin-access-control-routing-paths.ts new file mode 100644 index 0000000000..2080cb14a7 --- /dev/null +++ b/src/app/+admin/admin-access-control/admin-access-control-routing-paths.ts @@ -0,0 +1,8 @@ +import { URLCombiner } from '../../core/url-combiner/url-combiner'; +import { getAccessControlModuleRoute } from '../admin-routing-paths'; + +export const GROUP_EDIT_PATH = 'groups'; + +export function getGroupEditRoute(id: string) { + return new URLCombiner(getAccessControlModuleRoute(), GROUP_EDIT_PATH, id).toString(); +} diff --git a/src/app/+admin/admin-access-control/admin-access-control-routing.module.ts b/src/app/+admin/admin-access-control/admin-access-control-routing.module.ts index f61a3c2f71..d2f2233eee 100644 --- a/src/app/+admin/admin-access-control/admin-access-control-routing.module.ts +++ b/src/app/+admin/admin-access-control/admin-access-control-routing.module.ts @@ -3,14 +3,7 @@ import { RouterModule } from '@angular/router'; import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component'; import { GroupFormComponent } from './group-registry/group-form/group-form.component'; import { GroupsRegistryComponent } from './group-registry/groups-registry.component'; -import { URLCombiner } from '../../core/url-combiner/url-combiner'; -import { getAccessControlModulePath } from '../admin-routing.module'; - -export const GROUP_EDIT_PATH = 'groups'; - -export function getGroupEditPath(id: string) { - return new URLCombiner(getAccessControlModulePath(), GROUP_EDIT_PATH, id).toString(); -} +import { GROUP_EDIT_PATH } from './admin-access-control-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.html b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.html index 20593756c1..9cf733a394 100644 --- a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.html +++ b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.html @@ -7,87 +7,88 @@ -
- -
- - -
-
- +
+
+
-
-
- - - - + + + +
+
+
+
+ + + + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + +
{{labelPrefix + 'table.id' | translate}}{{labelPrefix + 'table.name' | translate}}{{labelPrefix + 'table.email' | translate}}{{labelPrefix + 'table.edit' | translate}}
{{eperson.id}}{{eperson.name}}{{eperson.email}} +
+ + +
+
+
+ +
+ + - - - - -
- - - - - - - - - - - - - - - - - -
{{labelPrefix + 'table.id' | translate}}{{labelPrefix + 'table.name' | translate}}{{labelPrefix + 'table.email' | translate}}{{labelPrefix + 'table.edit' | translate}}
{{eperson.id}}{{eperson.name}}{{eperson.email}} -
- - -
-
-
- -
- - -
diff --git a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts index 17d8655bdd..4cc68a5540 100644 --- a/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.spec.ts @@ -175,7 +175,7 @@ describe('EPeopleRegistryComponent', () => { it('editEPerson form is toggled', () => { const ePeopleIds = fixture.debugElement.queryAll(By.css('#epeople tr td:first-child')); ePersonDataServiceStub.getActiveEPerson().subscribe((activeEPerson: EPerson) => { - if (activeEPerson === ePeopleIds[0].nativeElement.textContent) { + if (ePeopleIds[0] && activeEPerson === ePeopleIds[0].nativeElement.textContent) { expect(component.isEPersonFormShown).toEqual(false); } else { expect(component.isEPersonFormShown).toEqual(true); @@ -183,6 +183,10 @@ describe('EPeopleRegistryComponent', () => { }) }); + + it('EPerson search section is hidden', () => { + expect(fixture.debugElement.query(By.css('#search'))).toBeNull(); + }); }); }); diff --git a/src/app/+admin/admin-registries/admin-registries-routing-paths.ts b/src/app/+admin/admin-registries/admin-registries-routing-paths.ts new file mode 100644 index 0000000000..fa8ee0b209 --- /dev/null +++ b/src/app/+admin/admin-registries/admin-registries-routing-paths.ts @@ -0,0 +1,8 @@ +import { URLCombiner } from '../../core/url-combiner/url-combiner'; +import { getRegistriesModuleRoute } from '../admin-routing-paths'; + +export const BITSTREAMFORMATS_MODULE_PATH = 'bitstream-formats'; + +export function getBitstreamFormatsModuleRoute() { + return new URLCombiner(getRegistriesModuleRoute(), BITSTREAMFORMATS_MODULE_PATH).toString(); +} diff --git a/src/app/+admin/admin-registries/admin-registries-routing.module.ts b/src/app/+admin/admin-registries/admin-registries-routing.module.ts index 8833b307b9..d291827b12 100644 --- a/src/app/+admin/admin-registries/admin-registries-routing.module.ts +++ b/src/app/+admin/admin-registries/admin-registries-routing.module.ts @@ -2,15 +2,8 @@ import { MetadataRegistryComponent } from './metadata-registry/metadata-registry import { RouterModule } from '@angular/router'; import { NgModule } from '@angular/core'; import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component'; -import { URLCombiner } from '../../core/url-combiner/url-combiner'; -import { getRegistriesModulePath } from '../admin-routing.module'; import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; - -const BITSTREAMFORMATS_MODULE_PATH = 'bitstream-formats'; - -export function getBitstreamFormatsModulePath() { - return new URLCombiner(getRegistriesModulePath(), BITSTREAMFORMATS_MODULE_PATH).toString(); -} +import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts index 9712be70ca..ecc26bd5d9 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts @@ -5,8 +5,8 @@ import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model' import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; import { RestResponse } from '../../../../core/cache/response.models'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; -import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module'; import { TranslateService } from '@ngx-translate/core'; +import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths'; /** * This component renders the page to create a new bitstream format. @@ -37,7 +37,7 @@ export class AddBitstreamFormatComponent { if (response.isSuccessful) { this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.create.success.head'), this.translateService.get('admin.registries.bitstream-formats.create.success.content')); - this.router.navigate([getBitstreamFormatsModulePath()]); + this.router.navigate([getBitstreamFormatsModuleRoute()]); this.bitstreamFormatDataService.clearBitStreamFormatRequests().subscribe(); } else { this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'), diff --git a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts index 0fdcc75689..0b63e4d4dd 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts @@ -7,8 +7,8 @@ import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model' import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; import { RestResponse } from '../../../../core/cache/response.models'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; -import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module'; import { TranslateService } from '@ngx-translate/core'; +import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths'; /** * This component renders the edit page of a bitstream format. @@ -51,7 +51,7 @@ export class EditBitstreamFormatComponent implements OnInit { if (response.isSuccessful) { this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.edit.success.head'), this.translateService.get('admin.registries.bitstream-formats.edit.success.content')); - this.router.navigate([getBitstreamFormatsModulePath()]); + this.router.navigate([getBitstreamFormatsModuleRoute()]); } else { this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head', 'admin.registries.bitstream-formats.create.edit.content'); diff --git a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts index 505ccccd91..7212288ab8 100644 --- a/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts +++ b/src/app/+admin/admin-registries/bitstream-formats/format-form/format-form.component.ts @@ -12,9 +12,9 @@ import { DynamicTextAreaModel } from '@ng-dynamic-forms/core'; import { Router } from '@angular/router'; -import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module'; import { hasValue, isEmpty } from '../../../../shared/empty.util'; import { TranslateService } from '@ngx-translate/core'; +import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths'; /** * The component responsible for rendering the form to create/edit a bitstream format @@ -189,6 +189,6 @@ export class FormatFormComponent implements OnInit { * Cancels the edit/create action of the bitstream format and navigates back to the bitstream format registry */ onCancel() { - this.router.navigate([getBitstreamFormatsModulePath()]); + this.router.navigate([getBitstreamFormatsModuleRoute()]); } } diff --git a/src/app/+admin/admin-routing-paths.ts b/src/app/+admin/admin-routing-paths.ts new file mode 100644 index 0000000000..11eac49fe2 --- /dev/null +++ b/src/app/+admin/admin-routing-paths.ts @@ -0,0 +1,13 @@ +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getAdminModuleRoute } from '../app-routing-paths'; + +export const REGISTRIES_MODULE_PATH = 'registries'; +export const ACCESS_CONTROL_MODULE_PATH = 'access-control'; + +export function getRegistriesModuleRoute() { + return new URLCombiner(getAdminModuleRoute(), REGISTRIES_MODULE_PATH).toString(); +} + +export function getAccessControlModuleRoute() { + return new URLCombiner(getAdminModuleRoute(), ACCESS_CONTROL_MODULE_PATH).toString(); +} diff --git a/src/app/+admin/admin-routing.module.ts b/src/app/+admin/admin-routing.module.ts index 84b418772a..7495eab003 100644 --- a/src/app/+admin/admin-routing.module.ts +++ b/src/app/+admin/admin-routing.module.ts @@ -1,24 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; -import { getAdminModulePath } from '../app-routing.module'; import { MetadataImportPageComponent } from './admin-import-metadata-page/metadata-import-page.component'; import { AdminSearchPageComponent } from './admin-search-page/admin-search-page.component'; import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component'; import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.service'; -import { URLCombiner } from '../core/url-combiner/url-combiner'; import { AdminCurationTasksComponent } from './admin-curation-tasks/admin-curation-tasks.component'; - -const REGISTRIES_MODULE_PATH = 'registries'; -export const ACCESS_CONTROL_MODULE_PATH = 'access-control'; - -export function getRegistriesModulePath() { - return new URLCombiner(getAdminModulePath(), REGISTRIES_MODULE_PATH).toString(); -} - -export function getAccessControlModulePath() { - return new URLCombiner(getAdminModulePath(), ACCESS_CONTROL_MODULE_PATH).toString(); -} +import { ACCESS_CONTROL_MODULE_PATH, REGISTRIES_MODULE_PATH } from './admin-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts index 1dcd978095..34db71db77 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts @@ -12,7 +12,7 @@ import { CollectionSearchResult } from '../../../../../shared/object-collection/ import { Collection } from '../../../../../core/shared/collection.model'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; -import { getCollectionEditPath } from '../../../../../+collection-page/collection-page-routing.module'; +import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths'; describe('CollectionAdminSearchResultGridElementComponent', () => { let component: CollectionAdminSearchResultGridElementComponent; @@ -61,6 +61,6 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { it('should render an edit button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.edit-link')); const link = a.nativeElement.href; - expect(link).toContain(getCollectionEditPath(id)); + expect(link).toContain(getCollectionEditRoute(id)); }) }); diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts index 5e784165ab..9477544f60 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts @@ -4,8 +4,8 @@ import { listableObjectComponent } from '../../../../../shared/object-collection import { Context } from '../../../../../core/shared/context.model'; import { CollectionSearchResult } from '../../../../../shared/object-collection/shared/collection-search-result.model'; import { Collection } from '../../../../../core/shared/collection.model'; -import { getCollectionEditPath } from '../../../../../+collection-page/collection-page-routing.module'; import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component'; +import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths'; @listableObjectComponent(CollectionSearchResult, ViewMode.GridElement, Context.AdminSearch) @Component({ @@ -21,6 +21,6 @@ export class CollectionAdminSearchResultGridElementComponent extends SearchResul ngOnInit() { super.ngOnInit(); - this.editPath = getCollectionEditPath(this.dso.uuid); + this.editPath = getCollectionEditRoute(this.dso.uuid); } } diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts index 99d33f841a..85c81d55a4 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts @@ -13,9 +13,9 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { CommunityAdminSearchResultGridElementComponent } from './community-admin-search-result-grid-element.component'; import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model'; -import { getCommunityEditPath } from '../../../../../+community-page/community-page-routing.module'; import { Community } from '../../../../../core/shared/community.model'; import { CommunityAdminSearchResultListElementComponent } from '../../admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component'; +import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths'; describe('CommunityAdminSearchResultGridElementComponent', () => { let component: CommunityAdminSearchResultGridElementComponent; @@ -65,6 +65,6 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { it('should render an edit button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.edit-link')); const link = a.nativeElement.href; - expect(link).toContain(getCommunityEditPath(id)); + expect(link).toContain(getCommunityEditRoute(id)); }) }); diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts index 8df12e703f..59117b1f65 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts @@ -4,8 +4,8 @@ import { listableObjectComponent } from '../../../../../shared/object-collection import { Context } from '../../../../../core/shared/context.model'; import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model'; import { Community } from '../../../../../core/shared/community.model'; -import { getCommunityEditPath } from '../../../../../+community-page/community-page-routing.module'; import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component'; +import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths'; @listableObjectComponent(CommunitySearchResult, ViewMode.GridElement, Context.AdminSearch) @Component({ @@ -21,6 +21,6 @@ export class CommunityAdminSearchResultGridElementComponent extends SearchResult ngOnInit() { super.ngOnInit(); - this.editPath = getCommunityEditPath(this.dso.uuid); + this.editPath = getCommunityEditRoute(this.dso.uuid); } } diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts index 04558f6320..3fcb33502d 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts @@ -4,16 +4,6 @@ import { ViewMode } from '../../../../../core/shared/view-mode.model'; import { getListableObjectComponent, listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator'; import { Context } from '../../../../../core/shared/context.model'; import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; -import { getItemEditPath } from '../../../../../+item-page/item-page-routing.module'; -import { URLCombiner } from '../../../../../core/url-combiner/url-combiner'; -import { - ITEM_EDIT_DELETE_PATH, - ITEM_EDIT_MOVE_PATH, - ITEM_EDIT_PRIVATE_PATH, - ITEM_EDIT_PUBLIC_PATH, - ITEM_EDIT_REINSTATE_PATH, - ITEM_EDIT_WITHDRAW_PATH -} from '../../../../../+item-page/edit-item-page/edit-item-page.routing.module'; import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component'; import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service'; diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts index 259d1d64aa..e4c151eee9 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts @@ -10,7 +10,7 @@ import { CollectionSearchResult } from '../../../../../shared/object-collection/ import { Collection } from '../../../../../core/shared/collection.model'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; -import { getCollectionEditPath } from '../../../../../+collection-page/collection-page-routing.module'; +import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths'; describe('CollectionAdminSearchResultListElementComponent', () => { let component: CollectionAdminSearchResultListElementComponent; @@ -55,6 +55,6 @@ describe('CollectionAdminSearchResultListElementComponent', () => { it('should render an edit button with the correct link', () => { const a = fixture.debugElement.query(By.css('a')); const link = a.nativeElement.href; - expect(link).toContain(getCollectionEditPath(id)); + expect(link).toContain(getCollectionEditRoute(id)); }) }); diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts index e49f272184..9622888660 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts @@ -5,7 +5,7 @@ import { Context } from '../../../../../core/shared/context.model'; import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component'; import { CollectionSearchResult } from '../../../../../shared/object-collection/shared/collection-search-result.model'; import { Collection } from '../../../../../core/shared/collection.model'; -import { getCollectionEditPath } from '../../../../../+collection-page/collection-page-routing.module'; +import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths'; @listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.AdminSearch) @Component({ @@ -21,6 +21,6 @@ export class CollectionAdminSearchResultListElementComponent extends SearchResul ngOnInit() { super.ngOnInit(); - this.editPath = getCollectionEditPath(this.dso.uuid); + this.editPath = getCollectionEditRoute(this.dso.uuid); } } diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts index a7922d7cf5..31709914c5 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts @@ -9,8 +9,8 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { CommunityAdminSearchResultListElementComponent } from './community-admin-search-result-list-element.component'; import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model'; -import { getCommunityEditPath } from '../../../../../+community-page/community-page-routing.module'; import { Community } from '../../../../../core/shared/community.model'; +import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths'; describe('CommunityAdminSearchResultListElementComponent', () => { let component: CommunityAdminSearchResultListElementComponent; @@ -55,6 +55,6 @@ describe('CommunityAdminSearchResultListElementComponent', () => { it('should render an edit button with the correct link', () => { const a = fixture.debugElement.query(By.css('a')); const link = a.nativeElement.href; - expect(link).toContain(getCommunityEditPath(id)); + expect(link).toContain(getCommunityEditRoute(id)); }) }); diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts index 71fe4203ef..2e82e7f3b8 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts @@ -5,7 +5,7 @@ import { Context } from '../../../../../core/shared/context.model'; import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component'; import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model'; import { Community } from '../../../../../core/shared/community.model'; -import { getCommunityEditPath } from '../../../../../+community-page/community-page-routing.module'; +import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths'; @listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.AdminSearch) @Component({ @@ -21,6 +21,6 @@ export class CommunityAdminSearchResultListElementComponent extends SearchResult ngOnInit() { super.ngOnInit(); - this.editPath = getCommunityEditPath(this.dso.uuid); + this.editPath = getCommunityEditRoute(this.dso.uuid); } } diff --git a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.html b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.html index a4a923e725..2ee828e870 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.html +++ b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.html @@ -1,27 +1,27 @@ - + {{"admin.search.item.edit" | translate}} - + {{"admin.search.item.withdraw" | translate}} - + {{"admin.search.item.reinstate" | translate}} - + {{"admin.search.item.make-private" | translate}} - + {{"admin.search.item.make-public" | translate}} - + {{"admin.search.item.delete" | translate}} - + {{"admin.search.item.move" | translate}} diff --git a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts index c1aceb477d..f26fde1311 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts @@ -6,16 +6,16 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { ItemAdminSearchResultActionsComponent } from './item-admin-search-result-actions.component'; import { Item } from '../../../core/shared/item.model'; +import { URLCombiner } from '../../../core/url-combiner/url-combiner'; +import { getItemEditRoute } from '../../../+item-page/item-page-routing-paths'; import { - ITEM_EDIT_DELETE_PATH, ITEM_EDIT_MOVE_PATH, - ITEM_EDIT_PRIVATE_PATH, + ITEM_EDIT_DELETE_PATH, ITEM_EDIT_PUBLIC_PATH, + ITEM_EDIT_PRIVATE_PATH, ITEM_EDIT_REINSTATE_PATH, ITEM_EDIT_WITHDRAW_PATH -} from '../../../+item-page/edit-item-page/edit-item-page.routing.module'; -import { getItemEditPath } from '../../../+item-page/item-page-routing.module'; -import { URLCombiner } from '../../../core/url-combiner/url-combiner'; +} from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; describe('ItemAdminSearchResultActionsComponent', () => { let component: ItemAdminSearchResultActionsComponent; @@ -55,19 +55,19 @@ describe('ItemAdminSearchResultActionsComponent', () => { it('should render an edit button with the correct link', () => { const button = fixture.debugElement.query(By.css('a.edit-link')); const link = button.nativeElement.href; - expect(link).toContain(getItemEditPath(id)); + expect(link).toContain(getItemEditRoute(id)); }); it('should render a delete button with the correct link', () => { const button = fixture.debugElement.query(By.css('a.delete-link')); const link = button.nativeElement.href; - expect(link).toContain(new URLCombiner(getItemEditPath(id), ITEM_EDIT_DELETE_PATH).toString()); + expect(link).toContain(new URLCombiner(getItemEditRoute(id), ITEM_EDIT_DELETE_PATH).toString()); }); it('should render a move button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.move-link')); const link = a.nativeElement.href; - expect(link).toContain(new URLCombiner(getItemEditPath(id), ITEM_EDIT_MOVE_PATH).toString()); + expect(link).toContain(new URLCombiner(getItemEditRoute(id), ITEM_EDIT_MOVE_PATH).toString()); }); describe('when the item is not withdrawn', () => { @@ -79,7 +79,7 @@ describe('ItemAdminSearchResultActionsComponent', () => { it('should render a withdraw button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.withdraw-link')); const link = a.nativeElement.href; - expect(link).toContain(new URLCombiner(getItemEditPath(id), ITEM_EDIT_WITHDRAW_PATH).toString()); + expect(link).toContain(new URLCombiner(getItemEditRoute(id), ITEM_EDIT_WITHDRAW_PATH).toString()); }); it('should not render a reinstate button with the correct link', () => { @@ -102,7 +102,7 @@ describe('ItemAdminSearchResultActionsComponent', () => { it('should render a reinstate button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.reinstate-link')); const link = a.nativeElement.href; - expect(link).toContain(new URLCombiner(getItemEditPath(id), ITEM_EDIT_REINSTATE_PATH).toString()); + expect(link).toContain(new URLCombiner(getItemEditRoute(id), ITEM_EDIT_REINSTATE_PATH).toString()); }); }); @@ -115,7 +115,7 @@ describe('ItemAdminSearchResultActionsComponent', () => { it('should render a make private button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.private-link')); const link = a.nativeElement.href; - expect(link).toContain(new URLCombiner(getItemEditPath(id), ITEM_EDIT_PRIVATE_PATH).toString()); + expect(link).toContain(new URLCombiner(getItemEditRoute(id), ITEM_EDIT_PRIVATE_PATH).toString()); }); it('should not render a make public button with the correct link', () => { @@ -138,7 +138,7 @@ describe('ItemAdminSearchResultActionsComponent', () => { it('should render a make private button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.public-link')); const link = a.nativeElement.href; - expect(link).toContain(new URLCombiner(getItemEditPath(id), ITEM_EDIT_PUBLIC_PATH).toString()); + expect(link).toContain(new URLCombiner(getItemEditRoute(id), ITEM_EDIT_PUBLIC_PATH).toString()); }); }) }); diff --git a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts index 40cddc816d..d3cbc025c2 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts @@ -1,15 +1,15 @@ import { Component, Input } from '@angular/core'; import { Item } from '../../../core/shared/item.model'; -import { getItemEditPath } from '../../../+item-page/item-page-routing.module'; import { URLCombiner } from '../../../core/url-combiner/url-combiner'; +import { getItemEditRoute } from '../../../+item-page/item-page-routing-paths'; import { - ITEM_EDIT_DELETE_PATH, ITEM_EDIT_MOVE_PATH, - ITEM_EDIT_PRIVATE_PATH, + ITEM_EDIT_DELETE_PATH, ITEM_EDIT_PUBLIC_PATH, + ITEM_EDIT_PRIVATE_PATH, ITEM_EDIT_REINSTATE_PATH, ITEM_EDIT_WITHDRAW_PATH -} from '../../../+item-page/edit-item-page/edit-item-page.routing.module'; +} from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; @Component({ selector: 'ds-item-admin-search-result-actions-element', @@ -33,49 +33,49 @@ export class ItemAdminSearchResultActionsComponent { /** * Returns the path to the edit page of this item */ - getEditPath(): string { - return getItemEditPath(this.item.uuid) + getEditRoute(): string { + return getItemEditRoute(this.item.uuid) } /** * Returns the path to the move page of this item */ - getMovePath(): string { - return new URLCombiner(this.getEditPath(), ITEM_EDIT_MOVE_PATH).toString(); + getMoveRoute(): string { + return new URLCombiner(this.getEditRoute(), ITEM_EDIT_MOVE_PATH).toString(); } /** * Returns the path to the delete page of this item */ - getDeletePath(): string { - return new URLCombiner(this.getEditPath(), ITEM_EDIT_DELETE_PATH).toString(); + getDeleteRoute(): string { + return new URLCombiner(this.getEditRoute(), ITEM_EDIT_DELETE_PATH).toString(); } /** * Returns the path to the withdraw page of this item */ - getWithdrawPath(): string { - return new URLCombiner(this.getEditPath(), ITEM_EDIT_WITHDRAW_PATH).toString(); + getWithdrawRoute(): string { + return new URLCombiner(this.getEditRoute(), ITEM_EDIT_WITHDRAW_PATH).toString(); } /** * Returns the path to the reinstate page of this item */ - getReinstatePath(): string { - return new URLCombiner(this.getEditPath(), ITEM_EDIT_REINSTATE_PATH).toString(); + getReinstateRoute(): string { + return new URLCombiner(this.getEditRoute(), ITEM_EDIT_REINSTATE_PATH).toString(); } /** * Returns the path to the page where the user can make this item private */ - getPrivatePath(): string { - return new URLCombiner(this.getEditPath(), ITEM_EDIT_PRIVATE_PATH).toString(); + getPrivateRoute(): string { + return new URLCombiner(this.getEditRoute(), ITEM_EDIT_PRIVATE_PATH).toString(); } /** * Returns the path to the page where the user can make this item public */ - getPublicPath(): string { - return new URLCombiner(this.getEditPath(), ITEM_EDIT_PUBLIC_PATH).toString(); + getPublicRoute(): string { + return new URLCombiner(this.getEditRoute(), ITEM_EDIT_PUBLIC_PATH).toString(); } } diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.html b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.html index 1a90a4cff4..4d7266514c 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.html +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.html @@ -1,7 +1,7 @@ - + {{"admin.workflow.item.delete" | translate}} - + {{"admin.workflow.item.send-back" | translate}} diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts index bca2684364..5e0ff481a0 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.spec.ts @@ -5,19 +5,22 @@ import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { Item } from '../../../core/shared/item.model'; -import { - ITEM_EDIT_DELETE_PATH, - ITEM_EDIT_MOVE_PATH, - ITEM_EDIT_PRIVATE_PATH, - ITEM_EDIT_PUBLIC_PATH, - ITEM_EDIT_REINSTATE_PATH, - ITEM_EDIT_WITHDRAW_PATH -} from '../../../+item-page/edit-item-page/edit-item-page.routing.module'; -import { getItemEditPath } from '../../../+item-page/item-page-routing.module'; import { URLCombiner } from '../../../core/url-combiner/url-combiner'; import { WorkflowItemAdminWorkflowActionsComponent } from './workflow-item-admin-workflow-actions.component'; import { WorkflowItem } from '../../../core/submission/models/workflowitem.model'; -import { getWorkflowItemDeletePath, getWorkflowItemSendBackPath } from '../../../+workflowitems-edit-page/workflowitems-edit-page-routing.module'; +import { + getWorkflowItemSendBackRoute, + getWorkflowItemDeleteRoute +} from '../../../+workflowitems-edit-page/workflowitems-edit-page-routing-paths'; +import { getItemEditRoute } from '../../../+item-page/item-page-routing-paths'; +import { + ITEM_EDIT_MOVE_PATH, + ITEM_EDIT_DELETE_PATH, + ITEM_EDIT_PUBLIC_PATH, + ITEM_EDIT_PRIVATE_PATH, + ITEM_EDIT_REINSTATE_PATH, + ITEM_EDIT_WITHDRAW_PATH +} from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; describe('WorkflowItemAdminWorkflowActionsComponent', () => { let component: WorkflowItemAdminWorkflowActionsComponent; @@ -57,12 +60,12 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => { it('should render a delete button with the correct link', () => { const button = fixture.debugElement.query(By.css('a.delete-link')); const link = button.nativeElement.href; - expect(link).toContain(new URLCombiner(getWorkflowItemDeletePath(wfi.id)).toString()); + expect(link).toContain(new URLCombiner(getWorkflowItemDeleteRoute(wfi.id)).toString()); }); it('should render a move button with the correct link', () => { const a = fixture.debugElement.query(By.css('a.send-back-link')); const link = a.nativeElement.href; - expect(link).toContain(new URLCombiner(getWorkflowItemSendBackPath(wfi.id)).toString()); + expect(link).toContain(new URLCombiner(getWorkflowItemSendBackRoute(wfi.id)).toString()); }); }); diff --git a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.ts b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.ts index d44f870b14..9dba0e9fd4 100644 --- a/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.ts +++ b/src/app/+admin/admin-workflow-page/admin-workflow-search-results/workflow-item-admin-workflow-actions.component.ts @@ -1,6 +1,9 @@ import { Component, Input } from '@angular/core'; import { WorkflowItem } from '../../../core/submission/models/workflowitem.model'; -import { getWorkflowItemDeletePath, getWorkflowItemSendBackPath } from '../../../+workflowitems-edit-page/workflowitems-edit-page-routing.module'; +import { + getWorkflowItemSendBackRoute, + getWorkflowItemDeleteRoute +} from '../../../+workflowitems-edit-page/workflowitems-edit-page-routing-paths'; @Component({ selector: 'ds-workflow-item-admin-workflow-actions-element', @@ -25,15 +28,15 @@ export class WorkflowItemAdminWorkflowActionsComponent { /** * Returns the path to the delete page of this workflow item */ - getDeletePath(): string { + getDeleteRoute(): string { - return getWorkflowItemDeletePath(this.wfi.id) + return getWorkflowItemDeleteRoute(this.wfi.id) } /** * Returns the path to the send back page of this workflow item */ - getSendBackPath(): string { - return getWorkflowItemSendBackPath(this.wfi.id); + getSendBackRoute(): string { + return getWorkflowItemSendBackRoute(this.wfi.id); } } diff --git a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index cce6932cd1..3e8b686e48 100644 --- a/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -36,7 +36,7 @@ import { Observable } from 'rxjs/internal/Observable'; import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list'; import { followLink } from '../../shared/utils/follow-link-config.model'; -import { getItemEditPath } from '../../+item-page/item-page-routing.module'; +import { getItemEditRoute } from '../../+item-page/item-page-routing-paths'; @Component({ selector: 'ds-edit-bitstream-page', @@ -506,7 +506,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy { */ navigateToItemEditBitstreams() { if (hasValue(this.itemId)) { - this.router.navigate([getItemEditPath(this.itemId), 'bitstreams']); + this.router.navigate([getItemEditRoute(this.itemId), 'bitstreams']); } else { this.location.back(); } diff --git a/src/app/+browse-by/browse-by-dso-breadcrumb.resolver.ts b/src/app/+browse-by/browse-by-dso-breadcrumb.resolver.ts index 5759e28754..e64fa8a89d 100644 --- a/src/app/+browse-by/browse-by-dso-breadcrumb.resolver.ts +++ b/src/app/+browse-by/browse-by-dso-breadcrumb.resolver.ts @@ -9,7 +9,7 @@ import { Observable } from 'rxjs'; import { getRemoteDataPayload, getSucceededRemoteData } from '../core/shared/operators'; import { map } from 'rxjs/operators'; import { hasValue } from '../shared/empty.util'; -import { getDSOPath } from '../app-routing.module'; +import { getDSORoute } from '../app-routing-paths'; /** * The class that resolves the BreadcrumbConfig object for a DSpaceObject on a browse by page @@ -32,7 +32,7 @@ export class BrowseByDSOBreadcrumbResolver { getSucceededRemoteData(), getRemoteDataPayload(), map((object: Community | Collection) => { - return { provider: this.breadcrumbService, key: object, url: getDSOPath(object) }; + return { provider: this.breadcrumbService, key: object, url: getDSORoute(object) }; }) ); } diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts index 64ad426584..84475c95eb 100644 --- a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts +++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts @@ -133,7 +133,7 @@ export class CollectionItemMapperComponent implements OnInit { return this.searchService.search(Object.assign(new PaginatedSearchOptions(options), { query: this.buildQuery(collectionRD.payload.id, options.query), scope: undefined, - dsoType: DSpaceObjectType.ITEM, + dsoTypes: [DSpaceObjectType.ITEM], sort: this.defaultSortOptions }), 10000).pipe( toDSpaceObjectListRD(), diff --git a/src/app/+collection-page/collection-page-routing-paths.ts b/src/app/+collection-page/collection-page-routing-paths.ts new file mode 100644 index 0000000000..7a1b2923bf --- /dev/null +++ b/src/app/+collection-page/collection-page-routing-paths.ts @@ -0,0 +1,25 @@ +import { URLCombiner } from '../core/url-combiner/url-combiner'; + +export const COLLECTION_PARENT_PARAMETER = 'parent'; + +export const COLLECTION_MODULE_PATH = 'collections'; + +export function getCollectionModuleRoute() { + return `/${COLLECTION_MODULE_PATH}`; +} + +export function getCollectionPageRoute(collectionId: string) { + return new URLCombiner(getCollectionModuleRoute(), collectionId).toString(); +} + +export function getCollectionEditRoute(id: string) { + return new URLCombiner(getCollectionModuleRoute(), id, COLLECTION_EDIT_PATH).toString() +} + +export function getCollectionCreateRoute() { + return new URLCombiner(getCollectionModuleRoute(), COLLECTION_CREATE_PATH).toString() +} + +export const COLLECTION_CREATE_PATH = 'create'; +export const COLLECTION_EDIT_PATH = 'edit'; +export const ITEMTEMPLATE_PATH = 'itemtemplate'; diff --git a/src/app/+collection-page/collection-page-routing.module.ts b/src/app/+collection-page/collection-page-routing.module.ts index c7ee89a9d2..13898055f9 100644 --- a/src/app/+collection-page/collection-page-routing.module.ts +++ b/src/app/+collection-page/collection-page-routing.module.ts @@ -7,8 +7,6 @@ import { CreateCollectionPageComponent } from './create-collection-page/create-c import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard'; import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component'; -import { URLCombiner } from '../core/url-combiner/url-combiner'; -import { getCollectionModulePath } from '../app-routing.module'; import { EditItemTemplatePageComponent } from './edit-item-template-page/edit-item-template-page.component'; import { ItemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver'; import { CollectionItemMapperComponent } from './collection-item-mapper/collection-item-mapper.component'; @@ -17,24 +15,11 @@ import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.servi import { LinkService } from '../core/cache/builders/link.service'; import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard'; - -export const COLLECTION_PARENT_PARAMETER = 'parent'; - -export function getCollectionPageRoute(collectionId: string) { - return new URLCombiner(getCollectionModulePath(), collectionId).toString(); -} - -export function getCollectionEditPath(id: string) { - return new URLCombiner(getCollectionModulePath(), id, COLLECTION_EDIT_PATH).toString() -} - -export function getCollectionCreatePath() { - return new URLCombiner(getCollectionModulePath(), COLLECTION_CREATE_PATH).toString() -} - -const COLLECTION_CREATE_PATH = 'create'; -const COLLECTION_EDIT_PATH = 'edit'; -const ITEMTEMPLATE_PATH = 'itemtemplate'; +import { + ITEMTEMPLATE_PATH, + COLLECTION_EDIT_PATH, + COLLECTION_CREATE_PATH +} from './collection-page-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/+collection-page/collection-page.component.ts b/src/app/+collection-page/collection-page.component.ts index 7f54e0f9d7..c7d287ed6a 100644 --- a/src/app/+collection-page/collection-page.component.ts +++ b/src/app/+collection-page/collection-page.component.ts @@ -87,7 +87,7 @@ export class CollectionPageComponent implements OnInit { scope: id, pagination: dto.paginationConfig, sort: dto.sortConfig, - dsoType: DSpaceObjectType.ITEM + dsoTypes: [DSpaceObjectType.ITEM] })).pipe(toDSpaceObjectListRD()) as Observable>> }), startWith(undefined) // Make sure switching pages shows loading component diff --git a/src/app/+collection-page/edit-collection-page/edit-collection-page.component.ts b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.ts index 209ce5149a..f225fc3e97 100644 --- a/src/app/+collection-page/edit-collection-page/edit-collection-page.component.ts +++ b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component'; import { Collection } from '../../core/shared/collection.model'; -import { getCollectionPageRoute } from '../collection-page-routing.module'; +import { getCollectionPageRoute } from '../collection-page-routing-paths'; /** * Component that represents the page where a user can edit an existing Collection diff --git a/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts b/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts index 6d5ffc8768..3cd2a7a638 100644 --- a/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts +++ b/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts @@ -9,8 +9,8 @@ import { ActivatedRoute } from '@angular/router'; import { of as observableOf } from 'rxjs/internal/observable/of'; import { Collection } from '../../core/shared/collection.model'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { getCollectionEditPath } from '../collection-page-routing.module'; import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils'; +import { getCollectionEditRoute } from '../collection-page-routing-paths'; describe('EditItemTemplatePageComponent', () => { let comp: EditItemTemplatePageComponent; @@ -45,7 +45,7 @@ describe('EditItemTemplatePageComponent', () => { describe('getCollectionEditUrl', () => { it('should return the collection\'s edit url', () => { const url = comp.getCollectionEditUrl(collection); - expect(url).toEqual(getCollectionEditPath(collection.uuid)); + expect(url).toEqual(getCollectionEditRoute(collection.uuid)); }); }); }); diff --git a/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.ts b/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.ts index 329c72d683..ac8d9b47d4 100644 --- a/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.ts +++ b/src/app/+collection-page/edit-item-template-page/edit-item-template-page.component.ts @@ -5,7 +5,7 @@ import { Collection } from '../../core/shared/collection.model'; import { ActivatedRoute } from '@angular/router'; import { first, map } from 'rxjs/operators'; import { ItemTemplateDataService } from '../../core/data/item-template-data.service'; -import { getCollectionEditPath } from '../collection-page-routing.module'; +import { getCollectionEditRoute } from '../collection-page-routing-paths'; @Component({ selector: 'ds-edit-item-template-page', @@ -35,7 +35,7 @@ export class EditItemTemplatePageComponent implements OnInit { */ getCollectionEditUrl(collection: Collection): string { if (collection) { - return getCollectionEditPath(collection.uuid); + return getCollectionEditRoute(collection.uuid); } else { return ''; } diff --git a/src/app/+community-page/community-page-routing-paths.ts b/src/app/+community-page/community-page-routing-paths.ts new file mode 100644 index 0000000000..2d0a3e5308 --- /dev/null +++ b/src/app/+community-page/community-page-routing-paths.ts @@ -0,0 +1,24 @@ +import { URLCombiner } from '../core/url-combiner/url-combiner'; + +export const COMMUNITY_PARENT_PARAMETER = 'parent'; + +export const COMMUNITY_MODULE_PATH = 'communities'; + +export function getCommunityModuleRoute() { + return `/${COMMUNITY_MODULE_PATH}`; +} + +export function getCommunityPageRoute(communityId: string) { + return new URLCombiner(getCommunityModuleRoute(), communityId).toString(); +} + +export function getCommunityEditRoute(id: string) { + return new URLCombiner(getCommunityModuleRoute(), id, COMMUNITY_EDIT_PATH).toString() +} + +export function getCommunityCreateRoute() { + return new URLCombiner(getCommunityModuleRoute(), COMMUNITY_CREATE_PATH).toString() +} + +export const COMMUNITY_CREATE_PATH = 'create'; +export const COMMUNITY_EDIT_PATH = 'edit'; diff --git a/src/app/+community-page/community-page-routing.module.ts b/src/app/+community-page/community-page-routing.module.ts index be09a2c48f..050d24e9b4 100644 --- a/src/app/+community-page/community-page-routing.module.ts +++ b/src/app/+community-page/community-page-routing.module.ts @@ -7,29 +7,11 @@ import { CreateCommunityPageComponent } from './create-community-page/create-com import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard'; import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; -import { URLCombiner } from '../core/url-combiner/url-combiner'; -import { getCommunityModulePath } from '../app-routing.module'; import { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver'; import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service'; import { LinkService } from '../core/cache/builders/link.service'; import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard'; - -export const COMMUNITY_PARENT_PARAMETER = 'parent'; - -export function getCommunityPageRoute(communityId: string) { - return new URLCombiner(getCommunityModulePath(), communityId).toString(); -} - -export function getCommunityEditPath(id: string) { - return new URLCombiner(getCommunityModulePath(), id, COMMUNITY_EDIT_PATH).toString() -} - -export function getCommunityCreatePath() { - return new URLCombiner(getCommunityModulePath(), COMMUNITY_CREATE_PATH).toString() -} - -const COMMUNITY_CREATE_PATH = 'create'; -const COMMUNITY_EDIT_PATH = 'edit'; +import { COMMUNITY_EDIT_PATH, COMMUNITY_CREATE_PATH } from './community-page-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/+community-page/edit-community-page/edit-community-page.component.ts b/src/app/+community-page/edit-community-page/edit-community-page.component.ts index c0adfe0ff1..b8bf3a08ac 100644 --- a/src/app/+community-page/edit-community-page/edit-community-page.component.ts +++ b/src/app/+community-page/edit-community-page/edit-community-page.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; import { Community } from '../../core/shared/community.model'; import { ActivatedRoute, Router } from '@angular/router'; import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component'; -import { getCommunityPageRoute } from '../community-page-routing.module'; +import { getCommunityPageRoute } from '../community-page-routing-paths'; /** * Component that represents the page where a user can edit an existing Community diff --git a/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts b/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts index 536fc0931f..eb42b1c30c 100644 --- a/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts +++ b/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts @@ -11,7 +11,6 @@ import { ItemDataService } from '../../../core/data/item-data.service'; import { AuthService } from '../../../core/auth/auth.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; -import { getBitstreamModulePath } from '../../../app-routing.module'; import { PaginatedList } from '../../../core/data/paginated-list'; import { Bundle } from '../../../core/shared/bundle.model'; import { BundleDataService } from '../../../core/data/bundle-data.service'; @@ -19,8 +18,9 @@ import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators'; import { UploaderComponent } from '../../../shared/uploader/uploader.component'; -import { getItemEditPath } from '../../item-page-routing.module'; import { RequestService } from '../../../core/data/request.service'; +import { getBitstreamModuleRoute } from '../../../app-routing-paths'; +import { getItemEditRoute } from '../../item-page-routing-paths'; @Component({ selector: 'ds-upload-bitstream', @@ -171,7 +171,7 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy { // Bring over the item ID as a query parameter const queryParams = { itemId: this.itemId }; - this.router.navigate([getBitstreamModulePath(), bitstream.id, 'edit'], { queryParams: queryParams }); + this.router.navigate([getBitstreamModuleRoute(), bitstream.id, 'edit'], { queryParams: queryParams }); } /** @@ -196,7 +196,7 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy { * When cancel is clicked, navigate back to the item's edit bitstreams page */ onCancel() { - this.router.navigate([getItemEditPath(this.itemId), 'bitstreams']); + this.router.navigate([getItemEditRoute(this.itemId), 'bitstreams']); } /** diff --git a/src/app/+item-page/edit-item-page/edit-item-page.component.ts b/src/app/+item-page/edit-item-page/edit-item-page.component.ts index eafc04ae0b..655582064c 100644 --- a/src/app/+item-page/edit-item-page/edit-item-page.component.ts +++ b/src/app/+item-page/edit-item-page/edit-item-page.component.ts @@ -6,7 +6,7 @@ import { Item } from '../../core/shared/item.model'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { isNotEmpty } from '../../shared/empty.util'; -import { getItemPageRoute } from '../item-page-routing.module'; +import { getItemPageRoute } from '../item-page-routing-paths'; @Component({ selector: 'ds-edit-item-page', diff --git a/src/app/+item-page/edit-item-page/edit-item-page.routing-paths.ts b/src/app/+item-page/edit-item-page/edit-item-page.routing-paths.ts new file mode 100644 index 0000000000..ce76a614dd --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.routing-paths.ts @@ -0,0 +1,7 @@ +export const ITEM_EDIT_WITHDRAW_PATH = 'withdraw'; +export const ITEM_EDIT_REINSTATE_PATH = 'reinstate'; +export const ITEM_EDIT_PRIVATE_PATH = 'private'; +export const ITEM_EDIT_PUBLIC_PATH = 'public'; +export const ITEM_EDIT_DELETE_PATH = 'delete'; +export const ITEM_EDIT_MOVE_PATH = 'move'; +export const ITEM_EDIT_AUTHORIZATIONS_PATH = 'authorizations'; diff --git a/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts index 87b4b7a592..7006c5dc89 100644 --- a/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts +++ b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts @@ -20,14 +20,15 @@ import { ResourcePolicyResolver } from '../../shared/resource-policies/resolvers import { ResourcePolicyCreateComponent } from '../../shared/resource-policies/create/resource-policy-create.component'; import { ResourcePolicyEditComponent } from '../../shared/resource-policies/edit/resource-policy-edit.component'; import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service'; - -export const ITEM_EDIT_WITHDRAW_PATH = 'withdraw'; -export const ITEM_EDIT_REINSTATE_PATH = 'reinstate'; -export const ITEM_EDIT_PRIVATE_PATH = 'private'; -export const ITEM_EDIT_PUBLIC_PATH = 'public'; -export const ITEM_EDIT_DELETE_PATH = 'delete'; -export const ITEM_EDIT_MOVE_PATH = 'move'; -export const ITEM_EDIT_AUTHORIZATIONS_PATH = 'authorizations'; +import { + ITEM_EDIT_AUTHORIZATIONS_PATH, + ITEM_EDIT_MOVE_PATH, + ITEM_EDIT_DELETE_PATH, + ITEM_EDIT_PUBLIC_PATH, + ITEM_EDIT_PRIVATE_PATH, + ITEM_EDIT_REINSTATE_PATH, + ITEM_EDIT_WITHDRAW_PATH +} from './edit-item-page.routing-paths'; /** * Routing module that handles the routing for the Edit Item page administrator functionality diff --git a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts index 8477ae5c21..1409e06ddb 100644 --- a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts +++ b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts @@ -125,7 +125,7 @@ export class ItemCollectionMapperComponent implements OnInit { switchMap(([itemCollectionsRD, owningCollectionRD, searchOptions]) => { return this.searchService.search(Object.assign(new PaginatedSearchOptions(searchOptions), { query: this.buildQuery([...itemCollectionsRD.payload.page, owningCollectionRD.payload], searchOptions.query), - dsoType: DSpaceObjectType.COLLECTION + dsoTypes: [DSpaceObjectType.COLLECTION] }), 10000).pipe( toDSpaceObjectListRD(), startWith(undefined) diff --git a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts index 7233dbeaa1..18cbd6e855 100644 --- a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts @@ -16,7 +16,6 @@ import { NotificationsService } from '../../../shared/notifications/notification import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { ItemDeleteComponent } from './item-delete.component'; -import { getItemEditPath } from '../../item-page-routing.module'; import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils'; import { VarDirective } from '../../../shared/utils/var.directive'; import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service'; @@ -26,6 +25,7 @@ import { RemoteData } from '../../../core/data/remote-data'; import { PaginatedList } from '../../../core/data/paginated-list'; import { PageInfo } from '../../../core/shared/page-info.model'; import { EntityTypeService } from '../../../core/data/entity-type.service'; +import { getItemEditRoute } from '../../item-page-routing-paths'; let comp: ItemDeleteComponent; let fixture: ComponentFixture; @@ -233,7 +233,7 @@ describe('ItemDeleteComponent', () => { describe('notify', () => { it('should navigate to the item edit page on failed deletion of the item', () => { comp.notify(false); - expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath('fake-id')]); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('fake-id')]); }); }); }) diff --git a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.ts b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.ts index 933919c572..ac73c561b2 100644 --- a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.ts +++ b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { defaultIfEmpty, filter, first, map, switchMap, take } from 'rxjs/operators'; import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; -import { getItemEditPath } from '../../item-page-routing.module'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { combineLatest as observableCombineLatest, combineLatest, Observable, of as observableOf } from 'rxjs'; import { RelationshipType } from '../../../core/shared/item-relationships/relationship-type.model'; @@ -22,6 +21,7 @@ import { EntityTypeService } from '../../../core/data/entity-type.service'; import { LinkService } from '../../../core/cache/builders/link.service'; import { followLink } from '../../../shared/utils/follow-link-config.model'; import { RestResponse } from '../../../core/cache/response.models'; +import { getItemEditRoute } from '../../item-page-routing-paths'; @Component({ selector: 'ds-item-delete', @@ -345,7 +345,7 @@ export class ItemDeleteComponent this.router.navigate(['']); } else { this.notificationsService.error(this.translateService.get('item.edit.' + this.messageKey + '.error')); - this.router.navigate([getItemEditPath(this.item.id)]); + this.router.navigate([getItemEditRoute(this.item.id)]); } } } diff --git a/src/app/+item-page/edit-item-page/item-move/item-move.component.ts b/src/app/+item-page/edit-item-page/item-move/item-move.component.ts index 4db7cf94da..abadd2ec4a 100644 --- a/src/app/+item-page/edit-item-page/item-move/item-move.component.ts +++ b/src/app/+item-page/edit-item-page/item-move/item-move.component.ts @@ -10,7 +10,6 @@ import { NotificationsService } from '../../../shared/notifications/notification import { TranslateService } from '@ngx-translate/core'; import { getSucceededRemoteData } from '../../../core/shared/operators'; import { ItemDataService } from '../../../core/data/item-data.service'; -import { getItemEditPath } from '../../item-page-routing.module'; import { Observable, of as observableOf } from 'rxjs'; import { RestResponse } from '../../../core/cache/response.models'; import { Collection } from '../../../core/shared/collection.model'; @@ -18,6 +17,7 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio import { SearchService } from '../../../core/shared/search/search.service'; import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model'; import { SearchResult } from '../../../shared/search/search-result.model'; +import { getItemEditRoute } from '../../item-page-routing-paths'; @Component({ selector: 'ds-item-move', @@ -79,7 +79,7 @@ export class ItemMoveComponent implements OnInit { loadSuggestions(query): void { this.collectionSearchResults = this.searchService.search(new PaginatedSearchOptions({ pagination: this.pagination, - dsoType: DSpaceObjectType.COLLECTION, + dsoTypes: [DSpaceObjectType.COLLECTION], query: query })).pipe( first(), @@ -116,7 +116,7 @@ export class ItemMoveComponent implements OnInit { this.processing = true; this.itemDataService.moveToCollection(this.itemId, this.selectedCollection).pipe(first()).subscribe( (response: RestResponse) => { - this.router.navigate([getItemEditPath(this.itemId)]); + this.router.navigate([getItemEditRoute(this.itemId)]); if (response.isSuccessful) { this.notificationsService.success(this.translateService.get('item.edit.move.success')); } else { diff --git a/src/app/+item-page/edit-item-page/item-status/item-status.component.ts b/src/app/+item-page/edit-item-page/item-status/item-status.component.ts index 1be13e3a7a..2696c90353 100644 --- a/src/app/+item-page/edit-item-page/item-status/item-status.component.ts +++ b/src/app/+item-page/edit-item-page/item-status/item-status.component.ts @@ -6,7 +6,7 @@ import { ItemOperation } from '../item-operation/itemOperation.model'; import { first, map } from 'rxjs/operators'; import { Observable } from 'rxjs'; import { RemoteData } from '../../../core/data/remote-data'; -import { getItemEditPath, getItemPageRoute } from '../../item-page-routing.module'; +import { getItemEditRoute, getItemPageRoute } from '../../item-page-routing-paths'; @Component({ selector: 'ds-item-status', @@ -99,7 +99,7 @@ export class ItemStatusComponent implements OnInit { * @returns {string} url */ getCurrentUrl(item: Item): string { - return getItemEditPath(item.id); + return getItemEditRoute(item.id); } } diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts index a6e64250cb..e6c5cfefc0 100644 --- a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts @@ -15,12 +15,12 @@ import { RemoteData } from '../../../core/data/remote-data'; import { AbstractSimpleItemActionComponent } from './abstract-simple-item-action.component'; import { By } from '@angular/platform-browser'; import { of as observableOf } from 'rxjs'; -import { getItemEditPath } from '../../item-page-routing.module'; import { RestResponse } from '../../../core/cache/response.models'; import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; +import { getItemEditRoute } from '../../item-page-routing-paths'; /** * Test component that implements the AbstractSimpleItemActionComponent used to test the @@ -136,14 +136,14 @@ describe('AbstractSimpleItemActionComponent', () => { comp.processRestResponse(successfulRestResponse); expect(notificationsServiceStub.success).toHaveBeenCalled(); - expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath(mockItem.id)]); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute(mockItem.id)]); }); it('should process a RestResponse to navigate and display success notification', () => { comp.processRestResponse(failRestResponse); expect(notificationsServiceStub.error).toHaveBeenCalled(); - expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath(mockItem.id)]); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute(mockItem.id)]); }); }); diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.ts b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.ts index 7773dbb573..ca347e1298 100644 --- a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.ts +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.ts @@ -9,8 +9,8 @@ import {Observable} from 'rxjs'; import {getSucceededRemoteData} from '../../../core/shared/operators'; import {first, map} from 'rxjs/operators'; import {findSuccessfulAccordingTo} from '../edit-item-operators'; -import {getItemEditPath} from '../../item-page-routing.module'; import { RestResponse } from '../../../core/cache/response.models'; +import { getItemEditRoute } from '../../item-page-routing-paths'; /** * Component to render and handle simple item edit actions such as withdrawal and reinstatement. @@ -73,11 +73,11 @@ export class AbstractSimpleItemActionComponent implements OnInit { this.itemDataService.findById(this.item.id).pipe( findSuccessfulAccordingTo(this.predicate)).subscribe(() => { this.notificationsService.success(this.translateService.get('item.edit.' + this.messageKey + '.success')); - this.router.navigate([getItemEditPath(this.item.id)]); + this.router.navigate([getItemEditRoute(this.item.id)]); }); } else { this.notificationsService.error(this.translateService.get('item.edit.' + this.messageKey + '.error')); - this.router.navigate([getItemEditPath(this.item.id)]); + this.router.navigate([getItemEditRoute(this.item.id)]); } } diff --git a/src/app/+item-page/item-page-routing-paths.ts b/src/app/+item-page/item-page-routing-paths.ts new file mode 100644 index 0000000000..bb8f052eda --- /dev/null +++ b/src/app/+item-page/item-page-routing-paths.ts @@ -0,0 +1,18 @@ +import { URLCombiner } from '../core/url-combiner/url-combiner'; + +export const ITEM_MODULE_PATH = 'items'; + +export function getItemModuleRoute() { + return `/${ITEM_MODULE_PATH}`; +} + +export function getItemPageRoute(itemId: string) { + return new URLCombiner(getItemModuleRoute(), itemId).toString(); +} + +export function getItemEditRoute(id: string) { + return new URLCombiner(getItemModuleRoute(), id, ITEM_EDIT_PATH).toString() +} + +export const ITEM_EDIT_PATH = 'edit'; +export const UPLOAD_BITSTREAM_PATH = 'bitstreams/new'; diff --git a/src/app/+item-page/item-page-routing.module.ts b/src/app/+item-page/item-page-routing.module.ts index 436f6990ba..5b8a3cb293 100644 --- a/src/app/+item-page/item-page-routing.module.ts +++ b/src/app/+item-page/item-page-routing.module.ts @@ -4,25 +4,13 @@ import { RouterModule } from '@angular/router'; import { ItemPageComponent } from './simple/item-page.component'; import { FullItemPageComponent } from './full/full-item-page.component'; import { ItemPageResolver } from './item-page.resolver'; -import { URLCombiner } from '../core/url-combiner/url-combiner'; -import { getItemModulePath } from '../app-routing.module'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { ItemBreadcrumbResolver } from '../core/breadcrumbs/item-breadcrumb.resolver'; import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service'; import { LinkService } from '../core/cache/builders/link.service'; import { UploadBitstreamComponent } from './bitstreams/upload/upload-bitstream.component'; import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard'; - -export function getItemPageRoute(itemId: string) { - return new URLCombiner(getItemModulePath(), itemId).toString(); -} - -export function getItemEditPath(id: string) { - return new URLCombiner(getItemModulePath(), id, ITEM_EDIT_PATH).toString() -} - -const ITEM_EDIT_PATH = 'edit'; -const UPLOAD_BITSTREAM_PATH = 'bitstreams/new'; +import { UPLOAD_BITSTREAM_PATH, ITEM_EDIT_PATH } from './item-page-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts new file mode 100644 index 0000000000..7d09a6915e --- /dev/null +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts @@ -0,0 +1,22 @@ +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getWorkflowItemModuleRoute } from '../app-routing-paths'; + +export function getWorkflowItemPageRoute(wfiId: string) { + return new URLCombiner(getWorkflowItemModuleRoute(), wfiId).toString(); +} + +export function getWorkflowItemEditRoute(wfiId: string) { + return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_EDIT_PATH).toString() +} + +export function getWorkflowItemDeleteRoute(wfiId: string) { + return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_DELETE_PATH).toString() +} + +export function getWorkflowItemSendBackRoute(wfiId: string) { + return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_SEND_BACK_PATH).toString() +} + +export const WORKFLOW_ITEM_EDIT_PATH = 'edit'; +export const WORKFLOW_ITEM_DELETE_PATH = 'delete'; +export const WORKFLOW_ITEM_SEND_BACK_PATH = 'sendback'; diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts index 585a6377ae..7f3b9026f2 100644 --- a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts @@ -3,32 +3,15 @@ import { RouterModule } from '@angular/router'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { SubmissionEditComponent } from '../submission/edit/submission-edit.component'; -import { URLCombiner } from '../core/url-combiner/url-combiner'; -import { getWorkflowItemModulePath } from '../app-routing.module'; import { WorkflowItemDeleteComponent } from './workflow-item-delete/workflow-item-delete.component'; import { WorkflowItemPageResolver } from './workflow-item-page.resolver'; import { WorkflowItemSendBackComponent } from './workflow-item-send-back/workflow-item-send-back.component'; import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard'; - -export function getWorkflowItemPageRoute(wfiId: string) { - return new URLCombiner(getWorkflowItemModulePath(), wfiId).toString(); -} - -export function getWorkflowItemEditPath(wfiId: string) { - return new URLCombiner(getWorkflowItemModulePath(), wfiId, WORKFLOW_ITEM_EDIT_PATH).toString() -} - -export function getWorkflowItemDeletePath(wfiId: string) { - return new URLCombiner(getWorkflowItemModulePath(), wfiId, WORKFLOW_ITEM_DELETE_PATH).toString() -} - -export function getWorkflowItemSendBackPath(wfiId: string) { - return new URLCombiner(getWorkflowItemModulePath(), wfiId, WORKFLOW_ITEM_SEND_BACK_PATH).toString() -} - -const WORKFLOW_ITEM_EDIT_PATH = 'edit'; -const WORKFLOW_ITEM_DELETE_PATH = 'delete'; -const WORKFLOW_ITEM_SEND_BACK_PATH = 'sendback'; +import { + WORKFLOW_ITEM_SEND_BACK_PATH, + WORKFLOW_ITEM_DELETE_PATH, + WORKFLOW_ITEM_EDIT_PATH +} from './workflowitems-edit-page-routing-paths'; @NgModule({ imports: [ diff --git a/src/app/app-routing-paths.ts b/src/app/app-routing-paths.ts new file mode 100644 index 0000000000..4e64a4a552 --- /dev/null +++ b/src/app/app-routing-paths.ts @@ -0,0 +1,67 @@ +import { DSpaceObject } from './core/shared/dspace-object.model'; +import { Community } from './core/shared/community.model'; +import { Collection } from './core/shared/collection.model'; +import { Item } from './core/shared/item.model'; +import { getCommunityPageRoute } from './+community-page/community-page-routing-paths'; +import { getCollectionPageRoute } from './+collection-page/collection-page-routing-paths'; +import { getItemPageRoute } from './+item-page/item-page-routing-paths'; + +export const BITSTREAM_MODULE_PATH = 'bitstreams'; + +export function getBitstreamModuleRoute() { + return `/${BITSTREAM_MODULE_PATH}`; +} + +export const ADMIN_MODULE_PATH = 'admin'; + +export function getAdminModuleRoute() { + return `/${ADMIN_MODULE_PATH}`; +} + +export const PROFILE_MODULE_PATH = 'profile'; + +export function getProfileModuleRoute() { + return `/${PROFILE_MODULE_PATH}`; +} + +export const REGISTER_PATH = 'register'; + +export function getRegisterRoute() { + return `/${REGISTER_PATH}`; + +} + +export const FORGOT_PASSWORD_PATH = 'forgot'; + +export function getForgotPasswordRoute() { + return `/${FORGOT_PASSWORD_PATH}`; + +} + +export const WORKFLOW_ITEM_MODULE_PATH = 'workflowitems'; + +export function getWorkflowItemModuleRoute() { + return `/${WORKFLOW_ITEM_MODULE_PATH}`; +} + +export function getDSORoute(dso: DSpaceObject): string { + switch ((dso as any).type) { + case Community.type.value: + return getCommunityPageRoute(dso.uuid); + case Collection.type.value: + return getCollectionPageRoute(dso.uuid); + case Item.type.value: + return getItemPageRoute(dso.uuid); + } +} + +export const UNAUTHORIZED_PATH = 'unauthorized'; + +export function getUnauthorizedRoute() { + return `/${UNAUTHORIZED_PATH}`; +} + +export const INFO_MODULE_PATH = 'info'; +export function getInfoModulePath() { + return `/${INFO_MODULE_PATH}`; +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 5e02a6cf1b..13afd0423e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,95 +4,24 @@ import { AuthBlockingGuard } from './core/auth/auth-blocking.guard'; import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; import { AuthenticatedGuard } from './core/auth/authenticated.guard'; -import { DSpaceObject } from './core/shared/dspace-object.model'; -import { Community } from './core/shared/community.model'; -import { getCommunityPageRoute } from './+community-page/community-page-routing.module'; -import { Collection } from './core/shared/collection.model'; -import { Item } from './core/shared/item.model'; -import { getItemPageRoute } from './+item-page/item-page-routing.module'; -import { getCollectionPageRoute } from './+collection-page/collection-page-routing.module'; import { SiteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard'; import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; +import { + UNAUTHORIZED_PATH, + WORKFLOW_ITEM_MODULE_PATH, + FORGOT_PASSWORD_PATH, + REGISTER_PATH, + PROFILE_MODULE_PATH, + ADMIN_MODULE_PATH, + BITSTREAM_MODULE_PATH, + INFO_MODULE_PATH +} from './app-routing-paths'; +import { COLLECTION_MODULE_PATH } from './+collection-page/collection-page-routing-paths'; +import { COMMUNITY_MODULE_PATH } from './+community-page/community-page-routing-paths'; +import { ITEM_MODULE_PATH } from './+item-page/item-page-routing-paths'; import { ReloadGuard } from './core/reload/reload.guard'; import { EndUserAgreementGuard } from './core/end-user-agreement/end-user-agreement.guard'; -const ITEM_MODULE_PATH = 'items'; - -export function getItemModulePath() { - return `/${ITEM_MODULE_PATH}`; -} - -const COLLECTION_MODULE_PATH = 'collections'; - -export function getCollectionModulePath() { - return `/${COLLECTION_MODULE_PATH}`; -} - -const COMMUNITY_MODULE_PATH = 'communities'; - -export function getCommunityModulePath() { - return `/${COMMUNITY_MODULE_PATH}`; -} -const BITSTREAM_MODULE_PATH = 'bitstreams'; -export function getBitstreamModulePath() { - return `/${BITSTREAM_MODULE_PATH}`; -} - -export const ADMIN_MODULE_PATH = 'admin'; - -export function getAdminModulePath() { - return `/${ADMIN_MODULE_PATH}`; -} - -const PROFILE_MODULE_PATH = 'profile'; - -export function getProfileModulePath() { - return `/${PROFILE_MODULE_PATH}`; -} - -const REGISTER_PATH = 'register'; - -export function getRegisterPath() { - return `/${REGISTER_PATH}`; - -} - -const FORGOT_PASSWORD_PATH = 'forgot'; - -export function getForgotPasswordPath() { - return `/${FORGOT_PASSWORD_PATH}`; - -} - -const WORKFLOW_ITEM_MODULE_PATH = 'workflowitems'; - -export function getWorkflowItemModulePath() { - return `/${WORKFLOW_ITEM_MODULE_PATH}`; -} - -export function getDSOPath(dso: DSpaceObject): string { - switch ((dso as any).type) { - case Community.type.value: - return getCommunityPageRoute(dso.uuid); - case Collection.type.value: - return getCollectionPageRoute(dso.uuid); - case Item.type.value: - return getItemPageRoute(dso.uuid); - } -} - -const UNAUTHORIZED_PATH = 'unauthorized'; - -export function getUnauthorizedPath() { - return `/${UNAUTHORIZED_PATH}`; -} - -const INFO_MODULE_PATH = 'info'; - -export function getInfoModulePath() { - return `/${INFO_MODULE_PATH}`; -} - @NgModule({ imports: [ RouterModule.forRoot([ diff --git a/src/app/app.component.html b/src/app/app.component.html index b628424cd4..fa534855e7 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,4 @@ -
+
{ @@ -159,7 +148,6 @@ describe('CurationFormComponent', () => { expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [ {name: '-t', value: 'profileformats'}, {name: '-i', value: 'all'}, - {name: '-e', value: 'test@mail'}, ], []); }); }); diff --git a/src/app/curation-form/curation-form.component.ts b/src/app/curation-form/curation-form.component.ts index 95512d1129..36382b0797 100644 --- a/src/app/curation-form/curation-form.component.ts +++ b/src/app/curation-form/curation-form.component.ts @@ -3,9 +3,7 @@ import { ScriptDataService } from '../core/data/processes/script-data.service'; import { FormControl, FormGroup } from '@angular/forms'; import { getResponseFromEntry } from '../core/shared/operators'; import { DSOSuccessResponse } from '../core/cache/response.models'; -import { AuthService } from '../core/auth/auth.service'; -import { filter, map, switchMap, take } from 'rxjs/operators'; -import { EPerson } from '../core/eperson/models/eperson.model'; +import { filter, map, take } from 'rxjs/operators'; import { NotificationsService } from '../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; import { hasValue, isEmpty, isNotEmpty } from '../shared/empty.util'; @@ -40,7 +38,6 @@ export class CurationFormComponent implements OnInit { private scriptDataService: ScriptDataService, private configurationDataService: ConfigurationDataService, private processDataService: ProcessDataService, - private authService: AuthService, private notificationsService: NotificationsService, private translateService: TranslateService, private router: Router @@ -90,16 +87,10 @@ export class CurationFormComponent implements OnInit { handle = 'all'; } } - this.authService.getAuthenticatedUserFromStore().pipe( - take(1), - switchMap((eperson: EPerson) => { - return this.scriptDataService.invoke('curate', [ + this.scriptDataService.invoke('curate', [ {name: '-t', value: taskName}, {name: '-i', value: handle}, - {name: '-e', value: eperson.email}, - ], []).pipe(getResponseFromEntry()); - }) - ).subscribe((response: DSOSuccessResponse) => { + ], []).pipe(getResponseFromEntry()).subscribe((response: DSOSuccessResponse) => { if (response.isSuccessful) { this.notificationsService.success(this.translateService.get('curation.form.submit.success.head'), this.translateService.get('curation.form.submit.success.content')); diff --git a/src/app/info/info-routing.module.ts b/src/app/info/info-routing.module.ts index eab8cd32af..86ff7fb334 100644 --- a/src/app/info/info-routing.module.ts +++ b/src/app/info/info-routing.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { EndUserAgreementComponent } from './end-user-agreement/end-user-agreement.component'; -import { getInfoModulePath } from '../app-routing.module'; +import { getInfoModulePath } from '../app-routing-paths'; import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; import { PrivacyComponent } from './privacy/privacy.component'; diff --git a/src/app/shared/auth-nav-menu/user-menu/user-menu.component.ts b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.ts index 81d9b3d555..1dbcec8eb6 100644 --- a/src/app/shared/auth-nav-menu/user-menu/user-menu.component.ts +++ b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.ts @@ -7,8 +7,8 @@ import { EPerson } from '../../../core/eperson/models/eperson.model'; import { AppState } from '../../../app.reducer'; import { isAuthenticationLoading } from '../../../core/auth/selectors'; import { MYDSPACE_ROUTE } from '../../../+my-dspace-page/my-dspace-page.component'; -import { getProfileModulePath } from '../../../app-routing.module'; import { AuthService } from '../../../core/auth/auth.service'; +import { getProfileModuleRoute } from '../../../app-routing-paths'; /** * This component represents the user nav menu. @@ -41,7 +41,7 @@ export class UserMenuComponent implements OnInit { /** * The profile page route */ - public profileRoute = getProfileModulePath(); + public profileRoute = getProfileModuleRoute(); constructor(private store: Store, private authService: AuthService) { diff --git a/src/app/shared/chips/models/chips-item.model.ts b/src/app/shared/chips/models/chips-item.model.ts index d60d29e41e..6bc513022c 100644 --- a/src/app/shared/chips/models/chips-item.model.ts +++ b/src/app/shared/chips/models/chips-item.model.ts @@ -2,7 +2,7 @@ import { isObject, uniqueId } from 'lodash'; import { hasValue, isNotEmpty } from '../../empty.util'; import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model'; import { ConfidenceType } from '../../../core/integration/models/confidence-type'; -import { PLACEHOLDER_PARENT_METADATA } from '../../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { PLACEHOLDER_PARENT_METADATA } from '../../form/builder/ds-dynamic-form-ui/ds-dynamic-form-constants'; export interface ChipsItemIcon { metadata: string; diff --git a/src/app/shared/chips/models/chips.model.ts b/src/app/shared/chips/models/chips.model.ts index de694bdcfd..936e13a3cd 100644 --- a/src/app/shared/chips/models/chips.model.ts +++ b/src/app/shared/chips/models/chips.model.ts @@ -2,10 +2,10 @@ import { findIndex, isEqual, isObject } from 'lodash'; import { BehaviorSubject } from 'rxjs'; import { ChipsItem, ChipsItemIcon } from './chips-item.model'; import { hasValue, isNotEmpty } from '../../empty.util'; -import { PLACEHOLDER_PARENT_METADATA } from '../../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { MetadataIconConfig } from '../../../../config/submission-config.interface'; import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model'; import { AuthorityValue } from '../../../core/integration/models/authority.value'; +import { PLACEHOLDER_PARENT_METADATA } from '../../form/builder/ds-dynamic-form-ui/ds-dynamic-form-constants'; export class Chips { chipsItems: BehaviorSubject; diff --git a/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.ts b/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.ts index 986d616c7d..8ce986832b 100644 --- a/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.ts +++ b/src/app/shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.ts @@ -2,7 +2,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { Group } from '../../../../core/eperson/models/group.model'; import { Community } from '../../../../core/shared/community.model'; import { Observable } from 'rxjs'; -import { getGroupEditPath } from '../../../../+admin/admin-access-control/admin-access-control-routing.module'; import { GroupDataService } from '../../../../core/eperson/group-data.service'; import { Collection } from '../../../../core/shared/collection.model'; import { filter, map } from 'rxjs/operators'; @@ -10,6 +9,7 @@ import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/s import { RequestService } from '../../../../core/data/request.service'; import { RemoteData } from '../../../../core/data/remote-data'; import { HALLink } from '../../../../core/shared/hal-link.model'; +import { getGroupEditRoute } from '../../../../+admin/admin-access-control/admin-access-control-routing-paths'; /** * Component for managing a community or collection role. @@ -71,7 +71,7 @@ export class ComcolRoleComponent implements OnInit { */ get editGroupLink$(): Observable { return this.group$.pipe( - map((group) => getGroupEditPath(group.id)), + map((group) => getGroupEditRoute(group.id)), ); } diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts index 477af5c1e4..0dab8a796f 100644 --- a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -1,11 +1,11 @@ import { Component, Inject, Input, OnInit } from '@angular/core'; import { Observable } from 'rxjs/internal/Observable'; import { map } from 'rxjs/operators'; -import { getCollectionPageRoute } from '../../+collection-page/collection-page-routing.module'; -import { getCommunityPageRoute } from '../../+community-page/community-page-routing.module'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface'; import { environment } from '../../../environments/environment'; +import { getCommunityPageRoute } from '../../+community-page/community-page-routing-paths'; +import { getCollectionPageRoute } from '../../+collection-page/collection-page-routing-paths'; export interface ComColPageNavOption { id: string; diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html index 8a30399391..92ddf4cf36 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html @@ -2,14 +2,14 @@
diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts index 9c6185199c..15cf5fe367 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.spec.ts @@ -6,7 +6,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ActivatedRoute, Router } from '@angular/router'; import { RemoteData } from '../../../../core/data/remote-data'; import { RouterStub } from '../../../testing/router.stub'; -import * as communityRouter from '../../../../+community-page/community-page-routing.module'; +import * as communityRouterPaths from '../../../../+community-page/community-page-routing-paths'; import { Community } from '../../../../core/shared/community.model'; import { CreateCommunityParentSelectorComponent } from './create-community-parent-selector.component'; import { MetadataValue } from '../../../../core/shared/metadata.models'; @@ -53,7 +53,7 @@ describe('CreateCommunityParentSelectorComponent', () => { })); beforeEach(() => { - spyOnProperty(communityRouter, 'getCommunityCreatePath').and.callFake(() => { + spyOnProperty(communityRouterPaths, 'getCommunityCreateRoute').and.callFake(() => { return () => createPath; }); diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts index 914dc7582f..7abe8f6a0a 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.ts @@ -4,14 +4,14 @@ import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.mod import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { hasValue } from '../../../empty.util'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { - COMMUNITY_PARENT_PARAMETER, - getCommunityCreatePath -} from '../../../../+community-page/community-page-routing.module'; import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +import { + getCommunityCreateRoute, + COMMUNITY_PARENT_PARAMETER +} from '../../../../+community-page/community-page-routing-paths'; /** * Component to wrap a button - for top communities - @@ -27,7 +27,7 @@ import { }) export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.COMMUNITY; - selectorType = DSpaceObjectType.COMMUNITY; + selectorTypes = [DSpaceObjectType.COMMUNITY]; action = SelectorActionType.CREATE; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) { @@ -46,6 +46,6 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap } }; } - this.router.navigate([getCommunityCreatePath()], navigationExtras); + this.router.navigate([getCommunityCreateRoute()], navigationExtras); } } diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts index 45d15ae306..5729ac8460 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.ts @@ -18,7 +18,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel }) export class CreateItemParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.ITEM; - selectorType = DSpaceObjectType.COLLECTION; + selectorTypes = [DSpaceObjectType.COLLECTION]; action = SelectorActionType.CREATE; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) { diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.html b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.html index 4800bb8733..e1c18ec1e0 100644 --- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.html +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.html @@ -5,6 +5,6 @@
diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts index f52ce3fc8f..0422953e17 100644 --- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.spec.ts @@ -124,7 +124,7 @@ describe('DSOSelectorModalWrapperComponent', () => { }) class TestComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.ITEM; - selectorType = DSpaceObjectType.ITEM; + selectorTypes = [DSpaceObjectType.ITEM]; action = SelectorActionType.EDIT; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) { diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts index 0f166dac51..b56a901b12 100644 --- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts @@ -29,9 +29,9 @@ export abstract class DSOSelectorModalWrapperComponent implements OnInit { objectType: DSpaceObjectType; /** - * The type of DSO that can be selected from this list + * The types of DSO that can be selected from this list */ - selectorType: DSpaceObjectType; + selectorTypes: DSpaceObjectType[]; /** * The type of action to perform diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts index 21ff5e846d..81040e558d 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.spec.ts @@ -6,7 +6,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ActivatedRoute, Router } from '@angular/router'; import { RemoteData } from '../../../../core/data/remote-data'; import { RouterStub } from '../../../testing/router.stub'; -import * as collectionRouter from '../../../../+collection-page/collection-page-routing.module'; +import * as collectionRouterPaths from '../../../../+collection-page/collection-page-routing-paths'; import { EditCollectionSelectorComponent } from './edit-collection-selector.component'; import { Collection } from '../../../../core/shared/collection.model'; import { MetadataValue } from '../../../../core/shared/metadata.models'; @@ -53,7 +53,7 @@ describe('EditCollectionSelectorComponent', () => { })); beforeEach(() => { - spyOnProperty(collectionRouter, 'getCollectionEditPath').and.callFake(() => { + spyOnProperty(collectionRouterPaths, 'getCollectionEditRoute').and.callFake(() => { return () => editPath; }); diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts index 79660b9589..cd0dda9af3 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.ts @@ -3,11 +3,11 @@ import { ActivatedRoute, Router } from '@angular/router'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module'; import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +import { getCollectionEditRoute } from '../../../../+collection-page/collection-page-routing-paths'; /** * Component to wrap a list of existing collections inside a modal @@ -20,7 +20,7 @@ import { }) export class EditCollectionSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.COLLECTION; - selectorType = DSpaceObjectType.COLLECTION; + selectorTypes = [DSpaceObjectType.COLLECTION]; action = SelectorActionType.EDIT; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) { @@ -31,6 +31,6 @@ export class EditCollectionSelectorComponent extends DSOSelectorModalWrapperComp * Navigate to the collection edit page */ navigate(dso: DSpaceObject) { - this.router.navigate([getCollectionEditPath(dso.uuid)]); + this.router.navigate([getCollectionEditRoute(dso.uuid)]); } } diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts index b37fa23024..260d15725e 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.spec.ts @@ -6,7 +6,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { ActivatedRoute, Router } from '@angular/router'; import { RemoteData } from '../../../../core/data/remote-data'; import { RouterStub } from '../../../testing/router.stub'; -import * as communityRouter from '../../../../+community-page/community-page-routing.module'; +import * as communityRouterPaths from '../../../../+community-page/community-page-routing-paths'; import { EditCommunitySelectorComponent } from './edit-community-selector.component'; import { Community } from '../../../../core/shared/community.model'; import { MetadataValue } from '../../../../core/shared/metadata.models'; @@ -53,7 +53,7 @@ describe('EditCommunitySelectorComponent', () => { })); beforeEach(() => { - spyOnProperty(communityRouter, 'getCommunityEditPath').and.callFake(() => { + spyOnProperty(communityRouterPaths, 'getCommunityEditRoute').and.callFake(() => { return () => editPath; }); diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts index 6b9efc1ff4..0d440e16c9 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.ts @@ -3,11 +3,11 @@ import { ActivatedRoute, Router } from '@angular/router'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module'; import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +import { getCommunityEditRoute } from '../../../../+community-page/community-page-routing-paths'; /** * Component to wrap a list of existing communities inside a modal @@ -21,7 +21,7 @@ import { export class EditCommunitySelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.COMMUNITY; - selectorType = DSpaceObjectType.COMMUNITY; + selectorTypes = [DSpaceObjectType.COMMUNITY]; action = SelectorActionType.EDIT; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) { @@ -32,6 +32,6 @@ export class EditCommunitySelectorComponent extends DSOSelectorModalWrapperCompo * Navigate to the community edit page */ navigate(dso: DSpaceObject) { - this.router.navigate([getCommunityEditPath(dso.uuid)]); + this.router.navigate([getCommunityEditRoute(dso.uuid)]); } } diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts index dbd5a0a575..67be305ccd 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.spec.ts @@ -6,7 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { EditItemSelectorComponent } from './edit-item-selector.component'; import { Item } from '../../../../core/shared/item.model'; import { RouterStub } from '../../../testing/router.stub'; -import * as itemRouter from '../../../../+item-page/item-page-routing.module'; +import * as itemRouterPaths from '../../../../+item-page/item-page-routing-paths'; import { MetadataValue } from '../../../../core/shared/metadata.models'; import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils'; @@ -51,7 +51,7 @@ describe('EditItemSelectorComponent', () => { })); beforeEach(() => { - spyOnProperty(itemRouter, 'getItemEditPath').and.callFake(() => { + spyOnProperty(itemRouterPaths, 'getItemEditRoute').and.callFake(() => { return () => editPath; }); diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.ts index dae36d3017..5288c1a197 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.ts @@ -3,8 +3,8 @@ import { ActivatedRoute, Router } from '@angular/router'; import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { getItemEditPath } from '../../../../+item-page/item-page-routing.module'; import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +import { getItemEditRoute } from '../../../../+item-page/item-page-routing-paths'; /** * Component to wrap a list of existing items inside a modal @@ -17,7 +17,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel }) export class EditItemSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.ITEM; - selectorType = DSpaceObjectType.ITEM; + selectorTypes = [DSpaceObjectType.ITEM]; action = SelectorActionType.EDIT; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) { @@ -28,6 +28,6 @@ export class EditItemSelectorComponent extends DSOSelectorModalWrapperComponent * Navigate to the item edit page */ navigate(dso: DSpaceObject) { - this.router.navigate([getItemEditPath(dso.uuid)]); + this.router.navigate([getItemEditRoute(dso.uuid)]); } } diff --git a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts index ca7a339a04..40aab2fad5 100644 --- a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts @@ -130,9 +130,8 @@ describe('ExportMetadataSelectorComponent', () => { done() }); }); - it('should show error notification', () => { - expect(notificationService.error).toHaveBeenCalled(); - expect(scriptRequestSucceeded).toBeFalse(); + it('should not invoke metadata-export script', () => { + expect(scriptService.invoke).not.toHaveBeenCalled(); }); }); diff --git a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.ts b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.ts index 523c1c592a..f294390ecf 100644 --- a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.ts @@ -28,7 +28,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel }) export class ExportMetadataSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit { objectType = DSpaceObjectType.DSPACEOBJECT; - selectorType = DSpaceObjectType.DSPACEOBJECT; + selectorTypes = [DSpaceObjectType.COLLECTION, DSpaceObjectType.COMMUNITY]; action = SelectorActionType.EXPORT_METADATA; constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router, @@ -66,7 +66,6 @@ export class ExportMetadataSelectorComponent extends DSOSelectorModalWrapperComp resp$.subscribe(); return resp$; } else { - this.notificationsService.error(this.translationService.get('dso-selector.export-metadata.notValidDSO')); return observableOf(false); } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-constants.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-constants.ts new file mode 100644 index 0000000000..d3cdad290f --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-constants.ts @@ -0,0 +1,2 @@ +export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION'; +export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#'; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts index 0064c2e093..f03050155b 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts @@ -76,7 +76,6 @@ import { DsDynamicLookupComponent } from './models/lookup/dynamic-lookup.compone import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component'; import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-array.component'; import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components'; -import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './models/relation-group/dynamic-relation-group.model'; import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component'; import { DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH } from './models/custom-switch/custom-switch.model'; import { CustomSwitchComponent } from './models/custom-switch/custom-switch.component'; @@ -110,6 +109,7 @@ import { followLink } from '../../../utils/follow-link-config.model'; import { paginatedRelationsToItems } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils'; import { RelationshipOptions } from '../models/relationship-options.model'; import { FormBuilderService } from '../form-builder.service'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-constants'; export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type | null { switch (model.type) { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.ts index 11085a1bc3..e7a519e2b4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.ts @@ -23,7 +23,7 @@ import { } from '@ng-dynamic-forms/core'; import { isEqual, isObject } from 'lodash'; -import { DynamicRelationGroupModel, PLACEHOLDER_PARENT_METADATA } from './dynamic-relation-group.model'; +import { DynamicRelationGroupModel} from './dynamic-relation-group.model'; import { FormBuilderService } from '../../../form-builder.service'; import { SubmissionFormsModel } from '../../../../../../core/config/models/config-submission-forms.model'; import { FormService } from '../../../../form.service'; @@ -39,6 +39,7 @@ import { IntegrationData } from '../../../../../../core/integration/integration- import { FormFieldMetadataValueObject } from '../../../models/form-field-metadata-value.model'; import { AuthorityValue } from '../../../../../../core/integration/models/authority.value'; import { environment } from '../../../../../../../environments/environment'; +import { PLACEHOLDER_PARENT_METADATA } from '../../ds-dynamic-form-constants'; @Component({ selector: 'ds-dynamic-relation-group', diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts index c1f76f0431..afa03a8e4e 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.ts @@ -2,9 +2,7 @@ import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core'; import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model'; import { isEmpty, isNull } from '../../../../../empty.util'; import { FormRowModel } from '../../../../../../core/config/models/config-submission-form.model'; - -export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION'; -export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from '../../ds-dynamic-form-constants'; /** * Dynamic Group Model configuration interface diff --git a/src/app/shared/form/builder/form-builder.service.ts b/src/app/shared/form/builder/form-builder.service.ts index 1ca0a2748c..8703a3af51 100644 --- a/src/app/shared/form/builder/form-builder.service.ts +++ b/src/app/shared/form/builder/form-builder.service.ts @@ -20,11 +20,12 @@ import { DynamicQualdropModel } from './ds-dynamic-form-ui/models/ds-dynamic-qua import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model'; import { DYNAMIC_FORM_CONTROL_TYPE_TAG } from './ds-dynamic-form-ui/models/tag/dynamic-tag.model'; import { RowParser } from './parsers/row-parser'; -import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP, DynamicRelationGroupModel } from './ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { DynamicRelationGroupModel } from './ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { DynamicRowArrayModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-array-model'; import { DsDynamicInputModel } from './ds-dynamic-form-ui/models/ds-dynamic-input.model'; import { FormFieldMetadataValueObject } from './models/form-field-metadata-value.model'; import { isNgbDateStruct } from '../../date.util'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-ui/ds-dynamic-form-constants'; @Injectable() export class FormBuilderService extends DynamicFormService { diff --git a/src/app/shared/form/builder/models/form-field-metadata-value.model.ts b/src/app/shared/form/builder/models/form-field-metadata-value.model.ts index c0bdb338e3..b537cb54f7 100644 --- a/src/app/shared/form/builder/models/form-field-metadata-value.model.ts +++ b/src/app/shared/form/builder/models/form-field-metadata-value.model.ts @@ -1,7 +1,7 @@ import { hasValue, isEmpty, isNotEmpty, isNotNull } from '../../../empty.util'; import { ConfidenceType } from '../../../../core/integration/models/confidence-type'; -import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { MetadataValueInterface, VIRTUAL_METADATA_PREFIX } from '../../../../core/shared/metadata.models'; +import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/ds-dynamic-form-constants'; export interface OtherInformation { [name: string]: string diff --git a/src/app/shared/form/builder/parsers/relation-group-field-parser.ts b/src/app/shared/form/builder/parsers/relation-group-field-parser.ts index 01699d9e78..cf55c9d665 100644 --- a/src/app/shared/form/builder/parsers/relation-group-field-parser.ts +++ b/src/app/shared/form/builder/parsers/relation-group-field-parser.ts @@ -5,10 +5,10 @@ import { FormFieldModel } from '../models/form-field.model'; import { isNotEmpty } from '../../../empty.util'; import { DynamicRelationGroupModel, - DynamicRelationGroupModelConfig, - PLACEHOLDER_PARENT_METADATA + DynamicRelationGroupModelConfig } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { FormRowModel } from '../../../../core/config/models/config-submission-form.model'; +import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/ds-dynamic-form-constants'; export class RelationGroupFieldParser extends FieldParser { diff --git a/src/app/shared/form/builder/parsers/row-parser.ts b/src/app/shared/form/builder/parsers/row-parser.ts index 4938b9859e..ac20ca1b56 100644 --- a/src/app/shared/form/builder/parsers/row-parser.ts +++ b/src/app/shared/form/builder/parsers/row-parser.ts @@ -8,7 +8,6 @@ import { uniqueId } from 'lodash'; import { IntegrationSearchOptions } from '../../../../core/integration/models/integration-options.model'; import { isEmpty } from '../../../empty.util'; import { DynamicRowGroupModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-group-model'; -import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { FormFieldModel } from '../models/form-field.model'; import { CONFIG_DATA, @@ -21,6 +20,7 @@ import { ParserFactory } from './parser-factory'; import { ParserOptions } from './parser-options'; import { ParserType } from './parser-type'; import { setLayout } from './parser.utils'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from '../ds-dynamic-form-ui/ds-dynamic-form-constants'; export const ROW_ID_PREFIX = 'df-row-group-config-'; diff --git a/src/app/shared/item/item-versions/notice/item-versions-notice.component.ts b/src/app/shared/item/item-versions/notice/item-versions-notice.component.ts index c2bd316137..1494e8c723 100644 --- a/src/app/shared/item/item-versions/notice/item-versions-notice.component.ts +++ b/src/app/shared/item/item-versions/notice/item-versions-notice.component.ts @@ -13,7 +13,7 @@ import { followLink } from '../../../utils/follow-link-config.model'; import { VersionHistoryDataService } from '../../../../core/data/version-history-data.service'; import { AlertType } from '../../../alert/aletr-type'; import { combineLatest as observableCombineLatest } from 'rxjs'; -import { getItemPageRoute } from '../../../../+item-page/item-page-routing.module'; +import { getItemPageRoute } from '../../../../+item-page/item-page-routing-paths'; @Component({ selector: 'ds-item-versions-notice', diff --git a/src/app/shared/log-in/log-in.component.html b/src/app/shared/log-in/log-in.component.html index af76c74a9e..a2af460b05 100644 --- a/src/app/shared/log-in/log-in.component.html +++ b/src/app/shared/log-in/log-in.component.html @@ -8,6 +8,6 @@ - {{"login.form.new-user" | translate}} - {{"login.form.forgot-password" | translate}} + {{"login.form.new-user" | translate}} + {{"login.form.forgot-password" | translate}} diff --git a/src/app/shared/log-in/log-in.component.ts b/src/app/shared/log-in/log-in.component.ts index 9e289af603..7700d7be82 100644 --- a/src/app/shared/log-in/log-in.component.ts +++ b/src/app/shared/log-in/log-in.component.ts @@ -9,7 +9,7 @@ import { isAuthenticationLoading } from '../../core/auth/selectors'; import { CoreState } from '../../core/core.reducers'; -import { getForgotPasswordPath, getRegisterPath } from '../../app-routing.module'; +import { getForgotPasswordRoute, getRegisterRoute } from '../../app-routing-paths'; import { hasValue } from '../empty.util'; import { AuthService } from '../../core/auth/auth.service'; @@ -72,11 +72,11 @@ export class LogInComponent implements OnInit { }); } - getRegisterPath() { - return getRegisterPath(); + getRegisterRoute() { + return getRegisterRoute(); } - getForgotPath() { - return getForgotPasswordPath(); + getForgotRoute() { + return getForgotPasswordRoute(); } } diff --git a/src/app/shared/resource-policies/create/resource-policy-create.component.ts b/src/app/shared/resource-policies/create/resource-policy-create.component.ts index e96533515c..017e67841c 100644 --- a/src/app/shared/resource-policies/create/resource-policy-create.component.ts +++ b/src/app/shared/resource-policies/create/resource-policy-create.component.ts @@ -11,8 +11,8 @@ import { NotificationsService } from '../../notifications/notifications.service' import { RemoteData } from '../../../core/data/remote-data'; import { ResourcePolicy } from '../../../core/resource-policy/models/resource-policy.model'; import { ResourcePolicyEvent } from '../form/resource-policy-form.component'; -import { ITEM_EDIT_AUTHORIZATIONS_PATH } from '../../../+item-page/edit-item-page/edit-item-page.routing.module'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; +import { ITEM_EDIT_AUTHORIZATIONS_PATH } from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; @Component({ selector: 'ds-resource-policy-create', diff --git a/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts b/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts index e3927e7fcd..3c933dc607 100644 --- a/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts +++ b/src/app/shared/resource-policies/edit/resource-policy-edit.component.ts @@ -10,8 +10,8 @@ import { NotificationsService } from '../../notifications/notifications.service' import { RemoteData } from '../../../core/data/remote-data'; import { ResourcePolicy } from '../../../core/resource-policy/models/resource-policy.model'; import { ResourcePolicyEvent } from '../form/resource-policy-form.component'; -import { ITEM_EDIT_AUTHORIZATIONS_PATH } from '../../../+item-page/edit-item-page/edit-item-page.routing.module'; import { RESOURCE_POLICY } from '../../../core/resource-policy/models/resource-policy.resource-type'; +import { ITEM_EDIT_AUTHORIZATIONS_PATH } from '../../../+item-page/edit-item-page/edit-item-page.routing-paths'; @Component({ selector: 'ds-resource-policy-edit', diff --git a/src/app/shared/resource-policies/resource-policies.component.ts b/src/app/shared/resource-policies/resource-policies.component.ts index bf5f584e98..130891ffd1 100644 --- a/src/app/shared/resource-policies/resource-policies.component.ts +++ b/src/app/shared/resource-policies/resource-policies.component.ts @@ -22,9 +22,9 @@ import { RequestService } from '../../core/data/request.service'; import { NotificationsService } from '../notifications/notifications.service'; import { dateToString, stringToNgbDateStruct } from '../date.util'; import { followLink } from '../utils/follow-link-config.model'; -import { ADMIN_MODULE_PATH } from '../../app-routing.module'; -import { ACCESS_CONTROL_MODULE_PATH } from '../../+admin/admin-routing.module'; -import { GROUP_EDIT_PATH } from '../../+admin/admin-access-control/admin-access-control-routing.module'; +import { ADMIN_MODULE_PATH } from '../../app-routing-paths'; +import { GROUP_EDIT_PATH } from '../../+admin/admin-access-control/admin-access-control-routing-paths'; +import { ACCESS_CONTROL_MODULE_PATH } from '../../+admin/admin-routing-paths'; interface ResourcePolicyCheckboxEntry { id: string; diff --git a/src/app/shared/search/paginated-search-options.model.spec.ts b/src/app/shared/search/paginated-search-options.model.spec.ts index 1739fd54fb..c8bef4b721 100644 --- a/src/app/shared/search/paginated-search-options.model.spec.ts +++ b/src/app/shared/search/paginated-search-options.model.spec.ts @@ -13,7 +13,7 @@ describe('PaginatedSearchOptions', () => { const scope = '0fde1ecb-82cc-425a-b600-ac3576d76b47'; const baseUrl = 'www.rest.com'; beforeEach(() => { - options = new PaginatedSearchOptions({sort: sortOptions, pagination: pageOptions, filters: filters, query: query, scope: scope, dsoType: DSpaceObjectType.ITEM}); + options = new PaginatedSearchOptions({sort: sortOptions, pagination: pageOptions, filters: filters, query: query, scope: scope, dsoTypes: [DSpaceObjectType.ITEM]}); }); describe('when toRestUrl is called', () => { diff --git a/src/app/shared/search/paginated-search-options.model.ts b/src/app/shared/search/paginated-search-options.model.ts index 13ab4cabea..950b207c3a 100644 --- a/src/app/shared/search/paginated-search-options.model.ts +++ b/src/app/shared/search/paginated-search-options.model.ts @@ -12,7 +12,7 @@ export class PaginatedSearchOptions extends SearchOptions { pagination?: PaginationComponentOptions; sort?: SortOptions; - constructor(options: {configuration?: string, scope?: string, query?: string, dsoType?: DSpaceObjectType, filters?: SearchFilter[], fixedFilter?: any, pagination?: PaginationComponentOptions, sort?: SortOptions}) { + constructor(options: {configuration?: string, scope?: string, query?: string, dsoTypes?: DSpaceObjectType[], filters?: SearchFilter[], fixedFilter?: any, pagination?: PaginationComponentOptions, sort?: SortOptions}) { super(options); this.pagination = options.pagination; this.sort = options.sort; diff --git a/src/app/shared/search/search-options.model.spec.ts b/src/app/shared/search/search-options.model.spec.ts index 3195ec3660..7982eba6d3 100644 --- a/src/app/shared/search/search-options.model.spec.ts +++ b/src/app/shared/search/search-options.model.spec.ts @@ -10,7 +10,7 @@ describe('SearchOptions', () => { const scope = '0fde1ecb-82cc-425a-b600-ac3576d76b47'; const baseUrl = 'www.rest.com'; beforeEach(() => { - options = new SearchOptions({ filters: filters, query: query, scope: scope , dsoType: DSpaceObjectType.ITEM}); + options = new SearchOptions({ filters: filters, query: query, scope: scope , dsoTypes: [DSpaceObjectType.ITEM]}); }); describe('when toRestUrl is called', () => { diff --git a/src/app/shared/search/search-options.model.ts b/src/app/shared/search/search-options.model.ts index 7d5f4dd207..387ae6a517 100644 --- a/src/app/shared/search/search-options.model.ts +++ b/src/app/shared/search/search-options.model.ts @@ -12,15 +12,15 @@ export class SearchOptions { view?: ViewMode = ViewMode.ListElement; scope?: string; query?: string; - dsoType?: DSpaceObjectType; + dsoTypes?: DSpaceObjectType[]; filters?: any; fixedFilter?: any; - constructor(options: {configuration?: string, scope?: string, query?: string, dsoType?: DSpaceObjectType, filters?: SearchFilter[], fixedFilter?: any}) { + constructor(options: {configuration?: string, scope?: string, query?: string, dsoTypes?: DSpaceObjectType[], filters?: SearchFilter[], fixedFilter?: any}) { this.configuration = options.configuration; this.scope = options.scope; this.query = options.query; - this.dsoType = options.dsoType; + this.dsoTypes = options.dsoTypes; this.filters = options.filters; this.fixedFilter = options.fixedFilter; } @@ -44,8 +44,10 @@ export class SearchOptions { if (isNotEmpty(this.scope)) { args.push(`scope=${this.scope}`); } - if (isNotEmpty(this.dsoType)) { - args.push(`dsoType=${this.dsoType}`); + if (isNotEmpty(this.dsoTypes)) { + this.dsoTypes.forEach((dsoType: string) => { + args.push(`dsoType=${dsoType}`); + }) } if (isNotEmpty(this.filters)) { this.filters.forEach((filter: SearchFilter) => { diff --git a/src/app/statistics/statistics.service.spec.ts b/src/app/statistics/statistics.service.spec.ts index e508d25ded..2ca80f9b07 100644 --- a/src/app/statistics/statistics.service.spec.ts +++ b/src/app/statistics/statistics.service.spec.ts @@ -82,7 +82,7 @@ describe('StatisticsService', () => { const mockSearch: any = new SearchOptions({ query: 'mock-query', configuration: 'mock-configuration', - dsoType: DSpaceObjectType.ITEM, + dsoTypes: [DSpaceObjectType.ITEM], scope: 'mock-scope' }); diff --git a/src/app/statistics/statistics.service.ts b/src/app/statistics/statistics.service.ts index 004e013164..20d1ebd3fe 100644 --- a/src/app/statistics/statistics.service.ts +++ b/src/app/statistics/statistics.service.ts @@ -68,8 +68,8 @@ export class StatisticsService { if (hasValue(searchOptions.configuration)) { Object.assign(body, { configuration: searchOptions.configuration }) } - if (hasValue(searchOptions.dsoType)) { - Object.assign(body, { dsoType: searchOptions.dsoType.toLowerCase() }) + if (isNotEmpty(searchOptions.dsoTypes)) { + Object.assign(body, { dsoType: searchOptions.dsoTypes[0].toLowerCase() }) } if (hasValue(searchOptions.scope)) { Object.assign(body, { scope: searchOptions.scope }) diff --git a/src/app/submission/sections/upload/section-upload.component.html b/src/app/submission/sections/upload/section-upload.component.html index d63bc1b7d6..f07c524b8a 100644 --- a/src/app/submission/sections/upload/section-upload.component.html +++ b/src/app/submission/sections/upload/section-upload.component.html @@ -36,7 +36,7 @@ [fileId]="fileIndexes[fileList.indexOf(fileEntry)]" [fileIndex]="fileList.indexOf(fileEntry)" [fileName]="fileNames[fileList.indexOf(fileEntry)]" - [sectionId]="'upload'" + [sectionId]="sectionData.id" [submissionId]="submissionId">
diff --git a/src/app/submission/sections/upload/section-upload.component.spec.ts b/src/app/submission/sections/upload/section-upload.component.spec.ts index 42fb700ad7..cbf3209d8a 100644 --- a/src/app/submission/sections/upload/section-upload.component.spec.ts +++ b/src/app/submission/sections/upload/section-upload.component.spec.ts @@ -97,7 +97,7 @@ describe('SubmissionSectionUploadComponent test suite', () => { }, errors: [], header: 'submit.progressbar.describe.upload', - id: 'upload', + id: 'upload-id', sectionType: SectionsType.Upload }; submissionId = mockSubmissionId; diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 4c732be1e3..e9f7bb37f0 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -989,8 +989,6 @@ "dso-selector.export-metadata.dspaceobject.head": "Export metadata from", - "dso-selector.export-metadata.notValidDSO": "You can only export metadata for collections and communities", - "dso-selector.no-results": "No {{ type }} found", "dso-selector.placeholder": "Search for a {{ type }}",