@adaptabletools/adaptable-plugin-openfin 17.0.6 → 18.0.0-canary.0
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 +37 -0
- package/package.json +5 -4
- package/src/Module/Interface/IOpenFinModule.js +1 -2
- package/src/Module/OpenFinModule.js +12 -17
- package/src/OpenFinApiImpl.js +12 -17
- package/src/OpenFinHelper.js +31 -42
- package/src/Redux/ActionReducers/OpenFinRedux.js +19 -28
- package/src/Utilities/Services/Interface/IOpenFinService.js +1 -2
- package/src/Utilities/Services/OpenFinService.js +10 -16
- package/src/Utilities/Services/setup.js +9 -13
- package/src/Utilities/isRunningInOpenfin.js +1 -5
- package/src/View/OpenFinPopup.js +9 -13
- package/src/View/OpenFinViewPanel.js +26 -30
- package/src/index.js +32 -33
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# AdapTable Openfin Plugin Read Me
|
|
2
|
+
|
|
3
|
+
In order to use this plugin, you have to install `@adaptabletools/adaptable-plugin-openfin` and specify it in your `adaptableOptions` configuration object, as shown below:
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const adaptableOptions: AdaptableOptions = {
|
|
7
|
+
adaptableId: 'openfindemo1',
|
|
8
|
+
plugins: [
|
|
9
|
+
openfin()
|
|
10
|
+
]
|
|
11
|
+
// ... other options
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## OpenFin configuration
|
|
16
|
+
|
|
17
|
+
To use the AdapTable-Excel integration with your openfin setup, in your app.json, you need to specify
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
"services": [
|
|
21
|
+
{ "name": "excel",
|
|
22
|
+
"manifestUrl": "http://openfin.github.io/excel-api-example/provider/app.json"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Help
|
|
28
|
+
|
|
29
|
+
Developers can learn how to access AdapTable programmatically at [AdapTable Documentation](https://docs.adaptabletools.com) which contains information on using the [OpenFin Plugin](https://docs.adaptabletools.com/guide/integrations-openfin)
|
|
30
|
+
|
|
31
|
+
## Other AdapTable Resources
|
|
32
|
+
|
|
33
|
+
General information about Adaptable Tools is available at our [Website](http://www.adaptabletools.com)
|
|
34
|
+
|
|
35
|
+
## Support
|
|
36
|
+
|
|
37
|
+
For all support enquiries please email [`support@adaptabletools.com`](mailto:support@adaptabletools.com) or [raise a Support Ticket](https://adaptabletools.zendesk.com/hc/en-us/requests/new).
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-plugin-openfin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0-canary.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "http://www.adaptabletools.com/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jonny Wolfson",
|
|
8
8
|
"email": "jonny.wolfson@adaptabletools.com"
|
|
9
9
|
},
|
|
10
|
-
"main": "src/index.js",
|
|
11
10
|
"typings": "src/index.d.ts",
|
|
12
11
|
"dependencies": {
|
|
13
12
|
"lodash": "^4.17.15",
|
|
@@ -19,6 +18,8 @@
|
|
|
19
18
|
"redux": "4.0.5",
|
|
20
19
|
"styled-components": "^4.4.1",
|
|
21
20
|
"tslib": "^2.3.0",
|
|
22
|
-
"@adaptabletools/adaptable": "
|
|
23
|
-
}
|
|
21
|
+
"@adaptabletools/adaptable": "18.0.0-canary.0"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"module": "src/index.js"
|
|
24
25
|
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
|
|
8
|
-
const GeneralConstants_1 = require("@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants");
|
|
9
|
-
exports.EXCEL_VALIDATION_FAILED = 'excelValidationFailed';
|
|
10
|
-
class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
1
|
+
import { AdaptableModuleBase } from '@adaptabletools/adaptable/src/Strategy/AdaptableModuleBase';
|
|
2
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
3
|
+
import throttle from 'lodash/throttle';
|
|
4
|
+
import { SELECTED_CELLS_REPORT, DEFAULT_LIVE_REPORT_THROTTLE_TIME, SELECTED_ROWS_REPORT, ALL_DATA_REPORT, } from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
5
|
+
export const EXCEL_VALIDATION_FAILED = 'excelValidationFailed';
|
|
6
|
+
export class OpenFinModule extends AdaptableModuleBase {
|
|
11
7
|
constructor(api) {
|
|
12
8
|
super(ModuleConstants.OpenFinModuleId, ModuleConstants.OpenFinFriendlyName, 'download', null, 'Integrate AdapTable with the OpenFin container', api);
|
|
13
9
|
this.isSendingData = false;
|
|
@@ -16,7 +12,7 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
16
12
|
return this.currentReportData ? this.currentReportData.columns : [];
|
|
17
13
|
};
|
|
18
14
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
19
|
-
this.throttledRecomputeAndSendLiveDataEvent = (
|
|
15
|
+
this.throttledRecomputeAndSendLiveDataEvent = throttle(() => this.sendInitialLiveData(), this.getThrottleTimeFromState());
|
|
20
16
|
}
|
|
21
17
|
getViewAccessLevel() {
|
|
22
18
|
return 'Full';
|
|
@@ -111,7 +107,7 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
111
107
|
}, 500); // for whatever strange excel reason, the timeout is needed
|
|
112
108
|
const isSelectionReport = (report) => {
|
|
113
109
|
return (report &&
|
|
114
|
-
(report.ReportName ===
|
|
110
|
+
(report.ReportName === SELECTED_CELLS_REPORT || report.ReportName === SELECTED_ROWS_REPORT));
|
|
115
111
|
};
|
|
116
112
|
const resendLiveDataNoSelectionReport = () => {
|
|
117
113
|
// Rerun all reports except selected cells / rows
|
|
@@ -142,7 +138,7 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
142
138
|
});
|
|
143
139
|
// if the grid has refreshed then update all live reports
|
|
144
140
|
this.removeGridRefreshedListener = this.adaptable._on('GridRefreshed', resendLiveDataNoSelectionReport);
|
|
145
|
-
if (iOpenFinReport.ReportName !==
|
|
141
|
+
if (iOpenFinReport.ReportName !== ALL_DATA_REPORT) {
|
|
146
142
|
this.removeGridSortChangedListener = this.adaptable._on('SortChanged', resendLiveData);
|
|
147
143
|
// if the grid filters have changed then update any live reports except cell or row selected
|
|
148
144
|
this.removeGridFilteredListener = this.adaptable._on('AdapTableFiltersApplied', resendLiveDataNoSelectionReport);
|
|
@@ -151,14 +147,14 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
151
147
|
this.removeCellSelectionChangedListener = this.api.eventApi.on('CellSelectionChanged', () => {
|
|
152
148
|
const currentLiveIOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
|
|
153
149
|
if (currentLiveIOpenFinReport &&
|
|
154
|
-
currentLiveIOpenFinReport.ReportName ===
|
|
150
|
+
currentLiveIOpenFinReport.ReportName === SELECTED_CELLS_REPORT) {
|
|
155
151
|
this.throttledRecomputeAndSendLiveDataEvent();
|
|
156
152
|
}
|
|
157
153
|
});
|
|
158
154
|
this.removeRowSelectionChangedListener = this.api.eventApi.on('RowSelectionChanged', () => {
|
|
159
155
|
const currentLiveIOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
|
|
160
156
|
if (currentLiveIOpenFinReport &&
|
|
161
|
-
currentLiveIOpenFinReport.ReportName ===
|
|
157
|
+
currentLiveIOpenFinReport.ReportName === SELECTED_ROWS_REPORT) {
|
|
162
158
|
this.throttledRecomputeAndSendLiveDataEvent();
|
|
163
159
|
}
|
|
164
160
|
});
|
|
@@ -396,8 +392,7 @@ class OpenFinModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
396
392
|
if (this.getOpenFinApi().isOpenFinRunning()) {
|
|
397
393
|
iOpenFinThrottleTime = this.getOpenFinApi().getOpenFinThrottleTime();
|
|
398
394
|
}
|
|
399
|
-
const result = iOpenFinThrottleTime ? iOpenFinThrottleTime :
|
|
395
|
+
const result = iOpenFinThrottleTime ? iOpenFinThrottleTime : DEFAULT_LIVE_REPORT_THROTTLE_TIME;
|
|
400
396
|
return result;
|
|
401
397
|
}
|
|
402
398
|
}
|
|
403
|
-
exports.OpenFinModule = OpenFinModule;
|
package/src/OpenFinApiImpl.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const OpenFinRedux = tslib_1.__importStar(require("./Redux/ActionReducers/OpenFinRedux"));
|
|
8
|
-
const openfin_notifications_1 = require("openfin-notifications");
|
|
9
|
-
const isRunningInOpenfin_1 = require("./Utilities/isRunningInOpenfin");
|
|
10
|
-
const Icon_1 = require("@adaptabletools/adaptable/src/components/Icon");
|
|
1
|
+
import { ApiBase } from '@adaptabletools/adaptable/src/Api/Implementation/ApiBase';
|
|
2
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
3
|
+
import * as OpenFinRedux from './Redux/ActionReducers/OpenFinRedux';
|
|
4
|
+
import { addEventListener, create } from 'openfin-notifications';
|
|
5
|
+
import { isRunningInOpenfin } from './Utilities/isRunningInOpenfin';
|
|
6
|
+
import { isAdaptableCustomIcon } from '@adaptabletools/adaptable/src/components/Icon';
|
|
11
7
|
// needed because otherwise openfin-notifications is not initialized properly
|
|
12
8
|
// as it assumes it's running before DOMContentLoaded, but nextjs and other bundlers
|
|
13
9
|
// might inject it after DOMContentLoaded is fired - so we fire it programatically
|
|
@@ -19,13 +15,13 @@ if (typeof window !== 'undefined' && window.document) {
|
|
|
19
15
|
}));
|
|
20
16
|
}
|
|
21
17
|
const CLICK_ALERT_BUTTON = 'adaptable-click-alert-button';
|
|
22
|
-
class OpenFinApiImpl extends
|
|
18
|
+
export class OpenFinApiImpl extends ApiBase {
|
|
23
19
|
constructor(adaptable, options) {
|
|
24
20
|
super(adaptable);
|
|
25
21
|
this.OpenFinService = null;
|
|
26
22
|
this.options = options;
|
|
27
|
-
if (
|
|
28
|
-
|
|
23
|
+
if (isRunningInOpenfin()) {
|
|
24
|
+
addEventListener('notification-action', (event) => {
|
|
29
25
|
var _a, _b, _c, _d, _e;
|
|
30
26
|
if (this.options.onValidationFailureInExcel === 'show-undo-notification' &&
|
|
31
27
|
((_a = event.notification.customData) === null || _a === void 0 ? void 0 : _a.name) === 'validation-failed') {
|
|
@@ -111,7 +107,7 @@ class OpenFinApiImpl extends ApiBase_1.ApiBase {
|
|
|
111
107
|
}
|
|
112
108
|
const showIcon = this.options.showAppIconInNotifications;
|
|
113
109
|
const appIcon = (_a = this.adaptable.api.optionsApi.getUserInterfaceOptions()) === null || _a === void 0 ? void 0 : _a.applicationIcon;
|
|
114
|
-
if (!notification.icon && showIcon &&
|
|
110
|
+
if (!notification.icon && showIcon && isAdaptableCustomIcon(appIcon)) {
|
|
115
111
|
notification.icon = appIcon.src;
|
|
116
112
|
}
|
|
117
113
|
const fn = this.options.onShowNotification;
|
|
@@ -119,7 +115,7 @@ class OpenFinApiImpl extends ApiBase_1.ApiBase {
|
|
|
119
115
|
return;
|
|
120
116
|
}
|
|
121
117
|
// see https://developers.openfin.co/of-docs/docs/customize-notifications
|
|
122
|
-
|
|
118
|
+
create(notification);
|
|
123
119
|
}
|
|
124
120
|
getOpenFinState() {
|
|
125
121
|
return this.getAdaptableState().System;
|
|
@@ -127,7 +123,7 @@ class OpenFinApiImpl extends ApiBase_1.ApiBase {
|
|
|
127
123
|
isOpenFinRunning() {
|
|
128
124
|
let OpenFinState = this.getOpenFinState();
|
|
129
125
|
if (OpenFinState) {
|
|
130
|
-
return
|
|
126
|
+
return isRunningInOpenfin();
|
|
131
127
|
}
|
|
132
128
|
return false;
|
|
133
129
|
}
|
|
@@ -165,4 +161,3 @@ class OpenFinApiImpl extends ApiBase_1.ApiBase {
|
|
|
165
161
|
this.adaptable.ReportService.PublishLiveLiveDataChangedEvent('OpenFin', 'LiveDataStopped', currentLiveReport);
|
|
166
162
|
}
|
|
167
163
|
}
|
|
168
|
-
exports.OpenFinApiImpl = OpenFinApiImpl;
|
package/src/OpenFinHelper.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*import { ExcelWorkbook } from '../Services/OpenfinLiveExcel/ExcelWorkbook';*/
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OpenfinHelper = exports.initOpenFinExcel = exports.pushData = exports.isExcelOpenfinLoaded = exports.isRunningInOpenfin = exports.OnWorkbookSaved = exports.OnWorkbookDisconnected = exports.OnExcelDisconnected = exports.EventDispatcher = void 0;
|
|
5
2
|
// putting this here as we dont use it elswhere - so keeping it here until we redo the OpenFin one day...
|
|
6
|
-
|
|
7
|
-
class EventDispatcher {
|
|
3
|
+
import { AdaptableLogger } from '@adaptabletools/adaptable/src/agGrid/AdaptableLogger';
|
|
4
|
+
export class EventDispatcher {
|
|
8
5
|
constructor() {
|
|
9
6
|
this._subscriptions = new Array();
|
|
10
7
|
}
|
|
@@ -25,7 +22,6 @@ class EventDispatcher {
|
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
exports.EventDispatcher = EventDispatcher;
|
|
29
25
|
var ExcelServiceStatus;
|
|
30
26
|
(function (ExcelServiceStatus) {
|
|
31
27
|
ExcelServiceStatus["Unknown"] = "Unknown";
|
|
@@ -38,31 +34,26 @@ let excelStatus = ExcelServiceStatus.Unknown;
|
|
|
38
34
|
let _onExcelDisconnected = new EventDispatcher();
|
|
39
35
|
let _onWorkbookDisconnected = new EventDispatcher();
|
|
40
36
|
let _onWorkbookSaved = new EventDispatcher();
|
|
41
|
-
function OnExcelDisconnected() {
|
|
37
|
+
export function OnExcelDisconnected() {
|
|
42
38
|
return _onExcelDisconnected;
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
function OnWorkbookDisconnected() {
|
|
40
|
+
export function OnWorkbookDisconnected() {
|
|
46
41
|
return _onWorkbookDisconnected;
|
|
47
42
|
}
|
|
48
|
-
|
|
49
|
-
function OnWorkbookSaved() {
|
|
43
|
+
export function OnWorkbookSaved() {
|
|
50
44
|
return _onWorkbookSaved;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
|
-
function isRunningInOpenfin() {
|
|
46
|
+
export function isRunningInOpenfin() {
|
|
54
47
|
return 'fin' in window && 'desktop' in fin;
|
|
55
48
|
}
|
|
56
|
-
|
|
57
|
-
function isExcelOpenfinLoaded() {
|
|
49
|
+
export function isExcelOpenfinLoaded() {
|
|
58
50
|
return isRunningInOpenfin() && 'Excel' in fin.desktop;
|
|
59
51
|
}
|
|
60
|
-
exports.isExcelOpenfinLoaded = isExcelOpenfinLoaded;
|
|
61
52
|
function addWorkbook() {
|
|
62
53
|
return new Promise((resolve, reject) => {
|
|
63
|
-
|
|
54
|
+
AdaptableLogger.consoleLogBase('Creating new workbook');
|
|
64
55
|
fin.desktop.Excel.addWorkbook(function (workbook /*ExcelWorkbook*/) {
|
|
65
|
-
|
|
56
|
+
AdaptableLogger.consoleLogBase('workbook created:' + workbook.name);
|
|
66
57
|
resolve(workbook.name);
|
|
67
58
|
// workbook.addEventListener("workbookActivated", (event) => onWorkbookActivated(event, resolve));
|
|
68
59
|
// workbook.activate();
|
|
@@ -91,11 +82,11 @@ function addWorkbook() {
|
|
|
91
82
|
// // });
|
|
92
83
|
// });
|
|
93
84
|
// }
|
|
94
|
-
function pushData(workBookName, data) {
|
|
85
|
+
export function pushData(workBookName, data) {
|
|
95
86
|
return new Promise((resolve, reject) => {
|
|
96
87
|
let workBook = fin.desktop.Excel.getWorkbookByName(workBookName);
|
|
97
88
|
if (!workBook) {
|
|
98
|
-
|
|
89
|
+
AdaptableLogger.consoleErrorBase('Cannot find workbook:' + workBookName);
|
|
99
90
|
reject('Cannot find workbook:' + workBookName);
|
|
100
91
|
}
|
|
101
92
|
let worksheet = workBook.getWorksheetByName('Sheet1');
|
|
@@ -103,11 +94,10 @@ function pushData(workBookName, data) {
|
|
|
103
94
|
resolve();
|
|
104
95
|
});
|
|
105
96
|
}
|
|
106
|
-
exports.pushData = pushData;
|
|
107
97
|
/**
|
|
108
98
|
* @deprecated not used anymore
|
|
109
99
|
*/
|
|
110
|
-
function initOpenFinExcel() {
|
|
100
|
+
export function initOpenFinExcel() {
|
|
111
101
|
// fin.desktop.main(function () {
|
|
112
102
|
fin.desktop.Excel.init();
|
|
113
103
|
if (excelStatus == ExcelServiceStatus.Unknown) {
|
|
@@ -117,7 +107,7 @@ function initOpenFinExcel() {
|
|
|
117
107
|
.then(onExcelConnected)
|
|
118
108
|
.then(addWorkbook)
|
|
119
109
|
.catch((err) => {
|
|
120
|
-
|
|
110
|
+
AdaptableLogger.consoleErrorBase(err);
|
|
121
111
|
return '';
|
|
122
112
|
});
|
|
123
113
|
}
|
|
@@ -127,19 +117,18 @@ function initOpenFinExcel() {
|
|
|
127
117
|
.then(onExcelConnected)
|
|
128
118
|
.then(addWorkbook)
|
|
129
119
|
.catch((err) => {
|
|
130
|
-
|
|
120
|
+
AdaptableLogger.consoleErrorBase(err);
|
|
131
121
|
return '';
|
|
132
122
|
});
|
|
133
123
|
}
|
|
134
124
|
// });
|
|
135
125
|
}
|
|
136
|
-
exports.initOpenFinExcel = initOpenFinExcel;
|
|
137
126
|
function initExcelPluginService() {
|
|
138
127
|
var installFolder = '%localappdata%\\OpenFin\\shared\\assets\\excel-api-addin';
|
|
139
128
|
var servicePath = 'OpenFin.ExcelService.exe';
|
|
140
129
|
var addInPath = 'OpenFin.ExcelApi-AddIn.xll';
|
|
141
130
|
if (excelStatus != ExcelServiceStatus.Unknown) {
|
|
142
|
-
|
|
131
|
+
AdaptableLogger.consoleLogBase('Skipping Add-in deployment as already deployed');
|
|
143
132
|
return Promise.resolve();
|
|
144
133
|
}
|
|
145
134
|
excelStatus = ExcelServiceStatus.Connecting;
|
|
@@ -150,13 +139,13 @@ function initExcelPluginService() {
|
|
|
150
139
|
}
|
|
151
140
|
function deployAddIn(servicePath, installFolder) {
|
|
152
141
|
return new Promise((resolve, reject) => {
|
|
153
|
-
|
|
142
|
+
AdaptableLogger.consoleLogBase('Deploying Add-In');
|
|
154
143
|
fin.desktop.System.launchExternalProcess({
|
|
155
144
|
alias: 'excel-api-addin',
|
|
156
145
|
target: servicePath,
|
|
157
146
|
arguments: '-d "' + installFolder + '"',
|
|
158
147
|
listener: function (args) {
|
|
159
|
-
|
|
148
|
+
AdaptableLogger.consoleLogBase('Installer script completed! ' + args.exitCode);
|
|
160
149
|
resolve();
|
|
161
150
|
},
|
|
162
151
|
});
|
|
@@ -168,12 +157,12 @@ function startExcelService(servicePath, installFolder) {
|
|
|
168
157
|
fin.desktop.System.getAllExternalApplications((extApps) => {
|
|
169
158
|
var excelServiceIndex = extApps.findIndex((extApp) => extApp.uuid === serviceUuid);
|
|
170
159
|
if (excelServiceIndex >= 0) {
|
|
171
|
-
|
|
160
|
+
AdaptableLogger.consoleLogBase('Service Already Running');
|
|
172
161
|
resolve();
|
|
173
162
|
return;
|
|
174
163
|
}
|
|
175
164
|
var onServiceStarted = () => {
|
|
176
|
-
|
|
165
|
+
AdaptableLogger.consoleLogBase('Service Started');
|
|
177
166
|
fin.desktop.Excel.instance.removeEventListener('started', onServiceStarted);
|
|
178
167
|
resolve();
|
|
179
168
|
};
|
|
@@ -184,7 +173,7 @@ function startExcelService(servicePath, installFolder) {
|
|
|
184
173
|
arguments: '-p ' + details.port,
|
|
185
174
|
uuid: serviceUuid,
|
|
186
175
|
}, (process) => {
|
|
187
|
-
|
|
176
|
+
AdaptableLogger.consoleLogBase('Service Launched: ' + process.uuid);
|
|
188
177
|
}, (error) => {
|
|
189
178
|
reject('Error starting Excel service');
|
|
190
179
|
});
|
|
@@ -194,9 +183,9 @@ function startExcelService(servicePath, installFolder) {
|
|
|
194
183
|
}
|
|
195
184
|
function registerAddIn(servicePath, installFolder) {
|
|
196
185
|
return new Promise((resolve, reject) => {
|
|
197
|
-
|
|
186
|
+
AdaptableLogger.consoleLogBase('Registering Add-In');
|
|
198
187
|
fin.desktop.Excel.install((ack) => {
|
|
199
|
-
|
|
188
|
+
AdaptableLogger.consoleLogBase('Add-In Registration callback', ack);
|
|
200
189
|
//if (ack.success) {
|
|
201
190
|
resolve();
|
|
202
191
|
//}
|
|
@@ -207,11 +196,11 @@ function connectToExcel() {
|
|
|
207
196
|
return new Promise((resolve, reject) => {
|
|
208
197
|
fin.desktop.Excel.instance.getExcelInstances((instances) => {
|
|
209
198
|
if (instances.length > 0) {
|
|
210
|
-
|
|
199
|
+
AdaptableLogger.consoleLogBase('Excel Already Running');
|
|
211
200
|
resolve();
|
|
212
201
|
}
|
|
213
202
|
else {
|
|
214
|
-
|
|
203
|
+
AdaptableLogger.consoleLogBase('Launching Excel');
|
|
215
204
|
fin.desktop.Excel.run(resolve);
|
|
216
205
|
}
|
|
217
206
|
});
|
|
@@ -225,19 +214,19 @@ function onWorkbookSaved(event) {
|
|
|
225
214
|
_onWorkbookSaved.Dispatch(this, { OldName: event.oldWorkbookName, NewName: event.workbook.name });
|
|
226
215
|
}
|
|
227
216
|
function onWorkbookActivated(event) {
|
|
228
|
-
|
|
217
|
+
AdaptableLogger.consoleLogBase('Workbook Activated: ' + event.target.name);
|
|
229
218
|
event.target.getWorksheets((ack) => {
|
|
230
|
-
|
|
219
|
+
AdaptableLogger.consoleLogBase('getWorksheets:', ack);
|
|
231
220
|
});
|
|
232
221
|
}
|
|
233
222
|
function onWorkbookAdded(event) {
|
|
234
|
-
|
|
223
|
+
AdaptableLogger.consoleLogBase('Workbook Added: ' + event.workbook.name);
|
|
235
224
|
let workbook = event.workbook;
|
|
236
225
|
workbook.addEventListener('workbookActivated', onWorkbookActivated);
|
|
237
226
|
}
|
|
238
227
|
function onExcelConnected() {
|
|
239
228
|
if (excelStatus != ExcelServiceStatus.Connected) {
|
|
240
|
-
|
|
229
|
+
AdaptableLogger.consoleLogBase('Excel Connected: ' + fin.desktop.Excel.legacyApi.connectionUuid);
|
|
241
230
|
excelStatus = ExcelServiceStatus.Connected;
|
|
242
231
|
// fin.desktop.Excel.instance.removeEventListener("excelConnected", onExcelConnected);
|
|
243
232
|
fin.desktop.Excel.addEventListener('workbookClosed', onWorkbookRemoved);
|
|
@@ -246,7 +235,7 @@ function onExcelConnected() {
|
|
|
246
235
|
// Grab a snapshot of the current instance, it can change!
|
|
247
236
|
var legacyApi = fin.desktop.Excel.legacyApi;
|
|
248
237
|
var onExcelDisconnected = function () {
|
|
249
|
-
|
|
238
|
+
AdaptableLogger.consoleLogBase('Excel Disconnected: ' + legacyApi.connectionUuid);
|
|
250
239
|
fin.desktop.Excel.instance.removeEventListener('excelDisconnected', onExcelDisconnected);
|
|
251
240
|
legacyApi.removeEventListener('workbookClosed', onWorkbookRemoved);
|
|
252
241
|
legacyApi.removeEventListener('workbookSaved', onWorkbookSaved);
|
|
@@ -264,7 +253,7 @@ function onExcelConnected() {
|
|
|
264
253
|
fin.desktop.Excel.instance.addEventListener('excelDisconnected', onExcelDisconnected);
|
|
265
254
|
}
|
|
266
255
|
}
|
|
267
|
-
|
|
256
|
+
export const OpenfinHelper = {
|
|
268
257
|
OnExcelDisconnected,
|
|
269
258
|
OnWorkbookDisconnected,
|
|
270
259
|
OnWorkbookSaved,
|
|
@@ -273,4 +262,4 @@ exports.OpenfinHelper = {
|
|
|
273
262
|
pushData,
|
|
274
263
|
initOpenFinExcel,
|
|
275
264
|
};
|
|
276
|
-
|
|
265
|
+
export default OpenfinHelper;
|
|
@@ -1,51 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const GeneralConstants_1 = require("@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants");
|
|
6
|
-
const OpenFinStartLiveData = (openFinReport) => ({
|
|
7
|
-
type: PluginsRedux_1.OPENFIN_START_LIVE_DATA,
|
|
1
|
+
import { OPENFIN_START_LIVE_DATA, OPENFIN_STOP_LIVE_DATA, OPENFIN_LIVE_REPORT_SET, OPENFIN_LIVE_REPORT_CLEAR, OPENFIN_SET_CURRENT_REPORTNAME, } from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PluginsRedux';
|
|
2
|
+
import { EMPTY_STRING } from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
3
|
+
export const OpenFinStartLiveData = (openFinReport) => ({
|
|
4
|
+
type: OPENFIN_START_LIVE_DATA,
|
|
8
5
|
openFinReport: openFinReport,
|
|
9
6
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type: PluginsRedux_1.OPENFIN_STOP_LIVE_DATA,
|
|
7
|
+
export const OpenFinStopLiveData = (openFinReport) => ({
|
|
8
|
+
type: OPENFIN_STOP_LIVE_DATA,
|
|
13
9
|
openFinReport: openFinReport,
|
|
14
10
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: PluginsRedux_1.OPENFIN_LIVE_REPORT_SET,
|
|
11
|
+
export const OpenFinLiveReportSet = (openFinReport) => ({
|
|
12
|
+
type: OPENFIN_LIVE_REPORT_SET,
|
|
18
13
|
openFinReport: openFinReport,
|
|
19
14
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type: PluginsRedux_1.OPENFIN_LIVE_REPORT_CLEAR,
|
|
15
|
+
export const OpenFinLiveReportClear = () => ({
|
|
16
|
+
type: OPENFIN_LIVE_REPORT_CLEAR,
|
|
23
17
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type: PluginsRedux_1.OPENFIN_SET_CURRENT_REPORTNAME,
|
|
18
|
+
export const OpenFinSetCurrentReportName = (reportName) => ({
|
|
19
|
+
type: OPENFIN_SET_CURRENT_REPORTNAME,
|
|
27
20
|
reportName,
|
|
28
21
|
});
|
|
29
|
-
|
|
30
|
-
exports.initialOpenFinState = {
|
|
22
|
+
export const initialOpenFinState = {
|
|
31
23
|
CurrentLiveOpenFinReport: undefined,
|
|
32
|
-
OpenFinCurrentReportName:
|
|
24
|
+
OpenFinCurrentReportName: EMPTY_STRING,
|
|
33
25
|
};
|
|
34
|
-
const OpenFinReducer = (
|
|
26
|
+
export const OpenFinReducer = (
|
|
35
27
|
// initial state is handled in the plugin rootReducer
|
|
36
28
|
state, action) => {
|
|
37
29
|
switch (action.type) {
|
|
38
|
-
case
|
|
30
|
+
case OPENFIN_START_LIVE_DATA: {
|
|
39
31
|
const actionType = action;
|
|
40
32
|
return Object.assign({}, state, { CurrentLiveOpenFinReport: actionType.openFinReport });
|
|
41
33
|
}
|
|
42
|
-
case
|
|
34
|
+
case OPENFIN_LIVE_REPORT_CLEAR: {
|
|
43
35
|
return Object.assign({}, state, { CurrentLiveOpenFinReport: undefined });
|
|
44
36
|
}
|
|
45
|
-
case
|
|
37
|
+
case OPENFIN_STOP_LIVE_DATA: {
|
|
46
38
|
return Object.assign({}, state, { CurrentLiveOpenFinReport: undefined });
|
|
47
39
|
}
|
|
48
|
-
case
|
|
40
|
+
case OPENFIN_SET_CURRENT_REPORTNAME: {
|
|
49
41
|
const actionType = action;
|
|
50
42
|
return Object.assign({}, state, { OpenFinCurrentReportName: actionType.reportName });
|
|
51
43
|
}
|
|
@@ -53,4 +45,3 @@ state, action) => {
|
|
|
53
45
|
return state;
|
|
54
46
|
}
|
|
55
47
|
};
|
|
56
|
-
exports.OpenFinReducer = OpenFinReducer;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const Emitter_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/Utilities/Emitter"));
|
|
6
|
-
const setup_1 = require("./setup");
|
|
7
|
-
const isRunningInOpenfin_1 = require("../isRunningInOpenfin");
|
|
8
|
-
if ((0, isRunningInOpenfin_1.isRunningInOpenfin)()) {
|
|
1
|
+
import Emitter from '@adaptabletools/adaptable/src/Utilities/Emitter';
|
|
2
|
+
import { setup } from './setup';
|
|
3
|
+
import { isRunningInOpenfin } from '../isRunningInOpenfin';
|
|
4
|
+
if (isRunningInOpenfin()) {
|
|
9
5
|
require('../../excel-service/index.js');
|
|
10
6
|
}
|
|
11
|
-
function isExcelOpenfinLoaded() {
|
|
12
|
-
return
|
|
7
|
+
export function isExcelOpenfinLoaded() {
|
|
8
|
+
return isRunningInOpenfin() && 'Excel' in fin.desktop;
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
class OpenFinService {
|
|
10
|
+
export class OpenFinService {
|
|
16
11
|
getOpenFinApi() {
|
|
17
12
|
return this.adaptable.api.pluginsApi.getOpenFinPluginApi();
|
|
18
13
|
}
|
|
@@ -64,7 +59,7 @@ class OpenFinService {
|
|
|
64
59
|
}
|
|
65
60
|
doPushData(data, { address, clear }) {
|
|
66
61
|
const OpenFinApi = this.getOpenFinApi();
|
|
67
|
-
if (!OpenFinApi || !this.options || !
|
|
62
|
+
if (!OpenFinApi || !this.options || !isRunningInOpenfin()) {
|
|
68
63
|
return Promise.reject('OpenFinService error');
|
|
69
64
|
}
|
|
70
65
|
let resolve = () => { };
|
|
@@ -122,7 +117,7 @@ class OpenFinService {
|
|
|
122
117
|
return this.initialisingExcel;
|
|
123
118
|
}
|
|
124
119
|
this.connectedCallbacks.push(callback);
|
|
125
|
-
this.initialisingExcel =
|
|
120
|
+
this.initialisingExcel = setup()
|
|
126
121
|
.then(() => {
|
|
127
122
|
fin.desktop.ExcelService.addEventListener('excelConnected', this.onExcelConnected);
|
|
128
123
|
fin.desktop.ExcelService.addEventListener('excelDisconnected', this.onExcelDisconnected);
|
|
@@ -245,7 +240,6 @@ class OpenFinService {
|
|
|
245
240
|
};
|
|
246
241
|
this.adaptable = adaptable;
|
|
247
242
|
this.options = options;
|
|
248
|
-
this.emitter = new
|
|
243
|
+
this.emitter = new Emitter();
|
|
249
244
|
}
|
|
250
245
|
}
|
|
251
|
-
exports.OpenFinService = OpenFinService;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.setup = void 0;
|
|
4
|
-
const AdaptableLogger_1 = require("@adaptabletools/adaptable/src/agGrid/AdaptableLogger");
|
|
5
|
-
const setup = async () => {
|
|
1
|
+
import { AdaptableLogger } from '@adaptabletools/adaptable/src/agGrid/AdaptableLogger';
|
|
2
|
+
export const setup = async () => {
|
|
6
3
|
const excelAssetAlias = 'excel-api-addin';
|
|
7
4
|
const excelServiceUuid = '886834D1-4651-4872-996C-7B2578E953B9';
|
|
8
5
|
const installFolder = '%localappdata%\\OpenFin\\shared\\assets\\excel-api-addin';
|
|
@@ -12,11 +9,11 @@ const setup = async () => {
|
|
|
12
9
|
let serviceIsRunning = await isServiceRunning();
|
|
13
10
|
let assetInfo = await getAppAssetInfo();
|
|
14
11
|
if (serviceIsRunning) {
|
|
15
|
-
|
|
12
|
+
AdaptableLogger.consoleLogBase('Service Already Running: Skipping Deployment and Registration');
|
|
16
13
|
return;
|
|
17
14
|
}
|
|
18
15
|
if (assetInfo.version === localStorage.installedAssetVersion && !assetInfo.forceDownload) {
|
|
19
|
-
|
|
16
|
+
AdaptableLogger.consoleLogBase('Current Add-In version previously installed: Skipping Deployment and Registration');
|
|
20
17
|
}
|
|
21
18
|
else {
|
|
22
19
|
await deploySharedAssets();
|
|
@@ -58,7 +55,7 @@ const setup = async () => {
|
|
|
58
55
|
target: servicePath,
|
|
59
56
|
arguments: `-d "${installFolder}" -c ${manifest.runtime.version}`,
|
|
60
57
|
listener: (result) => {
|
|
61
|
-
|
|
58
|
+
AdaptableLogger.consoleLogBase(`Asset Deployment completed! Exit Code: ${result.exitCode}`);
|
|
62
59
|
resolve();
|
|
63
60
|
},
|
|
64
61
|
}, () => console.log('Deploying Shared Assets'), (err) => reject(err));
|
|
@@ -72,14 +69,14 @@ const setup = async () => {
|
|
|
72
69
|
arguments: `-i "${installFolder}"`,
|
|
73
70
|
listener: (result) => {
|
|
74
71
|
if (result.exitCode === 0) {
|
|
75
|
-
|
|
72
|
+
AdaptableLogger.consoleLogBase('Add-In Installed');
|
|
76
73
|
}
|
|
77
74
|
else {
|
|
78
|
-
|
|
75
|
+
AdaptableLogger.consoleWarnBase(`Installation failed. Exit code: ${result.exitCode}`);
|
|
79
76
|
}
|
|
80
77
|
resolve();
|
|
81
78
|
},
|
|
82
|
-
}, () =>
|
|
79
|
+
}, () => AdaptableLogger.consoleLogBase('Installing Add-In'), (err) => reject(err));
|
|
83
80
|
});
|
|
84
81
|
}
|
|
85
82
|
function startExcelService() {
|
|
@@ -98,7 +95,7 @@ const setup = async () => {
|
|
|
98
95
|
arguments: '-p ' + details.port,
|
|
99
96
|
uuid: excelServiceUuid,
|
|
100
97
|
}, (process) => {
|
|
101
|
-
|
|
98
|
+
AdaptableLogger.consoleLogBase('Service Launched: ' + process.uuid);
|
|
102
99
|
}, (error) => {
|
|
103
100
|
reject('Error starting Excel service');
|
|
104
101
|
});
|
|
@@ -106,4 +103,3 @@ const setup = async () => {
|
|
|
106
103
|
});
|
|
107
104
|
}
|
|
108
105
|
};
|
|
109
|
-
exports.setup = setup;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRunningInOpenfin = void 0;
|
|
4
|
-
function isRunningInOpenfin() {
|
|
1
|
+
export function isRunningInOpenfin() {
|
|
5
2
|
return 'fin' in window && 'desktop' in fin;
|
|
6
3
|
}
|
|
7
|
-
exports.isRunningInOpenfin = isRunningInOpenfin;
|
package/src/View/OpenFinPopup.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const PanelWithButton_1 = require("@adaptabletools/adaptable/src/View/Components/Panels/PanelWithButton");
|
|
8
|
-
const TeamSharingRedux = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Redux/ActionsReducers/TeamSharingRedux"));
|
|
9
|
-
const ModuleConstants = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants"));
|
|
10
|
-
const UIHelper_1 = require("@adaptabletools/adaptable/src/View/UIHelper");
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { PanelWithButton } from '@adaptabletools/adaptable/src/View/Components/Panels/PanelWithButton';
|
|
4
|
+
import * as TeamSharingRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/TeamSharingRedux';
|
|
5
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
6
|
+
import { UIHelper } from '@adaptabletools/adaptable/src/View/UIHelper';
|
|
11
7
|
class OpenFinPopupComponent extends React.Component {
|
|
12
8
|
constructor(props) {
|
|
13
9
|
super(props);
|
|
14
10
|
this.shouldClosePopupOnFinishWizard = false;
|
|
15
|
-
this.state =
|
|
11
|
+
this.state = UIHelper.getEmptyConfigState();
|
|
16
12
|
}
|
|
17
13
|
componentDidMount() {
|
|
18
14
|
if (this.props.popupParams) {
|
|
@@ -21,7 +17,7 @@ class OpenFinPopupComponent extends React.Component {
|
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
19
|
render() {
|
|
24
|
-
return (React.createElement(
|
|
20
|
+
return (React.createElement(PanelWithButton, { headerText: this.props.moduleInfo.FriendlyName, bodyProps: { padding: 0 }, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed() }));
|
|
25
21
|
}
|
|
26
22
|
onApplyExport(OpenFinReport) {
|
|
27
23
|
this.props.onOpenFinSendSnapshot(OpenFinReport);
|
|
@@ -35,4 +31,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
35
31
|
onShare: (entity, config) => dispatch(TeamSharingRedux.TeamSharingShare(entity, ModuleConstants.OpenFinModuleId, config)),
|
|
36
32
|
};
|
|
37
33
|
}
|
|
38
|
-
|
|
34
|
+
export const OpenFinPopup = connect(mapStateToProps, mapDispatchToProps)(OpenFinPopupComponent);
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const ModuleConstants = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants"));
|
|
18
|
-
const ObjectFactory_1 = require("@adaptabletools/adaptable/src/Utilities/ObjectFactory");
|
|
19
|
-
const react_redux_1 = require("react-redux");
|
|
20
|
-
const IS_OPENFIN = (0, isRunningInOpenfin_1.isRunningInOpenfin)();
|
|
1
|
+
import * as OpenFinRedux from '../Redux/ActionReducers/OpenFinRedux';
|
|
2
|
+
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
3
|
+
import { isRunningInOpenfin } from '../Utilities/isRunningInOpenfin';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import * as GeneralConstants from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
6
|
+
import { StringExtensions } from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
7
|
+
import { Flex } from 'rebass';
|
|
8
|
+
import Dropdown from '@adaptabletools/adaptable/src/components/Dropdown';
|
|
9
|
+
import { ButtonPause } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonPause';
|
|
10
|
+
import { ButtonPlay } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonPlay';
|
|
11
|
+
import join from '@adaptabletools/adaptable/src/components/utils/join';
|
|
12
|
+
import { ButtonSchedule } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonSchedule';
|
|
13
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
14
|
+
import { CreateEmptyOpenFinSchedule } from '@adaptabletools/adaptable/src/Utilities/ObjectFactory';
|
|
15
|
+
import { connect } from 'react-redux';
|
|
16
|
+
const IS_OPENFIN = isRunningInOpenfin();
|
|
21
17
|
class OpenFinViewPanelComponent extends React.Component {
|
|
22
18
|
constructor(props) {
|
|
23
19
|
super(props);
|
|
@@ -55,18 +51,18 @@ class OpenFinViewPanelComponent extends React.Component {
|
|
|
55
51
|
});
|
|
56
52
|
// this is clearly ridiculous!
|
|
57
53
|
// im getting tired...
|
|
58
|
-
let isCompletedReport =
|
|
54
|
+
let isCompletedReport = StringExtensions.IsNotNullOrEmpty(this.props.currentReportName);
|
|
59
55
|
let isLiveOpenFinReport = isCompletedReport &&
|
|
60
56
|
this.props.CurrentLiveOpenFinReport &&
|
|
61
57
|
this.props.currentReportName == this.props.CurrentLiveOpenFinReport.ReportName;
|
|
62
58
|
const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
63
|
-
return (React.createElement(
|
|
64
|
-
React.createElement(
|
|
65
|
-
React.createElement(
|
|
66
|
-
React.createElement(
|
|
67
|
-
isLiveOpenFinReport ? (React.createElement(
|
|
68
|
-
React.createElement(
|
|
69
|
-
React.createElement(
|
|
59
|
+
return (React.createElement(Flex, { flexDirection: "row", className: `ab-${elementType}__OpenFin__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
|
|
60
|
+
React.createElement(Flex, null,
|
|
61
|
+
React.createElement(Dropdown, { disabled: !IS_OPENFIN || allReports.length == 0 || isLiveOpenFinReport, style: { minWidth: 160 }, options: availableReports, className: `ab-${elementType}__OpenFin__select`, placeholder: !IS_OPENFIN ? 'Not available' : 'Select Report', onChange: (reportName) => this.onSelectedReportChanged(reportName), value: this.props.currentReportName, showClearButton: true, marginRight: 2 })),
|
|
62
|
+
React.createElement(Flex, null,
|
|
63
|
+
isLiveOpenFinReport ? (React.createElement(ButtonPause, { fillColor: 'red', marginLeft: 1, className: `ab-${elementType}__OpenFin__pause`, onClick: () => this.getOpenFinApi().stopLiveData(), tooltip: "Stop sync with OpenFin", disabled: !isLiveOpenFinReport, accessLevel: this.props.accessLevel })) : (React.createElement(ButtonPlay, { marginLeft: 1, className: `ab-${elementType}__OpenFin__play`, onClick: () => this.onOpenFinStartLiveData(), tooltip: "Start sync with OpenFin", disabled: isLiveOpenFinReport || !isCompletedReport, accessLevel: this.props.accessLevel })),
|
|
64
|
+
React.createElement(Flex, { className: join(this.props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__OpenFin__controls`), alignItems: "stretch" },
|
|
65
|
+
React.createElement(ButtonSchedule, { marginLeft: 1, className: `ab-${elementType}__OpenFin__schedule`, onClick: () => this.onNewOpenFinSchedule(), tooltip: "Schedule", disabled: !IS_OPENFIN, accessLevel: this.props.accessLevel })))));
|
|
70
66
|
}
|
|
71
67
|
onSelectedReportChanged(reportName) {
|
|
72
68
|
if (reportName == undefined) {
|
|
@@ -105,9 +101,9 @@ function mapDispatchToProps(dispatch) {
|
|
|
105
101
|
onNewOpenFinSchedule: () => dispatch(PopupRedux.PopupShowScreen(ModuleConstants.ScheduleModuleId, 'SchedulePopup', {
|
|
106
102
|
action: 'New',
|
|
107
103
|
source: 'Other',
|
|
108
|
-
value:
|
|
104
|
+
value: CreateEmptyOpenFinSchedule(),
|
|
109
105
|
})),
|
|
110
106
|
onCurrentReportNameChange: (reportName) => dispatch(OpenFinRedux.OpenFinSetCurrentReportName(reportName)),
|
|
111
107
|
};
|
|
112
108
|
}
|
|
113
|
-
|
|
109
|
+
export const OpenFinViewPanelControl = connect(mapStateToProps, mapDispatchToProps)(OpenFinViewPanelComponent);
|
package/src/index.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
1
|
+
import { AdaptablePlugin, } from '@adaptabletools/adaptable/types';
|
|
2
|
+
// TODO in the future, try to put back the version check
|
|
3
|
+
// import { version, name } from '../package.json';
|
|
4
|
+
// import { version as coreVersion } from '@adaptabletools/adaptable/package.json';
|
|
5
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
6
|
+
import { OpenFinModuleId } from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
7
|
+
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
8
|
+
import { AdaptableViewPanelFactory } from '@adaptabletools/adaptable/src/View/AdaptableViewFactory';
|
|
9
|
+
import { OpenFinModule } from './Module/OpenFinModule';
|
|
10
|
+
import { OpenFinApiImpl } from './OpenFinApiImpl';
|
|
11
|
+
import { OpenFinService } from './Utilities/Services/OpenFinService';
|
|
12
|
+
import { initialOpenFinState, OpenFinReducer } from './Redux/ActionReducers/OpenFinRedux';
|
|
13
|
+
import { OPENFIN_START_LIVE_DATA, OPENFIN_STOP_LIVE_DATA, } from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PluginsRedux';
|
|
14
|
+
import { OpenFinViewPanelControl } from './View/OpenFinViewPanel';
|
|
15
|
+
// const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
16
|
+
// if (version !== coreVersion) {
|
|
17
|
+
// console.warn(`
|
|
18
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
19
|
+
// !!!!!!! "@adaptabletools/adaptable-plugin-openfin${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
|
|
20
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
21
|
+
// `);
|
|
22
|
+
// }
|
|
24
23
|
const defaultOptions = {
|
|
25
24
|
throttleTime: 2000,
|
|
26
25
|
notificationTimeout: 5000,
|
|
@@ -28,7 +27,7 @@ const defaultOptions = {
|
|
|
28
27
|
showAppIconInNotifications: true,
|
|
29
28
|
onValidationFailureInExcel: 'show-undo-notification',
|
|
30
29
|
};
|
|
31
|
-
class OpenFinPlugin extends
|
|
30
|
+
class OpenFinPlugin extends AdaptablePlugin {
|
|
32
31
|
constructor(options) {
|
|
33
32
|
super(options);
|
|
34
33
|
this.pluginId = 'openfin';
|
|
@@ -39,9 +38,9 @@ class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
|
39
38
|
if (!state) {
|
|
40
39
|
// required for store initialization
|
|
41
40
|
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
42
|
-
augmentedState = Object.assign({}, augmentedState,
|
|
41
|
+
augmentedState = Object.assign({}, augmentedState, initialOpenFinState);
|
|
43
42
|
}
|
|
44
|
-
return
|
|
43
|
+
return OpenFinReducer(augmentedState, action);
|
|
45
44
|
},
|
|
46
45
|
};
|
|
47
46
|
};
|
|
@@ -49,13 +48,13 @@ class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
|
49
48
|
return (next) => {
|
|
50
49
|
return (action) => {
|
|
51
50
|
switch (action.type) {
|
|
52
|
-
case
|
|
51
|
+
case OPENFIN_START_LIVE_DATA: {
|
|
53
52
|
const actionTyped = action;
|
|
54
53
|
this.openFinModule.startLiveData(actionTyped.openFinReport);
|
|
55
54
|
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
56
55
|
return next(action);
|
|
57
56
|
}
|
|
58
|
-
case
|
|
57
|
+
case OPENFIN_STOP_LIVE_DATA: {
|
|
59
58
|
const actionTyped = action;
|
|
60
59
|
this.openFinModule.stopLiveData(actionTyped.openFinReport);
|
|
61
60
|
return next(action);
|
|
@@ -73,8 +72,8 @@ class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
|
73
72
|
this.openFinModule = (adaptable.adaptableModules.get(ModuleConstants.OpenFinModuleId));
|
|
74
73
|
}
|
|
75
74
|
afterInitApi(adaptable) {
|
|
76
|
-
this.openFinApi = new
|
|
77
|
-
this.OpenFinService = new
|
|
75
|
+
this.openFinApi = new OpenFinApiImpl(adaptable, this.options);
|
|
76
|
+
this.OpenFinService = new OpenFinService(adaptable, this.options);
|
|
78
77
|
adaptable.api.eventApi.on('AlertFired', (alertFiredInfo) => {
|
|
79
78
|
if (this.options.showAdaptableAlertsAsNotifications) {
|
|
80
79
|
if (!alertFiredInfo.alert.alertDefinition.AlertProperties.DisplayNotification &&
|
|
@@ -118,8 +117,8 @@ class OpenFinPlugin extends types_1.AdaptablePlugin {
|
|
|
118
117
|
}
|
|
119
118
|
*/
|
|
120
119
|
afterInitModules(adaptable, modules) {
|
|
121
|
-
modules.set(
|
|
122
|
-
|
|
120
|
+
modules.set(OpenFinModuleId, new OpenFinModule(adaptable.api));
|
|
121
|
+
AdaptableViewPanelFactory.set(OpenFinModuleId, OpenFinViewPanelControl);
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
|
-
|
|
124
|
+
export default (options) => new OpenFinPlugin(options);
|