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(properties): resolve 409 conflict (DEV-1336) #822

Merged
merged 2 commits into from Sep 14, 2022
Merged
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
38 changes: 22 additions & 16 deletions src/app/workspace/resource/properties/properties.component.ts
Expand Up @@ -343,22 +343,28 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {

// update resource's label if it has changed
if (this.resource.res.label !== answer.comment) {
const payload = new UpdateResourceMetadata();
payload.id = this.resource.res.id;
payload.type = this.resource.res.type;
payload.lastModificationDate = this.lastModificationDate;
payload.label = answer.comment;
this._dspApiConnection.v2.res.updateResourceMetadata(payload).subscribe(
(response: UpdateResourceMetadataResponse) => {
this.resource.res.label = payload.label;
this.lastModificationDate = response.lastModificationDate;
// if annotations tab is active; a label of a region has been changed --> update regions
if (this.isAnnotation) {
this.regionChanged.emit();
}
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
// get the correct lastModificationDate from the resource
this._dspApiConnection.v2.res.getResource(this.resource.res.id).subscribe(
(res: ReadResource) => {
const payload = new UpdateResourceMetadata();
payload.id = this.resource.res.id;
payload.type = this.resource.res.type;
payload.lastModificationDate = res.lastModificationDate;
payload.label = answer.comment;

this._dspApiConnection.v2.res.updateResourceMetadata(payload).subscribe(
(response: UpdateResourceMetadataResponse) => {
this.resource.res.label = payload.label;
this.lastModificationDate = response.lastModificationDate;
// if annotations tab is active; a label of a region has been changed --> update regions
if (this.isAnnotation) {
this.regionChanged.emit();
}
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
}
);
}
);
}
Expand Down