Skip to content

Commit 7d4709e

Browse files
committed
#8149 ensuring all "main.addon" related remote calls pass windowId
1 parent d3d40dd commit 7d4709e

19 files changed

+191
-148
lines changed

apps/colors/view/ViewportController.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class ViewportController extends Controller {
301301
*/
302302
async onEnableWindowManagementClick(data) {
303303
let me = this,
304-
response = await Neo.main.addon.DragDrop.requestWindowManagementPermission(),
304+
response = await Neo.main.addon.DragDrop.requestWindowManagementPermission({windowId: me.windowId}),
305305
button = me.getReference('window-management-button');
306306

307307
if (response.success) {

apps/covid/view/TableContainerController.mjs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ class TableContainerController extends ComponentController {
232232
* {Object} data
233233
*/
234234
onDailyValuesChange(data) {
235-
let chartId = this.getReference('line-chart').id,
236-
logCheckbox = this.getReference('logarithmic-scale-checkbox'),
235+
let me = this,
236+
{windowId} = me,
237+
chartId = me.getReference('line-chart').id,
238+
logCheckbox = me.getReference('logarithmic-scale-checkbox'),
237239
value = data.value;
238240

239241
if (value) {
@@ -252,12 +254,14 @@ class TableContainerController extends ComponentController {
252254
'series.values.1.dataFields.valueY' : value ? 'dailyCases' : 'cases',
253255
'series.values.2.dataFields.valueY' : value ? 'dailyDeaths' : 'deaths',
254256
'series.values.3.dataFields.valueY' : value ? 'dailyRecovered' : 'recovered'
255-
}
257+
},
258+
windowId
256259
});
257260

258261
Neo.main.addon.AmCharts.callMethod({
259-
id : chartId,
260-
path: 'invalidateData'
262+
id : chartId,
263+
path : 'invalidateData',
264+
windowId
261265
});
262266
}
263267

@@ -266,9 +270,10 @@ class TableContainerController extends ComponentController {
266270
*/
267271
onLogarithmicScaleChange(data) {
268272
Neo.main.addon.AmCharts.setProperty({
269-
id : this.getReference('line-chart').id,
270-
path : 'yAxes.values.0.logarithmic',
271-
value: data.value
273+
id : this.getReference('line-chart').id,
274+
path : 'yAxes.values.0.logarithmic',
275+
value : data.value,
276+
windowId: this.windowId
272277
});
273278
}
274279

apps/covid/view/WorldMapComponent.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class WorldMapComponent extends AmChartComponent {
8181
* @param {Object[]} data
8282
*/
8383
loadData(data) {
84-
const chartData = [];
84+
let me = this,
85+
chartData = [];
8586

8687
data.forEach(item => {
8788
chartData.push({
@@ -92,14 +93,15 @@ class WorldMapComponent extends AmChartComponent {
9293
id : item.countryInfo.iso2,
9394
name : item.country,
9495
recovered: item.recovered,
95-
});
96+
})
9697
});
9798

9899
Neo.main.addon.AmCharts.updateData({
99100
data : chartData,
100-
dataPath: this.dataPath,
101-
id : this.id
102-
});
101+
dataPath: me.dataPath,
102+
id : me.id,
103+
windowId: me.windowId
104+
})
103105
}
104106
}
105107

apps/covid/view/WorldMapContainerController.mjs

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@ class WorldMapContainerController extends ComponentController {
2222
}
2323

2424
changeHeatRule(value) {
25-
const chartId = this.getReference('worldmap').id;
25+
let me = this,
26+
{windowId} = me,
27+
chartId = me.getReference('worldmap').id;
2628

2729
Neo.main.addon.AmCharts.setProperty({
28-
id : this.getReference('worldmap').id,
29-
path : 'series.values.0.heatRules.values.0.maxValue',
30-
value : value
30+
id : me.getReference('worldmap').id,
31+
path : 'series.values.0.heatRules.values.0.maxValue',
32+
value: value,
33+
windowId
3134
});
3235

3336
Neo.main.addon.AmCharts.callMethod({
3437
id : chartId,
35-
path: 'series.values.0.invalidateData'
36-
});
38+
path: 'series.values.0.invalidateData',
39+
windowId
40+
})
3741
}
3842

3943
/**
@@ -45,48 +49,51 @@ class WorldMapContainerController extends ComponentController {
4549
clearTimeout(me.heatRuleChangeTimeout);
4650

4751
me.heatRuleChangeTimeout = setTimeout(() => {
48-
me.changeHeatRule(data.value);
49-
}, me.heatRuleChangeDelay);
52+
me.changeHeatRule(data.value)
53+
}, me.heatRuleChangeDelay)
5054
}
5155

5256
/**
5357
* @param {Object} data
5458
*/
5559
onSeriesButtonClick(data) {
56-
const me = this,
57-
chartId = me.getReference('worldmap').id,
58-
countryData = [...me.getParent().data];
59-
60-
const colorMap = {
61-
active : '#64b5f6',
62-
cases : '#bbbbbb',
63-
deaths : '#fb6767',
64-
recovered: '#28ca68'
65-
};
60+
let me = this,
61+
{windowId} = me,
62+
chartId = me.getReference('worldmap').id,
63+
countryData = [...me.getParent().data],
64+
colorMap = {
65+
active : '#64b5f6',
66+
cases : '#bbbbbb',
67+
deaths : '#fb6767',
68+
recovered: '#28ca68'
69+
};
6670

6771
Neo.main.addon.AmCharts.setProperty({
6872
id : chartId,
6973
isColor: true,
7074
path : 'series.values.0.heatRules.values.0.max',
71-
value : colorMap[data.component.series]
75+
value : colorMap[data.component.series],
76+
windowId
7277
});
7378

7479
Neo.main.addon.AmCharts.setProperty({
7580
id : chartId,
7681
path : 'series.values.0.dataFields.value',
77-
value: data.component.series
82+
value: data.component.series,
83+
windowId
7884
});
7985

8086
Neo.main.addon.AmCharts.callMethod({
8187
id : chartId,
82-
path: 'series.values.0.invalidateData'
88+
path: 'series.values.0.invalidateData',
89+
windowId
8390
}).then(() => {
8491
me.getReference('currentMapViewLabel').text = 'Current view: ' + Neo.capitalize(data.component.series);
8592

8693
countryData.sort((a, b) => b[data.component.series] - a[data.component.series]);
8794

88-
me.getReference('heatRuleField').value = Math.ceil(countryData[9][data.component.series] / 100) * 100;
89-
});
95+
me.getReference('heatRuleField').value = Math.ceil(countryData[9][data.component.series] / 100) * 100
96+
})
9097
}
9198
}
9299

apps/form/view/FormContainerController.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ class FormContainerController extends Component {
4444
* @param {Object} data
4545
*/
4646
async onSaveButtonClick(data) {
47-
let form = this.getReference('main-form'),
47+
let form = me.getReference('main-form'),
4848
formValues = await form.getSubmitValues();
4949

5050
Neo.main.addon.LocalStorage.updateLocalStorageItem({
51-
appName: this.component.appName,
52-
key : 'neo-form',
53-
value : JSON.stringify(formValues)
51+
key : 'neo-form',
52+
value : JSON.stringify(formValues),
53+
windowId: this.windowId
5454
})
5555
}
5656
}

apps/form/view/ViewportStateProvider.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class ViewportStateProvider extends StateProvider {
5858
super.construct(config);
5959

6060
Neo.main.addon.LocalStorage.readLocalStorageItem({
61-
appName: this.component.appName,
62-
key : 'neo-form'
61+
key : 'neo-form',
62+
windowId: this.windowId
6363
}).then(data => {
6464
this.formData = JSON.parse(data.value);
6565
})

apps/realworld/api/Base.mjs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ class Base extends CoreBase {
9393

9494
me.onReady(token);
9595
Base.isReady = true;
96-
Base.fire('ready', token);
97-
});
96+
Base.fire('ready', token)
97+
})
9898
} else {
9999
Base.on({
100100
ready: me.onReady,
101101
scope: me
102-
});
102+
})
103103
}
104104
}
105105

@@ -117,7 +117,7 @@ class Base extends CoreBase {
117117
return API_URL + opts.url;
118118
}
119119

120-
return API_URL + (opts.resource || this.resource) + (opts.slug ? '/' + opts.slug : '');
120+
return API_URL + (opts.resource || this.resource) + (opts.slug ? '/' + opts.slug : '')
121121
}
122122

123123
/**
@@ -143,8 +143,8 @@ class Base extends CoreBase {
143143
'X-Requested-With': 'XMLHttpRequest'
144144
}
145145
}).catch(error => {
146-
console.log('RealWorld.api.Base:get()', error);
147-
});
146+
console.log('RealWorld.api.Base:get()', error)
147+
})
148148
}
149149

150150
/**
@@ -170,8 +170,8 @@ class Base extends CoreBase {
170170
'X-Requested-With': 'XMLHttpRequest'
171171
}
172172
}).catch(error => {
173-
console.log('RealWorld.api.Base:get()', error);
174-
});
173+
console.log('RealWorld.api.Base:get()', error)
174+
})
175175
}
176176

177177
/**
@@ -187,7 +187,7 @@ class Base extends CoreBase {
187187
}
188188

189189
me.isReady = true;
190-
me.fire('ready', token);
190+
me.fire('ready', token)
191191
}
192192

193193
/**
@@ -199,8 +199,6 @@ class Base extends CoreBase {
199199
* @returns {Promise<any>}
200200
*/
201201
post(opts={}) {
202-
// console.log('post', opts);
203-
204202
const params = opts.params;
205203
delete opts.params;
206204

@@ -217,7 +215,7 @@ class Base extends CoreBase {
217215
}
218216
}).catch(error => {
219217
console.log('RealWorld.api.Base:post()', error);
220-
});
218+
})
221219
}
222220

223221
/**
@@ -246,8 +244,8 @@ class Base extends CoreBase {
246244
'X-Requested-With': 'XMLHttpRequest'
247245
}
248246
}).catch(error => {
249-
console.log('RealWorld.api.Base:put()', error);
250-
});
247+
console.log('RealWorld.api.Base:put()', error)
248+
})
251249
}
252250
}
253251

apps/realworld/view/article/Component.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class Component extends BaseComponent {
216216
});
217217

218218
me.update();
219-
me.onCurrentUserChange();
219+
me.onCurrentUserChange()
220220
}
221221
}
222222

@@ -228,16 +228,18 @@ class Component extends BaseComponent {
228228
*/
229229
afterSetBody(value, oldValue) {
230230
if (value) {
231-
Neo.main.addon.Markdown.markdownToHtml(value).then(html => {
232-
VDomUtil.getByFlag(this.vdom, 'body').cn[0] = {
233-
cn: [{
234-
tag: 'p',
235-
html
236-
}]
231+
let me = this;
232+
233+
Neo.main.addon.Markdown.markdownToHtml({
234+
markdown: value,
235+
windowId: me.windowId
236+
}).then(html => {
237+
VDomUtil.getByFlag(me.vdom, 'body').cn[0] = {
238+
cn: [{tag: 'p', html}]
237239
};
238240

239-
this.update();
240-
});
241+
me.update()
242+
})
241243
}
242244
}
243245

@@ -255,7 +257,7 @@ class Component extends BaseComponent {
255257

256258
if (!me.commentComponent) {
257259
module = await import('./CommentComponent.mjs');
258-
me.commentComponent = module.default;
260+
me.commentComponent = module.default
259261
}
260262

261263
container.cn = [container.cn.shift()]; // keep the CreateCommentComponent

apps/realworld2/view/MainContainerController.mjs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,21 @@ class MainContainerController extends ComponentController {
222222
* @param {Object} userData
223223
*/
224224
login(userData) {
225-
this.currentUser = userData;
225+
let me = this,
226+
{windowId} = me;
227+
228+
me.currentUser = userData;
226229

227230
Neo.main.addon.LocalStorage.createLocalStorageItem({
228231
key : LOCAL_STORAGE_KEY,
229-
value: userData.token
232+
value: userData.token,
233+
windowId
230234
}).then(() => {
231235
// wait until the header vdom-update is done to avoid showing sign up & sign in twice
232-
this.timeout(50).then(() => {
236+
me.timeout(50).then(() => {
233237
Neo.Main.setRoute({
234-
value: '/'
238+
value: '/',
239+
windowId
235240
})
236241
})
237242
})
@@ -241,15 +246,20 @@ class MainContainerController extends ComponentController {
241246
*
242247
*/
243248
logout() {
244-
this.currentUser = null;
249+
let me = this,
250+
{windowId} = me;
251+
252+
me.currentUser = null;
245253

246254
Neo.main.addon.LocalStorage.destroyLocalStorageItem({
247-
key: LOCAL_STORAGE_KEY
255+
key: LOCAL_STORAGE_KEY,
256+
windowId
248257
}).then(() => {
249258
// wait until the header vdom-update is done to avoid showing sign up & sign in twice
250259
this.timeout(50).then(() => {
251260
Neo.Main.setRoute({
252-
value: '/'
261+
value: '/',
262+
windowId
253263
})
254264
})
255265
})

0 commit comments

Comments
 (0)