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 {
}
.rule-value-container {
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 {
......@@ -305,9 +319,6 @@ td {
.rules-group-header .btn-group.group-conditions label {
display: none;
}
.rule-value-container input {
padding: 6px 12px !important;
}
.rules-group-container {
border: none;
background: none;
......
......@@ -72,6 +72,33 @@ define(['require'], function(require) {
},
"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;
});
\ No newline at end of file
......@@ -21,9 +21,10 @@ define(['require',
'hbs!tmpl/search/QueryBuilder_tmpl',
'utils/Utils',
'utils/CommonViewFunction',
'utils/Enums',
'query-builder',
'daterangepicker'
], function(require, Backbone, QueryBuilder_Tmpl, Utils, CommonViewFunction) {
], function(require, Backbone, QueryBuilder_Tmpl, Utils, CommonViewFunction, Enums) {
var QueryBuilderView = Backbone.Marionette.LayoutView.extend(
/** @lends QueryBuilderView */
......@@ -112,13 +113,18 @@ define(['require',
obj['values'] = ['true', 'false'];
}
_.extend(obj, this.getOperator(obj.type));
if (obj.type === "long" || obj.type === "float") {
obj.type = "double";
}
if (obj.type === "int" || obj.type === "byte" || obj.type === "short") {
obj.type = "integer";
}
return obj;
if (_.has(Enums.regex.RANGE_CHECK, obj.type)) {
obj.validation = {
min: Enums.regex.RANGE_CHECK[obj.type].min,
max: Enums.regex.RANGE_CHECK[obj.type].max
};
if (obj.type === "double" || obj.type === "float") {
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 });
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