mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge pull request #850 from atmire/remove-cirular-dependencies
Remove circular dependencies
This commit is contained in:
@@ -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();
|
||||
}
|
@@ -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: [
|
||||
|
@@ -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();
|
||||
}
|
@@ -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: [
|
||||
|
@@ -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'),
|
||||
|
@@ -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');
|
||||
|
@@ -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()]);
|
||||
}
|
||||
}
|
||||
|
13
src/app/+admin/admin-routing-paths.ts
Normal file
13
src/app/+admin/admin-routing-paths.ts
Normal file
@@ -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();
|
||||
}
|
@@ -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: [
|
||||
|
@@ -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));
|
||||
})
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
})
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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';
|
||||
|
@@ -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));
|
||||
})
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
})
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -1,27 +1,27 @@
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 edit-link" [routerLink]="[getEditPath()]" [title]="'admin.search.item.edit' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 edit-link" [routerLink]="[getEditRoute()]" [title]="'admin.search.item.edit' | translate">
|
||||
<i class="fa fa-edit"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.edit" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && !item.isWithdrawn" class="btn btn-light my-1 withdraw-link" [routerLink]="[getWithdrawPath()]" [title]="'admin.search.item.withdraw' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && !item.isWithdrawn" class="btn btn-light my-1 withdraw-link" [routerLink]="[getWithdrawRoute()]" [title]="'admin.search.item.withdraw' | translate">
|
||||
<i class="fa fa-ban"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.withdraw" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && item.isWithdrawn" class="btn btn-light my-1 reinstate-link" [routerLink]="[getReinstatePath()]" [title]="'admin.search.item.reinstate' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && item.isWithdrawn" class="btn btn-light my-1 reinstate-link" [routerLink]="[getReinstateRoute()]" [title]="'admin.search.item.reinstate' | translate">
|
||||
<i class="fa fa-undo"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.reinstate" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && item.isDiscoverable" class="btn btn-light my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && item.isDiscoverable" class="btn btn-light my-1 private-link" [routerLink]="[getPrivateRoute()]" [title]="'admin.search.item.make-private' | translate">
|
||||
<i class="fa fa-eye-slash"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.make-private" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && !item.isDiscoverable" class="btn btn-light my-1 public-link" [routerLink]="[getPublicPath()]" [title]="'admin.search.item.make-public' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" *ngIf="item && !item.isDiscoverable" class="btn btn-light my-1 public-link" [routerLink]="[getPublicRoute()]" [title]="'admin.search.item.make-public' | translate">
|
||||
<i class="fa fa-eye"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.make-public" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 delete-link" [routerLink]="[getDeletePath()]" [title]="'admin.search.item.delete' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 delete-link" [routerLink]="[getDeleteRoute()]" [title]="'admin.search.item.delete' | translate">
|
||||
<i class="fa fa-trash"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.delete" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 move-link" [routerLink]="[getMovePath()]" [title]="'admin.search.item.move' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 move-link" [routerLink]="[getMoveRoute()]" [title]="'admin.search.item.move' | translate">
|
||||
<i class="fa fa-arrow-circle-right"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.move" | translate}}</span>
|
||||
</a>
|
||||
|
@@ -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());
|
||||
});
|
||||
})
|
||||
});
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 delete-link" [routerLink]="[getDeletePath()]" [title]="'admin.workflow.item.delete' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 delete-link" [routerLink]="[getDeleteRoute()]" [title]="'admin.workflow.item.delete' | translate">
|
||||
<i class="fa fa-trash"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.workflow.item.delete" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 send-back-link" [routerLink]="[getSendBackPath()]" [title]="'admin.workflow.item.send-back' | translate">
|
||||
<a [ngClass]="{'btn-sm': small}" class="btn btn-light my-1 send-back-link" [routerLink]="[getSendBackRoute()]" [title]="'admin.workflow.item.send-back' | translate">
|
||||
<i class="fa fa-hand-point-left"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.workflow.item.send-back" | translate}}</span>
|
||||
</a>
|
||||
|
@@ -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());
|
||||
});
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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) };
|
||||
})
|
||||
);
|
||||
}
|
||||
|
25
src/app/+collection-page/collection-page-routing-paths.ts
Normal file
25
src/app/+collection-page/collection-page-routing-paths.ts
Normal file
@@ -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';
|
@@ -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';
|
||||
@@ -16,24 +14,11 @@ import { CollectionBreadcrumbResolver } from '../core/breadcrumbs/collection-bre
|
||||
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
|
||||
import { LinkService } from '../core/cache/builders/link.service';
|
||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
|
||||
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: [
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -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 '';
|
||||
}
|
||||
|
24
src/app/+community-page/community-page-routing-paths.ts
Normal file
24
src/app/+community-page/community-page-routing-paths.ts
Normal file
@@ -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';
|
@@ -7,28 +7,10 @@ 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';
|
||||
|
||||
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: [
|
||||
|
@@ -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
|
||||
|
@@ -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']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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',
|
||||
|
@@ -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';
|
@@ -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
|
||||
|
@@ -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<ItemDeleteComponent>;
|
||||
@@ -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')]);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
@@ -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)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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',
|
||||
@@ -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 {
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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)]);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -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)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
18
src/app/+item-page/item-page-routing-paths.ts
Normal file
18
src/app/+item-page/item-page-routing-paths.ts
Normal file
@@ -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';
|
@@ -4,24 +4,12 @@ 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';
|
||||
|
||||
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: [
|
||||
|
@@ -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';
|
@@ -3,31 +3,14 @@ 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';
|
||||
|
||||
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: [
|
||||
|
62
src/app/app-routing-paths.ts
Normal file
62
src/app/app-routing-paths.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
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}`;
|
||||
}
|
@@ -3,86 +3,20 @@ import { RouterModule } from '@angular/router';
|
||||
|
||||
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';
|
||||
|
||||
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}`;
|
||||
}
|
||||
import {
|
||||
UNAUTHORIZED_PATH,
|
||||
WORKFLOW_ITEM_MODULE_PATH,
|
||||
FORGOT_PASSWORD_PATH,
|
||||
REGISTER_PATH,
|
||||
PROFILE_MODULE_PATH,
|
||||
ADMIN_MODULE_PATH,
|
||||
BITSTREAM_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';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -13,11 +13,11 @@ import { PageInfo } from '../core/shared/page-info.model';
|
||||
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||
import { RemoteData } from '../core/data/remote-data';
|
||||
import { PaginatedList } from '../core/data/paginated-list';
|
||||
import { getCommunityPageRoute } from '../+community-page/community-page-routing.module';
|
||||
import { getCollectionPageRoute } from '../+collection-page/collection-page-routing.module';
|
||||
import { CollectionDataService } from '../core/data/collection-data.service';
|
||||
import { CommunityListSaveAction } from './community-list.actions';
|
||||
import { CommunityListState } from './community-list.reducer';
|
||||
import { getCommunityPageRoute } from '../+community-page/community-page-routing-paths';
|
||||
import { getCollectionPageRoute } from '../+collection-page/collection-page-routing-paths';
|
||||
|
||||
/**
|
||||
* Each node in the tree is represented by a flatNode which contains info about the node itself and its position and
|
||||
|
@@ -10,8 +10,8 @@ import { Community } from '../shared/community.model';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
import { getDSOPath } from '../../app-routing.module';
|
||||
import { DSONameService } from './dso-name.service';
|
||||
import { getDSORoute } from '../../app-routing-paths';
|
||||
|
||||
describe('DSOBreadcrumbsService', () => {
|
||||
let service: DSOBreadcrumbsService;
|
||||
@@ -108,9 +108,9 @@ describe('DSOBreadcrumbsService', () => {
|
||||
it('should return the breadcrumbs based on an Item', () => {
|
||||
const breadcrumbs = service.getBreadcrumbs(testItem, testItem._links.self);
|
||||
const expectedCrumbs = [
|
||||
new Breadcrumb(getName(testCommunity), getDSOPath(testCommunity)),
|
||||
new Breadcrumb(getName(testCollection), getDSOPath(testCollection)),
|
||||
new Breadcrumb(getName(testItem), getDSOPath(testItem)),
|
||||
new Breadcrumb(getName(testCommunity), getDSORoute(testCommunity)),
|
||||
new Breadcrumb(getName(testCollection), getDSORoute(testCollection)),
|
||||
new Breadcrumb(getName(testItem), getDSORoute(testItem)),
|
||||
];
|
||||
getTestScheduler().expectObservable(breadcrumbs).toBe('(a|)', { a: expectedCrumbs });
|
||||
})
|
||||
|
@@ -7,10 +7,10 @@ import { LinkService } from '../cache/builders/link.service';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { find, map, switchMap } from 'rxjs/operators';
|
||||
import { getDSOPath } from '../../app-routing.module';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { getDSORoute } from '../../app-routing-paths';
|
||||
|
||||
/**
|
||||
* Service to calculate DSpaceObject breadcrumbs for a single part of the route
|
||||
@@ -41,7 +41,7 @@ export class DSOBreadcrumbsService implements BreadcrumbsService<ChildHALResourc
|
||||
switchMap((parentRD: RemoteData<ChildHALResource & DSpaceObject>) => {
|
||||
if (hasValue(parentRD.payload)) {
|
||||
const parent = parentRD.payload;
|
||||
return this.getBreadcrumbs(parent, getDSOPath(parent))
|
||||
return this.getBreadcrumbs(parent, getDSORoute(parent))
|
||||
}
|
||||
return observableOf([]);
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
||||
import { isNotEmpty } from '../../../shared/empty.util';
|
||||
import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||
import { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||
import { typedObject } from '../../cache/builders/build-decorators';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { MetadataValueInterface } from '../../shared/metadata.models';
|
||||
import { AUTHORITY_VALUE } from './authority.resource-type';
|
||||
import { IntegrationModel } from './integration.model';
|
||||
import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-constants';
|
||||
|
||||
/**
|
||||
* Class representing an authority object
|
||||
|
@@ -11,7 +11,7 @@ import { RequestEntry } from '../data/request.reducer';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { BrowseDefinition } from './browse-definition.model';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { getUnauthorizedPath } from '../../app-routing.module';
|
||||
import { getUnauthorizedRoute } from '../../app-routing-paths';
|
||||
|
||||
/**
|
||||
* This file contains custom RxJS operators that can be used in multiple places
|
||||
@@ -189,7 +189,7 @@ export const returnUnauthorizedUrlTreeOnFalse = (router: Router) =>
|
||||
(source: Observable<boolean>): Observable<boolean | UrlTree> =>
|
||||
source.pipe(
|
||||
map((authorized: boolean) => {
|
||||
return authorized ? authorized : router.parseUrl(getUnauthorizedPath())
|
||||
return authorized ? authorized : router.parseUrl(getUnauthorizedRoute())
|
||||
}));
|
||||
|
||||
export const getFinishedRemoteData = () =>
|
||||
|
@@ -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<AppState>,
|
||||
private authService: AuthService) {
|
||||
|
@@ -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;
|
||||
|
@@ -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<ChipsItem[]>;
|
||||
|
@@ -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<string> {
|
||||
return this.group$.pipe(
|
||||
map((group) => getGroupEditPath(group.id)),
|
||||
map((group) => getGroupEditRoute(group.id)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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 { Community } from '../../../../core/shared/community.model';
|
||||
import { CreateCollectionParentSelectorComponent } from './create-collection-parent-selector.component';
|
||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||
@@ -59,7 +59,7 @@ describe('CreateCollectionParentSelectorComponent', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
spyOnProperty(collectionRouter, 'getCollectionCreatePath').and.callFake(() => {
|
||||
spyOnProperty(collectionRouterPaths, 'getCollectionCreateRoute').and.callFake(() => {
|
||||
return () => createPath;
|
||||
});
|
||||
|
||||
|
@@ -3,11 +3,11 @@ import { ActivatedRoute, NavigationExtras, 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 {
|
||||
COLLECTION_PARENT_PARAMETER,
|
||||
getCollectionCreatePath
|
||||
} from '../../../../+collection-page/collection-page-routing.module';
|
||||
import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component';
|
||||
import {
|
||||
getCollectionCreateRoute,
|
||||
COLLECTION_PARENT_PARAMETER
|
||||
} from '../../../../+collection-page/collection-page-routing-paths';
|
||||
|
||||
/**
|
||||
* Component to wrap a list of existing communities inside a modal
|
||||
@@ -36,6 +36,6 @@ export class CreateCollectionParentSelectorComponent extends DSOSelectorModalWra
|
||||
[COLLECTION_PARENT_PARAMETER]: dso.uuid,
|
||||
}
|
||||
};
|
||||
this.router.navigate([getCollectionCreatePath()], navigationExtras);
|
||||
this.router.navigate([getCollectionCreateRoute()], navigationExtras);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
});
|
||||
|
||||
|
@@ -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 -
|
||||
@@ -46,6 +46,6 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap
|
||||
}
|
||||
};
|
||||
}
|
||||
this.router.navigate([getCommunityCreatePath()], navigationExtras);
|
||||
this.router.navigate([getCommunityCreateRoute()], navigationExtras);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
});
|
||||
|
||||
|
@@ -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
|
||||
@@ -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)]);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
});
|
||||
|
||||
|
@@ -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
|
||||
@@ -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)]);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
});
|
||||
|
||||
|
@@ -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
|
||||
@@ -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)]);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,2 @@
|
||||
export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION';
|
||||
export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#';
|
@@ -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<DynamicFormControl> | null {
|
||||
switch (model.type) {
|
||||
|
@@ -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',
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
||||
|
@@ -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-';
|
||||
|
||||
|
@@ -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',
|
||||
|
@@ -8,6 +8,6 @@
|
||||
</ng-container>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" [routerLink]="[getRegisterPath()]">{{"login.form.new-user" | translate}}</a>
|
||||
<a class="dropdown-item" [routerLink]="[getForgotPath()]">{{"login.form.forgot-password" | translate}}</a>
|
||||
<a class="dropdown-item" [routerLink]="[getRegisterRoute()]">{{"login.form.new-user" | translate}}</a>
|
||||
<a class="dropdown-item" [routerLink]="[getForgotRoute()]">{{"login.form.forgot-password" | translate}}</a>
|
||||
</div>
|
||||
|
@@ -8,7 +8,7 @@ import { AuthMethod } from '../../core/auth/models/auth.method';
|
||||
import { getAuthenticationMethods, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors';
|
||||
import { CoreState } from '../../core/core.reducers';
|
||||
import { AuthService } from '../../core/auth/auth.service';
|
||||
import { getForgotPasswordPath, getRegisterPath } from '../../app-routing.module';
|
||||
import { getForgotPasswordRoute, getRegisterRoute } from '../../app-routing-paths';
|
||||
|
||||
/**
|
||||
* /users/sign-in
|
||||
@@ -83,11 +83,11 @@ export class LogInComponent implements OnInit, OnDestroy {
|
||||
this.alive = false;
|
||||
}
|
||||
|
||||
getRegisterPath() {
|
||||
return getRegisterPath();
|
||||
getRegisterRoute() {
|
||||
return getRegisterRoute();
|
||||
}
|
||||
|
||||
getForgotPath() {
|
||||
return getForgotPasswordPath();
|
||||
getForgotRoute() {
|
||||
return getForgotPasswordRoute();
|
||||
}
|
||||
}
|
||||
|
@@ -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',
|
||||
|
@@ -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',
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user