diff --git a/apps/dsp-app/src/app/project/ontology/create-resource-class-dialog/create-resource-class-dialog.component.ts b/apps/dsp-app/src/app/project/ontology/create-resource-class-dialog/create-resource-class-dialog.component.ts index a95ba5d74c..8a5aa6ad1c 100644 --- a/apps/dsp-app/src/app/project/ontology/create-resource-class-dialog/create-resource-class-dialog.component.ts +++ b/apps/dsp-app/src/app/project/ontology/create-resource-class-dialog/create-resource-class-dialog.component.ts @@ -1,11 +1,17 @@ import { Component, Inject, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { ApiResponseError, CreateResourceClass, KnoraApiConnection, UpdateOntology } from '@dasch-swiss/dsp-js'; +import { CreateResourceClass, KnoraApiConnection, UpdateOntology } from '@dasch-swiss/dsp-js'; import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config'; -import { NotificationService } from '@dasch-swiss/vre/shared/app-notification'; import { tap } from 'rxjs/operators'; +export interface CreateResourceClassDialogProps { + id: string; + title: string; + ontologyId: string; + lastModificationDate: string; +} + @Component({ selector: 'app-create-resource-class-dialog', template: ` @@ -37,8 +43,8 @@ export class CreateResourceClassDialogComponent implements OnInit { @Inject(DspApiConnectionToken) private _dspApiConnection: KnoraApiConnection, @Inject(MAT_DIALOG_DATA) - public data: { id: string; title: string; ontologyId: string; lastModificationDate: string }, - public dialogRef: MatDialogRef + public data: CreateResourceClassDialogProps, + public dialogRef: MatDialogRef ) {} ngOnInit() { diff --git a/apps/dsp-app/src/app/project/ontology/edit-resource-class-dialog/edit-resource-class-dialog.component.ts b/apps/dsp-app/src/app/project/ontology/edit-resource-class-dialog/edit-resource-class-dialog.component.ts index c3102397fb..05d7bbad5e 100644 --- a/apps/dsp-app/src/app/project/ontology/edit-resource-class-dialog/edit-resource-class-dialog.component.ts +++ b/apps/dsp-app/src/app/project/ontology/edit-resource-class-dialog/edit-resource-class-dialog.component.ts @@ -10,7 +10,14 @@ import { UpdateResourceClassLabel, } from '@dasch-swiss/dsp-js'; import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config'; -import { finalize, switchMap, tap } from 'rxjs/operators'; +import { switchMap, tap } from 'rxjs/operators'; + +export interface EditResourceClassDialogProps { + id: string; + title: string; + ontologyId: string; + lastModificationDate: string; +} @Component({ selector: 'app-edit-resource-class-dialog', @@ -44,8 +51,8 @@ export class EditResourceClassDialogComponent implements OnInit { @Inject(DspApiConnectionToken) private _dspApiConnection: KnoraApiConnection, @Inject(MAT_DIALOG_DATA) - public data: { id: string; title: string; ontologyId: string; lastModificationDate: string }, - public dialogRef: MatDialogRef + public data: EditResourceClassDialogProps, + public dialogRef: MatDialogRef ) {} ngOnInit() { @@ -92,7 +99,9 @@ export class EditResourceClassDialogComponent implements OnInit { this.loading = false; }) ) - .subscribe(); + .subscribe(() => { + this.dialogRef.close(true); + }); } private _deleteResourceComment$() { diff --git a/apps/dsp-app/src/app/project/ontology/ontology.component.ts b/apps/dsp-app/src/app/project/ontology/ontology.component.ts index ad1a4c5546..da4b6eb0c2 100644 --- a/apps/dsp-app/src/app/project/ontology/ontology.component.ts +++ b/apps/dsp-app/src/app/project/ontology/ontology.component.ts @@ -58,8 +58,14 @@ import { Observable, Subject, combineLatest } from 'rxjs'; import { map, take, takeUntil } from 'rxjs/operators'; import { DialogComponent, DialogEvent } from '../../main/dialog/dialog.component'; import { ProjectBase } from '../project-base'; -import { CreateResourceClassDialogComponent } from './create-resource-class-dialog/create-resource-class-dialog.component'; -import { EditResourceClassDialogComponent } from './edit-resource-class-dialog/edit-resource-class-dialog.component'; +import { + CreateResourceClassDialogComponent, + CreateResourceClassDialogProps, +} from './create-resource-class-dialog/create-resource-class-dialog.component'; +import { + EditResourceClassDialogComponent, + EditResourceClassDialogProps, +} from './edit-resource-class-dialog/edit-resource-class-dialog.component'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, @@ -455,14 +461,17 @@ export class OntologyComponent extends ProjectBase implements OnInit, OnDestroy const currentOntology = this._store.selectSnapshot(OntologiesSelectors.currentOntology); this._dialog - .open(CreateResourceClassDialogComponent, { - data: { - id: resClassInfo.iri, - title: resClassInfo.label, - ontologyId: currentOntology.id, - lastModificationDate: currentOntology.lastModificationDate, - }, - }) + .open( + CreateResourceClassDialogComponent, + { + data: { + id: resClassInfo.iri, + title: resClassInfo.label, + ontologyId: currentOntology.id, + lastModificationDate: currentOntology.lastModificationDate, + }, + } + ) .afterClosed() .subscribe(event => { if (event !== DialogEvent.DialogCanceled) { @@ -475,7 +484,7 @@ export class OntologyComponent extends ProjectBase implements OnInit, OnDestroy const currentOntology = this._store.selectSnapshot(OntologiesSelectors.currentOntology); this._dialog - .open(EditResourceClassDialogComponent, { + .open(EditResourceClassDialogComponent, { data: { id: resClassInfo.iri, title: resClassInfo.label, @@ -485,7 +494,7 @@ export class OntologyComponent extends ProjectBase implements OnInit, OnDestroy }) .afterClosed() .subscribe(event => { - if (event !== DialogEvent.DialogCanceled) { + if (event === true) { this.initOntologiesList(); } });