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