@adaptabletools/adaptable-plugin-openfin 22.1.1 → 23.0.0-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
|
@@ -266,9 +266,15 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
266
266
|
}
|
|
267
267
|
if (pluginOptions.onValidationFailureInExcel === 'show-notification' ||
|
|
268
268
|
pluginOptions.onValidationFailureInExcel === 'show-undo-notification') {
|
|
269
|
-
const
|
|
269
|
+
const failedRule = failedValidationRules[0];
|
|
270
|
+
const predicateText = 'Rule' in failedRule && failedRule.Rule.Predicates
|
|
271
|
+
? failedRule.Rule.Predicates.map((predicate) => this.adaptable.api.predicateApi.predicateToString(predicate)).join(' AND ')
|
|
272
|
+
: '';
|
|
273
|
+
const textPredicate = ('Scope' in failedRule
|
|
274
|
+
? this.adaptable.api.columnScopeApi.getScopeDescription(failedRule.Scope)
|
|
275
|
+
: '') +
|
|
270
276
|
' ' +
|
|
271
|
-
|
|
277
|
+
predicateText;
|
|
272
278
|
const info = { ...dataChangedInfos[0] };
|
|
273
279
|
delete info.rowNode;
|
|
274
280
|
const alertOptions = this.api.optionsApi.getAlertOptions();
|
|
@@ -300,7 +306,9 @@ export class OpenFinModule extends AdaptableModuleBase {
|
|
|
300
306
|
Scope: {
|
|
301
307
|
All: true,
|
|
302
308
|
},
|
|
303
|
-
Rule: {
|
|
309
|
+
Rule: {
|
|
310
|
+
Predicates: 'Rule' in failedRule ? failedRule.Rule.Predicates : [],
|
|
311
|
+
},
|
|
304
312
|
AlertForm: {
|
|
305
313
|
Buttons: pluginOptions.onValidationFailureInExcel === 'show-undo-notification'
|
|
306
314
|
? [
|
package/src/OpenFinApiImpl.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ApiBase } from '@adaptabletools/adaptable/src/Api/Implementation/ApiBas
|
|
|
2
2
|
import { OpenFinApi } from '@adaptabletools/adaptable/src/Api/OpenFinApi';
|
|
3
3
|
import { OpenFinPluginOptions } from '@adaptabletools/adaptable/src/AdaptableOptions/OpenFinPluginOptions';
|
|
4
4
|
import { AdaptableAlert } from '@adaptabletools/adaptable';
|
|
5
|
-
import { OpenFinReport,
|
|
5
|
+
import { OpenFinReport, OpenFinState } from '@adaptabletools/adaptable/src/AdaptableState/OpenFinState';
|
|
6
6
|
import { IAdaptable } from '@adaptabletools/adaptable/src/AdaptableInterfaces/IAdaptable';
|
|
7
7
|
export declare class OpenFinApiImpl extends ApiBase implements OpenFinApi {
|
|
8
8
|
private options;
|
|
@@ -17,7 +17,6 @@ export declare class OpenFinApiImpl extends ApiBase implements OpenFinApi {
|
|
|
17
17
|
clearOpenFinInternalState(): void;
|
|
18
18
|
getOpenFinThrottleTime(): number | undefined;
|
|
19
19
|
getCurrentLiveOpenFinReport(): OpenFinReport | undefined;
|
|
20
|
-
getOpenFinSchedules(): OpenFinSchedule[];
|
|
21
20
|
startLiveData(OpenFinReport: OpenFinReport): void;
|
|
22
21
|
stopLiveData(): void;
|
|
23
22
|
}
|
package/src/OpenFinApiImpl.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as OpenFinRedux from './Redux/ActionReducers/OpenFinRedux';
|
|
|
4
4
|
import { addEventListener, create } from 'openfin-notifications';
|
|
5
5
|
import { isRunningInOpenfin } from './Utilities/isRunningInOpenfin';
|
|
6
6
|
import { isAdaptableCustomIcon } from '@adaptabletools/adaptable/src/components/Icon';
|
|
7
|
+
import { resolveAlertFormForDefinition } from '@adaptabletools/adaptable/src/Utilities/Helpers/alertFormHelper';
|
|
7
8
|
// needed because otherwise openfin-notifications is not initialized properly
|
|
8
9
|
// as it assumes it's running before DOMContentLoaded, but nextjs and other bundlers
|
|
9
10
|
// might inject it after DOMContentLoaded is fired - so we fire it programatically
|
|
@@ -77,10 +78,8 @@ export class OpenFinApiImpl extends ApiBase {
|
|
|
77
78
|
AlertId: alert.Uuid,
|
|
78
79
|
},
|
|
79
80
|
};
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
: alert.alertDefinition.AlertForm ||
|
|
83
|
-
this.getAlertApi().internalApi.getDefaultAlertNotificationForm();
|
|
81
|
+
const resolvedForm = resolveAlertFormForDefinition(alert.alertDefinition, this.getAlertApi().internalApi.getDefaultAlertNotificationForm());
|
|
82
|
+
const alertForm = typeof resolvedForm === 'string' ? null : resolvedForm;
|
|
84
83
|
if (alertForm && alertForm?.Buttons) {
|
|
85
84
|
notification.buttons = alertForm.Buttons.map((button) => {
|
|
86
85
|
const { ButtonStyle: buttonStyle } = button;
|
|
@@ -136,9 +135,6 @@ export class OpenFinApiImpl extends ApiBase {
|
|
|
136
135
|
getCurrentLiveOpenFinReport() {
|
|
137
136
|
return this.getAdaptableState().Internal.CurrentLiveOpenFinReport;
|
|
138
137
|
}
|
|
139
|
-
getOpenFinSchedules() {
|
|
140
|
-
return this.getAdaptableState().Schedule.OpenFinSchedules || [];
|
|
141
|
-
}
|
|
142
138
|
startLiveData(OpenFinReport) {
|
|
143
139
|
if (this.checkItemExists(OpenFinReport, OpenFinReport.ReportName, 'OpenFin Report')) {
|
|
144
140
|
this.dispatchAction(OpenFinRedux.OpenFinStartLiveData(OpenFinReport));
|
package/src/View/OpenFinPopup.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { connect } from 'react-redux';
|
|
3
4
|
import { PanelWithButton } from '@adaptabletools/adaptable/src/View/Components/Panels/PanelWithButton';
|
|
@@ -14,7 +15,7 @@ const OpenFinPopupComponent = (props) => {
|
|
|
14
15
|
// const onApplyExport = (OpenFinReport: OpenFinReport) => {
|
|
15
16
|
// props.onOpenFinSendSnapshot(OpenFinReport);
|
|
16
17
|
// };
|
|
17
|
-
return (
|
|
18
|
+
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() }));
|
|
18
19
|
};
|
|
19
20
|
function mapStateToProps(state) {
|
|
20
21
|
return {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ViewPanelProps } from '@adaptabletools/adaptable/src/View/Components/SharedProps/ViewPanelProps';
|
|
2
2
|
import { OpenFinReport } from '@adaptabletools/adaptable/src/AdaptableState/OpenFinState';
|
|
3
3
|
import * as OpenFinRedux from '../Redux/ActionReducers/OpenFinRedux';
|
|
4
|
-
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
5
4
|
import { AdaptableColumn } from '@adaptabletools/adaptable/src/AdaptableState/Common/AdaptableColumn';
|
|
6
5
|
import { Report } from '@adaptabletools/adaptable/src/AdaptableState/ExportState';
|
|
7
6
|
import * as React from 'react';
|
|
@@ -11,7 +10,6 @@ import { ConnectedComponent } from 'react-redux';
|
|
|
11
10
|
export interface OpenFinViewPanelComponentProps extends ViewPanelProps {
|
|
12
11
|
onOpenFinStartLiveData: (OpenFinreport: OpenFinReport) => OpenFinRedux.OpenFinStartLiveDataAction;
|
|
13
12
|
onOpenFinStopLiveData: (OpenFinreport: OpenFinReport) => OpenFinRedux.OpenFinStopLiveDataAction;
|
|
14
|
-
onNewOpenFinSchedule: () => PopupRedux.PopupShowScreenAction;
|
|
15
13
|
Columns: AdaptableColumn[];
|
|
16
14
|
Reports: Report[] | undefined;
|
|
17
15
|
CurrentLiveOpenFinReport: OpenFinReport | undefined;
|
|
@@ -28,7 +26,6 @@ declare class OpenFinViewPanelComponent extends React.Component<OpenFinViewPanel
|
|
|
28
26
|
render(): any;
|
|
29
27
|
onSelectedReportChanged(reportName: string): void;
|
|
30
28
|
private onOpenFinStartLiveData;
|
|
31
|
-
private onNewOpenFinSchedule;
|
|
32
29
|
private createOpenFinReportFromState;
|
|
33
30
|
}
|
|
34
31
|
export declare const OpenFinViewPanelControl: ConnectedComponent<typeof OpenFinViewPanelComponent, Pick<React.ClassAttributes<OpenFinViewPanelComponent> & OpenFinViewPanelComponentProps, never>>;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import * as OpenFinRedux from '../Redux/ActionReducers/OpenFinRedux';
|
|
2
|
-
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
3
3
|
import { isRunningInOpenfin } from '../Utilities/isRunningInOpenfin';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import * as GeneralConstants from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
6
5
|
import { StringExtensions } from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
7
6
|
import { Flex } from '@adaptabletools/adaptable/src/components/Flex';
|
|
8
7
|
import Dropdown from '@adaptabletools/adaptable/src/components/Dropdown';
|
|
9
8
|
import { ButtonPause } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonPause';
|
|
10
9
|
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
10
|
import { connect } from 'react-redux';
|
|
16
11
|
const IS_OPENFIN = isRunningInOpenfin();
|
|
17
12
|
class OpenFinViewPanelComponent extends React.Component {
|
|
@@ -55,13 +50,7 @@ class OpenFinViewPanelComponent extends React.Component {
|
|
|
55
50
|
this.props.CurrentLiveOpenFinReport &&
|
|
56
51
|
this.props.currentReportName == this.props.CurrentLiveOpenFinReport.ReportName;
|
|
57
52
|
const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
58
|
-
return (
|
|
59
|
-
React.createElement(Flex, null,
|
|
60
|
-
React.createElement(Dropdown, { disabled: !IS_OPENFIN || allReports.length == 0 || isLiveOpenFinReport, options: availableReports, className: `ab-${elementType}__OpenFin__select twa:mr-2 twa:min-w-[160px]`, placeholder: !IS_OPENFIN ? 'Not available' : 'Select Report', onChange: (reportName) => this.onSelectedReportChanged(reportName), value: this.props.currentReportName, showClearButton: true })),
|
|
61
|
-
React.createElement(Flex, null,
|
|
62
|
-
isLiveOpenFinReport ? (React.createElement(ButtonPause, { fillColor: 'red', className: `ab-${elementType}__OpenFin__pause twa:ml-1`, onClick: () => this.getOpenFinApi().stopLiveData(), tooltip: "Stop sync with OpenFin", disabled: !isLiveOpenFinReport, accessLevel: this.props.accessLevel })) : (React.createElement(ButtonPlay, { className: `ab-${elementType}__OpenFin__play twa:ml-1`, onClick: () => this.onOpenFinStartLiveData(), tooltip: "Start sync with OpenFin", disabled: isLiveOpenFinReport || !isCompletedReport, accessLevel: this.props.accessLevel })),
|
|
63
|
-
React.createElement(Flex, { className: join(this.props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__OpenFin__controls`), alignItems: "stretch" },
|
|
64
|
-
React.createElement(ButtonSchedule, { className: `ab-${elementType}__OpenFin__schedule twa:ml-1`, onClick: () => this.onNewOpenFinSchedule(), tooltip: "Schedule", disabled: !IS_OPENFIN, accessLevel: this.props.accessLevel })))));
|
|
53
|
+
return (_jsxs(Flex, { flexDirection: "row", className: `ab-${elementType}__OpenFin__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap', children: [_jsx(Flex, { children: _jsx(Dropdown, { disabled: !IS_OPENFIN || allReports.length == 0 || isLiveOpenFinReport, options: availableReports, className: `ab-${elementType}__OpenFin__select twa:mr-2 twa:min-w-[160px]`, placeholder: !IS_OPENFIN ? 'Not available' : 'Select Report', onChange: (reportName) => this.onSelectedReportChanged(reportName), value: this.props.currentReportName, showClearButton: true }) }), _jsx(Flex, { children: isLiveOpenFinReport ? (_jsx(ButtonPause, { fillColor: 'red', className: `ab-${elementType}__OpenFin__pause twa:ml-1`, onClick: () => this.getOpenFinApi().stopLiveData(), tooltip: "Stop sync with OpenFin", disabled: !isLiveOpenFinReport, accessLevel: this.props.accessLevel })) : (_jsx(ButtonPlay, { className: `ab-${elementType}__OpenFin__play twa:ml-1`, onClick: () => this.onOpenFinStartLiveData(), tooltip: "Start sync with OpenFin", disabled: isLiveOpenFinReport || !isCompletedReport, accessLevel: this.props.accessLevel })) })] }));
|
|
65
54
|
}
|
|
66
55
|
onSelectedReportChanged(reportName) {
|
|
67
56
|
if (reportName == undefined) {
|
|
@@ -72,14 +61,6 @@ class OpenFinViewPanelComponent extends React.Component {
|
|
|
72
61
|
onOpenFinStartLiveData() {
|
|
73
62
|
this.getOpenFinApi().startLiveData(this.createOpenFinReportFromState());
|
|
74
63
|
}
|
|
75
|
-
onNewOpenFinSchedule() {
|
|
76
|
-
// let OpenFinSchedule: OpenFinSchedule = {
|
|
77
|
-
// ...ObjectFactory.CreateEmptyBaseSchedule(ScheduleType.OpenFin),
|
|
78
|
-
// OpenFinReport: this.createOpenFinReportFromState(),
|
|
79
|
-
// Transmission: 'Live Data',
|
|
80
|
-
// };
|
|
81
|
-
this.props.onNewOpenFinSchedule();
|
|
82
|
-
}
|
|
83
64
|
// perhaps this should be props and in real state?
|
|
84
65
|
createOpenFinReportFromState() {
|
|
85
66
|
return {
|
|
@@ -97,11 +78,6 @@ function mapStateToProps(state) {
|
|
|
97
78
|
}
|
|
98
79
|
function mapDispatchToProps(dispatch) {
|
|
99
80
|
return {
|
|
100
|
-
onNewOpenFinSchedule: () => dispatch(PopupRedux.PopupShowScreen(ModuleConstants.ScheduleModuleId, 'SchedulePopup', {
|
|
101
|
-
action: 'New',
|
|
102
|
-
source: 'Other',
|
|
103
|
-
value: CreateEmptyOpenFinSchedule(),
|
|
104
|
-
})),
|
|
105
81
|
onCurrentReportNameChange: (reportName) => dispatch(OpenFinRedux.OpenFinSetCurrentReportName(reportName)),
|
|
106
82
|
};
|
|
107
83
|
}
|
package/src/index.js
CHANGED
|
@@ -46,6 +46,7 @@ class OpenFinPlugin extends AdaptablePlugin {
|
|
|
46
46
|
adaptable.api.eventApi.on('AlertFired', (alertFiredInfo) => {
|
|
47
47
|
if (this.options.showAdaptableAlertsAsNotifications) {
|
|
48
48
|
if (!alertFiredInfo.alert.alertDefinition.AlertProperties.DisplayNotification &&
|
|
49
|
+
'AlertForm' in alertFiredInfo.alert.alertDefinition &&
|
|
49
50
|
typeof alertFiredInfo.alert.alertDefinition.AlertForm === 'string') {
|
|
50
51
|
// bail out early for dynamic forms
|
|
51
52
|
return;
|