Commit 69330a5d by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2295: UI updates for classifications

parent ca04aead
...@@ -112,6 +112,9 @@ td { ...@@ -112,6 +112,9 @@ td {
td { td {
white-space: normal; white-space: normal;
} }
.select-all-header-cell{
width : 42px;
}
} }
.backgrid-paginator ul { .backgrid-paginator ul {
......
...@@ -23,65 +23,112 @@ ...@@ -23,65 +23,112 @@
height: 150px; height: 150px;
overflow-y: auto; overflow-y: auto;
} }
.child>li,
>li { >li {
list-style: none; list-style: none;
cursor: pointer; cursor: pointer;
&.parent-node { &.parent-node {
position: relative; position: relative;
margin-top: 5px;
/* margin-bottom: 5px; */
border-radius: 4px;
&:hover {
background-color: $color_star_dust_approx;
}
&.active { &.active {
background-color: $color_jungle_green_approx; &>div {
border: none; background-color: $color_jungle_green_approx;
.tools { border: none;
display: block .tools {
display: block
}
&:hover {
background-color: $color_jungle_green_approx;
}
}
ul.child {
&:after {
height: 4px;
top: -5px;
}
} }
} }
>ul>li { &>div {
line-height: 30px; position: relative;
margin-left: -20px; margin-top: 5px;
text-indent: 20px; /* margin-bottom: 5px; */
border-radius: 4px;
&:hover { &:hover {
background-color: $color_keppel_approx; background-color: $color_star_dust_approx;
} }
&.selected { >.fa.toggleArrow {
background-color: $color_keppel_approx; position: absolute;
left: 0;
padding: 8px;
cursor: pointer;
} // >ul>li {
// line-height: 30px;
// margin-left: -20px;
// text-indent: 20px;
// &:hover {
// background-color: $color_keppel_approx;
// }
// &.selected {
// background-color: $color_keppel_approx;
// }
// }
.tools {
display: none;
position: absolute;
right: 0;
color: $white;
padding: 5px 10px;
}
>a,
>div>a {
display: block;
color: $white !important;
white-space: nowrap;
padding: 5px 10px;
max-width: 91%;
@include ellipsis();
font-size: 14px;
&:hover {
color: $white !important;
text-decoration: none !important;
}
}
>i+a {
padding: 5px 25px;
} }
} }
.tools { >ul.child {
display: none; margin-left: 11px;
position: absolute; padding-left: 10px;
right: 0; border-left: 1px dotted gray;
color: $white; position: relative;
padding: 5px 10px; &:after {
} position: absolute;
} content: "";
>a, height: 13px;
>div>a { width: 11px;
display: block; top: -14px;
color: $white !important; left: -1px;
white-space: nowrap; border-left: 1px dotted gray;
padding: 5px 10px; }
max-width: 91%; li {
@include ellipsis(); &.parent-node {
font-size: 14px; &:after {
&:hover { position: absolute;
color: $white !important; content: "";
text-decoration: none !important; height: 2px;
width: 14px;
top: 16px;
left: -9px;
border-top: 1px dotted gray;
}
&.active:after {
width: 9px;
}
}
}
} }
} }
} }
>ul {
padding-left: 20px;
li {}
}
.tagAsset {
display: none;
}
} }
.input-group.attributes .form-control { .input-group.attributes .form-control {
......
...@@ -145,6 +145,11 @@ a { ...@@ -145,6 +145,11 @@ a {
} }
} }
.cursor-default,
.cursor-default a {
cursor: default;
}
.blue-link { .blue-link {
color: $color_havelock_blue_approx; color: $color_havelock_blue_approx;
&:focus { &:focus {
......
...@@ -160,7 +160,7 @@ require.config({ ...@@ -160,7 +160,7 @@ require.config({
'daterangepicker': 'libs/bootstrap-daterangepicker/js/daterangepicker', 'daterangepicker': 'libs/bootstrap-daterangepicker/js/daterangepicker',
'nvd3': 'libs/nvd3/nv.d3.min', 'nvd3': 'libs/nvd3/nv.d3.min',
'sparkline': 'libs/sparkline/jquery.sparkline.min', 'sparkline': 'libs/sparkline/jquery.sparkline.min',
'table-dragger' : 'libs/table-dragger/table-dragger' 'table-dragger': 'libs/table-dragger/table-dragger'
}, },
/** /**
...@@ -237,6 +237,10 @@ require(['App', ...@@ -237,6 +237,10 @@ require(['App',
this.entityDefCollection.fetch({ this.entityDefCollection.fetch({
skipDefaultError: true, skipDefaultError: true,
complete: function() { complete: function() {
that.entityDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
};
that.entityDefCollection.fullCollection.sort({ silent: true });
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
} }
...@@ -244,6 +248,10 @@ require(['App', ...@@ -244,6 +248,10 @@ require(['App',
this.typeHeaders.fetch({ this.typeHeaders.fetch({
skipDefaultError: true, skipDefaultError: true,
complete: function() { complete: function() {
that.typeHeaders.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
}
that.typeHeaders.fullCollection.sort({ silent: true });
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
} }
...@@ -251,6 +259,10 @@ require(['App', ...@@ -251,6 +259,10 @@ require(['App',
this.enumDefCollection.fetch({ this.enumDefCollection.fetch({
skipDefaultError: true, skipDefaultError: true,
complete: function() { complete: function() {
that.enumDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
};
that.enumDefCollection.fullCollection.sort({ silent: true });
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
} }
...@@ -258,6 +270,10 @@ require(['App', ...@@ -258,6 +270,10 @@ require(['App',
this.classificationDefCollection.fetch({ this.classificationDefCollection.fetch({
skipDefaultError: true, skipDefaultError: true,
complete: function() { complete: function() {
that.classificationDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
};
that.classificationDefCollection.fullCollection.sort({ silent: true });
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
} }
......
...@@ -139,7 +139,8 @@ define([ ...@@ -139,7 +139,8 @@ define([
} }
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ _.extend({
'tag': tagName 'tag': tagName,
'value': paramObj
}, that.preFetchedCollectionLists, that.sharedObj) }, that.preFetchedCollectionLists, that.sharedObj)
)); ));
} else { } else {
...@@ -150,7 +151,7 @@ define([ ...@@ -150,7 +151,7 @@ define([
updateTabState: true updateTabState: true
}); });
} }
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(tagName); App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(_.extend({}, paramObj, { 'tagName': tagName }));
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
} }
if (tagName) { if (tagName) {
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
* limitations under the License. * limitations under the License.
--> -->
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-sm-4">
<div class="col-md-8 subContent"> <div class="col-sm-8 subContent">
<p data-id="atlasVersion"></p> <p data-id="atlasVersion"></p>
<br> <br>
<p class="text-info">Get involved!</p> <p class="text-info">Get involved!</p>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</div> </div>
{{#if includePagination}} {{#if includePagination}}
<div class="row clearfix banded pagination-box"> <div class="row clearfix banded pagination-box">
<div class="col-md-offset-4 col-md-8"> <div class="col-sm-offset-4 col-sm-8">
<div class="inline-content-fr"> <div class="inline-content-fr">
<div data-id="r_pagination" class="inline"></div> <div data-id="r_pagination" class="inline"></div>
{{#if includePageSize}} {{#if includePageSize}}
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="fontLoader"> <div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
</div> </div>
<div class="entityDetail form-horizontal col-md-12"> <div class="entityDetail form-horizontal col-sm-12">
<div class="row"> <div class="row">
<a href="javascript:void(0);" data-id="backButton"><i class="fa fa-chevron-left"></i> Back To Results</a> <a href="javascript:void(0);" data-id="backButton"><i class="fa fa-chevron-left"></i> Back To Results</a>
</div> </div>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-sm-12">
<ul class="nav nav-tabs "> <ul class="nav nav-tabs ">
<li role="properties" class="tab active"><a href="#tab-details" aria-controls="tab-details" role="tab" data-toggle="tab">Properties</a></li> <li role="properties" class="tab active"><a href="#tab-details" aria-controls="tab-details" role="tab" data-toggle="tab">Properties</a></li>
<li role="tags"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Tags</a></li> <li role="tags"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Tags</a></li>
......
...@@ -19,15 +19,15 @@ ...@@ -19,15 +19,15 @@
<div class="col-sm-12 form-group"> <div class="col-sm-12 form-group">
<div class="row"> <div class="row">
{{#if guid}} {{#if guid}}
<div class="col-md-8"> <div class="col-sm-8">
<label class="col-md-6 row-margin-bottom" data-id="assetName"></label> <label class="col-sm-6 row-margin-bottom" data-id="assetName"></label>
</div> </div>
{{else}} {{else}}
<div class="col-md-8"> <div class="col-sm-8">
<select class="form-control col-md-6 row-margin-bottom" data-id="entityList"></select> <select class="form-control col-sm-6 row-margin-bottom" data-id="entityList"></select>
</div> </div>
{{/if}} {{/if}}
<div class="col-md-4"> <div class="col-sm-4">
<span class="pull-left">Required</span> <span class="pull-left">Required</span>
<label class="switch pull-left"> <label class="switch pull-left">
<input type="checkbox" class="switch-input" name="toggleRequired" value="text"> <input type="checkbox" class="switch-input" name="toggleRequired" value="text">
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-12 entityInputData" data-id="entityInputData"></div> <div class="col-sm-12 entityInputData" data-id="entityInputData"></div>
</div> </div>
</form> </form>
<div class="fontLoader-relative entityLoader" style="display:none"> <div class="fontLoader-relative entityLoader" style="display:none">
......
...@@ -16,15 +16,15 @@ ...@@ -16,15 +16,15 @@
--> -->
<div class="row"> <div class="row">
<div class=""> <div class="">
<div class="col-md-3 rowValue"> <div class="col-sm-3 rowValue">
<div><span class="graphkey">Rows</span></div> <div><span class="graphkey">Rows</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
<div class="col-md-3 table_created"> <div class="col-sm-3 table_created">
<div><span class="graphkey">Date Created</span></div> <div><span class="graphkey">Date Created</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
<div class="col-md-6 table_name"> <div class="col-sm-6 table_name">
<div><span class="graphkey">Table</span></div> <div><span class="graphkey">Table</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</div> </div>
<hr/> <hr/>
<div class="row"> <div class="row">
<h4 class="col-md-12">{{typeObject.label}}</h4> <h4 class="col-sm-12">{{typeObject.label}}</h4>
</div> </div>
<div class="row"> <div class="row">
<a href="javascript:void(0);" data-id="backToYear" style="display: none"><i class="fa fa-chevron-left"></i> Back To Year</a> <a href="javascript:void(0);" data-id="backToYear" style="display: none"><i class="fa fa-chevron-left"></i> Back To Year</a>
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
</br> </br>
<div class="row"> <div class="row">
<div class=""> <div class="">
<div class="col-md-10"> <div class="col-sm-10">
<svg class="graph" width="100%" height="250px"></svg> <svg class="graph" width="100%" height="250px"></svg>
</div> </div>
<div class="col-md-2 profileGraphDetail"> <div class="col-sm-2 profileGraphDetail">
{{#if profileData}} {{#if profileData}}
<div class=""> <div class="">
<div><span class="graphkey">Cardinality</span></div> <div><span class="graphkey">Cardinality</span></div>
......
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
--> -->
<div class="row"> <div class="row">
<div class=""> <div class="">
<div class="col-md-3 rowValue"> <div class="col-sm-3 rowValue">
<div><span class="graphkey">Rows</span></div> <div><span class="graphkey">Rows</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
<div class="col-md-3 table_created"> <div class="col-sm-3 table_created">
<div><span class="graphkey">Date Created</span></div> <div><span class="graphkey">Date Created</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
<div class="col-md-3 table_name"> <div class="col-sm-3 table_name">
<div><span class="graphkey">Table</span></div> <div><span class="graphkey">Table</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
<div class="col-md-3 db_name"> <div class="col-sm-3 db_name">
<div><span class="graphkey">DB</span></div> <div><span class="graphkey">DB</span></div>
<div><span class="graphval"><div class="value-loader"></div></span></div> <div><span class="graphval"><div class="value-loader"></div></span></div>
</div> </div>
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
<div class="searchTable"> <div class="searchTable">
<div class="row well"> <div class="row well">
<div class="row form-group pagination-box" style="display: none;"> <div class="row form-group pagination-box" style="display: none;">
<div class="col-md-4"> <div class="col-sm-4">
<span class="labelShowRecord pull-left" data-id="pageRecordText"> </span> <span class="labelShowRecord pull-left" data-id="pageRecordText"> </span>
</div> </div>
<div class="col-md-8 inline-content-fr"> <div class="col-sm-8 inline-content-fr">
<div class="inline" data-id="colManager"></div> <div class="inline" data-id="colManager"></div>
<div class="inline" data-id="containerCheckBox" style="display: none;"> <div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="inputLabel"> <label class="checkbox-inline btn" for="inputLabel">
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
{{/if}} {{/if}}
</div> </div>
<div class="row pagination-box" style="display: none"> <div class="row pagination-box" style="display: none">
<div class="col-md-offset-4 col-md-8"> <div class="col-sm-offset-4 col-sm-8">
<div class="inline-content-fr"> <div class="inline-content-fr">
<div class="backgrid-paginator inline"> <div class="backgrid-paginator inline">
<ul class="" data-id="paginationDiv" style="display:none"> <ul class="" data-id="paginationDiv" style="display:none">
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="inline col-md-4" data-id="paginationDiv"> <div class="inline col-sm-4" data-id="paginationDiv">
<div class="input-group" data-id="goToPageDiv"> <div class="input-group" data-id="goToPageDiv">
<input type="text" class="form-control number-input" data-id="gotoPage" placeholder="Goto Page" /> <input type="text" class="form-control number-input" data-id="gotoPage" placeholder="Goto Page" />
<span class="input-group-btn"> <span class="input-group-btn">
......
...@@ -14,12 +14,6 @@ ...@@ -14,12 +14,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<!-- <div class="row">
<div class="col-md-10"><span>{{name}}</span></div>
<div class="col-md-2">
<button type="button" class="btn btn-danger btn-sm closeInput" data-id="close"><i class="fa fa-times"></i></button>
</div>
</div> -->
<div data-id="{{guid}}" class="item"> <div data-id="{{guid}}" class="item">
<div class="tools"> <div class="tools">
<i class="fa fa-ellipsis-h saveSearchPopover" data-original-title="" title="" data-id=""></i> <i class="fa fa-ellipsis-h saveSearchPopover" data-original-title="" title="" data-id=""></i>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</div> </div>
{{#if create}} {{#if create}}
<div class="form-group"> <div class="form-group">
<div class="col-md-12"> <div class="col-sm-12">
<label>Select tags to inherit attributes(optional)</label> <label>Select tags to inherit attributes(optional)</label>
<p class="text-gray">Attributes define additional properties for the tag</p> <p class="text-gray">Attributes define additional properties for the tag</p>
<select class="form-control" data-id="parentTagList" multiple="multiple"></select> <select class="form-control" data-id="parentTagList" multiple="multiple"></select>
......
...@@ -18,13 +18,23 @@ ...@@ -18,13 +18,23 @@
<div class="fontLoader"> <div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
</div> </div>
<div class="tagDetail clearfix form-horizontal col-md-12"> <div class="tagDetail clearfix form-horizontal col-sm-12">
<h1 class="form-group"><span data-id="title"></span></h1> <h1 class="form-group"><span data-id="title"></span></h1>
<button type="button" data-id="editButton" class="btn btn-sm btn-action pull-right"><i class="fa fa-pencil"></i></button> <button type="button" data-id="editButton" class="btn btn-sm btn-action pull-right"><i class="fa fa-pencil"></i></button>
<p class="form-group" data-id="description"></p> <p class="form-group" data-id="description"></p>
<div class="superType form-group" style="display:none"> <div class="superType form-group" style="display:none">
<label class="control-label-sm-pr pull-left">Derived From:</label> <label class="control-label-sm-pr pull-left">Direct super-tags:</label>
<div data-id="showSuperType" class="btn-inline"> <div data-id="superType" class="btn-inline">
</div>
</div>
<div class="subType form-group" style="display:none">
<label class="control-label-sm-pr pull-left">Direct sub-tags:</label>
<div data-id="subType" class="btn-inline">
</div>
</div>
<div class="entityType form-group cursor-default" style="display:none">
<label class="control-label-sm-pr pull-left">Entity-types:</label>
<div data-id="entityType" class="btn-inline">
</div> </div>
</div> </div>
<div class="attributes form-group"> <div class="attributes form-group">
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
--> -->
<div class="form-group clearfix"> <div class="form-group clearfix">
<div class="col-md-7"> <div class="col-sm-7">
<input class="form-control attributeInput" data-id="attributeInput" placeholder="Attribute name"> <input class="form-control attributeInput" data-id="attributeInput" placeholder="Attribute name">
</input> </input>
</div> </div>
<div class="col-md-3"> <div class="col-sm-3">
<select class="form-control dataTypeSelector" data-id="dataTypeSelector"> <select class="form-control dataTypeSelector" data-id="dataTypeSelector">
<option selected="selected">string</option> <option selected="selected">string</option>
<option>boolean</option> <option>boolean</option>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<option>date</option> <option>date</option>
</select> </select>
</div> </div>
<div class="col-md-2 attributePlusData" align="right"> <div class="col-sm-2 attributePlusData" align="right">
<button type="button" class="btn btn-danger btn-sm closeInput" data-id="close"><i class="fa fa-times"></i></button> <button type="button" class="btn btn-danger btn-sm closeInput" data-id="close"><i class="fa fa-times"></i></button>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -14,10 +14,36 @@ ...@@ -14,10 +14,36 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<div class="clearfix add-seperator"> <div class="col-sm-12 add-seperator">
<button type="button" class="btn btn-action btn-md pull-left" data-id="createTag" type="button"><i class="fa fa-plus"></i> Create Tag</button> <div class="row">
<button type="button" class="btn btn-action btn-md pull-right" title="Refresh" data-id="refreshTag" onclick="this.blur();" type="button"><i class="fa fa-refresh"></i></button> <div class="col-sm-6 no-padding" style="margin-top: 5px;">
<span class="pull-left">Flat</span>
<label class="switch pull-left">
<input type="checkbox" class="switch-input" name="tagView" value="text" />
<span class="switch-slider"></span>
</label>
<span class="pull-left">Tree</span>
</div>
<div class="col-sm-6 no-padding-right">
<button type="button" class="btn btn-action btn-md pull-right" title="Refresh" data-id="refreshTag" onclick="this.blur();" type="button"><i class="fa fa-refresh"></i></button>
<button type="button" class="btn btn-action btn-md pull-right" data-id="createTag" type="button"><i class="fa fa-plus"></i></button>
</div>
</div>
</div> </div>
<input type="text" class="form-control" data-id="offlineSearchTag" placeholder="Search Tags"> <!-- <div class="clearfix add-seperator">
<ul class="tag-tree" data-id="tagsParent"> <button type="button" class="btn btn-action btn-md pull-left" data-id="createTag" type="button"><i class="fa fa-plus"></i> Create Tag</button>
</ul> </div> -->
\ No newline at end of file <div class="row">
<div class="list-view col-sm-12">
<input type="text" class="form-control" data-id="offlineSearchTag" placeholder="Search Tags">
<ul class="tag-tree" data-id="tagsList">
</ul>
</div>
<div class="tree-view col-sm-12" style="display: none;">
<div class="treeLov">
<select class="form-control" data-id="treeLov"></select>
</div>
<ul class="tag-tree" data-id="tagsParent">
</ul>
</div>
</div>
\ No newline at end of file
...@@ -304,16 +304,17 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -304,16 +304,17 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
}, },
isInitial: function() { isInitial: function() {
return this.getQueryUrl().firstValue == undefined ? true : false; return this.getQueryUrl().firstValue == undefined;
}, },
isTagTab: function(url) { isTagTab: function(url) {
return this.getQueryUrl(url).firstValue == "tag" ? true : false; var quey = this.getQueryUrl(url);
return quey.firstValue == "tag" || quey.queyParams[0] == "#!/tag";
}, },
isSearchTab: function(url) { isSearchTab: function(url) {
return this.getQueryUrl(url).firstValue == "search" ? true : false; return this.getQueryUrl(url).firstValue == "search";
}, },
isDetailPage: function(url) { isDetailPage: function(url) {
return this.getQueryUrl(url).firstValue == "detailPage" ? true : false; return this.getQueryUrl(url).firstValue == "detailPage";
}, },
getLastValue: function() { getLastValue: function() {
return this.getQueryUrl().lastValue; return this.getQueryUrl().lastValue;
......
...@@ -328,6 +328,7 @@ define(['require', ...@@ -328,6 +328,7 @@ define(['require',
}, },
showLoader: that.showLoader.bind(that), showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that), hideLoader: that.hideLoader.bind(that),
collection: that.classificationDefCollection,
enumDefCollection: that.enumDefCollection enumDefCollection: that.enumDefCollection
}); });
view.modal.on('ok', function() { view.modal.on('ok', function() {
......
...@@ -234,10 +234,7 @@ define(['require', ...@@ -234,10 +234,7 @@ define(['require',
} }
} else { } else {
var str = '<option disabled="disabled" selected>--Select entity-type--</option>'; var str = '<option disabled="disabled" selected>--Select entity-type--</option>';
this.entityDefCollection.fullCollection.comparator = function(model) { this.entityDefCollection.fullCollection.each(function(val) {
return model.get('name');
}
this.entityDefCollection.fullCollection.sort().each(function(val) {
var name = Utils.getName(val.toJSON()); var name = Utils.getName(val.toJSON());
if (Globals.entityTypeConfList) { if (Globals.entityTypeConfList) {
if (_.isEmptyArray(Globals.entityTypeConfList)) { if (_.isEmptyArray(Globals.entityTypeConfList)) {
...@@ -400,9 +397,9 @@ define(['require', ...@@ -400,9 +397,9 @@ define(['require',
}, },
getContainer: function(value) { getContainer: function(value) {
var entityLabel = this.capitalize(value.name); var entityLabel = this.capitalize(value.name);
return '<div class="row form-group ' + value.isOptional + '"><span class="col-md-3">' + return '<div class="row form-group ' + value.isOptional + '"><span class="col-sm-3">' +
'<label><span class="' + (value.isOptional ? 'true' : 'false required') + '">' + entityLabel + '</span><span class="center-block ellipsis text-gray" title="Data Type : ' + value.typeName + '">' + '(' + Utils.escapeHtml(value.typeName) + ')' + '</span></label></span>' + '<label><span class="' + (value.isOptional ? 'true' : 'false required') + '">' + entityLabel + '</span><span class="center-block ellipsis text-gray" title="Data Type : ' + value.typeName + '">' + '(' + Utils.escapeHtml(value.typeName) + ')' + '</span></label></span>' +
'<span class="col-md-9">' + (this.getElement(value)) + '<span class="col-sm-9">' + (this.getElement(value)) +
'</input></span></div>'; '</input></span></div>';
}, },
getFieldSet: function(name, alloptional, attributeInput) { getFieldSet: function(name, alloptional, attributeInput) {
......
...@@ -73,7 +73,7 @@ define(['require', ...@@ -73,7 +73,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entityDefCollection', 'attribute', 'fetchCollection', 'enumDefCollection')); _.extend(this, _.pick(options, 'guid', 'classificationDefCollection', 'entityDefCollection', 'attribute', 'fetchCollection', 'enumDefCollection'));
this.schemaCollection = new VSchemaList([], {}); this.schemaCollection = new VSchemaList([], {});
this.commonTableOptions = { this.commonTableOptions = {
collection: this.schemaCollection, collection: this.schemaCollection,
...@@ -274,6 +274,7 @@ define(['require', ...@@ -274,6 +274,7 @@ define(['require',
}, },
hideLoader: that.hideLoader.bind(that), hideLoader: that.hideLoader.bind(that),
showLoader: that.showLoader.bind(that), showLoader: that.showLoader.bind(that),
collection: that.classificationDefCollection,
enumDefCollection: that.enumDefCollection enumDefCollection: that.enumDefCollection
}); });
}); });
......
...@@ -43,7 +43,7 @@ define(['require', ...@@ -43,7 +43,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'searchTableColumns')); _.extend(this, _.pick(options, 'value', 'initialView', 'classificationDefCollection', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'searchTableColumns'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
......
...@@ -184,19 +184,15 @@ define(['require', ...@@ -184,19 +184,15 @@ define(['require',
}, },
bindEvents: function(param) { bindEvents: function(param) {
this.listenTo(this.typeHeaders, "reset", function(value) { this.listenTo(this.typeHeaders, "reset", function(value) {
this.renderTypeTagList(); this.initializeValues();
this.setValues();
this.ui.typeLov.select2({
placeholder: "Select",
allowClear: true
});
this.ui.tagLov.select2({
placeholder: "Select",
allowClear: true
});
this.checkForButtonVisiblity();
}, this); }, this);
}, },
initializeValues: function() {
this.renderTypeTagList();
this.setValues();
this.checkForButtonVisiblity();
this.renderSaveSearch();
},
makeFilterButtonActive: function(filtertypeParam) { makeFilterButtonActive: function(filtertypeParam) {
var filtertype = ['entityFilters', 'tagFilters'], var filtertype = ['entityFilters', 'tagFilters'],
that = this; that = this;
...@@ -306,17 +302,7 @@ define(['require', ...@@ -306,17 +302,7 @@ define(['require',
}, },
onRender: function() { onRender: function() {
// array of tags which is coming from url // array of tags which is coming from url
this.renderTypeTagList(); this.initializeValues();
this.setValues();
this.ui.typeLov.select2({
placeholder: "Select",
allowClear: true
});
this.ui.tagLov.select2({
placeholder: "Select",
allowClear: true
});
this.renderSaveSearch();
}, },
updateQueryObject: function(param) { updateQueryObject: function(param) {
if (param && param.searchType) { if (param && param.searchType) {
...@@ -345,7 +331,7 @@ define(['require', ...@@ -345,7 +331,7 @@ define(['require',
}, },
onRefreshButton: function() { onRefreshButton: function() {
this.fetchCollection(); this.fetchCollection();
//to check url query param contain type or not //to check url query param contain type or not
var checkURLValue = Utils.getUrlState.getQueryParams(this.url); var checkURLValue = Utils.getUrlState.getQueryParams(this.url);
if (this.searchVent && (_.has(checkURLValue, "tag") || _.has(checkURLValue, "type") || _.has(checkURLValue, "query"))) { if (this.searchVent && (_.has(checkURLValue, "tag") || _.has(checkURLValue, "type") || _.has(checkURLValue, "query"))) {
this.searchVent.trigger('search:refresh'); this.searchVent.trigger('search:refresh');
...@@ -420,10 +406,7 @@ define(['require', ...@@ -420,10 +406,7 @@ define(['require',
this.ui.typeLov.empty(); this.ui.typeLov.empty();
var typeStr = '<option></option>', var typeStr = '<option></option>',
tagStr = typeStr; tagStr = typeStr;
this.typeHeaders.fullCollection.comparator = function(model) { this.typeHeaders.fullCollection.each(function(model) {
return Utils.getName(model.toJSON(), 'name').toLowerCase();
}
this.typeHeaders.fullCollection.sort().each(function(model) {
var name = Utils.getName(model.toJSON(), 'name'); var name = Utils.getName(model.toJSON(), 'name');
if (model.get('category') == 'ENTITY') { if (model.get('category') == 'ENTITY') {
typeStr += '<option>' + (name) + '</option>'; typeStr += '<option>' + (name) + '</option>';
...@@ -434,6 +417,14 @@ define(['require', ...@@ -434,6 +417,14 @@ define(['require',
}); });
that.ui.typeLov.html(typeStr); that.ui.typeLov.html(typeStr);
that.ui.tagLov.html(tagStr); that.ui.tagLov.html(tagStr);
this.ui.typeLov.select2({
placeholder: "Select",
allowClear: true
});
this.ui.tagLov.select2({
placeholder: "Select",
allowClear: true
});
}, },
setValues: function(paramObj) { setValues: function(paramObj) {
var arr = [], var arr = [],
......
...@@ -120,14 +120,13 @@ define(['require', ...@@ -120,14 +120,13 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'initialView', 'isTypeTagNotExists', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection', 'searchTableColumns')); _.extend(this, _.pick(options, 'value', 'initialView', 'isTypeTagNotExists', 'classificationDefCollection', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection', 'searchTableColumns'));
this.entityModel = new VEntity(); this.entityModel = new VEntity();
this.searchCollection = new VSearchList(); this.searchCollection = new VSearchList();
this.limit = 25; this.limit = 25;
this.asyncFetchCounter = 0; this.asyncFetchCounter = 0;
this.offset = 0; this.offset = 0;
this.bindEvents(); this.bindEvents();
this.bradCrumbList = [];
this.arr = []; this.arr = [];
this.searchType = 'Basic Search'; this.searchType = 'Basic Search';
this.columnOrder = null; this.columnOrder = null;
...@@ -501,7 +500,6 @@ define(['require', ...@@ -501,7 +500,6 @@ define(['require',
return this; return this;
} }
}); });
that.bradCrumbList = [];
var columns = new columnCollection((that.searchCollection.dynamicTable ? that.getDaynamicColumns(that.searchCollection.toJSON()) : that.getFixedDslColumn())); var columns = new columnCollection((that.searchCollection.dynamicTable ? that.getDaynamicColumns(that.searchCollection.toJSON()) : that.getFixedDslColumn()));
columns.setPositions().sort(); columns.setPositions().sort();
that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, { that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
...@@ -791,6 +789,7 @@ define(['require', ...@@ -791,6 +789,7 @@ define(['require',
tagList: that.getTagList(guid, multiple), tagList: that.getTagList(guid, multiple),
showLoader: that.showLoader.bind(that), showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that), hideLoader: that.hideLoader.bind(that),
collection: that.classificationDefCollection,
enumDefCollection: that.enumDefCollection enumDefCollection: that.enumDefCollection
}); });
}); });
......
...@@ -28,9 +28,8 @@ define(['require', ...@@ -28,9 +28,8 @@ define(['require',
template: tmpl, template: tmpl,
regions: { regions: {
RBusinessCatalogLayoutView: "#r_businessCatalogLayoutView",
RTagLayoutView: "#r_tagLayoutView", RTagLayoutView: "#r_tagLayoutView",
RSearchLayoutView: "#r_searchLayoutView", RSearchLayoutView: "#r_searchLayoutView"
}, },
ui: { ui: {
tabs: '.tabs li a', tabs: '.tabs li a',
...@@ -92,6 +91,7 @@ define(['require', ...@@ -92,6 +91,7 @@ define(['require',
collection: that.classificationDefCollection, collection: that.classificationDefCollection,
tag: that.tag, tag: that.tag,
value: that.value, value: that.value,
enumDefCollection: that.enumDefCollection,
typeHeaders: that.typeHeaders typeHeaders: that.typeHeaders
})); }));
}); });
......
...@@ -61,27 +61,17 @@ define(['require', ...@@ -61,27 +61,17 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
// this.parentView = options.parentView; _.extend(this, _.pick(options, 'enumDefCollection'));
this.collection = new Backbone.Collection(); this.collection = new Backbone.Collection();
this.typeEnum = new VTagList(); this.collectionAttribute();
this.typeEnum.url = UrlLinks.typedefsUrl().defs;
this.typeEnum.modelAttrName = "enumDefs";
}, },
onRender: function() { onRender: function() {
var that = this; var that = this;
this.$('.fontLoader').show();
this.ui.addAttributeDiv.find('.closeInput').hide(); this.ui.addAttributeDiv.find('.closeInput').hide();
if (!('placeholder' in HTMLInputElement.prototype)) { if (!('placeholder' in HTMLInputElement.prototype)) {
this.ui.addAttributeDiv.find('input,textarea').placeholder(); this.ui.addAttributeDiv.find('input,textarea').placeholder();
} }
that.typeEnum.fetch({ that.$('.hide').removeClass('hide');
reset: true,
complete: function(model, response) {
that.collectionAttribute();
that.$('.fontLoader').hide();
that.$('.hide').removeClass('hide');
}
});
}, },
bindEvents: function() {}, bindEvents: function() {},
collectionAttribute: function() { collectionAttribute: function() {
...@@ -107,4 +97,4 @@ define(['require', ...@@ -107,4 +97,4 @@ define(['require',
} }
} }
}); });
}); });
\ No newline at end of file
...@@ -53,8 +53,7 @@ define(['require', ...@@ -53,8 +53,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList', 'tagModel', 'enumDefCollection')); _.extend(this, _.pick(options, 'collection', 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList', 'tagModel', 'enumDefCollection'));
this.collection = new VTagList();
this.commonCollection = new VTagList(); this.commonCollection = new VTagList();
var that = this, var that = this,
modalObj = { modalObj = {
...@@ -184,17 +183,12 @@ define(['require', ...@@ -184,17 +183,12 @@ define(['require',
onRender: function() { onRender: function() {
var that = this; var that = this;
$.extend(this.collection.queryParams, { type: 'classification' });
this.hideAttributeBox(); this.hideAttributeBox();
this.collection.fetch({ this.tagsCollection();
reset: true, if (this.tagModel) {
complete: function() { this.fetchTagSubData(that.tagModel.typeName);
if (that.tagModel) { }
that.fetchTagSubData(that.tagModel.typeName); that.showAttributeBox();
}
that.showAttributeBox();
},
});
}, },
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
...@@ -207,13 +201,9 @@ define(['require', ...@@ -207,13 +201,9 @@ define(['require',
}, this); }, this);
}, },
tagsCollection: function() { tagsCollection: function() {
var that = this; var that = this,
this.collection.fullCollection.comparator = function(model) { str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>';
return Utils.getName(model.toJSON(), 'name').toLowerCase(); this.collection.fullCollection.each(function(obj, key) {
}
var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>';
this.collection.fullCollection.sort().each(function(obj, key) {
var name = Utils.getName(obj.toJSON(), 'name'); var name = Utils.getName(obj.toJSON(), 'name');
// using obj.get('name') insted of name variable because if html is presen in name then escaped name will not found in tagList. // using obj.get('name') insted of name variable because if html is presen in name then escaped name will not found in tagList.
if (_.indexOf(that.tagList, obj.get('name')) === -1) { if (_.indexOf(that.tagList, obj.get('name')) === -1) {
......
...@@ -74,16 +74,13 @@ define(['require', ...@@ -74,16 +74,13 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tagCollection', 'model', 'tag', 'descriptionData')); _.extend(this, _.pick(options, 'tagCollection', 'enumDefCollection', 'model', 'tag', 'descriptionData', 'selectedTag'));
if (this.model) { if (this.model) {
this.description = this.model.get('description'); this.description = this.model.get('description');
} else { } else {
this.create = true; this.create = true;
} }
this.collection = new Backbone.Collection(); this.collection = new Backbone.Collection();
this.typeEnum = new VTagList();
this.typeEnum.url = UrlLinks.typedefsUrl().defs;
this.typeEnum.modelAttrName = "enumDefs";
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -97,12 +94,7 @@ define(['require', ...@@ -97,12 +94,7 @@ define(['require',
if (!('placeholder' in HTMLInputElement.prototype)) { if (!('placeholder' in HTMLInputElement.prototype)) {
this.ui.createTagForm.find('input,textarea').placeholder(); this.ui.createTagForm.find('input,textarea').placeholder();
} }
that.typeEnum.fetch({ that.hideLoader();
reset: true,
complete: function(model, response) {
that.hideLoader();
}
});
}, },
tagCollectionList: function() { tagCollectionList: function() {
var that = this, var that = this,
...@@ -110,7 +102,7 @@ define(['require', ...@@ -110,7 +102,7 @@ define(['require',
this.ui.parentTag.empty(); this.ui.parentTag.empty();
this.tagCollection.fullCollection.each(function(val) { this.tagCollection.fullCollection.each(function(val) {
var name = Utils.getName(val.toJSON()); var name = Utils.getName(val.toJSON());
str += '<option>' + (name) + '</option>'; str += '<option ' + (name == that.selectedTag ? 'selected' : '') + '>' + (name) + '</option>';
}); });
that.ui.parentTag.html(str); that.ui.parentTag.html(str);
// IE9 support // IE9 support
......
...@@ -44,7 +44,9 @@ define(['require', ...@@ -44,7 +44,9 @@ define(['require',
addAttribute: '[data-id="addAttribute"]', addAttribute: '[data-id="addAttribute"]',
description: '[data-id="description"]', description: '[data-id="description"]',
publishButton: '[data-id="publishButton"]', publishButton: '[data-id="publishButton"]',
showSuperType: "[data-id='showSuperType']" superType: "[data-id='superType']",
subType: "[data-id='subType']",
entityType: "[data-id='entityType']"
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -58,7 +60,7 @@ define(['require', ...@@ -58,7 +60,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tag', 'collection')); _.extend(this, _.pick(options, 'tag', 'collection', 'enumDefCollection'));
}, },
bindEvents: function() { bindEvents: function() {
this.listenTo(this.collection, 'reset', function() { this.listenTo(this.collection, 'reset', function() {
...@@ -98,10 +100,21 @@ define(['require', ...@@ -98,10 +100,21 @@ define(['require',
this.ui.publishButton.prop('disabled', true); this.ui.publishButton.prop('disabled', true);
}, },
renderTagDetail: function() { renderTagDetail: function() {
var attributeData = "", var that = this,
supertypeData = "", attributeData = "",
attributeDefs = this.model.get("attributeDefs"), attributeDefs = this.model.get("attributeDefs"),
superTypeArr = this.model.get('superTypes'); genrateType = function(options) {
var data = options.data;
_.each(data, function(value, key) {
var str = "",
el = that.ui[key];
_.each(value, function(name) {
el.parents("." + key).show();
str += ' <a class="btn btn-action btn-sm" href="' + (key === "entityType" ? "javascript:void(0)" : "#!/tag/tagAttribute/" + name) + '">' + name + '</a>';
});
el.html(str);
});
}
this.ui.title.html('<span>' + (Utils.getName(this.model.toJSON())) + '</span>'); this.ui.title.html('<span>' + (Utils.getName(this.model.toJSON())) + '</span>');
if (this.model.get("description")) { if (this.model.get("description")) {
this.ui.description.text(this.model.get("description")); this.ui.description.text(this.model.get("description"));
...@@ -115,13 +128,14 @@ define(['require', ...@@ -115,13 +128,14 @@ define(['require',
}); });
this.ui.showAttribute.html(attributeData); this.ui.showAttribute.html(attributeData);
} }
if (superTypeArr.length > 0) {
this.$(".superType").show(); genrateType({
_.each(superTypeArr, function(value, key) { data: {
supertypeData += ' <a class="btn btn-action btn-sm" href="#!/tag/tagAttribute/' + value + '">' + value + '</a>'; superType: this.model.get('superTypes'),
}); subType: this.model.get('subTypes'),
this.ui.showSuperType.html(supertypeData); entityType: this.model.get('entityTypes'),
} }
});
Utils.hideTitleLoader(this.$('.fontLoader'), this.$('.tagDetail')); Utils.hideTitleLoader(this.$('.fontLoader'), this.$('.tagDetail'));
}, },
onSaveButton: function(saveObject, message) { onSaveButton: function(saveObject, message) {
...@@ -174,7 +188,9 @@ define(['require', ...@@ -174,7 +188,9 @@ define(['require',
'modules/Modal' 'modules/Modal'
], ],
function(AddTagAttributeView, Modal) { function(AddTagAttributeView, Modal) {
var view = new AddTagAttributeView(); var view = new AddTagAttributeView({
"enumDefCollection": that.enumDefCollection
});
that.modal = new Modal({ that.modal = new Modal({
title: 'Add Attribute', title: 'Add Attribute',
content: view, content: view,
...@@ -274,7 +290,7 @@ define(['require', ...@@ -274,7 +290,7 @@ define(['require',
'views/tag/CreateTagLayoutView', 'views/tag/CreateTagLayoutView',
'modules/Modal' 'modules/Modal'
], function(CreateTagLayoutView, Modal) { ], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'tagCollection': that.collection, 'model': that.model, 'tag': that.tag }); var view = new CreateTagLayoutView({ 'tagCollection': that.collection, 'model': that.model, 'tag': that.tag, 'enumDefCollection': enumDefCollection });
that.modal = new Modal({ that.modal = new Modal({
title: 'Edit Tag', title: 'Edit Tag',
content: view, content: view,
...@@ -296,4 +312,4 @@ define(['require', ...@@ -296,4 +312,4 @@ define(['require',
} }
}); });
return TagAttributeDetailLayoutView; return TagAttributeDetailLayoutView;
}); });
\ No newline at end of file
...@@ -60,8 +60,8 @@ define(['require', ...@@ -60,8 +60,8 @@ define(['require',
}, },
onRender: function() { onRender: function() {
var that = this; var that = this;
_.each(this.parentView.typeEnum.models, function(objValue) { this.parentView.enumDefCollection.fullCollection.each(function(model) {
that.ui.dataTypeSelector.append("<option>" + objValue.attributes.name + "</option>"); that.ui.dataTypeSelector.append("<option>" + model.get('name') + "</option>");
}); });
}, },
onCloseButton: function() { onCloseButton: function() {
...@@ -70,4 +70,4 @@ define(['require', ...@@ -70,4 +70,4 @@ define(['require',
} }
} }
}); });
}); });
\ No newline at end of file
...@@ -76,7 +76,8 @@ define(['require', ...@@ -76,7 +76,8 @@ define(['require',
if (that.RTagAttributeDetailLayoutView) { if (that.RTagAttributeDetailLayoutView) {
that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({ that.RTagAttributeDetailLayoutView.show(new TagAttributeDetailLayoutView({
tag: that.tag, tag: that.tag,
collection: that.collection collection: that.collection,
enumDefCollection: that.enumDefCollection
})); }));
} }
}); });
......
...@@ -172,6 +172,7 @@ define(['require', ...@@ -172,6 +172,7 @@ define(['require',
var view = new AddTagModalView({ var view = new AddTagModalView({
guid: that.guid, guid: that.guid,
modalCollection: that.collection, modalCollection: that.collection,
collection: that.classificationDefCollection,
enumDefCollection: that.enumDefCollection enumDefCollection: that.enumDefCollection
}); });
}); });
...@@ -224,10 +225,11 @@ define(['require', ...@@ -224,10 +225,11 @@ define(['require',
], function(AddTagModalView) { ], function(AddTagModalView) {
var view = new AddTagModalView({ var view = new AddTagModalView({
'tagModel': tagModel, 'tagModel': tagModel,
callback: function() { 'callback': function() {
that.fetchCollection(); that.fetchCollection();
}, },
guid: that.guid, 'guid': that.guid,
'collection': that.classificationDefCollection,
'enumDefCollection': that.enumDefCollection 'enumDefCollection': that.enumDefCollection
}); });
}); });
......
...@@ -40,10 +40,14 @@ define(['require', ...@@ -40,10 +40,14 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
tagsParent: "[data-id='tagsParent']", tagsParent: "[data-id='tagsParent']",
tagsList: "[data-id='tagsList']",
createTag: "[data-id='createTag']", createTag: "[data-id='createTag']",
tags: "[data-id='tags']", tags: "[data-id='tags']",
offLineSearchTag: "[data-id='offlineSearchTag']", offLineSearchTag: "[data-id='offlineSearchTag']",
refreshTag: '[data-id="refreshTag"]' treeLov: "[data-id='treeLov']",
refreshTag: '[data-id="refreshTag"]',
tagView: 'input[name="tagView"]',
expandArrow: '[data-id="expandArrow"]'
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -51,7 +55,10 @@ define(['require', ...@@ -51,7 +55,10 @@ define(['require',
events["click " + this.ui.createTag] = 'onClickCreateTag'; events["click " + this.ui.createTag] = 'onClickCreateTag';
events["click " + this.ui.tags] = 'onTagList'; events["click " + this.ui.tags] = 'onTagList';
events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag'; events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag';
events["change " + this.ui.treeLov] = 'onTreeSelect';
events['click ' + this.ui.refreshTag] = 'fetchCollections'; events['click ' + this.ui.refreshTag] = 'fetchCollections';
events["change " + this.ui.tagView] = 'tagViewToggle';
events["click " + this.ui.expandArrow] = 'toggleChild';
return events; return events;
}, },
/** /**
...@@ -59,14 +66,27 @@ define(['require', ...@@ -59,14 +66,27 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tag', 'collection', 'typeHeaders', 'value')); _.extend(this, _.pick(options, 'tag', 'collection', 'typeHeaders', 'value', 'enumDefCollection'));
this.viewType = "flat";
this.query = {
flat: {
tagName: null
},
tree: {
tagName: null
}
};
if (this.value && this.value.viewType) {
this.viewType = this.value.viewType;
}
this.query[this.viewType].tagName = this.tag;
}, },
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
this.listenTo(this.collection, "reset add remove", function() { this.listenTo(this.collection, "reset add remove", function() {
this.tagsGenerator(); this.tagsGenerator();
}, this); }, this);
this.ui.tagsParent.on('click', 'li.parent-node a', function() { this.ui.tagsList.on('click', 'li.parent-node a', function() {
that.setUrl(this.getAttribute("href")); that.setUrl(this.getAttribute("href"));
}); });
$('body').on('click', '.tagPopoverOptions li', function(e) { $('body').on('click', '.tagPopoverOptions li', function(e) {
...@@ -83,18 +103,60 @@ define(['require', ...@@ -83,18 +103,60 @@ define(['require',
this.collection.fetch({ reset: true }); this.collection.fetch({ reset: true });
this.ui.offLineSearchTag.val(""); this.ui.offLineSearchTag.val("");
}, },
manualRender: function(tagName) { manualRender: function(options) {
this.tag = tagName; this.tag = options && options.tagName;
_.extend(this.value, options);
this.query[this.viewType].tagName = this.tag;
if (options && options.viewType) {
this.viewType = options.viewType;
}
if (!this.createTag) { if (!this.createTag) {
this.setValues(true); this.setValues(true);
} }
}, },
renderTreeList: function() {
var that = this;
this.ui.treeLov.empty();
var treeStr = '<option></option>';
this.collection.fullCollection.each(function(model) {
var name = Utils.getName(model.toJSON(), 'name');
treeStr += '<option>' + (name) + '</option>';
});
that.ui.treeLov.html(treeStr);
that.ui.treeLov.select2({
placeholder: "Search tag",
allowClear: true
});
},
onTreeSelect: function() {
var name = this.ui.treeLov.val();
Utils.setUrl({
url: (name ? '#!/tag/tagAttribute/' + name : '#!/tag'),
urlParams: {
viewType: 'tree',
},
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
},
setValues: function(manual) { setValues: function(manual) {
var $firstEl = this.ui.tagsParent.find('li a') ? this.ui.tagsParent.find('li a').first() : null; var el = this.ui.tagsList;
if (this.viewType == "tree") {
el = this.ui.tagsParent;
if (!this.ui.tagView.prop("checked")) {
this.ui.tagView.prop("checked", true).trigger("change");
}
} else {
if (this.ui.tagView.prop("checked")) {
this.ui.tagView.prop("checked", false).trigger("change");
}
}
var $firstEl = el.find('li a') ? el.find('li a').first() : null;
if (Utils.getUrlState.isTagTab()) { if (Utils.getUrlState.isTagTab()) {
if (!this.tag) { if (!this.tag) {
this.selectFirst = false; this.selectFirst = false;
this.ui.tagsParent.find('li').first().addClass('active'); el.find('li').first().addClass('active');
if ($firstEl && $firstEl.length) { if ($firstEl && $firstEl.length) {
url: $firstEl.attr("href"), url: $firstEl.attr("href"),
Utils.setUrl({ Utils.setUrl({
...@@ -105,13 +167,15 @@ define(['require', ...@@ -105,13 +167,15 @@ define(['require',
} }
} else { } else {
var presentTag = this.collection.fullCollection.findWhere({ name: this.tag }), var presentTag = this.collection.fullCollection.findWhere({ name: this.tag }),
url = Utils.getUrlState.getQueryUrl().hash, url = Utils.getUrlState.getQueryUrl().queyParams[0],
tag = this.tag, tag = this.tag,
query = null; query = Utils.getUrlState.getQueryParams() || null;
if (!presentTag) { if (!presentTag) {
tag = $firstEl.data('name'); tag = $firstEl.data('name');
url = $firstEl && $firstEl.length ? $firstEl.attr("href") : '#!/tag'; url = $firstEl && $firstEl.length ? $firstEl.attr("href") : '#!/tag';
query = $firstEl && $firstEl.length ? { dlttag: true } : null if ($firstEl && $firstEl.length) {
_.extend(query, { dlttag: true })
}
} }
Utils.setUrl({ Utils.setUrl({
url: url, url: url,
...@@ -121,63 +185,177 @@ define(['require', ...@@ -121,63 +185,177 @@ define(['require',
if (!presentTag) { if (!presentTag) {
return false; return false;
} }
this.ui.tagsParent.find('li').removeClass('active'); el.find('li').removeClass('active'); // remove selected
var target = this.ui.tagsParent.find('li').filter(function() { el.find('li.parent-node').each(function() {
return $(this).text() === tag; // based on browser url select tag.
}).addClass('active'); var target = $(this);
if (this.createTag || !manual) { if (target.children('div').find('a').text() === tag) {
if (target && target.offset()) { target.addClass('active');
$('#sidebar-wrapper').animate({ target.parents('ul').addClass('show').removeClass('hide'); // Don't use toggle
scrollTop: target.offset().top - 100 if (this.createTag || !manual) {
}, 500); if (target.offset()) {
$('#sidebar-wrapper').animate({
scrollTop: target.offset().top - 100
}, 500);
}
}
return false;
} }
} });
} }
} }
}, },
tagsGenerator: function(searchString) { tagsGenerator: function(searchString) {
var str = ''; var tagParents = '',
tagLists = '';
if (this.collection && this.collection.fullCollection.length) { if (this.collection && this.collection.fullCollection.length) {
this.collection.fullCollection.comparator = function(model) { var sortedCollection = this.collection.fullCollection;
return Utils.getName(model.toJSON(), 'name').toLowerCase(); this.tagTreeList = this.getTagTreeList({ collection: sortedCollection });
if (searchString) {
if (this.viewType == "flat") {
this.ui.tagsList.empty().html(this.generateTree({ 'data': sortedCollection, 'searchString': searchString }));
} else {
this.ui.tagsParent.empty().html(this.generateTree({ 'data': this.tagTreeList, 'isTree': true, 'searchString': searchString }));
}
} else {
this.ui.tagsParent.empty().html(this.generateTree({ 'data': this.tagTreeList, 'isTree': true, 'searchString': searchString }));
this.ui.tagsList.empty().html(this.generateTree({ 'data': sortedCollection, 'searchString': searchString }));
}
this.createTagAction();
this.setValues();
this.renderTreeList();
if (this.createTag) {
this.createTag = false;
}
}
},
getTagTreeList: function(options) {
var that = this,
collection = options.collection,
listOfParents = {},
getChildren = function(options) {
var children = options.children,
data = [];
if (children && children.length) {
_.each(children, function(name) {
var child = collection.find({ 'name': name });
if (child) {
var modelJSON = child.toJSON();
data.push({
name: name,
children: getChildren({ children: modelJSON.subTypes })
});
}
});
}
return data;
}
collection.each(function(model) {
var modelJSON = model.toJSON();
if (modelJSON.superTypes.length == 0) {
var name = modelJSON.name;
listOfParents[name] = {
name: name,
children: getChildren({ children: modelJSON.subTypes })
}
}
});
return listOfParents;
},
generateTree: function(options) {
var data = options.data,
isTree = options.isTree,
searchString = options.searchString,
that = this,
element = '',
getElString = function(options) {
var name = options.name,
hasChild = isTree && options.children && options.children.length;
return '<li class="parent-node" data-id="tags">' +
'<div><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div>' +
(hasChild ? '<i class="fa toggleArrow fa-angle-right" data-id="expandArrow" data-name="' + name + '"></i>' : '') +
'<a href="#!/tag/tagAttribute/' + name + '?viewType=' + (isTree ? 'tree' : 'flat') + '" data-name="' + name + '">' + name + '</a></div>' +
(isTree && hasChild ? '<ul class="child hide">' + that.generateTree({ 'data': options.children, 'isTree': isTree }) + '</ul>' : '') + '</li>';
}; };
this.collection.fullCollection.sort().each(function(model) { if (isTree) {
var name = Utils.getName(model.toJSON(), 'name'); _.each(data, function(obj) {
element += getElString({
name: obj.name,
children: obj.children
});
});
} else {
data.each(function(obj) {
var name = obj.get('name');
if (searchString) { if (searchString) {
if (name.search(new RegExp(searchString, "i")) != -1) { if (name.search(new RegExp(searchString, "i")) != -1) {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '" >' + name + '</a></li>'; element += getElString({
name: obj.get('name'),
children: null
});
} else { } else {
return; return;
} }
} else { } else {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '">' + name + '</a></li>'; element += getElString({
name: obj.get('name'),
children: null
});
} }
});
}
return element;
},
toggleChild: function(e) {
var el = $(e.currentTarget);
if (el) {
el.parent().siblings('ul.child').toggleClass('hide show');
}
},
tagViewToggle: function(e) {
if (e.currentTarget.checked) {
this.$('.tree-view').show();
this.$('.list-view').hide();
this.viewType = "tree";
} else {
this.viewType = "flat";
this.$('.tree-view').hide();
this.$('.list-view').show();
}
if (Utils.getUrlState.isTagTab()) {
var name = this.query[this.viewType].tagName;
Utils.setUrl({
url: (name ? '#!/tag/tagAttribute/' + name : '#!/tag'),
urlParams: {
viewType: this.viewType,
},
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
}); });
this.ui.tagsParent.empty().html(str);
this.setValues();
this.createTagAction();
if (this.createTag) {
this.createTag = false;
}
} }
}, },
onClickCreateTag: function(e) { onClickCreateTag: function(e) {
var that = this; var that = this,
nodeName = e.currentTarget.nodeName;
$(e.currentTarget).attr("disabled", "true"); $(e.currentTarget).attr("disabled", "true");
require([ require([
'views/tag/CreateTagLayoutView', 'views/tag/CreateTagLayoutView',
'modules/Modal' 'modules/Modal'
], function(CreateTagLayoutView, Modal) { ], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'tagCollection': that.collection }); var name = (!(nodeName == "BUTTON") ? that.query[that.viewType].tagName : null);
var modal = new Modal({ var view = new CreateTagLayoutView({ 'tagCollection': that.collection, 'selectedTag': name, 'enumDefCollection': enumDefCollection }),
title: 'Create a new tag', modal = new Modal({
content: view, title: 'Create a new tag',
cancelText: "Cancel", content: view,
okCloses: false, cancelText: "Cancel",
okText: 'Create', okCloses: false,
allowCancel: true, okText: 'Create',
}).open(); allowCancel: true,
}).open();
modal.$el.find('button.ok').attr("disabled", "true"); modal.$el.find('button.ok').attr("disabled", "true");
view.ui.tagName.on('keyup', function(e) { view.ui.tagName.on('keyup', function(e) {
modal.$el.find('button.ok').removeAttr("disabled"); modal.$el.find('button.ok').removeAttr("disabled");
...@@ -269,7 +447,6 @@ define(['require', ...@@ -269,7 +447,6 @@ define(['require',
] ]
} }
} }
if (duplicateAttributeList.length) { if (duplicateAttributeList.length) {
if (duplicateAttributeList.length < 2) { if (duplicateAttributeList.length < 2) {
var text = "Attribute <b>" + duplicateAttributeList.join(",") + "</b> is duplicate !" var text = "Attribute <b>" + duplicateAttributeList.join(",") + "</b> is duplicate !"
...@@ -299,9 +476,21 @@ define(['require', ...@@ -299,9 +476,21 @@ define(['require',
}; };
new this.collection.model().set(this.json).save(null, { new this.collection.model().set(this.json).save(null, {
success: function(model, response) { success: function(model, response) {
var classificationDefs = model.get('classificationDefs');
that.ui.createTag.removeAttr("disabled"); that.ui.createTag.removeAttr("disabled");
that.createTag = true; that.createTag = true;
that.collection.add(model.get('classificationDefs')); if (classificationDefs[0]) {
_.each(classificationDefs[0].superTypes, function(superType) {
var superTypeModel = that.collection.fullCollection.find({ name: superType }),
subTypes = [];
if (superTypeModel) {
subTypes = superTypeModel.get('subTypes');
subTypes.push(classificationDefs[0].name);
superTypeModel.set({ 'subTypes': _.uniq(subTypes) });
}
});
}
that.collection.fullCollection.add(classificationDefs);
that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true); that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true);
Utils.notifySuccess({ Utils.notifySuccess({
content: "Tag " + that.name + Messages.addSuccessMessage content: "Tag " + that.name + Messages.addSuccessMessage
...@@ -320,8 +509,10 @@ define(['require', ...@@ -320,8 +509,10 @@ define(['require',
}); });
}, },
onTagList: function(e, toggle) { onTagList: function(e, toggle) {
this.ui.tagsParent.find('li').removeClass("active"); if (e.target.nodeName === "A") {
$(e.currentTarget).addClass("active"); $(e.currentTarget).parents('ul.tag-tree').find('li.active').removeClass("active");
$(e.currentTarget).addClass("active");
}
}, },
offlineSearchTag: function(e) { offlineSearchTag: function(e) {
var type = $(e.currentTarget).data('type'); var type = $(e.currentTarget).data('type');
...@@ -336,6 +527,7 @@ define(['require', ...@@ -336,6 +527,7 @@ define(['require',
content: function() { content: function() {
return "<ul>" + return "<ul>" +
"<li class='listTerm' ><i class='fa fa-search'></i> <a href='javascript:void(0)' data-fn='onSearchTag'>Search Tag</a></li>" + "<li class='listTerm' ><i class='fa fa-search'></i> <a href='javascript:void(0)' data-fn='onSearchTag'>Search Tag</a></li>" +
"<li class='listTerm' ><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='onClickCreateTag'>Create Sub-tag</a></li>" +
"<li class='listTerm' ><i class='fa fa-trash-o'></i> <a href='javascript:void(0)' data-fn='onDeleteTag'>Delete Tag</a></li>" + "<li class='listTerm' ><i class='fa fa-trash-o'></i> <a href='javascript:void(0)' data-fn='onDeleteTag'>Delete Tag</a></li>" +
"</ul>"; "</ul>";
} }
...@@ -343,10 +535,14 @@ define(['require', ...@@ -343,10 +535,14 @@ define(['require',
}); });
}, },
onSearchTag: function() { onSearchTag: function() {
var el = this.ui.tagsList;
if (this.viewType == "tree") {
el = this.ui.tagsParent;
}
Utils.setUrl({ Utils.setUrl({
url: '#!/search/searchResult', url: '#!/search/searchResult',
urlParams: { urlParams: {
tag: this.ui.tagsParent.find('li.active').find('>a[data-name]').data('name'), tag: el.find('li.active').find('a[data-name]').data('name'),
searchType: "basic", searchType: "basic",
dslChecked: false dslChecked: false
}, },
......
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