validation improvements

4.x.x
kamidu 7 years ago
parent 086eeecb01
commit cdff923aab

@ -77,7 +77,10 @@ function getTileServers() {
$.getJSON("/api/controllers/tile_servers?serverId=all", function (data) {
console.log(JSON.stringify(data));
$.each(data, function (key, val) {
noty({text: 'Loading... <span style="color: #ccfcff">' + val.NAME + '</span>', type: 'info'});
noty({
text: 'Loading... <span style="color: #ccfcff">' + val.NAME + '</span>',
type: 'info'
});
//baseLayers[val.name]
var newTileLayer = L.tileLayer(
val.URL, {
@ -153,7 +156,10 @@ function addWmsEndPoint() {
// TODO: If failure happens notify user about the error message
$.post(serverUrl, data, function (response) {
console.log("------->><wms_endpoints>" + response);
noty({text: '<span style="color: dodgerblue">' + response + '</span>',type: 'success'});
noty({
text: '<span style="color: dodgerblue">' + response + '</span>',
type: 'success'
});
closeAll();
});
}
@ -235,10 +241,11 @@ function setWithinAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty.";
noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) {
} else if ($.trim(areaName).indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type: 'error'});
} else {
areaName = $.trim(areaName);
var data = {
'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedAreaGeoJson,
@ -293,10 +300,11 @@ function setExitAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty.";
noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) {
} else if ($.trim(areaName).indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type: 'error'});
} else {
areaName = $.trim(areaName);
var data = {
'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedAreaGeoJson,
@ -358,7 +366,7 @@ function setStationeryAlert(leafletId) {
if (stationeryName == null || stationeryName === undefined || stationeryName == "") {
var message = "Stationery Name cannot be empty.";
noty({text: message, type: 'error'});
} else if (stationeryName.indexOf(" ") > -1) {
} else if ($.trim(stationeryName).indexOf(" ") > -1) {
var message = "Stationery Name cannot contain spaces.";
noty({text: message, type: 'error'});
} else if (fluctuationRadius == null || fluctuationRadius === undefined || fluctuationRadius == "") {
@ -368,6 +376,7 @@ function setStationeryAlert(leafletId) {
var message = "Time cannot be empty.";
noty({text: message, type: 'error'});
} else {
stationeryName = $.trim(stationeryName);
var data = {
'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedProcessedAreaGeoJson,
@ -477,10 +486,11 @@ function setTrafficAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty.";
noty({text: message, type: 'error'});
} else if (areaName.indexOf(" ") > -1) {
} else if ($.trim(areaName).indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type: 'error'});
} else {
areaName = $.trim(areaName);
var data = {
'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedProcessedAreaGeoJson,
@ -541,7 +551,6 @@ function removeGeoFence(geoFenceElement, id) {
}
function getAlertsHistory(deviceType, deviceId, timeFrom, timeTo) {
var timeRange = '';
if (timeFrom && timeTo) {
@ -591,7 +600,10 @@ function setProximityAlert() {
} else {
var data = {
'parseData': JSON.stringify({'proximityTime': proximityTime, 'proximityDistance': proximityDistance}),
'parseData': JSON.stringify({
'proximityTime': proximityTime,
'proximityDistance': proximityDistance
}),
'proximityTime': proximityTime,
'proximityDistance': proximityDistance,
'executionPlan': 'Proximity',

Loading…
Cancel
Save