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
41eebcf4
Commit
41eebcf4
authored
4 years ago
by
kevalbhatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3900: UI: Allow user to select the date range for date attribute in basic search
parent
1b41b980
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
208 additions
and
119 deletions
+208
-119
package-lock.json
dashboardv2/package-lock.json
+3
-3
package.json
dashboardv2/package.json
+1
-1
override.scss
dashboardv2/public/css/scss/override.scss
+24
-1
CommonViewFunction.js
dashboardv2/public/js/utils/CommonViewFunction.js
+38
-51
Enums.js
dashboardv2/public/js/utils/Enums.js
+37
-1
QueryBuilderView.js
dashboardv2/public/js/views/search/QueryBuilderView.js
+0
-0
package-lock.json
dashboardv3/package-lock.json
+3
-3
package.json
dashboardv3/package.json
+1
-1
override.scss
dashboardv3/public/css/scss/override.scss
+22
-1
main.js
dashboardv3/public/js/main.js
+0
-1
SearchDefaultLayoutView_tmpl.html
...lic/js/templates/search/SearchDefaultLayoutView_tmpl.html
+3
-3
CommonViewFunction.js
dashboardv3/public/js/utils/CommonViewFunction.js
+37
-51
Enums.js
dashboardv3/public/js/utils/Enums.js
+37
-1
QueryBuilderView.js
dashboardv3/public/js/views/search/QueryBuilderView.js
+0
-0
EntityTreeLayoutView.js
...ardv3/public/js/views/search/tree/EntityTreeLayoutView.js
+2
-1
No files found.
dashboardv2/package-lock.json
View file @
41eebcf4
...
...
@@ -357,9 +357,9 @@
"integrity"
:
"sha1-WjiTlFSfIzMIdaOxUGVldPip63E="
},
"bootstrap-daterangepicker"
:
{
"version"
:
"
2.1.25
"
,
"resolved"
:
"https://registry.npmjs.org/bootstrap-daterangepicker/-/bootstrap-daterangepicker-
2.1.25
.tgz"
,
"integrity"
:
"sha
1-/Ni6C3VaBU0zDXo7fE3Yu4Vc/7c
="
,
"version"
:
"
3.1.0
"
,
"resolved"
:
"https://registry.npmjs.org/bootstrap-daterangepicker/-/bootstrap-daterangepicker-
3.1.0
.tgz"
,
"integrity"
:
"sha
512-oaQZx6ZBDo/dZNyXGVi2rx5GmFXThyQLAxdtIqjtLlYVaQUfQALl5JZMJJZzyDIX7blfy4ppZPAJ10g8Ma4d/g=
="
,
"requires"
:
{
"jquery"
:
">=1.10"
,
"moment"
:
"^2.9.0"
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/package.json
View file @
41eebcf4
...
...
@@ -29,7 +29,7 @@
"backgrid-select-all"
:
"0.3.5"
,
"backgrid-sizeable-columns"
:
"0.1.1"
,
"bootstrap"
:
"3.3.7"
,
"bootstrap-daterangepicker"
:
"
2.1.25
"
,
"bootstrap-daterangepicker"
:
"
3.1.0
"
,
"d3"
:
"3.5.17"
,
"d3-tip"
:
"0.6.8"
,
"dagre-d3"
:
"0.6.4"
,
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/public/css/scss/override.scss
View file @
41eebcf4
...
...
@@ -300,7 +300,7 @@
}
.rule-operator-container
{
width
:
1
05
px
;
width
:
1
50
px
;
.form-control
{
width
:
100%
!
important
;
...
...
@@ -508,3 +508,25 @@ div.columnmanager-dropdown-container {
text-overflow
:
ellipsis
;
}
}
.daterangepicker
{
max-height
:
400px
;
overflow-y
:
scroll
;
.ranges
{
max-height
:
328px
;
overflow
:
auto
;
}
.ranges
li
.active
,
td
.active
{
background-color
:
$color_havelock_blue_approx
;
}
.drp-buttons
{
.applyBtn
{
background-color
:
$color_havelock_blue_approx
;
border-color
:
$color_havelock_blue_approx
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv2/public/js/utils/CommonViewFunction.js
View file @
41eebcf4
...
...
@@ -16,7 +16,7 @@
* limitations under the License.
*/
define
([
'require'
,
'utils/Utils'
,
'modules/Modal'
,
'utils/Messages'
,
'utils/Enums'
,
'moment'
,
'utils/Globals'
],
function
(
require
,
Utils
,
Modal
,
Messages
,
Enums
,
moment
,
Globals
)
{
define
([
'require'
,
'utils/Utils'
,
'modules/Modal'
,
'utils/Messages'
,
'utils/Enums'
,
'moment'
,
'utils/Globals'
,
'moment-timezone'
],
function
(
require
,
Utils
,
Modal
,
Messages
,
Enums
,
moment
,
Globals
)
{
'use strict'
;
var
CommonViewFunction
=
{};
...
...
@@ -387,9 +387,13 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
function
objToString
(
filterObj
)
{
var
generatedQuery
=
_
.
map
(
filterObj
.
rules
,
function
(
obj
,
key
)
{
var
obj
=
$
.
extend
(
true
,
{},
obj
);
// not to update the timezone abbr on original obj , copy of obj is used
if
(
_
.
has
(
obj
,
'condition'
))
{
return
' <span class="operator">'
+
obj
.
condition
+
'</span> '
+
'('
+
objToString
(
obj
)
+
')'
;
}
else
{
if
(
obj
.
type
===
"date"
)
{
obj
.
value
=
obj
.
value
+
" ("
+
moment
.
tz
(
moment
.
tz
.
guess
()).
zoneAbbr
()
+
")"
;
}
return
'<span class="key">'
+
(
Enums
.
systemAttributes
[
obj
.
id
]
?
Enums
.
systemAttributes
[
obj
.
id
]
:
_
.
escape
(
obj
.
id
))
+
'</span> <span class="operator">'
+
_
.
escape
(
obj
.
operator
)
+
'</span> <span class="value">'
+
(
Enums
[
obj
.
id
]
?
Enums
[
obj
.
id
][
obj
.
value
]
:
_
.
escape
(
obj
.
value
))
+
"</span>"
;
}
});
...
...
@@ -487,6 +491,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if
(
Globals
[
value
[
skey
].
typeName
])
{
attributeDefs
=
Globals
[
value
[
skey
].
typeName
].
attributeDefs
;
}
if
(
Globals
.
_ALL_CLASSIFICATION_TYPES
&&
Globals
.
_ALL_CLASSIFICATION_TYPES
.
attributeDefs
)
{
attributeDefs
=
attributeDefs
.
concat
(
Globals
.
_ALL_CLASSIFICATION_TYPES
.
attributeDefs
);
}
}
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
,
"attributeDefs"
:
attributeDefs
});
}
else
if
(
k
==
"entityFilters"
)
{
...
...
@@ -503,6 +510,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if
(
Globals
[
value
[
skey
].
typeName
])
{
attributeDefs
=
Globals
[
value
[
skey
].
typeName
].
attributeDefs
;
}
if
(
Globals
.
_ALL_ENTITY_TYPES
&&
Globals
.
_ALL_ENTITY_TYPES
.
attributeDefs
)
{
attributeDefs
=
attributeDefs
.
concat
(
Globals
.
_ALL_ENTITY_TYPES
.
attributeDefs
);
}
}
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
,
"attributeDefs"
:
attributeDefs
});
}
else
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
...
...
@@ -544,7 +554,18 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
var
type
=
(
obj
.
type
||
obj
.
attributeType
),
//obj.value will come as an object when selected type is Date and operator is isNull or not_null;
value
=
((
_
.
isString
(
obj
.
value
)
&&
_
.
contains
([
"is_null"
,
"not_null"
],
obj
.
operator
)
&&
type
===
'date'
)
||
_
.
isObject
(
obj
.
value
)
?
""
:
_
.
trim
(
obj
.
value
||
obj
.
attributeValue
)),
url
=
[(
obj
.
id
||
obj
.
attributeName
),
mapApiOperatorToUI
(
obj
.
operator
),
(
type
===
'date'
&&
formatedDateToLong
&&
value
.
length
?
Date
.
parse
(
value
)
:
value
)];
url
=
[(
obj
.
id
||
obj
.
attributeName
),
mapApiOperatorToUI
(
obj
.
operator
),
value
];
if
(
obj
.
operator
===
"TIME_RANGE"
)
{
if
(
value
.
indexOf
(
"-"
)
>
-
1
)
{
url
[
2
]
=
value
.
split
(
'-'
).
map
(
function
(
udKey
)
{
return
Date
.
parse
(
udKey
.
trim
()).
toString
()
}).
join
(
","
)
}
else
{
url
[
2
]
=
Enums
.
queryBuilderDateRangeUIValueToAPI
[
_
.
trim
(
value
)]
||
value
;
}
}
else
if
(
value
.
length
&&
type
===
'date'
&&
formatedDateToLong
)
{
url
[
2
]
=
Date
.
parse
(
value
);
}
if
(
type
)
{
url
.
push
(
type
);
}
...
...
@@ -561,30 +582,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
function
mapApiOperatorToUI
(
oper
)
{
if
(
oper
==
"eq"
)
{
return
"="
;
}
else
if
(
oper
==
"neq"
)
{
return
"!="
;
}
else
if
(
oper
==
"lt"
)
{
return
"<"
;
}
else
if
(
oper
==
"lte"
)
{
return
"<="
;
}
else
if
(
oper
==
"gt"
)
{
return
">"
;
}
else
if
(
oper
==
"gte"
)
{
return
">="
;
}
else
if
(
oper
==
"startsWith"
)
{
return
"begins_with"
;
}
else
if
(
oper
==
"endsWith"
)
{
return
"ends_with"
;
}
else
if
(
oper
==
"contains"
)
{
return
"contains"
;
}
else
if
(
oper
==
"notNull"
)
{
return
"not_null"
;
}
else
if
(
oper
==
"isNull"
)
{
return
"is_null"
;
}
return
oper
;
// Enum will be in effect once we click on save search.
return
Enums
.
queryBuilderApiOperatorToUI
[
oper
]
||
oper
;
}
},
extractUrl
:
function
(
options
)
{
...
...
@@ -594,30 +593,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
spliter
=
1
,
apiObj
=
options
.
apiObj
,
mapUiOperatorToAPI
=
function
(
oper
)
{
if
(
oper
==
"="
)
{
return
"eq"
;
}
else
if
(
oper
==
"!="
)
{
return
"neq"
;
}
else
if
(
oper
==
"<"
)
{
return
"lt"
;
}
else
if
(
oper
==
"<="
)
{
return
"lte"
;
}
else
if
(
oper
==
">"
)
{
return
"gt"
;
}
else
if
(
oper
==
">="
)
{
return
"gte"
;
}
else
if
(
oper
==
"begins_with"
)
{
return
"startsWith"
;
}
else
if
(
oper
==
"ends_with"
)
{
return
"endsWith"
;
}
else
if
(
oper
==
"contains"
)
{
return
"contains"
;
}
else
if
(
oper
==
"not_null"
)
{
return
"notNull"
;
}
else
if
(
oper
==
"is_null"
)
{
return
"isNull"
;
}
return
oper
;
return
Enums
.
queryBuilderUIOperatorToAPI
[
oper
]
||
oper
;
},
createObject
=
function
(
urlObj
)
{
var
finalObj
=
{};
...
...
@@ -636,13 +612,24 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
rule
=
{};
if
(
apiObj
)
{
rule
=
{
attributeName
:
temp
[
0
],
operator
:
mapUiOperatorToAPI
(
temp
[
1
]),
attributeValue
:
_
.
trim
(
temp
[
2
])
}
rule
.
attributeValue
=
rule
.
type
===
'date'
&&
formatDate
&&
rule
.
attributeValue
.
length
?
moment
(
parseInt
(
rule
.
attributeValue
)).
format
(
Globals
.
dateTimeFormat
)
:
rule
.
attributeValue
;
}
else
{
rule
=
{
id
:
temp
[
0
],
operator
:
temp
[
1
],
value
:
_
.
trim
(
temp
[
2
])
}
if
(
temp
[
3
])
{
rule
[
'type'
]
=
temp
[
3
];
}
rule
.
value
=
rule
.
type
===
'date'
&&
formatDate
&&
rule
.
value
.
length
?
moment
(
parseInt
(
rule
.
value
)).
format
(
Globals
.
dateTimeFormat
)
:
rule
.
value
;
if
(
rule
.
operator
===
"TIME_RANGE"
)
{
if
(
temp
[
2
].
indexOf
(
","
)
>
-
1
)
{
rule
.
value
=
temp
[
2
].
split
(
","
).
map
(
function
(
udKey
)
{
return
moment
(
parseInt
(
udKey
.
trim
())).
format
(
Globals
.
dateTimeFormat
)
}).
join
(
" - "
)
}
else
{
rule
.
value
=
Enums
.
queryBuilderDateRangeAPIValueToUI
[
_
.
trim
(
rule
.
value
)]
||
rule
.
value
;
}
}
else
if
(
rule
.
type
===
'date'
&&
formatDate
&&
rule
.
value
.
length
)
{
rule
.
value
=
moment
(
parseInt
(
rule
.
value
)).
format
(
Globals
.
dateTimeFormat
)
}
}
return
rule
;
}
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/public/js/utils/Enums.js
View file @
41eebcf4
...
...
@@ -16,7 +16,7 @@
* limitations under the License.
*/
define
([
'require'
],
function
(
require
)
{
define
([
"require"
,
"backbone"
],
function
(
require
)
{
'use strict'
;
var
Enums
=
{};
...
...
@@ -219,5 +219,40 @@ define(['require'], function(require) {
0
:
"false"
,
1
:
"true"
};
Enums
.
queryBuilderUIOperatorToAPI
=
{
"="
:
"eq"
,
"!="
:
"neq"
,
"<"
:
"lt"
,
"<="
:
"lte"
,
">"
:
"gt"
,
">="
:
"gte"
,
"begins_with"
:
"startsWith"
,
"ends_with"
:
"endsWith"
,
"not_null"
:
"notNull"
,
"is_null"
:
"isNull"
,
"TIME_RANGE"
:
"timerange"
};
Enums
.
queryBuilderApiOperatorToUI
=
_
.
invert
(
Enums
.
queryBuilderUIOperatorToAPI
);
Enums
.
queryBuilderDateRangeUIValueToAPI
=
{
"Today"
:
"TODAY"
,
"Yesterday"
:
"YESTERDAY"
,
"Last 7 Days"
:
"LAST_7_DAYS"
,
"Last 30 Days"
:
"LAST_30_DAYS"
,
"This Month"
:
"THIS_MONTH"
,
"Last Month"
:
"LAST_MONTH"
,
"This Quarter"
:
"THIS_QUARTER"
,
"Last Quarter"
:
"LAST_QUARTER"
,
"This Year"
:
"THIS_YEAR"
,
"Last Year"
:
"LAST_YEAR"
,
"Last 3 Months"
:
"LAST_3_MONTHS"
,
"Last 6 Months"
:
"LAST_6_MONTHS"
,
"Last 12 Months"
:
"LAST_12_MONTHS"
};
Enums
.
queryBuilderDateRangeAPIValueToUI
=
_
.
invert
(
Enums
.
queryBuilderDateRangeUIValueToAPI
);
return
Enums
;
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv2/public/js/views/search/QueryBuilderView.js
View file @
41eebcf4
This diff is collapsed.
Click to expand it.
dashboardv3/package-lock.json
View file @
41eebcf4
...
...
@@ -357,9 +357,9 @@
"integrity"
:
"sha1-WjiTlFSfIzMIdaOxUGVldPip63E="
},
"bootstrap-daterangepicker"
:
{
"version"
:
"
2.1.25
"
,
"resolved"
:
"https://registry.npmjs.org/bootstrap-daterangepicker/-/bootstrap-daterangepicker-
2.1.25
.tgz"
,
"integrity"
:
"sha
1-/Ni6C3VaBU0zDXo7fE3Yu4Vc/7c
="
,
"version"
:
"
3.1.0
"
,
"resolved"
:
"https://registry.npmjs.org/bootstrap-daterangepicker/-/bootstrap-daterangepicker-
3.1.0
.tgz"
,
"integrity"
:
"sha
512-oaQZx6ZBDo/dZNyXGVi2rx5GmFXThyQLAxdtIqjtLlYVaQUfQALl5JZMJJZzyDIX7blfy4ppZPAJ10g8Ma4d/g=
="
,
"requires"
:
{
"jquery"
:
">=1.10"
,
"moment"
:
"^2.9.0"
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/package.json
View file @
41eebcf4
...
...
@@ -29,7 +29,7 @@
"backgrid-select-all"
:
"0.3.5"
,
"backgrid-sizeable-columns"
:
"0.1.1"
,
"bootstrap"
:
"3.3.7"
,
"bootstrap-daterangepicker"
:
"
2.1.25
"
,
"bootstrap-daterangepicker"
:
"
3.1.0
"
,
"d3"
:
"3.5.17"
,
"d3-tip"
:
"0.6.8"
,
"dagre-d3"
:
"0.6.4"
,
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/css/scss/override.scss
View file @
41eebcf4
...
...
@@ -304,7 +304,7 @@
}
.rule-operator-container
{
width
:
1
05
px
;
width
:
1
50
px
;
.form-control
{
width
:
100%
!
important
;
...
...
@@ -512,3 +512,23 @@ div.columnmanager-dropdown-container {
text-overflow
:
ellipsis
;
}
}
.daterangepicker
{
.ranges
{
max-height
:
328px
;
overflow
:
auto
;
}
.ranges
li
.active
,
td
.active
{
background-color
:
$color_havelock_blue_approx
;
}
.drp-buttons
{
.applyBtn
{
background-color
:
$color_havelock_blue_approx
;
border-color
:
$color_havelock_blue_approx
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/main.js
View file @
41eebcf4
...
...
@@ -348,7 +348,6 @@ require(['App',
startApp
();
}
});
this
.
businessMetadataDefCollection
.
fetch
({
complete
:
function
()
{
that
.
businessMetadataDefCollection
.
fullCollection
.
comparator
=
function
(
model
)
{
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/templates/search/SearchDefaultLayoutView_tmpl.html
View file @
41eebcf4
...
...
@@ -30,7 +30,7 @@
<button
class=
"btn-action btn-sm attribute-filter-text"
data-id=
'attrFilter'
>
<i
class=
"fa fa-angle-right"
></i>
Filters
</button>
<button
class=
'btn-action btn-sm'
data-id=
'clearQuerySearch'
>
Clear
</button>
<div
class=
"attribute-filter-container hide"
>
<div
class=
"panel panel-default expand_collapse_panel-icon"
data-id=
"includeExclude"
>
<div
class=
"panel panel-default expand_collapse_panel-icon"
data-id=
"includeExclude"
style=
"margin-bottom: 0px;"
>
<div
class=
"panel-heading"
data-toggle=
"collapse"
href=
"#collapseIncludeExclude"
aria-expanded=
"true"
>
<h4
class=
"panel-title"
>
<a>
Include/Exclude
</a>
...
...
@@ -40,8 +40,8 @@
</div>
</div>
<div
id=
"collapseIncludeExclude"
class=
"panel-collapse collapse in"
>
<div
class=
"panel-body"
>
<div
class=
"form-group filter-box"
>
<div
class=
"panel-body"
style=
"padding: 4px 15px;"
>
<div
class=
"form-group filter-box"
style=
"margin: 0;"
>
<div
class=
"entity-detail-table-toggle"
>
<div
class=
"pretty p-switch p-fill"
>
<input
type=
"checkbox"
data-id=
"checkDeletedEntity"
data-value=
"includeDE"
id=
"historicalentities"
/>
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/utils/CommonViewFunction.js
View file @
41eebcf4
...
...
@@ -16,7 +16,7 @@
* limitations under the License.
*/
define
([
'require'
,
'utils/Utils'
,
'modules/Modal'
,
'utils/Messages'
,
'utils/Enums'
,
'moment'
,
'utils/Globals'
],
function
(
require
,
Utils
,
Modal
,
Messages
,
Enums
,
moment
,
Globals
)
{
define
([
'require'
,
'utils/Utils'
,
'modules/Modal'
,
'utils/Messages'
,
'utils/Enums'
,
'moment'
,
'utils/Globals'
,
'moment-timezone'
],
function
(
require
,
Utils
,
Modal
,
Messages
,
Enums
,
moment
,
Globals
)
{
'use strict'
;
var
CommonViewFunction
=
{};
...
...
@@ -387,10 +387,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
function
objToString
(
filterObj
,
type
)
{
var
generatedQuery
=
_
.
map
(
filterObj
.
rules
,
function
(
obj
,
key
)
{
var
obj
=
$
.
extend
(
true
,
{},
obj
);
// not to update the timezone abbr on original obj , copy of obj is used
if
(
_
.
has
(
obj
,
'condition'
))
{
return
'<span class="operator">'
+
obj
.
condition
+
'</span>'
+
'('
+
objToString
(
obj
).
join
(
""
)
+
')'
;
}
else
{
if
(
isCapsuleView
)
{
if
(
obj
.
type
===
"date"
)
{
obj
.
value
=
obj
.
value
+
" ("
+
moment
.
tz
(
moment
.
tz
.
guess
()).
zoneAbbr
()
+
")"
;
}
return
'<div class="capsuleView"><span class="key">'
+
(
Enums
.
systemAttributes
[
obj
.
id
]
?
Enums
.
systemAttributes
[
obj
.
id
]
:
_
.
escape
(
obj
.
id
))
+
'</span><span class="operator">'
+
_
.
escape
(
obj
.
operator
)
+
'</span><span class="value">'
+
(
Enums
[
obj
.
id
]
?
Enums
[
obj
.
id
][
obj
.
value
]
:
_
.
escape
(
obj
.
value
))
+
"</span><div class='fa fa-close clear-attr' data-type="
+
type
+
" data-id="
+
_
.
escape
(
obj
.
id
)
+
"></div></div>"
;
}
return
'<span class="key">'
+
(
Enums
.
systemAttributes
[
obj
.
id
]
?
Enums
.
systemAttributes
[
obj
.
id
]
:
_
.
escape
(
obj
.
id
))
+
'</span><span class="operator">'
+
_
.
escape
(
obj
.
operator
)
+
'</span><span class="value">'
+
(
Enums
[
obj
.
id
]
?
Enums
[
obj
.
id
][
obj
.
value
]
:
_
.
escape
(
obj
.
value
))
+
"</span>"
;
...
...
@@ -507,6 +511,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if
(
Globals
[
value
[
skey
].
typeName
])
{
attributeDefs
=
Globals
[
value
[
skey
].
typeName
].
attributeDefs
;
}
if
(
Globals
.
_ALL_CLASSIFICATION_TYPES
&&
Globals
.
_ALL_CLASSIFICATION_TYPES
.
attributeDefs
)
{
attributeDefs
=
attributeDefs
.
concat
(
Globals
.
_ALL_CLASSIFICATION_TYPES
.
attributeDefs
);
}
}
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
,
"attributeDefs"
:
attributeDefs
});
}
else
if
(
k
==
"entityFilters"
)
{
...
...
@@ -523,6 +530,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if
(
Globals
[
value
[
skey
].
typeName
])
{
attributeDefs
=
Globals
[
value
[
skey
].
typeName
].
attributeDefs
;
}
if
(
Globals
.
_ALL_ENTITY_TYPES
&&
Globals
.
_ALL_ENTITY_TYPES
.
attributeDefs
)
{
attributeDefs
=
attributeDefs
.
concat
(
Globals
.
_ALL_ENTITY_TYPES
.
attributeDefs
);
}
}
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
,
"attributeDefs"
:
attributeDefs
});
}
else
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
...
...
@@ -564,7 +574,18 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
var
type
=
(
obj
.
type
||
obj
.
attributeType
),
//obj.value will come as an object when selected type is Date and operator is isNull or not_null;
value
=
((
_
.
isString
(
obj
.
value
)
&&
_
.
contains
([
"is_null"
,
"not_null"
],
obj
.
operator
)
&&
type
===
'date'
)
||
_
.
isObject
(
obj
.
value
)
?
""
:
_
.
trim
(
obj
.
value
||
obj
.
attributeValue
)),
url
=
[(
obj
.
id
||
obj
.
attributeName
),
mapApiOperatorToUI
(
obj
.
operator
),
(
type
===
'date'
&&
formatedDateToLong
&&
value
.
length
?
Date
.
parse
(
value
)
:
value
)];
url
=
[(
obj
.
id
||
obj
.
attributeName
),
mapApiOperatorToUI
(
obj
.
operator
),
value
];
if
(
obj
.
operator
===
"TIME_RANGE"
)
{
if
(
value
.
indexOf
(
"-"
)
>
-
1
)
{
url
[
2
]
=
value
.
split
(
'-'
).
map
(
function
(
udKey
)
{
return
Date
.
parse
(
udKey
.
trim
()).
toString
()
}).
join
(
","
)
}
else
{
url
[
2
]
=
Enums
.
queryBuilderDateRangeUIValueToAPI
[
_
.
trim
(
value
)]
||
value
;
}
}
else
if
(
value
.
length
&&
type
===
'date'
&&
formatedDateToLong
)
{
url
[
2
]
=
Date
.
parse
(
value
);
}
if
(
type
)
{
url
.
push
(
type
);
}
...
...
@@ -581,30 +602,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
function
mapApiOperatorToUI
(
oper
)
{
if
(
oper
==
"eq"
)
{
return
"="
;
}
else
if
(
oper
==
"neq"
)
{
return
"!="
;
}
else
if
(
oper
==
"lt"
)
{
return
"<"
;
}
else
if
(
oper
==
"lte"
)
{
return
"<="
;
}
else
if
(
oper
==
"gt"
)
{
return
">"
;
}
else
if
(
oper
==
"gte"
)
{
return
">="
;
}
else
if
(
oper
==
"startsWith"
)
{
return
"begins_with"
;
}
else
if
(
oper
==
"endsWith"
)
{
return
"ends_with"
;
}
else
if
(
oper
==
"contains"
)
{
return
"contains"
;
}
else
if
(
oper
==
"notNull"
)
{
return
"not_null"
;
}
else
if
(
oper
==
"isNull"
)
{
return
"is_null"
;
}
return
oper
;
// Enum will be in effect once we click on save search.
return
Enums
.
queryBuilderApiOperatorToUI
[
oper
]
||
oper
;
}
},
extractUrl
:
function
(
options
)
{
...
...
@@ -614,30 +613,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
spliter
=
1
,
apiObj
=
options
.
apiObj
,
mapUiOperatorToAPI
=
function
(
oper
)
{
if
(
oper
==
"="
)
{
return
"eq"
;
}
else
if
(
oper
==
"!="
)
{
return
"neq"
;
}
else
if
(
oper
==
"<"
)
{
return
"lt"
;
}
else
if
(
oper
==
"<="
)
{
return
"lte"
;
}
else
if
(
oper
==
">"
)
{
return
"gt"
;
}
else
if
(
oper
==
">="
)
{
return
"gte"
;
}
else
if
(
oper
==
"begins_with"
)
{
return
"startsWith"
;
}
else
if
(
oper
==
"ends_with"
)
{
return
"endsWith"
;
}
else
if
(
oper
==
"contains"
)
{
return
"contains"
;
}
else
if
(
oper
==
"not_null"
)
{
return
"notNull"
;
}
else
if
(
oper
==
"is_null"
)
{
return
"isNull"
;
}
return
oper
;
return
Enums
.
queryBuilderUIOperatorToAPI
[
oper
]
||
oper
;
},
createObject
=
function
(
urlObj
)
{
var
finalObj
=
{};
...
...
@@ -662,7 +638,17 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
if
(
temp
[
3
])
{
rule
[
'type'
]
=
temp
[
3
];
}
rule
.
value
=
rule
.
type
===
'date'
&&
formatDate
&&
rule
.
value
.
length
?
moment
(
parseInt
(
rule
.
value
)).
format
(
Globals
.
dateTimeFormat
)
:
rule
.
value
;
if
(
rule
.
operator
===
"TIME_RANGE"
)
{
if
(
temp
[
2
].
indexOf
(
","
)
>
-
1
)
{
rule
.
value
=
temp
[
2
].
split
(
","
).
map
(
function
(
udKey
)
{
return
moment
(
parseInt
(
udKey
.
trim
())).
format
(
Globals
.
dateTimeFormat
)
}).
join
(
" - "
)
}
else
{
rule
.
value
=
Enums
.
queryBuilderDateRangeAPIValueToUI
[
_
.
trim
(
rule
.
value
)]
||
rule
.
value
;
}
}
else
if
(
rule
.
type
===
'date'
&&
formatDate
&&
rule
.
value
.
length
)
{
rule
.
value
=
moment
(
parseInt
(
rule
.
value
)).
format
(
Globals
.
dateTimeFormat
)
}
}
return
rule
;
}
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/utils/Enums.js
View file @
41eebcf4
...
...
@@ -16,7 +16,7 @@
* limitations under the License.
*/
define
([
'require'
],
function
(
require
)
{
define
([
"require"
,
"backbone"
],
function
(
require
)
{
'use strict'
;
var
Enums
=
{};
...
...
@@ -219,5 +219,40 @@ define(['require'], function(require) {
0
:
"false"
,
1
:
"true"
};
Enums
.
queryBuilderUIOperatorToAPI
=
{
"="
:
"eq"
,
"!="
:
"neq"
,
"<"
:
"lt"
,
"<="
:
"lte"
,
">"
:
"gt"
,
">="
:
"gte"
,
"begins_with"
:
"startsWith"
,
"ends_with"
:
"endsWith"
,
"not_null"
:
"notNull"
,
"is_null"
:
"isNull"
,
"TIME_RANGE"
:
"timerange"
};
Enums
.
queryBuilderApiOperatorToUI
=
_
.
invert
(
Enums
.
queryBuilderUIOperatorToAPI
);
Enums
.
queryBuilderDateRangeUIValueToAPI
=
{
"Today"
:
"TODAY"
,
"Yesterday"
:
"YESTERDAY"
,
"Last 7 Days"
:
"LAST_7_DAYS"
,
"Last 30 Days"
:
"LAST_30_DAYS"
,
"This Month"
:
"THIS_MONTH"
,
"Last Month"
:
"LAST_MONTH"
,
"This Quarter"
:
"THIS_QUARTER"
,
"Last Quarter"
:
"LAST_QUARTER"
,
"This Year"
:
"THIS_YEAR"
,
"Last Year"
:
"LAST_YEAR"
,
"Last 3 Months"
:
"LAST_3_MONTHS"
,
"Last 6 Months"
:
"LAST_6_MONTHS"
,
"Last 12 Months"
:
"LAST_12_MONTHS"
};
Enums
.
queryBuilderDateRangeAPIValueToUI
=
_
.
invert
(
Enums
.
queryBuilderDateRangeUIValueToAPI
);
return
Enums
;
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/search/QueryBuilderView.js
View file @
41eebcf4
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
View file @
41eebcf4
...
...
@@ -242,7 +242,8 @@ define([
params
[
"entityFilters"
]
=
null
;
}
}
var
getUrl
=
Utils
.
getUrlState
.
isSearchTab
();
if
(
!
getUrl
)
{
that
.
typeId
=
null
;
}
if
(
that
.
typeId
!=
selectedNodeId
)
{
that
.
typeId
=
selectedNodeId
;
typeValue
=
name
;
...
...
This diff is collapsed.
Click to expand it.
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