@adaptabletools/adaptable-plugin-openfin 23.0.4 → 23.0.5-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-plugin-openfin",
3
- "version": "23.0.4",
3
+ "version": "23.0.5-canary.1",
4
4
  "description": "",
5
5
  "homepage": "http://www.adaptabletools.com/",
6
6
  "author": {
@@ -42,7 +42,6 @@ export class OpenFinModule extends AdaptableModuleBase {
42
42
  return this.openFinService;
43
43
  }
44
44
  sendInitialLiveData(force = true) {
45
- // We wait for the last setInitialLiveData to finish
46
45
  if (this.isSendingData === true && !force) {
47
46
  this.throttledRecomputeAndSendLiveDataEvent();
48
47
  return;
@@ -82,15 +81,14 @@ export class OpenFinModule extends AdaptableModuleBase {
82
81
  return this.currentReportData ? this.currentReportData.columns : [];
83
82
  };
84
83
  startLiveData(iOpenFinReport) {
85
- this.cleanup(); // just in case the previous report has not been stopped
84
+ this.cleanup();
86
85
  this.liveTimeoutId = setTimeout(() => {
87
86
  this.sendInitialLiveData();
88
- }, 500); // for whatever strange excel reason, the timeout is needed
87
+ }, 500);
89
88
  const isSelectionReport = (report) => {
90
89
  return report && report.ReportName === SELECTED_DATA_REPORT;
91
90
  };
92
91
  const resendLiveDataNoSelectionReport = () => {
93
- // Rerun all reports except selected cells / rows
94
92
  const currentLiveIOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
95
93
  if (currentLiveIOpenFinReport && !isSelectionReport(currentLiveIOpenFinReport)) {
96
94
  this.throttledRecomputeAndSendLiveDataEvent();
@@ -102,9 +100,6 @@ export class OpenFinModule extends AdaptableModuleBase {
102
100
  this.throttledRecomputeAndSendLiveDataEvent();
103
101
  }
104
102
  };
105
- // if a piece of data has updated then update any live reports except cell or row selected
106
- // currently we DONT send deltas or even check if the updated cell is in the current report - we should
107
- // we simply send everything to iOpenFin every time any cell ticks....
108
103
  this.removeDataChangedListener = this.adaptable.DataService.on('CellDataChanged', (cellDataChangedInfo) => {
109
104
  const currentLiveIOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
110
105
  const report = currentLiveIOpenFinReport
@@ -116,14 +111,10 @@ export class OpenFinModule extends AdaptableModuleBase {
116
111
  this.throttledRecomputeAndSendLiveDataEvent();
117
112
  }
118
113
  });
119
- // if the grid has refreshed then update all live reports
120
114
  this.removeGridRefreshedListener = this.adaptable._on('GridRefreshed', resendLiveDataNoSelectionReport);
121
115
  if (iOpenFinReport.ReportName !== ALL_DATA_REPORT) {
122
- // this.removeGridSortChangedListener = this.adaptable._on('SortChanged', resendLiveData);
123
- // if the grid filters have changed then update any live reports except cell or row selected
124
116
  this.removeGridFilteredListener = this.adaptable._on('AdapTableFiltersApplied', resendLiveDataNoSelectionReport);
125
117
  }
126
- // if grid selection has changed and the iOpenFin Live report is 'Selected Cells' or 'Selected Rows' then send updated data
127
118
  this.removeCellSelectionChangedListener = this.api.eventApi.on('CellSelectionChanged', () => {
128
119
  const currentLiveIOpenFinReport = this.getOpenFinApi().getCurrentLiveOpenFinReport();
129
120
  if (currentLiveIOpenFinReport &&
@@ -143,11 +134,8 @@ export class OpenFinModule extends AdaptableModuleBase {
143
134
  const { data } = event;
144
135
  const { row, column, width = 1, height = 1 } = data;
145
136
  if (row === 1) {
146
- //its an event coming from adaptable, so no need to do extra processing
147
137
  return;
148
138
  }
149
- // if (address.split(':').length === 1) {
150
- // update on only 1 cell
151
139
  const columns = this.getCurrentReportColumns();
152
140
  const primaryKeyColumnId = this.adaptable.adaptableOptions.primaryKey;
153
141
  const primaryKeyColumnIndex = columns.findIndex((c) => c.columnId === primaryKeyColumnId);
@@ -165,7 +153,6 @@ export class OpenFinModule extends AdaptableModuleBase {
165
153
  const primaryKey = primaryKeyColumnIndex != -1 ? rowValues[primaryKeyColumnIndex] : null;
166
154
  const rowNode = this.api.gridApi.getRowNodeForPrimaryKey(primaryKey);
167
155
  if (!rowNode || cols.includes(primaryKeyColumnIndex + 1)) {
168
- // rejectTop(false);
169
156
  resolveTop({
170
157
  success: false,
171
158
  failedValidationRules: [],
@@ -185,13 +172,11 @@ export class OpenFinModule extends AdaptableModuleBase {
185
172
  }
186
173
  if (columnIsPrimaryKey) {
187
174
  return reject('Cannot edit a primary key column.');
188
- // return resolve({ ignore: true });
189
175
  }
190
176
  if (this.api.columnApi.getColumnWithColumnId(columnId).readOnly) {
191
177
  const msg = `Cannot update column "${columnId}" — it is read-only.`;
192
178
  this.adaptable.logger.warn(msg);
193
179
  return reject(msg);
194
- // return resolve({ ignore: true });
195
180
  }
196
181
  const cellDataChangedInfo = this.api.internalApi.buildCellDataChangedInfo({
197
182
  oldValue,
@@ -251,7 +236,6 @@ export class OpenFinModule extends AdaptableModuleBase {
251
236
  const api = this.getOpenFinApi();
252
237
  const pluginOptions = api.getPluginOptions();
253
238
  if (!success) {
254
- //push data back to excel as hard error occured
255
239
  if (this.getOpenFinApi().getCurrentLiveOpenFinReport()) {
256
240
  this.sendInitialLiveData();
257
241
  }
@@ -259,7 +243,6 @@ export class OpenFinModule extends AdaptableModuleBase {
259
243
  }
260
244
  if (failedValidationRules.length) {
261
245
  if (pluginOptions.onValidationFailureInExcel === 'override') {
262
- // push data back to excel
263
246
  if (this.getOpenFinApi().getCurrentLiveOpenFinReport()) {
264
247
  this.sendInitialLiveData();
265
248
  }
@@ -5,10 +5,6 @@ import { addEventListener, create } from 'openfin-notifications';
5
5
  import { isRunningInOpenfin } from './Utilities/isRunningInOpenfin';
6
6
  import { isAdaptableCustomIcon } from '@adaptabletools/adaptable/src/components/Icon';
7
7
  import { resolveAlertFormForDefinition } from '@adaptabletools/adaptable/src/Utilities/Helpers/AlertHelper';
8
- // needed because otherwise openfin-notifications is not initialized properly
9
- // as it assumes it's running before DOMContentLoaded, but nextjs and other bundlers
10
- // might inject it after DOMContentLoaded is fired - so we fire it programatically
11
- // to trick openfin-notifications to work properly
12
8
  if (typeof window !== 'undefined' && window.document) {
13
9
  window.document.dispatchEvent(new Event('DOMContentLoaded', {
14
10
  bubbles: true,
@@ -66,14 +62,10 @@ export class OpenFinApiImpl extends ApiBase {
66
62
  const notification = {
67
63
  title: alert.header || messageType.toUpperCase(),
68
64
  category: messageType,
69
- // possible values for indicator type: 'failure', 'warning','success'
70
- // see https://cdn.openfin.co/docs/services/notifications/stable/api/interfaces/notifications.notificationindicator.html#type
71
65
  indicator: messageType === 'Info'
72
66
  ? undefined
73
67
  : { type: messageType === 'Error' ? 'failure' : messageType.toLowerCase() },
74
68
  body: alert.message,
75
- // not sure if this is right but seems a nice way to tie in the Alert to the Notification - useful in the action clicked...
76
- // see: https://cdn.openfin.co/docs/services/notifications/stable/api/interfaces/notifications.customdata.html
77
69
  customData: {
78
70
  AlertId: alert.Uuid,
79
71
  },
@@ -110,7 +102,6 @@ export class OpenFinApiImpl extends ApiBase {
110
102
  if (fn && fn(notification, alert) === false) {
111
103
  return;
112
104
  }
113
- // see https://developers.openfin.co/of-docs/docs/customize-notifications
114
105
  create(notification);
115
106
  }
116
107
  getOpenFinState() {
@@ -144,7 +135,6 @@ export class OpenFinApiImpl extends ApiBase {
144
135
  stopLiveData() {
145
136
  let currentLiveReport = this.getCurrentLiveOpenFinReport();
146
137
  this.dispatchAction(OpenFinRedux.OpenFinStopLiveData(currentLiveReport));
147
- // fire the Live Report event for Export Stopped
148
138
  this.getExportApi().internalApi.publishLiveLiveDataChangedEvent('OpenFin', 'LiveDataStopped', currentLiveReport);
149
139
  }
150
140
  }
@@ -1,5 +1,3 @@
1
- /*import { ExcelWorkbook } from '../Services/OpenfinLiveExcel/ExcelWorkbook';*/
2
- // putting this here as we dont use it elswhere - so keeping it here until we redo the OpenFin one day...
3
1
  import { AdaptableLogger } from '@adaptabletools/adaptable/src/agGrid/AdaptableLogger';
4
2
  export class EventDispatcher {
5
3
  _subscriptions = new Array();
@@ -50,36 +48,12 @@ export function isExcelOpenfinLoaded() {
50
48
  function addWorkbook() {
51
49
  return new Promise((resolve, reject) => {
52
50
  AdaptableLogger.consoleLogBase('Creating new workbook');
53
- fin.desktop.Excel.addWorkbook(function (workbook /*ExcelWorkbook*/) {
51
+ fin.desktop.Excel.addWorkbook(function (workbook) {
54
52
  AdaptableLogger.consoleLogBase('workbook created:' + workbook.name);
55
53
  resolve(workbook.name);
56
- // workbook.addEventListener("workbookActivated", (event) => onWorkbookActivated(event, resolve));
57
- // workbook.activate();
58
- // setTimeout(() => {
59
- // workbook.getWorksheets((ack: any) => {
60
- // LogMessage('getWorksheets:', ack);
61
- // resolve(workbook.name)
62
- // })
63
- // }, 500);
64
54
  });
65
55
  });
66
56
  }
67
- // function onWorkbookActivated(event: any, resolve: any) {
68
- // LogMessage('workbookActivated:', event);
69
- // event.target.getWorksheets((ack: any) => {
70
- // LogMessage('getWorksheets:', ack);
71
- // resolve();
72
- // });
73
- // }
74
- // export function addRangeWorkSheet(workBook: ExcelWorkbook, range: string): Promise<ExcelWorksheet> {
75
- // return new Promise<ExcelWorksheet>((resolve: any, reject: any) => {
76
- // resolve(workBook.getWorksheetByName("Sheet1"))
77
- // // workBook.addWorksheet(function (worksheet: ExcelWorksheet) {
78
- // // //worksheet.worksheetName = range
79
- // // resolve(worksheet);
80
- // // });
81
- // });
82
- // }
83
57
  export function pushData(workBookName, data) {
84
58
  return new Promise((resolve, reject) => {
85
59
  let workBook = fin.desktop.Excel.getWorkbookByName(workBookName);
@@ -92,11 +66,7 @@ export function pushData(workBookName, data) {
92
66
  resolve();
93
67
  });
94
68
  }
95
- /**
96
- * @deprecated not used anymore
97
- */
98
69
  export function initOpenFinExcel() {
99
- // fin.desktop.main(function () {
100
70
  fin.desktop.Excel.init();
101
71
  if (excelStatus == ExcelServiceStatus.Unknown) {
102
72
  return Promise.resolve()
@@ -119,7 +89,6 @@ export function initOpenFinExcel() {
119
89
  return '';
120
90
  });
121
91
  }
122
- // });
123
92
  }
124
93
  function initExcelPluginService() {
125
94
  var installFolder = '%localappdata%\\OpenFin\\shared\\assets\\excel-api-addin';
@@ -184,9 +153,7 @@ function registerAddIn(servicePath, installFolder) {
184
153
  AdaptableLogger.consoleLogBase('Registering Add-In');
185
154
  fin.desktop.Excel.install((ack) => {
186
155
  AdaptableLogger.consoleLogBase('Add-In Registration callback', ack);
187
- //if (ack.success) {
188
156
  resolve();
189
- //}
190
157
  });
191
158
  });
192
159
  }
@@ -226,11 +193,9 @@ function onExcelConnected() {
226
193
  if (excelStatus != ExcelServiceStatus.Connected) {
227
194
  AdaptableLogger.consoleLogBase('Excel Connected: ' + fin.desktop.Excel.legacyApi.connectionUuid);
228
195
  excelStatus = ExcelServiceStatus.Connected;
229
- // fin.desktop.Excel.instance.removeEventListener("excelConnected", onExcelConnected);
230
196
  fin.desktop.Excel.addEventListener('workbookClosed', onWorkbookRemoved);
231
197
  fin.desktop.Excel.addEventListener('workbookSaved', onWorkbookSaved);
232
198
  fin.desktop.Excel.addEventListener('workbookAdded', onWorkbookAdded);
233
- // Grab a snapshot of the current instance, it can change!
234
199
  var legacyApi = fin.desktop.Excel.legacyApi;
235
200
  var onExcelDisconnected = function () {
236
201
  AdaptableLogger.consoleLogBase('Excel Disconnected: ' + legacyApi.connectionUuid);
@@ -245,7 +210,6 @@ function onExcelConnected() {
245
210
  else {
246
211
  excelStatus = ExcelServiceStatus.Disconnected;
247
212
  _onExcelDisconnected.Dispatch(this, null);
248
- // fin.desktop.Excel.instance.addEventListener("excelConnected", onExcelConnected);
249
213
  }
250
214
  };
251
215
  fin.desktop.Excel.instance.addEventListener('excelDisconnected', onExcelDisconnected);
@@ -23,9 +23,7 @@ export const initialOpenFinState = {
23
23
  CurrentLiveOpenFinReport: undefined,
24
24
  OpenFinCurrentReportName: EMPTY_STRING,
25
25
  };
26
- export const OpenFinReducer = (
27
- // initial state is handled in the plugin rootReducer
28
- state, action) => {
26
+ export const OpenFinReducer = (state, action) => {
29
27
  switch (action.type) {
30
28
  case OPENFIN_START_LIVE_DATA: {
31
29
  const actionType = action;
@@ -2,9 +2,6 @@ import Emitter from '@adaptabletools/adaptable/src/Utilities/Emitter';
2
2
  import { setup } from './setup';
3
3
  import { isRunningInOpenfin } from '../isRunningInOpenfin';
4
4
  if (isRunningInOpenfin()) {
5
- // Commenting this out as its causing build issues
6
- // Need to decide what to do about Excel - old implementation is deprecated and replaced with this: https://developers.openfin.co/of-docs/docs/excel-integration
7
- // require('../../excel-service/index.js');
8
5
  }
9
6
  export function isExcelOpenfinLoaded() {
10
7
  return isRunningInOpenfin() && 'Excel' in fin.desktop;
@@ -29,9 +26,6 @@ export class OpenFinService {
29
26
  onWorkbookSaved = (event) => {
30
27
  const NewName = event.workbook.name;
31
28
  this.adaptable.logger.info('Workbook saved.', NewName);
32
- //saving adds an extension, but the name does not have that
33
- // however, not adding the extension will not find the workbook when we do getWorkBookByName
34
- // and will crash the app
35
29
  this.workbookName = NewName;
36
30
  };
37
31
  onWorkbookActivated = (event) => {
@@ -49,7 +43,6 @@ export class OpenFinService {
49
43
  if (!this.workbookName) {
50
44
  return this.waitForExcel().then(() => {
51
45
  return fin.desktop.Excel.addWorkbook().then((workbook) => {
52
- // since getWorkbookByName only works after getWorkbooks was called
53
46
  return fin.desktop.Excel.getWorkbooks().then(() => {
54
47
  this.workbookName = workbook.name;
55
48
  this.adaptable.logger.info('Workbook created.', this.workbookName);
@@ -212,7 +205,6 @@ export class OpenFinService {
212
205
  })
213
206
  .then(() => this.waitForExcel())
214
207
  .then(() => {
215
- //this.initialisingExcel = null
216
208
  return Promise.resolve('');
217
209
  });
218
210
  return this.initialisingExcel;
@@ -25,10 +25,6 @@ export const setup = async () => {
25
25
  catch (err) {
26
26
  console.error(err);
27
27
  }
28
- // Technically there is a small window of time between when the UUID is
29
- // registered as an external application and when the service is ready to
30
- // receive commands. This edge-case will be best handled in the future
31
- // with the availability of plugins and services from the fin API
32
28
  function isServiceRunning() {
33
29
  return new Promise((resolve, reject) => {
34
30
  fin.desktop.System.getAllExternalApplications((extApps) => {
@@ -84,8 +80,6 @@ export const setup = async () => {
84
80
  var onExcelServiceEvent;
85
81
  fin.desktop.InterApplicationBus.subscribe('*', excelServiceEventTopic, (onExcelServiceEvent = () => {
86
82
  fin.desktop.InterApplicationBus.unsubscribe('*', excelServiceEventTopic, onExcelServiceEvent);
87
- // The channel provider should eventually move into the .NET app
88
- // but for now it only being used for signalling
89
83
  fin.desktop.InterApplicationBus.Channel.create(excelServiceUuid);
90
84
  resolve();
91
85
  }));
@@ -12,9 +12,6 @@ const OpenFinPopupComponent = (props) => {
12
12
  props.popupParams.source && props.popupParams.source == 'Toolbar';
13
13
  }
14
14
  }, [props.popupParams]);
15
- // const onApplyExport = (OpenFinReport: OpenFinReport) => {
16
- // props.onOpenFinSendSnapshot(OpenFinReport);
17
- // };
18
15
  return (_jsx(PanelWithButton, { headerText: props.moduleInfo.FriendlyName, bodyProps: { className: 'twa:p-0' }, glyphicon: props.moduleInfo.Glyph, infoLink: props.moduleInfo.HelpPage, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() }));
19
16
  };
20
17
  function mapStateToProps(state) {
@@ -43,8 +43,6 @@ class OpenFinViewPanelComponent extends React.Component {
43
43
  value: report,
44
44
  };
45
45
  });
46
- // this is clearly ridiculous!
47
- // im getting tired...
48
46
  let isCompletedReport = StringExtensions.IsNotNullOrEmpty(this.props.currentReportName);
49
47
  let isLiveOpenFinReport = isCompletedReport &&
50
48
  this.props.CurrentLiveOpenFinReport &&
@@ -61,7 +59,6 @@ class OpenFinViewPanelComponent extends React.Component {
61
59
  onOpenFinStartLiveData() {
62
60
  this.getOpenFinApi().startLiveData(this.createOpenFinReportFromState());
63
61
  }
64
- // perhaps this should be props and in real state?
65
62
  createOpenFinReportFromState() {
66
63
  return {
67
64
  ReportName: this.props.currentReportName,
package/src/index.js CHANGED
@@ -48,7 +48,6 @@ class OpenFinPlugin extends AdaptablePlugin {
48
48
  if (!alertFiredInfo.alert.alertDefinition.AlertProperties.DisplayNotification &&
49
49
  'AlertForm' in alertFiredInfo.alert.alertDefinition &&
50
50
  typeof alertFiredInfo.alert.alertDefinition.AlertForm === 'string') {
51
- // bail out early for dynamic forms
52
51
  return;
53
52
  }
54
53
  this.openFinApi.showNotificationForAlert(alertFiredInfo.alert);
@@ -63,8 +62,6 @@ class OpenFinPlugin extends AdaptablePlugin {
63
62
  Internal: (state, action) => {
64
63
  let augmentedState = rootReducer.Internal(state, action);
65
64
  if (!state) {
66
- // required for store initialization
67
- // (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the Internal reducer)
68
65
  augmentedState = Object.assign({}, augmentedState, initialOpenFinState);
69
66
  }
70
67
  return OpenFinReducer(augmentedState, action);