Skip to content

Commit

Permalink
Bug Fixes for querying the POI layer and extended properties
Browse files Browse the repository at this point in the history
Fixed the following bugs:
- POIs are not being filtered out correctly on the map (49111)
- LOIs are cleared out after updating job properties (49060)
- Extended properties should not enforce required field for not
implemented functionality (45969)
  • Loading branch information
llam001 committed Aug 15, 2016
1 parent e5cc262 commit b7281ab
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
15 changes: 10 additions & 5 deletions js/app/WorkflowManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,11 @@ define([
var self = lang.hitch(this);
this.wmConfigurationTask.getVisibleJobTypes(username, function (response) {
self.visibleJobTypes = response.jobTypes;
// init framework
self.initFrameworkUI();
}, function (error) {
// init framework
self.initFrameworkUI();
});
},

Expand Down Expand Up @@ -727,6 +732,7 @@ define([
var queryName = self.filter.content.setQueryNameFromId(self.queryIDInURL);
if (queryName) {
self.savedQuery = queryName;
queryID = self.queryIDInURL;
}
self.queryIDInURL = null;
}
Expand Down Expand Up @@ -1135,7 +1141,7 @@ define([

// set map aoi
topic.publish(appTopics.map.clearGraphics, null);
var loi = data.aoi ? data.aoi : data.poi;
var loi = data.aoi ? data.aoi : data.loi;
self.selectJobLOI(args.jobId, loi, args.zoomToFeature);

//set draw tool buttons
Expand Down Expand Up @@ -1849,6 +1855,7 @@ define([
var self = lang.hitch(this);
this.myMap = new EsriMap({
mapConfig : config.map,
poiLayerID : config.app.jobLOILayer.POILayerID,
aoiLayerID : config.app.jobLOILayer.AOILayerID,
mapTopics : appTopics.map,
mapId : self.mapPanel.id,
Expand Down Expand Up @@ -2013,7 +2020,7 @@ define([
console.log(errMsg, error);
self.errorHandler(errMsg, error);
});
})
});

topic.subscribe(appTopics.filter.jobSearch, function(sender, args) {
if (args.value == "") {
Expand Down Expand Up @@ -2602,10 +2609,8 @@ define([
self.initUserPrivileges(data.privileges);
// user queries
self.userQueries = data.userQueries;
//Load Visible Job Types
//Load Visible Job Types and then initialize UI framework afterward
self.initVisibleJobTypes(data.userName);
// initialize UI framework
self.initFrameworkUI();
}

}, function(error) {
Expand Down
2 changes: 1 addition & 1 deletion js/app/WorkflowManager/AttachmentItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ function (
return url;
}
});
});
});
17 changes: 12 additions & 5 deletions js/app/WorkflowManager/ExtendedPropertiesItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,9 @@ function (

setRequired: function (index) {
// toggle the required asterisk

var field = this.field;
var data = field.get('value');
if (this.required) {
if (this.isRequiredField()) {
this.fieldRequired.style.display = "";
} else {
this.fieldRequired.style.display = "none";
Expand All @@ -244,7 +243,7 @@ function (

var field = this.field;
var data = field.get('value');
if (((data == null || data == "") && this.required) || field.state == "Error") {
if (((data == null || data == "") && this.isRequiredField()) || field.state == "Error") {
field.set('state', "Error");
} else {
field.set('state', "");
Expand Down Expand Up @@ -446,9 +445,9 @@ function (
}
var state = field.state;
//flagging
if (((data == null || data == "") && this.required) || state == "Error") {
if (((data == null || data == "") && this.isRequiredField()) || state == "Error") {
this.setHighlight();
if (!(data === undefined) && (data == null || data == "") && this.required) {
if (!(data === undefined) && (data == null || data == "") && this.isRequiredField()) {
topic.publish(appTopics.extendedProperties.invalidUpdate, this, { missingField: true });
} else {
topic.publish(appTopics.extendedProperties.invalidUpdate, this, { invalidField: true });
Expand All @@ -473,6 +472,14 @@ function (
}
}
},

isRequiredField : function() {
// The field is only required if it's not an unsupported type (file, folder, geofile)
return this.required && this.displayType != Enum.ExtendedPropertyDisplayType.FILE
&& this.displayType != Enum.ExtendedPropertyDisplayType.FOLDER
&& this.displayType != Enum.ExtendedPropertyDisplayType.GEO_FILE;
},

generateRandomIndex : function() {
// generate a random number from 1 to specified max value (1000000000000)
return Math.floor((Math.random() * 1000000000000) + 1);
Expand Down
6 changes: 4 additions & 2 deletions js/app/WorkflowManager/Properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function (
this.jobStartDateControl.set("value", job.startDate);
this.jobDueDateControl.set("value", job.dueDate);

if (job.aoi || job.poi) {
if (job.aoi || job.loi) {
this.propertiesFormLOI.innerHTML = this.i18n_LoiDefined;
} else {
this.propertiesFormLOI.innerHTML = this.i18n_LoiUndefined;
Expand Down Expand Up @@ -766,7 +766,9 @@ function (
para.clearDueDate = true;
}

//AOI
//AOI / LOI
para.aoi = this.currentJob.aoi;
para.loi = this.currentJob.loi;
if ((this.currentJob.aoi != this.propertiesFormLOI.innerHTML) && (this.propertiesFormLOI.innerHTML == "")) {
para.clearAOI = true;
};
Expand Down
10 changes: 7 additions & 3 deletions js/app/WorkflowManager/libs/workflowmanager/WMJobTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ define("workflowmanager/WMJobTask", [
response.startDate = util.convertToDate(response.startDate);
response.startedDate = util.convertToDate(response.startedDate);
response.dueDate = util.convertToDate(response.dueDate);
if (response.aoi)
if (response.aoi) {
response.aoi = new esri.geometry.Polygon(response.aoi);
if (response.poi)
response.poi = new esri.geometry.Multipoint(response.poi);
response.loi = new esri.geometry.Polygon(response.aoi);
}
if (response.poi) {
response.loi = new esri.geometry.Multipoint(response.poi);
delete response.poi; // response should not include the poi, just loi
}
successCallBack(response);
}, errorCallBack);
},
Expand Down
8 changes: 5 additions & 3 deletions js/widget/gis/EsriMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ define([
var poiReq = null;
if (self.poiQueryTask) {
var poiQuery = new Query();
poiQuery .returnGeometry = true;
poiQuery .outSpatialReference = self.map.spatialReference;
poiQuery .where = self.poiJobIdField + "=" + jobId;
poiQuery.returnGeometry = true;
poiQuery.outSpatialReference = self.map.spatialReference;
poiQuery.where = self.poiJobIdField + "=" + jobId;
poiReq = self.poiQueryTask.execute(poiQuery);
}

Expand Down Expand Up @@ -626,6 +626,8 @@ define([
getUpdatedFeatures: function (jobIds) {
this.selectedJobIds = jobIds;
var layerDefinitions = [];
if (this.poiLayerID != null)
layerDefinitions[this.poiLayerID] = this.poiJobIdField + " in (" + jobIds.join() + ")";
layerDefinitions[this.aoiLayerID] = this.jobIdField + " in (" + jobIds.join() + ")";
this.aoiDynamicLayer.setLayerDefinitions(layerDefinitions);
this.setMapExtent();
Expand Down

0 comments on commit b7281ab

Please sign in to comment.