Commit 6b4c3aa7 by pratik24mac Committed by Madhan Neethiraj

ATLAS-1921: basic-search UI: added range validation for entity/trait attributes

parent 0345cd41
...@@ -297,6 +297,20 @@ td { ...@@ -297,6 +297,20 @@ td {
} }
.rule-value-container { .rule-value-container {
display: inline-block !important; display: inline-block !important;
.form-control {
width: 220px !important;
padding: 6px 12px !important;
}
}
.rule-filter-container {
.form-control {
width: 200px !important;
}
}
.rule-operator-container {
.form-control {
width: auto !important;
}
} }
} }
.rules-list>:first-child::before { .rules-list>:first-child::before {
...@@ -305,9 +319,6 @@ td { ...@@ -305,9 +319,6 @@ td {
.rules-group-header .btn-group.group-conditions label { .rules-group-header .btn-group.group-conditions label {
display: none; display: none;
} }
.rule-value-container input {
padding: 6px 12px !important;
}
.rules-group-container { .rules-group-container {
border: none; border: none;
background: none; background: none;
......
...@@ -72,6 +72,33 @@ define(['require'], function(require) { ...@@ -72,6 +72,33 @@ define(['require'], function(require) {
}, },
"uiParameters": "uiParameters" "uiParameters": "uiParameters"
} }
Enums.regex = {
RANGE_CHECK: {
"byte": {
min: -128,
max: 127
},
"short": {
min: -32768,
max: 32767
},
"int": {
min: -2147483648,
max: 2147483647
},
"long": {
min: -9223372036854775808,
max: 9223372036854775807
},
"float": {
min: 1.4E-45,
max: 3.4028235E38
},
"double": {
min: 4.9E-324,
max: 1.7976931348623157E308
}
}
}
return Enums; return Enums;
}); });
\ No newline at end of file
...@@ -21,9 +21,10 @@ define(['require', ...@@ -21,9 +21,10 @@ define(['require',
'hbs!tmpl/search/QueryBuilder_tmpl', 'hbs!tmpl/search/QueryBuilder_tmpl',
'utils/Utils', 'utils/Utils',
'utils/CommonViewFunction', 'utils/CommonViewFunction',
'utils/Enums',
'query-builder', 'query-builder',
'daterangepicker' 'daterangepicker'
], function(require, Backbone, QueryBuilder_Tmpl, Utils, CommonViewFunction) { ], function(require, Backbone, QueryBuilder_Tmpl, Utils, CommonViewFunction, Enums) {
var QueryBuilderView = Backbone.Marionette.LayoutView.extend( var QueryBuilderView = Backbone.Marionette.LayoutView.extend(
/** @lends QueryBuilderView */ /** @lends QueryBuilderView */
...@@ -112,13 +113,18 @@ define(['require', ...@@ -112,13 +113,18 @@ define(['require',
obj['values'] = ['true', 'false']; obj['values'] = ['true', 'false'];
} }
_.extend(obj, this.getOperator(obj.type)); _.extend(obj, this.getOperator(obj.type));
if (obj.type === "long" || obj.type === "float") { if (_.has(Enums.regex.RANGE_CHECK, obj.type)) {
obj.type = "double"; obj.validation = {
} min: Enums.regex.RANGE_CHECK[obj.type].min,
if (obj.type === "int" || obj.type === "byte" || obj.type === "short") { max: Enums.regex.RANGE_CHECK[obj.type].max
obj.type = "integer"; };
} if (obj.type === "double" || obj.type === "float") {
return obj; obj.type = "double";
} else if (obj.type === "int" || obj.type === "byte" || obj.type === "short" || obj.type === "long") {
obj.type = "integer"
}
}
return obj;
} }
var enumObj = this.enumDefCollection.fullCollection.find({ name: obj.type }); var enumObj = this.enumDefCollection.fullCollection.find({ name: obj.type });
if (enumObj) { if (enumObj) {
......
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