@adaptabletools/adaptable-plugin-openfin 20.0.0-canary.2 → 20.0.0-canary.20
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/package.json +2 -3
- package/src/Module/OpenFinModule.js +17 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-plugin-openfin",
|
|
3
|
-
"version": "20.0.0-canary.
|
|
3
|
+
"version": "20.0.0-canary.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "http://www.adaptabletools.com/",
|
|
6
6
|
"author": {
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"rebass": "^3.2.2",
|
|
18
18
|
"redux": "^5.0.1",
|
|
19
19
|
"styled-components": "^4.4.1",
|
|
20
|
-
"tslib": "^2.8.1"
|
|
21
|
-
"@adaptabletools/adaptable": "20.0.0-canary.2"
|
|
20
|
+
"tslib": "^2.8.1"
|
|
22
21
|
},
|
|
23
22
|
"type": "module",
|
|
24
23
|
"module": "src/index.js"
|
|
@@ -35,35 +35,39 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
35
35
|
return this.openFinService;
|
|
36
36
|
}
|
|
37
37
|
sendInitialLiveData(force = true) {
|
|
38
|
-
//
|
|
39
|
-
if (this.isSendingData
|
|
38
|
+
// We wait for the last setInitialLiveData to finish
|
|
39
|
+
if (this.isSendingData === true && !force) {
|
|
40
40
|
this.throttledRecomputeAndSendLiveDataEvent();
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
if (
|
|
43
|
+
const currentLiveOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
|
|
44
|
+
if (currentLiveOpenFinReport) {
|
|
45
45
|
this.isSendingData = true;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
return this.api.exportApi
|
|
47
|
+
.getReportData(currentLiveOpenFinReport.ReportName, 'JSON')
|
|
48
|
+
.then((exportResultData) => {
|
|
49
|
+
if (exportResultData?.type === 'json' && exportResultData?.data) {
|
|
50
|
+
this.currentReportData = exportResultData.data;
|
|
51
|
+
const reportDataAsArray = this.api.exportApi.internalApi.convertReportDataToArray(exportResultData.data);
|
|
52
|
+
return this.getOpenFinService().clearAndPushData(reportDataAsArray);
|
|
53
|
+
}
|
|
54
|
+
throw new Error('Invalid report data format');
|
|
55
|
+
})
|
|
52
56
|
.then(() => {
|
|
53
57
|
this.adaptable.logger.success('All live report data sent');
|
|
54
58
|
this.isSendingData = false;
|
|
55
|
-
return this.api.exportApi.internalApi.publishLiveLiveDataChangedEvent('OpenFin', 'LiveDataUpdated',
|
|
59
|
+
return this.api.exportApi.internalApi.publishLiveLiveDataChangedEvent('OpenFin', 'LiveDataUpdated', currentLiveOpenFinReport);
|
|
56
60
|
})
|
|
57
61
|
.catch((reason) => {
|
|
58
62
|
this.isSendingData = false;
|
|
59
|
-
this.adaptable.logger.warn('Failed to send data to OpenFin for [' +
|
|
63
|
+
this.adaptable.logger.warn('Failed to send data to OpenFin for [' + currentLiveOpenFinReport.ReportName + ']', reason);
|
|
60
64
|
this.getOpenFinApi().stopLiveData();
|
|
61
65
|
let errorMessage = 'Export Failed';
|
|
62
66
|
if (reason) {
|
|
63
67
|
errorMessage += ': ' + reason;
|
|
64
68
|
}
|
|
65
69
|
errorMessage += '. This live export has been cancelled.';
|
|
66
|
-
this.api.alertApi.showAlertError('
|
|
70
|
+
this.api.alertApi.showAlertError('OpenFin Export Error', errorMessage);
|
|
67
71
|
this.adaptable.logger.warn('Failed to send data');
|
|
68
72
|
});
|
|
69
73
|
}
|