Skip to content

Commit

Permalink
cancel long running load on filter change
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrjo committed Nov 27, 2018
1 parent d349a98 commit 6a796d5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 21 deletions.
37 changes: 23 additions & 14 deletions CustomChartApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ Ext.define('CustomChartApp', {
},

_addChart: function() {
// If there is a current chart store, force it to stop loading pages
// Note that recreating the grid will then create a new chart store with
// the same store ID.
var chartStore = Ext.getStore('chartStore');
if (chartStore) {
chartStore.cancelLoad();
}

var gridArea = this.down('#grid-area')
gridArea.removeAll();

Expand Down Expand Up @@ -202,7 +210,7 @@ Ext.define('CustomChartApp', {
}
};

gridArea.add(gridBoardConfig);
this.gridboard = gridArea.add(gridBoardConfig);
},

_getQuickFilters: function() {
Expand Down Expand Up @@ -233,20 +241,21 @@ Ext.define('CustomChartApp', {
model = this.models[0],
config = {
xtype: chartType,
enableStacking: !!stackField,
chartColors: [
"#FF8200", // $orange
"#F6A900", // $gold
"#FAD200", // $yellow
"#8DC63F", // $lime
"#1E7C00", // $green_dk
"#337EC6", // $blue_link
"#005EB8", // $blue
"#7832A5", // $purple,
"#DA1884", // $pink,
"#C0C0C0" // $grey4
],
enableStacking: !!stackField,
chartColors: [
"#FF8200", // $orange
"#F6A900", // $gold
"#FAD200", // $yellow
"#8DC63F", // $lime
"#1E7C00", // $green_dk
"#337EC6", // $blue_link
"#005EB8", // $blue
"#7832A5", // $purple,
"#DA1884", // $pink,
"#C0C0C0" // $grey4
],
storeConfig: {
storeId: 'chartStore',
context: this.getContext().getDataContext(),
//TODO: can we do summary fetch here and not limit infinity?
//we'll have to also make sure the fetch is correct for export somehow...
Expand Down
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"sdk": "2.1",
"javascript": [
"Overrides.js",
"node_modules/@agile-central-technical-services/utils-cancel-store-load/index.js",
"node_modules/@agile-central-technical-services/utils-ancestor-pi-app-filter/index.js",
"node_modules/@agile-central-technical-services/utils-ancestor-pi-inline-filter/index.js",
"Config.js",
Expand Down
10 changes: 5 additions & 5 deletions deploy/Ugly.txt

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CustomChart",
"version": "1.3.6",
"version": "1.3.7",
"scripts": {
"debug": "grunt debug",
"debug:watch": "nodemon --exec grunt debug",
Expand All @@ -10,7 +10,8 @@
},
"dependencies": {
"@agile-central-technical-services/utils-ancestor-pi-app-filter": "^2.3.0",
"@agile-central-technical-services/utils-ancestor-pi-inline-filter": "^1.0.12"
"@agile-central-technical-services/utils-ancestor-pi-inline-filter": "^1.0.12",
"@agile-central-technical-services/utils-cancel-store-load": "^1.0.0"
},
"devDependencies": {
"grunt": "~0.4.5",
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
version "1.0.12"
resolved "https://registry.yarnpkg.com/@agile-central-technical-services/utils-ancestor-pi-inline-filter/-/utils-ancestor-pi-inline-filter-1.0.12.tgz#eb82287496305bec975beea03ff7a510588e05ee"

"@agile-central-technical-services/utils-cancel-store-load@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@agile-central-technical-services/utils-cancel-store-load/-/utils-cancel-store-load-1.0.0.tgz#db58fb143466cb3a111b785a9512b211a5211b6b"

"@sinonjs/commons@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.0.2.tgz#3e0ac737781627b8844257fadc3d803997d0526e"
Expand Down

0 comments on commit 6a796d5

Please sign in to comment.