Commit f1df13dc by sameer79 Committed by nixonrodrigues

ATLAS-3664 - Beta UI : Fix Option to select CLASSIFIED and NOT_CLASSIFIED.

parent 14b57dbd
...@@ -342,10 +342,10 @@ require(['App', ...@@ -342,10 +342,10 @@ require(['App',
CommonViewFunction.fetchRootClassificationAttributes({ CommonViewFunction.fetchRootClassificationAttributes({
url: UrlLinks.rootClassificationDefUrl(Enums.addOnClassification[0]), url: UrlLinks.rootClassificationDefUrl(Enums.addOnClassification[0]),
classification: Enums.addOnClassification[0], classification: Enums.addOnClassification,
callback: function() { callback: function() {
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
} }
}); });
}); });
\ No newline at end of file
...@@ -1012,7 +1012,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -1012,7 +1012,10 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
cache: true, cache: true,
success: function(response) { success: function(response) {
if (response) { if (response) {
Globals[options.classification] = Object.assign(response, { name: options.classification, guid: options.classification }); _.each(options.classification, function(rootClassification) {
var responseData = $.extend(true, {}, response);
Globals[rootClassification] = Object.assign(responseData, { name: rootClassification, guid: rootClassification });
});
} }
}, },
complete: function(response) { complete: function(response) {
......
...@@ -258,18 +258,15 @@ define([ ...@@ -258,18 +258,15 @@ define([
this.ui.classificationSearchTree.jstree(true).deselect_all(); this.ui.classificationSearchTree.jstree(true).deselect_all();
this.tagId = null; this.tagId = null;
} else { } else {
if (that.options.value.tag === "_ALL_CLASSIFICATION_TYPES" && this.tagId !== "_ALL_CLASSIFICATION_TYPES") { if ((that.options.value.tag === "_ALL_CLASSIFICATION_TYPES" && this.tagId !== "_ALL_CLASSIFICATION_TYPES") || (that.options.value.tag === "_NOT_CLASSIFIED" && this.tagId !== "_NOT_CLASSIFIED") || (that.options.value.tag === "_CLASSIFIED" && this.tagId !== "_CLASSIFIED")) {
this.fromManualRender = true; this.fromManualRender = true;
if (this.tagId) { if (this.tagId) {
this.ui.classificationSearchTree.jstree(true).deselect_node(this.tagId); this.ui.classificationSearchTree.jstree(true).deselect_node(this.tagId);
} }
this.tagId = Globals[that.options.value.tag].guid; this.tagId = Globals[that.options.value.tag].guid;
this.ui.classificationSearchTree.jstree(true).select_node(this.tagId); this.ui.classificationSearchTree.jstree(true).select_node(this.tagId);
} else if (this.tagId !== "_ALL_CLASSIFICATION_TYPES" && that.options.value.tag !== this.tagId) { } else if ((this.tagId !== "_ALL_CLASSIFICATION_TYPES" && that.options.value.tag !== this.tagId) || (this.tagId !== "_NOT_CLASSIFIED" && that.options.value.tag !== this.tagId) || (this.tagId !== "_CLASSIFIED" && that.options.value.tag !== this.tagId)) {
if ((that.options.value.tag.indexOf('*') != -1)) {
that.ui.classificationSearchTree.jstree(true).deselect_all();
that.ui.wildCardValue.val(that.options.value.tag); that.ui.wildCardValue.val(that.options.value.tag);
}
var dataFound = this.classificationDefCollection.fullCollection.find(function(obj) { var dataFound = this.classificationDefCollection.fullCollection.find(function(obj) {
return obj.get("name") === that.options.value.tag return obj.get("name") === that.options.value.tag
}); });
...@@ -513,23 +510,26 @@ define([ ...@@ -513,23 +510,26 @@ define([
return classificationData; return classificationData;
}, },
pushRootClassificationToJstree: function(data) { pushRootClassificationToJstree: function(data) {
var rootClassification = Globals[Enums.addOnClassification[0]]; var that = this;
var isSelected = this.options.value && this.options.value.tag ? this.options.value.tag == rootClassification.name : false; _.each(Enums.addOnClassification, function(addOnClassification) {
var rootClassificationNode = { var rootClassification = Globals[addOnClassification];
text: _.escape(rootClassification.name), var isSelected = that.options.value && that.options.value.tag ? that.options.value.tag == rootClassification.name : false;
name: rootClassification.name, var rootClassificationNode = {
type: rootClassification.category, text: _.escape(rootClassification.name),
gType: "Classification", name: rootClassification.name,
guid: rootClassification.guid, type: rootClassification.category,
id: rootClassification.guid, gType: "Classification",
model: rootClassification, guid: rootClassification.guid,
children: [], id: rootClassification.guid,
icon: "fa fa-tag", model: rootClassification,
state: { children: [],
selected: isSelected icon: "fa fa-tag",
state: {
selected: isSelected
}
} }
} data.push(rootClassificationNode);
data.push(rootClassificationNode); });
return data; return data;
}, },
generateSearchTree: function(options) { generateSearchTree: function(options) {
...@@ -832,4 +832,4 @@ define([ ...@@ -832,4 +832,4 @@ define([
}); });
return ClassificationTreeLayoutView; return ClassificationTreeLayoutView;
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment