mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge branch 'w2p-72699_Hard-redirect-after-log-in' into w2p-72541_User-agreement-and-Privacy-statement
Conflicts: src/app/+collection-page/collection-page-routing.module.ts src/app/+community-page/community-page-routing.module.ts src/app/+item-page/item-page-routing.module.ts src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.ts src/app/app-routing.module.ts src/app/core/shared/operators.ts
This commit is contained in:
25
.github/workflows/label_merge_conflicts.yml
vendored
Normal file
25
.github/workflows/label_merge_conflicts.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# This workflow checks open PRs for merge conflicts and labels them when conflicts are found
|
||||||
|
name: Check for merge conflicts
|
||||||
|
|
||||||
|
# Run whenever the "main" branch is updated
|
||||||
|
# NOTE: This means merge conflicts are only checked for when a PR is merged to main.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
triage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# See: https://github.com/mschilde/auto-label-merge-conflicts/
|
||||||
|
- name: Auto-label PRs with merge conflicts
|
||||||
|
uses: mschilde/auto-label-merge-conflicts@v2.0
|
||||||
|
# Add "merge conflict" label if a merge conflict is detected. Remove it when resolved.
|
||||||
|
# Note, the authentication token is created automatically
|
||||||
|
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
|
||||||
|
with:
|
||||||
|
CONFLICT_LABEL_NAME: 'merge conflict'
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# Ignore errors
|
||||||
|
continue-on-error: true
|
@@ -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 { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
||||||
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
||||||
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
||||||
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
import { GROUP_EDIT_PATH } from './admin-access-control-routing-paths';
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@@ -7,87 +7,88 @@
|
|||||||
<ds-eperson-form *ngIf="isEPersonFormShown" (submitForm)="forceUpdateEPeople()"
|
<ds-eperson-form *ngIf="isEPersonFormShown" (submitForm)="forceUpdateEPeople()"
|
||||||
(cancelForm)="isEPersonFormShown = false"></ds-eperson-form>
|
(cancelForm)="isEPersonFormShown = false"></ds-eperson-form>
|
||||||
|
|
||||||
<div *ngIf="!isEPersonFormShown" class="button-row top d-flex pb-2">
|
<div *ngIf="!isEPersonFormShown">
|
||||||
<button class="mr-auto btn btn-success addEPerson-button"
|
<div class="button-row top d-flex pb-2">
|
||||||
(click)="isEPersonFormShown = true">
|
<button class="mr-auto btn btn-success addEPerson-button"
|
||||||
<i class="fas fa-plus"></i>
|
(click)="isEPersonFormShown = true">
|
||||||
<span class="d-none d-sm-inline">{{labelPrefix + 'button.add' | translate}}</span>
|
<i class="fas fa-plus"></i>
|
||||||
</button>
|
<span class="d-none d-sm-inline">{{labelPrefix + 'button.add' | translate}}</span>
|
||||||
</div>
|
</button>
|
||||||
|
|
||||||
<h3 id="search" class="border-bottom pb-2">{{labelPrefix + 'search.head' | translate}}
|
|
||||||
<button (click)="clearFormAndResetResult();"
|
|
||||||
class="btn btn-primary float-right">{{labelPrefix + 'button.see-all' | translate}}</button>
|
|
||||||
</h3>
|
|
||||||
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="row">
|
|
||||||
<div class="col-12 col-sm-3">
|
|
||||||
<select name="scope" id="scope" formControlName="scope" class="form-control" aria-label="Search scope">
|
|
||||||
<option value="metadata">{{labelPrefix + 'search.scope.metadata' | translate}}</option>
|
|
||||||
<option value="email">{{labelPrefix + 'search.scope.email' | translate}}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-9 col-12">
|
|
||||||
<div class="form-group input-group">
|
<h3 id="search" class="border-bottom pb-2">{{labelPrefix + 'search.head' | translate}}
|
||||||
<input type="text" name="query" id="query" formControlName="query"
|
<button (click)="clearFormAndResetResult();"
|
||||||
class="form-control" aria-label="Search input">
|
class="btn btn-primary float-right">{{labelPrefix + 'button.see-all' | translate}}</button>
|
||||||
<span class="input-group-append">
|
</h3>
|
||||||
<button type="submit"
|
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="row">
|
||||||
class="search-button btn btn-secondary">{{ labelPrefix + 'search.button' | translate }}</button>
|
<div class="col-12 col-sm-3">
|
||||||
</span>
|
<select name="scope" id="scope" formControlName="scope" class="form-control" aria-label="Search scope">
|
||||||
|
<option value="metadata">{{labelPrefix + 'search.scope.metadata' | translate}}</option>
|
||||||
|
<option value="email">{{labelPrefix + 'search.scope.email' | translate}}</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-9 col-12">
|
||||||
|
<div class="form-group input-group">
|
||||||
|
<input type="text" name="query" id="query" formControlName="query"
|
||||||
|
class="form-control" aria-label="Search input">
|
||||||
|
<span class="input-group-append">
|
||||||
|
<button type="submit"
|
||||||
|
class="search-button btn btn-secondary">{{ labelPrefix + 'search.button' | translate }}</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<ds-pagination
|
||||||
|
*ngIf="(ePeople | async)?.payload?.totalElements > 0"
|
||||||
|
[paginationOptions]="config"
|
||||||
|
[pageInfoState]="(ePeople | async)?.payload"
|
||||||
|
[collectionSize]="(ePeople | async)?.payload?.totalElements"
|
||||||
|
[hideGear]="true"
|
||||||
|
[hidePagerWhenSinglePage]="true"
|
||||||
|
(pageChange)="onPageChange($event)">
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="epeople" class="table table-striped table-hover table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">{{labelPrefix + 'table.id' | translate}}</th>
|
||||||
|
<th scope="col">{{labelPrefix + 'table.name' | translate}}</th>
|
||||||
|
<th scope="col">{{labelPrefix + 'table.email' | translate}}</th>
|
||||||
|
<th>{{labelPrefix + 'table.edit' | translate}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let eperson of (ePeople | async)?.payload?.page"
|
||||||
|
[ngClass]="{'table-primary' : isActive(eperson) | async}">
|
||||||
|
<td>{{eperson.id}}</td>
|
||||||
|
<td>{{eperson.name}}</td>
|
||||||
|
<td>{{eperson.email}}</td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group edit-field">
|
||||||
|
<button (click)="toggleEditEPerson(eperson)"
|
||||||
|
class="btn btn-outline-primary btn-sm access-control-editEPersonButton"
|
||||||
|
title="{{labelPrefix + 'table.edit.buttons.edit' | translate: {name: eperson.name} }}">
|
||||||
|
<i class="fas fa-edit fa-fw"></i>
|
||||||
|
</button>
|
||||||
|
<button (click)="deleteEPerson(eperson)"
|
||||||
|
class="btn btn-outline-danger btn-sm access-control-deleteEPersonButton"
|
||||||
|
title="{{labelPrefix + 'table.edit.buttons.remove' | translate: {name: eperson.name} }}">
|
||||||
|
<i class="fas fa-trash-alt fa-fw"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ds-pagination>
|
||||||
|
|
||||||
|
<div *ngIf="(ePeople | async)?.payload?.totalElements == 0" class="alert alert-info w-100 mb-2" role="alert">
|
||||||
|
{{labelPrefix + 'no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
|
|
||||||
<ds-pagination
|
|
||||||
*ngIf="(ePeople | async)?.payload?.totalElements > 0"
|
|
||||||
[paginationOptions]="config"
|
|
||||||
[pageInfoState]="(ePeople | async)?.payload"
|
|
||||||
[collectionSize]="(ePeople | async)?.payload?.totalElements"
|
|
||||||
[hideGear]="true"
|
|
||||||
[hidePagerWhenSinglePage]="true"
|
|
||||||
(pageChange)="onPageChange($event)">
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table id="epeople" class="table table-striped table-hover table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">{{labelPrefix + 'table.id' | translate}}</th>
|
|
||||||
<th scope="col">{{labelPrefix + 'table.name' | translate}}</th>
|
|
||||||
<th scope="col">{{labelPrefix + 'table.email' | translate}}</th>
|
|
||||||
<th>{{labelPrefix + 'table.edit' | translate}}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr *ngFor="let eperson of (ePeople | async)?.payload?.page"
|
|
||||||
[ngClass]="{'table-primary' : isActive(eperson) | async}">
|
|
||||||
<td>{{eperson.id}}</td>
|
|
||||||
<td>{{eperson.name}}</td>
|
|
||||||
<td>{{eperson.email}}</td>
|
|
||||||
<td>
|
|
||||||
<div class="btn-group edit-field">
|
|
||||||
<button (click)="toggleEditEPerson(eperson)"
|
|
||||||
class="btn btn-outline-primary btn-sm access-control-editEPersonButton"
|
|
||||||
title="{{labelPrefix + 'table.edit.buttons.edit' | translate: {name: eperson.name} }}">
|
|
||||||
<i class="fas fa-edit fa-fw"></i>
|
|
||||||
</button>
|
|
||||||
<button (click)="deleteEPerson(eperson)"
|
|
||||||
class="btn btn-outline-danger btn-sm access-control-deleteEPersonButton"
|
|
||||||
title="{{labelPrefix + 'table.edit.buttons.remove' | translate: {name: eperson.name} }}">
|
|
||||||
<i class="fas fa-trash-alt fa-fw"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</ds-pagination>
|
|
||||||
|
|
||||||
<div *ngIf="(ePeople | async)?.payload?.totalElements == 0" class="alert alert-info w-100 mb-2" role="alert">
|
|
||||||
{{labelPrefix + 'no-items' | translate}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -175,7 +175,7 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
it('editEPerson form is toggled', () => {
|
it('editEPerson form is toggled', () => {
|
||||||
const ePeopleIds = fixture.debugElement.queryAll(By.css('#epeople tr td:first-child'));
|
const ePeopleIds = fixture.debugElement.queryAll(By.css('#epeople tr td:first-child'));
|
||||||
ePersonDataServiceStub.getActiveEPerson().subscribe((activeEPerson: EPerson) => {
|
ePersonDataServiceStub.getActiveEPerson().subscribe((activeEPerson: EPerson) => {
|
||||||
if (activeEPerson === ePeopleIds[0].nativeElement.textContent) {
|
if (ePeopleIds[0] && activeEPerson === ePeopleIds[0].nativeElement.textContent) {
|
||||||
expect(component.isEPersonFormShown).toEqual(false);
|
expect(component.isEPersonFormShown).toEqual(false);
|
||||||
} else {
|
} else {
|
||||||
expect(component.isEPersonFormShown).toEqual(true);
|
expect(component.isEPersonFormShown).toEqual(true);
|
||||||
@@ -183,6 +183,10 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('EPerson search section is hidden', () => {
|
||||||
|
expect(fixture.debugElement.query(By.css('#search'))).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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 { RouterModule } from '@angular/router';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
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';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
||||||
const BITSTREAMFORMATS_MODULE_PATH = 'bitstream-formats';
|
|
||||||
|
|
||||||
export function getBitstreamFormatsModulePath() {
|
|
||||||
return new URLCombiner(getRegistriesModulePath(), BITSTREAMFORMATS_MODULE_PATH).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@@ -5,8 +5,8 @@ import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'
|
|||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { RestResponse } from '../../../../core/cache/response.models';
|
import { RestResponse } from '../../../../core/cache/response.models';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders the page to create a new bitstream format.
|
* This component renders the page to create a new bitstream format.
|
||||||
@@ -37,7 +37,7 @@ export class AddBitstreamFormatComponent {
|
|||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.create.success.head'),
|
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.create.success.head'),
|
||||||
this.translateService.get('admin.registries.bitstream-formats.create.success.content'));
|
this.translateService.get('admin.registries.bitstream-formats.create.success.content'));
|
||||||
this.router.navigate([getBitstreamFormatsModulePath()]);
|
this.router.navigate([getBitstreamFormatsModuleRoute()]);
|
||||||
this.bitstreamFormatDataService.clearBitStreamFormatRequests().subscribe();
|
this.bitstreamFormatDataService.clearBitStreamFormatRequests().subscribe();
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'),
|
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 { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { RestResponse } from '../../../../core/cache/response.models';
|
import { RestResponse } from '../../../../core/cache/response.models';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders the edit page of a bitstream format.
|
* This component renders the edit page of a bitstream format.
|
||||||
@@ -51,7 +51,7 @@ export class EditBitstreamFormatComponent implements OnInit {
|
|||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.edit.success.head'),
|
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.edit.success.head'),
|
||||||
this.translateService.get('admin.registries.bitstream-formats.edit.success.content'));
|
this.translateService.get('admin.registries.bitstream-formats.edit.success.content'));
|
||||||
this.router.navigate([getBitstreamFormatsModulePath()]);
|
this.router.navigate([getBitstreamFormatsModuleRoute()]);
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
|
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
|
||||||
'admin.registries.bitstream-formats.create.edit.content');
|
'admin.registries.bitstream-formats.create.edit.content');
|
||||||
|
@@ -12,9 +12,9 @@ import {
|
|||||||
DynamicTextAreaModel
|
DynamicTextAreaModel
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { getBitstreamFormatsModulePath } from '../../admin-registries-routing.module';
|
|
||||||
import { hasValue, isEmpty } from '../../../../shared/empty.util';
|
import { hasValue, isEmpty } from '../../../../shared/empty.util';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
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
|
* 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
|
* Cancels the edit/create action of the bitstream format and navigates back to the bitstream format registry
|
||||||
*/
|
*/
|
||||||
onCancel() {
|
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 { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { getAdminModulePath } from '../app-routing.module';
|
|
||||||
import { MetadataImportPageComponent } from './admin-import-metadata-page/metadata-import-page.component';
|
import { MetadataImportPageComponent } from './admin-import-metadata-page/metadata-import-page.component';
|
||||||
import { AdminSearchPageComponent } from './admin-search-page/admin-search-page.component';
|
import { AdminSearchPageComponent } from './admin-search-page/admin-search-page.component';
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component';
|
import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component';
|
||||||
import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.service';
|
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';
|
import { AdminCurationTasksComponent } from './admin-curation-tasks/admin-curation-tasks.component';
|
||||||
|
import { ACCESS_CONTROL_MODULE_PATH, REGISTRIES_MODULE_PATH } from './admin-routing-paths';
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@@ -12,7 +12,7 @@ import { CollectionSearchResult } from '../../../../../shared/object-collection/
|
|||||||
import { Collection } from '../../../../../core/shared/collection.model';
|
import { Collection } from '../../../../../core/shared/collection.model';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
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', () => {
|
describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||||
let component: CollectionAdminSearchResultGridElementComponent;
|
let component: CollectionAdminSearchResultGridElementComponent;
|
||||||
@@ -61,6 +61,6 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
|||||||
it('should render an edit button with the correct link', () => {
|
it('should render an edit button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.edit-link'));
|
const a = fixture.debugElement.query(By.css('a.edit-link'));
|
||||||
const link = a.nativeElement.href;
|
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 { Context } from '../../../../../core/shared/context.model';
|
||||||
import { CollectionSearchResult } from '../../../../../shared/object-collection/shared/collection-search-result.model';
|
import { CollectionSearchResult } from '../../../../../shared/object-collection/shared/collection-search-result.model';
|
||||||
import { Collection } from '../../../../../core/shared/collection.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 { 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)
|
@listableObjectComponent(CollectionSearchResult, ViewMode.GridElement, Context.AdminSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -21,6 +21,6 @@ export class CollectionAdminSearchResultGridElementComponent extends SearchResul
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.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 { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { CommunityAdminSearchResultGridElementComponent } from './community-admin-search-result-grid-element.component';
|
import { CommunityAdminSearchResultGridElementComponent } from './community-admin-search-result-grid-element.component';
|
||||||
import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
|
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 { 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 { 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', () => {
|
describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||||
let component: CommunityAdminSearchResultGridElementComponent;
|
let component: CommunityAdminSearchResultGridElementComponent;
|
||||||
@@ -65,6 +65,6 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
|||||||
it('should render an edit button with the correct link', () => {
|
it('should render an edit button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.edit-link'));
|
const a = fixture.debugElement.query(By.css('a.edit-link'));
|
||||||
const link = a.nativeElement.href;
|
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 { Context } from '../../../../../core/shared/context.model';
|
||||||
import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
|
import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
|
||||||
import { Community } from '../../../../../core/shared/community.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 { 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)
|
@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement, Context.AdminSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -21,6 +21,6 @@ export class CommunityAdminSearchResultGridElementComponent extends SearchResult
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.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 { getListableObjectComponent, listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { Context } from '../../../../../core/shared/context.model';
|
import { Context } from '../../../../../core/shared/context.model';
|
||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.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 { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component';
|
||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.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 { Collection } from '../../../../../core/shared/collection.model';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
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', () => {
|
describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||||
let component: CollectionAdminSearchResultListElementComponent;
|
let component: CollectionAdminSearchResultListElementComponent;
|
||||||
@@ -55,6 +55,6 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
|
|||||||
it('should render an edit button with the correct link', () => {
|
it('should render an edit button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a'));
|
const a = fixture.debugElement.query(By.css('a'));
|
||||||
const link = a.nativeElement.href;
|
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 { 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 { CollectionSearchResult } from '../../../../../shared/object-collection/shared/collection-search-result.model';
|
||||||
import { Collection } from '../../../../../core/shared/collection.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)
|
@listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.AdminSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -21,6 +21,6 @@ export class CollectionAdminSearchResultListElementComponent extends SearchResul
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.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 { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { CommunityAdminSearchResultListElementComponent } from './community-admin-search-result-list-element.component';
|
import { CommunityAdminSearchResultListElementComponent } from './community-admin-search-result-list-element.component';
|
||||||
import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
|
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 { Community } from '../../../../../core/shared/community.model';
|
||||||
|
import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths';
|
||||||
|
|
||||||
describe('CommunityAdminSearchResultListElementComponent', () => {
|
describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||||
let component: CommunityAdminSearchResultListElementComponent;
|
let component: CommunityAdminSearchResultListElementComponent;
|
||||||
@@ -55,6 +55,6 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
|
|||||||
it('should render an edit button with the correct link', () => {
|
it('should render an edit button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a'));
|
const a = fixture.debugElement.query(By.css('a'));
|
||||||
const link = a.nativeElement.href;
|
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 { 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 { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
|
||||||
import { Community } from '../../../../../core/shared/community.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)
|
@listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.AdminSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -21,6 +21,6 @@ export class CommunityAdminSearchResultListElementComponent extends SearchResult
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.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>
|
<i class="fa fa-edit"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.edit" | translate}}</span>
|
||||||
</a>
|
</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>
|
<i class="fa fa-ban"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.withdraw" | translate}}</span>
|
||||||
</a>
|
</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>
|
<i class="fa fa-undo"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.reinstate" | translate}}</span>
|
||||||
</a>
|
</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>
|
<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>
|
||||||
|
|
||||||
<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>
|
<i class="fa fa-eye"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.make-public" | translate}}</span>
|
||||||
</a>
|
</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>
|
<i class="fa fa-trash"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.delete" | translate}}</span>
|
||||||
</a>
|
</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>
|
<i class="fa fa-arrow-circle-right"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.search.item.move" | translate}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
@@ -6,16 +6,16 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { ItemAdminSearchResultActionsComponent } from './item-admin-search-result-actions.component';
|
import { ItemAdminSearchResultActionsComponent } from './item-admin-search-result-actions.component';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
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 {
|
import {
|
||||||
ITEM_EDIT_DELETE_PATH,
|
|
||||||
ITEM_EDIT_MOVE_PATH,
|
ITEM_EDIT_MOVE_PATH,
|
||||||
ITEM_EDIT_PRIVATE_PATH,
|
ITEM_EDIT_DELETE_PATH,
|
||||||
ITEM_EDIT_PUBLIC_PATH,
|
ITEM_EDIT_PUBLIC_PATH,
|
||||||
|
ITEM_EDIT_PRIVATE_PATH,
|
||||||
ITEM_EDIT_REINSTATE_PATH,
|
ITEM_EDIT_REINSTATE_PATH,
|
||||||
ITEM_EDIT_WITHDRAW_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';
|
||||||
import { getItemEditPath } from '../../../+item-page/item-page-routing.module';
|
|
||||||
import { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
|
||||||
|
|
||||||
describe('ItemAdminSearchResultActionsComponent', () => {
|
describe('ItemAdminSearchResultActionsComponent', () => {
|
||||||
let component: ItemAdminSearchResultActionsComponent;
|
let component: ItemAdminSearchResultActionsComponent;
|
||||||
@@ -55,19 +55,19 @@ describe('ItemAdminSearchResultActionsComponent', () => {
|
|||||||
it('should render an edit button with the correct link', () => {
|
it('should render an edit button with the correct link', () => {
|
||||||
const button = fixture.debugElement.query(By.css('a.edit-link'));
|
const button = fixture.debugElement.query(By.css('a.edit-link'));
|
||||||
const link = button.nativeElement.href;
|
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', () => {
|
it('should render a delete button with the correct link', () => {
|
||||||
const button = fixture.debugElement.query(By.css('a.delete-link'));
|
const button = fixture.debugElement.query(By.css('a.delete-link'));
|
||||||
const link = button.nativeElement.href;
|
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', () => {
|
it('should render a move button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.move-link'));
|
const a = fixture.debugElement.query(By.css('a.move-link'));
|
||||||
const link = a.nativeElement.href;
|
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', () => {
|
describe('when the item is not withdrawn', () => {
|
||||||
@@ -79,7 +79,7 @@ describe('ItemAdminSearchResultActionsComponent', () => {
|
|||||||
it('should render a withdraw button with the correct link', () => {
|
it('should render a withdraw button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.withdraw-link'));
|
const a = fixture.debugElement.query(By.css('a.withdraw-link'));
|
||||||
const link = a.nativeElement.href;
|
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', () => {
|
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', () => {
|
it('should render a reinstate button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.reinstate-link'));
|
const a = fixture.debugElement.query(By.css('a.reinstate-link'));
|
||||||
const link = a.nativeElement.href;
|
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', () => {
|
it('should render a make private button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.private-link'));
|
const a = fixture.debugElement.query(By.css('a.private-link'));
|
||||||
const link = a.nativeElement.href;
|
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', () => {
|
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', () => {
|
it('should render a make private button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.public-link'));
|
const a = fixture.debugElement.query(By.css('a.public-link'));
|
||||||
const link = a.nativeElement.href;
|
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 { Component, Input } from '@angular/core';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
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 { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
||||||
|
import { getItemEditRoute } from '../../../+item-page/item-page-routing-paths';
|
||||||
import {
|
import {
|
||||||
ITEM_EDIT_DELETE_PATH,
|
|
||||||
ITEM_EDIT_MOVE_PATH,
|
ITEM_EDIT_MOVE_PATH,
|
||||||
ITEM_EDIT_PRIVATE_PATH,
|
ITEM_EDIT_DELETE_PATH,
|
||||||
ITEM_EDIT_PUBLIC_PATH,
|
ITEM_EDIT_PUBLIC_PATH,
|
||||||
|
ITEM_EDIT_PRIVATE_PATH,
|
||||||
ITEM_EDIT_REINSTATE_PATH,
|
ITEM_EDIT_REINSTATE_PATH,
|
||||||
ITEM_EDIT_WITHDRAW_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({
|
@Component({
|
||||||
selector: 'ds-item-admin-search-result-actions-element',
|
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
|
* Returns the path to the edit page of this item
|
||||||
*/
|
*/
|
||||||
getEditPath(): string {
|
getEditRoute(): string {
|
||||||
return getItemEditPath(this.item.uuid)
|
return getItemEditRoute(this.item.uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path to the move page of this item
|
* Returns the path to the move page of this item
|
||||||
*/
|
*/
|
||||||
getMovePath(): string {
|
getMoveRoute(): string {
|
||||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_MOVE_PATH).toString();
|
return new URLCombiner(this.getEditRoute(), ITEM_EDIT_MOVE_PATH).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path to the delete page of this item
|
* Returns the path to the delete page of this item
|
||||||
*/
|
*/
|
||||||
getDeletePath(): string {
|
getDeleteRoute(): string {
|
||||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_DELETE_PATH).toString();
|
return new URLCombiner(this.getEditRoute(), ITEM_EDIT_DELETE_PATH).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path to the withdraw page of this item
|
* Returns the path to the withdraw page of this item
|
||||||
*/
|
*/
|
||||||
getWithdrawPath(): string {
|
getWithdrawRoute(): string {
|
||||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_WITHDRAW_PATH).toString();
|
return new URLCombiner(this.getEditRoute(), ITEM_EDIT_WITHDRAW_PATH).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path to the reinstate page of this item
|
* Returns the path to the reinstate page of this item
|
||||||
*/
|
*/
|
||||||
getReinstatePath(): string {
|
getReinstateRoute(): string {
|
||||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_REINSTATE_PATH).toString();
|
return new URLCombiner(this.getEditRoute(), ITEM_EDIT_REINSTATE_PATH).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path to the page where the user can make this item private
|
* Returns the path to the page where the user can make this item private
|
||||||
*/
|
*/
|
||||||
getPrivatePath(): string {
|
getPrivateRoute(): string {
|
||||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_PRIVATE_PATH).toString();
|
return new URLCombiner(this.getEditRoute(), ITEM_EDIT_PRIVATE_PATH).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path to the page where the user can make this item public
|
* Returns the path to the page where the user can make this item public
|
||||||
*/
|
*/
|
||||||
getPublicPath(): string {
|
getPublicRoute(): string {
|
||||||
return new URLCombiner(this.getEditPath(), ITEM_EDIT_PUBLIC_PATH).toString();
|
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>
|
<i class="fa fa-trash"></i><span *ngIf="!small" class="d-none d-sm-inline"> {{"admin.workflow.item.delete" | translate}}</span>
|
||||||
</a>
|
</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>
|
<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>
|
</a>
|
||||||
|
@@ -5,19 +5,22 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
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 { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
||||||
import { WorkflowItemAdminWorkflowActionsComponent } from './workflow-item-admin-workflow-actions.component';
|
import { WorkflowItemAdminWorkflowActionsComponent } from './workflow-item-admin-workflow-actions.component';
|
||||||
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
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', () => {
|
describe('WorkflowItemAdminWorkflowActionsComponent', () => {
|
||||||
let component: WorkflowItemAdminWorkflowActionsComponent;
|
let component: WorkflowItemAdminWorkflowActionsComponent;
|
||||||
@@ -57,12 +60,12 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => {
|
|||||||
it('should render a delete button with the correct link', () => {
|
it('should render a delete button with the correct link', () => {
|
||||||
const button = fixture.debugElement.query(By.css('a.delete-link'));
|
const button = fixture.debugElement.query(By.css('a.delete-link'));
|
||||||
const link = button.nativeElement.href;
|
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', () => {
|
it('should render a move button with the correct link', () => {
|
||||||
const a = fixture.debugElement.query(By.css('a.send-back-link'));
|
const a = fixture.debugElement.query(By.css('a.send-back-link'));
|
||||||
const link = a.nativeElement.href;
|
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 { Component, Input } from '@angular/core';
|
||||||
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
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({
|
@Component({
|
||||||
selector: 'ds-workflow-item-admin-workflow-actions-element',
|
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
|
* 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
|
* Returns the path to the send back page of this workflow item
|
||||||
*/
|
*/
|
||||||
getSendBackPath(): string {
|
getSendBackRoute(): string {
|
||||||
return getWorkflowItemSendBackPath(this.wfi.id);
|
return getWorkflowItemSendBackRoute(this.wfi.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ import { Observable } from 'rxjs/internal/Observable';
|
|||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
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({
|
@Component({
|
||||||
selector: 'ds-edit-bitstream-page',
|
selector: 'ds-edit-bitstream-page',
|
||||||
@@ -506,7 +506,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
navigateToItemEditBitstreams() {
|
navigateToItemEditBitstreams() {
|
||||||
if (hasValue(this.itemId)) {
|
if (hasValue(this.itemId)) {
|
||||||
this.router.navigate([getItemEditPath(this.itemId), 'bitstreams']);
|
this.router.navigate([getItemEditRoute(this.itemId), 'bitstreams']);
|
||||||
} else {
|
} else {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ import { Observable } from 'rxjs';
|
|||||||
import { getRemoteDataPayload, getSucceededRemoteData } from '../core/shared/operators';
|
import { getRemoteDataPayload, getSucceededRemoteData } from '../core/shared/operators';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { hasValue } from '../shared/empty.util';
|
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
|
* The class that resolves the BreadcrumbConfig object for a DSpaceObject on a browse by page
|
||||||
@@ -32,7 +32,7 @@ export class BrowseByDSOBreadcrumbResolver {
|
|||||||
getSucceededRemoteData(),
|
getSucceededRemoteData(),
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
map((object: Community | Collection) => {
|
map((object: Community | Collection) => {
|
||||||
return { provider: this.breadcrumbService, key: object, url: getDSOPath(object) };
|
return { provider: this.breadcrumbService, key: object, url: getDSORoute(object) };
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -133,7 +133,7 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
return this.searchService.search(Object.assign(new PaginatedSearchOptions(options), {
|
return this.searchService.search(Object.assign(new PaginatedSearchOptions(options), {
|
||||||
query: this.buildQuery(collectionRD.payload.id, options.query),
|
query: this.buildQuery(collectionRD.payload.id, options.query),
|
||||||
scope: undefined,
|
scope: undefined,
|
||||||
dsoType: DSpaceObjectType.ITEM,
|
dsoTypes: [DSpaceObjectType.ITEM],
|
||||||
sort: this.defaultSortOptions
|
sort: this.defaultSortOptions
|
||||||
}), 10000).pipe(
|
}), 10000).pipe(
|
||||||
toDSpaceObjectListRD(),
|
toDSpaceObjectListRD(),
|
||||||
|
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 { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||||
import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard';
|
import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard';
|
||||||
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
|
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 { EditItemTemplatePageComponent } from './edit-item-template-page/edit-item-template-page.component';
|
||||||
import { ItemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver';
|
import { ItemTemplatePageResolver } from './edit-item-template-page/item-template-page.resolver';
|
||||||
import { CollectionItemMapperComponent } from './collection-item-mapper/collection-item-mapper.component';
|
import { CollectionItemMapperComponent } from './collection-item-mapper/collection-item-mapper.component';
|
||||||
@@ -17,24 +15,11 @@ import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.servi
|
|||||||
import { LinkService } from '../core/cache/builders/link.service';
|
import { LinkService } from '../core/cache/builders/link.service';
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
||||||
|
import {
|
||||||
export const COLLECTION_PARENT_PARAMETER = 'parent';
|
ITEMTEMPLATE_PATH,
|
||||||
|
COLLECTION_EDIT_PATH,
|
||||||
export function getCollectionPageRoute(collectionId: string) {
|
COLLECTION_CREATE_PATH
|
||||||
return new URLCombiner(getCollectionModulePath(), collectionId).toString();
|
} from './collection-page-routing-paths';
|
||||||
}
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@@ -87,7 +87,7 @@ export class CollectionPageComponent implements OnInit {
|
|||||||
scope: id,
|
scope: id,
|
||||||
pagination: dto.paginationConfig,
|
pagination: dto.paginationConfig,
|
||||||
sort: dto.sortConfig,
|
sort: dto.sortConfig,
|
||||||
dsoType: DSpaceObjectType.ITEM
|
dsoTypes: [DSpaceObjectType.ITEM]
|
||||||
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>
|
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>
|
||||||
}),
|
}),
|
||||||
startWith(undefined) // Make sure switching pages shows loading component
|
startWith(undefined) // Make sure switching pages shows loading component
|
||||||
|
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
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
|
* 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 { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
import { Collection } from '../../core/shared/collection.model';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { getCollectionEditPath } from '../collection-page-routing.module';
|
|
||||||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
||||||
|
import { getCollectionEditRoute } from '../collection-page-routing-paths';
|
||||||
|
|
||||||
describe('EditItemTemplatePageComponent', () => {
|
describe('EditItemTemplatePageComponent', () => {
|
||||||
let comp: EditItemTemplatePageComponent;
|
let comp: EditItemTemplatePageComponent;
|
||||||
@@ -45,7 +45,7 @@ describe('EditItemTemplatePageComponent', () => {
|
|||||||
describe('getCollectionEditUrl', () => {
|
describe('getCollectionEditUrl', () => {
|
||||||
it('should return the collection\'s edit url', () => {
|
it('should return the collection\'s edit url', () => {
|
||||||
const url = comp.getCollectionEditUrl(collection);
|
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 { ActivatedRoute } from '@angular/router';
|
||||||
import { first, map } from 'rxjs/operators';
|
import { first, map } from 'rxjs/operators';
|
||||||
import { ItemTemplateDataService } from '../../core/data/item-template-data.service';
|
import { ItemTemplateDataService } from '../../core/data/item-template-data.service';
|
||||||
import { getCollectionEditPath } from '../collection-page-routing.module';
|
import { getCollectionEditRoute } from '../collection-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-item-template-page',
|
selector: 'ds-edit-item-template-page',
|
||||||
@@ -35,7 +35,7 @@ export class EditItemTemplatePageComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
getCollectionEditUrl(collection: Collection): string {
|
getCollectionEditUrl(collection: Collection): string {
|
||||||
if (collection) {
|
if (collection) {
|
||||||
return getCollectionEditPath(collection.uuid);
|
return getCollectionEditRoute(collection.uuid);
|
||||||
} else {
|
} else {
|
||||||
return '';
|
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,29 +7,11 @@ import { CreateCommunityPageComponent } from './create-community-page/create-com
|
|||||||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||||
import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard';
|
import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard';
|
||||||
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
|
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 { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver';
|
||||||
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
|
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
|
||||||
import { LinkService } from '../core/cache/builders/link.service';
|
import { LinkService } from '../core/cache/builders/link.service';
|
||||||
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
||||||
|
import { COMMUNITY_EDIT_PATH, COMMUNITY_CREATE_PATH } from './community-page-routing-paths';
|
||||||
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';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
|||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component';
|
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
|
* 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 { AuthService } from '../../../core/auth/auth.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { getBitstreamModulePath } from '../../../app-routing.module';
|
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||||
import { Bundle } from '../../../core/shared/bundle.model';
|
import { Bundle } from '../../../core/shared/bundle.model';
|
||||||
import { BundleDataService } from '../../../core/data/bundle-data.service';
|
import { BundleDataService } from '../../../core/data/bundle-data.service';
|
||||||
@@ -19,8 +18,9 @@ import {
|
|||||||
getFirstSucceededRemoteDataPayload
|
getFirstSucceededRemoteDataPayload
|
||||||
} from '../../../core/shared/operators';
|
} from '../../../core/shared/operators';
|
||||||
import { UploaderComponent } from '../../../shared/uploader/uploader.component';
|
import { UploaderComponent } from '../../../shared/uploader/uploader.component';
|
||||||
import { getItemEditPath } from '../../item-page-routing.module';
|
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { getBitstreamModuleRoute } from '../../../app-routing-paths';
|
||||||
|
import { getItemEditRoute } from '../../item-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-upload-bitstream',
|
selector: 'ds-upload-bitstream',
|
||||||
@@ -171,7 +171,7 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
// Bring over the item ID as a query parameter
|
// Bring over the item ID as a query parameter
|
||||||
const queryParams = { itemId: this.itemId };
|
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
|
* When cancel is clicked, navigate back to the item's edit bitstreams page
|
||||||
*/
|
*/
|
||||||
onCancel() {
|
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 { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import { getItemPageRoute } from '../item-page-routing.module';
|
import { getItemPageRoute } from '../item-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-item-page',
|
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 { ResourcePolicyCreateComponent } from '../../shared/resource-policies/create/resource-policy-create.component';
|
||||||
import { ResourcePolicyEditComponent } from '../../shared/resource-policies/edit/resource-policy-edit.component';
|
import { ResourcePolicyEditComponent } from '../../shared/resource-policies/edit/resource-policy-edit.component';
|
||||||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||||
|
import {
|
||||||
export const ITEM_EDIT_WITHDRAW_PATH = 'withdraw';
|
ITEM_EDIT_AUTHORIZATIONS_PATH,
|
||||||
export const ITEM_EDIT_REINSTATE_PATH = 'reinstate';
|
ITEM_EDIT_MOVE_PATH,
|
||||||
export const ITEM_EDIT_PRIVATE_PATH = 'private';
|
ITEM_EDIT_DELETE_PATH,
|
||||||
export const ITEM_EDIT_PUBLIC_PATH = 'public';
|
ITEM_EDIT_PUBLIC_PATH,
|
||||||
export const ITEM_EDIT_DELETE_PATH = 'delete';
|
ITEM_EDIT_PRIVATE_PATH,
|
||||||
export const ITEM_EDIT_MOVE_PATH = 'move';
|
ITEM_EDIT_REINSTATE_PATH,
|
||||||
export const ITEM_EDIT_AUTHORIZATIONS_PATH = 'authorizations';
|
ITEM_EDIT_WITHDRAW_PATH
|
||||||
|
} from './edit-item-page.routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routing module that handles the routing for the Edit Item page administrator functionality
|
* Routing module that handles the routing for the Edit Item page administrator functionality
|
||||||
|
@@ -125,7 +125,7 @@ export class ItemCollectionMapperComponent implements OnInit {
|
|||||||
switchMap(([itemCollectionsRD, owningCollectionRD, searchOptions]) => {
|
switchMap(([itemCollectionsRD, owningCollectionRD, searchOptions]) => {
|
||||||
return this.searchService.search(Object.assign(new PaginatedSearchOptions(searchOptions), {
|
return this.searchService.search(Object.assign(new PaginatedSearchOptions(searchOptions), {
|
||||||
query: this.buildQuery([...itemCollectionsRD.payload.page, owningCollectionRD.payload], searchOptions.query),
|
query: this.buildQuery([...itemCollectionsRD.payload.page, owningCollectionRD.payload], searchOptions.query),
|
||||||
dsoType: DSpaceObjectType.COLLECTION
|
dsoTypes: [DSpaceObjectType.COLLECTION]
|
||||||
}), 10000).pipe(
|
}), 10000).pipe(
|
||||||
toDSpaceObjectListRD(),
|
toDSpaceObjectListRD(),
|
||||||
startWith(undefined)
|
startWith(undefined)
|
||||||
|
@@ -16,7 +16,6 @@ import { NotificationsService } from '../../../shared/notifications/notification
|
|||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ItemDeleteComponent } from './item-delete.component';
|
import { ItemDeleteComponent } from './item-delete.component';
|
||||||
import { getItemEditPath } from '../../item-page-routing.module';
|
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
import { VarDirective } from '../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||||
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
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 { PaginatedList } from '../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { EntityTypeService } from '../../../core/data/entity-type.service';
|
import { EntityTypeService } from '../../../core/data/entity-type.service';
|
||||||
|
import { getItemEditRoute } from '../../item-page-routing-paths';
|
||||||
|
|
||||||
let comp: ItemDeleteComponent;
|
let comp: ItemDeleteComponent;
|
||||||
let fixture: ComponentFixture<ItemDeleteComponent>;
|
let fixture: ComponentFixture<ItemDeleteComponent>;
|
||||||
@@ -233,7 +233,7 @@ describe('ItemDeleteComponent', () => {
|
|||||||
describe('notify', () => {
|
describe('notify', () => {
|
||||||
it('should navigate to the item edit page on failed deletion of the item', () => {
|
it('should navigate to the item edit page on failed deletion of the item', () => {
|
||||||
comp.notify(false);
|
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 { Component, Input, OnInit } from '@angular/core';
|
||||||
import { defaultIfEmpty, filter, first, map, switchMap, take } from 'rxjs/operators';
|
import { defaultIfEmpty, filter, first, map, switchMap, take } from 'rxjs/operators';
|
||||||
import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component';
|
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 { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { combineLatest as observableCombineLatest, combineLatest, Observable, of as observableOf } from 'rxjs';
|
import { combineLatest as observableCombineLatest, combineLatest, Observable, of as observableOf } from 'rxjs';
|
||||||
import { RelationshipType } from '../../../core/shared/item-relationships/relationship-type.model';
|
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 { LinkService } from '../../../core/cache/builders/link.service';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
|
import { getItemEditRoute } from '../../item-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-delete',
|
selector: 'ds-item-delete',
|
||||||
@@ -345,7 +345,7 @@ export class ItemDeleteComponent
|
|||||||
this.router.navigate(['']);
|
this.router.navigate(['']);
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get('item.edit.' + this.messageKey + '.error'));
|
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 { TranslateService } from '@ngx-translate/core';
|
||||||
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import { getItemEditPath } from '../../item-page-routing.module';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { Collection } from '../../../core/shared/collection.model';
|
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 { SearchService } from '../../../core/shared/search/search.service';
|
||||||
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model';
|
||||||
import { SearchResult } from '../../../shared/search/search-result.model';
|
import { SearchResult } from '../../../shared/search/search-result.model';
|
||||||
|
import { getItemEditRoute } from '../../item-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-move',
|
selector: 'ds-item-move',
|
||||||
@@ -79,7 +79,7 @@ export class ItemMoveComponent implements OnInit {
|
|||||||
loadSuggestions(query): void {
|
loadSuggestions(query): void {
|
||||||
this.collectionSearchResults = this.searchService.search(new PaginatedSearchOptions({
|
this.collectionSearchResults = this.searchService.search(new PaginatedSearchOptions({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
dsoType: DSpaceObjectType.COLLECTION,
|
dsoTypes: [DSpaceObjectType.COLLECTION],
|
||||||
query: query
|
query: query
|
||||||
})).pipe(
|
})).pipe(
|
||||||
first(),
|
first(),
|
||||||
@@ -116,7 +116,7 @@ export class ItemMoveComponent implements OnInit {
|
|||||||
this.processing = true;
|
this.processing = true;
|
||||||
this.itemDataService.moveToCollection(this.itemId, this.selectedCollection).pipe(first()).subscribe(
|
this.itemDataService.moveToCollection(this.itemId, this.selectedCollection).pipe(first()).subscribe(
|
||||||
(response: RestResponse) => {
|
(response: RestResponse) => {
|
||||||
this.router.navigate([getItemEditPath(this.itemId)]);
|
this.router.navigate([getItemEditRoute(this.itemId)]);
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
this.notificationsService.success(this.translateService.get('item.edit.move.success'));
|
this.notificationsService.success(this.translateService.get('item.edit.move.success'));
|
||||||
} else {
|
} else {
|
||||||
|
@@ -6,7 +6,7 @@ import { ItemOperation } from '../item-operation/itemOperation.model';
|
|||||||
import { first, map } from 'rxjs/operators';
|
import { first, map } from 'rxjs/operators';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { getItemEditPath, getItemPageRoute } from '../../item-page-routing.module';
|
import { getItemEditRoute, getItemPageRoute } from '../../item-page-routing-paths';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-status',
|
selector: 'ds-item-status',
|
||||||
@@ -99,7 +99,7 @@ export class ItemStatusComponent implements OnInit {
|
|||||||
* @returns {string} url
|
* @returns {string} url
|
||||||
*/
|
*/
|
||||||
getCurrentUrl(item: Item): string {
|
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 { AbstractSimpleItemActionComponent } from './abstract-simple-item-action.component';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { getItemEditPath } from '../../item-page-routing.module';
|
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import {
|
import {
|
||||||
createSuccessfulRemoteDataObject,
|
createSuccessfulRemoteDataObject,
|
||||||
createSuccessfulRemoteDataObject$
|
createSuccessfulRemoteDataObject$
|
||||||
} from '../../../shared/remote-data.utils';
|
} from '../../../shared/remote-data.utils';
|
||||||
|
import { getItemEditRoute } from '../../item-page-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test component that implements the AbstractSimpleItemActionComponent used to test the
|
* Test component that implements the AbstractSimpleItemActionComponent used to test the
|
||||||
@@ -136,14 +136,14 @@ describe('AbstractSimpleItemActionComponent', () => {
|
|||||||
comp.processRestResponse(successfulRestResponse);
|
comp.processRestResponse(successfulRestResponse);
|
||||||
|
|
||||||
expect(notificationsServiceStub.success).toHaveBeenCalled();
|
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', () => {
|
it('should process a RestResponse to navigate and display success notification', () => {
|
||||||
comp.processRestResponse(failRestResponse);
|
comp.processRestResponse(failRestResponse);
|
||||||
|
|
||||||
expect(notificationsServiceStub.error).toHaveBeenCalled();
|
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 {getSucceededRemoteData} from '../../../core/shared/operators';
|
||||||
import {first, map} from 'rxjs/operators';
|
import {first, map} from 'rxjs/operators';
|
||||||
import {findSuccessfulAccordingTo} from '../edit-item-operators';
|
import {findSuccessfulAccordingTo} from '../edit-item-operators';
|
||||||
import {getItemEditPath} from '../../item-page-routing.module';
|
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
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.
|
* 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(
|
this.itemDataService.findById(this.item.id).pipe(
|
||||||
findSuccessfulAccordingTo(this.predicate)).subscribe(() => {
|
findSuccessfulAccordingTo(this.predicate)).subscribe(() => {
|
||||||
this.notificationsService.success(this.translateService.get('item.edit.' + this.messageKey + '.success'));
|
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 {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get('item.edit.' + this.messageKey + '.error'));
|
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,25 +4,13 @@ import { RouterModule } from '@angular/router';
|
|||||||
import { ItemPageComponent } from './simple/item-page.component';
|
import { ItemPageComponent } from './simple/item-page.component';
|
||||||
import { FullItemPageComponent } from './full/full-item-page.component';
|
import { FullItemPageComponent } from './full/full-item-page.component';
|
||||||
import { ItemPageResolver } from './item-page.resolver';
|
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 { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||||
import { ItemBreadcrumbResolver } from '../core/breadcrumbs/item-breadcrumb.resolver';
|
import { ItemBreadcrumbResolver } from '../core/breadcrumbs/item-breadcrumb.resolver';
|
||||||
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
|
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
|
||||||
import { LinkService } from '../core/cache/builders/link.service';
|
import { LinkService } from '../core/cache/builders/link.service';
|
||||||
import { UploadBitstreamComponent } from './bitstreams/upload/upload-bitstream.component';
|
import { UploadBitstreamComponent } from './bitstreams/upload/upload-bitstream.component';
|
||||||
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
||||||
|
import { UPLOAD_BITSTREAM_PATH, ITEM_EDIT_PATH } from './item-page-routing-paths';
|
||||||
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';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
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,32 +3,15 @@ import { RouterModule } from '@angular/router';
|
|||||||
|
|
||||||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||||
import { SubmissionEditComponent } from '../submission/edit/submission-edit.component';
|
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 { WorkflowItemDeleteComponent } from './workflow-item-delete/workflow-item-delete.component';
|
||||||
import { WorkflowItemPageResolver } from './workflow-item-page.resolver';
|
import { WorkflowItemPageResolver } from './workflow-item-page.resolver';
|
||||||
import { WorkflowItemSendBackComponent } from './workflow-item-send-back/workflow-item-send-back.component';
|
import { WorkflowItemSendBackComponent } from './workflow-item-send-back/workflow-item-send-back.component';
|
||||||
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
import { EndUserAgreementGuard } from '../core/end-user-agreement/end-user-agreement.guard';
|
||||||
|
import {
|
||||||
export function getWorkflowItemPageRoute(wfiId: string) {
|
WORKFLOW_ITEM_SEND_BACK_PATH,
|
||||||
return new URLCombiner(getWorkflowItemModulePath(), wfiId).toString();
|
WORKFLOW_ITEM_DELETE_PATH,
|
||||||
}
|
WORKFLOW_ITEM_EDIT_PATH
|
||||||
|
} from './workflowitems-edit-page-routing-paths';
|
||||||
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';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
67
src/app/app-routing-paths.ts
Normal file
67
src/app/app-routing-paths.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import { DSpaceObject } from './core/shared/dspace-object.model';
|
||||||
|
import { Community } from './core/shared/community.model';
|
||||||
|
import { Collection } from './core/shared/collection.model';
|
||||||
|
import { Item } from './core/shared/item.model';
|
||||||
|
import { getCommunityPageRoute } from './+community-page/community-page-routing-paths';
|
||||||
|
import { getCollectionPageRoute } from './+collection-page/collection-page-routing-paths';
|
||||||
|
import { getItemPageRoute } from './+item-page/item-page-routing-paths';
|
||||||
|
|
||||||
|
export const BITSTREAM_MODULE_PATH = 'bitstreams';
|
||||||
|
|
||||||
|
export function getBitstreamModuleRoute() {
|
||||||
|
return `/${BITSTREAM_MODULE_PATH}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ADMIN_MODULE_PATH = 'admin';
|
||||||
|
|
||||||
|
export function getAdminModuleRoute() {
|
||||||
|
return `/${ADMIN_MODULE_PATH}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PROFILE_MODULE_PATH = 'profile';
|
||||||
|
|
||||||
|
export function getProfileModuleRoute() {
|
||||||
|
return `/${PROFILE_MODULE_PATH}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const REGISTER_PATH = 'register';
|
||||||
|
|
||||||
|
export function getRegisterRoute() {
|
||||||
|
return `/${REGISTER_PATH}`;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FORGOT_PASSWORD_PATH = 'forgot';
|
||||||
|
|
||||||
|
export function getForgotPasswordRoute() {
|
||||||
|
return `/${FORGOT_PASSWORD_PATH}`;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WORKFLOW_ITEM_MODULE_PATH = 'workflowitems';
|
||||||
|
|
||||||
|
export function getWorkflowItemModuleRoute() {
|
||||||
|
return `/${WORKFLOW_ITEM_MODULE_PATH}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDSORoute(dso: DSpaceObject): string {
|
||||||
|
switch ((dso as any).type) {
|
||||||
|
case Community.type.value:
|
||||||
|
return getCommunityPageRoute(dso.uuid);
|
||||||
|
case Collection.type.value:
|
||||||
|
return getCollectionPageRoute(dso.uuid);
|
||||||
|
case Item.type.value:
|
||||||
|
return getItemPageRoute(dso.uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const UNAUTHORIZED_PATH = 'unauthorized';
|
||||||
|
|
||||||
|
export function getUnauthorizedRoute() {
|
||||||
|
return `/${UNAUTHORIZED_PATH}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const INFO_MODULE_PATH = 'info';
|
||||||
|
export function getInfoModulePath() {
|
||||||
|
return `/${INFO_MODULE_PATH}`;
|
||||||
|
}
|
@@ -4,95 +4,24 @@ import { AuthBlockingGuard } from './core/auth/auth-blocking.guard';
|
|||||||
|
|
||||||
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
|
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
|
||||||
import { AuthenticatedGuard } from './core/auth/authenticated.guard';
|
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 { SiteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||||
|
import {
|
||||||
|
UNAUTHORIZED_PATH,
|
||||||
|
WORKFLOW_ITEM_MODULE_PATH,
|
||||||
|
FORGOT_PASSWORD_PATH,
|
||||||
|
REGISTER_PATH,
|
||||||
|
PROFILE_MODULE_PATH,
|
||||||
|
ADMIN_MODULE_PATH,
|
||||||
|
BITSTREAM_MODULE_PATH,
|
||||||
|
INFO_MODULE_PATH
|
||||||
|
} from './app-routing-paths';
|
||||||
|
import { COLLECTION_MODULE_PATH } from './+collection-page/collection-page-routing-paths';
|
||||||
|
import { COMMUNITY_MODULE_PATH } from './+community-page/community-page-routing-paths';
|
||||||
|
import { ITEM_MODULE_PATH } from './+item-page/item-page-routing-paths';
|
||||||
import { ReloadGuard } from './core/reload/reload.guard';
|
import { ReloadGuard } from './core/reload/reload.guard';
|
||||||
import { EndUserAgreementGuard } from './core/end-user-agreement/end-user-agreement.guard';
|
import { EndUserAgreementGuard } from './core/end-user-agreement/end-user-agreement.guard';
|
||||||
|
|
||||||
const ITEM_MODULE_PATH = 'items';
|
|
||||||
|
|
||||||
export function getItemModulePath() {
|
|
||||||
return `/${ITEM_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const COLLECTION_MODULE_PATH = 'collections';
|
|
||||||
|
|
||||||
export function getCollectionModulePath() {
|
|
||||||
return `/${COLLECTION_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const COMMUNITY_MODULE_PATH = 'communities';
|
|
||||||
|
|
||||||
export function getCommunityModulePath() {
|
|
||||||
return `/${COMMUNITY_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
const BITSTREAM_MODULE_PATH = 'bitstreams';
|
|
||||||
export function getBitstreamModulePath() {
|
|
||||||
return `/${BITSTREAM_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ADMIN_MODULE_PATH = 'admin';
|
|
||||||
|
|
||||||
export function getAdminModulePath() {
|
|
||||||
return `/${ADMIN_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const PROFILE_MODULE_PATH = 'profile';
|
|
||||||
|
|
||||||
export function getProfileModulePath() {
|
|
||||||
return `/${PROFILE_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const REGISTER_PATH = 'register';
|
|
||||||
|
|
||||||
export function getRegisterPath() {
|
|
||||||
return `/${REGISTER_PATH}`;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const FORGOT_PASSWORD_PATH = 'forgot';
|
|
||||||
|
|
||||||
export function getForgotPasswordPath() {
|
|
||||||
return `/${FORGOT_PASSWORD_PATH}`;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const WORKFLOW_ITEM_MODULE_PATH = 'workflowitems';
|
|
||||||
|
|
||||||
export function getWorkflowItemModulePath() {
|
|
||||||
return `/${WORKFLOW_ITEM_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getDSOPath(dso: DSpaceObject): string {
|
|
||||||
switch ((dso as any).type) {
|
|
||||||
case Community.type.value:
|
|
||||||
return getCommunityPageRoute(dso.uuid);
|
|
||||||
case Collection.type.value:
|
|
||||||
return getCollectionPageRoute(dso.uuid);
|
|
||||||
case Item.type.value:
|
|
||||||
return getItemPageRoute(dso.uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const UNAUTHORIZED_PATH = 'unauthorized';
|
|
||||||
|
|
||||||
export function getUnauthorizedPath() {
|
|
||||||
return `/${UNAUTHORIZED_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const INFO_MODULE_PATH = 'info';
|
|
||||||
|
|
||||||
export function getInfoModulePath() {
|
|
||||||
return `/${INFO_MODULE_PATH}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forRoot([
|
RouterModule.forRoot([
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div class="outer-wrapper" *ngIf="isAuthBlocking$ | async; else authLoader">
|
<div class="outer-wrapper" *ngIf="isNotAuthBlocking$ | async; else authLoader">
|
||||||
<ds-admin-sidebar></ds-admin-sidebar>
|
<ds-admin-sidebar></ds-admin-sidebar>
|
||||||
<div class="inner-wrapper" [@slideSidebarPadding]="{
|
<div class="inner-wrapper" [@slideSidebarPadding]="{
|
||||||
value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'),
|
value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'),
|
||||||
|
@@ -29,7 +29,7 @@ import { RouteService } from './core/services/route.service';
|
|||||||
import { MockActivatedRoute } from './shared/mocks/active-router.mock';
|
import { MockActivatedRoute } from './shared/mocks/active-router.mock';
|
||||||
import { RouterMock } from './shared/mocks/router.mock';
|
import { RouterMock } from './shared/mocks/router.mock';
|
||||||
import { Angulartics2DSpace } from './statistics/angulartics/dspace-provider';
|
import { Angulartics2DSpace } from './statistics/angulartics/dspace-provider';
|
||||||
import { AppState, storeModuleConfig } from './app.reducer';
|
import { storeModuleConfig } from './app.reducer';
|
||||||
import { LocaleService } from './core/locale/locale.service';
|
import { LocaleService } from './core/locale/locale.service';
|
||||||
import { authReducer } from './core/auth/auth.reducer';
|
import { authReducer } from './core/auth/auth.reducer';
|
||||||
import { cold } from 'jasmine-marbles';
|
import { cold } from 'jasmine-marbles';
|
||||||
|
@@ -19,7 +19,7 @@ import { MetadataService } from './core/metadata/metadata.service';
|
|||||||
import { HostWindowResizeAction } from './shared/host-window.actions';
|
import { HostWindowResizeAction } from './shared/host-window.actions';
|
||||||
import { HostWindowState } from './shared/search/host-window.reducer';
|
import { HostWindowState } from './shared/search/host-window.reducer';
|
||||||
import { NativeWindowRef, NativeWindowService } from './core/services/window.service';
|
import { NativeWindowRef, NativeWindowService } from './core/services/window.service';
|
||||||
import { isAuthenticationBlocking, isAuthenticationLoading } from './core/auth/selectors';
|
import { isAuthenticationBlocking } from './core/auth/selectors';
|
||||||
import { AuthService } from './core/auth/auth.service';
|
import { AuthService } from './core/auth/auth.service';
|
||||||
import { CSSVariableService } from './shared/sass-helper/sass-helper.service';
|
import { CSSVariableService } from './shared/sass-helper/sass-helper.service';
|
||||||
import { MenuService } from './shared/menu/menu.service';
|
import { MenuService } from './shared/menu/menu.service';
|
||||||
@@ -53,9 +53,9 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
models;
|
models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the authenticated has finished loading
|
* Whether or not the authentication is currently blocking the UI
|
||||||
*/
|
*/
|
||||||
isAuthBlocking$: Observable<boolean>;
|
isNotAuthBlocking$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(NativeWindowService) private _window: NativeWindowRef,
|
@Inject(NativeWindowService) private _window: NativeWindowRef,
|
||||||
@@ -94,7 +94,7 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.isAuthBlocking$ = this.store.pipe(select(isAuthenticationBlocking)).pipe(
|
this.isNotAuthBlocking$ = this.store.pipe(select(isAuthenticationBlocking)).pipe(
|
||||||
map((isBlocking: boolean) => isBlocking === false),
|
map((isBlocking: boolean) => isBlocking === false),
|
||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
);
|
);
|
||||||
|
@@ -13,11 +13,11 @@ import { PageInfo } from '../core/shared/page-info.model';
|
|||||||
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||||
import { RemoteData } from '../core/data/remote-data';
|
import { RemoteData } from '../core/data/remote-data';
|
||||||
import { PaginatedList } from '../core/data/paginated-list';
|
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 { CollectionDataService } from '../core/data/collection-data.service';
|
||||||
import { CommunityListSaveAction } from './community-list.actions';
|
import { CommunityListSaveAction } from './community-list.actions';
|
||||||
import { CommunityListState } from './community-list.reducer';
|
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
|
* Each node in the tree is represented by a flatNode which contains info about the node itself and its position and
|
||||||
|
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { CanActivate } from '@angular/router';
|
import { CanActivate } from '@angular/router';
|
||||||
import { select, Store } from '@ngrx/store';
|
import { select, Store } from '@ngrx/store';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { distinctUntilChanged, filter, map, take, tap } from 'rxjs/operators';
|
import { distinctUntilChanged, filter, map, take } from 'rxjs/operators';
|
||||||
import { AppState } from '../../app.reducer';
|
import { AppState } from '../../app.reducer';
|
||||||
import { isAuthenticationBlocking } from './selectors';
|
import { isAuthenticationBlocking } from './selectors';
|
||||||
|
|
||||||
|
@@ -239,8 +239,8 @@ describe('authReducer', () => {
|
|||||||
authToken: undefined,
|
authToken: undefined,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
blocking: false,
|
blocking: true,
|
||||||
loading: false,
|
loading: true,
|
||||||
info: undefined,
|
info: undefined,
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
userId: undefined
|
userId: undefined
|
||||||
|
@@ -141,7 +141,6 @@ export function authReducer(state: any = initialState, action: AuthActions): Aut
|
|||||||
error: (action as LogOutErrorAction).payload.message
|
error: (action as LogOutErrorAction).payload.message
|
||||||
});
|
});
|
||||||
|
|
||||||
case AuthActionTypes.LOG_OUT_SUCCESS:
|
|
||||||
case AuthActionTypes.REFRESH_TOKEN_ERROR:
|
case AuthActionTypes.REFRESH_TOKEN_ERROR:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
@@ -155,6 +154,19 @@ export function authReducer(state: any = initialState, action: AuthActions): Aut
|
|||||||
userId: undefined
|
userId: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
|
case AuthActionTypes.LOG_OUT_SUCCESS:
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
authenticated: false,
|
||||||
|
authToken: undefined,
|
||||||
|
error: undefined,
|
||||||
|
loaded: false,
|
||||||
|
blocking: true,
|
||||||
|
loading: true,
|
||||||
|
info: undefined,
|
||||||
|
refreshing: false,
|
||||||
|
userId: undefined
|
||||||
|
});
|
||||||
|
|
||||||
case AuthActionTypes.REDIRECT_AUTHENTICATION_REQUIRED:
|
case AuthActionTypes.REDIRECT_AUTHENTICATION_REQUIRED:
|
||||||
case AuthActionTypes.REDIRECT_TOKEN_EXPIRED:
|
case AuthActionTypes.REDIRECT_TOKEN_EXPIRED:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { PRIMARY_OUTLET, Router, UrlSegmentGroup, UrlTree } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { HttpHeaders } from '@angular/common/http';
|
import { HttpHeaders } from '@angular/common/http';
|
||||||
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
|
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
|
||||||
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { distinctUntilChanged, filter, map, startWith, switchMap, take, withLatestFrom } from 'rxjs/operators';
|
import { map, startWith, switchMap, take } from 'rxjs/operators';
|
||||||
import { RouterReducerState } from '@ngrx/router-store';
|
|
||||||
import { select, Store } from '@ngrx/store';
|
import { select, Store } from '@ngrx/store';
|
||||||
import { CookieAttributes } from 'js-cookie';
|
import { CookieAttributes } from 'js-cookie';
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ import {
|
|||||||
isTokenRefreshing,
|
isTokenRefreshing,
|
||||||
isAuthenticatedLoaded
|
isAuthenticatedLoaded
|
||||||
} from './selectors';
|
} from './selectors';
|
||||||
import { AppState, routerStateSelector } from '../../app.reducer';
|
import { AppState } from '../../app.reducer';
|
||||||
import {
|
import {
|
||||||
CheckAuthenticationTokenAction,
|
CheckAuthenticationTokenAction,
|
||||||
ResetAuthenticationMessagesAction,
|
ResetAuthenticationMessagesAction,
|
||||||
|
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
|||||||
import {
|
import {
|
||||||
ActivatedRouteSnapshot,
|
ActivatedRouteSnapshot,
|
||||||
CanActivate,
|
CanActivate,
|
||||||
Route,
|
|
||||||
Router,
|
Router,
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
UrlTree
|
UrlTree
|
||||||
|
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpHeaders } from '@angular/common/http';
|
import { HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { filter, map, take } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||||
|
@@ -10,8 +10,8 @@ import { Community } from '../shared/community.model';
|
|||||||
import { Collection } from '../shared/collection.model';
|
import { Collection } from '../shared/collection.model';
|
||||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||||
import { getTestScheduler } from 'jasmine-marbles';
|
import { getTestScheduler } from 'jasmine-marbles';
|
||||||
import { getDSOPath } from '../../app-routing.module';
|
|
||||||
import { DSONameService } from './dso-name.service';
|
import { DSONameService } from './dso-name.service';
|
||||||
|
import { getDSORoute } from '../../app-routing-paths';
|
||||||
|
|
||||||
describe('DSOBreadcrumbsService', () => {
|
describe('DSOBreadcrumbsService', () => {
|
||||||
let service: DSOBreadcrumbsService;
|
let service: DSOBreadcrumbsService;
|
||||||
@@ -108,9 +108,9 @@ describe('DSOBreadcrumbsService', () => {
|
|||||||
it('should return the breadcrumbs based on an Item', () => {
|
it('should return the breadcrumbs based on an Item', () => {
|
||||||
const breadcrumbs = service.getBreadcrumbs(testItem, testItem._links.self);
|
const breadcrumbs = service.getBreadcrumbs(testItem, testItem._links.self);
|
||||||
const expectedCrumbs = [
|
const expectedCrumbs = [
|
||||||
new Breadcrumb(getName(testCommunity), getDSOPath(testCommunity)),
|
new Breadcrumb(getName(testCommunity), getDSORoute(testCommunity)),
|
||||||
new Breadcrumb(getName(testCollection), getDSOPath(testCollection)),
|
new Breadcrumb(getName(testCollection), getDSORoute(testCollection)),
|
||||||
new Breadcrumb(getName(testItem), getDSOPath(testItem)),
|
new Breadcrumb(getName(testItem), getDSORoute(testItem)),
|
||||||
];
|
];
|
||||||
getTestScheduler().expectObservable(breadcrumbs).toBe('(a|)', { a: expectedCrumbs });
|
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 { DSpaceObject } from '../shared/dspace-object.model';
|
||||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||||
import { find, map, switchMap } from 'rxjs/operators';
|
import { find, map, switchMap } from 'rxjs/operators';
|
||||||
import { getDSOPath } from '../../app-routing.module';
|
|
||||||
import { RemoteData } from '../data/remote-data';
|
import { RemoteData } from '../data/remote-data';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { getDSORoute } from '../../app-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service to calculate DSpaceObject breadcrumbs for a single part of the route
|
* 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>) => {
|
switchMap((parentRD: RemoteData<ChildHALResource & DSpaceObject>) => {
|
||||||
if (hasValue(parentRD.payload)) {
|
if (hasValue(parentRD.payload)) {
|
||||||
const parent = parentRD.payload;
|
const parent = parentRD.payload;
|
||||||
return this.getBreadcrumbs(parent, getDSOPath(parent))
|
return this.getBreadcrumbs(parent, getDSORoute(parent))
|
||||||
}
|
}
|
||||||
return observableOf([]);
|
return observableOf([]);
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
||||||
import { isNotEmpty } from '../../../shared/empty.util';
|
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 { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||||
import { typedObject } from '../../cache/builders/build-decorators';
|
import { typedObject } from '../../cache/builders/build-decorators';
|
||||||
import { HALLink } from '../../shared/hal-link.model';
|
import { HALLink } from '../../shared/hal-link.model';
|
||||||
import { MetadataValueInterface } from '../../shared/metadata.models';
|
import { MetadataValueInterface } from '../../shared/metadata.models';
|
||||||
import { AUTHORITY_VALUE } from './authority.resource-type';
|
import { AUTHORITY_VALUE } from './authority.resource-type';
|
||||||
import { IntegrationModel } from './integration.model';
|
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
|
* Class representing an authority object
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import {async, TestBed} from '@angular/core/testing';
|
import {TestBed} from '@angular/core/testing';
|
||||||
import {BrowserHardRedirectService} from './browser-hard-redirect.service';
|
import {BrowserHardRedirectService} from './browser-hard-redirect.service';
|
||||||
|
|
||||||
describe('BrowserHardRedirectService', () => {
|
describe('BrowserHardRedirectService', () => {
|
||||||
|
@@ -11,7 +11,7 @@ import { RequestEntry } from '../data/request.reducer';
|
|||||||
import { RequestService } from '../data/request.service';
|
import { RequestService } from '../data/request.service';
|
||||||
import { BrowseDefinition } from './browse-definition.model';
|
import { BrowseDefinition } from './browse-definition.model';
|
||||||
import { DSpaceObject } from './dspace-object.model';
|
import { DSpaceObject } from './dspace-object.model';
|
||||||
import { getUnauthorizedPath } from '../../app-routing.module';
|
import { getUnauthorizedRoute } from '../../app-routing-paths';
|
||||||
import { getEndUserAgreementPath } from '../../info/info-routing.module';
|
import { getEndUserAgreementPath } from '../../info/info-routing.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,7 +190,7 @@ export const returnUnauthorizedUrlTreeOnFalse = (router: Router) =>
|
|||||||
(source: Observable<boolean>): Observable<boolean | UrlTree> =>
|
(source: Observable<boolean>): Observable<boolean | UrlTree> =>
|
||||||
source.pipe(
|
source.pipe(
|
||||||
map((authorized: boolean) => {
|
map((authorized: boolean) => {
|
||||||
return authorized ? authorized : router.parseUrl(getUnauthorizedPath())
|
return authorized ? authorized : router.parseUrl(getUnauthorizedRoute())
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -4,13 +4,11 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|||||||
import { CurationFormComponent } from './curation-form.component';
|
import { CurationFormComponent } from './curation-form.component';
|
||||||
import { ScriptDataService } from '../core/data/processes/script-data.service';
|
import { ScriptDataService } from '../core/data/processes/script-data.service';
|
||||||
import { ProcessDataService } from '../core/data/processes/process-data.service';
|
import { ProcessDataService } from '../core/data/processes/process-data.service';
|
||||||
import { AuthService } from '../core/auth/auth.service';
|
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { RequestEntry } from '../core/data/request.reducer';
|
import { RequestEntry } from '../core/data/request.reducer';
|
||||||
import { DSOSuccessResponse, RestResponse } from '../core/cache/response.models';
|
import { DSOSuccessResponse, RestResponse } from '../core/cache/response.models';
|
||||||
import { Process } from '../process-page/processes/process.model';
|
import { Process } from '../process-page/processes/process.model';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
|
||||||
import { EPerson } from '../core/eperson/models/eperson.model';
|
|
||||||
import { NotificationsServiceStub } from '../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../shared/testing/router.stub';
|
import { RouterStub } from '../shared/testing/router.stub';
|
||||||
import { NotificationsService } from '../shared/notifications/notifications.service';
|
import { NotificationsService } from '../shared/notifications/notifications.service';
|
||||||
@@ -27,7 +25,6 @@ describe('CurationFormComponent', () => {
|
|||||||
let scriptDataService: ScriptDataService;
|
let scriptDataService: ScriptDataService;
|
||||||
let processDataService: ProcessDataService;
|
let processDataService: ProcessDataService;
|
||||||
let configurationDataService: ConfigurationDataService;
|
let configurationDataService: ConfigurationDataService;
|
||||||
let authService: AuthService;
|
|
||||||
let notificationsService;
|
let notificationsService;
|
||||||
let router;
|
let router;
|
||||||
|
|
||||||
@@ -48,10 +45,6 @@ describe('CurationFormComponent', () => {
|
|||||||
findByHref: createSuccessfulRemoteDataObject$(process)
|
findByHref: createSuccessfulRemoteDataObject$(process)
|
||||||
});
|
});
|
||||||
|
|
||||||
authService = jasmine.createSpyObj('authService', {
|
|
||||||
getAuthenticatedUserFromStore: observableOf(Object.assign(new EPerson(), {email: 'test@mail'}))
|
|
||||||
});
|
|
||||||
|
|
||||||
configurationDataService = jasmine.createSpyObj('configurationDataService', {
|
configurationDataService = jasmine.createSpyObj('configurationDataService', {
|
||||||
findByPropertyName: createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), {
|
findByPropertyName: createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), {
|
||||||
name: 'plugin.named.org.dspace.curate.CurationTask',
|
name: 'plugin.named.org.dspace.curate.CurationTask',
|
||||||
@@ -74,7 +67,6 @@ describe('CurationFormComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{provide: ScriptDataService, useValue: scriptDataService},
|
{provide: ScriptDataService, useValue: scriptDataService},
|
||||||
{provide: ProcessDataService, useValue: processDataService},
|
{provide: ProcessDataService, useValue: processDataService},
|
||||||
{provide: AuthService, useValue: authService},
|
|
||||||
{provide: NotificationsService, useValue: notificationsService},
|
{provide: NotificationsService, useValue: notificationsService},
|
||||||
{provide: Router, useValue: router},
|
{provide: Router, useValue: router},
|
||||||
{provide: ConfigurationDataService, useValue: configurationDataService},
|
{provide: ConfigurationDataService, useValue: configurationDataService},
|
||||||
@@ -119,7 +111,6 @@ describe('CurationFormComponent', () => {
|
|||||||
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
||||||
{name: '-t', value: 'profileformats'},
|
{name: '-t', value: 'profileformats'},
|
||||||
{name: '-i', value: 'test-handle'},
|
{name: '-i', value: 'test-handle'},
|
||||||
{name: '-e', value: 'test@mail'},
|
|
||||||
], []);
|
], []);
|
||||||
expect(notificationsService.success).toHaveBeenCalled();
|
expect(notificationsService.success).toHaveBeenCalled();
|
||||||
expect(processDataService.findByHref).toHaveBeenCalledWith('process-link');
|
expect(processDataService.findByHref).toHaveBeenCalledWith('process-link');
|
||||||
@@ -134,7 +125,6 @@ describe('CurationFormComponent', () => {
|
|||||||
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
||||||
{name: '-t', value: 'profileformats'},
|
{name: '-t', value: 'profileformats'},
|
||||||
{name: '-i', value: 'test-handle'},
|
{name: '-i', value: 'test-handle'},
|
||||||
{name: '-e', value: 'test@mail'},
|
|
||||||
], []);
|
], []);
|
||||||
expect(notificationsService.error).toHaveBeenCalled();
|
expect(notificationsService.error).toHaveBeenCalled();
|
||||||
expect(processDataService.findByHref).not.toHaveBeenCalled();
|
expect(processDataService.findByHref).not.toHaveBeenCalled();
|
||||||
@@ -149,7 +139,6 @@ describe('CurationFormComponent', () => {
|
|||||||
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
||||||
{name: '-t', value: 'profileformats'},
|
{name: '-t', value: 'profileformats'},
|
||||||
{name: '-i', value: 'form-handle'},
|
{name: '-i', value: 'form-handle'},
|
||||||
{name: '-e', value: 'test@mail'},
|
|
||||||
], []);
|
], []);
|
||||||
});
|
});
|
||||||
it('should use "all" when the handle provided by the form is empty and when no dsoHandle is provided', () => {
|
it('should use "all" when the handle provided by the form is empty and when no dsoHandle is provided', () => {
|
||||||
@@ -159,7 +148,6 @@ describe('CurationFormComponent', () => {
|
|||||||
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
|
||||||
{name: '-t', value: 'profileformats'},
|
{name: '-t', value: 'profileformats'},
|
||||||
{name: '-i', value: 'all'},
|
{name: '-i', value: 'all'},
|
||||||
{name: '-e', value: 'test@mail'},
|
|
||||||
], []);
|
], []);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -3,9 +3,7 @@ import { ScriptDataService } from '../core/data/processes/script-data.service';
|
|||||||
import { FormControl, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { getResponseFromEntry } from '../core/shared/operators';
|
import { getResponseFromEntry } from '../core/shared/operators';
|
||||||
import { DSOSuccessResponse } from '../core/cache/response.models';
|
import { DSOSuccessResponse } from '../core/cache/response.models';
|
||||||
import { AuthService } from '../core/auth/auth.service';
|
import { filter, map, take } from 'rxjs/operators';
|
||||||
import { filter, map, switchMap, take } from 'rxjs/operators';
|
|
||||||
import { EPerson } from '../core/eperson/models/eperson.model';
|
|
||||||
import { NotificationsService } from '../shared/notifications/notifications.service';
|
import { NotificationsService } from '../shared/notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { hasValue, isEmpty, isNotEmpty } from '../shared/empty.util';
|
import { hasValue, isEmpty, isNotEmpty } from '../shared/empty.util';
|
||||||
@@ -40,7 +38,6 @@ export class CurationFormComponent implements OnInit {
|
|||||||
private scriptDataService: ScriptDataService,
|
private scriptDataService: ScriptDataService,
|
||||||
private configurationDataService: ConfigurationDataService,
|
private configurationDataService: ConfigurationDataService,
|
||||||
private processDataService: ProcessDataService,
|
private processDataService: ProcessDataService,
|
||||||
private authService: AuthService,
|
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private router: Router
|
private router: Router
|
||||||
@@ -90,16 +87,10 @@ export class CurationFormComponent implements OnInit {
|
|||||||
handle = 'all';
|
handle = 'all';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.authService.getAuthenticatedUserFromStore().pipe(
|
this.scriptDataService.invoke('curate', [
|
||||||
take(1),
|
|
||||||
switchMap((eperson: EPerson) => {
|
|
||||||
return this.scriptDataService.invoke('curate', [
|
|
||||||
{name: '-t', value: taskName},
|
{name: '-t', value: taskName},
|
||||||
{name: '-i', value: handle},
|
{name: '-i', value: handle},
|
||||||
{name: '-e', value: eperson.email},
|
], []).pipe(getResponseFromEntry()).subscribe((response: DSOSuccessResponse) => {
|
||||||
], []).pipe(getResponseFromEntry());
|
|
||||||
})
|
|
||||||
).subscribe((response: DSOSuccessResponse) => {
|
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
this.notificationsService.success(this.translateService.get('curation.form.submit.success.head'),
|
this.notificationsService.success(this.translateService.get('curation.form.submit.success.head'),
|
||||||
this.translateService.get('curation.form.submit.success.content'));
|
this.translateService.get('curation.form.submit.success.content'));
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { EndUserAgreementComponent } from './end-user-agreement/end-user-agreement.component';
|
import { EndUserAgreementComponent } from './end-user-agreement/end-user-agreement.component';
|
||||||
import { getInfoModulePath } from '../app-routing.module';
|
import { getInfoModulePath } from '../app-routing-paths';
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { PrivacyComponent } from './privacy/privacy.component';
|
import { PrivacyComponent } from './privacy/privacy.component';
|
||||||
|
|
||||||
|
@@ -7,8 +7,8 @@ import { EPerson } from '../../../core/eperson/models/eperson.model';
|
|||||||
import { AppState } from '../../../app.reducer';
|
import { AppState } from '../../../app.reducer';
|
||||||
import { isAuthenticationLoading } from '../../../core/auth/selectors';
|
import { isAuthenticationLoading } from '../../../core/auth/selectors';
|
||||||
import { MYDSPACE_ROUTE } from '../../../+my-dspace-page/my-dspace-page.component';
|
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 { AuthService } from '../../../core/auth/auth.service';
|
||||||
|
import { getProfileModuleRoute } from '../../../app-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents the user nav menu.
|
* This component represents the user nav menu.
|
||||||
@@ -41,7 +41,7 @@ export class UserMenuComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* The profile page route
|
* The profile page route
|
||||||
*/
|
*/
|
||||||
public profileRoute = getProfileModulePath();
|
public profileRoute = getProfileModuleRoute();
|
||||||
|
|
||||||
constructor(private store: Store<AppState>,
|
constructor(private store: Store<AppState>,
|
||||||
private authService: AuthService) {
|
private authService: AuthService) {
|
||||||
|
@@ -2,7 +2,7 @@ import { isObject, uniqueId } from 'lodash';
|
|||||||
import { hasValue, isNotEmpty } from '../../empty.util';
|
import { hasValue, isNotEmpty } from '../../empty.util';
|
||||||
import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model';
|
||||||
import { ConfidenceType } from '../../../core/integration/models/confidence-type';
|
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 {
|
export interface ChipsItemIcon {
|
||||||
metadata: string;
|
metadata: string;
|
||||||
|
@@ -2,10 +2,10 @@ import { findIndex, isEqual, isObject } from 'lodash';
|
|||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { ChipsItem, ChipsItemIcon } from './chips-item.model';
|
import { ChipsItem, ChipsItemIcon } from './chips-item.model';
|
||||||
import { hasValue, isNotEmpty } from '../../empty.util';
|
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 { MetadataIconConfig } from '../../../../config/submission-config.interface';
|
||||||
import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model';
|
||||||
import { AuthorityValue } from '../../../core/integration/models/authority.value';
|
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 {
|
export class Chips {
|
||||||
chipsItems: BehaviorSubject<ChipsItem[]>;
|
chipsItems: BehaviorSubject<ChipsItem[]>;
|
||||||
|
@@ -2,7 +2,6 @@ import { Component, Input, OnInit } from '@angular/core';
|
|||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
import { Community } from '../../../../core/shared/community.model';
|
import { Community } from '../../../../core/shared/community.model';
|
||||||
import { Observable } from 'rxjs';
|
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 { GroupDataService } from '../../../../core/eperson/group-data.service';
|
||||||
import { Collection } from '../../../../core/shared/collection.model';
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map } from 'rxjs/operators';
|
||||||
@@ -10,6 +9,7 @@ import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/s
|
|||||||
import { RequestService } from '../../../../core/data/request.service';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { HALLink } from '../../../../core/shared/hal-link.model';
|
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.
|
* Component for managing a community or collection role.
|
||||||
@@ -71,7 +71,7 @@ export class ComcolRoleComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
get editGroupLink$(): Observable<string> {
|
get editGroupLink$(): Observable<string> {
|
||||||
return this.group$.pipe(
|
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 { Component, Inject, Input, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import { map } from 'rxjs/operators';
|
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 { ActivatedRoute, Params, Router } from '@angular/router';
|
||||||
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
||||||
import { environment } from '../../../environments/environment';
|
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 {
|
export interface ComColPageNavOption {
|
||||||
id: string;
|
id: string;
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
<input type="search"
|
<input type="search"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
(click)="$event.stopPropagation();"
|
(click)="$event.stopPropagation();"
|
||||||
placeholder="{{'dso-selector.placeholder' | translate: { type: type.toString().toLowerCase() } }}"
|
placeholder="{{'dso-selector.placeholder' | translate: { type: typesString } }}"
|
||||||
[formControl]="input" dsAutoFocus (keyup.enter)="selectSingleResult()">
|
[formControl]="input" dsAutoFocus (keyup.enter)="selectSingleResult()">
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<div class="scrollable-menu list-group">
|
<div class="scrollable-menu list-group">
|
||||||
<button class="list-group-item list-group-item-action border-0 disabled"
|
<button class="list-group-item list-group-item-action border-0 disabled"
|
||||||
*ngIf="(listEntries$ | async)?.payload.page.length == 0">
|
*ngIf="(listEntries$ | async)?.payload.page.length == 0">
|
||||||
{{'dso-selector.no-results' | translate: { type: type.toString().toLowerCase() } }}
|
{{'dso-selector.no-results' | translate: { type: typesString } }}
|
||||||
</button>
|
</button>
|
||||||
<button *ngFor="let listEntry of (listEntries$ | async)?.payload.page"
|
<button *ngFor="let listEntry of (listEntries$ | async)?.payload.page"
|
||||||
class="list-group-item list-group-item-action border-0 list-entry"
|
class="list-group-item list-group-item-action border-0 list-entry"
|
||||||
|
@@ -49,7 +49,7 @@ describe('DSOSelectorComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
debugElement = fixture.debugElement;
|
debugElement = fixture.debugElement;
|
||||||
component.currentDSOId = currentDSOId;
|
component.currentDSOId = currentDSOId;
|
||||||
component.type = type;
|
component.types = [type];
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
@@ -61,7 +61,7 @@ describe('DSOSelectorComponent', () => {
|
|||||||
it('should initially call the search method on the SearchService with the given DSO uuid', () => {
|
it('should initially call the search method on the SearchService with the given DSO uuid', () => {
|
||||||
const searchOptions = new PaginatedSearchOptions({
|
const searchOptions = new PaginatedSearchOptions({
|
||||||
query: currentDSOId,
|
query: currentDSOId,
|
||||||
dsoType: type,
|
dsoTypes: [type],
|
||||||
pagination: (component as any).defaultPagination
|
pagination: (component as any).defaultPagination
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -43,9 +43,12 @@ export class DSOSelectorComponent implements OnInit {
|
|||||||
@Input() currentDSOId: string;
|
@Input() currentDSOId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of DSpace objects this components shows a list of
|
* The types of DSpace objects this components shows a list of
|
||||||
*/
|
*/
|
||||||
@Input() type: DSpaceObjectType;
|
@Input() types: DSpaceObjectType[];
|
||||||
|
|
||||||
|
// list of allowed selectable dsoTypes
|
||||||
|
typesString: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emits the selected Object when a user selects it in the list
|
* Emits the selected Object when a user selects it in the list
|
||||||
@@ -91,6 +94,7 @@ export class DSOSelectorComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.input.setValue(this.currentDSOId);
|
this.input.setValue(this.currentDSOId);
|
||||||
|
this.typesString = this.types.map((type: string) => type.toString().toLowerCase()).join(', ');
|
||||||
this.listEntries$ = this.input.valueChanges
|
this.listEntries$ = this.input.valueChanges
|
||||||
.pipe(
|
.pipe(
|
||||||
debounceTime(this.debounceTime),
|
debounceTime(this.debounceTime),
|
||||||
@@ -99,7 +103,7 @@ export class DSOSelectorComponent implements OnInit {
|
|||||||
return this.searchService.search(
|
return this.searchService.search(
|
||||||
new PaginatedSearchOptions({
|
new PaginatedSearchOptions({
|
||||||
query: query,
|
query: query,
|
||||||
dsoType: this.type !== DSpaceObjectType.DSPACEOBJECT ? this.type : null,
|
dsoTypes: this.types,
|
||||||
pagination: this.defaultPagination
|
pagination: this.defaultPagination
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@@ -6,7 +6,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { RouterStub } from '../../../testing/router.stub';
|
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 { Community } from '../../../../core/shared/community.model';
|
||||||
import { CreateCollectionParentSelectorComponent } from './create-collection-parent-selector.component';
|
import { CreateCollectionParentSelectorComponent } from './create-collection-parent-selector.component';
|
||||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
@@ -59,7 +59,7 @@ describe('CreateCollectionParentSelectorComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOnProperty(collectionRouter, 'getCollectionCreatePath').and.callFake(() => {
|
spyOnProperty(collectionRouterPaths, 'getCollectionCreateRoute').and.callFake(() => {
|
||||||
return () => createPath;
|
return () => createPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -3,11 +3,11 @@ import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
|||||||
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
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 { 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
|
* Component to wrap a list of existing communities inside a modal
|
||||||
@@ -20,7 +20,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel
|
|||||||
})
|
})
|
||||||
export class CreateCollectionParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class CreateCollectionParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.COLLECTION;
|
objectType = DSpaceObjectType.COLLECTION;
|
||||||
selectorType = DSpaceObjectType.COMMUNITY;
|
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
||||||
action = SelectorActionType.CREATE;
|
action = SelectorActionType.CREATE;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
@@ -36,6 +36,6 @@ export class CreateCollectionParentSelectorComponent extends DSOSelectorModalWra
|
|||||||
[COLLECTION_PARENT_PARAMETER]: dso.uuid,
|
[COLLECTION_PARENT_PARAMETER]: dso.uuid,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.router.navigate([getCollectionCreatePath()], navigationExtras);
|
this.router.navigate([getCollectionCreateRoute()], navigationExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,6 @@
|
|||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<h5 class="px-2">{{'dso-selector.create.community.sub-level' | translate}}</h5>
|
<h5 class="px-2">{{'dso-selector.create.community.sub-level' | translate}}</h5>
|
||||||
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [type]="selectorType" (onSelect)="selectObject($event)"></ds-dso-selector>
|
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" (onSelect)="selectObject($event)"></ds-dso-selector>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -6,7 +6,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { RouterStub } from '../../../testing/router.stub';
|
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 { Community } from '../../../../core/shared/community.model';
|
||||||
import { CreateCommunityParentSelectorComponent } from './create-community-parent-selector.component';
|
import { CreateCommunityParentSelectorComponent } from './create-community-parent-selector.component';
|
||||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
@@ -53,7 +53,7 @@ describe('CreateCommunityParentSelectorComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOnProperty(communityRouter, 'getCommunityCreatePath').and.callFake(() => {
|
spyOnProperty(communityRouterPaths, 'getCommunityCreateRoute').and.callFake(() => {
|
||||||
return () => createPath;
|
return () => createPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -4,14 +4,14 @@ import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.mod
|
|||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { hasValue } from '../../../empty.util';
|
import { hasValue } from '../../../empty.util';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
|
||||||
COMMUNITY_PARENT_PARAMETER,
|
|
||||||
getCommunityCreatePath
|
|
||||||
} from '../../../../+community-page/community-page-routing.module';
|
|
||||||
import {
|
import {
|
||||||
DSOSelectorModalWrapperComponent,
|
DSOSelectorModalWrapperComponent,
|
||||||
SelectorActionType
|
SelectorActionType
|
||||||
} from '../dso-selector-modal-wrapper.component';
|
} 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 -
|
* Component to wrap a button - for top communities -
|
||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
})
|
})
|
||||||
export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.COMMUNITY;
|
objectType = DSpaceObjectType.COMMUNITY;
|
||||||
selectorType = DSpaceObjectType.COMMUNITY;
|
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
||||||
action = SelectorActionType.CREATE;
|
action = SelectorActionType.CREATE;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
@@ -46,6 +46,6 @@ export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrap
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.router.navigate([getCommunityCreatePath()], navigationExtras);
|
this.router.navigate([getCommunityCreateRoute()], navigationExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel
|
|||||||
})
|
})
|
||||||
export class CreateItemParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class CreateItemParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.ITEM;
|
objectType = DSpaceObjectType.ITEM;
|
||||||
selectorType = DSpaceObjectType.COLLECTION;
|
selectorTypes = [DSpaceObjectType.COLLECTION];
|
||||||
action = SelectorActionType.CREATE;
|
action = SelectorActionType.CREATE;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
|
@@ -5,6 +5,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid ? 'search.resourceid:' + dsoRD?.payload.uuid : null" [type]="selectorType" (onSelect)="selectObject($event)"></ds-dso-selector>
|
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid ? 'search.resourceid:' + dsoRD?.payload.uuid : null" [types]="selectorTypes" (onSelect)="selectObject($event)"></ds-dso-selector>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -124,7 +124,7 @@ describe('DSOSelectorModalWrapperComponent', () => {
|
|||||||
})
|
})
|
||||||
class TestComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
class TestComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.ITEM;
|
objectType = DSpaceObjectType.ITEM;
|
||||||
selectorType = DSpaceObjectType.ITEM;
|
selectorTypes = [DSpaceObjectType.ITEM];
|
||||||
action = SelectorActionType.EDIT;
|
action = SelectorActionType.EDIT;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute) {
|
||||||
|
@@ -29,9 +29,9 @@ export abstract class DSOSelectorModalWrapperComponent implements OnInit {
|
|||||||
objectType: DSpaceObjectType;
|
objectType: DSpaceObjectType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of DSO that can be selected from this list
|
* The types of DSO that can be selected from this list
|
||||||
*/
|
*/
|
||||||
selectorType: DSpaceObjectType;
|
selectorTypes: DSpaceObjectType[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of action to perform
|
* The type of action to perform
|
||||||
|
@@ -6,7 +6,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { RouterStub } from '../../../testing/router.stub';
|
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 { EditCollectionSelectorComponent } from './edit-collection-selector.component';
|
||||||
import { Collection } from '../../../../core/shared/collection.model';
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
@@ -53,7 +53,7 @@ describe('EditCollectionSelectorComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOnProperty(collectionRouter, 'getCollectionEditPath').and.callFake(() => {
|
spyOnProperty(collectionRouterPaths, 'getCollectionEditRoute').and.callFake(() => {
|
||||||
return () => editPath;
|
return () => editPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -3,11 +3,11 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module';
|
|
||||||
import {
|
import {
|
||||||
DSOSelectorModalWrapperComponent,
|
DSOSelectorModalWrapperComponent,
|
||||||
SelectorActionType
|
SelectorActionType
|
||||||
} from '../dso-selector-modal-wrapper.component';
|
} 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
|
* Component to wrap a list of existing collections inside a modal
|
||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
})
|
})
|
||||||
export class EditCollectionSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class EditCollectionSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.COLLECTION;
|
objectType = DSpaceObjectType.COLLECTION;
|
||||||
selectorType = DSpaceObjectType.COLLECTION;
|
selectorTypes = [DSpaceObjectType.COLLECTION];
|
||||||
action = SelectorActionType.EDIT;
|
action = SelectorActionType.EDIT;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
@@ -31,6 +31,6 @@ export class EditCollectionSelectorComponent extends DSOSelectorModalWrapperComp
|
|||||||
* Navigate to the collection edit page
|
* Navigate to the collection edit page
|
||||||
*/
|
*/
|
||||||
navigate(dso: DSpaceObject) {
|
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 { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { RouterStub } from '../../../testing/router.stub';
|
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 { EditCommunitySelectorComponent } from './edit-community-selector.component';
|
||||||
import { Community } from '../../../../core/shared/community.model';
|
import { Community } from '../../../../core/shared/community.model';
|
||||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
@@ -53,7 +53,7 @@ describe('EditCommunitySelectorComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOnProperty(communityRouter, 'getCommunityEditPath').and.callFake(() => {
|
spyOnProperty(communityRouterPaths, 'getCommunityEditRoute').and.callFake(() => {
|
||||||
return () => editPath;
|
return () => editPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -3,11 +3,11 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module';
|
|
||||||
import {
|
import {
|
||||||
DSOSelectorModalWrapperComponent,
|
DSOSelectorModalWrapperComponent,
|
||||||
SelectorActionType
|
SelectorActionType
|
||||||
} from '../dso-selector-modal-wrapper.component';
|
} 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
|
* Component to wrap a list of existing communities inside a modal
|
||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
|
|
||||||
export class EditCommunitySelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class EditCommunitySelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.COMMUNITY;
|
objectType = DSpaceObjectType.COMMUNITY;
|
||||||
selectorType = DSpaceObjectType.COMMUNITY;
|
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
||||||
action = SelectorActionType.EDIT;
|
action = SelectorActionType.EDIT;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
@@ -32,6 +32,6 @@ export class EditCommunitySelectorComponent extends DSOSelectorModalWrapperCompo
|
|||||||
* Navigate to the community edit page
|
* Navigate to the community edit page
|
||||||
*/
|
*/
|
||||||
navigate(dso: DSpaceObject) {
|
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 { EditItemSelectorComponent } from './edit-item-selector.component';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { RouterStub } from '../../../testing/router.stub';
|
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 { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ describe('EditItemSelectorComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOnProperty(itemRouter, 'getItemEditPath').and.callFake(() => {
|
spyOnProperty(itemRouterPaths, 'getItemEditRoute').and.callFake(() => {
|
||||||
return () => editPath;
|
return () => editPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -3,8 +3,8 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
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 { 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
|
* Component to wrap a list of existing items inside a modal
|
||||||
@@ -17,7 +17,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel
|
|||||||
})
|
})
|
||||||
export class EditItemSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class EditItemSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.ITEM;
|
objectType = DSpaceObjectType.ITEM;
|
||||||
selectorType = DSpaceObjectType.ITEM;
|
selectorTypes = [DSpaceObjectType.ITEM];
|
||||||
action = SelectorActionType.EDIT;
|
action = SelectorActionType.EDIT;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
||||||
@@ -28,6 +28,6 @@ export class EditItemSelectorComponent extends DSOSelectorModalWrapperComponent
|
|||||||
* Navigate to the item edit page
|
* Navigate to the item edit page
|
||||||
*/
|
*/
|
||||||
navigate(dso: DSpaceObject) {
|
navigate(dso: DSpaceObject) {
|
||||||
this.router.navigate([getItemEditPath(dso.uuid)]);
|
this.router.navigate([getItemEditRoute(dso.uuid)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -130,9 +130,8 @@ describe('ExportMetadataSelectorComponent', () => {
|
|||||||
done()
|
done()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should show error notification', () => {
|
it('should not invoke metadata-export script', () => {
|
||||||
expect(notificationService.error).toHaveBeenCalled();
|
expect(scriptService.invoke).not.toHaveBeenCalled();
|
||||||
expect(scriptRequestSucceeded).toBeFalse();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-sel
|
|||||||
})
|
})
|
||||||
export class ExportMetadataSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class ExportMetadataSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.DSPACEOBJECT;
|
objectType = DSpaceObjectType.DSPACEOBJECT;
|
||||||
selectorType = DSpaceObjectType.DSPACEOBJECT;
|
selectorTypes = [DSpaceObjectType.COLLECTION, DSpaceObjectType.COMMUNITY];
|
||||||
action = SelectorActionType.EXPORT_METADATA;
|
action = SelectorActionType.EXPORT_METADATA;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router,
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router,
|
||||||
@@ -66,7 +66,6 @@ export class ExportMetadataSelectorComponent extends DSOSelectorModalWrapperComp
|
|||||||
resp$.subscribe();
|
resp$.subscribe();
|
||||||
return resp$;
|
return resp$;
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translationService.get('dso-selector.export-metadata.notValidDSO'));
|
|
||||||
return observableOf(false);
|
return observableOf(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,2 @@
|
|||||||
|
export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION';
|
||||||
|
export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#';
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user