ATLAS-4512-1-If user tries to delete a glossary (where a term is assigned) a second time, the dialog box goes into endless loading animation

Signed-off-by: Pinal Shah <pinal.shah@freestoneinfotech.com>
This commit is contained in:
Farhan Khan 2021-12-21 13:33:45 +05:30 committed by Pinal Shah
parent 8b4ca740ac
commit 2eb180ca60
4 changed files with 24 additions and 2 deletions

View File

@ -64,6 +64,14 @@ define(['require',
}, options);
return this.constructor.nonCrudOperation.call(this, url, type, options);
},
deleteGlossary: function(guid, options) {
var url = UrlLinks.glossaryApiUrl({ "guid": guid });
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
deleteCategory: function(guid, options) {
var url = UrlLinks.categoryApiUrl({ "guid": guid });
options = _.extend({

View File

@ -720,6 +720,9 @@ define(['require',
if (!gId) {
gId = guid;
}
if (gId === guid) {
that.glossaryCollection.fullCollection.remove(gId);
}
var glossary = that.glossaryCollection.fullCollection.get(gId);
if (that.value) {
if (that.value.gType == "term") {
@ -776,7 +779,7 @@ define(['require',
that.notificationModal = obj;
obj.showButtonLoader();
if (type == "Glossary") {
that.glossaryCollection.fullCollection.get(guid).destroy(options, { silent: true, reset: false });
new that.glossaryCollection.model().deleteGlossary(guid, options);
} else if (type == "GlossaryCategory") {
new that.glossaryCollection.model().deleteCategory(guid, options);
} else if (type == "GlossaryTerm") {

View File

@ -64,6 +64,14 @@ define(['require',
}, options);
return this.constructor.nonCrudOperation.call(this, url, type, options);
},
deleteGlossary: function(guid, options) {
var url = UrlLinks.glossaryApiUrl({ "guid": guid });
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
deleteCategory: function(guid, options) {
var url = UrlLinks.categoryApiUrl({ "guid": guid });
options = _.extend({

View File

@ -602,6 +602,9 @@ define([
if (!gId) {
gId = guid;
}
if (gId === guid) {
that.glossaryCollection.fullCollection.remove(gId);
}
var glossary = that.glossaryCollection.fullCollection.get(gId);
if (type == "GlossaryTerm") {
glossary.set('terms', _.reject(glossary.get('terms'), function(obj) {
@ -635,7 +638,7 @@ define([
that.notificationModal = obj;
obj.showButtonLoader();
if (type == "Glossary" || type == "GLOSSARY") {
that.glossaryCollection.fullCollection.get(guid).destroy(options, { silent: true, reset: false });
new that.glossaryCollection.model().deleteGlossary(guid, options);
} else if (type == "GlossaryCategory") {
new that.glossaryCollection.model().deleteCategory(guid, options);