From 41d52344767f82375e83d7e1a11d18dbe64f281c Mon Sep 17 00:00:00 2001 From: Justin Smethie Date: Mon, 18 Jul 2016 14:00:45 -0600 Subject: [PATCH] -Fixed locking issue when trying to edit a Dashboard through the Dashboard Builder --- geoprism-web/pom.xml | 8 ++-- .../net/geoprism/service/BuilderService.js | 38 +++++++++++-------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/geoprism-web/pom.xml b/geoprism-web/pom.xml index b2d083178..5baba081c 100644 --- a/geoprism-web/pom.xml +++ b/geoprism-web/pom.xml @@ -115,8 +115,8 @@ **/*catalina*.jar, **/*servlet-api*.jar, **/*annotations-api*.jar, - - **/*aspectjtools*.jar + + **/aspectjtools*.jar @@ -346,8 +346,8 @@ **/*catalina*.jar, **/*servlet-api*.jar, **/*annotations-api*.jar, - - **/*aspectjtools*.jar + + **/aspectjtools*.jar diff --git a/geoprism-web/src/main/webapp/net/geoprism/service/BuilderService.js b/geoprism-web/src/main/webapp/net/geoprism/service/BuilderService.js index 0bea72e79..3d7a33aa3 100644 --- a/geoprism-web/src/main/webapp/net/geoprism/service/BuilderService.js +++ b/geoprism-web/src/main/webapp/net/geoprism/service/BuilderService.js @@ -49,40 +49,47 @@ service.loadDashboard = function(dashboardId, onSuccess, onFailure) { - var request = runwayService.createRequest(function(json, dto) { + /* + * Second: Get all options + */ + var request = runwayService.createRequest(function(json, dto) { service.dto = dto; - + var object = JSON.parse(json); - + var result = {}; // Populate the list of country options // ORDER MATTERS for this array of field names. Fields will be added to the form in order. var attributeNames = ['displayLabel', 'description', 'name']; - + if(dto.isNewInstance()) { attributeNames = ['displayLabel', 'description']; } - + result.fields = runwayService.getFields(service.dto, attributeNames); - + // Overwrite name field options if(!dto.isNewInstance()) { result.fields[2].writable = dto.isNewInstance(); } - + result.object = object; - + onSuccess(result); - + }, onFailure); - if(dashboardId != null) { - var dto = new net.geoprism.dashboard.Dashboard(); - dto.id = dashboardId; - dto.newInstance = false; - dto.attributeMap.id.value = dashboardId; - dto.getDashboardDefinition(request); + if(dashboardId != null) { + + /* + * First: Lock the dashboard object + */ + var lockRequest = runwayService.createRequest(function(dto){ + dto.getDashboardDefinition(request); + }); + + net.geoprism.dashboard.Dashboard.lock(lockRequest, dashboardId); } else { var dto = new net.geoprism.dashboard.Dashboard(); @@ -90,6 +97,7 @@ } } + return service; }