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
5527afb0
Commit
5527afb0
authored
Jul 19, 2017
by
kevalbhatt
Committed by
Madhan Neethiraj
Jul 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1914: clear button in search UI to clear filter attributes
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
cda7f56d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
47 deletions
+93
-47
Router.js
dashboardv2/public/js/router/Router.js
+16
-16
SideNavLayoutView.js
...dv2/public/js/views/business_catalog/SideNavLayoutView.js
+4
-1
QueryBuilderView.js
dashboardv2/public/js/views/search/QueryBuilderView.js
+17
-2
SearchLayoutView.js
dashboardv2/public/js/views/search/SearchLayoutView.js
+44
-26
TagLayoutView.js
dashboardv2/public/js/views/tag/TagLayoutView.js
+12
-2
No files found.
dashboardv2/public/js/router/Router.js
View file @
5527afb0
...
...
@@ -53,6 +53,10 @@ 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
;
...
...
@@ -125,6 +129,7 @@ define([
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'url'
:
url
,
'filterObj'
:
that
.
filterObj
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -156,7 +161,7 @@ define([
App
.
rNHeader
.
show
(
new
Header
());
if
(
!
App
.
rSideNav
.
currentView
)
{
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({},
that
.
preFetchedCollectionLists
)
_
.
extend
({
'filterObj'
:
that
.
filterObj
},
that
.
preFetchedCollectionLists
)
));
}
else
{
App
.
rSideNav
.
currentView
.
selectTab
();
...
...
@@ -193,7 +198,8 @@ define([
}
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'tag'
:
tagName
'tag'
:
tagName
,
'filterObj'
:
that
.
filterObj
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -231,17 +237,13 @@ define([
'views/business_catalog/SideNavLayoutView'
,
'views/search/SearchDetailLayoutView'
,
],
function
(
Header
,
BusinessCatalogLayoutView
,
SideNavLayoutView
,
SearchDetailLayoutView
)
{
var
paramObj
=
Utils
.
getUrlState
.
getQueryParams
(),
filterObj
=
{
'tagFilters'
:
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'tagFilters'
)),
'entityFilters'
:
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'entityFilters'
))
}
var
paramObj
=
Utils
.
getUrlState
.
getQueryParams
();
App
.
rNHeader
.
show
(
new
Header
());
if
(
!
App
.
rSideNav
.
currentView
)
{
App
.
rSideNav
.
show
(
new
SideNavLayoutView
(
_
.
extend
({
'searchVent'
:
that
.
searchVent
,
'filterObj'
:
filterObj
'filterObj'
:
that
.
filterObj
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -257,7 +259,7 @@ define([
_
.
extend
({
'value'
:
paramObj
,
'initialView'
:
true
,
'filterObj'
:
filterObj
,
'filterObj'
:
that
.
filterObj
,
'searchVent'
:
that
.
searchVent
},
that
.
preFetchedCollectionLists
)
));
...
...
@@ -276,10 +278,7 @@ define([
'views/search/SearchDetailLayoutView'
],
function
(
Header
,
BusinessCatalogLayoutView
,
SideNavLayoutView
,
SearchDetailLayoutView
)
{
var
paramObj
=
Utils
.
getUrlState
.
getQueryParams
(),
filterObj
=
{
'tagFilters'
:
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'tagFilters'
)),
'entityFilters'
:
JSON
.
parse
(
Utils
.
localStorage
.
getValue
(
'entityFilters'
))
}
filterObj
=
that
.
filterObj
if
(
paramObj
&&
paramObj
.
searchType
===
"basic"
)
{
if
(
paramObj
.
type
)
{
if
(
_
.
has
(
filterObj
.
entityFilters
,
paramObj
.
type
))
{
...
...
@@ -310,7 +309,7 @@ define([
_
.
extend
({
'value'
:
paramObj
,
'searchVent'
:
that
.
searchVent
,
'filterObj'
:
filterObj
'filterObj'
:
that
.
filterObj
},
that
.
preFetchedCollectionLists
)
));
}
else
{
...
...
@@ -321,7 +320,7 @@ define([
_
.
extend
({
'value'
:
paramObj
,
'searchVent'
:
that
.
searchVent
,
'filterObj'
:
filterObj
,
'filterObj'
:
that
.
filterObj
,
'initialView'
:
(
paramObj
.
type
||
(
paramObj
.
dslChecked
==
"true"
?
""
:
paramObj
.
tag
)
||
(
paramObj
.
query
?
paramObj
.
query
.
trim
()
:
""
)).
length
===
0
},
that
.
preFetchedCollectionLists
)
));
...
...
@@ -342,4 +341,4 @@ define([
}
});
return
AppRouter
;
});
});
\ No newline at end of file
dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
View file @
5527afb0
...
...
@@ -96,6 +96,8 @@ define(['require',
that
.
RTagLayoutView
.
show
(
new
TagLayoutView
({
collection
:
that
.
classificationDefCollection
,
tag
:
that
.
tag
,
value
:
that
.
value
,
filterObj
:
that
.
filterObj
,
typeHeaders
:
that
.
typeHeaders
}));
});
...
...
@@ -128,4 +130,4 @@ define(['require',
},
});
return
SideNavLayoutView
;
});
});
\ No newline at end of file
dashboardv2/public/js/views/search/QueryBuilderView.js
View file @
5527afb0
...
...
@@ -138,13 +138,27 @@ define(['require',
}
}
}
_
.
each
(
this
.
attrObj
,
function
(
obj
)
{
var
returnObj
=
that
.
getObjDef
(
obj
,
rules_widgets
);
if
(
returnObj
)
{
filters
.
push
(
returnObj
);
}
});
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'
],
...
...
@@ -178,4 +192,4 @@ define(['require',
}
});
return
QueryBuilderView
;
});
});
\ No newline at end of file
dashboardv2/public/js/views/search/SearchLayoutView.js
View file @
5527afb0
...
...
@@ -282,32 +282,36 @@ define(['require',
var
filtertype
=
this
.
attrModal
.
tag
?
'tagFilters'
:
'entityFilters'
,
rule
=
this
.
attrModal
.
RQueryBuilder
.
currentView
.
ui
.
builder
.
queryBuilder
(
'getRules'
),
result
=
this
.
getQueryBuilderParsData
(
rule
);
if
(
result
&&
!
_
.
isEmpty
(
result
.
criterion
))
{
this
.
query
[
this
.
type
][
filtertype
]
=
+
new
Date
();
if
(
result
)
{
var
filterObj
=
this
.
filterObj
?
this
.
filterObj
[
filtertype
]
:
null
;
if
(
!
filterObj
)
{
filterObj
=
{};
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
);
}
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
);
}
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
);
}
this
.
attrModal
.
modal
.
close
();
},
getQueryBuilderParsData
:
function
(
obj
)
{
if
(
obj
)
{
...
...
@@ -378,17 +382,26 @@ define(['require',
}
else
if
(
this
.
value
.
dslChecked
==
"false"
&&
this
.
dsl
==
true
)
{
this
.
ui
.
searchType
.
prop
(
"checked"
,
false
).
trigger
(
"change"
);
}
this
.
ui
.
typeLov
.
val
(
this
.
value
.
type
);
if
(
this
.
ui
.
typeLov
.
data
(
'select2'
))
{
this
.
ui
.
typeLov
.
val
(
this
.
value
.
type
).
trigger
(
'change'
);
}
else
{
this
.
ui
.
typeLov
.
val
(
this
.
value
.
type
);
if
(
this
.
ui
.
typeLov
.
val
()
!==
this
.
value
.
type
)
{
this
.
value
.
type
=
null
;
this
.
ui
.
typeLov
.
val
(
""
).
trigger
(
"change"
);
}
else
{
this
.
ui
.
typeLov
.
trigger
(
"change"
);
}
}
if
(
!
this
.
dsl
)
{
this
.
ui
.
tagLov
.
val
(
this
.
value
.
tag
);
if
(
this
.
ui
.
tagLov
.
data
(
'select2'
))
{
this
.
ui
.
tagLov
.
val
(
this
.
value
.
tag
).
trigger
(
'change'
);
}
else
{
this
.
ui
.
typeLov
.
val
(
this
.
value
.
tag
);
// To handle delete scenario.
if
(
this
.
ui
.
tagLov
.
val
()
!==
this
.
value
.
tag
)
{
this
.
value
.
tag
=
null
;
this
.
ui
.
tagLov
.
val
(
""
).
trigger
(
"change"
);
}
else
{
this
.
ui
.
tagLov
.
trigger
(
"change"
);
}
}
}
this
.
ui
.
searchInput
.
val
(
this
.
value
.
query
||
""
);
...
...
@@ -468,7 +481,11 @@ define(['require',
this
.
ui
.
typeLov
.
val
(
""
).
trigger
(
"change"
);
this
.
ui
.
tagLov
.
val
(
""
).
trigger
(
"change"
);
this
.
ui
.
searchInput
.
val
(
""
);
this
.
checkForButtonVisiblity
()
this
.
checkForButtonVisiblity
();
Utils
.
localStorage
.
removeValue
(
'tagFilters'
);
Utils
.
localStorage
.
removeValue
(
'entityFilters'
);
this
.
filterObj
.
tagFilters
=
null
;
this
.
filterObj
.
entityFilters
=
null
;
Utils
.
setUrl
({
url
:
'#!/search/searchResult'
,
urlParams
:
{
...
...
@@ -481,4 +498,4 @@ define(['require',
}
});
return
SearchLayoutView
;
});
});
\ No newline at end of file
dashboardv2/public/js/views/tag/TagLayoutView.js
View file @
5527afb0
...
...
@@ -59,7 +59,7 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'tag'
,
'collection'
,
'typeHeaders'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'tag'
,
'collection'
,
'typeHeaders'
,
'filterObj'
,
'value'
));
},
bindEvents
:
function
()
{
var
that
=
this
;
...
...
@@ -417,10 +417,19 @@ 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
});
}
});
}
});
return
TagLayoutView
;
});
});
\ No newline at end of file
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