Skip to content

Commit

Permalink
ELEMENTS-1637: Remove button not working
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuljain-dev authored and poonamyadav252 committed Jun 16, 2023
1 parent 32022a1 commit 01f8725
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions ui/actions/nuxeo-delete-blob-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,35 @@ import '../nuxeo-button-styles.js';

_remove() {
const rowNo = this.xpath.split('/')[1];
const { 'upload-batch': uploadBatch, 'upload-fileId': uploadFileId } = this.document.properties[
'monschema:mesdonnees'
][rowNo].fichier;
if (uploadBatch && uploadFileId) {
this.$.blobRequest.data = {};
this.$.blobRequest.path = `upload/${uploadBatch}/${uploadFileId}`;
this.$.blobRequest
.remove()
.then((response) => {
this._dispatchEvent('file-deleted', response);
})
.catch((error) => {
this._dispatchEvent('error', error);
});
if (rowNo && this.document.properties['monschema:mesdonnees']) {
const { 'upload-batch': uploadBatch, 'upload-fileId': uploadFileId } = this.document.properties[
'monschema:mesdonnees'
][rowNo].fichier;
if (uploadBatch && uploadFileId) {
this.$.blobRequest.data = {};
this.$.blobRequest.path = `upload/${uploadBatch}/${uploadFileId}`;
this.$.blobRequest
.remove()
.then((response) => {
this._dispatchEvent('file-deleted', response);
})
.catch((error) => {
this._dispatchEvent('error', error);
});
} else {
this._removeBlob();
}
} else {
this.$.operation.execute().then((response) => {
this._dispatchEvent('file-deleted', response);
});
this._removeBlob();
}
}

_removeBlob() {
this.$.operation.execute().then((response) => {
this._dispatchEvent('file-deleted', response);
});
}

_dispatchEvent(eventName, response) {
this.dispatchEvent(
new CustomEvent(eventName, {
Expand Down

0 comments on commit 01f8725

Please sign in to comment.