Commit d0beadf2 by kevalbhatt Committed by apoorvnaik

ATLAS-2020 : Result Table Column Filter : Filtering using Columns in Result…

ATLAS-2020 : Result Table Column Filter : Filtering using Columns in Result table always sets excludeDeletedEntities to True Signed-off-by: 's avatarapoorvnaik <apoorvnaik@apache.org>
parent e1a142b5
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git-wip-us.apache.org/repos/asf/atlas.git" "url": "https://git-wip-us.apache.org/repos/asf/incubator-atlas.git"
}, },
"engines": { "engines": {
"node": "4.4.x", "node": "4.4.x",
......
...@@ -69,3 +69,44 @@ ...@@ -69,3 +69,44 @@
display: none; display: none;
opacity: 0.2; opacity: 0.2;
} }
.value-loader {
height: 4px;
width: 50%;
position: relative;
overflow: hidden;
background-color: #ddd;
}
.value-loader:before {
display: block;
position: absolute;
content: "";
left: -200px;
width: 200px;
height: 4px;
background-color: #2980b9;
animation: value-loader 2s linear infinite;
}
@keyframes value-loader {
from {
left: -200px;
width: 30%;
}
50% {
width: 30%;
}
70% {
width: 70%;
}
80% {
left: 50%;
}
95% {
left: 120%;
}
to {
left: 100%;
}
}
\ No newline at end of file
...@@ -69,9 +69,15 @@ ...@@ -69,9 +69,15 @@
box-shadow: 0px 0px 4px #d8d8d8; box-shadow: 0px 0px 4px #d8d8d8;
overflow: scroll !important; overflow: scroll !important;
max-height: 500px; max-height: 500px;
} .resizeHandler {
&.grid-draggable {
.table-quickMenu>thead>tr>th { background-color: $color_jungle_green_approx !important;
}
&:hover {
border-left: 1px solid #d2d2d2;
}
}
>thead>tr>th {
border-width: thin; border-width: thin;
border-color: $color_jungle_green_approx; border-color: $color_jungle_green_approx;
border-bottom-style: solid; border-bottom-style: solid;
...@@ -80,25 +86,29 @@ ...@@ -80,25 +86,29 @@
background-color: transparent; background-color: transparent;
text-align: left; text-align: left;
font-weight: 800; font-weight: 800;
border-top: 0;
font-size: 14px; font-size: 14px;
letter-spacing: 0.25px; letter-spacing: 0.25px;
color: rgba(52, 52, 52, 1); color: rgba(52, 52, 52, 1);
} }
>tbody>tr>td {
.table-quickMenu > tbody > tr > td {
border-color: $color_gallery_approx; border-color: $color_gallery_approx;
color: #333333; color: #333333;
font-weight: 100; font-weight: 100;
padding: 10px 15px; padding: 10px 15px;
}
} }
.backgrid-paginator ul > li > a:hover, td {
.backgrid-paginator ul > .active > a, div.scroll-y {
.backgrid-paginator ul > .active > span { max-height: 200px;
background-color: #2EBC9A !important; overflow-y: auto;
color: #fff !important; }
&:hover { }
background-color: none;
.backgrid {
td {
white-space: normal;
} }
} }
...@@ -108,11 +118,25 @@ ...@@ -108,11 +118,25 @@
margin: 20px 0; margin: 20px 0;
border-radius: 4px; border-radius: 4px;
border: 1px #DDDDDD solid; border: 1px #DDDDDD solid;
} margin: 0px;
float: right;
.backgrid { border-radius: 10px;
td { overflow: hidden;
white-space: normal; >.disabled>span,
>.disabled>a {
&:hover {
cursor: not-allowed;
background-color: #7ed3be !important;
}
}
>.active>span,
>.active>a,
>li>a:hover {
background-color: #2EBC9A !important;
color: #fff !important;
&:hover {
background-color: none;
}
} }
} }
...@@ -216,21 +240,6 @@ ...@@ -216,21 +240,6 @@
} }
} }
.backgrid-paginator ul {
margin: 0px;
float: right;
border-radius: 10px;
overflow: hidden;
}
.backgrid-paginator ul > .disabled > span,
.backgrid-paginator ul > .disabled > a {
&:hover {
cursor: not-allowed;
background-color: #7ed3be !important;
}
}
.popover { .popover {
z-index: 99; z-index: 99;
} }
...@@ -248,7 +257,7 @@ ...@@ -248,7 +257,7 @@
} }
} }
.tab-content > .tab-pane.active { .tab-content>.tab-pane.active {
overflow-x: hidden; overflow-x: hidden;
} }
...@@ -267,40 +276,40 @@ ...@@ -267,40 +276,40 @@
cursor: pointer; cursor: pointer;
} }
.query-builder .rule-container .rule-value-container { .query-builder {
.rule-container .rule-value-container {
display: inline-block !important; display: inline-block !important;
} }
.rules-list>:first-child::before {
.rules-group-header .btn-group.pull-right.group-actions {
float: left !important;
}
.query-builder .rules-list>:first-child::before {
top: -8px; top: -8px;
} }
.rules-group-header .btn-group.group-conditions label {
.query-builder .rules-group-header .btn-group.group-conditions label {
display: none; display: none;
}
.rule-value-container input {
padding: 6px 12px !important;
}
} }
.query-builder .rule-value-container input {
padding: 6px 12px !important; .rules-group-header .btn-group.pull-right.group-actions {
float: left !important;
} }
div.columnmanager-visibilitycontrol { div.columnmanager-visibilitycontrol {
width: auto; width: auto;
margin-bottom: 5px; margin-bottom: 5px;
&.open .btn-atlasAction {
background-color: #37bb9b;
color: #fff;
}
} }
.columnmanager-dropdown-container > li > span.column-label { div.columnmanager-dropdown-container {
width: auto; &.open {
}
div.columnmanager-dropdown-container.open {
overflow: auto; overflow: auto;
} }
>li>span.column-label {
.columnmanager-visibilitycontrol.open .btn-atlasAction { width: auto;
background-color: #37bb9b; }
color: #fff;
} }
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* panel.scss */ /* panel.scss */
.panel-default { .panel-default {
> .panel-heading { >.panel-heading {
color: $color_jungle_green_approx; color: $color_jungle_green_approx;
background: $white; background: $white;
border-color: $color_jungle_green_approx; border-color: $color_jungle_green_approx;
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
} }
} }
.nav-tabs { .nav-tabs {
> li { >li {
&.active { &.active {
>a { >a {
color: $color_jungle_green_approx; color: $color_jungle_green_approx;
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
//overflow: hidden; //overflow: hidden;
height: calc(100% - 46px)!important; height: calc(100% - 46px)!important;
} }
.ui-resizable-handle{ .ui-resizable-handle {
display: none !important; display: none !important;
} }
} }
.nav-tabs { .nav-tabs {
...@@ -68,8 +68,9 @@ ...@@ -68,8 +68,9 @@
.with-nav-tabs { .with-nav-tabs {
.tab-content { .tab-content {
> .tab-pane.active { >.tab-pane.active {
padding: 20px 10px 0px 10px; padding: 20px 10px 0px 10px;
min-height: 50px;
} }
} }
} }
\ No newline at end of file
...@@ -53,6 +53,9 @@ define([ ...@@ -53,6 +53,9 @@ define([
'enumDefCollection': this.enumDefCollection, 'enumDefCollection': this.enumDefCollection,
'classificationDefCollection': this.classificationDefCollection 'classificationDefCollection': this.classificationDefCollection
} }
this.sharedObj = {
searchTableColumns: {}
}
}, },
bindCommonEvents: function() { bindCommonEvents: function() {
var that = this; var that = this;
...@@ -237,7 +240,7 @@ define([ ...@@ -237,7 +240,7 @@ define([
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ _.extend({
'searchVent': that.searchVent 'searchVent': that.searchVent
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists, that.sharedObj)
)); ));
} else { } else {
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
...@@ -253,7 +256,7 @@ define([ ...@@ -253,7 +256,7 @@ define([
'value': paramObj, 'value': paramObj,
'initialView': true, 'initialView': true,
'searchVent': that.searchVent 'searchVent': that.searchVent
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists, that.sharedObj)
)); ));
} else { } else {
App.rNContent.$el.html(""); App.rNContent.$el.html("");
...@@ -276,18 +279,22 @@ define([ ...@@ -276,18 +279,22 @@ define([
_.extend({ _.extend({
'value': paramObj, 'value': paramObj,
'searchVent': that.searchVent 'searchVent': that.searchVent
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists, that.sharedObj)
)); ));
} else { } else {
App.rSideNav.currentView.RSearchLayoutView.currentView.manualRender(paramObj); App.rSideNav.currentView.RSearchLayoutView.currentView.manualRender(paramObj);
} }
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
var isinitialView = true;
if (paramObj) {
isinitialView = (paramObj.type || (paramObj.dslChecked == "true" ? "" : paramObj.tag) || (paramObj.query ? paramObj.query.trim() : "")).length === 0;
}
App.rNContent.show(new SearchDetailLayoutView( App.rNContent.show(new SearchDetailLayoutView(
_.extend({ _.extend({
'value': paramObj, 'value': paramObj,
'searchVent': that.searchVent, 'searchVent': that.searchVent,
'initialView': (paramObj.type || (paramObj.dslChecked == "true" ? "" : paramObj.tag) || (paramObj.query ? paramObj.query.trim() : "")).length === 0 'initialView': isinitialView,
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists, that.sharedObj)
)); ));
}); });
}, },
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</div> </div>
<div class="position-relative thick-border"> <div class="position-relative thick-border">
<div data-id="r_tableList" class="table-responsive tableBorder"> </div> <div data-id="r_tableList" class="table-responsive tableBorder"> </div>
<div data-id="r_tableSpinner" class="fontLoader"> <div data-id="r_tableSpinner" class="fontLoader for-ignore">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
</div> </div>
</div> </div>
......
...@@ -82,46 +82,46 @@ ...@@ -82,46 +82,46 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<ul class="nav nav-tabs "> <ul class="nav nav-tabs ">
<li role="presentation" 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="presentation"><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>
{{#if taxonomy}} {{#if taxonomy}}
<li role="presentation"><a href="#tab-termTable" aria-controls="tab-termTable" role="tab" data-toggle="tab">Terms</a></li> <li role="terms"><a href="#tab-termTable" aria-controls="tab-termTable" role="tab" data-toggle="tab">Terms</a></li>
{{/if}} {{/if}}
<li role="presentation" class="tab"><a href="#tab-audit" aria-controls="tab-audit" role="tab" data-toggle="tab">Audits</a></li> <li role="audits" class="tab"><a href="#tab-audit" aria-controls="tab-audit" role="tab" data-toggle="tab">Audits</a></li>
<li role="presentation" class="tab schemaTable" style="display:none"><a href="#tab-schema" aria-controls="tab-schema" role="tab" data-toggle="tab">Schema</a></li> <li role="schema" class="tab schemaTable" style="display:none"><a href="#tab-schema" aria-controls="tab-schema" role="tab" data-toggle="tab">Schema</a></li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="tab-content"> <div class="tab-content">
<div id="tab-details" role="tabpanel" class="tab-pane active"> <div id="tab-details" role="properties" class="tab-pane active">
<div id="r_entityDetailTableLayoutView" style="position: relative;"> <div id="r_entityDetailTableLayoutView" style="position: relative;">
<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> </div>
</div> </div>
<div id="tab-tagTable" role="tabpanel" class="tab-pane fade"> <div id="tab-tagTable" role="tags" class="tab-pane fade">
<div id="r_tagTableLayoutView" style="position: relative;"> <div id="r_tagTableLayoutView" style="position: relative;">
<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> </div>
</div> </div>
<div id="tab-termTable" role="tabpanel" class="tab-pane"> <div id="tab-termTable" role="terms" class="tab-pane">
<div id="r_termTableLayoutView" style="position: relative;"> <div id="r_termTableLayoutView" style="position: relative;">
<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> </div>
</div> </div>
<div id="tab-audit" role="tabpanel" class="tab-pane"> <div id="tab-audit" role="audits" class="tab-pane">
<div id="r_auditTableLayoutView" style="position: relative;"> <div id="r_auditTableLayoutView" style="position: relative;">
<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> </div>
</div> </div>
<div id="tab-schema" role="tabpanel" class="tab-pane"> <div id="tab-schema" role="schema" class="tab-pane">
<div id="r_schemaTableLayoutView" style="position: relative;"> <div id="r_schemaTableLayoutView" style="position: relative;">
<div class="fontLoader"> <div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class=""> <div class="">
<div class="tableOverlay"></div> <div class="tableOverlay"></div>
<!-- Not for table Loader its only for initial loading --> <!-- Not for table Loader its only for initial loading -->
<div class="fontLoader"> <div class="fontLoader" style="z-index:999">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
</div> </div>
<div class="ellipsis" style="display: none;"><span class="searchResult" style=" font-size: 16px;"></span> <div class="ellipsis" style="display: none;"><span class="searchResult" style=" font-size: 16px;"></span>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
<div class="searchTable"> <div class="searchTable">
<div data-id="containerCheckBox" style="display: none;"> <div data-id="containerCheckBox" style="display: none;">
<input type="checkbox" id="inputLabel" class="checkbox-inline" name="queryType" value="text" name="check" value="1" data-id="checkDeletedEntity" /> <input type="checkbox" id="inputLabel" class="checkbox-inline" name="queryType" name="check" data-id="checkDeletedEntity" />
<label class="checkbox-inline" for="inputLabel"> <label class="checkbox-inline" for="inputLabel">
<b>Include historical entities</b></label> <b>Include historical entities</b></label>
</div> </div>
...@@ -53,3 +53,6 @@ ...@@ -53,3 +53,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="text-center" data-id="columnEmptyInfo" style="display: none;">
<h4>Please select one/more column to see the data</h4>
</div>
\ No newline at end of file
...@@ -170,7 +170,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -170,7 +170,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
var fetch = true; var fetch = true;
var fetchId = (_.isObject(id) ? id.id : id); var fetchId = (_.isObject(id) ? id.id : id);
fetchInputOutputValue(fetchId); fetchInputOutputValue(fetchId);
tempLink += '<div data-id="' + fetchId + '"></div>'; tempLink += '<div data-id="' + fetchId + '"><div class="value-loader"></div></div>';
} else { } else {
tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>' tempLink += '<a href="#!/detailPage/' + id + '">' + name + '</a>'
} }
...@@ -214,7 +214,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -214,7 +214,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
} }
} }
if (isTable) { if (isTable) {
table += '<tr><td>' + _.escape(key) + '</td><td>' + (_.isObject(valueObject[key]) ? keyValue : _.escape(keyValue)) + '</td></tr>'; table += '<tr><td>' + _.escape(key) + '</td><td><div ' + (_.isObject(valueObject[key]) ? 'class="scroll-y"' : '') + '>' + (_.isObject(valueObject[key]) ? keyValue : _.escape(keyValue)) + '</div></td></tr>';
} else { } else {
table += '<div>' + (_.isObject(valueObject[key]) ? keyValue : _.escape(keyValue)) + '</div>'; table += '<div>' + (_.isObject(valueObject[key]) ? keyValue : _.escape(keyValue)) + '</div>';
} }
......
...@@ -131,6 +131,8 @@ define(['require', ...@@ -131,6 +131,8 @@ define(['require',
includeOverlayLoader: false, includeOverlayLoader: false,
includeTableLoader: true,
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -146,7 +148,7 @@ define(['require', ...@@ -146,7 +148,7 @@ define(['require',
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'collection', 'columns', 'includePagination', _.extend(this, _.pick(options, 'collection', 'columns', 'includePagination',
'includeHeaderSearch', 'includeFilter', 'includePageSize', 'includeHeaderSearch', 'includeFilter', 'includePageSize',
'includeFooterRecords', 'includeColumnManager', 'includeSizeAbleColumns', 'includeOrderAbleColumns', 'includeOverlayLoader')); 'includeFooterRecords', 'includeColumnManager', 'includeSizeAbleColumns', 'includeOrderAbleColumns', 'includeOverlayLoader', 'includeTableLoader'));
_.extend(this.gridOpts, options.gridOpts, { collection: this.collection, columns: this.columns }); _.extend(this.gridOpts, options.gridOpts, { collection: this.collection, columns: this.columns });
_.extend(this.filterOpts, options.filterOpts); _.extend(this.filterOpts, options.filterOpts);
...@@ -160,14 +162,20 @@ define(['require', ...@@ -160,14 +162,20 @@ define(['require',
/** all events binding here */ /** all events binding here */
bindEvents: function() { bindEvents: function() {
this.listenTo(this.collection, 'request', function() { this.listenTo(this.collection, 'request', function() {
if (this.includeTableLoader) {
this.$('div[data-id="r_tableSpinner"]').addClass('show'); this.$('div[data-id="r_tableSpinner"]').addClass('show');
}
if (this.includeOverlayLoader) { if (this.includeOverlayLoader) {
this.$('.t_tableOverlay').addClass('fontLoader');
this.$('.t_tableOverlay').show(); this.$('.t_tableOverlay').show();
} }
}, this); }, this);
this.listenTo(this.collection, 'sync error', function() { this.listenTo(this.collection, 'sync error', function() {
if (this.includeTableLoader) {
this.$('div[data-id="r_tableSpinner"]').removeClass('show'); this.$('div[data-id="r_tableSpinner"]').removeClass('show');
}
if (this.includeOverlayLoader) { if (this.includeOverlayLoader) {
this.$('.t_tableOverlay').removeClass('fontLoader');
this.$('.t_tableOverlay').hide(); this.$('.t_tableOverlay').hide();
} }
}, this); }, this);
......
...@@ -45,8 +45,25 @@ define(['require', ...@@ -45,8 +45,25 @@ define(['require',
that = this; that = this;
events["click " + this.ui.tabs] = function(e) { events["click " + this.ui.tabs] = function(e) {
var urlString = "", var urlString = "",
elementName = $(e.currentTarget).data(); elementName = $(e.currentTarget).data(),
var tabStateUrls = Globals.saveApplicationState.tabState; tabStateUrls = Globals.saveApplicationState.tabState,
urlStateObj = Utils.getUrlState,
hashUrl = Utils.getUrlState.getQueryUrl().hash;
if (urlStateObj.isTagTab()) {
if (hashUrl != tabStateUrls.tagUrl) {
Globals.saveApplicationState.tabState.tagUrl = hashUrl;
}
} else if (urlStateObj.isSearchTab()) {
if (hashUrl != tabStateUrls.searchUrl) {
Globals.saveApplicationState.tabState.searchUrl = hashUrl;
}
} else if (urlStateObj.isTaxonomyTab()) {
if (hashUrl != tabStateUrls.taxonomyUrl) {
Globals.saveApplicationState.tabState.isTaxonomyTab = hashUrl;
}
}
if (elementName.name == "tab-tag") { if (elementName.name == "tab-tag") {
urlString = tabStateUrls.tagUrl; //'#!/tag'; urlString = tabStateUrls.tagUrl; //'#!/tag';
} else if (elementName.name == "tab-taxonomy") { } else if (elementName.name == "tab-taxonomy") {
...@@ -66,7 +83,7 @@ define(['require', ...@@ -66,7 +83,7 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection')); _.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'searchTableColumns'));
if (Globals.taxonomy) { if (Globals.taxonomy) {
this.tabClass = "tab col-sm-4"; this.tabClass = "tab col-sm-4";
} else { } else {
...@@ -110,7 +127,8 @@ define(['require', ...@@ -110,7 +127,8 @@ define(['require',
typeHeaders: that.typeHeaders, typeHeaders: that.typeHeaders,
entityDefCollection: that.entityDefCollection, entityDefCollection: that.entityDefCollection,
enumDefCollection: that.enumDefCollection, enumDefCollection: that.enumDefCollection,
classificationDefCollection: that.classificationDefCollection classificationDefCollection: that.classificationDefCollection,
searchTableColumns: that.searchTableColumns
})); }));
}); });
}, },
......
...@@ -53,7 +53,7 @@ define(['require', ...@@ -53,7 +53,7 @@ define(['require',
var VCommonModel = new VCommon(); var VCommonModel = new VCommon();
VCommonModel.aboutUs(url, { VCommonModel.aboutUs(url, {
success: function(data) { success: function(data) {
var str = "<b>Version : </b>" + data.Version; var str = "<b>Version : </b>" + _.escape(data.Version);
that.ui.atlasVersion.html(str); that.ui.atlasVersion.html(str);
}, },
complete: function() {} complete: function() {}
......
...@@ -112,6 +112,9 @@ define(['require', ...@@ -112,6 +112,9 @@ define(['require',
this.listenTo(this.collection, 'reset', function() { this.listenTo(this.collection, 'reset', function() {
this.entityObject = this.collection.first().toJSON(); this.entityObject = this.collection.first().toJSON();
var collectionJSON = this.entityObject.entity; var collectionJSON = this.entityObject.entity;
// MergerRefEntity.
Utils.findAndMergeRefEntity(collectionJSON.attributes, this.entityObject.referredEntities);
if (collectionJSON && collectionJSON.guid) { if (collectionJSON && collectionJSON.guid) {
var tagGuid = collectionJSON.guid; var tagGuid = collectionJSON.guid;
this.readOnly = Enums.entityStateReadOnly[collectionJSON.status]; this.readOnly = Enums.entityStateReadOnly[collectionJSON.status];
...@@ -162,20 +165,29 @@ define(['require', ...@@ -162,20 +165,29 @@ define(['require',
this.ui.editButton.show(); this.ui.editButton.show();
} }
} }
if (collectionJSON.attributes && collectionJSON.attributes.columns) {
var valueSorted = _.sortBy(collectionJSON.attributes.columns, function(val) {
return val.attributes.position
});
collectionJSON.attributes.columns = valueSorted;
}
} }
this.hideLoader(); this.hideLoader();
var obj = { var obj = {
entity: collectionJSON, entity: collectionJSON,
referredEntities: this.entityObject.referredEntities,
guid: this.id, guid: this.id,
entityName: this.name, entityName: this.name,
typeHeaders: this.typeHeaders, typeHeaders: this.typeHeaders,
entityDefCollection: this.entityDefCollection, entityDefCollection: this.entityDefCollection,
fetchCollection: this.fetchCollection.bind(that), fetchCollection: this.fetchCollection.bind(that),
enumDefCollection: this.enumDefCollection, enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection classificationDefCollection: this.classificationDefCollection,
attributeDefs: (function() {
return that.getEntityDef(collectionJSON);
})()
} }
this.getEntityDef(obj); this.renderEntityDetailTableLayoutView(obj);
this.renderAuditTableLayoutView(obj);
this.renderTagTableLayoutView(obj); this.renderTagTableLayoutView(obj);
this.renderTermTableLayoutView(_.extend({}, obj, { term: true })); this.renderTermTableLayoutView(_.extend({}, obj, { term: true }));
// To render Schema check attribute "schemaElementsAttribute" // To render Schema check attribute "schemaElementsAttribute"
...@@ -241,16 +253,14 @@ define(['require', ...@@ -241,16 +253,14 @@ define(['require',
fetchCollection: function() { fetchCollection: function() {
this.collection.fetch({ reset: true }); this.collection.fetch({ reset: true });
}, },
getEntityDef: function(obj) { getEntityDef: function(entityObj) {
var data = this.entityDefCollection.fullCollection.findWhere({ name: obj.entity.typeName }).toJSON(); var data = this.entityDefCollection.fullCollection.findWhere({ name: entityObj.typeName }).toJSON();
var attributeDefs = Utils.getNestedSuperTypeObj({ var attributeDefs = Utils.getNestedSuperTypeObj({
data: data, data: data,
attrMerge: true, attrMerge: true,
collection: this.entityDefCollection collection: this.entityDefCollection
}); });
obj['attributeDefs'] = attributeDefs; return attributeDefs;
this.renderEntityDetailTableLayoutView(obj);
this.renderAuditTableLayoutView(obj);
}, },
onClickTagCross: function(e) { onClickTagCross: function(e) {
var tagName = $(e.currentTarget).parent().text(), var tagName = $(e.currentTarget).parent().text(),
......
...@@ -20,9 +20,8 @@ define(['require', ...@@ -20,9 +20,8 @@ define(['require',
'backbone', 'backbone',
'hbs!tmpl/entity/EntityDetailTableLayoutView_tmpl', 'hbs!tmpl/entity/EntityDetailTableLayoutView_tmpl',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'models/VEntity', 'models/VEntity'
'utils/Utils' ], function(require, Backbone, EntityDetailTableLayoutView_tmpl, CommonViewFunction, VEntity) {
], function(require, Backbone, EntityDetailTableLayoutView_tmpl, CommonViewFunction, VEntity, Utils) {
'use strict'; 'use strict';
var EntityDetailTableLayoutView = Backbone.Marionette.LayoutView.extend( var EntityDetailTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -49,7 +48,7 @@ define(['require', ...@@ -49,7 +48,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'referredEntities', 'typeHeaders', 'attributeDefs')); _.extend(this, _.pick(options, 'entity', 'typeHeaders', 'attributeDefs', 'attributes'));
this.entityModel = new VEntity({}); this.entityModel = new VEntity({});
}, },
bindEvents: function() {}, bindEvents: function() {},
...@@ -57,17 +56,8 @@ define(['require', ...@@ -57,17 +56,8 @@ define(['require',
this.entityTableGenerate(); this.entityTableGenerate();
}, },
entityTableGenerate: function() { entityTableGenerate: function() {
var that = this, var table = CommonViewFunction.propertyTable({ scope: this, valueObject: this.entity.attributes, attributeDefs: this.attributeDefs });
attributeObject = this.entity.attributes; this.ui.detailValue.append(table);
Utils.findAndMergeRefEntity(attributeObject, that.referredEntities);
if (attributeObject && attributeObject.columns) {
var valueSorted = _.sortBy(attributeObject.columns, function(val) {
return val.attributes.position
});
attributeObject.columns = valueSorted;
}
var table = CommonViewFunction.propertyTable({ scope: this, valueObject: attributeObject, attributeDefs: this.attributeDefs });
that.ui.detailValue.append(table);
} }
}); });
return EntityDetailTableLayoutView; return EntityDetailTableLayoutView;
......
...@@ -94,7 +94,7 @@ define(['require', ...@@ -94,7 +94,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entityDefCollection', 'attribute', 'referredEntities', 'fetchCollection', 'enumDefCollection')); _.extend(this, _.pick(options, 'guid', 'entityDefCollection', 'attribute', 'fetchCollection', 'enumDefCollection'));
this.schemaCollection = new VSchemaList([], {}); this.schemaCollection = new VSchemaList([], {});
this.commonTableOptions = { this.commonTableOptions = {
collection: this.schemaCollection, collection: this.schemaCollection,
...@@ -166,15 +166,11 @@ define(['require', ...@@ -166,15 +166,11 @@ define(['require',
} }
} }
_.each(this.attribute, function(obj) { _.each(this.attribute, function(obj) {
newModel = that.referredEntities[obj.guid]; if (!Enums.entityStateReadOnly[obj.status]) {
if (newModel.attributes['position']) { that.activeObj.push(obj);
newModel['position'] = newModel.attributes['position']; that.schemaCollection.push(obj);
} } else if (Enums.entityStateReadOnly[obj.status]) {
if (!Enums.entityStateReadOnly[newModel.status]) { that.deleteObj.push(obj);
that.activeObj.push(newModel);
that.schemaCollection.push(newModel);
} else if (Enums.entityStateReadOnly[newModel.status]) {
that.deleteObj.push(newModel);
} }
}); });
$('body').click(function(e) { $('body').click(function(e) {
......
...@@ -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')); _.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'searchTableColumns'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -51,19 +51,9 @@ define(['require', ...@@ -51,19 +51,9 @@ define(['require',
}, },
renderSearchResultLayoutView: function() { renderSearchResultLayoutView: function() {
var that = this; var that = this;
require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) { require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) {
if (that.RSearchResultLayoutView) { if (that.RSearchResultLayoutView) {
that.RSearchResultLayoutView.show(new SearchResultLayoutView({ that.RSearchResultLayoutView.show(new SearchResultLayoutView(that.options));
value: that.value,
tag: that.tag,
initialView: that.initialView,
entityDefCollection: that.entityDefCollection,
typeHeaders: that.typeHeaders,
searchVent: that.searchVent,
enumDefCollection: that.enumDefCollection
}));
} }
}); });
} }
......
...@@ -81,7 +81,7 @@ define(['require', ...@@ -81,7 +81,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection')); _.extend(this, _.pick(options, 'value', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'searchTableColumns'));
this.type = "basic"; this.type = "basic";
var param = Utils.getUrlState.getQueryParams(); var param = Utils.getUrlState.getQueryParams();
this.query = { this.query = {
...@@ -94,7 +94,8 @@ define(['require', ...@@ -94,7 +94,8 @@ define(['require',
type: null, type: null,
typeFilter: null, typeFilter: null,
tagFilter: null, tagFilter: null,
tag: null tag: null,
attributes: null
} }
}; };
if (!this.value) { if (!this.value) {
...@@ -244,7 +245,8 @@ define(['require', ...@@ -244,7 +245,8 @@ define(['require',
type: null, type: null,
tag: null, tag: null,
entityFilters: null, entityFilters: null,
tagFilters: null tagFilters: null,
attributes: null
}), param); }), param);
}, },
fetchCollection: function(value) { fetchCollection: function(value) {
...@@ -389,9 +391,9 @@ define(['require', ...@@ -389,9 +391,9 @@ define(['require',
if (this.dsl) { if (this.dsl) {
params['attributes'] = null; params['attributes'] = null;
} else { } else {
var columnList = JSON.parse(Utils.localStorage.getValue('columnList')); var columnList = this.value && this.value.type && this.searchTableColumns ? this.searchTableColumns[this.value.type] : null;
if (columnList) { if (columnList) {
params['attributes'] = columnList[this.query[this.type].type]; params['attributes'] = columnList.join(',');
} else { } else {
params['attributes'] = null; params['attributes'] = null;
} }
...@@ -408,7 +410,7 @@ define(['require', ...@@ -408,7 +410,7 @@ define(['require',
}); });
}, },
dslFulltextToggle: function(e) { dslFulltextToggle: function(e) {
var paramQuery = ""; var paramObj = Utils.getUrlState.getQueryParams();
if (e.currentTarget.checked) { if (e.currentTarget.checked) {
this.type = "dsl"; this.type = "dsl";
this.dsl = true; this.dsl = true;
...@@ -422,8 +424,11 @@ define(['require', ...@@ -422,8 +424,11 @@ define(['require',
this.dsl = false; this.dsl = false;
this.type = "basic"; this.type = "basic";
} }
if (Utils.getUrlState.getQueryParams() && this.type == Utils.getUrlState.getQueryParams().searchType) { if (paramObj && this.type == paramObj.searchType) {
this.updateQueryObject(Utils.getUrlState.getQueryParams()); this.updateQueryObject(paramObj);
}
if (this.type == "basic") {
this.query[this.type].attribute = paramObj.attributes ? paramObj.attributes : null;
} }
Utils.setUrl({ Utils.setUrl({
url: '#!/search/searchResult', url: '#!/search/searchResult',
......
...@@ -62,7 +62,8 @@ define(['require', ...@@ -62,7 +62,8 @@ define(['require',
editEntityButton: "[data-id='editEntityButton']", editEntityButton: "[data-id='editEntityButton']",
createEntity: "[data-id='createEntity']", createEntity: "[data-id='createEntity']",
checkDeletedEntity: "[data-id='checkDeletedEntity']", checkDeletedEntity: "[data-id='checkDeletedEntity']",
containerCheckBox: "[data-id='containerCheckBox']" containerCheckBox: "[data-id='containerCheckBox']",
columnEmptyInfo: "[data-id='columnEmptyInfo']"
}, },
templateHelpers: function() { templateHelpers: function() {
return { return {
...@@ -127,20 +128,20 @@ define(['require', ...@@ -127,20 +128,20 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection')); _.extend(this, _.pick(options, 'value', 'initialView', '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.columnToShow = this.value && this.value.attributes ? this.value.attributes.split(',') : [];
this.commonTableOptions = { this.commonTableOptions = {
collection: this.searchCollection, collection: this.searchCollection,
includePagination: false, includePagination: false,
includeFooterRecords: false, includeFooterRecords: false,
includeColumnManager: (this.value && this.value.searchType === "basic" ? true : false), includeColumnManager: (Utils.getUrlState.isSearchTab() && this.value && this.value.searchType === "basic" ? true : false),
includeOrderAbleColumns: true, includeOrderAbleColumns: false,
includeSizeAbleColumns: true, includeSizeAbleColumns: false,
includeTableLoader: false,
columnOpts: { columnOpts: {
opts: { opts: {
initialColumnsVisible: null, initialColumnsVisible: null,
...@@ -216,20 +217,29 @@ define(['require', ...@@ -216,20 +217,29 @@ define(['require',
this.listenTo(this.searchCollection, "state-changed", function(state) { this.listenTo(this.searchCollection, "state-changed", function(state) {
if (Utils.getUrlState.isSearchTab()) { if (Utils.getUrlState.isSearchTab()) {
this.updateColumnList(state); this.updateColumnList(state);
var columnList = JSON.parse(Utils.localStorage.getValue('columnList')); var excludeDefaultColumn = [];
if (!columnList && this.value.type) { if (this.value && this.value.type) {
columnList = {}; excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "terms");
columnList[this.value.type] = this.value.attributes; if (this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show();
} else { } else {
columnList[this.value.type] = this.value.attributes; this.ui.columnEmptyInfo.hide();
} }
Utils.localStorage.setValue('columnList', JSON.stringify(columnList)); }
Utils.setUrl({ Utils.setUrl({
url: '#!/search/searchResult', url: '#!/search/searchResult',
urlParams: this.value, urlParams: this.value,
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true trigger: false,
updateTabState: function() {
return { searchUrl: this.url, stateChanged: true };
}
}); });
if (excludeDefaultColumn.length > this.searchCollection.filterObj.attributes.length) {
this.fetchCollection(this.value);
}
} }
}, this); }, this);
this.listenTo(this.searchVent, "search:refresh", function(model, response) { this.listenTo(this.searchVent, "search:refresh", function(model, response) {
...@@ -242,6 +252,9 @@ define(['require', ...@@ -242,6 +252,9 @@ define(['require',
that = this; that = this;
if (this.value) { if (this.value) {
value = this.value; value = this.value;
if (value && value.includeDE) {
this.ui.checkDeletedEntity.prop('checked', true);
}
} else { } else {
value = { value = {
'query': null, 'query': null,
...@@ -249,6 +262,11 @@ define(['require', ...@@ -249,6 +262,11 @@ define(['require',
}; };
} }
this.updateColumnList(); this.updateColumnList();
if (this.value && this.searchTableColumns && this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show();
} else {
this.ui.columnEmptyInfo.hide();
}
this.fetchCollection(value); this.fetchCollection(value);
$('body').click(function(e) { $('body').click(function(e) {
var iconEvnt = e.target.nodeName; var iconEvnt = e.target.nodeName;
...@@ -267,7 +285,7 @@ define(['require', ...@@ -267,7 +285,7 @@ define(['require',
}, },
updateColumnList: function(updatedList) { updateColumnList: function(updatedList) {
if (updatedList) { if (updatedList) {
var listOfColumns = [] var listOfColumns = [];
_.map(updatedList, function(obj) { _.map(updatedList, function(obj) {
var key = obj.name; var key = obj.name;
if (obj.renderable) { if (obj.renderable) {
...@@ -276,8 +294,12 @@ define(['require', ...@@ -276,8 +294,12 @@ define(['require',
}); });
listOfColumns = _.sortBy(listOfColumns); listOfColumns = _.sortBy(listOfColumns);
this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null; this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null;
if (this.value && this.searchTableColumns) {
this.searchTableColumns[this.value.type] = listOfColumns.length ? listOfColumns : null;
}
} else if (this.value && this.value.type && this.searchTableColumns && this.value.attributes) {
this.searchTableColumns[this.value.type] = this.value.attributes.split(",");
} }
this.columnToShow = this.value && this.value.attributes ? this.value.attributes.split(',') : [];
}, },
generateQueryOfFilter: function() { generateQueryOfFilter: function() {
var value = this.value, var value = this.value,
...@@ -287,26 +309,26 @@ define(['require', ...@@ -287,26 +309,26 @@ define(['require',
objToString = function(filterObj) { objToString = function(filterObj) {
var tempObj = []; var tempObj = [];
_.each(filterObj, function(obj) { _.each(filterObj, function(obj) {
tempObj.push('<span class="key">' + obj.id + '</span>&nbsp<span class="operator">' + obj.operator + '</span>&nbsp<span class="value">' + obj.value + "</span>") tempObj.push('<span class="key">' + _.escape(obj.id) + '</span>&nbsp<span class="operator">' + _.escape(obj.operator) + '</span>&nbsp<span class="value">' + _.escape(obj.value) + "</span>")
}); });
return tempObj.join('&nbsp<span class="operator">AND</span>&nbsp'); return tempObj.join('&nbsp<span class="operator">AND</span>&nbsp');
} }
if (value.type) { if (value.type) {
var typeKeyValue = '<span class="key">Type:</span>&nbsp<span class="value">' + value.type + '</span>'; var typeKeyValue = '<span class="key">Type:</span>&nbsp<span class="value">' + _.escape(value.type) + '</span>';
if (entityFilters) { if (entityFilters) {
typeKeyValue += '&nbsp<span class="operator">AND</span>&nbsp' + objToString(entityFilters); typeKeyValue += '&nbsp<span class="operator">AND</span>&nbsp' + objToString(entityFilters);
} }
queryArray.push(typeKeyValue) queryArray.push(typeKeyValue)
} }
if (value.tag) { if (value.tag) {
var tagKeyValue = '<span class="key">Tag:</span>&nbsp<span class="value">' + value.tag + '</span>'; var tagKeyValue = '<span class="key">Tag:</span>&nbsp<span class="value">' + _.escape(value.tag) + '</span>';
if (tagFilters) { if (tagFilters) {
tagKeyValue += '&nbsp<span class="operator">AND</span>&nbsp' + objToString(tagFilters); tagKeyValue += '&nbsp<span class="operator">AND</span>&nbsp' + objToString(tagFilters);
} }
queryArray.push(tagKeyValue); queryArray.push(tagKeyValue);
} }
if (value.query) { if (value.query) {
queryArray.push('<span class="key">Query:</span>&nbsp<span class="value">' + value.query + '</span>&nbsp'); queryArray.push('<span class="key">Query:</span>&nbsp<span class="value">' + _.escape(value.query) + '</span>&nbsp');
} }
if (queryArray.length == 1) { if (queryArray.length == 1) {
return queryArray.join(); return queryArray.join();
...@@ -319,33 +341,38 @@ define(['require', ...@@ -319,33 +341,38 @@ define(['require',
var that = this, var that = this,
isPostMethod = this.value.searchType === "basic" && Utils.getUrlState.isSearchTab(), isPostMethod = this.value.searchType === "basic" && Utils.getUrlState.isSearchTab(),
tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters), tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters),
entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters), entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters);
if (isPostMethod) {
var excludeDefaultColumn = this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "terms") : null,
filterObj = { filterObj = {
'entityFilters': entityFilters, 'entityFilters': entityFilters,
'tagFilters': tagFilters, 'tagFilters': tagFilters,
'attributes': this.columnToShow.length ? _.without(this.columnToShow, "selected", "name", "description", "typeName", "owner", "tag", "terms") : null 'attributes': excludeDefaultColumn ? excludeDefaultColumn : null
};
} }
this.showLoader(); this.showLoader();
if (Globals.searchApiCallRef && Globals.searchApiCallRef.readyState === 1) { if (Globals.searchApiCallRef && Globals.searchApiCallRef.readyState === 1) {
Globals.searchApiCallRef.abort(); Globals.searchApiCallRef.abort();
} }
var apiObj = { var apiObj = {
skipDefaultError: true, skipDefaultError: true,
sort: false,
success: function(model, response) { success: function(model, response) {
Globals.searchApiCallRef = undefined; Globals.searchApiCallRef = undefined;
if (!(that.ui.pageRecordText instanceof jQuery)) { if (!(that.ui.pageRecordText instanceof jQuery)) {
return; return;
} }
if (isPostMethod) { if (!model.entities && that.offset > that.limit) {
that.searchCollection.referredEntities = model.referredEntities;
that.searchCollection.reset(model.entities);
}
if (that.searchCollection.models.length === 0 && that.offset > that.limit) {
that.ui.nextData.attr('disabled', true); that.ui.nextData.attr('disabled', true);
that.offset = that.offset - that.limit; that.offset = that.offset - that.limit;
that.hideLoader(); that.hideLoader();
return; return;
} }
if (isPostMethod) {
that.searchCollection.referredEntities = model.referredEntities;
that.searchCollection.reset(model.entities);
}
if (that.searchCollection.models.length < that.limit) { if (that.searchCollection.models.length < that.limit) {
that.ui.nextData.attr('disabled', true); that.ui.nextData.attr('disabled', true);
} else { } else {
...@@ -367,38 +394,28 @@ define(['require', ...@@ -367,38 +394,28 @@ define(['require',
that.ui.previousData.attr('disabled', true); that.ui.previousData.attr('disabled', true);
} }
that.renderTableLayoutView(); that.renderTableLayoutView();
var resultArr = [];
if (that.searchCollection.queryParams.typeName) {
resultArr.push(that.searchCollection.queryParams.typeName)
}
if (that.searchCollection.queryParams.classification) {
resultArr.push(that.searchCollection.queryParams.classification)
}
if (that.searchCollection.queryParams.query) {
resultArr.push(that.searchCollection.queryParams.query)
}
var searchString = 'Results for: <span class="filterQuery">' + that.generateQueryOfFilter() + "</span>"; var searchString = 'Results for: <span class="filterQuery">' + that.generateQueryOfFilter() + "</span>";
if (Globals.entityCreate && Globals.entityTypeConfList && Utils.getUrlState.isSearchTab()) { if (Globals.entityCreate && Globals.entityTypeConfList && Utils.getUrlState.isSearchTab()) {
searchString += "<p>If you do not find the entity in search result below then you can" + '<a href="javascript:void(0)" data-id="createEntity"> create new entity</a></p>'; searchString += "<p>If you do not find the entity in search result below then you can" + '<a href="javascript:void(0)" data-id="createEntity"> create new entity</a></p>';
} }
that.$('.searchResult').html(searchString); that.$('.searchResult').html(searchString);
}, },
silent: true, silent: true,
reset: true reset: true
} }
if (value) { if (value) {
$.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: true }); $.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: (value.includeDE ? false : true) });
if (value.searchType) { if (value.searchType) {
this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType); this.searchCollection.url = UrlLinks.searchApiUrl(value.searchType);
} }
_.extend(this.searchCollection.queryParams, { 'query': (value.query ? value.query.trim() : null), 'typeName': value.type || null, 'classification': value.tag || null }); _.extend(this.searchCollection.queryParams, { 'query': (value.query ? value.query.trim() : null), 'typeName': value.type || null, 'classification': value.tag || null });
if (isPostMethod) { if (isPostMethod) {
this.searchCollection.filterObj = _.extend({}, filterObj);
apiObj['data'] = _.extend({}, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification')) apiObj['data'] = _.extend({}, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification'))
Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj); Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj);
} else { } else {
apiObj.data = null; apiObj.data = null;
this.searchCollection.filterObj = null;
Globals.searchApiCallRef = this.searchCollection.fetch(apiObj); Globals.searchApiCallRef = this.searchCollection.fetch(apiObj);
} }
} else { } else {
...@@ -421,9 +438,9 @@ define(['require', ...@@ -421,9 +438,9 @@ define(['require',
}); });
}, },
renderTableLayoutView: function(col) { renderTableLayoutView: function(col) {
var that = this, var that = this;
count = 5;
require(['utils/TableLayout'], function(TableLayout) { require(['utils/TableLayout'], function(TableLayout) {
// displayOrder added for column manager
var columnCollection = Backgrid.Columns.extend({ var columnCollection = Backgrid.Columns.extend({
sortKey: "displayOrder", sortKey: "displayOrder",
comparator: function(item) { comparator: function(item) {
...@@ -438,7 +455,6 @@ define(['require', ...@@ -438,7 +455,6 @@ define(['require',
}); });
var columns = new columnCollection(that.getFixedDslColumn()); var columns = new columnCollection(that.getFixedDslColumn());
columns.setPositions().sort(); columns.setPositions().sort();
//var columns = new Backgrid.Columns(that.getFixedDslColumn());
that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, { that.REntityTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
columns: columns columns: columns
}))); })));
...@@ -470,14 +486,18 @@ define(['require', ...@@ -470,14 +486,18 @@ define(['require',
getFixedDslColumn: function() { getFixedDslColumn: function() {
var that = this, var that = this,
nameCheck = 0, nameCheck = 0,
columnToShow = null,
col = {}; col = {};
if (this.value && this.searchTableColumns && (this.searchTableColumns[this.value.type] !== undefined)) {
columnToShow = this.searchTableColumns[this.value.type] == null ? [] : this.searchTableColumns[this.value.type];
}
col['Check'] = { col['Check'] = {
name: "selected", name: "selected",
label: "Select", label: "Select",
cell: "select-row", cell: "select-row",
resizeable: false, resizeable: false,
orderable: false, orderable: false,
renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'selected') : true), renderable: (columnToShow ? _.contains(columnToShow, 'selected') : true),
headerCell: "select-all" headerCell: "select-all"
}; };
...@@ -518,9 +538,8 @@ define(['require', ...@@ -518,9 +538,8 @@ define(['require',
} }
}) })
}; };
col['owner'] = {
col['description'] = { label: "Owner",
label: "Description",
cell: "String", cell: "String",
editable: false, editable: false,
sortable: false, sortable: false,
...@@ -530,46 +549,48 @@ define(['require', ...@@ -530,46 +549,48 @@ define(['require',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var obj = model.toJSON(); var obj = model.toJSON();
if (obj && obj.attributes && obj.attributes.description) { if (obj && obj.attributes && obj.attributes.owner) {
return obj.attributes.description; return obj.attributes.owner;
} }
} }
}) })
}; };
col['typeName'] = {
label: "Type", col['description'] = {
cell: "Html", label: "Description",
cell: "String",
editable: false, editable: false,
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'typeName') : true), renderable: true,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var obj = model.toJSON(); var obj = model.toJSON();
if (obj && obj.typeName) { if (obj && obj.attributes && obj.attributes.description) {
return '<a title="Search ' + obj.typeName + '" href="#!/search/searchResult?query=' + obj.typeName + ' &searchType=dsl&dslChecked=true">' + obj.typeName + '</a>'; return obj.attributes.description;
} }
} }
}) })
}; };
col['owner'] = { col['typeName'] = {
label: "Owner", label: "Type",
cell: "String", cell: "Html",
editable: false, editable: false,
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: true, renderable: (columnToShow ? _.contains(columnToShow, 'typeName') : true),
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var obj = model.toJSON(); var obj = model.toJSON();
if (obj && obj.attributes && obj.attributes.owner) { if (obj && obj.typeName) {
return obj.attributes.owner; return '<a title="Search ' + obj.typeName + '" href="#!/search/searchResult?query=' + obj.typeName + ' &searchType=dsl&dslChecked=true">' + obj.typeName + '</a>';
} }
} }
}) })
}; };
col['tag'] = { col['tag'] = {
label: "Tags", label: "Tags",
cell: "Html", cell: "Html",
...@@ -577,7 +598,7 @@ define(['require', ...@@ -577,7 +598,7 @@ define(['require',
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'tag') : true), renderable: (columnToShow ? _.contains(columnToShow, 'tag') : true),
className: 'searchTag', className: 'searchTag',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
...@@ -599,7 +620,7 @@ define(['require', ...@@ -599,7 +620,7 @@ define(['require',
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'terms') : true), renderable: (columnToShow ? _.contains(columnToShow, 'terms') : true),
className: 'searchTerm', className: 'searchTerm',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
...@@ -616,16 +637,15 @@ define(['require', ...@@ -616,16 +637,15 @@ define(['require',
} }
}) })
}; };
}
if (this.value && this.value.searchType === "basic") { if (this.value && this.value.searchType === "basic") {
var def = this.entityDefCollection.fullCollection.find({ name: this.value.type }); var def = this.entityDefCollection.fullCollection.find({ name: this.value.type });
if (def) { if (def) {
var attrObj = Utils.getNestedSuperTypeObj({ data: def.toJSON(), collection: this.entityDefCollection, attrMerge: true }); var attrObj = Utils.getNestedSuperTypeObj({ data: def.toJSON(), collection: this.entityDefCollection, attrMerge: true });
_.each(attrObj, function(obj, key) { _.each(attrObj, function(obj, key) {
var key = obj.name, var key = obj.name,
isRenderable = _.contains(that.columnToShow, key) isRenderable = _.contains(columnToShow, key)
if (key == "name" || key == "description" || key == "owner") { if (key == "name" || key == "description" || key == "owner") {
if (that.columnToShow && that.columnToShow.length) { if (columnToShow) {
col[key].renderable = isRenderable; col[key].renderable = isRenderable;
} }
return; return;
...@@ -660,6 +680,7 @@ define(['require', ...@@ -660,6 +680,7 @@ define(['require',
}); });
} }
} }
}
return this.searchCollection.constructor.getTableCols(col, this.searchCollection); return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
}, },
addTagModalView: function(guid, multiple) { addTagModalView: function(guid, multiple) {
...@@ -700,11 +721,11 @@ define(['require', ...@@ -700,11 +721,11 @@ define(['require',
}, },
showLoader: function() { showLoader: function() {
this.$('.fontLoader').show(); this.$('.fontLoader:not(.for-ignore)').show();
this.$('.tableOverlay').show(); this.$('.tableOverlay').show();
}, },
hideLoader: function() { hideLoader: function() {
this.$('.fontLoader').hide(); this.$('.fontLoader:not(.for-ignore)').hide();
this.$('.ellipsis,.labelShowRecord').show(); // only for first time this.$('.ellipsis,.labelShowRecord').show(); // only for first time
this.$('.tableOverlay').hide(); this.$('.tableOverlay').hide();
}, },
...@@ -846,11 +867,25 @@ define(['require', ...@@ -846,11 +867,25 @@ define(['require',
}); });
}, },
onCheckDeletedEntity: function(e) { onCheckDeletedEntity: function(e) {
var includeDE = false;
if (e.target.checked) { if (e.target.checked) {
includeDE = true;
$.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: false }); $.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: false });
} else { } else {
$.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: true }); $.extend(this.searchCollection.queryParams, { limit: this.limit, excludeDeletedEntities: true });
} }
if (this.value) {
this.value.includeDE = includeDE;
Utils.setUrl({
url: '#!/search/searchResult',
urlParams: this.value,
mergeBrowserUrl: false,
trigger: false,
updateTabState: function() {
return { searchUrl: this.url, stateChanged: true };
}
});
}
this.fetchCollection(); this.fetchCollection();
} }
}); });
......
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