Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
f511f272
Commit
f511f272
authored
Jul 21, 2017
by
kevalbhatt
Committed by
Madhan Neethiraj
Jul 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1967: search UI - render attribute filter based on browser URL
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
62d85a4c
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
232 additions
and
292 deletions
+232
-292
Modal.js
dashboardv2/public/js/modules/Modal.js
+5
-4
Router.js
dashboardv2/public/js/router/Router.js
+6
-41
modal.html
dashboardv2/public/js/templates/common/modal.html
+4
-1
SearchLayoutView_tmpl.html
...dv2/public/js/templates/search/SearchLayoutView_tmpl.html
+2
-2
SearchResultLayoutView_tmpl.html
...blic/js/templates/search/SearchResultLayoutView_tmpl.html
+0
-15
CommonViewFunction.js
dashboardv2/public/js/utils/CommonViewFunction.js
+58
-0
TableLayout.js
dashboardv2/public/js/utils/TableLayout.js
+3
-1
SideNavLayoutView.js
...dv2/public/js/views/business_catalog/SideNavLayoutView.js
+1
-3
QueryBuilderView.js
dashboardv2/public/js/views/search/QueryBuilderView.js
+8
-27
SearchDetailLayoutView.js
dashboardv2/public/js/views/search/SearchDetailLayoutView.js
+1
-2
SearchLayoutView.js
dashboardv2/public/js/views/search/SearchLayoutView.js
+85
-127
SearchQueryView.js
dashboardv2/public/js/views/search/SearchQueryView.js
+14
-5
SearchResultLayoutView.js
dashboardv2/public/js/views/search/SearchResultLayoutView.js
+44
-54
TagLayoutView.js
dashboardv2/public/js/views/tag/TagLayoutView.js
+1
-10
No files found.
dashboardv2/public/js/modules/Modal.js
View file @
f511f272
...
...
@@ -29,7 +29,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
this
.
trigger
(
'closeModal'
);
if
(
this
.
options
.
content
&&
this
.
options
.
content
.
trigger
)
{
this
.
options
.
content
.
trigger
(
'closeModal'
,
this
);
this
.
options
.
content
.
trigger
(
'closeModal'
,
this
,
event
);
}
},
'click .cancel'
:
function
(
event
)
{
...
...
@@ -38,7 +38,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
this
.
trigger
(
'closeModal'
);
if
(
this
.
options
.
content
&&
this
.
options
.
content
.
trigger
)
{
this
.
options
.
content
.
trigger
(
'closeModal'
,
this
);
this
.
options
.
content
.
trigger
(
'closeModal'
,
this
,
event
);
}
},
'click .ok'
:
function
(
event
)
{
...
...
@@ -47,7 +47,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
this
.
trigger
(
'ok'
);
if
(
this
.
options
.
content
&&
this
.
options
.
content
.
trigger
)
{
this
.
options
.
content
.
trigger
(
'ok'
,
this
);
this
.
options
.
content
.
trigger
(
'ok'
,
this
,
event
);
}
if
(
this
.
options
.
okCloses
)
{
...
...
@@ -85,7 +85,8 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
animate
:
true
,
contentWithFooter
:
false
,
template
:
template
,
width
:
null
width
:
null
,
buttons
:
null
},
options
);
},
...
...
dashboardv2/public/js/router/Router.js
View file @
f511f272
...
...
@@ -53,10 +53,6 @@ define([
'enumDefCollection'
:
this
.
enumDefCollection
,
'classificationDefCollection'
:
this
.
classificationDefCollection
}
this
.
filterObj
=
{
'tagFilters'
:
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'tagFilters'
)),
'entityFilters'
:
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'entityFilters'
))
}
},
bindCommonEvents
:
function
()
{
var
that
=
this
;
...
...
@@ -128,8 +124,7 @@ define([
if
(
!
App
.
rSideNav
.
currentView
)
{
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'url'
:
url
,
'filterObj'
:
that
.
filterObj
'url'
:
url
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -161,7 +156,7 @@ define([
App
.
rNHeader
.
show
(
new
Header
());
if
(
!
App
.
rSideNav
.
currentView
)
{
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'filterObj'
:
that
.
filterObj
},
that
.
preFetchedCollectionLists
)
_
.
extend
({},
that
.
preFetchedCollectionLists
)
));
}
else
{
App
.
rSideNav
.
currentView
.
selectTab
();
...
...
@@ -198,8 +193,7 @@ define([
}
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'tag'
:
tagName
,
'filterObj'
:
that
.
filterObj
'tag'
:
tagName
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -242,8 +236,7 @@ define([
if
(
!
App
.
rSideNav
.
currentView
)
{
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'searchVent'
:
that
.
searchVent
,
'filterObj'
:
that
.
filterObj
'searchVent'
:
that
.
searchVent
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -259,7 +252,6 @@ define([
_
.
extend
({
'value'
:
paramObj
,
'initialView'
:
true
,
'filterObj'
:
that
.
filterObj
,
'searchVent'
:
that
.
searchVent
},
that
.
preFetchedCollectionLists
)
));
...
...
@@ -277,39 +269,13 @@ define([
'views/business_catalog/SideNavLayoutView'
,
'views/search/SearchDetailLayoutView'
],
function
(
Header
,
BusinessCatalogLayoutView
,
SideNavLayoutView
,
SearchDetailLayoutView
)
{
var
paramObj
=
Utils
.
getUrlState
.
getQueryParams
(),
filterObj
=
that
.
filterObj
if
(
paramObj
&&
paramObj
.
searchType
===
"basic"
)
{
if
(
paramObj
.
type
)
{
if
(
_
.
has
(
filterObj
.
entityFilters
,
paramObj
.
type
))
{
_
.
extend
(
paramObj
,
{
'entityFilters'
:
+
new
Date
()
})
}
}
if
(
paramObj
.
tag
)
{
if
(
_
.
has
(
filterObj
.
entityFilters
,
paramObj
.
type
))
{
_
.
extend
(
paramObj
,
{
'tagFilters'
:
+
new
Date
()
})
}
}
Utils
.
setUrl
({
url
:
'#!/search/searchResult'
,
trigger
:
false
,
urlParams
:
paramObj
,
updateTabState
:
function
()
{
return
{
searchUrl
:
this
.
url
,
stateChanged
:
true
};
},
});
}
var
paramObj
=
Utils
.
getUrlState
.
getQueryParams
();
App
.
rNHeader
.
show
(
new
Header
());
if
(
!
App
.
rSideNav
.
currentView
)
{
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'value'
:
paramObj
,
'searchVent'
:
that
.
searchVent
,
'filterObj'
:
that
.
filterObj
'searchVent'
:
that
.
searchVent
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -320,7 +286,6 @@ define([
_
.
extend
({
'value'
:
paramObj
,
'searchVent'
:
that
.
searchVent
,
'filterObj'
:
that
.
filterObj
,
'initialView'
:
(
paramObj
.
type
||
(
paramObj
.
dslChecked
==
"true"
?
""
:
paramObj
.
tag
)
||
(
paramObj
.
query
?
paramObj
.
query
.
trim
()
:
""
)).
length
===
0
},
that
.
preFetchedCollectionLists
)
));
...
...
dashboardv2/public/js/templates/common/modal.html
View file @
f511f272
...
...
@@ -31,10 +31,13 @@
<div
class=
"modal-body"
>
{{content}}
</div>
{{#if showFooter}}
<div
class=
"modal-footer"
>
{{#if allowCancel}} {{#if cancelText}}
{{#if buttons}} {{#each buttons}}
<button
type=
"button"
class=
"btn btn-atlas {{this.btnClass}}"
>
{{this.text}}
</button>
{{/each}} {{else}} {{#if allowCancel}} {{#if cancelText}}
<button
type=
"button"
class=
"btn btn-atlas cancel"
>
{{tt cancelText}}
</button>
{{/if}} {{/if}}
<button
type=
"button"
class=
"btn btn-atlas ok"
>
{{tt okText}}
</button>
{{/if}}
</div>
{{/if}} {{/if}}
</div>
...
...
dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html
View file @
f511f272
...
...
@@ -40,7 +40,7 @@
<select
data-id=
"typeLOV"
></select>
</div>
<div
class=
"col-sm-2 no-padding temFilterBtn"
>
<button
type=
"button"
class=
"btn btn-atlasAction btn-atlas pull-right typeLOV"
title=
"Entity Attribute Filter"
data-id=
"typeAttrFilter"
><i
class=
"fa fa-filter"
></i></button>
<button
type=
"button"
class=
"btn btn-atlasAction btn-atlas pull-right typeLOV
active
"
title=
"Entity Attribute Filter"
data-id=
"typeAttrFilter"
><i
class=
"fa fa-filter"
></i></button>
</div>
</div>
</div>
...
...
@@ -51,7 +51,7 @@
<select
data-id=
"tagLOV"
></select>
</div>
<div
class=
"col-sm-2 no-padding"
>
<button
type=
"button"
class=
"btn btn-atlasAction btn-atlas pull-right"
title=
"Tag Attribute Filter"
data-id=
"tagAttrFilter"
><i
class=
"fa fa-filter"
></i></button>
<button
type=
"button"
class=
"btn btn-atlasAction btn-atlas pull-right
active
"
title=
"Tag Attribute Filter"
data-id=
"tagAttrFilter"
><i
class=
"fa fa-filter"
></i></button>
</div>
</div>
</div>
...
...
dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html
View file @
f511f272
...
...
@@ -20,21 +20,6 @@
<div
class=
"fontLoader"
>
<i
class=
"fa fa-refresh fa-spin-custom"
></i>
</div>
<div>
<div
id=
"r_searchQuery"
>
<div
class=
"panel panel-default"
id=
"filterPanel"
>
<div
class=
"panel-heading clearfix"
>
<h4
class=
"panel-title pull-left"
>
Type,Tag filter/s
</h4>
<div
class=
"btn-group pull-right"
>
<button
type=
"button"
id=
"expand_collapse_panel"
class=
"expand_collapse_panel"
title=
"Collapse"
><i
class=
"fa fa-chevron-up"
aria-hidden=
"true"
></i></button>
</div>
</div>
<div
id=
"panel_body"
class=
"panel-body collapse in"
align=
"center"
>
<p
class=
"filterQuery"
id=
"filterQuery"
></p>
</div>
</div>
</div>
</div>
<div
class=
"ellipsis"
style=
"display: none;"
><span
class=
"searchResult"
style=
" font-size: 16px;"
></span>
<a
href=
"javascript:void(0)"
class=
"inputAssignTag multiSelectTerm btnAssign"
style=
"display:none"
data-id=
"addTerm"
><i
class=
"fa fa-folder-o"
></i>
Assign Term
</a>
<a
href=
"javascript:void(0)"
class=
"inputAssignTag multiSelectTag assignTag btnAssign"
style=
"display:none"
data-id=
"addAssignTag"
><i
class=
"fa fa-plus"
></i>
Assign Tag
</a>
...
...
dashboardv2/public/js/utils/CommonViewFunction.js
View file @
f511f272
...
...
@@ -398,6 +398,64 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
});
})
}
CommonViewFunction
.
attributeFilter
=
{
generateUrl
:
function
(
attrObj
)
{
var
attrQuery
=
[];
if
(
attrObj
)
{
_
.
each
(
attrObj
,
function
(
obj
)
{
attrQuery
.
push
(
obj
.
id
+
"::"
+
obj
.
operator
+
"::"
+
obj
.
value
+
"::"
+
obj
.
type
);
});
return
attrQuery
.
join
();
}
else
{
return
null
;
}
},
extractUrl
:
function
(
urlObj
)
{
var
attrObj
=
[];
if
(
urlObj
&&
urlObj
.
length
)
{
_
.
each
(
urlObj
.
split
(
","
),
function
(
obj
)
{
var
temp
=
obj
.
split
(
"::"
);
attrObj
.
push
({
id
:
temp
[
0
],
operator
:
temp
[
1
],
value
:
temp
[
2
],
type
:
temp
[
3
]
});
});
return
attrObj
;
}
else
{
return
null
;
}
},
generateAPIObj
:
function
(
url
)
{
if
(
url
&&
url
.
length
)
{
var
parsObj
=
{
"condition"
:
'AND'
,
"criterion"
:
convertKeyAndExtractObj
(
this
.
extractUrl
(
url
))
}
return
parsObj
;
}
else
{
return
null
;
}
function
convertKeyAndExtractObj
(
rules
)
{
var
convertObj
=
[];
_
.
each
(
rules
,
function
(
rulObj
)
{
var
tempObj
=
{};
// For nested
// if (rulObj.rules) {
// tempObj = {
// "condition": "AND",
// "criterion": convertKeyAndExtractObj(rulObj.rules)
// }
// } else {
// }
tempObj
=
{
"attributeName"
:
rulObj
.
id
,
"operator"
:
rulObj
.
operator
,
"attributeValue"
:
(
rulObj
.
type
===
"date"
?
Date
.
parse
(
rulObj
.
value
)
:
rulObj
.
value
)
}
convertObj
.
push
(
tempObj
);
});
return
convertObj
;
}
}
}
CommonViewFunction
.
addRestCsrfCustomHeader
=
function
(
xhr
,
settings
)
{
// if (settings.url == null || !settings.url.startsWith('/webhdfs/')) {
if
(
settings
.
url
==
null
)
{
...
...
dashboardv2/public/js/utils/TableLayout.js
View file @
f511f272
...
...
@@ -238,7 +238,9 @@ define(['require',
*/
renderTable
:
function
()
{
var
that
=
this
;
this
.
rTableList
.
show
(
new
Backgrid
.
Grid
(
this
.
gridOpts
));
this
.
rTableList
.
show
(
new
Backgrid
.
Grid
(
this
.
gridOpts
).
on
(
'backgrid:rendered'
,
function
()
{
that
.
trigger
(
'backgrid:rendered'
,
this
)
}));
},
/**
...
...
dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
View file @
f511f272
...
...
@@ -66,7 +66,7 @@ define(['require',
return
events
;
},
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'url'
,
'value'
,
'tag'
,
'selectFirst'
,
'classificationDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'entityDefCollection'
,
'enumDefCollection'
,
'filterObj'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'url'
,
'value'
,
'tag'
,
'selectFirst'
,
'classificationDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'entityDefCollection'
,
'enumDefCollection'
));
if
(
Globals
.
taxonomy
)
{
this
.
tabClass
=
"tab col-sm-4"
;
}
else
{
...
...
@@ -97,7 +97,6 @@ define(['require',
collection
:
that
.
classificationDefCollection
,
tag
:
that
.
tag
,
value
:
that
.
value
,
filterObj
:
that
.
filterObj
,
typeHeaders
:
that
.
typeHeaders
}));
});
...
...
@@ -107,7 +106,6 @@ define(['require',
require
([
'views/search/SearchLayoutView'
],
function
(
SearchLayoutView
)
{
that
.
RSearchLayoutView
.
show
(
new
SearchLayoutView
({
value
:
that
.
value
,
filterObj
:
that
.
filterObj
,
searchVent
:
that
.
searchVent
,
typeHeaders
:
that
.
typeHeaders
,
entityDefCollection
:
that
.
entityDefCollection
,
...
...
dashboardv2/public/js/views/search/QueryBuilderView.js
View file @
f511f272
...
...
@@ -20,9 +20,10 @@ define(['require',
'backbone'
,
'hbs!tmpl/search/QueryBuilder_tmpl'
,
'utils/Utils'
,
'utils/CommonViewFunction'
,
'query-builder'
,
'daterangepicker'
],
function
(
require
,
Backbone
,
QueryBuilder_Tmpl
,
Utils
)
{
],
function
(
require
,
Backbone
,
QueryBuilder_Tmpl
,
Utils
,
CommonViewFunction
)
{
var
QueryBuilderView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
/** @lends QueryBuilderView */
...
...
@@ -51,8 +52,9 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'attrObj'
,
'value'
,
'typeHeaders'
,
'
filterObj'
,
'
entityDefCollection'
,
'enumDefCollection'
,
'tag'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'attrObj'
,
'value'
,
'typeHeaders'
,
'entityDefCollection'
,
'enumDefCollection'
,
'tag'
));
this
.
attrObj
=
_
.
sortBy
(
this
.
attrObj
,
'name'
);
this
.
filterType
=
this
.
tag
?
'tagFilters'
:
'entityFilters'
;
},
bindEvents
:
function
()
{},
getOperator
:
function
(
type
)
{
...
...
@@ -89,8 +91,8 @@ define(['require',
format
:
'MM/DD/YYYY h:mm A'
}
};
if
(
rules
&&
rules
.
rules
)
{
var
valueObj
=
_
.
find
(
rules
.
rules
,
{
id
:
obj
.
id
});
if
(
rules
)
{
var
valueObj
=
_
.
find
(
rules
,
{
id
:
obj
.
id
});
if
(
valueObj
)
{
obj
.
plugin_config
[
"startDate"
]
=
valueObj
.
value
;
}
...
...
@@ -128,15 +130,8 @@ define(['require',
onRender
:
function
()
{
var
that
=
this
,
filters
=
[];
if
(
this
.
filterObj
)
{
var
filter
=
this
.
filterObj
[(
this
.
tag
?
'tagFilters'
:
'entityFilters'
)],
tagTermName
=
this
.
tag
?
this
.
value
.
tag
:
this
.
value
.
type
;
if
(
filter
)
{
ruleObj
=
filter
[
tagTermName
];
if
(
ruleObj
)
{
var
rules_widgets
=
ruleObj
.
rule
;
}
}
if
(
this
.
value
)
{
var
rules_widgets
=
CommonViewFunction
.
attributeFilter
.
extractUrl
(
this
.
value
[
this
.
filterType
]);
}
_
.
each
(
this
.
attrObj
,
function
(
obj
)
{
var
returnObj
=
that
.
getObjDef
(
obj
,
rules_widgets
);
...
...
@@ -145,20 +140,6 @@ define(['require',
}
});
filters
=
_
.
uniq
(
filters
,
'id'
);
if
(
rules_widgets
)
{
for
(
var
i
=
0
;
i
<
rules_widgets
.
rules
.
length
;
i
++
)
{
if
(
!
_
.
find
(
filters
,
{
id
:
rules_widgets
.
rules
[
i
].
id
}))
{
var
type
=
(
this
.
tag
?
'tagFilters'
:
'entityFilters'
);
var
list
=
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
type
));
delete
list
[
this
.
value
.
tag
];
list
=
_
.
isEmpty
(
list
)
?
null
:
list
;
Utils
.
localStorage
.
setValue
(
type
,
JSON
.
stringify
(
list
));
this
.
filterObj
[
type
]
=
list
;
rules_widgets
=
null
;
break
;
}
}
}
if
(
filters
&&
!
_
.
isEmpty
(
filters
))
{
this
.
ui
.
builder
.
queryBuilder
({
plugins
:
[
'bt-tooltip-errors'
],
...
...
dashboardv2/public/js/views/search/SearchDetailLayoutView.js
View file @
f511f272
...
...
@@ -43,7 +43,7 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'initialView'
,
'entityDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'enumDefCollection'
,
'filterObj'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'initialView'
,
'entityDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'enumDefCollection'
));
},
bindEvents
:
function
()
{},
onRender
:
function
()
{
...
...
@@ -62,7 +62,6 @@ define(['require',
entityDefCollection
:
that
.
entityDefCollection
,
typeHeaders
:
that
.
typeHeaders
,
searchVent
:
that
.
searchVent
,
filterObj
:
that
.
filterObj
,
enumDefCollection
:
that
.
enumDefCollection
}));
}
...
...
dashboardv2/public/js/views/search/SearchLayoutView.js
View file @
f511f272
...
...
@@ -22,7 +22,8 @@ define(['require',
'utils/Utils'
,
'utils/UrlLinks'
,
'utils/Globals'
,
],
function
(
require
,
Backbone
,
SearchLayoutViewTmpl
,
Utils
,
UrlLinks
,
Globals
)
{
'utils/CommonViewFunction'
],
function
(
require
,
Backbone
,
SearchLayoutViewTmpl
,
Utils
,
UrlLinks
,
Globals
,
CommonViewFunction
)
{
'use strict'
;
var
SearchLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
...
...
@@ -80,7 +81,7 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'typeHeaders'
,
'searchVent'
,
'entityDefCollection'
,
'enumDefCollection'
,
'classificationDefCollection'
,
'filterObj'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'typeHeaders'
,
'searchVent'
,
'entityDefCollection'
,
'enumDefCollection'
,
'classificationDefCollection'
));
this
.
type
=
"basic"
;
var
param
=
Utils
.
getUrlState
.
getQueryParams
();
this
.
query
=
{
...
...
@@ -121,52 +122,88 @@ define(['require',
this
.
checkForButtonVisiblity
();
},
this
);
},
bindSelect2Events
:
function
(
argument
)
{
var
that
=
this
;
this
.
ui
.
typeLov
.
on
(
'select2:select'
,
function
(
argument
)
{
// this function calles after checkForButtonVisiblity that is why disabled flter here
makeFilterButtonActive
:
function
(
filtertypeParam
)
{
var
filtertype
=
[
'entityFilters'
,
'tagFilters'
],
that
=
this
;
if
(
filtertypeParam
)
{
if
(
_
.
isArray
(
filtertypeParam
))
{
filtertype
=
filtertypeParam
;
}
else
if
(
_
.
isString
(
filtertypeParam
))
{
filtertype
=
[
filtertypeParam
];
}
}
var
typeCheck
=
function
(
filterQueryObj
,
type
)
{
var
filterObj
=
filterQueryObj
[
type
];
if
(
that
.
value
.
type
)
{
if
(
filterObj
&&
filterObj
.
length
)
{
that
.
ui
.
typeAttrFilter
.
addClass
(
'active'
);
}
else
{
filterQueryObj
[
type
]
=
null
;
that
.
value
[
type
]
=
null
;
that
.
ui
.
typeAttrFilter
.
removeClass
(
'active'
);
}
that
.
ui
.
typeAttrFilter
.
prop
(
'disabled'
,
false
);
_
.
extend
(
that
.
value
,
{
'type'
:
this
.
value
});
that
.
makeFilterButtonActive
(
'type'
);
});
this
.
ui
.
tagLov
.
on
(
'select2:select'
,
function
(
argument
)
{
// this function calles after checkForButtonVisiblity that is why disabled flter here
that
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
false
);
_
.
extend
(
that
.
value
,
{
'tag'
:
this
.
value
});
that
.
makeFilterButtonActive
(
'tag'
);
});
this
.
ui
.
typeLov
.
on
(
'select2:unselect'
,
function
(
argument
)
{
_
.
extend
(
that
.
value
,
{
'type'
:
null
});
});
this
.
ui
.
tagLov
.
on
(
'select2:unselect'
,
function
(
argument
)
{
_
.
extend
(
that
.
value
,
{
'tag'
:
null
});
});
},
makeFilterButtonActive
:
function
(
type
)
{
if
(
this
.
filterObj
)
{
var
tagFilters
=
this
.
filterObj
.
tagFilters
,
entityFilters
=
this
.
filterObj
.
entityFilters
;
if
(
type
==
"type"
)
{
if
(
_
.
has
(
entityFilters
,
this
.
value
[
type
]))
{
this
.
query
[
this
.
type
][
'entityFilters'
]
=
+
new
Date
();
this
.
ui
.
typeAttrFilter
.
addClass
(
'active'
);
}
else
{
this
.
query
[
this
.
type
][
'entityFilters'
]
=
null
;
this
.
ui
.
typeAttrFilter
.
removeClass
(
'active'
);
filterQueryObj
[
type
]
=
null
;
that
.
value
[
type
]
=
null
;
that
.
ui
.
typeAttrFilter
.
removeClass
(
'active'
);
that
.
ui
.
typeAttrFilter
.
prop
(
'disabled'
,
true
);
}
}
var
tagCheck
=
function
(
filterQueryObj
,
type
)
{
var
filterObj
=
filterQueryObj
[
type
];
if
(
that
.
value
.
tag
)
{
that
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
false
);
if
(
filterObj
&&
filterObj
.
length
)
{
that
.
ui
.
tagAttrFilter
.
addClass
(
'active'
);
}
else
{
filterQueryObj
[
type
]
=
null
;
that
.
value
[
type
]
=
null
;
that
.
ui
.
tagAttrFilter
.
removeClass
(
'active'
);
}
if
(
type
==
"tag"
)
{
if
(
_
.
has
(
tagFilters
,
this
.
value
[
type
]))
{
this
.
query
[
this
.
type
][
'tagFilters'
]
=
+
new
Date
();
this
.
ui
.
tagAttrFilter
.
addClass
(
'active'
);
}
else
{
this
.
query
[
this
.
type
][
'tagFilters'
]
=
null
;
this
.
ui
.
tagAttrFilter
.
removeClass
(
'active'
);
filterQueryObj
[
type
]
=
null
;
that
.
value
[
type
]
=
null
;
that
.
ui
.
tagAttrFilter
.
removeClass
(
'active'
);
that
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
true
);
}
}
_
.
each
(
filtertype
,
function
(
type
)
{
var
filterObj
=
that
.
query
[
that
.
type
][
type
],
filterQueryObj
=
that
.
query
[
that
.
type
];
if
(
type
==
"entityFilters"
)
{
typeCheck
(
filterQueryObj
,
type
)
}
if
(
type
==
"tagFilters"
)
{
tagCheck
(
filterQueryObj
,
type
)
}
});
},
checkForButtonVisiblity
:
function
()
{
checkForButtonVisiblity
:
function
(
e
)
{
if
(
this
.
type
==
"basic"
&&
e
&&
e
.
currentTarget
)
{
var
$el
=
$
(
e
.
currentTarget
),
isTagEl
=
$el
.
data
(
'id'
)
==
"tagLOV"
?
true
:
false
;
if
(
e
.
type
==
"change"
&&
$el
.
select2
(
'data'
))
{
var
value
=
$el
.
val
(),
key
=
(
isTagEl
?
'tag'
:
'type'
),
filterType
=
(
isTagEl
?
'tagFilters'
:
'entityFilters'
),
value
=
value
.
length
?
value
:
null
;
if
(
this
.
value
)
{
if
(
this
.
value
[
key
]
!==
value
||
(
!
value
&&
!
this
.
value
[
key
])
||
(
!
this
.
value
[
filterType
]))
{
var
temp
=
{};
temp
[
key
]
=
value
;
_
.
extend
(
this
.
value
,
temp
);
this
.
query
[
this
.
type
][
filterType
]
=
null
;
this
.
value
[
filterType
]
=
null
;
this
.
makeFilterButtonActive
(
filterType
);
}
}
else
{
this
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
true
);
this
.
ui
.
typeAttrFilter
.
prop
(
'disabled'
,
true
);
}
}
}
var
that
=
this
,
value
=
this
.
ui
.
searchInput
.
val
()
||
this
.
ui
.
typeLov
.
val
();
if
(
!
this
.
dsl
&&
!
value
)
{
...
...
@@ -180,24 +217,6 @@ define(['require',
}
else
{
this
.
ui
.
searchBtn
.
attr
(
"disabled"
,
"true"
);
}
if
(
this
.
value
)
{
if
(
this
.
value
.
tag
)
{
this
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
false
);
}
else
{
this
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
true
);
}
if
(
this
.
value
.
type
)
{
this
.
ui
.
typeAttrFilter
.
prop
(
'disabled'
,
false
);
}
else
{
this
.
ui
.
typeAttrFilter
.
prop
(
'disabled'
,
true
);
}
this
.
makeFilterButtonActive
(
'type'
);
this
.
makeFilterButtonActive
(
'tag'
);
}
else
{
this
.
ui
.
tagAttrFilter
.
prop
(
'disabled'
,
true
);
this
.
ui
.
typeAttrFilter
.
prop
(
'disabled'
,
true
);
}
},
onRender
:
function
()
{
// array of tags which is coming from url
...
...
@@ -211,8 +230,6 @@ define(['require',
placeholder
:
"Select"
,
allowClear
:
true
});
this
.
bindSelect2Events
();
this
.
checkForButtonVisiblity
();
},
updateQueryObject
:
function
(
param
)
{
if
(
param
&&
param
.
searchType
)
{
...
...
@@ -270,78 +287,24 @@ define(['require',
typeHeaders
:
that
.
typeHeaders
,
entityDefCollection
:
that
.
entityDefCollection
,
enumDefCollection
:
that
.
enumDefCollection
,
filterObj
:
that
.
filterObj
,
classificationDefCollection
:
that
.
classificationDefCollection
});
that
.
attrModal
.
on
(
'ok'
,
function
(
e
)
{
that
.
okAttrFilterButton
();
that
.
attrModal
.
on
(
'ok'
,
function
(
scope
,
e
)
{
that
.
okAttrFilterButton
(
e
);
});
});
},
okAttrFilterButton
:
function
()
{
okAttrFilterButton
:
function
(
e
)
{
var
filtertype
=
this
.
attrModal
.
tag
?
'tagFilters'
:
'entityFilters'
,
rule
=
this
.
attrModal
.
RQueryBuilder
.
currentView
.
ui
.
builder
.
queryBuilder
(
'getRules'
),
result
=
this
.
getQueryBuilderParsData
(
rule
);
if
(
result
)
{
if
(
!
_
.
isEmpty
(
result
.
criterion
))
{
this
.
query
[
this
.
type
][
filtertype
]
=
+
new
Date
();
if
(
result
)
{
var
filterObj
=
this
.
filterObj
?
this
.
filterObj
[
filtertype
]
:
null
;
if
(
!
filterObj
)
{
filterObj
=
{};
}
var
temp
=
{};
// IE fix
temp
[(
this
.
attrModal
.
tag
?
this
.
value
.
tag
:
this
.
value
.
type
)]
=
{
'result'
:
result
,
'rule'
:
rule
};
_
.
extend
(
filterObj
,
temp
);
this
.
filterObj
[
filtertype
]
=
filterObj
;
this
.
makeFilterButtonActive
(
this
.
attrModal
.
tag
?
'tag'
:
'type'
);
Utils
.
localStorage
.
setValue
((
filtertype
),
JSON
.
stringify
(
filterObj
));
}
else
{
this
.
filterObj
[
filtertype
]
=
null
;
this
.
query
[
this
.
type
][
filtertype
]
=
null
;
this
.
makeFilterButtonActive
(
this
.
attrModal
.
tag
?
'tag'
:
'type'
);
Utils
.
localStorage
.
removeValue
(
filtertype
);
}
}
rule
=
this
.
attrModal
.
RQueryBuilder
.
currentView
.
ui
.
builder
.
queryBuilder
(
'getRules'
);
if
(
rule
)
{
this
.
query
[
this
.
type
][
filtertype
]
=
CommonViewFunction
.
attributeFilter
.
generateUrl
(
rule
.
rules
);
this
.
makeFilterButtonActive
(
filtertype
);
this
.
attrModal
.
modal
.
close
();
}
else
{
this
.
filterObj
[
filtertype
]
=
null
;
this
.
query
[
this
.
type
][
filtertype
]
=
null
;
this
.
makeFilterButtonActive
(
this
.
attrModal
.
tag
?
'tag'
:
'type'
);
Utils
.
localStorage
.
removeValue
(
filtertype
);
}
},
getQueryBuilderParsData
:
function
(
obj
)
{
if
(
obj
)
{
var
parsObj
=
{
"condition"
:
obj
.
condition
,
"criterion"
:
convertKeyAndExtractObj
(
obj
.
rules
)
}
if
(
$
(
e
.
currentTarget
).
hasClass
(
'search'
))
{
this
.
findSearchResult
();
}
function
convertKeyAndExtractObj
(
rules
)
{
var
convertObj
=
[];
_
.
each
(
rules
,
function
(
rulObj
)
{
var
tempObj
=
{}
if
(
rulObj
.
rules
)
{
tempObj
=
{
"condition"
:
rulObj
.
condition
,
"criterion"
:
convertKeyAndExtractObj
(
rulObj
.
rules
)
}
}
else
{
tempObj
=
{
"attributeName"
:
rulObj
.
id
,
"operator"
:
rulObj
.
operator
,
"attributeValue"
:
(
rulObj
.
type
===
"date"
?
Date
.
parse
(
rulObj
.
value
)
:
rulObj
.
value
)
}
}
convertObj
.
push
(
tempObj
);
});
return
convertObj
;
}
return
parsObj
;
},
manualRender
:
function
(
paramObj
)
{
this
.
updateQueryObject
(
paramObj
);
...
...
@@ -408,7 +371,6 @@ define(['require',
setTimeout
(
function
()
{
that
.
ui
.
searchInput
.
focus
();
},
0
);
//this.searchVent.trigger('searchAttribute', this.value);
}
},
findSearchResult
:
function
()
{
...
...
@@ -482,10 +444,6 @@ define(['require',
this
.
ui
.
tagLov
.
val
(
""
).
trigger
(
"change"
);
this
.
ui
.
searchInput
.
val
(
""
);
this
.
checkForButtonVisiblity
();
Utils
.
localStorage
.
removeValue
(
'tagFilters'
);
Utils
.
localStorage
.
removeValue
(
'entityFilters'
);
this
.
filterObj
.
tagFilters
=
null
;
this
.
filterObj
.
entityFilters
=
null
;
Utils
.
setUrl
({
url
:
'#!/search/searchResult'
,
urlParams
:
{
...
...
dashboardv2/public/js/views/search/SearchQueryView.js
View file @
f511f272
...
...
@@ -50,17 +50,27 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'entityDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'enumDefCollection'
,
'classificationDefCollection'
,
'tag'
,
'filterObj'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'entityDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'enumDefCollection'
,
'classificationDefCollection'
,
'tag'
));
this
.
bindEvents
();
var
that
=
this
;
this
.
modal
=
new
Modal
({
title
:
'Attribute Filter'
,
content
:
this
,
okText
:
'Apply'
,
cancelText
:
"Cancel"
,
allowCancel
:
true
,
okCloses
:
false
,
width
:
'50%'
width
:
'50%'
,
buttons
:
[{
text
:
'Apply'
,
btnClass
:
"ok"
},
{
text
:
'Apply & Search'
,
btnClass
:
"ok search"
},
{
text
:
'Cancel'
,
btnClass
:
"cancel"
}
]
}).
open
();
this
.
modal
.
on
(
'closeModal'
,
function
()
{
that
.
modal
.
trigger
(
'cancel'
);
...
...
@@ -73,7 +83,6 @@ define(['require',
searchVent
:
this
.
searchVent
,
entityDefCollection
:
this
.
entityDefCollection
,
enumDefCollection
:
this
.
enumDefCollection
,
filterObj
:
this
.
filterObj
,
classificationDefCollection
:
this
.
classificationDefCollection
}
...
...
dashboardv2/public/js/views/search/SearchResultLayoutView.js
View file @
f511f272
...
...
@@ -62,9 +62,7 @@ define(['require',
editEntityButton
:
"[data-id='editEntityButton']"
,
createEntity
:
"[data-id='createEntity']"
,
checkDeletedEntity
:
"[data-id='checkDeletedEntity']"
,
containerCheckBox
:
"[data-id='containerCheckBox']"
,
filterPanel
:
"#filterPanel"
,
filterQuery
:
"#filterQuery"
containerCheckBox
:
"[data-id='containerCheckBox']"
},
templateHelpers
:
function
()
{
return
{
...
...
@@ -129,8 +127,7 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'initialView'
,
'entityDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'enumDefCollection'
,
'tagCollection'
,
'filterObj'
));
var
pagination
=
""
;
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'initialView'
,
'entityDefCollection'
,
'typeHeaders'
,
'searchVent'
,
'enumDefCollection'
,
'tagCollection'
));
this
.
entityModel
=
new
VEntity
();
this
.
searchCollection
=
new
VSearchList
();
this
.
limit
=
25
;
...
...
@@ -142,7 +139,8 @@ define(['require',
includePagination
:
false
,
includeFooterRecords
:
false
,
includeColumnManager
:
(
this
.
value
&&
this
.
value
.
searchType
===
"basic"
?
true
:
false
),
includeOrderAbleColumns
:
false
,
includeOrderAbleColumns
:
true
,
includeSizeAbleColumns
:
true
,
columnOpts
:
{
opts
:
{
initialColumnsVisible
:
null
,
...
...
@@ -237,9 +235,6 @@ define(['require',
this
.
listenTo
(
this
.
searchVent
,
"search:refresh"
,
function
(
model
,
response
)
{
this
.
fetchCollection
();
},
this
);
this
.
listenTo
(
this
.
searchVent
,
"searchAttribute"
,
function
(
obj
)
{
this
.
showHideFilter
(
obj
);
},
this
);
},
onRender
:
function
()
{
if
(
!
this
.
initialView
)
{
...
...
@@ -269,76 +264,66 @@ define(['require',
this
.
$
(
".entityLink"
).
show
();
}
}
this
.
showHideFilter
();
},
updateColumnList
:
function
(
updatedList
)
{
if
(
updatedList
)
{
var
listOfColumns
=
[]
_
.
map
(
updatedList
,
function
(
obj
)
{
var
key
=
obj
.
name
;
if
(
key
==
"selected"
||
key
==
"displayText"
||
key
==
"description"
||
key
==
"typeName"
||
key
==
"owner"
||
key
==
"tag"
||
key
==
"terms"
)
{
return
;
}
if
(
obj
.
renderable
)
{
listOfColumns
.
push
(
obj
.
name
);
}
});
listOfColumns
=
_
.
sortBy
(
listOfColumns
);
this
.
value
.
attributes
=
listOfColumns
.
length
?
listOfColumns
.
join
(
","
)
:
null
;
}
this
.
columnToShow
=
this
.
value
&&
this
.
value
.
attributes
?
this
.
value
.
attributes
.
split
(
','
)
:
[];
},
generateQueryOfFilter
:
function
()
{
var
value
=
this
.
value
,
entityFilters
=
this
.
filterObj
&&
this
.
filterObj
.
entityFilters
?
this
.
filterObj
.
entityFilters
[
value
.
type
]
:
null
,
tagFilters
=
this
.
filterObj
&&
this
.
filterObj
.
tagFilters
?
this
.
filterObj
.
tagFilters
[
value
.
tag
]
:
null
,
entityFilters
=
CommonViewFunction
.
attributeFilter
.
extractUrl
(
value
.
entityFilters
)
,
tagFilters
=
CommonViewFunction
.
attributeFilter
.
extractUrl
(
value
.
tagFilters
)
,
queryArray
=
[],
objToString
=
function
(
filterObj
)
{
var
tempObj
=
[];
_
.
each
(
filterObj
.
rules
,
function
(
obj
)
{
tempObj
.
push
(
'<span class="key">'
+
obj
.
fiel
d
+
'</span> <span class="operator">'
+
obj
.
operator
+
'</span> <span class="value">'
+
obj
.
value
+
"</span>"
)
_
.
each
(
filterObj
,
function
(
obj
)
{
tempObj
.
push
(
'<span class="key">'
+
obj
.
i
d
+
'</span> <span class="operator">'
+
obj
.
operator
+
'</span> <span class="value">'
+
obj
.
value
+
"</span>"
)
});
return
tempObj
.
join
(
' <span class="operator">AND</span> '
);
}
if
(
value
.
type
)
{
var
typeKeyValue
=
'<span class="key">Type:</span> <span class="value">'
+
value
.
type
+
'</span>'
;
if
(
entityFilters
)
{
var
typeKeyValue
=
'<span class="key">Type:</span> <span class="value">'
+
value
.
type
+
'</span> <span class="operator">AND</span> '
;
queryArray
=
queryArray
.
concat
(
typeKeyValue
+
objToString
(
entityFilters
.
rule
));
typeKeyValue
+=
' <span class="operator">AND</span> '
+
objToString
(
entityFilters
);
}
queryArray
.
push
(
typeKeyValue
)
}
if
(
value
.
tag
)
{
var
tagKeyValue
=
'<span class="key">Tag:</span> <span class="value">'
+
value
.
tag
+
'</span>'
;
if
(
tagFilters
)
{
var
tagKeyValue
=
'<span class="key">Tag:</span> <span class="value">'
+
value
.
tag
+
'</span> <span class="operator">AND</span> '
;
queryArray
=
queryArray
.
concat
(
tagKeyValue
+
objToString
(
tagFilters
.
rule
));
tagKeyValue
+=
' <span class="operator">AND</span> '
+
objToString
(
tagFilters
);
}
if
(
queryArray
.
length
==
2
)
{
return
"<span>(</span> "
+
queryArray
.
join
(
'<span> )</span> <span>AND</span> <span>(</span> '
)
+
" <span>)</span>"
;
}
else
{
return
queryArray
.
join
();
queryArray
.
push
(
tagKeyValue
);
}
},
showHideFilter
:
function
()
{
if
(
this
.
value
)
{
if
(
Utils
.
getUrlState
.
isSearchTab
()
&&
this
.
value
.
searchType
==
"basic"
)
{
var
query
=
this
.
generateQueryOfFilter
();
if
(
query
)
{
this
.
ui
.
filterQuery
.
html
(
query
);
this
.
ui
.
filterPanel
.
show
();
}
else
this
.
ui
.
filterPanel
.
hide
();
}
else
{
this
.
ui
.
filterPanel
.
hide
();
if
(
value
.
query
)
{
queryArray
.
push
(
'<span class="key">Query:</span> <span class="value">'
+
value
.
query
+
'</span> '
);
}
if
(
queryArray
.
length
==
1
)
{
return
queryArray
.
join
();
}
else
{
this
.
ui
.
filterPanel
.
hide
();
return
"<span>(</span> "
+
queryArray
.
join
(
'<span> )</span> <span>AND</span> <span>(</span> '
)
+
" <span>)</span>"
;
}
},
fetchCollection
:
function
(
value
,
clickObj
)
{
var
that
=
this
,
isPostMethod
=
this
.
value
.
searchType
===
"basic"
&&
Utils
.
getUrlState
.
isSearchTab
(),
tagFilters
=
this
.
filterObj
&&
this
.
filterObj
.
tagFilters
?
this
.
filterObj
.
tagFilters
[
this
.
value
.
tag
]
:
null
,
entityFilters
=
this
.
filterObj
&&
this
.
filterObj
.
entityFilters
?
this
.
filterObj
.
entityFilters
[
this
.
value
.
type
]
:
null
,
tagFilters
=
CommonViewFunction
.
attributeFilter
.
generateAPIObj
(
this
.
value
.
tagFilters
)
,
entityFilters
=
CommonViewFunction
.
attributeFilter
.
generateAPIObj
(
this
.
value
.
entityFilters
)
,
filterObj
=
{
'entityFilters'
:
entityFilters
?
entityFilters
.
result
:
null
,
'tagFilters'
:
tagFilters
?
tagFilters
.
result
:
null
,
'attributes'
:
this
.
columnToShow
.
length
?
this
.
columnToShow
:
null
'entityFilters'
:
entityFilters
,
'tagFilters'
:
tagFilters
,
'attributes'
:
this
.
columnToShow
.
length
?
_
.
without
(
this
.
columnToShow
,
"selected"
,
"name"
,
"description"
,
"typeName"
,
"owner"
,
"tag"
,
"terms"
)
:
null
}
this
.
showLoader
();
if
(
Globals
.
searchApiCallRef
&&
Globals
.
searchApiCallRef
.
readyState
===
1
)
{
...
...
@@ -393,7 +378,7 @@ define(['require',
if
(
that
.
searchCollection
.
queryParams
.
query
)
{
resultArr
.
push
(
that
.
searchCollection
.
queryParams
.
query
)
}
var
searchString
=
'Results for
<b>'
+
_
.
escape
(
resultArr
.
join
(
that
.
searchType
==
'Advanced Search'
?
" "
:
" & "
))
+
'</b>'
;
var
searchString
=
'Results for
: <span class="filterQuery">'
+
that
.
generateQueryOfFilter
()
+
"</span>"
;
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>'
;
}
...
...
@@ -412,7 +397,6 @@ define(['require',
if
(
isPostMethod
)
{
apiObj
[
'data'
]
=
_
.
extend
({},
filterObj
,
_
.
pick
(
this
.
searchCollection
.
queryParams
,
'query'
,
'excludeDeletedEntities'
,
'limit'
,
'offset'
,
'typeName'
,
'classification'
))
Globals
.
searchApiCallRef
=
this
.
searchCollection
.
getBasicRearchResult
(
apiObj
);
this
.
showHideFilter
();
}
else
{
apiObj
.
data
=
null
;
Globals
.
searchApiCallRef
=
this
.
searchCollection
.
fetch
(
apiObj
);
...
...
@@ -441,13 +425,13 @@ define(['require',
count
=
5
;
require
([
'utils/TableLayout'
],
function
(
TableLayout
)
{
var
columnCollection
=
Backgrid
.
Columns
.
extend
({
sortKey
:
"
position
"
,
sortKey
:
"
displayOrder
"
,
comparator
:
function
(
item
)
{
return
item
.
get
(
this
.
sortKey
)
||
999
;
},
setPositions
:
function
()
{
_
.
each
(
this
.
models
,
function
(
model
,
index
)
{
model
.
set
(
"
position
"
,
index
+
1
,
{
silent
:
true
});
model
.
set
(
"
displayOrder
"
,
index
+
1
,
{
silent
:
true
});
});
return
this
;
}
...
...
@@ -491,10 +475,13 @@ define(['require',
name
:
"selected"
,
label
:
"Select"
,
cell
:
"select-row"
,
resizeable
:
false
,
orderable
:
false
,
renderable
:
(
that
.
columnToShow
&&
that
.
columnToShow
.
length
?
_
.
contains
(
that
.
columnToShow
,
'selected'
)
:
true
),
headerCell
:
"select-all"
};
col
[
'
displayText
'
]
=
{
col
[
'
name
'
]
=
{
label
:
"Name"
,
cell
:
"html"
,
editable
:
false
,
...
...
@@ -556,7 +543,7 @@ define(['require',
sortable
:
false
,
resizeable
:
true
,
orderable
:
true
,
renderable
:
true
,
renderable
:
(
that
.
columnToShow
&&
that
.
columnToShow
.
length
?
_
.
contains
(
that
.
columnToShow
,
'typeName'
)
:
true
)
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
var
obj
=
model
.
toJSON
();
...
...
@@ -590,7 +577,7 @@ define(['require',
sortable
:
false
,
resizeable
:
true
,
orderable
:
true
,
renderable
:
true
,
renderable
:
(
that
.
columnToShow
&&
that
.
columnToShow
.
length
?
_
.
contains
(
that
.
columnToShow
,
'tag'
)
:
true
)
,
className
:
'searchTag'
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
...
...
@@ -612,7 +599,7 @@ define(['require',
sortable
:
false
,
resizeable
:
true
,
orderable
:
true
,
renderable
:
true
,
renderable
:
(
that
.
columnToShow
&&
that
.
columnToShow
.
length
?
_
.
contains
(
that
.
columnToShow
,
'terms'
)
:
true
)
,
className
:
'searchTerm'
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
...
...
@@ -636,8 +623,11 @@ define(['require',
var
attrObj
=
Utils
.
getNestedSuperTypeObj
({
data
:
def
.
toJSON
(),
collection
:
this
.
entityDefCollection
,
attrMerge
:
true
});
_
.
each
(
attrObj
,
function
(
obj
,
key
)
{
var
key
=
obj
.
name
,
is
Eenderable
=
that
.
columnToShow
.
length
?
_
.
contains
(
that
.
columnToShow
,
key
)
:
false
;
is
Renderable
=
_
.
contains
(
that
.
columnToShow
,
key
)
if
(
key
==
"name"
||
key
==
"description"
||
key
==
"owner"
)
{
if
(
that
.
columnToShow
&&
that
.
columnToShow
.
length
)
{
col
[
key
].
renderable
=
isRenderable
;
}
return
;
}
col
[
obj
.
name
]
=
{
...
...
@@ -647,7 +637,7 @@ define(['require',
sortable
:
false
,
resizeable
:
true
,
orderable
:
true
,
renderable
:
is
E
enderable
,
renderable
:
is
R
enderable
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
var
modelObj
=
model
.
toJSON
();
...
...
dashboardv2/public/js/views/tag/TagLayoutView.js
View file @
f511f272
...
...
@@ -59,7 +59,7 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'tag'
,
'collection'
,
'typeHeaders'
,
'
filterObj'
,
'
value'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'tag'
,
'collection'
,
'typeHeaders'
,
'value'
));
},
bindEvents
:
function
()
{
var
that
=
this
;
...
...
@@ -417,15 +417,6 @@ define(['require',
}
that
.
collection
.
remove
(
deleteTagData
);
// to update tag list of search tab fetch typeHeaders.
var
tagList
=
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'tagFilters'
));
if
(
tagList
)
{
delete
tagList
[
that
.
tagName
];
}
tagList
=
_
.
isEmpty
(
tagList
)
?
null
:
tagList
;
if
(
that
.
filterObj
[
'tagFilters'
]
&&
that
.
filterObj
[
'tagFilters'
][
that
.
tagName
])
{
delete
that
.
filterObj
[
'tagFilters'
][
that
.
tagName
];
}
Utils
.
localStorage
.
setValue
(
'tagFilters'
,
JSON
.
stringify
(
tagList
));
that
.
typeHeaders
.
fetch
({
reset
:
true
});
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment