@adaptabletools/adaptable-plugin-openfin-cjs 22.0.0-canary.0 → 22.0.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/Module/OpenFinModule.js +15 -5
- package/src/OpenFinApiImpl.js +2 -1
- package/src/OpenFinHelper.js +1 -3
- package/src/Utilities/Services/OpenFinService.js +97 -92
- package/src/View/OpenFinViewPanel.js +7 -7
- package/src/index.js +39 -36
package/README.md
CHANGED
|
@@ -10,12 +10,12 @@ This plugin allows users to take advantage of some additional functionality cour
|
|
|
10
10
|
|
|
11
11
|
## Documentation & Demos
|
|
12
12
|
|
|
13
|
-
Full details of how to install, configure and use the OpenFin plugin can be found at [AdapTable OpenFin Documentation](https://
|
|
13
|
+
Full details of how to install, configure and use the OpenFin plugin can be found at [AdapTable OpenFin Documentation](https://www.adaptabletools.com/docs/integrations-openfin)
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
## Help
|
|
17
17
|
|
|
18
|
-
Developers can learn how to access AdapTable programmatically at [AdapTable Documentation](https://
|
|
18
|
+
Developers can learn how to access AdapTable programmatically at [AdapTable Documentation](https://www.adaptabletools.com/docs).
|
|
19
19
|
|
|
20
20
|
## Other AdapTable Resources
|
|
21
21
|
|
|
@@ -27,4 +27,4 @@ For all support enquiries please email [`support@adaptabletools.com`](mailto:sup
|
|
|
27
27
|
|
|
28
28
|
## Licences
|
|
29
29
|
|
|
30
|
-
Information on AdapTable Licences can be found at [Licensing AdapTable for AG Grid](https://
|
|
30
|
+
Information on AdapTable Licences can be found at [Licensing AdapTable for AG Grid](https://www.adaptabletools.com/buy/buying-adaptable-licensing).
|
package/package.json
CHANGED
|
@@ -8,13 +8,20 @@ const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
|
|
|
8
8
|
const GeneralConstants_1 = require("@adaptabletools/adaptable-cjs/src/Utilities/Constants/GeneralConstants");
|
|
9
9
|
exports.EXCEL_VALIDATION_FAILED = 'excelValidationFailed';
|
|
10
10
|
class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
11
|
+
isSendingData = false;
|
|
12
|
+
openFinService = null;
|
|
13
|
+
adaptable;
|
|
14
|
+
throttledRecomputeAndSendLiveDataEvent;
|
|
15
|
+
liveTimeoutId;
|
|
16
|
+
removeDataChangedListener;
|
|
17
|
+
removeGridRefreshedListener;
|
|
18
|
+
removeGridFilteredListener;
|
|
19
|
+
removeCellSelectionChangedListener;
|
|
20
|
+
removeRowSelectionChangedListener;
|
|
21
|
+
removeSheetChangedListener;
|
|
22
|
+
currentReportData;
|
|
11
23
|
constructor(api) {
|
|
12
24
|
super(ModuleConstants.OpenFinModuleId, ModuleConstants.OpenFinFriendlyName, 'download', null, 'Integrate AdapTable with the OpenFin container', api);
|
|
13
|
-
this.isSendingData = false;
|
|
14
|
-
this.openFinService = null;
|
|
15
|
-
this.getCurrentReportColumns = () => {
|
|
16
|
-
return this.currentReportData ? this.currentReportData.columns : [];
|
|
17
|
-
};
|
|
18
25
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
19
26
|
this.throttledRecomputeAndSendLiveDataEvent = (0, throttle_1.default)(() => this.sendInitialLiveData(), this.getThrottleTimeFromState());
|
|
20
27
|
}
|
|
@@ -76,6 +83,9 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
85
|
}
|
|
86
|
+
getCurrentReportColumns = () => {
|
|
87
|
+
return this.currentReportData ? this.currentReportData.columns : [];
|
|
88
|
+
};
|
|
79
89
|
startLiveData(iOpenFinReport) {
|
|
80
90
|
this.cleanup(); // just in case the previous report has not been stopped
|
|
81
91
|
this.liveTimeoutId = setTimeout(() => {
|
package/src/OpenFinApiImpl.js
CHANGED
|
@@ -20,9 +20,10 @@ if (typeof window !== 'undefined' && window.document) {
|
|
|
20
20
|
}
|
|
21
21
|
const CLICK_ALERT_BUTTON = 'adaptable-click-alert-button';
|
|
22
22
|
class OpenFinApiImpl extends ApiBase_1.ApiBase {
|
|
23
|
+
options;
|
|
24
|
+
OpenFinService = null;
|
|
23
25
|
constructor(_adaptable, options) {
|
|
24
26
|
super(_adaptable);
|
|
25
|
-
this.OpenFinService = null;
|
|
26
27
|
this.options = options;
|
|
27
28
|
if ((0, isRunningInOpenfin_1.isRunningInOpenfin)()) {
|
|
28
29
|
(0, openfin_notifications_1.addEventListener)('notification-action', (event) => {
|
package/src/OpenFinHelper.js
CHANGED
|
@@ -12,9 +12,7 @@ exports.initOpenFinExcel = initOpenFinExcel;
|
|
|
12
12
|
// putting this here as we dont use it elswhere - so keeping it here until we redo the OpenFin one day...
|
|
13
13
|
const AdaptableLogger_1 = require("@adaptabletools/adaptable-cjs/src/agGrid/AdaptableLogger");
|
|
14
14
|
class EventDispatcher {
|
|
15
|
-
|
|
16
|
-
this._subscriptions = new Array();
|
|
17
|
-
}
|
|
15
|
+
_subscriptions = new Array();
|
|
18
16
|
Subscribe(fn) {
|
|
19
17
|
if (fn) {
|
|
20
18
|
this._subscriptions.push(fn);
|
|
@@ -15,9 +15,41 @@ function isExcelOpenfinLoaded() {
|
|
|
15
15
|
return (0, isRunningInOpenfin_1.isRunningInOpenfin)() && 'Excel' in fin.desktop;
|
|
16
16
|
}
|
|
17
17
|
class OpenFinService {
|
|
18
|
+
adaptable;
|
|
19
|
+
options;
|
|
20
|
+
workbookName;
|
|
21
|
+
excelConnected = false;
|
|
22
|
+
connectedCallbacks = [];
|
|
23
|
+
activeWorksheet;
|
|
24
|
+
emitter;
|
|
18
25
|
getOpenFinApi() {
|
|
19
26
|
return this.adaptable.api.pluginsApi.getOpenFinPluginApi();
|
|
20
27
|
}
|
|
28
|
+
onWorkbookRemoved = (event) => {
|
|
29
|
+
event.workbook.removeEventListener('workbookActivated', this.onWorkbookActivated);
|
|
30
|
+
const { workbook } = event;
|
|
31
|
+
this.adaptable.logger.info('Workbook closed:' + workbook.name + ', Stopping Openfin Live Excel');
|
|
32
|
+
this.getOpenFinApi().stopLiveData();
|
|
33
|
+
};
|
|
34
|
+
onWorkbookSaved = (event) => {
|
|
35
|
+
const NewName = event.workbook.name;
|
|
36
|
+
this.adaptable.logger.info('workbook saved', NewName);
|
|
37
|
+
//saving adds an extension, but the name does not have that
|
|
38
|
+
// however, not adding the extension will not find the workbook when we do getWorkBookByName
|
|
39
|
+
// and will crash the app
|
|
40
|
+
this.workbookName = NewName;
|
|
41
|
+
};
|
|
42
|
+
onWorkbookActivated = (event) => {
|
|
43
|
+
this.adaptable.logger.info('Workbook Activated: ' + event.target.name);
|
|
44
|
+
event.target.getWorksheets((ack) => {
|
|
45
|
+
this.adaptable.logger.info('getWorksheets:', ack);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
onWorkbookAdded = (event) => {
|
|
49
|
+
this.adaptable.logger.success('Workbook Added: ' + event.workbook.name);
|
|
50
|
+
let workbook = event.workbook;
|
|
51
|
+
workbook.addEventListener('workbookActivated', this.onWorkbookActivated);
|
|
52
|
+
};
|
|
21
53
|
getCurrentWorkbook(skipRetry) {
|
|
22
54
|
if (!this.workbookName) {
|
|
23
55
|
return this.waitForExcel().then(() => {
|
|
@@ -64,6 +96,21 @@ class OpenFinService {
|
|
|
64
96
|
});
|
|
65
97
|
});
|
|
66
98
|
}
|
|
99
|
+
onSheetChanged = (event) => {
|
|
100
|
+
this.emit('sheetchanged', event);
|
|
101
|
+
};
|
|
102
|
+
getRowContents = (rowIndex, columnCount) => {
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
try {
|
|
105
|
+
this.activeWorksheet.getRow('A' + rowIndex, columnCount, (row) => {
|
|
106
|
+
return resolve(row.map((x) => x.value));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
reject(err);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
};
|
|
67
114
|
doPushData(data, { address, clear }) {
|
|
68
115
|
const OpenFinApi = this.getOpenFinApi();
|
|
69
116
|
if (!OpenFinApi || !this.options || !(0, isRunningInOpenfin_1.isRunningInOpenfin)()) {
|
|
@@ -115,6 +162,30 @@ class OpenFinService {
|
|
|
115
162
|
}));
|
|
116
163
|
});
|
|
117
164
|
}
|
|
165
|
+
onExcelConnected = () => {
|
|
166
|
+
this.excelConnected = true;
|
|
167
|
+
this.connectedCallbacks.forEach((fn) => fn());
|
|
168
|
+
this.connectedCallbacks.length = 0;
|
|
169
|
+
this.adaptable.logger.success('Excel Connected');
|
|
170
|
+
fin.desktop.Excel.addEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
171
|
+
fin.desktop.Excel.addEventListener('workbookSaved', this.onWorkbookSaved);
|
|
172
|
+
fin.desktop.Excel.addEventListener('workbookAdded', this.onWorkbookAdded);
|
|
173
|
+
};
|
|
174
|
+
onExcelDisconnected = () => {
|
|
175
|
+
this.adaptable.logger.info('Excel Disconnected');
|
|
176
|
+
this.excelConnected = false;
|
|
177
|
+
this.initialisingExcel = null;
|
|
178
|
+
this.workbookName = undefined;
|
|
179
|
+
this.activeWorksheet = null;
|
|
180
|
+
fin.desktop.Excel.removeEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
181
|
+
fin.desktop.Excel.removeEventListener('workbookSaved', this.onWorkbookSaved);
|
|
182
|
+
fin.desktop.Excel.removeEventListener('workbookAdded', this.onWorkbookAdded);
|
|
183
|
+
fin.desktop.ExcelService.removeEventListener('excelConnected', this.onExcelConnected);
|
|
184
|
+
fin.desktop.ExcelService.removeEventListener('excelDisconnected', this.onExcelDisconnected);
|
|
185
|
+
this.adaptable.logger.info('Excel closed stopping all Live Excel');
|
|
186
|
+
this.getOpenFinApi().stopLiveData();
|
|
187
|
+
};
|
|
188
|
+
initialisingExcel = null;
|
|
118
189
|
initOpenFinExcel(callback) {
|
|
119
190
|
if (this.excelConnected) {
|
|
120
191
|
callback();
|
|
@@ -151,103 +222,37 @@ class OpenFinService {
|
|
|
151
222
|
});
|
|
152
223
|
return this.initialisingExcel;
|
|
153
224
|
}
|
|
225
|
+
waitForExcel = () => {
|
|
226
|
+
let startTime = Date.now();
|
|
227
|
+
const poolForExcel = (callback) => {
|
|
228
|
+
if (Date.now() - startTime > 20000) {
|
|
229
|
+
console.error(`Could not find any Excel instance.`);
|
|
230
|
+
return callback();
|
|
231
|
+
}
|
|
232
|
+
if (!fin.desktop.Excel || !fin.desktop.Excel.getWorkbooks) {
|
|
233
|
+
requestAnimationFrame(() => {
|
|
234
|
+
poolForExcel(callback);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
callback();
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
return new Promise((resolve) => {
|
|
242
|
+
poolForExcel(() => resolve(''));
|
|
243
|
+
});
|
|
244
|
+
};
|
|
154
245
|
constructor(adaptable, options) {
|
|
155
246
|
this.adaptable = adaptable;
|
|
156
|
-
this.excelConnected = false;
|
|
157
|
-
this.connectedCallbacks = [];
|
|
158
|
-
this.onWorkbookRemoved = (event) => {
|
|
159
|
-
event.workbook.removeEventListener('workbookActivated', this.onWorkbookActivated);
|
|
160
|
-
const { workbook } = event;
|
|
161
|
-
this.adaptable.logger.info('Workbook closed:' + workbook.name + ', Stopping Openfin Live Excel');
|
|
162
|
-
this.getOpenFinApi().stopLiveData();
|
|
163
|
-
};
|
|
164
|
-
this.onWorkbookSaved = (event) => {
|
|
165
|
-
const NewName = event.workbook.name;
|
|
166
|
-
this.adaptable.logger.info('workbook saved', NewName);
|
|
167
|
-
//saving adds an extension, but the name does not have that
|
|
168
|
-
// however, not adding the extension will not find the workbook when we do getWorkBookByName
|
|
169
|
-
// and will crash the app
|
|
170
|
-
this.workbookName = NewName;
|
|
171
|
-
};
|
|
172
|
-
this.onWorkbookActivated = (event) => {
|
|
173
|
-
this.adaptable.logger.info('Workbook Activated: ' + event.target.name);
|
|
174
|
-
event.target.getWorksheets((ack) => {
|
|
175
|
-
this.adaptable.logger.info('getWorksheets:', ack);
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
this.onWorkbookAdded = (event) => {
|
|
179
|
-
this.adaptable.logger.success('Workbook Added: ' + event.workbook.name);
|
|
180
|
-
let workbook = event.workbook;
|
|
181
|
-
workbook.addEventListener('workbookActivated', this.onWorkbookActivated);
|
|
182
|
-
};
|
|
183
|
-
this.onSheetChanged = (event) => {
|
|
184
|
-
this.emit('sheetchanged', event);
|
|
185
|
-
};
|
|
186
|
-
this.getRowContents = (rowIndex, columnCount) => {
|
|
187
|
-
return new Promise((resolve, reject) => {
|
|
188
|
-
try {
|
|
189
|
-
this.activeWorksheet.getRow('A' + rowIndex, columnCount, (row) => {
|
|
190
|
-
return resolve(row.map((x) => x.value));
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
catch (err) {
|
|
194
|
-
reject(err);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
this.onExcelConnected = () => {
|
|
199
|
-
this.excelConnected = true;
|
|
200
|
-
this.connectedCallbacks.forEach((fn) => fn());
|
|
201
|
-
this.connectedCallbacks.length = 0;
|
|
202
|
-
this.adaptable.logger.success('Excel Connected');
|
|
203
|
-
fin.desktop.Excel.addEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
204
|
-
fin.desktop.Excel.addEventListener('workbookSaved', this.onWorkbookSaved);
|
|
205
|
-
fin.desktop.Excel.addEventListener('workbookAdded', this.onWorkbookAdded);
|
|
206
|
-
};
|
|
207
|
-
this.onExcelDisconnected = () => {
|
|
208
|
-
this.adaptable.logger.info('Excel Disconnected');
|
|
209
|
-
this.excelConnected = false;
|
|
210
|
-
this.initialisingExcel = null;
|
|
211
|
-
this.workbookName = undefined;
|
|
212
|
-
this.activeWorksheet = null;
|
|
213
|
-
fin.desktop.Excel.removeEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
214
|
-
fin.desktop.Excel.removeEventListener('workbookSaved', this.onWorkbookSaved);
|
|
215
|
-
fin.desktop.Excel.removeEventListener('workbookAdded', this.onWorkbookAdded);
|
|
216
|
-
fin.desktop.ExcelService.removeEventListener('excelConnected', this.onExcelConnected);
|
|
217
|
-
fin.desktop.ExcelService.removeEventListener('excelDisconnected', this.onExcelDisconnected);
|
|
218
|
-
this.adaptable.logger.info('Excel closed stopping all Live Excel');
|
|
219
|
-
this.getOpenFinApi().stopLiveData();
|
|
220
|
-
};
|
|
221
|
-
this.initialisingExcel = null;
|
|
222
|
-
this.waitForExcel = () => {
|
|
223
|
-
let startTime = Date.now();
|
|
224
|
-
const poolForExcel = (callback) => {
|
|
225
|
-
if (Date.now() - startTime > 20000) {
|
|
226
|
-
console.error(`Could not find any Excel instance.`);
|
|
227
|
-
return callback();
|
|
228
|
-
}
|
|
229
|
-
if (!fin.desktop.Excel || !fin.desktop.Excel.getWorkbooks) {
|
|
230
|
-
requestAnimationFrame(() => {
|
|
231
|
-
poolForExcel(callback);
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
callback();
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
return new Promise((resolve) => {
|
|
239
|
-
poolForExcel(() => resolve(''));
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
this.on = (eventName, callback) => {
|
|
243
|
-
return this.emitter.on(eventName, callback);
|
|
244
|
-
};
|
|
245
|
-
this.emit = (eventName, data) => {
|
|
246
|
-
return this.emitter.emit(eventName, data);
|
|
247
|
-
};
|
|
248
247
|
this.adaptable = adaptable;
|
|
249
248
|
this.options = options;
|
|
250
249
|
this.emitter = new Emitter_1.default();
|
|
251
250
|
}
|
|
251
|
+
on = (eventName, callback) => {
|
|
252
|
+
return this.emitter.on(eventName, callback);
|
|
253
|
+
};
|
|
254
|
+
emit = (eventName, data) => {
|
|
255
|
+
return this.emitter.emit(eventName, data);
|
|
256
|
+
};
|
|
252
257
|
}
|
|
253
258
|
exports.OpenFinService = OpenFinService;
|
|
@@ -21,13 +21,6 @@ const IS_OPENFIN = (0, isRunningInOpenfin_1.isRunningInOpenfin)();
|
|
|
21
21
|
class OpenFinViewPanelComponent extends React.Component {
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
|
-
this.onLiveDataChanged = (liveDataChangedInfo) => {
|
|
25
|
-
if (liveDataChangedInfo.reportDestination == 'OpenFin' &&
|
|
26
|
-
(liveDataChangedInfo.liveDataTrigger == 'Connected' ||
|
|
27
|
-
liveDataChangedInfo.liveDataTrigger == 'Disconnected')) {
|
|
28
|
-
this.forceUpdate();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
24
|
}
|
|
32
25
|
componentDidMount() {
|
|
33
26
|
this.props.api.eventApi.on('LiveDataChanged', this.onLiveDataChanged);
|
|
@@ -35,6 +28,13 @@ class OpenFinViewPanelComponent extends React.Component {
|
|
|
35
28
|
componentWillUnmount() {
|
|
36
29
|
this.props.api.eventApi.off('LiveDataChanged', this.onLiveDataChanged);
|
|
37
30
|
}
|
|
31
|
+
onLiveDataChanged = (liveDataChangedInfo) => {
|
|
32
|
+
if (liveDataChangedInfo.reportDestination == 'OpenFin' &&
|
|
33
|
+
(liveDataChangedInfo.liveDataTrigger == 'Connected' ||
|
|
34
|
+
liveDataChangedInfo.liveDataTrigger == 'Disconnected')) {
|
|
35
|
+
this.forceUpdate();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
38
|
getOpenFinApi() {
|
|
39
39
|
return this.props.api.pluginsApi.getOpenFinPluginApi();
|
|
40
40
|
}
|
package/src/index.js
CHANGED
|
@@ -33,44 +33,12 @@ const defaultOptions = {
|
|
|
33
33
|
onValidationFailureInExcel: 'show-undo-notification',
|
|
34
34
|
};
|
|
35
35
|
class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
36
|
+
pluginId = 'openfin';
|
|
37
|
+
openFinApi;
|
|
38
|
+
OpenFinService;
|
|
39
|
+
openFinModule;
|
|
36
40
|
constructor(options) {
|
|
37
41
|
super(options);
|
|
38
|
-
this.pluginId = 'openfin';
|
|
39
|
-
this.rootReducer = (rootReducer) => {
|
|
40
|
-
return {
|
|
41
|
-
System: (state, action) => {
|
|
42
|
-
let augmentedState = rootReducer.System(state, action);
|
|
43
|
-
if (!state) {
|
|
44
|
-
// required for store initialization
|
|
45
|
-
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
46
|
-
augmentedState = Object.assign({}, augmentedState, OpenFinRedux_1.initialOpenFinState);
|
|
47
|
-
}
|
|
48
|
-
return (0, OpenFinRedux_1.OpenFinReducer)(augmentedState, action);
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
this.reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
53
|
-
return (next) => {
|
|
54
|
-
return (action) => {
|
|
55
|
-
switch (action.type) {
|
|
56
|
-
case PluginsRedux_1.OPENFIN_START_LIVE_DATA: {
|
|
57
|
-
const actionTyped = action;
|
|
58
|
-
this.openFinModule.startLiveData(actionTyped.openFinReport);
|
|
59
|
-
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
60
|
-
return next(action);
|
|
61
|
-
}
|
|
62
|
-
case PluginsRedux_1.OPENFIN_STOP_LIVE_DATA: {
|
|
63
|
-
const actionTyped = action;
|
|
64
|
-
this.openFinModule.stopLiveData(actionTyped.openFinReport);
|
|
65
|
-
return next(action);
|
|
66
|
-
}
|
|
67
|
-
default: {
|
|
68
|
-
return next(action);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
42
|
this.options = {
|
|
75
43
|
...defaultOptions,
|
|
76
44
|
...options,
|
|
@@ -96,6 +64,41 @@ class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
|
96
64
|
this.registerProperty('api', () => this.openFinApi);
|
|
97
65
|
this.registerProperty('service', () => this.OpenFinService);
|
|
98
66
|
}
|
|
67
|
+
rootReducer = (rootReducer) => {
|
|
68
|
+
return {
|
|
69
|
+
System: (state, action) => {
|
|
70
|
+
let augmentedState = rootReducer.System(state, action);
|
|
71
|
+
if (!state) {
|
|
72
|
+
// required for store initialization
|
|
73
|
+
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
74
|
+
augmentedState = Object.assign({}, augmentedState, OpenFinRedux_1.initialOpenFinState);
|
|
75
|
+
}
|
|
76
|
+
return (0, OpenFinRedux_1.OpenFinReducer)(augmentedState, action);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
81
|
+
return (next) => {
|
|
82
|
+
return (action) => {
|
|
83
|
+
switch (action.type) {
|
|
84
|
+
case PluginsRedux_1.OPENFIN_START_LIVE_DATA: {
|
|
85
|
+
const actionTyped = action;
|
|
86
|
+
this.openFinModule.startLiveData(actionTyped.openFinReport);
|
|
87
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
88
|
+
return next(action);
|
|
89
|
+
}
|
|
90
|
+
case PluginsRedux_1.OPENFIN_STOP_LIVE_DATA: {
|
|
91
|
+
const actionTyped = action;
|
|
92
|
+
this.openFinModule.stopLiveData(actionTyped.openFinReport);
|
|
93
|
+
return next(action);
|
|
94
|
+
}
|
|
95
|
+
default: {
|
|
96
|
+
return next(action);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
99
102
|
afterInitStore(adaptable) {
|
|
100
103
|
adaptable.adaptableModules.set(ModuleConstants_1.OpenFinModuleId, new OpenFinModule_1.OpenFinModule(adaptable.api));
|
|
101
104
|
AdaptableViewFactory_1.AdaptableViewPanelFactory.set(ModuleConstants_1.OpenFinModuleId, OpenFinViewPanel_1.OpenFinViewPanelControl);
|