diff --git a/.travis.yml b/.travis.yml index 441d2e1..f48f640 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ node_js: before_script: - npm install -g gulp - - rvm install ruby-2.2.3 + - rvm install ruby - gem install scss_lint script: diff --git a/gulpfile.js b/gulpfile.js index 45d2830..35ad06d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -38,7 +38,9 @@ gulp.task('default', ['lint', 'build', 'build-doc']); // Do everything. gulp.task('all', function(cb) { runSequence( - 'clean', + 'dist', ['lint', 'compile-all', 'build-doc'], + 'dist', + 'build', cb); }); diff --git a/src/data/data.js b/src/data/data.js index f6f423b..6d6c50a 100644 --- a/src/data/data.js +++ b/src/data/data.js @@ -20,12 +20,6 @@ visflow.TabularData; /** @const */ visflow.data = {}; -/** - * Counter to set process based dataIds. - * @type {number} - */ -visflow.data.counter = 0; - /** * Dimension index of item table index. * @const {number} @@ -35,6 +29,9 @@ visflow.data.INDEX_DIM = -1; /** @const {string} */ visflow.data.INDEX_TEXT = '[index]'; +/** @const {string} */ +visflow.data.EMPTY_DATA_ID = 'empty'; + /** * @typedef {{ * id: number, @@ -121,12 +118,7 @@ visflow.data.registerData = function(data) { visflow.error('attempt register null/empty data'); return; } - if (!(data.hash in visflow.data.hashToData)) { - visflow.data.hashToData[data.hash] = data; - data.dataId = ++visflow.data.counter; - } else { - data.dataId = visflow.data.hashToData[data.hash].dataId; - } + visflow.data.hashToData[data.hash] = data; }; /** @@ -141,7 +133,7 @@ visflow.Data = function(data) { dimensionTypes: [], dimensionDuplicate: [], values: [], - dataId: 0, + dataId: visflow.data.EMPTY_DATA_ID, type: '' }); return; @@ -169,9 +161,10 @@ visflow.Data = function(data) { /** * Data id assigned by the running system instance. - * @type {number} + * Use hash value as data id to identify data changes. + * @type {string} */ - this.dataId = data.dataId; + this.dataId = data.hash; /** * Type of data. It will be a hash value of the data's dimensions and diff --git a/src/filter/index.js b/src/filter/index.js index 97b5eea..d641be3 100644 --- a/src/filter/index.js +++ b/src/filter/index.js @@ -18,9 +18,9 @@ visflow.Filter = function(params) { /** * Last processed data id. By default it is empty data. - * @protected {number} + * @protected {string} */ - this.lastDataId = 0; + this.lastDataId = visflow.data.EMPTY_DATA_ID; }; _.inherit(visflow.Filter, visflow.Node); @@ -51,7 +51,7 @@ visflow.Filter.prototype.deserialize = function(save) { visflow.Filter.base.deserialize.call(this, save); this.lastDataId = save.lastDataId; if (this.lastDataId == null) { - this.lastDataId = 0; + this.lastDataId = visflow.data.EMPTY_DATA_ID; visflow.warning('filter lastDataId not saved'); } }; diff --git a/src/value/value-extractor/index.js b/src/value/value-extractor/index.js index 4a5e816..397b8eb 100644 --- a/src/value/value-extractor/index.js +++ b/src/value/value-extractor/index.js @@ -27,10 +27,10 @@ visflow.ValueExtractor = function(params) { }; /** - * Last applied data id. Default is empty data (0). - * @protected {number} + * Last applied data id. Default is empty data. + * @protected {string} */ - this.lastDataId = 0; + this.lastDataId = visflow.data.EMPTY_DATA_ID; }; _.inherit(visflow.ValueExtractor, visflow.Node); diff --git a/src/visualization/index.js b/src/visualization/index.js index a4e9fe3..8a44511 100644 --- a/src/visualization/index.js +++ b/src/visualization/index.js @@ -55,10 +55,10 @@ visflow.Visualization = function(params) { this.brushPoints = []; /** - * Last used dataset ID. - * @protected {number} + * Last used dataset ID. Default is empty data. + * @protected {string} */ - this.lastDataId = 0; // Default: empty data + this.lastDataId = visflow.data.EMPTY_DATA_ID; /** * Whether rendering should be using transition. When the view is resized, @@ -112,7 +112,7 @@ visflow.Visualization.prototype.deserialize = function(save) { this.lastDataId = save.lastDataId; if (this.lastDataId == null) { visflow.error('lastDataId not saved in visualization'); - this.lastDataId = 0; + this.lastDataId = visflow.data.EMPTY_DATA_ID; } this.fillOptions(this.options, this.visualizationOptions()); }; diff --git a/src/visualization/network/index.js b/src/visualization/network/index.js index 67fcdf3..27b939a 100644 --- a/src/visualization/network/index.js +++ b/src/visualization/network/index.js @@ -83,9 +83,9 @@ visflow.Network = function(params) { /** * Last data id for edges. - * @protected {number} + * @protected {string} */ - this.lastEdgeDataId = 0; + this.lastEdgeDataId = visflow.data.EMPTY_DATA_ID; // Navigation state. /** @private {!Array} */