Merge pull request #350 from atmire/delete-communities-and-collections

Delete communities and collections
This commit is contained in:
Art Lowel
2019-02-13 11:14:43 +01:00
committed by GitHub
34 changed files with 564 additions and 142 deletions

View File

@@ -29,11 +29,22 @@
} }
}, },
"edit": { "edit": {
"head": "Edit Collection" "head": "Edit Collection",
"delete": "Delete this collection"
}, },
"create": { "create": {
"head": "Create a Collection", "head": "Create a Collection",
"sub-head": "Create a Collection for Community {{ parent }}" "sub-head": "Create a Collection for Community {{ parent }}"
},
"delete": {
"head": "Delete Collection",
"text": "Are you sure you want to delete collection \"{{ dso }}\"",
"confirm": "Confirm",
"cancel": "Cancel",
"notification": {
"success": "Successfully deleted collection",
"fail": "Collection could not be deleted"
}
} }
}, },
"community": { "community": {
@@ -60,11 +71,22 @@
} }
}, },
"edit": { "edit": {
"head": "Edit Community" "head": "Edit Community",
"delete": "Delete this community"
}, },
"create": { "create": {
"head": "Create a Community", "head": "Create a Community",
"sub-head": "Create a Sub-Community for Community {{ parent }}" "sub-head": "Create a Sub-Community for Community {{ parent }}"
},
"delete": {
"head": "Delete Community",
"text": "Are you sure you want to delete community \"{{ dso }}\"",
"confirm": "Confirm",
"cancel": "Cancel",
"notification": {
"success": "Successfully deleted community",
"fail": "Community could not be deleted"
}
} }
}, },
"item": { "item": {

View File

@@ -7,6 +7,7 @@ import { CreateCollectionPageComponent } from './create-collection-page/create-c
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component'; import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component';
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';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -25,6 +26,15 @@ import { CreateCollectionPageGuard } from './create-collection-page/create-colle
dso: CollectionPageResolver dso: CollectionPageResolver
} }
}, },
{
path: ':id/delete',
pathMatch: 'full',
component: DeleteCollectionPageComponent,
canActivate: [AuthenticatedGuard],
resolve: {
dso: CollectionPageResolver
}
},
{ {
path: ':id', path: ':id',
component: CollectionPageComponent, component: CollectionPageComponent,

View File

@@ -9,6 +9,7 @@ import { CreateCollectionPageComponent } from './create-collection-page/create-c
import { CollectionFormComponent } from './collection-form/collection-form.component'; import { CollectionFormComponent } from './collection-form/collection-form.component';
import { SearchPageModule } from '../+search-page/search-page.module'; import { SearchPageModule } from '../+search-page/search-page.module';
import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component'; import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component';
import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -21,6 +22,7 @@ import { EditCollectionPageComponent } from './edit-collection-page/edit-collect
CollectionPageComponent, CollectionPageComponent,
CreateCollectionPageComponent, CreateCollectionPageComponent,
EditCollectionPageComponent, EditCollectionPageComponent,
DeleteCollectionPageComponent,
CollectionFormComponent CollectionFormComponent
] ]
}) })

View File

@@ -0,0 +1,19 @@
<div class="container">
<div class="row">
<ng-container *ngVar="(dsoRD$ | async)?.payload as dso">
<div class="col-12 pb-4">
<h2 id="header" class="border-bottom pb-2">{{ 'community.delete.head' | translate
}}</h2>
<p class="pb-2">{{ 'community.delete.text' | translate:{ dso: dso.name } }}</p>
<button class="btn btn-primary mr-2" (click)="onConfirm(dso)">
{{'community.delete.confirm' |
translate}}
</button>
<button class="btn btn-primary" (click)="onCancel(dso)">{{'community.delete.cancel' | translate}}
</button>
</div>
</ng-container>
</div>
</div>

View File

@@ -0,0 +1,41 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { SharedModule } from '../../shared/shared.module';
import { of as observableOf } from 'rxjs';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { DeleteCollectionPageComponent } from './delete-collection-page.component';
import { CollectionDataService } from '../../core/data/collection-data.service';
describe('DeleteCollectionPageComponent', () => {
let comp: DeleteCollectionPageComponent;
let fixture: ComponentFixture<DeleteCollectionPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
declarations: [DeleteCollectionPageComponent],
providers: [
{ provide: CollectionDataService, useValue: {} },
{ provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } },
{ provide: NotificationsService, useValue: {} },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DeleteCollectionPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
});
describe('frontendURL', () => {
it('should have the right frontendURL set', () => {
expect((comp as any).frontendURL).toEqual('/collections/');
})
});
});

View File

@@ -0,0 +1,33 @@
import { Component } from '@angular/core';
import { Community } from '../../core/shared/community.model';
import { CommunityDataService } from '../../core/data/community-data.service';
import { ActivatedRoute, Router } from '@angular/router';
import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model';
import { DeleteComColPageComponent } from '../../shared/comcol-forms/delete-comcol-page/delete-comcol-page.component';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { CollectionDataService } from '../../core/data/collection-data.service';
import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
import { Collection } from '../../core/shared/collection.model';
import { TranslateService } from '@ngx-translate/core';
/**
* Component that represents the page where a user can delete an existing Collection
*/
@Component({
selector: 'ds-delete-collection',
styleUrls: ['./delete-collection-page.component.scss'],
templateUrl: './delete-collection-page.component.html'
})
export class DeleteCollectionPageComponent extends DeleteComColPageComponent<Collection, NormalizedCollection> {
protected frontendURL = '/collections/';
public constructor(
protected dsoDataService: CollectionDataService,
protected router: Router,
protected route: ActivatedRoute,
protected notifications: NotificationsService,
protected translate: TranslateService
) {
super(dsoDataService, router, route, notifications, translate);
}
}

View File

@@ -1,8 +1,11 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-12 pb-4"> <div class="col-12 pb-4">
<h2 id="header" class="border-bottom pb-2">{{ 'collection.edit.head' | translate }}</h2> <h2 id="header" class="border-bottom pb-2">{{ 'collection.edit.head' | translate }}</h2>
<ds-collection-form (submitForm)="onSubmit($event)" [dso]="(dsoRD$ | async)?.payload"></ds-collection-form>
<a class="btn btn-danger"
[routerLink]="'/collections/' + (dsoRD$ | async)?.payload.uuid + '/delete'">{{'collection.edit.delete'
| translate}}</a>
</div> </div>
</div> </div>
<ds-collection-form (submitForm)="onSubmit($event)" [dso]="(dsoRD$ | async)?.payload"></ds-collection-form>
</div> </div>

View File

@@ -1,11 +1,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { EditCollectionPageComponent } from './edit-collection-page.component'; import { EditCollectionPageComponent } from './edit-collection-page.component';
import { RouteService } from '../../shared/services/route.service';
import { SharedModule } from '../../shared/shared.module'; import { SharedModule } from '../../shared/shared.module';
import { CollectionDataService } from '../../core/data/collection-data.service'; import { CollectionDataService } from '../../core/data/collection-data.service';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
@@ -20,9 +19,7 @@ describe('EditCollectionPageComponent', () => {
declarations: [EditCollectionPageComponent], declarations: [EditCollectionPageComponent],
providers: [ providers: [
{ provide: CollectionDataService, useValue: {} }, { provide: CollectionDataService, useValue: {} },
{ provide: RouteService, useValue: {} }, { provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } },
{ provide: Router, useValue: {} },
{ provide: ActivatedRoute, useValue: { data: observableOf({dso: undefined}) } },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();

View File

@@ -1,5 +1,4 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { RouteService } from '../../shared/services/route.service';
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 { NormalizedCollection } from '../../core/cache/models/normalized-collection.model'; import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
@@ -19,10 +18,9 @@ export class EditCollectionPageComponent extends EditComColPageComponent<Collect
public constructor( public constructor(
protected collectionDataService: CollectionDataService, protected collectionDataService: CollectionDataService,
protected routeService: RouteService,
protected router: Router, protected router: Router,
protected route: ActivatedRoute protected route: ActivatedRoute
) { ) {
super(collectionDataService, routeService, router, route); super(collectionDataService, router, route);
} }
} }

View File

@@ -7,6 +7,7 @@ import { CreateCommunityPageComponent } from './create-community-page/create-com
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component'; import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component';
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';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -25,6 +26,15 @@ import { CreateCommunityPageGuard } from './create-community-page/create-communi
dso: CommunityPageResolver dso: CommunityPageResolver
} }
}, },
{
path: ':id/delete',
pathMatch: 'full',
component: DeleteCommunityPageComponent,
canActivate: [AuthenticatedGuard],
resolve: {
dso: CommunityPageResolver
}
},
{ {
path: ':id', path: ':id',
component: CommunityPageComponent, component: CommunityPageComponent,

View File

@@ -10,6 +10,7 @@ import {CommunityPageSubCommunityListComponent} from './sub-community-list/commu
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
import { CommunityFormComponent } from './community-form/community-form.component'; import { CommunityFormComponent } from './community-form/community-form.component';
import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component'; import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component';
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -23,9 +24,11 @@ import { EditCommunityPageComponent } from './edit-community-page/edit-community
CommunityPageSubCommunityListComponent, CommunityPageSubCommunityListComponent,
CreateCommunityPageComponent, CreateCommunityPageComponent,
EditCommunityPageComponent, EditCommunityPageComponent,
DeleteCommunityPageComponent,
CommunityFormComponent CommunityFormComponent
] ]
}) })
export class CommunityPageModule { export class CommunityPageModule {
} }

View File

@@ -0,0 +1,19 @@
<div class="container">
<div class="row">
<ng-container *ngVar="(dsoRD$ | async)?.payload as dso">
<div class="col-12 pb-4">
<h2 id="header" class="border-bottom pb-2">{{ 'community.delete.head' | translate
}}</h2>
<p class="pb-2">{{ 'community.delete.text' | translate:{ dso: dso.name } }}</p>
<button class="btn btn-primary mr-2" (click)="onConfirm(dso)">
{{'community.delete.confirm' |
translate}}
</button>
<button class="btn btn-primary" (click)="onCancel(dso)">{{'community.delete.cancel' | translate}}
</button>
</div>
</ng-container>
</div>
</div>

View File

@@ -0,0 +1,42 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { RouteService } from '../../shared/services/route.service';
import { SharedModule } from '../../shared/shared.module';
import { of as observableOf } from 'rxjs';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { DeleteCommunityPageComponent } from './delete-community-page.component';
import { CommunityDataService } from '../../core/data/community-data.service';
describe('DeleteCommunityPageComponent', () => {
let comp: DeleteCommunityPageComponent;
let fixture: ComponentFixture<DeleteCommunityPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
declarations: [DeleteCommunityPageComponent],
providers: [
{ provide: CommunityDataService, useValue: {} },
{ provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } },
{ provide: NotificationsService, useValue: {} },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DeleteCommunityPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
});
describe('frontendURL', () => {
it('should have the right frontendURL set', () => {
expect((comp as any).frontendURL).toEqual('/communities/');
})
});
});

View File

@@ -0,0 +1,30 @@
import { Component } from '@angular/core';
import { Community } from '../../core/shared/community.model';
import { CommunityDataService } from '../../core/data/community-data.service';
import { ActivatedRoute, Router } from '@angular/router';
import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model';
import { DeleteComColPageComponent } from '../../shared/comcol-forms/delete-comcol-page/delete-comcol-page.component';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
/**
* Component that represents the page where a user can delete an existing Community
*/
@Component({
selector: 'ds-delete-community',
styleUrls: ['./delete-community-page.component.scss'],
templateUrl: './delete-community-page.component.html'
})
export class DeleteCommunityPageComponent extends DeleteComColPageComponent<Community, NormalizedCommunity> {
protected frontendURL = '/communities/';
public constructor(
protected dsoDataService: CommunityDataService,
protected router: Router,
protected route: ActivatedRoute,
protected notifications: NotificationsService,
protected translate: TranslateService
) {
super(dsoDataService, router, route, notifications, translate);
}
}

View File

@@ -1,8 +1,12 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-12 pb-4"> <div class="col-12 pb-4">
<h2 id="header" class="border-bottom pb-2">{{ 'community.edit.head' | translate }}</h2> <h2 id="header" class="border-bottom pb-2">{{ 'community.edit.head' | translate }}</h2>
<ds-community-form (submitForm)="onSubmit($event)"
[dso]="(dsoRD$ | async)?.payload"></ds-community-form>
<a class="btn btn-danger"
[routerLink]="'/communities/' + (dsoRD$ | async)?.payload.uuid + '/delete'">{{'community.edit.delete'
| translate}}</a>
</div>
</div> </div>
</div>
<ds-community-form (submitForm)="onSubmit($event)" [dso]="(dsoRD$ | async)?.payload"></ds-community-form>
</div> </div>

View File

@@ -1,10 +1,9 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { RouteService } from '../../shared/services/route.service';
import { SharedModule } from '../../shared/shared.module'; import { SharedModule } from '../../shared/shared.module';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { EditCommunityPageComponent } from './edit-community-page.component'; import { EditCommunityPageComponent } from './edit-community-page.component';
@@ -20,9 +19,7 @@ describe('EditCommunityPageComponent', () => {
declarations: [EditCommunityPageComponent], declarations: [EditCommunityPageComponent],
providers: [ providers: [
{ provide: CommunityDataService, useValue: {} }, { provide: CommunityDataService, useValue: {} },
{ provide: RouteService, useValue: {} }, { provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } },
{ provide: Router, useValue: {} },
{ provide: ActivatedRoute, useValue: { data: observableOf({dso: undefined}) } },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();

View File

@@ -1,7 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Community } from '../../core/shared/community.model'; import { Community } from '../../core/shared/community.model';
import { CommunityDataService } from '../../core/data/community-data.service'; import { CommunityDataService } from '../../core/data/community-data.service';
import { RouteService } from '../../shared/services/route.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model'; import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model';
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';
@@ -19,10 +18,9 @@ export class EditCommunityPageComponent extends EditComColPageComponent<Communit
public constructor( public constructor(
protected communityDataService: CommunityDataService, protected communityDataService: CommunityDataService,
protected routeService: RouteService,
protected router: Router, protected router: Router,
protected route: ActivatedRoute protected route: ActivatedRoute
) { ) {
super(communityDataService, routeService, router, route); super(communityDataService, router, route);
} }
} }

View File

@@ -27,8 +27,6 @@ let routerStub;
let mockItemDataService: ItemDataService; let mockItemDataService: ItemDataService;
let routeStub; let routeStub;
let notificationsServiceStub; let notificationsServiceStub;
let successfulRestResponse;
let failRestResponse;
describe('ItemDeleteComponent', () => { describe('ItemDeleteComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -46,14 +44,12 @@ describe('ItemDeleteComponent', () => {
}); });
mockItemDataService = jasmine.createSpyObj('mockItemDataService', { mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
delete: observableOf(new RestResponse(true, '200')) delete: observableOf(true)
}); });
routeStub = { routeStub = {
data: observableOf({ data: observableOf({
item: new RemoteData(false, false, true, null, { item: new RemoteData(false, false, true, null, mockItem)
id: 'fake-id'
})
}) })
}; };
@@ -63,10 +59,10 @@ describe('ItemDeleteComponent', () => {
imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()],
declarations: [ItemDeleteComponent], declarations: [ItemDeleteComponent],
providers: [ providers: [
{provide: ActivatedRoute, useValue: routeStub}, { provide: ActivatedRoute, useValue: routeStub },
{provide: Router, useValue: routerStub}, { provide: Router, useValue: routerStub },
{provide: ItemDataService, useValue: mockItemDataService}, { provide: ItemDataService, useValue: mockItemDataService },
{provide: NotificationsService, useValue: notificationsServiceStub}, { provide: NotificationsService, useValue: notificationsServiceStub },
], schemas: [ ], schemas: [
CUSTOM_ELEMENTS_SCHEMA CUSTOM_ELEMENTS_SCHEMA
] ]
@@ -74,9 +70,6 @@ describe('ItemDeleteComponent', () => {
})); }));
beforeEach(() => { beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200');
failRestResponse = new RestResponse(false, '500');
fixture = TestBed.createComponent(ItemDeleteComponent); fixture = TestBed.createComponent(ItemDeleteComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
@@ -95,22 +88,21 @@ describe('ItemDeleteComponent', () => {
describe('performAction', () => { describe('performAction', () => {
it('should call delete function from the ItemDataService', () => { it('should call delete function from the ItemDataService', () => {
spyOn(comp, 'processRestResponse'); spyOn(comp, 'notify');
comp.performAction(); comp.performAction();
expect(mockItemDataService.delete).toHaveBeenCalledWith(mockItem);
expect(mockItemDataService.delete).toHaveBeenCalledWith(mockItem.id); expect(comp.notify).toHaveBeenCalled();
expect(comp.processRestResponse).toHaveBeenCalled();
}); });
}); });
describe('processRestResponse', () => { describe('notify', () => {
it('should navigate to the homepage on successful deletion of the item', () => { it('should navigate to the homepage on successful deletion of the item', () => {
comp.processRestResponse(successfulRestResponse); comp.notify(true);
expect(routerStub.navigate).toHaveBeenCalledWith(['']); expect(routerStub.navigate).toHaveBeenCalledWith(['']);
}); });
}); });
describe('processRestResponse', () => { 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.processRestResponse(failRestResponse); comp.notify(false);
expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath('fake-id')]); expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath('fake-id')]);
}); });
}); });

View File

@@ -19,20 +19,19 @@ export class ItemDeleteComponent extends AbstractSimpleItemActionComponent {
* Perform the delete action to the item * Perform the delete action to the item
*/ */
performAction() { performAction() {
this.itemDataService.delete(this.item.id).pipe(first()).subscribe( this.itemDataService.delete(this.item).pipe(first()).subscribe(
(response: RestResponse) => { (succeeded: boolean) => {
this.processRestResponse(response); this.notify(succeeded);
} }
); );
} }
/** /**
* Process the RestResponse retrieved from the server.
* When the item is successfully delete, navigate to the homepage, otherwise navigate back to the item edit page * When the item is successfully delete, navigate to the homepage, otherwise navigate back to the item edit page
* @param response * @param response
*/ */
processRestResponse(response: RestResponse) { notify(succeeded: boolean) {
if (response.isSuccessful) { if (succeeded) {
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(['']); this.router.navigate(['']);
} else { } else {

View File

@@ -86,7 +86,7 @@ describe('ComColDataService', () => {
function initMockCommunityDataService(): CommunityDataService { function initMockCommunityDataService(): CommunityDataService {
return jasmine.createSpyObj('responseCache', { return jasmine.createSpyObj('responseCache', {
getEndpoint: hot('--a-', { a: communitiesEndpoint }), getEndpoint: hot('--a-', { a: communitiesEndpoint }),
getFindByIDHref: cold('b-', { b: communityEndpoint }) getIDHref: cold('b-', { b: communityEndpoint })
}); });
} }

View File

@@ -42,7 +42,7 @@ export abstract class ComColDataService<TNormalized extends NormalizedObject, TD
return this.halService.getEndpoint(linkPath); return this.halService.getEndpoint(linkPath);
} else { } else {
const scopeCommunityHrefObs = this.cds.getEndpoint().pipe( const scopeCommunityHrefObs = this.cds.getEndpoint().pipe(
mergeMap((endpoint: string) => this.cds.getFindByIDHref(endpoint, options.scopeID)), mergeMap((endpoint: string) => this.cds.getIDHref(endpoint, options.scopeID)),
filter((href: string) => isNotEmpty(href)), filter((href: string) => isNotEmpty(href)),
take(1), take(1),
tap((href: string) => { tap((href: string) => {

View File

@@ -1,12 +1,12 @@
import { import {
delay,
distinctUntilChanged, distinctUntilChanged,
filter, filter,
find, find,
switchMap, first,
map, map,
take, mergeMap,
tap, first, mergeMap switchMap,
take
} from 'rxjs/operators'; } from 'rxjs/operators';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@@ -19,28 +19,26 @@ import { PaginatedList } from './paginated-list';
import { RemoteData } from './remote-data'; import { RemoteData } from './remote-data';
import { import {
CreateRequest, CreateRequest,
DeleteByIDRequest,
FindAllOptions, FindAllOptions,
FindAllRequest, FindAllRequest,
FindByIDRequest, FindByIDRequest,
GetRequest, RestRequest GetRequest
} from './request.models'; } from './request.models';
import { RequestService } from './request.service'; import { RequestService } from './request.service';
import { NormalizedObject } from '../cache/models/normalized-object.model'; import { NormalizedObject } from '../cache/models/normalized-object.model';
import { compare, Operation } from 'fast-json-patch'; import { Operation } from 'fast-json-patch';
import { ObjectCacheService } from '../cache/object-cache.service'; import { ObjectCacheService } from '../cache/object-cache.service';
import { DSpaceObject } from '../shared/dspace-object.model'; import { DSpaceObject } from '../shared/dspace-object.model';
import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsService } from '../../shared/notifications/notifications.service';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { import { configureRequest, getResponseFromEntry } from '../shared/operators';
configureRequest, import { ErrorResponse, RestResponse } from '../cache/response.models';
filterSuccessfulResponses, getResourceLinksFromResponse,
getResponseFromEntry
} from '../shared/operators';
import { DSOSuccessResponse, ErrorResponse, RestResponse } from '../cache/response.models';
import { NotificationOptions } from '../../shared/notifications/models/notification-options.model'; import { NotificationOptions } from '../../shared/notifications/models/notification-options.model';
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory';
import { CacheableObject } from '../cache/object-cache.reducer'; import { CacheableObject } from '../cache/object-cache.reducer';
import { RequestEntry } from './request.reducer';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
import { ChangeAnalyzer } from './change-analyzer'; import { ChangeAnalyzer } from './change-analyzer';
@@ -97,13 +95,18 @@ export abstract class DataService<TNormalized extends NormalizedObject, TDomain
return this.rdbService.buildList<TNormalized, TDomain>(hrefObs) as Observable<RemoteData<PaginatedList<TDomain>>>; return this.rdbService.buildList<TNormalized, TDomain>(hrefObs) as Observable<RemoteData<PaginatedList<TDomain>>>;
} }
getFindByIDHref(endpoint, resourceID): string { /**
* Create the HREF for a specific object based on its identifier
* @param endpoint The base endpoint for the type of object
* @param resourceID The identifier for the object
*/
getIDHref(endpoint, resourceID): string {
return `${endpoint}/${resourceID}`; return `${endpoint}/${resourceID}`;
} }
findById(id: string): Observable<RemoteData<TDomain>> { findById(id: string): Observable<RemoteData<TDomain>> {
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe( const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
map((endpoint: string) => this.getFindByIDHref(endpoint, id))); map((endpoint: string) => this.getIDHref(endpoint, id)));
hrefObs.pipe( hrefObs.pipe(
find((href: string) => hasValue(href))) find((href: string) => hasValue(href)))
@@ -201,4 +204,29 @@ export abstract class DataService<TNormalized extends NormalizedObject, TDomain
) )
} }
/**
* Delete an existing DSpace Object on the server
* @param dso The DSpace Object to be removed
* Return an observable that emits true when the deletion was successful, false when it failed
*/
delete(dso: TDomain): Observable<boolean> {
const requestId = this.requestService.generateRequestId();
const hrefObs = this.halService.getEndpoint(this.linkPath).pipe(
map((endpoint: string) => this.getIDHref(endpoint, dso.uuid)));
hrefObs.pipe(
find((href: string) => hasValue(href)),
map((href: string) => {
const request = new DeleteByIDRequest(requestId, href, dso.uuid);
this.requestService.configure(request);
})
).subscribe();
return this.requestService.getByUUID(requestId).pipe(
find((request: RequestEntry) => request.completed),
map((request: RequestEntry) => request.response.isSuccessful)
);
}
} }

View File

@@ -37,7 +37,7 @@ class DataServiceImpl extends DataService<NormalizedDSpaceObject, DSpaceObject>
return this.halService.getEndpoint(linkPath); return this.halService.getEndpoint(linkPath);
} }
getFindByIDHref(endpoint, resourceID): string { getIDHref(endpoint, resourceID): string {
return endpoint.replace(/\{\?uuid\}/,`?uuid=${resourceID}`); return endpoint.replace(/\{\?uuid\}/,`?uuid=${resourceID}`);
} }
} }

View File

@@ -162,25 +162,4 @@ describe('ItemDataService', () => {
}); });
}); });
describe('getItemDeleteEndpoint', () => {
beforeEach(() => {
scheduler = getTestScheduler();
service = initTestService();
});
it('should return the endpoint to make an item private or public', () => {
const result = service.getItemDeleteEndpoint(scopeID);
const expected = cold('a', {a: ScopedItemEndpoint});
expect(result).toBeObservable(expected);
});
it('should delete the item', () => {
const expected = new RestResponse(true, '200');
const result = service.delete(scopeID);
result.subscribe((v) => expect(v).toEqual(expected));
});
});
}); });

View File

@@ -14,7 +14,7 @@ import { URLCombiner } from '../url-combiner/url-combiner';
import { DataService } from './data.service'; import { DataService } from './data.service';
import { RequestService } from './request.service'; import { RequestService } from './request.service';
import { HALEndpointService } from '../shared/hal-endpoint.service'; import { HALEndpointService } from '../shared/hal-endpoint.service';
import { DeleteRequest, FindAllOptions, PatchRequest, RestRequest } from './request.models'; import { FindAllOptions, PatchRequest, RestRequest } from './request.models';
import { ObjectCacheService } from '../cache/object-cache.service'; import { ObjectCacheService } from '../cache/object-cache.service';
import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsService } from '../../shared/notifications/notifications.service';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
@@ -64,7 +64,7 @@ export class ItemDataService extends DataService<NormalizedItem, Item> {
*/ */
public getItemWithdrawEndpoint(itemId: string): Observable<string> { public getItemWithdrawEndpoint(itemId: string): Observable<string> {
return this.halService.getEndpoint(this.linkPath).pipe( return this.halService.getEndpoint(this.linkPath).pipe(
map((endpoint: string) => this.getFindByIDHref(endpoint, itemId)) map((endpoint: string) => this.getIDHref(endpoint, itemId))
); );
} }
@@ -74,17 +74,7 @@ export class ItemDataService extends DataService<NormalizedItem, Item> {
*/ */
public getItemDiscoverableEndpoint(itemId: string): Observable<string> { public getItemDiscoverableEndpoint(itemId: string): Observable<string> {
return this.halService.getEndpoint(this.linkPath).pipe( return this.halService.getEndpoint(this.linkPath).pipe(
map((endpoint: string) => this.getFindByIDHref(endpoint, itemId)) map((endpoint: string) => this.getIDHref(endpoint, itemId))
);
}
/**
* Get the endpoint to delete the item
* @param itemId
*/
public getItemDeleteEndpoint(itemId: string): Observable<string> {
return this.halService.getEndpoint(this.linkPath).pipe(
map((endpoint: string) => this.getFindByIDHref(endpoint, itemId))
); );
} }
@@ -129,22 +119,4 @@ export class ItemDataService extends DataService<NormalizedItem, Item> {
map((requestEntry: RequestEntry) => requestEntry.response) map((requestEntry: RequestEntry) => requestEntry.response)
); );
} }
/**
* Delete the item
* @param itemId
*/
public delete(itemId: string) {
return this.getItemDeleteEndpoint(itemId).pipe(
distinctUntilChanged(),
map((endpointURL: string) =>
new DeleteRequest(this.requestService.generateRequestId(), endpointURL)
),
configureRequest(this.requestService),
map((request: RestRequest) => request.href),
getRequestFromRequestHref(this.requestService),
map((requestEntry: RequestEntry) => requestEntry.response)
);
}
} }

View File

@@ -227,6 +227,19 @@ export class CreateRequest extends PostRequest {
} }
} }
/**
* Request to delete an object based on its identifier
*/
export class DeleteByIDRequest extends DeleteRequest {
constructor(
uuid: string,
href: string,
public resourceID: string
) {
super(uuid, href);
}
}
export class RequestError extends Error { export class RequestError extends Error {
statusText: string; statusText: string;
} }

View File

@@ -21,7 +21,7 @@ import { NormalizedDSpaceObject } from '../../../core/cache/models/normalized-ds
}) })
export class CreateComColPageComponent<TDomain extends DSpaceObject, TNormalized extends NormalizedDSpaceObject> implements OnInit { export class CreateComColPageComponent<TDomain extends DSpaceObject, TNormalized extends NormalizedDSpaceObject> implements OnInit {
/** /**
* Frontend endpoint where for this type of DSP * Frontend endpoint for this type of DSO
*/ */
protected frontendURL: string; protected frontendURL: string;

View File

@@ -0,0 +1,155 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommunityDataService } from '../../../core/data/community-data.service';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { of as observableOf } from 'rxjs';
import { Community } from '../../../core/shared/community.model';
import { SharedModule } from '../../shared.module';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { NormalizedDSpaceObject } from '../../../core/cache/models/normalized-dspace-object.model';
import { DataService } from '../../../core/data/data.service';
import { DeleteComColPageComponent } from './delete-comcol-page.component';
import { NotificationsService } from '../../notifications/notifications.service';
import { NotificationsServiceStub } from '../../testing/notifications-service-stub';
describe('DeleteComColPageComponent', () => {
let comp: DeleteComColPageComponent<DSpaceObject, NormalizedDSpaceObject>;
let fixture: ComponentFixture<DeleteComColPageComponent<DSpaceObject, NormalizedDSpaceObject>>;
let dsoDataService: CommunityDataService;
let router: Router;
let community;
let newCommunity;
let routerStub;
let routeStub;
let notificationsService;
const validUUID = 'valid-uuid';
const invalidUUID = 'invalid-uuid';
const frontendURL = '/testType';
function initializeVars() {
community = Object.assign(new Community(), {
uuid: 'a20da287-e174-466a-9926-f66b9300d347',
metadata: [{
key: 'dc.title',
value: 'test community'
}]
});
newCommunity = Object.assign(new Community(), {
uuid: '1ff59938-a69a-4e62-b9a4-718569c55d48',
metadata: [{
key: 'dc.title',
value: 'new community'
}]
});
dsoDataService = jasmine.createSpyObj(
'dsoDataService',
{
delete: observableOf(true)
});
routerStub = {
navigate: (commands) => commands
};
routeStub = {
data: observableOf(community)
};
}
beforeEach(async(() => {
initializeVars();
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
providers: [
{ provide: DataService, useValue: dsoDataService },
{ provide: Router, useValue: routerStub },
{ provide: ActivatedRoute, useValue: routeStub },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DeleteComColPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
notificationsService = (comp as any).notifications;
(comp as any).frontendURL = frontendURL;
router = (comp as any).router;
});
describe('onConfirm', () => {
let data1;
let data2;
beforeEach(() => {
data1 = Object.assign(new Community(), {
uuid: validUUID,
metadata: [{
key: 'dc.title',
value: 'test'
}]
});
data2 = Object.assign(new Community(), {
uuid: invalidUUID,
metadata: [{
key: 'dc.title',
value: 'test'
}]
});
});
it('should show an error notification on failure', () => {
(dsoDataService.delete as any).and.returnValue(observableOf(false));
spyOn(notificationsService, 'error');
spyOn(router, 'navigate');
comp.onConfirm(data2);
fixture.detectChanges();
expect(notificationsService.error).toHaveBeenCalled();
expect(router.navigate).toHaveBeenCalled();
});
it('should show a success notification on success and navigate', () => {
spyOn(notificationsService, 'success');
spyOn(router, 'navigate');
comp.onConfirm(data1);
fixture.detectChanges();
expect(notificationsService.success).toHaveBeenCalled();
expect(router.navigate).toHaveBeenCalled();
});
it('should call delete on the data service', () => {
comp.onConfirm(data1);
fixture.detectChanges();
expect(dsoDataService.delete).toHaveBeenCalledWith(data1);
});
});
describe('onCancel', () => {
let data1;
beforeEach(() => {
data1 = Object.assign(new Community(), {
uuid: validUUID,
metadata: [{
key: 'dc.title',
value: 'test'
}]
});
});
it('should redirect to the edit page', () => {
const redirectURL = frontendURL + '/' + validUUID + '/edit';
spyOn(router, 'navigate');
comp.onCancel(data1);
fixture.detectChanges();
expect(router.navigate).toHaveBeenCalledWith([redirectURL]);
});
});
});

View File

@@ -0,0 +1,71 @@
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { RouteService } from '../../services/route.service';
import { ActivatedRoute, Router } from '@angular/router';
import { RemoteData } from '../../../core/data/remote-data';
import { isNotUndefined } from '../../empty.util';
import { first, map } from 'rxjs/operators';
import { getSucceededRemoteData } from '../../../core/shared/operators';
import { DataService } from '../../../core/data/data.service';
import { NormalizedDSpaceObject } from '../../../core/cache/models/normalized-dspace-object.model';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { NotificationsService } from '../../notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
/**
* Component representing the delete page for communities and collections
*/
@Component({
selector: 'ds-delete-comcol',
template: ''
})
export class DeleteComColPageComponent<TDomain extends DSpaceObject, TNormalized extends NormalizedDSpaceObject> implements OnInit {
/**
* Frontend endpoint for this type of DSO
*/
protected frontendURL: string;
/**
* The initial DSO object
*/
public dsoRD$: Observable<RemoteData<TDomain>>;
public constructor(
protected dsoDataService: DataService<TNormalized, TDomain>,
protected router: Router,
protected route: ActivatedRoute,
protected notifications: NotificationsService,
protected translate: TranslateService
) {
}
ngOnInit(): void {
this.dsoRD$ = this.route.data.pipe(first(), map((data) => data.dso));
}
/**
* @param {TDomain} dso The DSO to delete
* Deletes an existing DSO and redirects to the home page afterwards, showing a notification that states whether or not the deletion was successful
*/
onConfirm(dso: TDomain) {
this.dsoDataService.delete(dso)
.pipe(first())
.subscribe((success: boolean) => {
if (success) {
const successMessage = this.translate.instant(dso.type + '.delete.notification.success');
this.notifications.success(successMessage)
} else {
const errorMessage = this.translate.instant(dso.type + '.delete.notification.fail');
this.notifications.error(errorMessage)
}
this.router.navigate(['/']);
});
}
/**
* @param {TDomain} dso The DSO for which the delete action was canceled
* When a delete is canceled, the user is redirected to the DSO's edit page
*/
onCancel(dso: TDomain) {
this.router.navigate([this.frontendURL + '/' + dso.uuid + '/edit']);
}
}

View File

@@ -1,6 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommunityDataService } from '../../../core/data/community-data.service'; import { CommunityDataService } from '../../../core/data/community-data.service';
import { RouteService } from '../../services/route.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
@@ -18,15 +17,12 @@ import { DataService } from '../../../core/data/data.service';
describe('EditComColPageComponent', () => { describe('EditComColPageComponent', () => {
let comp: EditComColPageComponent<DSpaceObject, NormalizedDSpaceObject>; let comp: EditComColPageComponent<DSpaceObject, NormalizedDSpaceObject>;
let fixture: ComponentFixture<EditComColPageComponent<DSpaceObject, NormalizedDSpaceObject>>; let fixture: ComponentFixture<EditComColPageComponent<DSpaceObject, NormalizedDSpaceObject>>;
let communityDataService: CommunityDataService;
let dsoDataService: CommunityDataService; let dsoDataService: CommunityDataService;
let routeService: RouteService;
let router: Router; let router: Router;
let community; let community;
let newCommunity; let newCommunity;
let communityDataServiceStub; let communityDataServiceStub;
let routeServiceStub;
let routerStub; let routerStub;
let routeStub; let routeStub;
@@ -48,20 +44,10 @@ describe('EditComColPageComponent', () => {
}); });
communityDataServiceStub = { communityDataServiceStub = {
findById: (uuid) => observableOf(new RemoteData(false, false, true, null, Object.assign(new Community(), {
uuid: uuid,
metadata: [{
key: 'dc.title',
value: community.name
}]
}))),
update: (com, uuid?) => observableOf(new RemoteData(false, false, true, undefined, newCommunity)) update: (com, uuid?) => observableOf(new RemoteData(false, false, true, undefined, newCommunity))
}; };
routeServiceStub = {
getQueryParameterValue: (param) => observableOf(community.uuid)
};
routerStub = { routerStub = {
navigate: (commands) => commands navigate: (commands) => commands
}; };
@@ -78,7 +64,6 @@ describe('EditComColPageComponent', () => {
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
providers: [ providers: [
{ provide: DataService, useValue: communityDataServiceStub }, { provide: DataService, useValue: communityDataServiceStub },
{ provide: RouteService, useValue: routeServiceStub },
{ provide: Router, useValue: routerStub }, { provide: Router, useValue: routerStub },
{ provide: ActivatedRoute, useValue: routeStub }, { provide: ActivatedRoute, useValue: routeStub },
], ],
@@ -91,8 +76,6 @@ describe('EditComColPageComponent', () => {
comp = fixture.componentInstance; comp = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
dsoDataService = (comp as any).dsoDataService; dsoDataService = (comp as any).dsoDataService;
communityDataService = (comp as any).communityDataService;
routeService = (comp as any).routeService;
router = (comp as any).router; router = (comp as any).router;
}); });

View File

@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { RouteService } from '../../services/route.service';
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 { isNotUndefined } from '../../empty.util'; import { isNotUndefined } from '../../empty.util';
@@ -19,7 +18,7 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model';
}) })
export class EditComColPageComponent<TDomain extends DSpaceObject, TNormalized extends NormalizedDSpaceObject> implements OnInit { export class EditComColPageComponent<TDomain extends DSpaceObject, TNormalized extends NormalizedDSpaceObject> implements OnInit {
/** /**
* Frontend endpoint where for this type of DSP * Frontend endpoint for this type of DSO
*/ */
protected frontendURL: string; protected frontendURL: string;
/** /**
@@ -29,7 +28,6 @@ export class EditComColPageComponent<TDomain extends DSpaceObject, TNormalized e
public constructor( public constructor(
protected dsoDataService: DataService<TNormalized, TDomain>, protected dsoDataService: DataService<TNormalized, TDomain>,
protected routeService: RouteService,
protected router: Router, protected router: Router,
protected route: ActivatedRoute protected route: ActivatedRoute
) { ) {

View File

@@ -89,6 +89,7 @@ import { MenuModule } from './menu/menu.module';
import { ComColFormComponent } from './comcol-forms/comcol-form/comcol-form.component'; import { ComColFormComponent } from './comcol-forms/comcol-form/comcol-form.component';
import { CreateComColPageComponent } from './comcol-forms/create-comcol-page/create-comcol-page.component'; import { CreateComColPageComponent } from './comcol-forms/create-comcol-page/create-comcol-page.component';
import { EditComColPageComponent } from './comcol-forms/edit-comcol-page/edit-comcol-page.component'; import { EditComColPageComponent } from './comcol-forms/edit-comcol-page/edit-comcol-page.component';
import { DeleteComColPageComponent } from './comcol-forms/delete-comcol-page/delete-comcol-page.component';
import { LangSwitchComponent } from './lang-switch/lang-switch.component'; import { LangSwitchComponent } from './lang-switch/lang-switch.component';
const MODULES = [ const MODULES = [
@@ -136,6 +137,7 @@ const COMPONENTS = [
ComColFormComponent, ComColFormComponent,
CreateComColPageComponent, CreateComColPageComponent,
EditComColPageComponent, EditComColPageComponent,
DeleteComColPageComponent,
DsDynamicFormComponent, DsDynamicFormComponent,
DsDynamicFormControlComponent, DsDynamicFormControlComponent,
DsDynamicListComponent, DsDynamicListComponent,