@adaptabletools/adaptable-plugin-ipushpull-cjs 22.0.0-canary.0 → 22.0.0-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/IPushPullApiImpl.js +3 -1
- package/src/Module/PushPullModule.d.ts +1 -1
- package/src/Module/PushPullModule.js +11 -10
- package/src/Utilities/Services/PushPullService.js +16 -15
- package/src/View/IPushPullAddPagePopup.d.ts +1 -11
- package/src/View/IPushPullAddPagePopup.js +1 -1
- package/src/View/IPushPullLoginPopup.d.ts +1 -12
- package/src/View/IPushPullPopup.d.ts +1 -22
- package/src/View/IPushPullPopup.js +1 -1
- package/src/View/IPushPullViewPanel.d.ts +1 -4
- package/src/index.d.ts +1 -1
- package/src/index.js +84 -86
package/README.md
CHANGED
|
@@ -39,12 +39,12 @@ Once the user is successfully logged in, the Toolbar will contain a number of el
|
|
|
39
39
|
|
|
40
40
|
## Documentation & Demos
|
|
41
41
|
|
|
42
|
-
Full details of how to install and use the ipushpull plugin, together with many demos, can be found at [AdapTable ipushpull Documentation]
|
|
42
|
+
Full details of how to install and use the ipushpull plugin, together with many demos, can be found at [AdapTable ipushpull Documentation](https://www.adaptabletools.com/docs/integrations-ipushpull)
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
## Help
|
|
46
46
|
|
|
47
|
-
Developers can learn how to access AdapTable programmatically at [AdapTable Documentation](https://
|
|
47
|
+
Developers can learn how to access AdapTable programmatically at [AdapTable Documentation](https://www.adaptabletools.com/docs).
|
|
48
48
|
|
|
49
49
|
## More Information
|
|
50
50
|
|
|
@@ -56,4 +56,4 @@ For all support enquiries please email [`support@adaptabletools.com`](mailto:sup
|
|
|
56
56
|
|
|
57
57
|
## Licences
|
|
58
58
|
|
|
59
|
-
Information on AdapTable Licences can be found at [Licensing AdapTable for AG Grid](https://
|
|
59
|
+
Information on AdapTable Licences can be found at [Licensing AdapTable for AG Grid](https://www.adaptabletools.com/buy/buying-adaptable-licensing).
|
package/package.json
CHANGED
package/src/IPushPullApiImpl.js
CHANGED
|
@@ -8,9 +8,11 @@ const IPushPullRedux = tslib_1.__importStar(require("./Redux/ActionReducers/IPus
|
|
|
8
8
|
const ArrayExtensions_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable-cjs/src/Utilities/Extensions/ArrayExtensions"));
|
|
9
9
|
const Helper_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable-cjs/src/Utilities/Helpers/Helper"));
|
|
10
10
|
class IPushPullApiImpl extends ApiBase_1.ApiBase {
|
|
11
|
+
ippInstance;
|
|
12
|
+
ippService = null;
|
|
13
|
+
options;
|
|
11
14
|
constructor(_adaptable, options) {
|
|
12
15
|
super(_adaptable);
|
|
13
|
-
this.ippService = null;
|
|
14
16
|
this.options = options;
|
|
15
17
|
}
|
|
16
18
|
getCurrentIPushPullUsername() {
|
|
@@ -2,7 +2,7 @@ import { AdaptableModuleBase } from "@adaptabletools/adaptable-cjs/src/Strategy/
|
|
|
2
2
|
import { IPushPullModule } from './Interface/IPushPullModule';
|
|
3
3
|
import { IPushPullReport } from "@adaptabletools/adaptable-cjs/src/AdaptableState/IPushPullState";
|
|
4
4
|
import { IPushPullApi } from "@adaptabletools/adaptable-cjs/src/Api/IPushPullApi";
|
|
5
|
-
import { AccessLevel, AdaptableApi } from "@adaptabletools/adaptable-cjs
|
|
5
|
+
import { AccessLevel, AdaptableApi } from "@adaptabletools/adaptable-cjs";
|
|
6
6
|
export declare class PushPullModule extends AdaptableModuleBase implements IPushPullModule {
|
|
7
7
|
private isSendingData;
|
|
8
8
|
private ippService;
|
|
@@ -8,10 +8,13 @@ const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
|
|
|
8
8
|
const GeneralConstants_1 = require("@adaptabletools/adaptable-cjs/src/Utilities/Constants/GeneralConstants");
|
|
9
9
|
const EQUAL_DATA_ERR = 'equal data, so not sending';
|
|
10
10
|
class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
11
|
+
isSendingData = false;
|
|
12
|
+
ippService = null;
|
|
13
|
+
adaptable;
|
|
14
|
+
throttledRecomputeAndSendLiveDataEvent;
|
|
15
|
+
lastData;
|
|
11
16
|
constructor(api) {
|
|
12
17
|
super(ModuleConstants.IPushPullModuleId, 'ipushpull', 'download', null, 'Send data from AdapTable to ipushpull', api);
|
|
13
|
-
this.isSendingData = false;
|
|
14
|
-
this.ippService = null;
|
|
15
18
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
16
19
|
this.api.eventApi.on('AdaptableReady', () => {
|
|
17
20
|
setTimeout(() => {
|
|
@@ -136,7 +139,7 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
136
139
|
})
|
|
137
140
|
.then((currentData) => {
|
|
138
141
|
this.lastData = currentData;
|
|
139
|
-
this.adaptable.logger.success('
|
|
142
|
+
this.adaptable.logger.success('Live report data sent successfully.');
|
|
140
143
|
this.isSendingData = false;
|
|
141
144
|
return this.api.exportApi.internalApi.publishLiveLiveDataChangedEvent('ipushpull', 'LiveDataUpdated', currentLiveIPushPullReport);
|
|
142
145
|
})
|
|
@@ -144,16 +147,14 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
144
147
|
// Skip logging for expected cases
|
|
145
148
|
if (reason?.message !== EQUAL_DATA_ERR) {
|
|
146
149
|
this.isSendingData = false;
|
|
147
|
-
this.adaptable.logger.warn(
|
|
148
|
-
currentLiveIPushPullReport.ReportName +
|
|
149
|
-
']', reason);
|
|
150
|
+
this.adaptable.logger.warn(`Failed to send data to ipushpull for report "${currentLiveIPushPullReport.ReportName}".`, reason);
|
|
150
151
|
this.stopLiveData();
|
|
151
|
-
let errorMessage = 'Export
|
|
152
|
+
let errorMessage = 'Export failed';
|
|
152
153
|
if (reason) {
|
|
153
154
|
errorMessage += ': ' + reason;
|
|
154
155
|
}
|
|
155
|
-
errorMessage += '.
|
|
156
|
-
this.api.alertApi.showAlertError('ipushpull Export
|
|
156
|
+
errorMessage += '. The live export has been cancelled.';
|
|
157
|
+
this.api.alertApi.showAlertError('ipushpull Export', errorMessage);
|
|
157
158
|
}
|
|
158
159
|
});
|
|
159
160
|
}
|
|
@@ -171,7 +172,7 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
171
172
|
}
|
|
172
173
|
})
|
|
173
174
|
.catch((error) => {
|
|
174
|
-
this.adaptable.logger.warn(`Failed to send snapshot for report
|
|
175
|
+
this.adaptable.logger.warn(`Failed to send snapshot for report "${iPushPullReport.ReportName}".`, error);
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
startLiveData(iPushPullReport) {
|
|
@@ -12,10 +12,11 @@ var ServiceStatus;
|
|
|
12
12
|
ServiceStatus["Error"] = "Error";
|
|
13
13
|
})(ServiceStatus || (exports.ServiceStatus = ServiceStatus = {}));
|
|
14
14
|
class PushPullService {
|
|
15
|
+
adaptable;
|
|
16
|
+
ppInstance = null;
|
|
17
|
+
pages = new Map();
|
|
15
18
|
constructor(adaptable) {
|
|
16
19
|
this.adaptable = adaptable;
|
|
17
|
-
this.ppInstance = null;
|
|
18
|
-
this.pages = new Map();
|
|
19
20
|
this.adaptable = adaptable;
|
|
20
21
|
this.adaptable.api.eventApi.on('AdaptableReady', async () => {
|
|
21
22
|
// turn off and clear everything
|
|
@@ -66,7 +67,7 @@ class PushPullService {
|
|
|
66
67
|
.login(login, password)
|
|
67
68
|
.then((result) => {
|
|
68
69
|
this.ppInstance.__status = ServiceStatus.Connected;
|
|
69
|
-
this.adaptable.logger.success('Logged in to ipushpull');
|
|
70
|
+
this.adaptable.logger.success('Logged in to ipushpull.');
|
|
70
71
|
return result;
|
|
71
72
|
})
|
|
72
73
|
.catch((err) => {
|
|
@@ -79,12 +80,12 @@ class PushPullService {
|
|
|
79
80
|
// Retrieves domain pages from ipushpull
|
|
80
81
|
getDomainPages() {
|
|
81
82
|
if (!this.ppInstance) {
|
|
82
|
-
return Promise.reject('No ipushpull instance found
|
|
83
|
+
return Promise.reject('No ipushpull instance found.');
|
|
83
84
|
}
|
|
84
85
|
return this.ppInstance.api
|
|
85
86
|
.getDomainsAndPages(this.ppInstance.config.api_key)
|
|
86
87
|
.then((response) => {
|
|
87
|
-
this.adaptable.logger.success('Retrieved ipushpull
|
|
88
|
+
this.adaptable.logger.success('Retrieved ipushpull folder and page info.');
|
|
88
89
|
return response.data.domains.map((domain) => ({
|
|
89
90
|
Name: domain.name,
|
|
90
91
|
FolderId: domain.id,
|
|
@@ -94,18 +95,18 @@ class PushPullService {
|
|
|
94
95
|
}));
|
|
95
96
|
})
|
|
96
97
|
.catch((error) => {
|
|
97
|
-
this.adaptable.logger.error(
|
|
98
|
+
this.adaptable.logger.error('Failed to retrieve folders and pages from ipushpull.', error);
|
|
98
99
|
throw error.message;
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
loadPage(folderIPP, pageIPP) {
|
|
102
103
|
if (!this.ppInstance) {
|
|
103
|
-
return Promise.reject('No ipushpull instance found
|
|
104
|
+
return Promise.reject('No ipushpull instance found.');
|
|
104
105
|
}
|
|
105
106
|
return new Promise((resolve, reject) => {
|
|
106
107
|
const page = new this.ppInstance.Page(pageIPP, folderIPP);
|
|
107
108
|
page.on(page.EVENT_NEW_CONTENT, () => {
|
|
108
|
-
this.adaptable.logger.info(`Page
|
|
109
|
+
this.adaptable.logger.info(`Page ready: "${pageIPP}".`);
|
|
109
110
|
this.pages.set(pageIPP, page);
|
|
110
111
|
resolve(page);
|
|
111
112
|
// we return true so it removes the listener for new content.
|
|
@@ -119,22 +120,22 @@ class PushPullService {
|
|
|
119
120
|
if (pageIPP) {
|
|
120
121
|
pageIPP.destroy();
|
|
121
122
|
this.pages.delete(page);
|
|
122
|
-
this.adaptable.logger.info(`Page
|
|
123
|
+
this.adaptable.logger.info(`Page unloaded: "${page}".`);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
addNewPage(folderId, page) {
|
|
126
127
|
if (!this.ppInstance) {
|
|
127
|
-
return Promise.reject('No ipushpull instance found
|
|
128
|
+
return Promise.reject('No ipushpull instance found.');
|
|
128
129
|
}
|
|
129
130
|
return this.ppInstance.Page.create(folderId, page)
|
|
130
131
|
.then((createdPage) => {
|
|
131
|
-
let message = page
|
|
132
|
-
this.adaptable.api.alertApi.showAlertSuccess('ipushpull
|
|
132
|
+
let message = `Page "${page}" created successfully.`;
|
|
133
|
+
this.adaptable.api.alertApi.showAlertSuccess('ipushpull', message);
|
|
133
134
|
this.adaptable.api.internalApi.hidePopupScreen();
|
|
134
135
|
return this.getIPPApi().retrieveIPushPullDomainsFromIPushPull();
|
|
135
136
|
})
|
|
136
137
|
.catch((err) => {
|
|
137
|
-
this.adaptable.logger.error(
|
|
138
|
+
this.adaptable.logger.error(`Failed to create page "${page}": ${err}`);
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
pushData(page, data) {
|
|
@@ -201,10 +202,10 @@ class PushPullService {
|
|
|
201
202
|
pageIPP.Content.canDoDelta = false;
|
|
202
203
|
pageIPP.Content.update(newData, true);
|
|
203
204
|
pageIPP.push().then(() => {
|
|
204
|
-
this.adaptable.logger.success(`Data pushed for ipushpull page
|
|
205
|
+
this.adaptable.logger.success(`Data pushed for ipushpull page "${page}".`);
|
|
205
206
|
resolve();
|
|
206
207
|
}, (err) => {
|
|
207
|
-
this.adaptable.logger.
|
|
208
|
+
this.adaptable.logger.error(`Failed to push data for ipushpull page "${page}".`);
|
|
208
209
|
reject();
|
|
209
210
|
});
|
|
210
211
|
});
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
4
|
-
import { IPushPullDomain } from "@adaptabletools/adaptable-cjs/src/AdaptableState/IPushPullState";
|
|
5
|
-
interface IPushPullAddPagePopupProps {
|
|
6
|
-
IPushPullDomainsPages: IPushPullDomain[] | undefined;
|
|
7
|
-
onAddPage: (folder: string, page: string) => IPushPullRedux.IPushPullAddPageAction;
|
|
8
|
-
onCancel: () => any;
|
|
9
|
-
}
|
|
10
|
-
declare const IPushPullAddPageComponent: (props: IPushPullAddPagePopupProps) => React.JSX.Element;
|
|
11
|
-
export declare let IPushPullAddPagePopup: ConnectedComponent<typeof IPushPullAddPageComponent, Omit<IPushPullAddPagePopupProps, "IPushPullDomainsPages" | "onAddPage" | "onCancel">>;
|
|
12
|
-
export {};
|
|
2
|
+
export declare let IPushPullAddPagePopup: React.ComponentType;
|
|
@@ -29,7 +29,7 @@ const IPushPullAddPageComponent = (props) => {
|
|
|
29
29
|
const { hidePopup } = (0, PopupContext_1.usePopupContext)();
|
|
30
30
|
const onSubmit = () => {
|
|
31
31
|
if (ArrayExtensions_1.default.ContainsItem(state.AvailablePages, state.Page)) {
|
|
32
|
-
setState({ ...state, ErrorMessage: 'A page with that name already exists in
|
|
32
|
+
setState({ ...state, ErrorMessage: 'A page with that name already exists in this folder.' });
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
props.onAddPage(state.Folder, state.Page);
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
4
|
-
interface IPushPullLoginPopupProps {
|
|
5
|
-
pushpullLogin: string | undefined;
|
|
6
|
-
pushpullPassword: string | undefined;
|
|
7
|
-
pushpullLoginErrorMessage: string | undefined;
|
|
8
|
-
onLogin: (login: string, password: string) => IPushPullRedux.IPushPullLoginAction;
|
|
9
|
-
onCancel: () => any;
|
|
10
|
-
}
|
|
11
|
-
declare const IPushPullLoginComponent: (props: IPushPullLoginPopupProps) => React.JSX.Element;
|
|
12
|
-
export declare let IPushPullLoginPopup: ConnectedComponent<typeof IPushPullLoginComponent, Omit<IPushPullLoginPopupProps, "pushpullLoginErrorMessage" | "onLogin" | "onCancel">>;
|
|
13
|
-
export {};
|
|
2
|
+
export declare let IPushPullLoginPopup: React.ComponentType;
|
|
@@ -1,23 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
4
|
-
import { ModuleViewPopupProps } from "@adaptabletools/adaptable-cjs/src/View/Components/SharedProps/ModuleViewPopupProps";
|
|
5
|
-
import * as TeamSharingRedux from "@adaptabletools/adaptable-cjs/src/Redux/ActionsReducers/TeamSharingRedux";
|
|
6
|
-
import { EditableConfigEntityState } from "@adaptabletools/adaptable-cjs/src/View/Components/SharedProps/EditableConfigEntityState";
|
|
7
|
-
import { AdaptableObject } from "@adaptabletools/adaptable-cjs/src/AdaptableState/Common/AdaptableObject";
|
|
8
|
-
import { IPushPullReport } from "@adaptabletools/adaptable-cjs/src/AdaptableState/IPushPullState";
|
|
9
|
-
import { AdaptableSharedEntityConfig } from "@adaptabletools/adaptable-cjs/src/AdaptableState/TeamSharingState";
|
|
10
|
-
interface IPushPullPopupProps extends ModuleViewPopupProps<IPushPullPopupComponent> {
|
|
11
|
-
onIPushPullSendSnapshot: (iPushPulleport: IPushPullReport) => IPushPullRedux.IPushPullSendSnapshotAction;
|
|
12
|
-
onIPushPullStopLiveData: () => IPushPullRedux.IPushPullStopLiveDataAction;
|
|
13
|
-
onShare: (entity: AdaptableObject, config: AdaptableSharedEntityConfig) => TeamSharingRedux.TeamSharingShareAction;
|
|
14
|
-
}
|
|
15
|
-
declare class IPushPullPopupComponent extends React.Component<IPushPullPopupProps, EditableConfigEntityState> {
|
|
16
|
-
constructor(props: IPushPullPopupProps);
|
|
17
|
-
shouldClosePopupOnFinishWizard: boolean;
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
render(): React.JSX.Element;
|
|
20
|
-
onApplyExport(iPushPullReport: IPushPullReport): void;
|
|
21
|
-
}
|
|
22
|
-
export declare let IPushPullPopup: ConnectedComponent<typeof IPushPullPopupComponent, IPushPullPopupProps>;
|
|
23
|
-
export {};
|
|
2
|
+
export declare let IPushPullPopup: React.ComponentType<any>;
|
|
@@ -12,9 +12,9 @@ const UIHelper_1 = require("@adaptabletools/adaptable-cjs/src/View/UIHelper");
|
|
|
12
12
|
class IPushPullPopupComponent extends React.Component {
|
|
13
13
|
constructor(props) {
|
|
14
14
|
super(props);
|
|
15
|
-
this.shouldClosePopupOnFinishWizard = false;
|
|
16
15
|
this.state = UIHelper_1.UIHelper.getEmptyConfigState();
|
|
17
16
|
}
|
|
17
|
+
shouldClosePopupOnFinishWizard = false;
|
|
18
18
|
componentDidMount() {
|
|
19
19
|
if (this.props.popupParams) {
|
|
20
20
|
this.shouldClosePopupOnFinishWizard =
|
|
@@ -5,7 +5,6 @@ import * as PopupRedux from "@adaptabletools/adaptable-cjs/src/Redux/ActionsRedu
|
|
|
5
5
|
import { AdaptableColumn } from "@adaptabletools/adaptable-cjs/src/AdaptableState/Common/AdaptableColumn";
|
|
6
6
|
import { Report } from "@adaptabletools/adaptable-cjs/src/AdaptableState/ExportState";
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { ConnectedComponent } from 'react-redux';
|
|
9
8
|
export interface IPushPullViewPanelComponentProps extends ViewPanelProps {
|
|
10
9
|
onIPushPullSendSnapshot: (iPushPulleport: IPushPullReport) => IPushPullRedux.IPushPullSendSnapshotAction;
|
|
11
10
|
onIPushPullStartLiveData: (iPushPulleport: IPushPullReport) => IPushPullRedux.IPushPullStartLiveDataAction;
|
|
@@ -26,6 +25,4 @@ export interface IPushPullViewPanelComponentProps extends ViewPanelProps {
|
|
|
26
25
|
onCurrentIPushPullFolderChange: (folder: string) => IPushPullRedux.IPushPullSetCurrentFolderAction;
|
|
27
26
|
onCurrentIPushPullPageChange: (page: string) => IPushPullRedux.IPushPullSetCurrentPageAction;
|
|
28
27
|
}
|
|
29
|
-
declare const
|
|
30
|
-
export declare const IPushPullViewPanelControl: ConnectedComponent<typeof IPushPullViewPanelComponent, IPushPullViewPanelComponentProps>;
|
|
31
|
-
export {};
|
|
28
|
+
export declare const IPushPullViewPanelControl: React.ComponentType<any>;
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptablePlugin } from "@adaptabletools/adaptable-cjs
|
|
1
|
+
import { AdaptablePlugin } from "@adaptabletools/adaptable-cjs";
|
|
2
2
|
import type { Middleware } from 'redux';
|
|
3
3
|
import * as Redux from 'redux';
|
|
4
4
|
import { IPushPullState } from "@adaptabletools/adaptable-cjs/src/AdaptableState/IPushPullState";
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const adaptable_1 = require("@adaptabletools/adaptable-cjs");
|
|
5
5
|
const env_1 = tslib_1.__importDefault(require("./env"));
|
|
6
6
|
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
7
7
|
const package_json_2 = tslib_1.__importDefault(require("@adaptabletools/adaptable-cjs/package.json"));
|
|
@@ -23,11 +23,7 @@ const { version, name } = package_json_1.default;
|
|
|
23
23
|
const { version: coreVersion } = package_json_2.default;
|
|
24
24
|
const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
25
25
|
if (version !== coreVersion) {
|
|
26
|
-
console.warn(`
|
|
27
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
28
|
-
!!!!!!! "@adaptabletools/adaptable-plugin-ipushpull${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
|
|
29
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
30
|
-
`);
|
|
26
|
+
console.warn(`Version mismatch: "@adaptabletools/adaptable-plugin-ipushpull${suffix}" (v${version}) and "@adaptabletools/adaptable${suffix}" (v${coreVersion}) have different versions. They should be the exact same version.`);
|
|
31
27
|
}
|
|
32
28
|
const getApiKey = () => {
|
|
33
29
|
let key = env_1.default.IPUSHPULL_API_KEY; // need to make sure that is always there
|
|
@@ -53,88 +49,12 @@ const defaultOptions = {
|
|
|
53
49
|
throttleTime: 2000,
|
|
54
50
|
includeSystemReports: true,
|
|
55
51
|
};
|
|
56
|
-
class IPushPullPlugin extends
|
|
52
|
+
class IPushPullPlugin extends adaptable_1.AdaptablePlugin {
|
|
53
|
+
pluginId = 'ipushpull';
|
|
54
|
+
iPushPullApi;
|
|
55
|
+
PushPullService;
|
|
57
56
|
constructor(options) {
|
|
58
57
|
super(options);
|
|
59
|
-
this.pluginId = 'ipushpull';
|
|
60
|
-
this.rootReducer = (rootReducer) => {
|
|
61
|
-
return {
|
|
62
|
-
System: (state, action) => {
|
|
63
|
-
let augmentedState = rootReducer.System(state, action);
|
|
64
|
-
if (!state) {
|
|
65
|
-
// required for store initialization
|
|
66
|
-
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
67
|
-
augmentedState = Object.assign({}, augmentedState, IPushPullRedux_1.iPushPullInitialState);
|
|
68
|
-
}
|
|
69
|
-
return (0, IPushPullRedux_1.IPushPullReducer)(augmentedState, action);
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
this.reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
74
|
-
return (next) => {
|
|
75
|
-
return (action) => {
|
|
76
|
-
switch (action.type) {
|
|
77
|
-
case PluginsRedux_1.IPUSHPULL_LOGIN: {
|
|
78
|
-
const actionTyped = action;
|
|
79
|
-
this.iPushPullApi.loginToIPushPull(actionTyped.username, actionTyped.password);
|
|
80
|
-
return next(action);
|
|
81
|
-
}
|
|
82
|
-
case PluginsRedux_1.IPUSHPULL_SEND_SNAPSHOT: {
|
|
83
|
-
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
84
|
-
const actionTyped = action;
|
|
85
|
-
iPushPullModule.sendSnapshot(actionTyped.iPushPullReport);
|
|
86
|
-
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
87
|
-
return next(action);
|
|
88
|
-
}
|
|
89
|
-
case PluginsRedux_1.IPUSHPULL_START_LIVE_DATA: {
|
|
90
|
-
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
91
|
-
const actionTyped = action;
|
|
92
|
-
iPushPullModule.startLiveData(actionTyped.iPushPullReport);
|
|
93
|
-
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
94
|
-
return next(action);
|
|
95
|
-
}
|
|
96
|
-
case PluginsRedux_1.IPUSHPULL_STOP_LIVE_DATA: {
|
|
97
|
-
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
98
|
-
iPushPullModule.stopLiveData();
|
|
99
|
-
return next(action);
|
|
100
|
-
}
|
|
101
|
-
case PluginsRedux_1.IPUSHPULL_ADD_PAGE: {
|
|
102
|
-
const actionTyped = action;
|
|
103
|
-
this.iPushPullApi.addNewIPushPullPage(actionTyped.folder, actionTyped.page);
|
|
104
|
-
return next(action);
|
|
105
|
-
}
|
|
106
|
-
case PluginsRedux_1.IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
107
|
-
const actionTyped = action;
|
|
108
|
-
const currentFolder = actionTyped.folder;
|
|
109
|
-
const isFolderValid = StringExtensions_1.default.IsNotNullOrEmpty(currentFolder);
|
|
110
|
-
const availablePages = isFolderValid
|
|
111
|
-
? adaptable.api.pluginsApi
|
|
112
|
-
.getipushpullPluginApi()
|
|
113
|
-
.getPagesForIPushPullDomain(currentFolder)
|
|
114
|
-
: [];
|
|
115
|
-
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentAvailablePages)(availablePages));
|
|
116
|
-
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentPage)(''));
|
|
117
|
-
return next(action);
|
|
118
|
-
}
|
|
119
|
-
case PluginsRedux_1.IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
120
|
-
//refresh the available pages
|
|
121
|
-
const currentFolder = middlewareAPI.getState().Internal.IPushPullCurrentFolder;
|
|
122
|
-
const isFolderValid = StringExtensions_1.default.IsNotNullOrEmpty(currentFolder);
|
|
123
|
-
if (isFolderValid) {
|
|
124
|
-
const availablePages = adaptable.api.pluginsApi
|
|
125
|
-
.getipushpullPluginApi()
|
|
126
|
-
.getPagesForIPushPullDomain(currentFolder);
|
|
127
|
-
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentAvailablePages)(availablePages));
|
|
128
|
-
}
|
|
129
|
-
return next(action);
|
|
130
|
-
}
|
|
131
|
-
default: {
|
|
132
|
-
return next(action);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
58
|
const ippConfig = {
|
|
139
59
|
...defaultOptions.ippConfig,
|
|
140
60
|
...(options || {}).ippConfig,
|
|
@@ -165,6 +85,84 @@ class IPushPullPlugin extends types_1.AdaptablePlugin {
|
|
|
165
85
|
this.registerProperty('api', () => this.iPushPullApi);
|
|
166
86
|
this.registerProperty('service', () => this.PushPullService);
|
|
167
87
|
}
|
|
88
|
+
rootReducer = (rootReducer) => {
|
|
89
|
+
return {
|
|
90
|
+
System: (state, action) => {
|
|
91
|
+
let augmentedState = rootReducer.System(state, action);
|
|
92
|
+
if (!state) {
|
|
93
|
+
// required for store initialization
|
|
94
|
+
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
95
|
+
augmentedState = Object.assign({}, augmentedState, IPushPullRedux_1.iPushPullInitialState);
|
|
96
|
+
}
|
|
97
|
+
return (0, IPushPullRedux_1.IPushPullReducer)(augmentedState, action);
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
102
|
+
return (next) => {
|
|
103
|
+
return (action) => {
|
|
104
|
+
switch (action.type) {
|
|
105
|
+
case PluginsRedux_1.IPUSHPULL_LOGIN: {
|
|
106
|
+
const actionTyped = action;
|
|
107
|
+
this.iPushPullApi.loginToIPushPull(actionTyped.username, actionTyped.password);
|
|
108
|
+
return next(action);
|
|
109
|
+
}
|
|
110
|
+
case PluginsRedux_1.IPUSHPULL_SEND_SNAPSHOT: {
|
|
111
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
112
|
+
const actionTyped = action;
|
|
113
|
+
iPushPullModule.sendSnapshot(actionTyped.iPushPullReport);
|
|
114
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
115
|
+
return next(action);
|
|
116
|
+
}
|
|
117
|
+
case PluginsRedux_1.IPUSHPULL_START_LIVE_DATA: {
|
|
118
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
119
|
+
const actionTyped = action;
|
|
120
|
+
iPushPullModule.startLiveData(actionTyped.iPushPullReport);
|
|
121
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
122
|
+
return next(action);
|
|
123
|
+
}
|
|
124
|
+
case PluginsRedux_1.IPUSHPULL_STOP_LIVE_DATA: {
|
|
125
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
126
|
+
iPushPullModule.stopLiveData();
|
|
127
|
+
return next(action);
|
|
128
|
+
}
|
|
129
|
+
case PluginsRedux_1.IPUSHPULL_ADD_PAGE: {
|
|
130
|
+
const actionTyped = action;
|
|
131
|
+
this.iPushPullApi.addNewIPushPullPage(actionTyped.folder, actionTyped.page);
|
|
132
|
+
return next(action);
|
|
133
|
+
}
|
|
134
|
+
case PluginsRedux_1.IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
135
|
+
const actionTyped = action;
|
|
136
|
+
const currentFolder = actionTyped.folder;
|
|
137
|
+
const isFolderValid = StringExtensions_1.default.IsNotNullOrEmpty(currentFolder);
|
|
138
|
+
const availablePages = isFolderValid
|
|
139
|
+
? adaptable.api.pluginsApi
|
|
140
|
+
.getipushpullPluginApi()
|
|
141
|
+
.getPagesForIPushPullDomain(currentFolder)
|
|
142
|
+
: [];
|
|
143
|
+
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentAvailablePages)(availablePages));
|
|
144
|
+
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentPage)(''));
|
|
145
|
+
return next(action);
|
|
146
|
+
}
|
|
147
|
+
case PluginsRedux_1.IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
148
|
+
//refresh the available pages
|
|
149
|
+
const currentFolder = middlewareAPI.getState().Internal.IPushPullCurrentFolder;
|
|
150
|
+
const isFolderValid = StringExtensions_1.default.IsNotNullOrEmpty(currentFolder);
|
|
151
|
+
if (isFolderValid) {
|
|
152
|
+
const availablePages = adaptable.api.pluginsApi
|
|
153
|
+
.getipushpullPluginApi()
|
|
154
|
+
.getPagesForIPushPullDomain(currentFolder);
|
|
155
|
+
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentAvailablePages)(availablePages));
|
|
156
|
+
}
|
|
157
|
+
return next(action);
|
|
158
|
+
}
|
|
159
|
+
default: {
|
|
160
|
+
return next(action);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
168
166
|
afterInitStore(adaptable) {
|
|
169
167
|
adaptable.adaptableModules.set(ModuleConstants_1.IPushPullModuleId, new PushPullModule_1.PushPullModule(adaptable.api));
|
|
170
168
|
AdaptableViewFactory_1.AdaptableViewFactory.IPushPullLoginPopup = IPushPullLoginPopup_1.IPushPullLoginPopup;
|