Commit 6b100410 by kevalbhatt Committed by Sarath Subramanian

ATLAS-3415 : UI : Beta UI : Improvements for left side tree view

parent 15e5bedb
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
} }
} }
} }
.dropdown-toggle {
width: 15px;
}
} }
.filter-tree-content { .filter-tree-content {
...@@ -164,6 +168,7 @@ ...@@ -164,6 +168,7 @@
.dropdown-menu { .dropdown-menu {
min-width: 182px; min-width: 182px;
left: -155px;
&>li { &>li {
padding: 3px 15px; padding: 3px 15px;
...@@ -177,18 +182,40 @@ ...@@ -177,18 +182,40 @@
background-color: $color_havelock_blue_approx; background-color: $color_havelock_blue_approx;
color: #fff !important; color: #fff !important;
} }
span {
color: #fff !important;
}
} }
a { a {
display: inline-block; display: inline-block;
padding: 0px 3px; padding: 0px 3px;
} }
span {
color: #686868;
margin-left: 10px;
}
} }
} }
.custom-filter { .custom-filter {
.fa { .fa-circle-thin:after {
font-size: 12px; font-family: Source Sans Pro, sans-serif;
position: absolute;
left: 0px;
margin-left: 9px;
font-size: 11px;
font-weight: bold;
}
.advance-tree:after {
content: "A";
}
.basic-tree:after {
content: "B";
} }
} }
......
...@@ -18,16 +18,19 @@ ...@@ -18,16 +18,19 @@
<div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_classfication"> <div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_classfication">
<i class="ec-icon fa"></i> <i class="ec-icon fa"></i>
<h4 class="panel-title">Classifications</h4> <h4 class="panel-title">Classifications</h4>
<div class="btn-group pull-right menu-items"> <div class="btn-group pull-right">
<!-- <button type="button" class="typeRefresh" data-id="groupOrFlatTreeView" data-type="classification" title="Show flat tree">
<i class="fa fa-sitemap"></i>
</button> -->
<button type="button" class="typeRefresh" data-id="refreshTree" data-type="classification" title="Refresh"> <button type="button" class="typeRefresh" data-id="refreshTree" data-type="classification" title="Refresh">
<i class="fa fa-refresh"></i> <i class="fa fa-refresh"></i>
</button> </button>
<button type="button" class="typeRefresh" data-id="showEmptyClassifications" title="Show unused classification"> <button type="button" class="typeRefresh" data-id="showEmptyClassifications" title="Show unused classification">
<i class="fa fa-toggle-off"></i> <i class="fa fa-toggle-off"></i>
</button> </button>
<button type="button" data-id="createTag" data-type="classification" title="Create Classification"> <!-- <button type="button" data-id="createTag" data-type="classification" title="Create Classification">
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
</button> </button> -->
<!-- <ul class="dropdown-menu right-align tree-menu"> <!-- <ul class="dropdown-menu right-align tree-menu">
<li data-id="createTag"><i class="fa fa-plus"></i><a>Create Classification</a></li> <li data-id="createTag"><i class="fa fa-plus"></i><a>Create Classification</a></li>
<li data-id="showEmptyClassifications"><i class="fa fa-check-circle"></i> <a>Show Empty</a></li> <li data-id="showEmptyClassifications"><i class="fa fa-check-circle"></i> <a>Show Empty</a></li>
...@@ -35,6 +38,19 @@ ...@@ -35,6 +38,19 @@
<!-- <button data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" data-id="tagMenu"> <!-- <button data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" data-id="tagMenu">
<i class="fa fa-ellipsis-v"></i> <i class="fa fa-ellipsis-v"></i>
</button> --> </button> -->
<button type="button" class="typeRefresh dropdown">
<div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i>
</div>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li data-id="groupOrFlatTreeView" data-type="classification"> <i class="fa fa-list-ul"></i><span>Show flat tree</span>
</li>
<!-- <li data-id="showEmptyClassifications" data-type="classification"> <i class="fa fa-toggle-off"></i><span>Show unused classification</span>
</li> -->
<li data-id="createTag" data-type="classification"> <i class="fa fa-plus"></i><span>Create Classification</span>
</li>
</ul>
</button>
</div> </div>
</div> </div>
<div id="c_classfication" class="panel-collapse collapse jstree-with-action in"> <div id="c_classfication" class="panel-collapse collapse jstree-with-action in">
......
...@@ -18,16 +18,30 @@ ...@@ -18,16 +18,30 @@
<div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_customFilter"> <div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_customFilter">
<i class="ec-icon fa"></i> <i class="ec-icon fa"></i>
<h4 class="panel-title">Custom Filters</h4> <h4 class="panel-title">Custom Filters</h4>
<div class="btn-group pull-right menu-items"> <div class="btn-group pull-right ">
<button type="button" class="typeRefresh" data-id="groupOrFlatTreeView" data-type="customFilter" title="Show all">
<i class="fa fa-sitemap"></i>
</button>
<button type="button" class="typeRefresh" data-id="refreshTree" data-type="CustomFilter" title="Refresh"> <button type="button" class="typeRefresh" data-id="refreshTree" data-type="CustomFilter" title="Refresh">
<i class="fa fa-refresh"></i> <i class="fa fa-refresh"></i>
</button> </button>
<button type="button" class="typeRefresh" data-id="showCustomFilter" title="Show Advanced search"> <!-- <button type="button" class="typeRefresh" data-id="showCustomFilter" title="Show Advanced search">
<i class="fa fa-toggle-on switch-button"></i> <i class="fa fa-toggle-on switch-button"></i>
</button> </button> -->
<!-- <button type="button" class="typeRefresh dropdown">
<div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i>
</div>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li data-id="groupOrFlatTreeView" data-type="customFilter"> <i class="fa fa-sitemap"></i><span>Show flat tree</span>
</li>
<li data-id="refreshTree" data-type="customFilter"><i class="fa fa-refresh"></i><span>Refresh</span>
</li>
</ul>
</button> -->
</div> </div>
</div> </div>
<div id="c_customFilter" class="panel-collapse collapse jstree-with-action in"> <div id="c_customFilter" class="panel-collapse collapse jstree-with-action in">
<div class="custom-filter" data-id="customFilterSearchTree"></div> <div class="custom-filter" data-id="customFilterSearchTree"></div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
<div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_entity"> <div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_entity">
<i class="ec-icon fa"></i> <i class="ec-icon fa"></i>
<h4 class="panel-title">Entities</h4> <h4 class="panel-title">Entities</h4>
<div class="btn-group pull-right menu-items"> <div class="btn-group pull-right">
<button type="button" class="typeRefresh" data-id="groupOrFlatTreeView" data-type="entity" title="Show group tree"> <!-- <button type="button" class="typeRefresh" data-id="groupOrFlatTreeView" data-type="entity" title="Show flat tree">
<i class="fa fa-sitemap group-tree-deactivate"></i> <i class="fa fa-sitemap"></i>
</button> </button> -->
<button type="button" class="typeRefresh" data-id="refreshTree" data-type="entity" title="Refresh"> <button type="button" class="typeRefresh" data-id="refreshTree" data-type="entity" title="Refresh">
<i class="fa fa-refresh"></i> <i class="fa fa-refresh"></i>
</button> </button>
...@@ -33,9 +33,19 @@ ...@@ -33,9 +33,19 @@
<button type="button" class="typeRefresh" data-id="showEmptyServiceType" data-type="entity" title="Show empty service types"> <button type="button" class="typeRefresh" data-id="showEmptyServiceType" data-type="entity" title="Show empty service types">
<i class="fa fa-toggle-off"></i> <i class="fa fa-toggle-off"></i>
</button> </button>
<!-- <button class="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button"> <button type="button" class="typeRefresh dropdown">
<i class="fa fa-ellipsis-v"></i> <div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button> --> <i class="fa fa-ellipsis-v"></i>
</div>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li data-id="groupOrFlatTreeView" data-type="entity"> <i class="fa fa-list-ul"></i><span>Show flat tree</span>
</li>
<!-- <li data-id="showEmptyServiceType" data-type="entity"> <i class="fa fa-toggle-off"></i><span >Show empty service types</span>
</li>
<li data-id="refreshTree" data-type="entity"><i class="fa fa-refresh"></i><span >Refresh</span>
</li> -->
</ul>
</button>
</div> </div>
</div> </div>
<div id="c_entity" class="panel-collapse collapse jstree-with-action in"> <div id="c_entity" class="panel-collapse collapse jstree-with-action in">
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_term"> <div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="true" href="#c_term">
<i class="ec-icon fa"></i> <i class="ec-icon fa"></i>
<h4 class="panel-title">Glossaries</h4> <h4 class="panel-title">Glossaries</h4>
<div class="btn-group pull-right menu-items"> <div class="btn-group pull-right">
<button type="button" class="typeRefresh" data-id="refreshTree" data-type="term" title="Refresh"><i class="fa fa-refresh"></i></button> <button type="button" class="typeRefresh" data-id="refreshTree" data-type="term" title="Refresh"><i class="fa fa-refresh"></i></button>
<!-- <ul class="dropdown-menu right-align tree-menu"> <!-- <ul class="dropdown-menu right-align tree-menu">
<li data-id="createGlossary"><i class="fa fa-plus"></i> <a>Create Glossary</a></li> <li data-id="createGlossary"><i class="fa fa-plus"></i> <a>Create Glossary</a></li>
...@@ -26,8 +26,23 @@ ...@@ -26,8 +26,23 @@
<button type="button" class="typeRefresh" data-id="showGlossaryType" title="Show Category"> <button type="button" class="typeRefresh" data-id="showGlossaryType" title="Show Category">
<i class="fa fa-toggle-on switch-button"></i> <i class="fa fa-toggle-on switch-button"></i>
</button> </button>
<button title="Create Glossary" type="button" data-id="createGlossary"><i class="fa fa-plus"></i></button> <!-- <button title="Create Glossary" type="button" data-id="createGlossary">
<!-- <button data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" data-id="termMenu"><i class="fa fa-ellipsis-v"></i></button> --> <i class="fa fa-plus"></i>
</button> -->
<!-- <button data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" data-id="termMenu"><i class="fa fa-ellipsis-v"></i></button> -->
<button type="button" class="typeRefresh dropdown">
<div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i>
</div>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<!-- <li data-id="showGlossaryType" data-type="term"> <i class="fa fa-toggle-on switch-button"></i><span>Show Category</span>
</li> -->
<!-- <li data-id="refreshTree" data-type="term"><i class="fa fa-refresh"></i><span>Refresh</span>
</li> -->
<li data-id="createGlossary" data-type="term"> <i class="fa fa-plus"></i><span>Create Glossary</span>
</li>
</ul>
</button>
</div> </div>
</div> </div>
<div id="c_term" class="panel-collapse collapse jstree-with-action in"> <div id="c_term" class="panel-collapse collapse jstree-with-action in">
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<tr> <tr>
<td> <td>
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<a href="#/"><img src="img/atlas-logo-beta-side.png" class="logo"></a> <a href="#/"><img src="img/atlas-logo-beta-ui.png" class="logo"></a>
</ul> </ul>
</td> </td>
<td class="global-search-container"> <td class="global-search-container">
......
...@@ -157,7 +157,9 @@ define(['require', ...@@ -157,7 +157,9 @@ define(['require',
} }
}); });
} }
that.glossaryCollection.trigger("update:details", { data: that.data }); that.options.categoryEvent.trigger("Success:TermRename", true);
// that.glossaryCollection.trigger("test");
// that.glossaryCollection.trigger("update:details", { data: that.data });
} }
that.data = data; that.data = data;
that.renderDetails(that.data); that.renderDetails(that.data);
......
...@@ -36,6 +36,7 @@ define([ ...@@ -36,6 +36,7 @@ define([
ui: { ui: {
//refresh //refresh
refreshTree: '[data-id="refreshTree"]', refreshTree: '[data-id="refreshTree"]',
groupOrFlatTree: '[data-id="groupOrFlatTreeView"]',
// menuItems: '.menu-items>ul>li', // menuItems: '.menu-items>ul>li',
...@@ -70,10 +71,24 @@ define([ ...@@ -70,10 +71,24 @@ define([
events["click " + this.ui.showEmptyClassifications] = function(e) { events["click " + this.ui.showEmptyClassifications] = function(e) {
var getTreeData, displayText; var getTreeData, displayText;
e.stopPropagation();
this.isEmptyClassification = !this.isEmptyClassification; this.isEmptyClassification = !this.isEmptyClassification;
this.classificationSwitchBtnUpdate(); this.classificationSwitchBtnUpdate();
}; };
events["click " + this.ui.groupOrFlatTree] = function(e) {
var type = $(e.currentTarget).data("type");
e.stopPropagation();
this.isGroupView = !this.isGroupView;
// this.ui.groupOrFlatTree.attr("data-original-title", (this.isGroupView ? "Show flat tree" : "Show group tree"));
this.ui.groupOrFlatTree.tooltip('hide');
// this.ui.groupOrFlatTree.find("i").toggleClass("group-tree-deactivate");
this.ui.groupOrFlatTree.find("i").toggleClass("fa-sitemap fa-list-ul");
this.ui.groupOrFlatTree.find("span").html(this.isGroupView ? "Show flat tree" : "Show group tree");
that.ui[type + "SearchTree"].jstree(true).destroy();
that.renderClassificationTree();
};
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
...@@ -97,6 +112,7 @@ define([ ...@@ -97,6 +112,7 @@ define([
this.isEmptyClassification = true; this.isEmptyClassification = true;
this.entityTreeData = {}; this.entityTreeData = {};
this.tagId = null; this.tagId = null;
this.isGroupView = true;
}, },
onRender: function() { onRender: function() {
this.renderClassificationTree(); this.renderClassificationTree();
...@@ -147,6 +163,7 @@ define([ ...@@ -147,6 +163,7 @@ define([
this.ui.showEmptyClassifications.attr("data-original-title", (this.isEmptyClassification ? "Show" : "Hide") + " unused classification"); this.ui.showEmptyClassifications.attr("data-original-title", (this.isEmptyClassification ? "Show" : "Hide") + " unused classification");
this.ui.showEmptyClassifications.tooltip('hide'); this.ui.showEmptyClassifications.tooltip('hide');
this.ui.showEmptyClassifications.find("i").toggleClass("fa-toggle-on fa-toggle-off"); this.ui.showEmptyClassifications.find("i").toggleClass("fa-toggle-on fa-toggle-off");
this.ui.showEmptyClassifications.find("span").html((this.isEmptyClassification ? "Show" : "Hide") + " unused classification");
this.ui.classificationSearchTree.jstree(true).refresh(); this.ui.classificationSearchTree.jstree(true).refresh();
}, },
createClassificationAction: function() { createClassificationAction: function() {
...@@ -293,29 +310,30 @@ define([ ...@@ -293,29 +310,30 @@ define([
collection = (options && options.collection) || this.classificationDefCollection.fullCollection, collection = (options && options.collection) || this.classificationDefCollection.fullCollection,
listOfParents = [], listOfParents = [],
listWithEmptyParents = [], listWithEmptyParents = [],
listWithEmptyParentsFlatView = [],
flatViewList = [],
isSelectedChild = false, isSelectedChild = false,
openClassificationNodesState = function(treeDate) { openClassificationNodesState = function(treeDate) {
if (treeDate.length == 1) { // if (treeDate.length == 1) {
_.each(treeDate, function(model) { _.each(treeDate, function(model) {
model.state['opeaned'] = true; model.state['opened'] = true;
}) })
} // }
}, },
generateNode = function(nodeOptions, options, isChild) { generateNode = function(nodeOptions, options, isChild) {
var nodeStructure = { var nodeStructure = {
text: nodeOptions.name, text: nodeOptions.name,
name: nodeOptions.name, name: nodeOptions.name,
children: getChildren({ children: that.isGroupView ? getChildren({
children: isChild ? nodeOptions.model.subTypes : nodeOptions.model.get("subTypes"), children: isChild ? nodeOptions.model.subTypes : nodeOptions.model.get("subTypes"),
parent: isChild ? options.parentName : nodeOptions.name parent: isChild ? options.parentName : nodeOptions.name
}), }) : null,
type: isChild ? nodeOptions.children.get("category") : nodeOptions.model.get("category"), type: isChild ? nodeOptions.children.get("category") : nodeOptions.model.get("category"),
id: isChild ? nodeOptions.children.get("guid") : nodeOptions.model.get("guid"), id: isChild ? nodeOptions.children.get("guid") : nodeOptions.model.get("guid"),
icon: "fa fa-tag", icon: "fa fa-tag",
gType: "Classification", gType: "Classification",
} }
return nodeStructure; return nodeStructure;
}, },
getChildren = function(options) { getChildren = function(options) {
...@@ -346,13 +364,14 @@ define([ ...@@ -346,13 +364,14 @@ define([
}, },
nodeProperties = { nodeProperties = {
parent: options.parentName, parent: options.parentName,
text: tagname,
guid: child.get("guid"), guid: child.get("guid"),
model: child, model: child,
state: { selected: isSelectedChild } state: { selected: isSelectedChild, opened: true }
}, },
isChild = true, isChild = true,
getNodeDetails = generateNode(nodeDetails, options, isChild), getNodeDetails = generateNode(nodeDetails, options, isChild),
classificationNode = (_.extend(nodeProperties, getNodeDetails)); classificationNode = (_.extend(getNodeDetails, nodeProperties));
data.push(classificationNode); data.push(classificationNode);
if (that.isEmptyClassification) { if (that.isEmptyClassification) {
var isTagEntityCount = _.isNaN(tagEntityCount) ? 0 : tagEntityCount; var isTagEntityCount = _.isNaN(tagEntityCount) ? 0 : tagEntityCount;
...@@ -368,45 +387,56 @@ define([ ...@@ -368,45 +387,56 @@ define([
} }
collection.each(function(model) { collection.each(function(model) {
var modelJSON = model.toJSON(); var modelJSON = model.toJSON();
if (modelJSON.superTypes.length == 0) { var name = modelJSON.name;
var name = modelJSON.name; var tagEntityCount = that.entityCountObj.tag.tagEntities[name];
var tagEntityCount = that.entityCountObj.tag.tagEntities[name]; var tagname = tagEntityCount ? name + " (" + _.numberFormatWithComa(tagEntityCount) + ")" : name,
var tagname = tagEntityCount ? name + " (" + _.numberFormatWithComa(tagEntityCount) + ")" : name, isSelected = false;
isSelected = false;
if (that.options.value) { if (that.options.value) {
isSelected = that.options.value.tag ? that.options.value.tag == name : false; isSelected = that.options.value.tag ? that.options.value.tag == name : false;
if (!that.tagId) { if (!that.tagId) {
that.tagId = isSelected ? model.get("guid") : null; that.tagId = isSelected ? model.get("guid") : null;
}
} }
var parentNodeDetails = { }
name: name, var parentNodeDetails = {
model: model, name: name,
isSelectedChild: isSelectedChild model: model,
}, isSelectedChild: isSelectedChild
parentNodeProperties = { },
text: tagname, parentNodeProperties = {
state: { text: tagname,
disabled: tagEntityCount == 0 ? true : false, state: {
selected: isSelected disabled: tagEntityCount == 0 ? true : false,
} selected: isSelected,
}, opened: true
isChild = false, }
getParentNodeDetails = generateNode(parentNodeDetails, model, isChild), },
classificationParentNode = (_.extend(getParentNodeDetails, parentNodeProperties)); isChild = false,
getParentNodeDetails,
classificationParentNode, getParentFlatView, classificationParentFlatView;
if (modelJSON.superTypes.length == 0) {
getParentNodeDetails = generateNode(parentNodeDetails, model, isChild);
classificationParentNode = (_.extend(getParentNodeDetails, parentNodeProperties));
listOfParents.push(classificationParentNode); listOfParents.push(classificationParentNode);
if (that.isEmptyClassification) { }
var isTagEntityCount = _.isNaN(tagEntityCount) ? 0 : tagEntityCount; getParentFlatView = generateNode(parentNodeDetails, model);
if (isTagEntityCount) { classificationParentFlatView = (_.extend(getParentFlatView, parentNodeProperties));
flatViewList.push(classificationParentFlatView);
if (that.isEmptyClassification) {
var isTagEntityCount = _.isNaN(tagEntityCount) ? 0 : tagEntityCount;
if (isTagEntityCount) {
if (modelJSON.superTypes.length == 0) {
listWithEmptyParents.push(classificationParentNode); listWithEmptyParents.push(classificationParentNode);
} }
listWithEmptyParentsFlatView.push(classificationParentFlatView);
} }
} }
}); });
var classificationData = that.isEmptyClassification ? listWithEmptyParents : listOfParents; var classificationTreeData = that.isEmptyClassification ? listWithEmptyParents : listOfParents;
openClassificationNodesState(classificationData); var flatViewClassificaton = that.isEmptyClassification ? listWithEmptyParentsFlatView : flatViewList;
var classificationData = that.isGroupView ? classificationTreeData : flatViewClassificaton;
// openClassificationNodesState(classificationData);
return classificationData; return classificationData;
}, },
generateSearchTree: function(options) { generateSearchTree: function(options) {
...@@ -435,9 +465,9 @@ define([ ...@@ -435,9 +465,9 @@ define([
}, },
node_customize: { node_customize: {
default: function(el) { default: function(el) {
if ($(el).find(".fa-ellipsis-h").length === 0) { // if ($(el).find(".fa-ellipsis-h").length === 0) {
$(el).append('<div class="tools"><i class="fa fa-ellipsis-h classificationPopover" rel="popover"></i></div>'); $(el).append('<div class="tools"><i class="fa fa-ellipsis-h classificationPopover" rel="popover"></i></div>');
} // }
} }
}, },
core: { core: {
......
...@@ -42,6 +42,7 @@ define([ ...@@ -42,6 +42,7 @@ define([
ui: { ui: {
//refresh //refresh
refreshTree: '[data-id="refreshTree"]', refreshTree: '[data-id="refreshTree"]',
groupOrFlatTree: '[data-id="groupOrFlatTreeView"]',
customFilterSearchTree: '[data-id="customFilterSearchTree"]', customFilterSearchTree: '[data-id="customFilterSearchTree"]',
showCustomFilter: '[data-id="showCustomFilter"]' showCustomFilter: '[data-id="showCustomFilter"]'
...@@ -64,6 +65,17 @@ define([ ...@@ -64,6 +65,17 @@ define([
that.isBasic = !that.isBasic; that.isBasic = !that.isBasic;
this.customFilterSwitchBtnUpdate(); this.customFilterSwitchBtnUpdate();
}; };
events["click " + this.ui.groupOrFlatTree] = function(e) {
var type = $(e.currentTarget).data("type");
e.stopPropagation();
this.isGroupView = !this.isGroupView;
this.ui.groupOrFlatTree.attr("data-original-title", (this.isGroupView ? "Show all" : "Show type"));
this.ui.groupOrFlatTree.tooltip('hide');
this.ui.groupOrFlatTree.find("i").toggleClass("group-tree-deactivate");
this.ui.groupOrFlatTree.find("span").html(this.isGroupView ? "Show flat tree" : "Show group tree");
that.ui[type + "SearchTree"].jstree(true).destroy();
that.renderCustomFilter();
};
return events; return events;
}, },
...@@ -125,6 +137,7 @@ define([ ...@@ -125,6 +137,7 @@ define([
this.customFilterData = null; this.customFilterData = null;
this.isBasic = true; this.isBasic = true;
this.customFilterId = null; this.customFilterId = null;
this.isGroupView = true;
}, },
onRender: function() { onRender: function() {
this.renderCustomFilter(); this.renderCustomFilter();
...@@ -176,7 +189,18 @@ define([ ...@@ -176,7 +189,18 @@ define([
getEntityTreeConfig = function(opt) { getEntityTreeConfig = function(opt) {
return { return {
plugins: ["search", "core", "sort", "conditionalselect", "changed", "wholerow", "node_customize"], plugins: ["search", "core", "sort", "conditionalselect", "changed", "wholerow", "node_customize"],
conditionalselect: function(node) {
var type = node.original.type;
if (type == "customFilterFolder") {
if (node.children.length) {
return false;
} else {
return true;
}
} else {
return true;
}
},
state: { opened: true }, state: { opened: true },
search: { search: {
show_only_matches: true, show_only_matches: true,
...@@ -193,7 +217,6 @@ define([ ...@@ -193,7 +217,6 @@ define([
multiple: false, multiple: false,
data: function(node, cb) { data: function(node, cb) {
if (node.id === "#") { if (node.id === "#") {
var testData = that.getCustomFilterTree();
cb(that.getCustomFilterTree()); cb(that.getCustomFilterTree());
} }
} }
...@@ -249,6 +272,7 @@ define([ ...@@ -249,6 +272,7 @@ define([
var that = this, var that = this,
customFilterBasicList = [], customFilterBasicList = [],
customFilterAdvanceList = [], customFilterAdvanceList = [],
allCustomFilter = [],
customFilterBasicTreeData = that.saveSearchBaiscCollection.fullCollection.models, customFilterBasicTreeData = that.saveSearchBaiscCollection.fullCollection.models,
customFilterAdvanceTreeData = that.saveSearchAdvanceCollection.fullCollection.models, customFilterAdvanceTreeData = that.saveSearchAdvanceCollection.fullCollection.models,
openClassificationNodesState = function(treeDate) { openClassificationNodesState = function(treeDate) {
...@@ -259,12 +283,13 @@ define([ ...@@ -259,12 +283,13 @@ define([
} }
}, },
generateNode = function(nodeOptions) { generateNode = function(nodeOptions) {
var searchType = nodeOptions.get('searchType');
var nodeStructure = { var nodeStructure = {
text: nodeOptions.get('name'), text: nodeOptions.get('name'),
name: nodeOptions.get('name'), name: nodeOptions.get('name'),
type: "customFilter", type: "customFilter",
id: nodeOptions.get('guid'), id: nodeOptions.get('guid'),
icon: "fa fa-search", icon: (searchType === 'BASIC' ? "fa fa-circle-thin basic-tree" : "fa fa-circle-thin advance-tree"),
gType: "CustomFilter", gType: "CustomFilter",
model: nodeOptions model: nodeOptions
} }
...@@ -274,11 +299,32 @@ define([ ...@@ -274,11 +299,32 @@ define([
that.customFilterId = null; that.customFilterId = null;
_.each(customFilterBasicTreeData, function(filterNode) { _.each(customFilterBasicTreeData, function(filterNode) {
customFilterBasicList.push(generateNode(filterNode)); customFilterBasicList.push(generateNode(filterNode));
allCustomFilter.push(generateNode(filterNode));
}); });
_.each(customFilterAdvanceTreeData, function(filterNode) { _.each(customFilterAdvanceTreeData, function(filterNode) {
customFilterAdvanceList.push(generateNode(filterNode)); customFilterAdvanceList.push(generateNode(filterNode));
allCustomFilter.push(generateNode(filterNode));
}); });
var customFilterList = that.isBasic ? customFilterBasicList : customFilterAdvanceList;
// var customFilterList = that.isBasic ? customFilterBasicList : customFilterAdvanceList;
var treeView = [{
icon: "fa fa-folder-o",
gType: "customFilter",
type: "customFilterFolder",
children: customFilterBasicList,
text: "Basic Search",
name: "Basic Search",
state: { opened: true }
}, {
icon: "fa fa-folder-o",
gType: "customFilter",
type: "customFilterFolder",
children: customFilterAdvanceList,
text: "Advance Search",
name: "Advance Search",
state: { opened: true }
}];
var customFilterList = that.isGroupView ? treeView : allCustomFilter;
return customFilterList; return customFilterList;
}, },
onNodeSelect: function(nodeData) { onNodeSelect: function(nodeData) {
...@@ -289,11 +335,13 @@ define([ ...@@ -289,11 +335,13 @@ define([
that.customFilterId = selectedNodeId; that.customFilterId = selectedNodeId;
if (options && options.model) { if (options && options.model) {
var searchParameters = options.model.get('searchParameters'), var searchParameters = options.model.get('searchParameters'),
searchType = options.model.get('searchType'),
params = CommonViewFunction.generateUrlFromSaveSearchObject({ params = CommonViewFunction.generateUrlFromSaveSearchObject({
value: { "searchParameters": searchParameters }, value: { "searchParameters": searchParameters },
classificationDefCollection: that.classificationDefCollection, classificationDefCollection: that.classificationDefCollection,
entityDefCollection: that.entityDefCollection entityDefCollection: that.entityDefCollection
}); });
searchType === 'ADVANCED' ? that.isBasic = false : that.isBasic = true;
_.extend({}, this.options.value, params), _.extend({}, this.options.value, params),
Utils.setUrl({ Utils.setUrl({
......
...@@ -61,6 +61,7 @@ define([ ...@@ -61,6 +61,7 @@ define([
// show and hide entities and classifications with 0 numbers // show and hide entities and classifications with 0 numbers
events["click " + this.ui.showEmptyServiceType] = function(e) { events["click " + this.ui.showEmptyServiceType] = function(e) {
e.stopPropagation();
this.isEmptyServicetype = !this.isEmptyServicetype; this.isEmptyServicetype = !this.isEmptyServicetype;
this.entitySwitchBtnUpdate(); this.entitySwitchBtnUpdate();
}; };
...@@ -69,9 +70,12 @@ define([ ...@@ -69,9 +70,12 @@ define([
var type = $(e.currentTarget).data("type"); var type = $(e.currentTarget).data("type");
e.stopPropagation(); e.stopPropagation();
this.isGroupView = !this.isGroupView; this.isGroupView = !this.isGroupView;
this.ui.groupOrFlatTree.attr("data-original-title", (this.isGroupView ? "Show flat tree" : "Show group tree")); // this.ui.groupOrFlatTree.attr("data-original-title", (this.isGroupView ? "Show flat tree" : "Show group tree"));
this.ui.groupOrFlatTree.tooltip('hide'); this.ui.groupOrFlatTree.tooltip('hide');
this.ui.groupOrFlatTree.find("i").toggleClass("group-tree-deactivate"); // this.ui.groupOrFlatTree.find("i").toggleClass("group-tree-deactivate");
this.ui.groupOrFlatTree.find("i").toggleClass("fa-sitemap fa-list-ul");
this.ui.groupOrFlatTree.find("span").html(this.isGroupView ? "Show flat tree" : "Show group tree");
that.ui[type + "SearchTree"].jstree(true).destroy(); that.ui[type + "SearchTree"].jstree(true).destroy();
that.renderEntityTree(); that.renderEntityTree();
}; };
...@@ -121,7 +125,7 @@ define([ ...@@ -121,7 +125,7 @@ define([
this.isEmptyServicetype = true; this.isEmptyServicetype = true;
this.entityTreeData = {}; this.entityTreeData = {};
this.typeId = null; this.typeId = null;
this.isGroupView = false; this.isGroupView = true;
}, },
onRender: function() { onRender: function() {
this.renderEntityTree(); this.renderEntityTree();
...@@ -158,6 +162,7 @@ define([ ...@@ -158,6 +162,7 @@ define([
this.ui.showEmptyServiceType.attr("data-original-title", (this.isEmptyServicetype ? "Show" : "Hide") + " empty service types"); this.ui.showEmptyServiceType.attr("data-original-title", (this.isEmptyServicetype ? "Show" : "Hide") + " empty service types");
this.ui.showEmptyServiceType.tooltip('hide'); this.ui.showEmptyServiceType.tooltip('hide');
this.ui.showEmptyServiceType.find("i").toggleClass("fa-toggle-on fa-toggle-off"); this.ui.showEmptyServiceType.find("i").toggleClass("fa-toggle-on fa-toggle-off");
// this.ui.showEmptyServiceType.find("span").html((this.isEmptyServicetype ? "Show" : "Hide") + " empty service types");
this.ui.entitySearchTree.jstree(true).refresh(); this.ui.entitySearchTree.jstree(true).refresh();
}, },
manualRender: function(options) { manualRender: function(options) {
...@@ -173,7 +178,6 @@ define([ ...@@ -173,7 +178,6 @@ define([
var dataFound = this.typeHeaders.fullCollection.find(function(obj) { var dataFound = this.typeHeaders.fullCollection.find(function(obj) {
return obj.get("name") === that.options.value.type return obj.get("name") === that.options.value.type
}); });
if (dataFound) { if (dataFound) {
if ((this.typeId && this.typeId !== dataFound.get("guid")) || this.typeId === null) { if ((this.typeId && this.typeId !== dataFound.get("guid")) || this.typeId === null) {
if (this.typeId) { if (this.typeId) {
......
...@@ -74,6 +74,7 @@ define([ ...@@ -74,6 +74,7 @@ define([
events["click " + this.ui.showGlossaryType] = function(e) { events["click " + this.ui.showGlossaryType] = function(e) {
var getTreeData, displayText; var getTreeData, displayText;
e.stopPropagation();
this.isTermView = !this.isTermView; this.isTermView = !this.isTermView;
this.glossarySwitchBtnUpdate(); this.glossarySwitchBtnUpdate();
}; };
...@@ -93,6 +94,12 @@ define([ ...@@ -93,6 +94,12 @@ define([
}, },
this this
); );
if (this.options.categoryEvent) {
this.options.categoryEvent.on("Success:TermRename", function(options) {
that.refresh();
})
}
$('body').on('click', '.termPopoverOptions li, .categoryPopoverOptions li', function(e) { $('body').on('click', '.termPopoverOptions li, .categoryPopoverOptions li', function(e) {
that.$('.termPopover,.categoryPopover').popover('hide'); that.$('.termPopover,.categoryPopover').popover('hide');
that[$(this).find('a').data('fn')](e) that[$(this).find('a').data('fn')](e)
...@@ -103,6 +110,7 @@ define([ ...@@ -103,6 +110,7 @@ define([
this.ui.showGlossaryType.attr("data-original-title", (this.isTermView ? "Show Category" : "Show Term")); this.ui.showGlossaryType.attr("data-original-title", (this.isTermView ? "Show Category" : "Show Term"));
this.ui.showGlossaryType.tooltip('hide'); this.ui.showGlossaryType.tooltip('hide');
this.ui.showGlossaryType.find("i").toggleClass("switch-button"); this.ui.showGlossaryType.find("i").toggleClass("switch-button");
// this.ui.showGlossaryType.find("span").html(this.isTermView ? "Show Category" : "Show Term");
this.ui.termSearchTree.jstree(true).refresh(); this.ui.termSearchTree.jstree(true).refresh();
//this.showDefaultPage(); //this.showDefaultPage();
// if(this.isTermView){ // if(this.isTermView){
...@@ -146,6 +154,10 @@ define([ ...@@ -146,6 +154,10 @@ define([
this.fetchGlossary(); this.fetchGlossary();
}, },
onBeforeDestroy: function() {
this.options.categoryEvent.off("Success:TermRename")
},
getViewType: function() { getViewType: function() {
if (this.options.value) { if (this.options.value) {
this.isTermView = this.options.value.viewType ? this.options.value.viewType == "term" ? true : false : true; this.isTermView = this.options.value.viewType ? this.options.value.viewType == "term" ? true : false : true;
......
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