From 96f408df731de7de5989947c3af89118d281455f Mon Sep 17 00:00:00 2001 From: Glen Javier Date: Tue, 14 Feb 2017 22:36:18 +1000 Subject: [PATCH 1/5] modifying batchUpdate to work with addWidget --- src/gridstack.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/gridstack.js b/src/gridstack.js index 39d250a..46e19a6 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -169,6 +169,7 @@ this._addedNodes = []; this._removedNodes = []; + this._batchQueue = []; }; GridStackEngine.prototype.batchUpdate = function() { @@ -176,9 +177,19 @@ this.float = true; }; - GridStackEngine.prototype.commit = function() { + GridStackEngine.prototype.commit = function(grid) { if (this._updateCounter !== 0) { this._updateCounter = 0; + + _.each(this._batchQueue, function(el) { + grid.container.append(el); + grid._prepareElement(el, true); + grid._triggerAddEvent(); + grid._updateContainerHeight(); + grid._triggerChangeEvent(true); + }); + this._batchQueue = []; + this.float = this._float; this._packNodes(); this._notify(); @@ -1264,11 +1275,18 @@ if (typeof minHeight != 'undefined') { el.attr('data-gs-min-height', minHeight); } if (typeof maxHeight != 'undefined') { el.attr('data-gs-max-height', maxHeight); } if (typeof id != 'undefined') { el.attr('data-gs-id', id); } - this.container.append(el); - this._prepareElement(el, true); - this._triggerAddEvent(); - this._updateContainerHeight(); - this._triggerChangeEvent(true); + + + console.log(this.grid._updateCounter); + if (this.grid._updateCounter) { + this.grid._batchQueue.push(el); + } else { + this.container.append(el); + this._prepareElement(el, true); + this._triggerAddEvent(); + this._updateContainerHeight(); + this._triggerChangeEvent(true); + } return el; }; @@ -1592,7 +1610,7 @@ }; GridStack.prototype.commit = function() { - this.grid.commit(); + this.grid.commit(this); this._updateContainerHeight(); }; From c22303e500e2992faa656f25e133804f3d0717cd Mon Sep 17 00:00:00 2001 From: Glen Javier Date: Fri, 17 Feb 2017 11:23:24 +1000 Subject: [PATCH 2/5] fixing build; removed debug code --- src/gridstack.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gridstack.js b/src/gridstack.js index 46e19a6..34108cd 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -180,7 +180,6 @@ GridStackEngine.prototype.commit = function(grid) { if (this._updateCounter !== 0) { this._updateCounter = 0; - _.each(this._batchQueue, function(el) { grid.container.append(el); grid._prepareElement(el, true); @@ -189,7 +188,6 @@ grid._triggerChangeEvent(true); }); this._batchQueue = []; - this.float = this._float; this._packNodes(); this._notify(); @@ -1276,8 +1274,6 @@ if (typeof maxHeight != 'undefined') { el.attr('data-gs-max-height', maxHeight); } if (typeof id != 'undefined') { el.attr('data-gs-id', id); } - - console.log(this.grid._updateCounter); if (this.grid._updateCounter) { this.grid._batchQueue.push(el); } else { From 29f0056c874072336109f6cf4703f1ef19997149 Mon Sep 17 00:00:00 2001 From: Glen Javier Date: Fri, 17 Feb 2017 11:45:11 +1000 Subject: [PATCH 3/5] Updating nodejs version to fixed webdriver-manager update error; More details here: https://github.com/angular/webdriver-manager/issues/170 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f8cde47..7df4ed4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: -- 5.7.0 +- 6.9.1 env: - CXX=g++-4.8 addons: From 6423d122b2e92eee213cf09cde4d579a864b5423 Mon Sep 17 00:00:00 2001 From: Glen Javier Date: Fri, 17 Feb 2017 12:13:32 +1000 Subject: [PATCH 4/5] updating dev-dependencies; possible fix for build timeout --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index b203ab8..9733c61 100644 --- a/package.json +++ b/package.json @@ -33,19 +33,19 @@ "connect": "^3.4.1", "coveralls": "^2.11.8", "doctoc": "^1.0.0", - "grunt": "^0.4.5", + "grunt": "^1.0.1", "grunt-cli": "^1.2.0", - "grunt-contrib-connect": "^0.11.2", - "grunt-contrib-copy": "^0.8.2", - "grunt-contrib-cssmin": "^0.14.0", + "grunt-contrib-connect": "^1.0.2", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-cssmin": "^2.0.0", "grunt-contrib-jshint": "^1.0.0", - "grunt-contrib-uglify": "^0.11.1", - "grunt-contrib-watch": "^0.6.1", + "grunt-contrib-uglify": "^2.1.0", + "grunt-contrib-watch": "^1.0.0", "grunt-doctoc": "^0.1.1", - "grunt-jscs": "^2.8.0", - "grunt-protractor-runner": "^3.2.0", + "grunt-jscs": "^3.0.1", + "grunt-protractor-runner": "^4.0.0", "grunt-protractor-webdriver": "^0.2.5", - "grunt-sass": "^1.1.0", + "grunt-sass": "^2.0.0", "jasmine-core": "^2.4.1", "karma": "^1.1.2", "karma-coverage": "^1.1.1", From 2f293c3fe4f5f1ac37f9539e40d789694b49b3a1 Mon Sep 17 00:00:00 2001 From: Glen Javier Date: Fri, 17 Feb 2017 12:21:11 +1000 Subject: [PATCH 5/5] updating npm from v2 to v3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7df4ed4..b1639ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ addons: before_install: - npm install -g protractor install: -- npm install -g npm@2 +- npm install -g npm@^3 - npm install -g grunt-cli - npm install -g bower - bower install