@adaptabletools/adaptable-plugin-ipushpull 22.0.0-canary.1 → 22.0.0-canary.11
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/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 +83 -85
package/package.json
CHANGED
package/src/IPushPullApiImpl.js
CHANGED
|
@@ -4,9 +4,11 @@ import * as IPushPullRedux from './Redux/ActionReducers/IPushPullRedux';
|
|
|
4
4
|
import ArrayExtensions from '@adaptabletools/adaptable/src/Utilities/Extensions/ArrayExtensions';
|
|
5
5
|
import Helper from '@adaptabletools/adaptable/src/Utilities/Helpers/Helper';
|
|
6
6
|
export class IPushPullApiImpl extends ApiBase {
|
|
7
|
+
ippInstance;
|
|
8
|
+
ippService = null;
|
|
9
|
+
options;
|
|
7
10
|
constructor(_adaptable, options) {
|
|
8
11
|
super(_adaptable);
|
|
9
|
-
this.ippService = null;
|
|
10
12
|
this.options = options;
|
|
11
13
|
}
|
|
12
14
|
getCurrentIPushPullUsername() {
|
|
@@ -2,7 +2,7 @@ import { AdaptableModuleBase } from '@adaptabletools/adaptable/src/Strategy/Adap
|
|
|
2
2
|
import { IPushPullModule } from './Interface/IPushPullModule';
|
|
3
3
|
import { IPushPullReport } from '@adaptabletools/adaptable/src/AdaptableState/IPushPullState';
|
|
4
4
|
import { IPushPullApi } from '@adaptabletools/adaptable/src/Api/IPushPullApi';
|
|
5
|
-
import { AccessLevel, AdaptableApi } from '@adaptabletools/adaptable
|
|
5
|
+
import { AccessLevel, AdaptableApi } from '@adaptabletools/adaptable';
|
|
6
6
|
export declare class PushPullModule extends AdaptableModuleBase implements IPushPullModule {
|
|
7
7
|
private isSendingData;
|
|
8
8
|
private ippService;
|
|
@@ -4,10 +4,13 @@ import throttle from 'lodash/throttle';
|
|
|
4
4
|
import { DEFAULT_LIVE_REPORT_THROTTLE_TIME, SELECTED_DATA_REPORT, } from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
5
5
|
const EQUAL_DATA_ERR = 'equal data, so not sending';
|
|
6
6
|
export class PushPullModule extends AdaptableModuleBase {
|
|
7
|
+
isSendingData = false;
|
|
8
|
+
ippService = null;
|
|
9
|
+
adaptable;
|
|
10
|
+
throttledRecomputeAndSendLiveDataEvent;
|
|
11
|
+
lastData;
|
|
7
12
|
constructor(api) {
|
|
8
13
|
super(ModuleConstants.IPushPullModuleId, 'ipushpull', 'download', null, 'Send data from AdapTable to ipushpull', api);
|
|
9
|
-
this.isSendingData = false;
|
|
10
|
-
this.ippService = null;
|
|
11
14
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
12
15
|
this.api.eventApi.on('AdaptableReady', () => {
|
|
13
16
|
setTimeout(() => {
|
|
@@ -132,7 +135,7 @@ export class PushPullModule extends AdaptableModuleBase {
|
|
|
132
135
|
})
|
|
133
136
|
.then((currentData) => {
|
|
134
137
|
this.lastData = currentData;
|
|
135
|
-
this.adaptable.logger.success('
|
|
138
|
+
this.adaptable.logger.success('Live report data sent successfully.');
|
|
136
139
|
this.isSendingData = false;
|
|
137
140
|
return this.api.exportApi.internalApi.publishLiveLiveDataChangedEvent('ipushpull', 'LiveDataUpdated', currentLiveIPushPullReport);
|
|
138
141
|
})
|
|
@@ -140,16 +143,14 @@ export class PushPullModule extends AdaptableModuleBase {
|
|
|
140
143
|
// Skip logging for expected cases
|
|
141
144
|
if (reason?.message !== EQUAL_DATA_ERR) {
|
|
142
145
|
this.isSendingData = false;
|
|
143
|
-
this.adaptable.logger.warn(
|
|
144
|
-
currentLiveIPushPullReport.ReportName +
|
|
145
|
-
']', reason);
|
|
146
|
+
this.adaptable.logger.warn(`Failed to send data to ipushpull for report "${currentLiveIPushPullReport.ReportName}".`, reason);
|
|
146
147
|
this.stopLiveData();
|
|
147
|
-
let errorMessage = 'Export
|
|
148
|
+
let errorMessage = 'Export failed';
|
|
148
149
|
if (reason) {
|
|
149
150
|
errorMessage += ': ' + reason;
|
|
150
151
|
}
|
|
151
|
-
errorMessage += '.
|
|
152
|
-
this.api.alertApi.showAlertError('ipushpull Export
|
|
152
|
+
errorMessage += '. The live export has been cancelled.';
|
|
153
|
+
this.api.alertApi.showAlertError('ipushpull Export', errorMessage);
|
|
153
154
|
}
|
|
154
155
|
});
|
|
155
156
|
}
|
|
@@ -167,7 +168,7 @@ export class PushPullModule extends AdaptableModuleBase {
|
|
|
167
168
|
}
|
|
168
169
|
})
|
|
169
170
|
.catch((error) => {
|
|
170
|
-
this.adaptable.logger.warn(`Failed to send snapshot for report
|
|
171
|
+
this.adaptable.logger.warn(`Failed to send snapshot for report "${iPushPullReport.ReportName}".`, error);
|
|
171
172
|
});
|
|
172
173
|
}
|
|
173
174
|
startLiveData(iPushPullReport) {
|
|
@@ -8,10 +8,11 @@ export var ServiceStatus;
|
|
|
8
8
|
ServiceStatus["Error"] = "Error";
|
|
9
9
|
})(ServiceStatus || (ServiceStatus = {}));
|
|
10
10
|
export class PushPullService {
|
|
11
|
+
adaptable;
|
|
12
|
+
ppInstance = null;
|
|
13
|
+
pages = new Map();
|
|
11
14
|
constructor(adaptable) {
|
|
12
15
|
this.adaptable = adaptable;
|
|
13
|
-
this.ppInstance = null;
|
|
14
|
-
this.pages = new Map();
|
|
15
16
|
this.adaptable = adaptable;
|
|
16
17
|
this.adaptable.api.eventApi.on('AdaptableReady', async () => {
|
|
17
18
|
// turn off and clear everything
|
|
@@ -62,7 +63,7 @@ export class PushPullService {
|
|
|
62
63
|
.login(login, password)
|
|
63
64
|
.then((result) => {
|
|
64
65
|
this.ppInstance.__status = ServiceStatus.Connected;
|
|
65
|
-
this.adaptable.logger.success('Logged in to ipushpull');
|
|
66
|
+
this.adaptable.logger.success('Logged in to ipushpull.');
|
|
66
67
|
return result;
|
|
67
68
|
})
|
|
68
69
|
.catch((err) => {
|
|
@@ -75,12 +76,12 @@ export class PushPullService {
|
|
|
75
76
|
// Retrieves domain pages from ipushpull
|
|
76
77
|
getDomainPages() {
|
|
77
78
|
if (!this.ppInstance) {
|
|
78
|
-
return Promise.reject('No ipushpull instance found
|
|
79
|
+
return Promise.reject('No ipushpull instance found.');
|
|
79
80
|
}
|
|
80
81
|
return this.ppInstance.api
|
|
81
82
|
.getDomainsAndPages(this.ppInstance.config.api_key)
|
|
82
83
|
.then((response) => {
|
|
83
|
-
this.adaptable.logger.success('Retrieved ipushpull
|
|
84
|
+
this.adaptable.logger.success('Retrieved ipushpull folder and page info.');
|
|
84
85
|
return response.data.domains.map((domain) => ({
|
|
85
86
|
Name: domain.name,
|
|
86
87
|
FolderId: domain.id,
|
|
@@ -90,18 +91,18 @@ export class PushPullService {
|
|
|
90
91
|
}));
|
|
91
92
|
})
|
|
92
93
|
.catch((error) => {
|
|
93
|
-
this.adaptable.logger.error(
|
|
94
|
+
this.adaptable.logger.error('Failed to retrieve folders and pages from ipushpull.', error);
|
|
94
95
|
throw error.message;
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
loadPage(folderIPP, pageIPP) {
|
|
98
99
|
if (!this.ppInstance) {
|
|
99
|
-
return Promise.reject('No ipushpull instance found
|
|
100
|
+
return Promise.reject('No ipushpull instance found.');
|
|
100
101
|
}
|
|
101
102
|
return new Promise((resolve, reject) => {
|
|
102
103
|
const page = new this.ppInstance.Page(pageIPP, folderIPP);
|
|
103
104
|
page.on(page.EVENT_NEW_CONTENT, () => {
|
|
104
|
-
this.adaptable.logger.info(`Page
|
|
105
|
+
this.adaptable.logger.info(`Page ready: "${pageIPP}".`);
|
|
105
106
|
this.pages.set(pageIPP, page);
|
|
106
107
|
resolve(page);
|
|
107
108
|
// we return true so it removes the listener for new content.
|
|
@@ -115,22 +116,22 @@ export class PushPullService {
|
|
|
115
116
|
if (pageIPP) {
|
|
116
117
|
pageIPP.destroy();
|
|
117
118
|
this.pages.delete(page);
|
|
118
|
-
this.adaptable.logger.info(`Page
|
|
119
|
+
this.adaptable.logger.info(`Page unloaded: "${page}".`);
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
addNewPage(folderId, page) {
|
|
122
123
|
if (!this.ppInstance) {
|
|
123
|
-
return Promise.reject('No ipushpull instance found
|
|
124
|
+
return Promise.reject('No ipushpull instance found.');
|
|
124
125
|
}
|
|
125
126
|
return this.ppInstance.Page.create(folderId, page)
|
|
126
127
|
.then((createdPage) => {
|
|
127
|
-
let message = page
|
|
128
|
-
this.adaptable.api.alertApi.showAlertSuccess('ipushpull
|
|
128
|
+
let message = `Page "${page}" created successfully.`;
|
|
129
|
+
this.adaptable.api.alertApi.showAlertSuccess('ipushpull', message);
|
|
129
130
|
this.adaptable.api.internalApi.hidePopupScreen();
|
|
130
131
|
return this.getIPPApi().retrieveIPushPullDomainsFromIPushPull();
|
|
131
132
|
})
|
|
132
133
|
.catch((err) => {
|
|
133
|
-
this.adaptable.logger.error(
|
|
134
|
+
this.adaptable.logger.error(`Failed to create page "${page}": ${err}`);
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
pushData(page, data) {
|
|
@@ -197,10 +198,10 @@ export class PushPullService {
|
|
|
197
198
|
pageIPP.Content.canDoDelta = false;
|
|
198
199
|
pageIPP.Content.update(newData, true);
|
|
199
200
|
pageIPP.push().then(() => {
|
|
200
|
-
this.adaptable.logger.success(`Data pushed for ipushpull page
|
|
201
|
+
this.adaptable.logger.success(`Data pushed for ipushpull page "${page}".`);
|
|
201
202
|
resolve();
|
|
202
203
|
}, (err) => {
|
|
203
|
-
this.adaptable.logger.
|
|
204
|
+
this.adaptable.logger.error(`Failed to push data for ipushpull page "${page}".`);
|
|
204
205
|
reject();
|
|
205
206
|
});
|
|
206
207
|
});
|
|
@@ -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/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;
|
|
@@ -25,7 +25,7 @@ const IPushPullAddPageComponent = (props) => {
|
|
|
25
25
|
const { hidePopup } = usePopupContext();
|
|
26
26
|
const onSubmit = () => {
|
|
27
27
|
if (ArrayExtensions.ContainsItem(state.AvailablePages, state.Page)) {
|
|
28
|
-
setState({ ...state, ErrorMessage: 'A page with that name already exists in
|
|
28
|
+
setState({ ...state, ErrorMessage: 'A page with that name already exists in this folder.' });
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
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/src/View/Components/SharedProps/ModuleViewPopupProps';
|
|
5
|
-
import * as TeamSharingRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/TeamSharingRedux';
|
|
6
|
-
import { EditableConfigEntityState } from '@adaptabletools/adaptable/src/View/Components/SharedProps/EditableConfigEntityState';
|
|
7
|
-
import { AdaptableObject } from '@adaptabletools/adaptable/src/AdaptableState/Common/AdaptableObject';
|
|
8
|
-
import { IPushPullReport } from '@adaptabletools/adaptable/src/AdaptableState/IPushPullState';
|
|
9
|
-
import { AdaptableSharedEntityConfig } from '@adaptabletools/adaptable/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>;
|
|
@@ -8,9 +8,9 @@ import { UIHelper } from '@adaptabletools/adaptable/src/View/UIHelper';
|
|
|
8
8
|
class IPushPullPopupComponent extends React.Component {
|
|
9
9
|
constructor(props) {
|
|
10
10
|
super(props);
|
|
11
|
-
this.shouldClosePopupOnFinishWizard = false;
|
|
12
11
|
this.state = UIHelper.getEmptyConfigState();
|
|
13
12
|
}
|
|
13
|
+
shouldClosePopupOnFinishWizard = false;
|
|
14
14
|
componentDidMount() {
|
|
15
15
|
if (this.props.popupParams) {
|
|
16
16
|
this.shouldClosePopupOnFinishWizard =
|
|
@@ -5,7 +5,6 @@ import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers
|
|
|
5
5
|
import { AdaptableColumn } from '@adaptabletools/adaptable/src/AdaptableState/Common/AdaptableColumn';
|
|
6
6
|
import { Report } from '@adaptabletools/adaptable/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
|
|
1
|
+
import { AdaptablePlugin } from '@adaptabletools/adaptable';
|
|
2
2
|
import type { Middleware } from 'redux';
|
|
3
3
|
import * as Redux from 'redux';
|
|
4
4
|
import { IPushPullState } from '@adaptabletools/adaptable/src/AdaptableState/IPushPullState';
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptablePlugin } from '@adaptabletools/adaptable
|
|
1
|
+
import { AdaptablePlugin } from '@adaptabletools/adaptable';
|
|
2
2
|
import env from './env';
|
|
3
3
|
import packageJson from '../package.json';
|
|
4
4
|
import adaptableCorePackageJson from '@adaptabletools/adaptable/package.json';
|
|
@@ -20,11 +20,7 @@ const { version, name } = packageJson;
|
|
|
20
20
|
const { version: coreVersion } = adaptableCorePackageJson;
|
|
21
21
|
const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
22
22
|
if (version !== coreVersion) {
|
|
23
|
-
console.warn(`
|
|
24
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
25
|
-
!!!!!!! "@adaptabletools/adaptable-plugin-ipushpull${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
|
|
26
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
27
|
-
`);
|
|
23
|
+
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.`);
|
|
28
24
|
}
|
|
29
25
|
const getApiKey = () => {
|
|
30
26
|
let key = env.IPUSHPULL_API_KEY; // need to make sure that is always there
|
|
@@ -51,87 +47,11 @@ const defaultOptions = {
|
|
|
51
47
|
includeSystemReports: true,
|
|
52
48
|
};
|
|
53
49
|
class IPushPullPlugin extends AdaptablePlugin {
|
|
50
|
+
pluginId = 'ipushpull';
|
|
51
|
+
iPushPullApi;
|
|
52
|
+
PushPullService;
|
|
54
53
|
constructor(options) {
|
|
55
54
|
super(options);
|
|
56
|
-
this.pluginId = 'ipushpull';
|
|
57
|
-
this.rootReducer = (rootReducer) => {
|
|
58
|
-
return {
|
|
59
|
-
System: (state, action) => {
|
|
60
|
-
let augmentedState = rootReducer.System(state, action);
|
|
61
|
-
if (!state) {
|
|
62
|
-
// required for store initialization
|
|
63
|
-
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
64
|
-
augmentedState = Object.assign({}, augmentedState, iPushPullInitialState);
|
|
65
|
-
}
|
|
66
|
-
return IPushPullReducer(augmentedState, action);
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
this.reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
71
|
-
return (next) => {
|
|
72
|
-
return (action) => {
|
|
73
|
-
switch (action.type) {
|
|
74
|
-
case IPUSHPULL_LOGIN: {
|
|
75
|
-
const actionTyped = action;
|
|
76
|
-
this.iPushPullApi.loginToIPushPull(actionTyped.username, actionTyped.password);
|
|
77
|
-
return next(action);
|
|
78
|
-
}
|
|
79
|
-
case IPUSHPULL_SEND_SNAPSHOT: {
|
|
80
|
-
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
81
|
-
const actionTyped = action;
|
|
82
|
-
iPushPullModule.sendSnapshot(actionTyped.iPushPullReport);
|
|
83
|
-
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
84
|
-
return next(action);
|
|
85
|
-
}
|
|
86
|
-
case IPUSHPULL_START_LIVE_DATA: {
|
|
87
|
-
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
88
|
-
const actionTyped = action;
|
|
89
|
-
iPushPullModule.startLiveData(actionTyped.iPushPullReport);
|
|
90
|
-
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
91
|
-
return next(action);
|
|
92
|
-
}
|
|
93
|
-
case IPUSHPULL_STOP_LIVE_DATA: {
|
|
94
|
-
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
95
|
-
iPushPullModule.stopLiveData();
|
|
96
|
-
return next(action);
|
|
97
|
-
}
|
|
98
|
-
case IPUSHPULL_ADD_PAGE: {
|
|
99
|
-
const actionTyped = action;
|
|
100
|
-
this.iPushPullApi.addNewIPushPullPage(actionTyped.folder, actionTyped.page);
|
|
101
|
-
return next(action);
|
|
102
|
-
}
|
|
103
|
-
case IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
104
|
-
const actionTyped = action;
|
|
105
|
-
const currentFolder = actionTyped.folder;
|
|
106
|
-
const isFolderValid = StringExtensions.IsNotNullOrEmpty(currentFolder);
|
|
107
|
-
const availablePages = isFolderValid
|
|
108
|
-
? adaptable.api.pluginsApi
|
|
109
|
-
.getipushpullPluginApi()
|
|
110
|
-
.getPagesForIPushPullDomain(currentFolder)
|
|
111
|
-
: [];
|
|
112
|
-
middlewareAPI.dispatch(IPushPullSetCurrentAvailablePages(availablePages));
|
|
113
|
-
middlewareAPI.dispatch(IPushPullSetCurrentPage(''));
|
|
114
|
-
return next(action);
|
|
115
|
-
}
|
|
116
|
-
case IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
117
|
-
//refresh the available pages
|
|
118
|
-
const currentFolder = middlewareAPI.getState().Internal.IPushPullCurrentFolder;
|
|
119
|
-
const isFolderValid = StringExtensions.IsNotNullOrEmpty(currentFolder);
|
|
120
|
-
if (isFolderValid) {
|
|
121
|
-
const availablePages = adaptable.api.pluginsApi
|
|
122
|
-
.getipushpullPluginApi()
|
|
123
|
-
.getPagesForIPushPullDomain(currentFolder);
|
|
124
|
-
middlewareAPI.dispatch(IPushPullSetCurrentAvailablePages(availablePages));
|
|
125
|
-
}
|
|
126
|
-
return next(action);
|
|
127
|
-
}
|
|
128
|
-
default: {
|
|
129
|
-
return next(action);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
55
|
const ippConfig = {
|
|
136
56
|
...defaultOptions.ippConfig,
|
|
137
57
|
...(options || {}).ippConfig,
|
|
@@ -162,6 +82,84 @@ class IPushPullPlugin extends AdaptablePlugin {
|
|
|
162
82
|
this.registerProperty('api', () => this.iPushPullApi);
|
|
163
83
|
this.registerProperty('service', () => this.PushPullService);
|
|
164
84
|
}
|
|
85
|
+
rootReducer = (rootReducer) => {
|
|
86
|
+
return {
|
|
87
|
+
System: (state, action) => {
|
|
88
|
+
let augmentedState = rootReducer.System(state, action);
|
|
89
|
+
if (!state) {
|
|
90
|
+
// required for store initialization
|
|
91
|
+
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
92
|
+
augmentedState = Object.assign({}, augmentedState, iPushPullInitialState);
|
|
93
|
+
}
|
|
94
|
+
return IPushPullReducer(augmentedState, action);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
99
|
+
return (next) => {
|
|
100
|
+
return (action) => {
|
|
101
|
+
switch (action.type) {
|
|
102
|
+
case IPUSHPULL_LOGIN: {
|
|
103
|
+
const actionTyped = action;
|
|
104
|
+
this.iPushPullApi.loginToIPushPull(actionTyped.username, actionTyped.password);
|
|
105
|
+
return next(action);
|
|
106
|
+
}
|
|
107
|
+
case IPUSHPULL_SEND_SNAPSHOT: {
|
|
108
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
109
|
+
const actionTyped = action;
|
|
110
|
+
iPushPullModule.sendSnapshot(actionTyped.iPushPullReport);
|
|
111
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
112
|
+
return next(action);
|
|
113
|
+
}
|
|
114
|
+
case IPUSHPULL_START_LIVE_DATA: {
|
|
115
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
116
|
+
const actionTyped = action;
|
|
117
|
+
iPushPullModule.startLiveData(actionTyped.iPushPullReport);
|
|
118
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
119
|
+
return next(action);
|
|
120
|
+
}
|
|
121
|
+
case IPUSHPULL_STOP_LIVE_DATA: {
|
|
122
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
123
|
+
iPushPullModule.stopLiveData();
|
|
124
|
+
return next(action);
|
|
125
|
+
}
|
|
126
|
+
case IPUSHPULL_ADD_PAGE: {
|
|
127
|
+
const actionTyped = action;
|
|
128
|
+
this.iPushPullApi.addNewIPushPullPage(actionTyped.folder, actionTyped.page);
|
|
129
|
+
return next(action);
|
|
130
|
+
}
|
|
131
|
+
case IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
132
|
+
const actionTyped = action;
|
|
133
|
+
const currentFolder = actionTyped.folder;
|
|
134
|
+
const isFolderValid = StringExtensions.IsNotNullOrEmpty(currentFolder);
|
|
135
|
+
const availablePages = isFolderValid
|
|
136
|
+
? adaptable.api.pluginsApi
|
|
137
|
+
.getipushpullPluginApi()
|
|
138
|
+
.getPagesForIPushPullDomain(currentFolder)
|
|
139
|
+
: [];
|
|
140
|
+
middlewareAPI.dispatch(IPushPullSetCurrentAvailablePages(availablePages));
|
|
141
|
+
middlewareAPI.dispatch(IPushPullSetCurrentPage(''));
|
|
142
|
+
return next(action);
|
|
143
|
+
}
|
|
144
|
+
case IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
145
|
+
//refresh the available pages
|
|
146
|
+
const currentFolder = middlewareAPI.getState().Internal.IPushPullCurrentFolder;
|
|
147
|
+
const isFolderValid = StringExtensions.IsNotNullOrEmpty(currentFolder);
|
|
148
|
+
if (isFolderValid) {
|
|
149
|
+
const availablePages = adaptable.api.pluginsApi
|
|
150
|
+
.getipushpullPluginApi()
|
|
151
|
+
.getPagesForIPushPullDomain(currentFolder);
|
|
152
|
+
middlewareAPI.dispatch(IPushPullSetCurrentAvailablePages(availablePages));
|
|
153
|
+
}
|
|
154
|
+
return next(action);
|
|
155
|
+
}
|
|
156
|
+
default: {
|
|
157
|
+
return next(action);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
165
163
|
afterInitStore(adaptable) {
|
|
166
164
|
adaptable.adaptableModules.set(IPushPullModuleId, new PushPullModule(adaptable.api));
|
|
167
165
|
AdaptableViewFactory.IPushPullLoginPopup = IPushPullLoginPopup;
|