Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(regions): reload the resource after deletion of regions #1185

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {
@Output() regionChanged: EventEmitter<ReadValue> =
new EventEmitter<ReadValue>();

@Output() regionDeleted: EventEmitter<void> =
new EventEmitter<void>();

lastModificationDate: string;

deletedResource = false;
Expand Down Expand Up @@ -375,6 +378,9 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {
CommsEvents.resourceDeleted
)
);
if (this.isAnnotation) {
this.regionDeleted.emit();
}
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
Expand All @@ -398,6 +404,11 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {
CommsEvents.resourceDeleted
)
);
// if it is an Annotation/Region which has been erases, we emit the
// regionChanged event, in order to refresh the page
if (this.isAnnotation) {
this.regionDeleted.emit();
}
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
[isAnnotation]="true"
[adminPermissions]="adminPermissions"
[valueUuidToHighlight]="valueUuid"
(regionChanged)="updateRegion()">
(regionChanged)="updateRegion()"
(regionDeleted)="reloadWithResource()">
</app-properties>
</div>

Expand Down
6 changes: 6 additions & 0 deletions apps/dsp-app/src/app/workspace/resource/resource.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ export class ResourceComponent implements OnChanges, OnDestroy {
}
}

// reload the page with the same resource
reloadWithResource() {
this.oldResourceIri = undefined;
this.ngOnChanges();
}

// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// general methods
Expand Down