Skip to content

Commit

Permalink
Merge pull request #316 from andygup/v2.6.1
Browse files Browse the repository at this point in the history
V2.6.1
  • Loading branch information
andygup committed Apr 13, 2015
2 parents 6740165 + 29cc636 commit bd2b14c
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 19 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# offline-editor-js - Changelog

## Version 2.6.1 - April 13, 2015

Patch release. Recommended update. No breaking changes.

**Bug Fixes**

* Closes #315 - editsStore.pushEdit() - failed to insert undefined objectId into database.

## Version 2.6 - April 9, 2015

Recommended update. No breaking changes.
Expand Down
4 changes: 2 additions & 2 deletions dist/offline-edit-min.js

Large diffs are not rendered by default.

26 changes: 21 additions & 5 deletions dist/offline-edit-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/*jshint -W030 */
Expand Down Expand Up @@ -94,6 +94,13 @@ define([
extend: function (layer, callback, dataStore) {
var self = this;

// NOTE: At v2.6.1 we've discovered that not all feature layers support objectIdField.
// However, we want to try to be consistent here with how the library is managing Ids.
// So, we force the layer.objectIdField to DB_UID. This should be consistent with
// how esri.Graphics assign a unique ID to a graphic. If it is not, then this
// library will break and we'll have to re-architect how we manage UIDs.
layer.objectIdField = this.DB_UID;

// Initialize the database as well as set offline data.
this._initializeDB(dataStore,callback);

Expand All @@ -113,9 +120,9 @@ define([
operations supported offline:
1. add a new attachment to an existing feature (DONE)
2. add a new attachment to a new feature (DONE)
3. remove an attachment that is already in the server... (NOT YET)
3. remove an attachment that is already in the server... (DONE)
4. remove an attachment that is not in the server yet (DONE)
5. update an existing attachment to an existing feature (NOT YET)
5. update an existing attachment to an existing feature (DONE)
6. update a new attachment (NOT YET)
concerns:
Expand Down Expand Up @@ -289,6 +296,7 @@ define([
var deferred = new Deferred();

var objectId = this._getNextTempId();

addEdit.attributes[this.objectIdField] = objectId;

var thisLayer = this;
Expand Down Expand Up @@ -398,7 +406,7 @@ define([
return deferred1;

}; // layer.applyEdits()

/**
* Converts an array of graphics/features into JSON
* @param features
Expand All @@ -407,7 +415,15 @@ define([
*/
layer.convertGraphicLayerToJSON = function (features, updateEndEvent, callback) {
var layerDefinition = {};
layerDefinition.objectIdFieldName = updateEndEvent.target.objectIdField;

// We want to be consistent, but we've discovered that not all feature layers have an objectIdField
if(updateEndEvent.target.hasOwnProperty("objectIdField"))
{
layerDefinition.objectIdFieldName = updateEndEvent.target.objectIdField;
}else {
layerDefinition.objectIdFieldName = this.objectIdField;
}

layerDefinition.globalIdFieldName = updateEndEvent.target.globalIdField;
layerDefinition.geometryType = updateEndEvent.target.geometryType;
layerDefinition.spatialReference = updateEndEvent.target.spatialReference;
Expand Down
2 changes: 1 addition & 1 deletion dist/offline-tiles-advanced-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/offline-tiles-advanced-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define([
Expand Down
2 changes: 1 addition & 1 deletion dist/offline-tiles-basic-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/offline-tiles-basic-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define([
Expand Down
2 changes: 1 addition & 1 deletion dist/offline-tpk-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/offline-tpk-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/**
Expand Down
24 changes: 20 additions & 4 deletions lib/edit/offlineFeaturesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ define([
extend: function (layer, callback, dataStore) {
var self = this;

// NOTE: At v2.6.1 we've discovered that not all feature layers support objectIdField.
// However, we want to try to be consistent here with how the library is managing Ids.
// So, we force the layer.objectIdField to DB_UID. This should be consistent with
// how esri.Graphics assign a unique ID to a graphic. If it is not, then this
// library will break and we'll have to re-architect how we manage UIDs.
layer.objectIdField = this.DB_UID;

// Initialize the database as well as set offline data.
this._initializeDB(dataStore,callback);

Expand All @@ -110,9 +117,9 @@ define([
operations supported offline:
1. add a new attachment to an existing feature (DONE)
2. add a new attachment to a new feature (DONE)
3. remove an attachment that is already in the server... (NOT YET)
3. remove an attachment that is already in the server... (DONE)
4. remove an attachment that is not in the server yet (DONE)
5. update an existing attachment to an existing feature (NOT YET)
5. update an existing attachment to an existing feature (DONE)
6. update a new attachment (NOT YET)
concerns:
Expand Down Expand Up @@ -286,6 +293,7 @@ define([
var deferred = new Deferred();

var objectId = this._getNextTempId();

addEdit.attributes[this.objectIdField] = objectId;

var thisLayer = this;
Expand Down Expand Up @@ -395,7 +403,7 @@ define([
return deferred1;

}; // layer.applyEdits()

/**
* Converts an array of graphics/features into JSON
* @param features
Expand All @@ -404,7 +412,15 @@ define([
*/
layer.convertGraphicLayerToJSON = function (features, updateEndEvent, callback) {
var layerDefinition = {};
layerDefinition.objectIdFieldName = updateEndEvent.target.objectIdField;

// We want to be consistent, but we've discovered that not all feature layers have an objectIdField
if(updateEndEvent.target.hasOwnProperty("objectIdField"))
{
layerDefinition.objectIdFieldName = updateEndEvent.target.objectIdField;
}else {
layerDefinition.objectIdFieldName = this.objectIdField;
}

layerDefinition.globalIdFieldName = updateEndEvent.target.globalIdField;
layerDefinition.geometryType = updateEndEvent.target.geometryType;
layerDefinition.spatialReference = updateEndEvent.target.spatialReference;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "offline-editor-js",
"version": "2.6.0",
"version": "2.6.1",
"description": "Lightweight set of libraries for working offline with map tiles and ArcGIS feature services",
"author": "Andy Gup <[email protected]> (http://blog.andygup.net)",
"license": "Apache 2",
Expand Down
2 changes: 1 addition & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"appHomePage": "appcache-features.html",
"optimizedApiURL": "../samples/jsolib",
"arcGISBaseURL": "http://js.arcgis.com/3.11",
"version": "2.6.0",
"version": "2.6.1",
"private": true,
"description": "manifest generator project",
"repository": {
Expand Down

0 comments on commit bd2b14c

Please sign in to comment.