@adaptabletools/adaptable-plugin-openfin 22.0.0-canary.6 → 22.0.0-canary.8
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 +1 -1
- package/src/Module/OpenFinModule.js +10 -11
- package/src/Utilities/Services/OpenFinService.js +15 -15
- package/src/Utilities/Services/setup.js +9 -9
- package/src/excel-service/ExcelApi.js +2 -2
- package/src/excel-service/ExcelApplication.js +3 -3
- package/src/excel-service/ExcelRtd.js +2 -2
- package/src/excel-service/RpcDispatcher.js +1 -1
- package/src/index.js +1 -5
package/package.json
CHANGED
|
@@ -61,21 +61,20 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
61
61
|
throw new Error('Invalid report data format');
|
|
62
62
|
})
|
|
63
63
|
.then(() => {
|
|
64
|
-
this.adaptable.logger.success('
|
|
64
|
+
this.adaptable.logger.success('Live report data sent successfully.');
|
|
65
65
|
this.isSendingData = false;
|
|
66
66
|
return this.api.exportApi.internalApi.publishLiveLiveDataChangedEvent('OpenFin', 'LiveDataUpdated', currentLiveOpenFinReport);
|
|
67
67
|
})
|
|
68
68
|
.catch((reason) => {
|
|
69
69
|
this.isSendingData = false;
|
|
70
|
-
this.adaptable.logger.warn(
|
|
70
|
+
this.adaptable.logger.warn(`Failed to send data to OpenFin for report "${currentLiveOpenFinReport.ReportName}".`, reason);
|
|
71
71
|
this.getOpenFinApi().stopLiveData();
|
|
72
|
-
let errorMessage = 'Export
|
|
72
|
+
let errorMessage = 'Export failed';
|
|
73
73
|
if (reason) {
|
|
74
74
|
errorMessage += ': ' + reason;
|
|
75
75
|
}
|
|
76
|
-
errorMessage += '.
|
|
77
|
-
this.api.alertApi.showAlertError('OpenFin Export
|
|
78
|
-
this.adaptable.logger.warn('Failed to send data');
|
|
76
|
+
errorMessage += '. The live export has been cancelled.';
|
|
77
|
+
this.api.alertApi.showAlertError('OpenFin Export', errorMessage);
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -185,11 +184,11 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
185
184
|
return resolve({ ignore: true });
|
|
186
185
|
}
|
|
187
186
|
if (columnIsPrimaryKey) {
|
|
188
|
-
return reject(
|
|
187
|
+
return reject('Cannot edit a primary key column.');
|
|
189
188
|
// return resolve({ ignore: true });
|
|
190
189
|
}
|
|
191
190
|
if (this.api.columnApi.getColumnWithColumnId(columnId).readOnly) {
|
|
192
|
-
const msg = `
|
|
191
|
+
const msg = `Cannot update column "${columnId}" — it is read-only.`;
|
|
193
192
|
this.adaptable.logger.warn(msg);
|
|
194
193
|
return reject(msg);
|
|
195
194
|
// return resolve({ ignore: true });
|
|
@@ -293,7 +292,7 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
293
292
|
alertType: 'cellChanged',
|
|
294
293
|
cellDataChangedInfo: info,
|
|
295
294
|
alertDefinition: {
|
|
296
|
-
Name: 'Excel Validation
|
|
295
|
+
Name: 'Excel Validation Failed',
|
|
297
296
|
AlertProperties: {
|
|
298
297
|
DisplayNotification: true,
|
|
299
298
|
},
|
|
@@ -306,14 +305,14 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
306
305
|
Buttons: pluginOptions.onValidationFailureInExcel === 'show-undo-notification'
|
|
307
306
|
? [
|
|
308
307
|
{
|
|
309
|
-
Label: 'Undo
|
|
308
|
+
Label: 'Undo Change',
|
|
310
309
|
Command: 'openfin-plugin:excel-undo',
|
|
311
310
|
},
|
|
312
311
|
]
|
|
313
312
|
: [],
|
|
314
313
|
},
|
|
315
314
|
},
|
|
316
|
-
header: 'Excel Validation
|
|
315
|
+
header: 'Excel Validation Failed',
|
|
317
316
|
message: textPredicate,
|
|
318
317
|
});
|
|
319
318
|
}
|
|
@@ -23,25 +23,25 @@ export class OpenFinService {
|
|
|
23
23
|
onWorkbookRemoved = (event) => {
|
|
24
24
|
event.workbook.removeEventListener('workbookActivated', this.onWorkbookActivated);
|
|
25
25
|
const { workbook } = event;
|
|
26
|
-
this.adaptable.logger.info(
|
|
26
|
+
this.adaptable.logger.info(`Workbook closed: "${workbook.name}". Stopping OpenFin Live Excel.`);
|
|
27
27
|
this.getOpenFinApi().stopLiveData();
|
|
28
28
|
};
|
|
29
29
|
onWorkbookSaved = (event) => {
|
|
30
30
|
const NewName = event.workbook.name;
|
|
31
|
-
this.adaptable.logger.info('
|
|
31
|
+
this.adaptable.logger.info('Workbook saved.', NewName);
|
|
32
32
|
//saving adds an extension, but the name does not have that
|
|
33
33
|
// however, not adding the extension will not find the workbook when we do getWorkBookByName
|
|
34
34
|
// and will crash the app
|
|
35
35
|
this.workbookName = NewName;
|
|
36
36
|
};
|
|
37
37
|
onWorkbookActivated = (event) => {
|
|
38
|
-
this.adaptable.logger.info('Workbook
|
|
38
|
+
this.adaptable.logger.info('Workbook activated: ' + event.target.name);
|
|
39
39
|
event.target.getWorksheets((ack) => {
|
|
40
|
-
this.adaptable.logger.info('
|
|
40
|
+
this.adaptable.logger.info('Retrieved worksheets.', ack);
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
onWorkbookAdded = (event) => {
|
|
44
|
-
this.adaptable.logger.success('Workbook
|
|
44
|
+
this.adaptable.logger.success('Workbook added: ' + event.workbook.name);
|
|
45
45
|
let workbook = event.workbook;
|
|
46
46
|
workbook.addEventListener('workbookActivated', this.onWorkbookActivated);
|
|
47
47
|
};
|
|
@@ -52,7 +52,7 @@ export class OpenFinService {
|
|
|
52
52
|
// since getWorkbookByName only works after getWorkbooks was called
|
|
53
53
|
return fin.desktop.Excel.getWorkbooks().then(() => {
|
|
54
54
|
this.workbookName = workbook.name;
|
|
55
|
-
this.adaptable.logger.info('
|
|
55
|
+
this.adaptable.logger.info('Workbook created.', this.workbookName);
|
|
56
56
|
return workbook;
|
|
57
57
|
});
|
|
58
58
|
});
|
|
@@ -122,13 +122,13 @@ export class OpenFinService {
|
|
|
122
122
|
const workBookName = workbook.name;
|
|
123
123
|
let workBook = fin.desktop.Excel.getWorkbookByName(workBookName);
|
|
124
124
|
if (!workBook) {
|
|
125
|
-
this.adaptable.logger.error('Cannot find workbook:' + workBookName);
|
|
126
|
-
reject('Cannot find workbook:' + workBookName);
|
|
125
|
+
this.adaptable.logger.error('Cannot find workbook: ' + workBookName);
|
|
126
|
+
reject('Cannot find workbook: ' + workBookName);
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
this.getActiveWorksheet()
|
|
130
130
|
.then((worksheet) => {
|
|
131
|
-
this.adaptable.logger.info('
|
|
131
|
+
this.adaptable.logger.info('Active worksheet retrieved.', worksheet);
|
|
132
132
|
this.onWorksheetSetData(worksheet, result);
|
|
133
133
|
if (clear) {
|
|
134
134
|
worksheet.clearAllCells(() => {
|
|
@@ -161,13 +161,13 @@ export class OpenFinService {
|
|
|
161
161
|
this.excelConnected = true;
|
|
162
162
|
this.connectedCallbacks.forEach((fn) => fn());
|
|
163
163
|
this.connectedCallbacks.length = 0;
|
|
164
|
-
this.adaptable.logger.success('Excel
|
|
164
|
+
this.adaptable.logger.success('Excel connected.');
|
|
165
165
|
fin.desktop.Excel.addEventListener('workbookClosed', this.onWorkbookRemoved);
|
|
166
166
|
fin.desktop.Excel.addEventListener('workbookSaved', this.onWorkbookSaved);
|
|
167
167
|
fin.desktop.Excel.addEventListener('workbookAdded', this.onWorkbookAdded);
|
|
168
168
|
};
|
|
169
169
|
onExcelDisconnected = () => {
|
|
170
|
-
this.adaptable.logger.info('Excel
|
|
170
|
+
this.adaptable.logger.info('Excel disconnected.');
|
|
171
171
|
this.excelConnected = false;
|
|
172
172
|
this.initialisingExcel = null;
|
|
173
173
|
this.workbookName = undefined;
|
|
@@ -177,7 +177,7 @@ export class OpenFinService {
|
|
|
177
177
|
fin.desktop.Excel.removeEventListener('workbookAdded', this.onWorkbookAdded);
|
|
178
178
|
fin.desktop.ExcelService.removeEventListener('excelConnected', this.onExcelConnected);
|
|
179
179
|
fin.desktop.ExcelService.removeEventListener('excelDisconnected', this.onExcelDisconnected);
|
|
180
|
-
this.adaptable.logger.info('Excel closed
|
|
180
|
+
this.adaptable.logger.info('Excel closed. Stopping all Live Excel connections.');
|
|
181
181
|
this.getOpenFinApi().stopLiveData();
|
|
182
182
|
};
|
|
183
183
|
initialisingExcel = null;
|
|
@@ -197,13 +197,13 @@ export class OpenFinService {
|
|
|
197
197
|
return fin.desktop.ExcelService.init();
|
|
198
198
|
})
|
|
199
199
|
.then(() => {
|
|
200
|
-
this.adaptable.logger.success('Excel initialized
|
|
200
|
+
this.adaptable.logger.success('Excel initialized. Connecting...');
|
|
201
201
|
fin.desktop.Excel.run();
|
|
202
202
|
return true;
|
|
203
203
|
})
|
|
204
204
|
.then(() => {
|
|
205
205
|
return fin.desktop.Excel.getConnectionStatus().then((connected) => {
|
|
206
|
-
this.adaptable.logger.success('Excel status', {
|
|
206
|
+
this.adaptable.logger.success('Excel connection status:', {
|
|
207
207
|
initialized: fin.desktop.ExcelService.initialized,
|
|
208
208
|
connected,
|
|
209
209
|
});
|
|
@@ -221,7 +221,7 @@ export class OpenFinService {
|
|
|
221
221
|
let startTime = Date.now();
|
|
222
222
|
const poolForExcel = (callback) => {
|
|
223
223
|
if (Date.now() - startTime > 20000) {
|
|
224
|
-
console.error(
|
|
224
|
+
console.error('Could not find any Excel instance within timeout.');
|
|
225
225
|
return callback();
|
|
226
226
|
}
|
|
227
227
|
if (!fin.desktop.Excel || !fin.desktop.Excel.getWorkbooks) {
|
|
@@ -9,11 +9,11 @@ export const setup = async () => {
|
|
|
9
9
|
let serviceIsRunning = await isServiceRunning();
|
|
10
10
|
let assetInfo = await getAppAssetInfo();
|
|
11
11
|
if (serviceIsRunning) {
|
|
12
|
-
AdaptableLogger.consoleLogBase('
|
|
12
|
+
AdaptableLogger.consoleLogBase('Excel service already running. Skipping deployment and registration.');
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
if (assetInfo.version === localStorage.installedAssetVersion && !assetInfo.forceDownload) {
|
|
16
|
-
AdaptableLogger.consoleLogBase('Current Add-In version
|
|
16
|
+
AdaptableLogger.consoleLogBase('Current Add-In version already installed. Skipping deployment and registration.');
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
await deploySharedAssets();
|
|
@@ -55,10 +55,10 @@ export const setup = async () => {
|
|
|
55
55
|
target: servicePath,
|
|
56
56
|
arguments: `-d "${installFolder}" -c ${manifest.runtime.version}`,
|
|
57
57
|
listener: (result) => {
|
|
58
|
-
AdaptableLogger.consoleLogBase(`Asset
|
|
58
|
+
AdaptableLogger.consoleLogBase(`Asset deployment completed (exit code: ${result.exitCode}).`);
|
|
59
59
|
resolve();
|
|
60
60
|
},
|
|
61
|
-
}, () => console.log('Deploying
|
|
61
|
+
}, () => console.log('Deploying shared assets...'), (err) => reject(err));
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -69,14 +69,14 @@ export const setup = async () => {
|
|
|
69
69
|
arguments: `-i "${installFolder}"`,
|
|
70
70
|
listener: (result) => {
|
|
71
71
|
if (result.exitCode === 0) {
|
|
72
|
-
AdaptableLogger.consoleLogBase('Add-In
|
|
72
|
+
AdaptableLogger.consoleLogBase('Add-In installed successfully.');
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
AdaptableLogger.consoleWarnBase(`
|
|
75
|
+
AdaptableLogger.consoleWarnBase(`Add-In installation failed (exit code: ${result.exitCode}).`);
|
|
76
76
|
}
|
|
77
77
|
resolve();
|
|
78
78
|
},
|
|
79
|
-
}, () => AdaptableLogger.consoleLogBase('Installing Add-In'), (err) => reject(err));
|
|
79
|
+
}, () => AdaptableLogger.consoleLogBase('Installing Add-In...'), (err) => reject(err));
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
function startExcelService() {
|
|
@@ -95,9 +95,9 @@ export const setup = async () => {
|
|
|
95
95
|
arguments: '-p ' + details.port,
|
|
96
96
|
uuid: excelServiceUuid,
|
|
97
97
|
}, (process) => {
|
|
98
|
-
AdaptableLogger.consoleLogBase('
|
|
98
|
+
AdaptableLogger.consoleLogBase('Excel service launched: ' + process.uuid);
|
|
99
99
|
}, (error) => {
|
|
100
|
-
reject('
|
|
100
|
+
reject('Failed to start Excel service.');
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
});
|
|
@@ -156,7 +156,7 @@ class ExcelService extends RpcDispatcher_1.RpcDispatcher {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
this.logger.info(this.loggerName + ':
|
|
159
|
+
this.logger.info(this.loggerName + ': Initialize called.');
|
|
160
160
|
this.logger.debug(this.loggerName + ': Subscribing to Service Messages.');
|
|
161
161
|
yield this.subscribeToServiceMessages();
|
|
162
162
|
this.logger.debug(
|
|
@@ -181,7 +181,7 @@ class ExcelService extends RpcDispatcher_1.RpcDispatcher {
|
|
|
181
181
|
}
|
|
182
182
|
this.logger.warn(
|
|
183
183
|
this.loggerName +
|
|
184
|
-
':
|
|
184
|
+
': Failed to connect to or fetch version from provider. The provider version may be older than the script version.',
|
|
185
185
|
errorMessage
|
|
186
186
|
);
|
|
187
187
|
}
|
|
@@ -237,11 +237,11 @@ class ExcelApplication extends RpcDispatcher_1.RpcDispatcher {
|
|
|
237
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
238
238
|
this.logger.info(this.loggerName + ': Init called.');
|
|
239
239
|
if (!this.initialized) {
|
|
240
|
-
this.logger.info(this.loggerName + ': Not
|
|
240
|
+
this.logger.info(this.loggerName + ': Not initialized. Initializing...');
|
|
241
241
|
yield this.subscribeToExcelMessages();
|
|
242
242
|
yield this.monitorDisconnect();
|
|
243
243
|
this.initialized = true;
|
|
244
|
-
this.logger.info(this.loggerName + ':
|
|
244
|
+
this.logger.info(this.loggerName + ': Initialized.');
|
|
245
245
|
}
|
|
246
246
|
return;
|
|
247
247
|
});
|
|
@@ -250,7 +250,7 @@ class ExcelApplication extends RpcDispatcher_1.RpcDispatcher {
|
|
|
250
250
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
251
|
this.logger.info(this.loggerName + ': Release called.');
|
|
252
252
|
if (this.initialized) {
|
|
253
|
-
this.logger.info(this.loggerName + ':
|
|
253
|
+
this.logger.info(this.loggerName + ': Unsubscribing from Excel messages.');
|
|
254
254
|
yield this.unsubscribeToExcelMessages();
|
|
255
255
|
//TODO: Provide external means to stop monitoring disconnect
|
|
256
256
|
}
|
|
@@ -72,7 +72,7 @@ class ExcelRtd extends EventEmitter_1.EventEmitter {
|
|
|
72
72
|
} catch (err) {
|
|
73
73
|
this.logger.warn(
|
|
74
74
|
this.loggerName +
|
|
75
|
-
`: The excelRtd/${this.providerName} channel already exists.
|
|
75
|
+
`: The excelRtd/${this.providerName} channel already exists. Only one connection instance per provider is allowed. Another window or application may have created a provider with the same name.`,
|
|
76
76
|
err
|
|
77
77
|
);
|
|
78
78
|
return;
|
|
@@ -133,7 +133,7 @@ class ExcelRtd extends EventEmitter_1.EventEmitter {
|
|
|
133
133
|
// without a catch the rest of the initialisation would be broken
|
|
134
134
|
this.logger.warn(
|
|
135
135
|
this.loggerName +
|
|
136
|
-
`:
|
|
136
|
+
`: Failed to destroy excelRtd/${this.providerName} channel during cleanup.`,
|
|
137
137
|
err
|
|
138
138
|
);
|
|
139
139
|
}
|
|
@@ -77,7 +77,7 @@ class RpcDispatcher extends EventEmitter_1.EventEmitter {
|
|
|
77
77
|
return result;
|
|
78
78
|
})
|
|
79
79
|
.catch((err) => {
|
|
80
|
-
this.logger.error('
|
|
80
|
+
this.logger.error('Failed to apply callback to promise.', err);
|
|
81
81
|
});
|
|
82
82
|
promise = undefined;
|
|
83
83
|
}
|
package/src/index.js
CHANGED
|
@@ -16,11 +16,7 @@ const { version, name } = packageJson;
|
|
|
16
16
|
const { version: coreVersion } = adaptableCorePackageJson;
|
|
17
17
|
const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
18
18
|
if (version !== coreVersion) {
|
|
19
|
-
console.warn(`
|
|
20
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
21
|
-
!!!!!!! "@adaptabletools/adaptable-plugin-openfin${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
|
|
22
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
23
|
-
`);
|
|
19
|
+
console.warn(`Version mismatch: "@adaptabletools/adaptable-plugin-openfin${suffix}" (v${version}) and "@adaptabletools/adaptable${suffix}" (v${coreVersion}) have different versions. They should be the exact same version.`);
|
|
24
20
|
}
|
|
25
21
|
const defaultOptions = {
|
|
26
22
|
throttleTime: 2000,
|