58522: implemented delete for coll and comms

This commit is contained in:
lotte
2019-01-04 16:30:25 +01:00
parent 773973cdef
commit ab5cc1c961
24 changed files with 281 additions and 32 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-community-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-community-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,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 edit an existing Community
*/
@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-primary"
[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,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,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 edit 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-primary"
[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

@@ -19,10 +19,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

@@ -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

@@ -18,7 +18,7 @@ import { URLCombiner } from '../url-combiner/url-combiner';
import { PaginatedList } from './paginated-list'; 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,
@@ -33,7 +33,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { import {
configureRequest, configureRequest,
filterSuccessfulResponses, getResourceLinksFromResponse, filterSuccessfulResponses, getFinishedRemoteData, getResourceLinksFromResponse,
getResponseFromEntry getResponseFromEntry
} from '../shared/operators'; } from '../shared/operators';
import { DSOSuccessResponse, ErrorResponse, RestResponse } from '../cache/response.models'; import { DSOSuccessResponse, ErrorResponse, RestResponse } from '../cache/response.models';
@@ -43,6 +43,7 @@ import { NormalizedObjectFactory } from '../cache/models/normalized-object-facto
import { CacheableObject } from '../cache/object-cache.reducer'; import { CacheableObject } from '../cache/object-cache.reducer';
import { DataBuildService } from '../cache/builders/data-build.service'; import { DataBuildService } from '../cache/builders/data-build.service';
import { UpdateComparator } from './update-comparator'; import { UpdateComparator } from './update-comparator';
import { RequestEntry } from './request.reducer';
export abstract class DataService<TNormalized extends NormalizedObject, TDomain extends CacheableObject> { export abstract class DataService<TNormalized extends NormalizedObject, TDomain extends CacheableObject> {
protected abstract requestService: RequestService; protected abstract requestService: RequestService;
@@ -97,13 +98,13 @@ 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 { 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)))
@@ -192,4 +193,24 @@ export abstract class DataService<TNormalized extends NormalizedObject, TDomain
) )
} }
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

@@ -227,6 +227,17 @@ export class CreateRequest extends PostRequest {
} }
} }
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

@@ -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 edit page for communities and collections
*/
@Component({
selector: 'ds-delete-comcol',
template: ''
})
export class DeleteComColPageComponent<TDomain extends DSpaceObject, TNormalized extends NormalizedDSpaceObject> implements OnInit {
/**
* Frontend endpoint where for this type of DSP
*/
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
*/
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';
@@ -20,13 +19,11 @@ describe('EditComColPageComponent', () => {
let fixture: ComponentFixture<EditComColPageComponent<DSpaceObject, NormalizedDSpaceObject>>; let fixture: ComponentFixture<EditComColPageComponent<DSpaceObject, NormalizedDSpaceObject>>;
let communityDataService: CommunityDataService; 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;
@@ -59,9 +56,6 @@ describe('EditComColPageComponent', () => {
}; };
routeServiceStub = {
getQueryParameterValue: (param) => observableOf(community.uuid)
};
routerStub = { routerStub = {
navigate: (commands) => commands navigate: (commands) => commands
}; };
@@ -78,7 +72,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 },
], ],
@@ -92,7 +85,6 @@ describe('EditComColPageComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
dsoDataService = (comp as any).dsoDataService; dsoDataService = (comp as any).dsoDataService;
communityDataService = (comp as any).communityDataService; 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';
@@ -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
) { ) {
@@ -41,7 +39,7 @@ export class EditComColPageComponent<TDomain extends DSpaceObject, TNormalized e
/** /**
* @param {TDomain} dso The updated version of the DSO * @param {TDomain} dso The updated version of the DSO
* Updates an existing DSO based on the submitted user data and navigates to the editted object's home page * Updates an existing DSO based on the submitted user data and navigates to the edited object's home page
*/ */
onSubmit(dso: TDomain) { onSubmit(dso: TDomain) {
this.dsoDataService.update(dso) this.dsoDataService.update(dso)

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';
const MODULES = [ const MODULES = [
// Do NOT include UniversalModule, HttpModule, or JsonpModule here // Do NOT include UniversalModule, HttpModule, or JsonpModule here
@@ -135,6 +136,7 @@ const COMPONENTS = [
ComColFormComponent, ComColFormComponent,
CreateComColPageComponent, CreateComColPageComponent,
EditComColPageComponent, EditComColPageComponent,
DeleteComColPageComponent,
DsDynamicFormComponent, DsDynamicFormComponent,
DsDynamicFormControlComponent, DsDynamicFormControlComponent,
DsDynamicListComponent, DsDynamicListComponent,