@adaptabletools/adaptable-plugin-openfin 20.0.0-canary.6 → 20.0.0-canary.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-plugin-openfin",
3
- "version": "20.0.0-canary.6",
3
+ "version": "20.0.0-canary.7",
4
4
  "description": "",
5
5
  "homepage": "http://www.adaptabletools.com/",
6
6
  "author": {
@@ -35,35 +35,39 @@ export class OpenFinModule extends AdaptableModuleBase {
35
35
  return this.openFinService;
36
36
  }
37
37
  sendInitialLiveData(force = true) {
38
- //we wait for the last setInitialLiveData to finish
39
- if (this.isSendingData == true && !force) {
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
- let currentLiveIOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
44
- if (currentLiveIOpenFinReport) {
43
+ const currentLiveOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
44
+ if (currentLiveOpenFinReport) {
45
45
  this.isSendingData = true;
46
- let report = this.api.exportApi.getReportByName(currentLiveIOpenFinReport.ReportName);
47
- let reportData = this.api.exportApi.internalApi.getReportData(report, true);
48
- this.currentReportData = reportData;
49
- let ReportAsArray = this.api.exportApi.internalApi.convertReportDataToArray(reportData);
50
- return this.getOpenFinService()
51
- .clearAndPushData(ReportAsArray)
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', currentLiveIOpenFinReport);
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 [' + currentLiveIOpenFinReport.ReportName + ']', reason);
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('iOpenFin Export Error', errorMessage);
70
+ this.api.alertApi.showAlertError('OpenFin Export Error', errorMessage);
67
71
  this.adaptable.logger.warn('Failed to send data');
68
72
  });
69
73
  }