@adaptabletools/adaptable-plugin-ipushpull 16.2.4 → 17.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/README.md +113 -0
- package/package.json +6 -3
- package/src/IPushPullApiImpl.js +8 -13
- package/src/Module/Interface/IPushPullModule.js +1 -2
- package/src/Module/PushPullModule.js +14 -19
- package/src/Redux/ActionReducers/IPushPullRedux.js +65 -90
- package/src/Utilities/Services/Interface/IPushPullService.js +1 -2
- package/src/Utilities/Services/PushPullService.js +6 -11
- package/src/View/IPushPullAddPagePopup.d.ts +2 -1
- package/src/View/IPushPullAddPagePopup.js +41 -45
- package/src/View/IPushPullLoginPopup.d.ts +2 -1
- package/src/View/IPushPullLoginPopup.js +31 -35
- package/src/View/IPushPullPopup.d.ts +1 -1
- package/src/View/IPushPullPopup.js +10 -14
- package/src/View/IPushPullViewPanel.d.ts +2 -1
- package/src/View/IPushPullViewPanel.js +36 -40
- package/src/env.js +1 -3
- package/src/index.js +47 -49
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# AdapTable ipushpull Plugin Read Me
|
|
2
|
+
|
|
3
|
+
The ipushpull plugin connects AdapTable with [ipushpull](https://www.ipushpull.com) the market-leading collaborative software.
|
|
4
|
+
|
|
5
|
+
It allows user to send Reports - either System Reports shipped by AdapTable or those created via the AdapTable Export function - to ipushpull and from their to Symphony and other destinations.
|
|
6
|
+
|
|
7
|
+
## Version 7
|
|
8
|
+
Version 7 of AdapTable made significant changes to how ipushpull is set up, primarily by using this dedicated plugin.
|
|
9
|
+
|
|
10
|
+
As a consequence, the ipushpull section from Predefined Config was removed and no ipushpull information is provided by users that way.
|
|
11
|
+
|
|
12
|
+
Similarly all ipushpull state is now transient and **not persisted** when the application ends.
|
|
13
|
+
|
|
14
|
+
Instead we now use the `ipushpullPluginOptions` object in a similar way to other plugins.
|
|
15
|
+
|
|
16
|
+
The actual ipushpull functionality is unchanged, and the information required to be supplied by the user is identical but it now done through Options and not Predefined Config - isolating it in this way enables us to add more ipushpull-related functionality in a much quicker and safer way, isolated from the rest of the application.
|
|
17
|
+
|
|
18
|
+
## ipushpull Options
|
|
19
|
+
|
|
20
|
+
The ipushpull plugin contains an `ipushpullPluginOptions` object which allows users to set up their instance.
|
|
21
|
+
|
|
22
|
+
It contains credential details, useful properties (e.g. `throttleTime`, `autoLogin` etc.) and the ipupshpull config object.
|
|
23
|
+
|
|
24
|
+
## ipushpull Api
|
|
25
|
+
|
|
26
|
+
The `ipushpullApi` is available for full runtime programmatic access to ipushpull objects and methods.
|
|
27
|
+
|
|
28
|
+
> Note: because ipushpull is a plugin, you can get hold of this object through the `getPluginApi` method of pluginsApi.
|
|
29
|
+
|
|
30
|
+
## ipushpull Setup Example
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
|
|
34
|
+
// set up AdaptableOptions
|
|
35
|
+
const adaptableOptions: AdaptableOptions = {
|
|
36
|
+
******
|
|
37
|
+
plugins: [
|
|
38
|
+
ipp({
|
|
39
|
+
username: process.env.IPUSHPULL_USERNAME,
|
|
40
|
+
password: process.env.IPUSHPULL_PASSWORD,
|
|
41
|
+
throttleTime: 5000,
|
|
42
|
+
includeSystemReports: true,
|
|
43
|
+
ippConfig: {
|
|
44
|
+
api_secret: process.env.IPUSHPULL_API_KEY,
|
|
45
|
+
api_key: process.env.IPUSHPULL_API_KEY,
|
|
46
|
+
api_url: 'https://www.ipushpull.com/api/1.0',
|
|
47
|
+
ws_url: 'https://www.ipushpull.com',
|
|
48
|
+
web_url: 'https://www.ipushpull.com',
|
|
49
|
+
docs_url: 'https://docs.ipushpull.com',
|
|
50
|
+
storage_prefix: 'ipp_local',
|
|
51
|
+
transport: 'polling',
|
|
52
|
+
hsts: false, // strict cors policy
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
],
|
|
56
|
+
******
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Instantitate AdapTable and get the main Api object
|
|
60
|
+
adaptableApi = await Adaptable.init(adaptableOptions);
|
|
61
|
+
|
|
62
|
+
// use the plugins api to get the IPushPullApi object
|
|
63
|
+
const ipushpullApi: IPushPullApi = adaptableApi.pluginsApi.getPluginApi(
|
|
64
|
+
'ipushpull'
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## ipushpull Toolbar
|
|
70
|
+
|
|
71
|
+
The ipushpull plugin includes a dedicated ipushpull Toolbar - the main way to interact with ipushpull inside AdapTable.
|
|
72
|
+
|
|
73
|
+
At start-up this simply displays a login button that, when clicked, opens a login screen asking for username and password.
|
|
74
|
+
|
|
75
|
+
> There is a `AutoLogin` property option which will automatically log the user in to ipushpull (if the correct credentials have been provided in ipushpull Plugin Options).
|
|
76
|
+
|
|
77
|
+
Once the user is successfully logged in, the Toolbar will contain a number of elements (primarily dropdowns and buttons). These include:
|
|
78
|
+
|
|
79
|
+
### Dropdowns
|
|
80
|
+
|
|
81
|
+
1. **Reports Dropdown** - this shows all the Reports that have been created via the Export function.
|
|
82
|
+
> This dropdown will also include any System Reports that AdapTable ships by default (e.g. Selected Cells); however these can be removed by setting `IncludeSystemReports` to false
|
|
83
|
+
|
|
84
|
+
2. **Folders Dropdown** - lists all the folders (aka 'Domains') to which the user has access in ipushpull
|
|
85
|
+
|
|
86
|
+
3. **Pages Dropdown** - lists all the ipushpull pages in the currently selected Folder (in the Folders Dropdown).
|
|
87
|
+
|
|
88
|
+
### Buttons
|
|
89
|
+
|
|
90
|
+
1. **Send Snapshot** - this will run the current report and send the data to the currently selected ipushpull page. This is a **one-off** action.
|
|
91
|
+
|
|
92
|
+
2. **Run Live Report** - this will run the current report and send the data to the currently selected ipushpull page. It will also send live updates so as the data in the grid ticks and the report updaes, ipushpull will be updated in real time.
|
|
93
|
+
> The button displays a 'Play' icon; however, when a Live Report is running this changes to a 'Pause' icon.
|
|
94
|
+
|
|
95
|
+
3. **New ipushpull Page** - alllows the user to create a new ipushpull page in the folder of his choice.
|
|
96
|
+
|
|
97
|
+
4. **Create Schedule** - enables an ipushpull report to be sent at a schedule of the user's choice
|
|
98
|
+
>This leverages AdapTable Scheduling which enables actions to be performed either at a one off date and time or to be repeated daily at a scheduled time.
|
|
99
|
+
|
|
100
|
+
5. **Logout Button** - logs the User out of ipushpull (and displays the login button).
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## Help
|
|
104
|
+
|
|
105
|
+
Developers can learn how to access AdapTable programmatically at [AdapTable Documentation](https://docs.adaptabletools.com).
|
|
106
|
+
|
|
107
|
+
## More Information
|
|
108
|
+
|
|
109
|
+
General information about Adaptable Tools is available at our [Website](http://www.adaptabletools.com)
|
|
110
|
+
|
|
111
|
+
## Support
|
|
112
|
+
|
|
113
|
+
For all support enquiries please email [`support@adaptabletools.com`](mailto:support@adaptabletools.com) or [raise a Support Ticket](https://adaptabletools.zendesk.com/hc/en-us/requests/new).
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-plugin-ipushpull",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-canary.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "http://www.adaptabletools.com/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jonny Wolfson",
|
|
8
8
|
"email": "jonny.wolfson@adaptabletools.com"
|
|
9
9
|
},
|
|
10
|
-
"main": "src/index.js",
|
|
11
10
|
"typings": "src/index.d.ts",
|
|
12
11
|
"dependencies": {
|
|
13
12
|
"ipushpull-js": "^2.25.0",
|
|
@@ -19,6 +18,10 @@
|
|
|
19
18
|
"redux": "4.0.5",
|
|
20
19
|
"styled-components": "^4.4.1",
|
|
21
20
|
"tslib": "^2.3.0",
|
|
22
|
-
"@adaptabletools/adaptable": "
|
|
21
|
+
"@adaptabletools/adaptable": "17.0.0-canary.1"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./src/index.js"
|
|
23
26
|
}
|
|
24
27
|
}
|
package/src/IPushPullApiImpl.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const IPushPullRedux = tslib_1.__importStar(require("./Redux/ActionReducers/IPushPullRedux"));
|
|
8
|
-
const ArrayExtensions_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/Utilities/Extensions/ArrayExtensions"));
|
|
9
|
-
const Helper_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/Utilities/Helpers/Helper"));
|
|
10
|
-
class IPushPullApiImpl extends ApiBase_1.ApiBase {
|
|
1
|
+
import { ApiBase } from '@adaptabletools/adaptable/src/Api/Implementation/ApiBase';
|
|
2
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
3
|
+
import * as IPushPullRedux from './Redux/ActionReducers/IPushPullRedux';
|
|
4
|
+
import ArrayExtensions from '@adaptabletools/adaptable/src/Utilities/Extensions/ArrayExtensions';
|
|
5
|
+
import Helper from '@adaptabletools/adaptable/src/Utilities/Helpers/Helper';
|
|
6
|
+
export class IPushPullApiImpl extends ApiBase {
|
|
11
7
|
constructor(adaptable, options) {
|
|
12
8
|
super(adaptable);
|
|
13
9
|
this.ippService = null;
|
|
@@ -80,7 +76,7 @@ class IPushPullApiImpl extends ApiBase_1.ApiBase {
|
|
|
80
76
|
getPagesForIPushPullDomain(folderName) {
|
|
81
77
|
let returnArray = [];
|
|
82
78
|
let iPushPullDomains = this.getIPushPullDomains();
|
|
83
|
-
if (
|
|
79
|
+
if (ArrayExtensions.IsNotNullOrEmpty(iPushPullDomains)) {
|
|
84
80
|
let iPushPullDomain = iPushPullDomains.find((f) => f.Name == folderName);
|
|
85
81
|
if (iPushPullDomain) {
|
|
86
82
|
returnArray = iPushPullDomain.Pages;
|
|
@@ -132,7 +128,7 @@ class IPushPullApiImpl extends ApiBase_1.ApiBase {
|
|
|
132
128
|
this.adaptable.ReportService.PublishLiveLiveDataChangedEvent('ipushpull', 'Disconnected');
|
|
133
129
|
}
|
|
134
130
|
isIPushPullLiveDataRunning() {
|
|
135
|
-
return
|
|
131
|
+
return Helper.objectExists(this.getCurrentLiveIPushPullReport());
|
|
136
132
|
}
|
|
137
133
|
getIPPService() {
|
|
138
134
|
if (!this.ippService) {
|
|
@@ -169,4 +165,3 @@ class IPushPullApiImpl extends ApiBase_1.ApiBase {
|
|
|
169
165
|
this.dispatchAction(IPushPullRedux.IPushPullLiveReportClear());
|
|
170
166
|
}
|
|
171
167
|
}
|
|
172
|
-
exports.IPushPullApiImpl = IPushPullApiImpl;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const AdaptableModuleBase_1 = require("@adaptabletools/adaptable/src/Strategy/AdaptableModuleBase");
|
|
6
|
-
const ModuleConstants = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants"));
|
|
7
|
-
const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
|
|
8
|
-
const GeneralConstants_1 = require("@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants");
|
|
1
|
+
import { AdaptableModuleBase } from '@adaptabletools/adaptable/src/Strategy/AdaptableModuleBase';
|
|
2
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
3
|
+
import throttle from 'lodash/throttle';
|
|
4
|
+
import { SELECTED_CELLS_REPORT, DEFAULT_LIVE_REPORT_THROTTLE_TIME, SELECTED_ROWS_REPORT, } from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
9
5
|
const EQUAL_DATA_ERR = 'equal data, so not sending';
|
|
10
|
-
class PushPullModule extends
|
|
6
|
+
export class PushPullModule extends AdaptableModuleBase {
|
|
11
7
|
constructor(api) {
|
|
12
8
|
super(ModuleConstants.IPushPullModuleId, 'ipushpull', 'download', null, 'Send data from AdapTable to ipushpull', api);
|
|
13
9
|
this.isSendingData = false;
|
|
@@ -15,7 +11,7 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
15
11
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
16
12
|
this.api.eventApi.on('AdaptableReady', () => {
|
|
17
13
|
setTimeout(() => {
|
|
18
|
-
this.throttledRecomputeAndSendLiveDataEvent = (
|
|
14
|
+
this.throttledRecomputeAndSendLiveDataEvent = throttle(() => this.sendNewLiveData(), this.getThrottleTimeFromState());
|
|
19
15
|
}, 1000);
|
|
20
16
|
});
|
|
21
17
|
// if a piece of data has updated then update any live reports except cell or row selected where the data change is relevant
|
|
@@ -28,8 +24,8 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
28
24
|
if (api.isIPushPullLiveDataRunning()) {
|
|
29
25
|
let currentLiveIPushPullReport = api.getCurrentLiveIPushPullReport();
|
|
30
26
|
if (currentLiveIPushPullReport &&
|
|
31
|
-
currentLiveIPushPullReport.ReportName !==
|
|
32
|
-
currentLiveIPushPullReport.ReportName !==
|
|
27
|
+
currentLiveIPushPullReport.ReportName !== SELECTED_CELLS_REPORT &&
|
|
28
|
+
currentLiveIPushPullReport.ReportName !== SELECTED_ROWS_REPORT &&
|
|
33
29
|
exportApi.internalApi.isDataChangeInReport(cellDataChangedInfo, this.getCurrentReport())) {
|
|
34
30
|
this.throttledRecomputeAndSendLiveDataEvent();
|
|
35
31
|
}
|
|
@@ -42,13 +38,13 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
42
38
|
}
|
|
43
39
|
});
|
|
44
40
|
// if the grid filters have changed then update any live reports except cell or row selected
|
|
45
|
-
this.adaptable._on('
|
|
41
|
+
this.adaptable._on('AdapTableFiltersApplied', () => {
|
|
46
42
|
// Rerun all reports except selected cells / rows when filter changes
|
|
47
43
|
if (this.getIPPApi().isIPushPullLiveDataRunning()) {
|
|
48
44
|
let currentLiveIPushPullReport = this.getIPPApi().getCurrentLiveIPushPullReport();
|
|
49
45
|
if (currentLiveIPushPullReport &&
|
|
50
|
-
currentLiveIPushPullReport.ReportName !==
|
|
51
|
-
currentLiveIPushPullReport.ReportName !==
|
|
46
|
+
currentLiveIPushPullReport.ReportName !== SELECTED_CELLS_REPORT &&
|
|
47
|
+
currentLiveIPushPullReport.ReportName !== SELECTED_ROWS_REPORT) {
|
|
52
48
|
this.throttledRecomputeAndSendLiveDataEvent();
|
|
53
49
|
}
|
|
54
50
|
}
|
|
@@ -58,8 +54,8 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
58
54
|
if (this.getIPPApi().isIPushPullLiveDataRunning()) {
|
|
59
55
|
let currentLiveIPushPullReport = this.getIPPApi().getCurrentLiveIPushPullReport();
|
|
60
56
|
if (currentLiveIPushPullReport &&
|
|
61
|
-
(currentLiveIPushPullReport.ReportName ===
|
|
62
|
-
currentLiveIPushPullReport.ReportName ===
|
|
57
|
+
(currentLiveIPushPullReport.ReportName === SELECTED_CELLS_REPORT ||
|
|
58
|
+
currentLiveIPushPullReport.ReportName === SELECTED_ROWS_REPORT)) {
|
|
63
59
|
this.throttledRecomputeAndSendLiveDataEvent();
|
|
64
60
|
}
|
|
65
61
|
}
|
|
@@ -184,7 +180,6 @@ class PushPullModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
184
180
|
if (this.getIPPApi().isIPushPullRunning()) {
|
|
185
181
|
iPushPullThrottleTime = this.getIPPApi().getIPushPullThrottleTime();
|
|
186
182
|
}
|
|
187
|
-
return iPushPullThrottleTime ? iPushPullThrottleTime :
|
|
183
|
+
return iPushPullThrottleTime ? iPushPullThrottleTime : DEFAULT_LIVE_REPORT_THROTTLE_TIME;
|
|
188
184
|
}
|
|
189
185
|
}
|
|
190
|
-
exports.PushPullModule = PushPullModule;
|
|
@@ -1,172 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const PluginsRedux_1 = require("@adaptabletools/adaptable/src/Redux/ActionsReducers/PluginsRedux");
|
|
6
|
-
const IPushPullSetThrottleTime = (throttleTime) => ({
|
|
7
|
-
type: PluginsRedux_1.IPUSHPULL_SET_THROTTLE_TIME,
|
|
1
|
+
import { EMPTY_ARRAY, EMPTY_STRING, } from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
2
|
+
import { IPUSHPULL_SET_THROTTLE_TIME, IPUSHPULL_SEND_SNAPSHOT, IPUSHPULL_START_LIVE_DATA, IPUSHPULL_STOP_LIVE_DATA, IPUSHPULL_LOGIN, IPUSHPULL_LOGOUT, IPUSHPULL_SET_LOGIN_DETAILS, IPUSHPULL_SET_LOGIN_ERROR_MESSAGE, IPUSHPULL_ADD_PAGE, IPUSHPULL_SET_AVAILABLE_ON, IPUSHPULL_SET_AVAILABLE_OFF, IPUSHPULL_SET_RUNNING_ON, IPUSHPULL_SET_RUNNING_OFF, IPUSHPULL_DOMAIN_PAGES_SET, IPUSHPULL_DOMAIN_PAGES_CLEAR, IPUSHPULL_LIVE_REPORT_SET, IPUSHPULL_LIVE_REPORT_CLEAR, IPUSHPULL_SET_CURRENT_REPORTNAME, IPUSHPULL_SET_CURRENT_FOLDER, IPUSHPULL_SET_CURRENT_PAGE, IPUSHPULL_SET_CURRENT_AVAILABLE_PAGES, } from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PluginsRedux';
|
|
3
|
+
export const IPushPullSetThrottleTime = (throttleTime) => ({
|
|
4
|
+
type: IPUSHPULL_SET_THROTTLE_TIME,
|
|
8
5
|
throttleTime,
|
|
9
6
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type: PluginsRedux_1.IPUSHPULL_SEND_SNAPSHOT,
|
|
7
|
+
export const IPushPullSendSnapshot = (iPushPullReport) => ({
|
|
8
|
+
type: IPUSHPULL_SEND_SNAPSHOT,
|
|
13
9
|
iPushPullReport,
|
|
14
10
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: PluginsRedux_1.IPUSHPULL_START_LIVE_DATA,
|
|
11
|
+
export const IPushPullStartLiveData = (iPushPullReport) => ({
|
|
12
|
+
type: IPUSHPULL_START_LIVE_DATA,
|
|
18
13
|
iPushPullReport,
|
|
19
14
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type: PluginsRedux_1.IPUSHPULL_STOP_LIVE_DATA,
|
|
15
|
+
export const IPushPullStopLiveData = () => ({
|
|
16
|
+
type: IPUSHPULL_STOP_LIVE_DATA,
|
|
23
17
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type: PluginsRedux_1.IPUSHPULL_LOGIN,
|
|
18
|
+
export const IPushPullLogin = (username, password) => ({
|
|
19
|
+
type: IPUSHPULL_LOGIN,
|
|
27
20
|
username,
|
|
28
21
|
password,
|
|
29
22
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: PluginsRedux_1.IPUSHPULL_LOGOUT,
|
|
23
|
+
export const IPushPullLogout = () => ({
|
|
24
|
+
type: IPUSHPULL_LOGOUT,
|
|
33
25
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type: PluginsRedux_1.IPUSHPULL_SET_LOGIN_DETAILS,
|
|
26
|
+
export const IPushPullSetLoginDetails = (username, password) => ({
|
|
27
|
+
type: IPUSHPULL_SET_LOGIN_DETAILS,
|
|
37
28
|
username,
|
|
38
29
|
password,
|
|
39
30
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type: PluginsRedux_1.IPUSHPULL_SET_LOGIN_ERROR_MESSAGE,
|
|
31
|
+
export const IPushPullSetLoginErrorMessage = (errorMessage) => ({
|
|
32
|
+
type: IPUSHPULL_SET_LOGIN_ERROR_MESSAGE,
|
|
43
33
|
errorMessage,
|
|
44
34
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: PluginsRedux_1.IPUSHPULL_ADD_PAGE,
|
|
35
|
+
export const IPushPullAddPage = (folder, page) => ({
|
|
36
|
+
type: IPUSHPULL_ADD_PAGE,
|
|
48
37
|
folder,
|
|
49
38
|
page,
|
|
50
39
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
type: PluginsRedux_1.IPUSHPULL_SET_AVAILABLE_ON,
|
|
40
|
+
export const SetIPushPullAvailableOn = () => ({
|
|
41
|
+
type: IPUSHPULL_SET_AVAILABLE_ON,
|
|
54
42
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type: PluginsRedux_1.IPUSHPULL_SET_AVAILABLE_OFF,
|
|
43
|
+
export const SetIPushPullAvailableOff = () => ({
|
|
44
|
+
type: IPUSHPULL_SET_AVAILABLE_OFF,
|
|
58
45
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type: PluginsRedux_1.IPUSHPULL_SET_RUNNING_ON,
|
|
46
|
+
export const SetIPushPullRunningOn = () => ({
|
|
47
|
+
type: IPUSHPULL_SET_RUNNING_ON,
|
|
62
48
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
type: PluginsRedux_1.IPUSHPULL_SET_RUNNING_OFF,
|
|
49
|
+
export const SetIPushPullRunningOff = () => ({
|
|
50
|
+
type: IPUSHPULL_SET_RUNNING_OFF,
|
|
66
51
|
});
|
|
67
|
-
|
|
68
|
-
const IPushPullSetDomainsPages = (IPushPullDomainsPages) => {
|
|
52
|
+
export const IPushPullSetDomainsPages = (IPushPullDomainsPages) => {
|
|
69
53
|
return {
|
|
70
|
-
type:
|
|
54
|
+
type: IPUSHPULL_DOMAIN_PAGES_SET,
|
|
71
55
|
IPushPullDomainsPages,
|
|
72
56
|
};
|
|
73
57
|
};
|
|
74
|
-
|
|
75
|
-
const IPushPullClearDomainsPages = () => {
|
|
58
|
+
export const IPushPullClearDomainsPages = () => {
|
|
76
59
|
return {
|
|
77
|
-
type:
|
|
60
|
+
type: IPUSHPULL_DOMAIN_PAGES_CLEAR,
|
|
78
61
|
};
|
|
79
62
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
type: PluginsRedux_1.IPUSHPULL_LIVE_REPORT_SET,
|
|
63
|
+
export const IPushPullLiveReportSet = (iPushPullReport) => ({
|
|
64
|
+
type: IPUSHPULL_LIVE_REPORT_SET,
|
|
83
65
|
iPushPullReport,
|
|
84
66
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
type: PluginsRedux_1.IPUSHPULL_LIVE_REPORT_CLEAR,
|
|
67
|
+
export const IPushPullLiveReportClear = () => ({
|
|
68
|
+
type: IPUSHPULL_LIVE_REPORT_CLEAR,
|
|
88
69
|
});
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
const IPushPullSetCurrentFolder = (folder) => ({
|
|
93
|
-
type: PluginsRedux_1.IPUSHPULL_SET_CURRENT_FOLDER,
|
|
70
|
+
export const IPushPullSetCurrentReportName = (reportName) => ({ type: IPUSHPULL_SET_CURRENT_REPORTNAME, reportName });
|
|
71
|
+
export const IPushPullSetCurrentFolder = (folder) => ({
|
|
72
|
+
type: IPUSHPULL_SET_CURRENT_FOLDER,
|
|
94
73
|
folder,
|
|
95
74
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
type: PluginsRedux_1.IPUSHPULL_SET_CURRENT_PAGE,
|
|
75
|
+
export const IPushPullSetCurrentPage = (page) => ({
|
|
76
|
+
type: IPUSHPULL_SET_CURRENT_PAGE,
|
|
99
77
|
page,
|
|
100
78
|
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
type: PluginsRedux_1.IPUSHPULL_SET_CURRENT_AVAILABLE_PAGES,
|
|
79
|
+
export const IPushPullSetCurrentAvailablePages = (availablePages) => ({
|
|
80
|
+
type: IPUSHPULL_SET_CURRENT_AVAILABLE_PAGES,
|
|
104
81
|
availablePages,
|
|
105
82
|
});
|
|
106
|
-
|
|
107
|
-
exports.iPushPullInitialState = {
|
|
83
|
+
export const iPushPullInitialState = {
|
|
108
84
|
IsIPushPullRunning: false,
|
|
109
|
-
IPushPullDomainsPages:
|
|
85
|
+
IPushPullDomainsPages: EMPTY_ARRAY,
|
|
110
86
|
CurrentLiveIPushPullReport: undefined,
|
|
111
87
|
IPushPullLoginErrorMessage: undefined,
|
|
112
|
-
IPushPullCurrentReportName:
|
|
113
|
-
IPushPullCurrentFolder:
|
|
114
|
-
IPushPullCurrentPage:
|
|
115
|
-
IPushPullCurrentAvailablePages:
|
|
88
|
+
IPushPullCurrentReportName: EMPTY_STRING,
|
|
89
|
+
IPushPullCurrentFolder: EMPTY_STRING,
|
|
90
|
+
IPushPullCurrentPage: EMPTY_STRING,
|
|
91
|
+
IPushPullCurrentAvailablePages: EMPTY_ARRAY,
|
|
116
92
|
};
|
|
117
|
-
const IPushPullReducer = (
|
|
93
|
+
export const IPushPullReducer = (
|
|
118
94
|
// initial state is handled in the plugin rootReducer
|
|
119
95
|
state, action) => {
|
|
120
96
|
switch (action.type) {
|
|
121
|
-
case
|
|
97
|
+
case IPUSHPULL_SET_AVAILABLE_ON:
|
|
122
98
|
return Object.assign({}, state, { IsIPushPullAvailable: true });
|
|
123
|
-
case
|
|
99
|
+
case IPUSHPULL_SET_AVAILABLE_OFF:
|
|
124
100
|
return Object.assign({}, state, { IsIPushPullAvailable: false });
|
|
125
|
-
case
|
|
101
|
+
case IPUSHPULL_SET_RUNNING_ON:
|
|
126
102
|
return Object.assign({}, state, { IsIPushPullRunning: true });
|
|
127
|
-
case
|
|
103
|
+
case IPUSHPULL_SET_RUNNING_OFF:
|
|
128
104
|
return Object.assign({}, state, { IsIPushPullRunning: false });
|
|
129
|
-
case
|
|
105
|
+
case IPUSHPULL_SET_LOGIN_DETAILS: {
|
|
130
106
|
let loginAction = action;
|
|
131
107
|
return Object.assign(Object.assign({}, state), { CurrentIPushpullUsername: loginAction.username, CurrentIPushpullPassword: loginAction.password });
|
|
132
108
|
}
|
|
133
|
-
case
|
|
109
|
+
case IPUSHPULL_LOGOUT: {
|
|
134
110
|
return Object.assign(Object.assign({}, state), { CurrentIPushpullUsername: undefined, CurrentIPushpullPassword: undefined });
|
|
135
111
|
}
|
|
136
|
-
case
|
|
112
|
+
case IPUSHPULL_SET_LOGIN_ERROR_MESSAGE: {
|
|
137
113
|
return Object.assign(Object.assign({}, state), { IPushPullLoginErrorMessage: action.errorMessage });
|
|
138
114
|
}
|
|
139
|
-
case
|
|
115
|
+
case IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
140
116
|
return Object.assign({}, state, {
|
|
141
117
|
IPushPullDomainsPages: action.IPushPullDomainsPages || [],
|
|
142
118
|
});
|
|
143
119
|
}
|
|
144
|
-
case
|
|
120
|
+
case IPUSHPULL_DOMAIN_PAGES_CLEAR: {
|
|
145
121
|
return Object.assign({}, state, {
|
|
146
122
|
IPushPullDomainsPages: [],
|
|
147
123
|
});
|
|
148
124
|
}
|
|
149
|
-
case
|
|
125
|
+
case IPUSHPULL_LIVE_REPORT_SET: {
|
|
150
126
|
const actionType = action;
|
|
151
127
|
return Object.assign({}, state, { CurrentLiveIPushPullReport: actionType.iPushPullReport });
|
|
152
128
|
}
|
|
153
|
-
case
|
|
129
|
+
case IPUSHPULL_LIVE_REPORT_CLEAR: {
|
|
154
130
|
// const atctionType = action as IPushPullLiveReportSetAction;
|
|
155
131
|
return Object.assign({}, state, { CurrentLiveIPushPullReport: undefined });
|
|
156
132
|
}
|
|
157
|
-
case
|
|
133
|
+
case IPUSHPULL_SET_CURRENT_REPORTNAME: {
|
|
158
134
|
const actionTyped = action;
|
|
159
135
|
return Object.assign({}, state, { IPushPullCurrentReportName: actionTyped.reportName });
|
|
160
136
|
}
|
|
161
|
-
case
|
|
137
|
+
case IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
162
138
|
const actionTyped = action;
|
|
163
139
|
return Object.assign({}, state, { IPushPullCurrentFolder: actionTyped.folder });
|
|
164
140
|
}
|
|
165
|
-
case
|
|
141
|
+
case IPUSHPULL_SET_CURRENT_PAGE: {
|
|
166
142
|
const actionTyped = action;
|
|
167
143
|
return Object.assign({}, state, { IPushPullCurrentPage: actionTyped.page });
|
|
168
144
|
}
|
|
169
|
-
case
|
|
145
|
+
case IPUSHPULL_SET_CURRENT_AVAILABLE_PAGES: {
|
|
170
146
|
const actionTyped = action;
|
|
171
147
|
return Object.assign({}, state, {
|
|
172
148
|
IPushPullCurrentAvailablePages: actionTyped.availablePages,
|
|
@@ -176,4 +152,3 @@ state, action) => {
|
|
|
176
152
|
return state;
|
|
177
153
|
}
|
|
178
154
|
};
|
|
179
|
-
exports.IPushPullReducer = IPushPullReducer;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PushPullService = exports.ServiceStatus = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const StringExtensions_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions"));
|
|
6
|
-
var ServiceStatus;
|
|
1
|
+
import StringExtensions from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
2
|
+
export var ServiceStatus;
|
|
7
3
|
(function (ServiceStatus) {
|
|
8
4
|
ServiceStatus["Unknown"] = "Unknown";
|
|
9
5
|
ServiceStatus["Disconnected"] = "Disconnected";
|
|
10
6
|
ServiceStatus["Connected"] = "Connected";
|
|
11
7
|
ServiceStatus["Error"] = "Error";
|
|
12
|
-
})(ServiceStatus
|
|
13
|
-
class PushPullService {
|
|
8
|
+
})(ServiceStatus || (ServiceStatus = {}));
|
|
9
|
+
export class PushPullService {
|
|
14
10
|
constructor(adaptable) {
|
|
15
11
|
this.adaptable = adaptable;
|
|
16
12
|
this.ppInstance = null;
|
|
@@ -31,8 +27,8 @@ class PushPullService {
|
|
|
31
27
|
// get the username and passwrord from the options
|
|
32
28
|
let userName = this.getIPPApi().getIPushPullUsername();
|
|
33
29
|
let password = this.getIPPApi().getIPushPullPassword();
|
|
34
|
-
if (
|
|
35
|
-
|
|
30
|
+
if (StringExtensions.IsNotNullOrEmpty(userName) &&
|
|
31
|
+
StringExtensions.IsNotNullOrEmpty(password)) {
|
|
36
32
|
try {
|
|
37
33
|
// slightly circular but it means tht we do the logic in one go..
|
|
38
34
|
this.getIPPApi().loginToIPushPull(userName, password);
|
|
@@ -211,4 +207,3 @@ class PushPullService {
|
|
|
211
207
|
});
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
|
-
exports.PushPullService = PushPullService;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
2
3
|
import { IPushPullDomain } from '@adaptabletools/adaptable/src/PredefinedConfig/IPushPullState';
|
|
3
4
|
interface IPushPullAddPagePopupProps {
|
|
@@ -5,5 +6,5 @@ interface IPushPullAddPagePopupProps {
|
|
|
5
6
|
onAddPage: (folder: string, page: string) => IPushPullRedux.IPushPullAddPageAction;
|
|
6
7
|
onCancel: () => any;
|
|
7
8
|
}
|
|
8
|
-
export declare let IPushPullAddPagePopup: import("react-redux").ConnectedComponent<(props: IPushPullAddPagePopupProps) => JSX.Element, import("react-redux").Omit<
|
|
9
|
+
export declare let IPushPullAddPagePopup: import("react-redux").ConnectedComponent<(props: IPushPullAddPagePopupProps) => JSX.Element, import("react-redux").Omit<JSX.LibraryManagedAttributes<C, import("react-redux").GetProps<C>>, "IPushPullDomainsPages" | "onCancel" | "onAddPage">>;
|
|
9
10
|
export {};
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const rebass_1 = require("rebass");
|
|
19
|
-
const Dropdown_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/components/Dropdown"));
|
|
20
|
-
const GeneralConstants_1 = require("@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants");
|
|
21
|
-
const ArrayExtensions_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/Utilities/Extensions/ArrayExtensions"));
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
4
|
+
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
5
|
+
import { StringExtensions } from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
6
|
+
import FormLayout, { FormRow } from '@adaptabletools/adaptable/src/components/FormLayout';
|
|
7
|
+
import Input from '@adaptabletools/adaptable/src/components/Input';
|
|
8
|
+
import SimpleButton from '@adaptabletools/adaptable/src/components/SimpleButton';
|
|
9
|
+
import FlexWithFooter from '@adaptabletools/adaptable/src/components/FlexWithFooter';
|
|
10
|
+
import { PanelWithImage } from '@adaptabletools/adaptable/src/View/Components/Panels/PanelWithImage';
|
|
11
|
+
import { usePopupContext } from '@adaptabletools/adaptable/src/View/Components/Popups/AdaptablePopup/PopupContext';
|
|
12
|
+
import ErrorBox from '@adaptabletools/adaptable/src/components/ErrorBox';
|
|
13
|
+
import HelpBlock from '@adaptabletools/adaptable/src/components/HelpBlock';
|
|
14
|
+
import { Flex } from 'rebass';
|
|
15
|
+
import Dropdown from '@adaptabletools/adaptable/src/components/Dropdown';
|
|
16
|
+
import { EMPTY_STRING, EMPTY_ARRAY, } from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
17
|
+
import ArrayExtensions from '@adaptabletools/adaptable/src/Utilities/Extensions/ArrayExtensions';
|
|
22
18
|
const IPushPullAddPageComponent = (props) => {
|
|
23
19
|
const [state, setState] = React.useState({
|
|
24
20
|
Folder: '',
|
|
25
21
|
Page: '',
|
|
26
|
-
AvailablePages:
|
|
22
|
+
AvailablePages: EMPTY_ARRAY,
|
|
27
23
|
ErrorMessage: '',
|
|
28
24
|
});
|
|
29
|
-
const { hidePopup } =
|
|
25
|
+
const { hidePopup } = usePopupContext();
|
|
30
26
|
const onSubmit = () => {
|
|
31
|
-
if (
|
|
27
|
+
if (ArrayExtensions.ContainsItem(state.AvailablePages, state.Page)) {
|
|
32
28
|
setState(Object.assign(Object.assign({}, state), { ErrorMessage: 'A page with that name already exists in the folder' }));
|
|
33
29
|
}
|
|
34
30
|
else {
|
|
@@ -40,21 +36,21 @@ const IPushPullAddPageComponent = (props) => {
|
|
|
40
36
|
setState(Object.assign(Object.assign({}, state), { Page: e.value }));
|
|
41
37
|
};
|
|
42
38
|
const onFolderChanged = (folderName) => {
|
|
43
|
-
if (
|
|
39
|
+
if (StringExtensions.IsNotNullOrEmpty(folderName) && folderName !== 'Select Folder') {
|
|
44
40
|
let avaialablePages = props.IPushPullDomainsPages.find((f) => f.Name == folderName).Pages;
|
|
45
41
|
setState({
|
|
46
42
|
Folder: folderName,
|
|
47
43
|
AvailablePages: avaialablePages,
|
|
48
|
-
Page:
|
|
49
|
-
ErrorMessage:
|
|
44
|
+
Page: EMPTY_STRING,
|
|
45
|
+
ErrorMessage: EMPTY_STRING,
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
48
|
else {
|
|
53
49
|
setState({
|
|
54
|
-
Folder:
|
|
50
|
+
Folder: EMPTY_STRING,
|
|
55
51
|
AvailablePages: [],
|
|
56
|
-
Page:
|
|
57
|
-
ErrorMessage:
|
|
52
|
+
Page: EMPTY_STRING,
|
|
53
|
+
ErrorMessage: EMPTY_STRING,
|
|
58
54
|
});
|
|
59
55
|
}
|
|
60
56
|
};
|
|
@@ -64,29 +60,29 @@ const IPushPullAddPageComponent = (props) => {
|
|
|
64
60
|
value: iPushPullDomain.Name,
|
|
65
61
|
};
|
|
66
62
|
});
|
|
67
|
-
return (React.createElement(
|
|
68
|
-
React.createElement(
|
|
63
|
+
return (React.createElement(PanelWithImage, { header: "Add ipushpull Page", glyphicon: "newpage", variant: "primary", style: { height: '100%' } },
|
|
64
|
+
React.createElement(FlexWithFooter, { as: "form", onSubmit: (e) => {
|
|
69
65
|
e.preventDefault();
|
|
70
66
|
onSubmit();
|
|
71
67
|
}, footerProps: {
|
|
72
68
|
fontSize: 'var(--ab-font-size-4)',
|
|
73
69
|
}, footer: React.createElement(React.Fragment, null,
|
|
74
|
-
React.createElement(
|
|
70
|
+
React.createElement(SimpleButton, { tone: "neutral", variant: "text", tooltip: "Close", onClick: (e) => {
|
|
75
71
|
e.stopPropagation();
|
|
76
72
|
hidePopup();
|
|
77
73
|
} }, "CLOSE"),
|
|
78
74
|
React.createElement("div", { style: { flex: 1 } }),
|
|
79
|
-
React.createElement(
|
|
80
|
-
|
|
81
|
-
React.createElement(
|
|
82
|
-
React.createElement(
|
|
83
|
-
React.createElement(
|
|
84
|
-
React.createElement(
|
|
85
|
-
React.createElement(
|
|
86
|
-
React.createElement(
|
|
87
|
-
React.createElement(
|
|
88
|
-
state.ErrorMessage ? (React.createElement(
|
|
89
|
-
React.createElement(
|
|
75
|
+
React.createElement(SimpleButton, { tone: "accent", variant: "raised", type: "submit", disabled: StringExtensions.IsNullOrEmpty(state.Folder) ||
|
|
76
|
+
StringExtensions.IsNullOrEmpty(state.Page), icon: 'check' }, "Add Page")) },
|
|
77
|
+
React.createElement(Flex, { flexDirection: "column", padding: 2, margin: 2 },
|
|
78
|
+
React.createElement(HelpBlock, { marginBottom: 1 }, "Select a folder and then choose the name of the new ipushpull page it should contain."),
|
|
79
|
+
React.createElement(FormLayout, { margin: 3 },
|
|
80
|
+
React.createElement(FormRow, { label: "Folder:" },
|
|
81
|
+
React.createElement(Dropdown, { disabled: availableFolders.length == 0, style: { minWidth: '50%' }, options: availableFolders, className: "ab-Popup__IPushPull__select", onChange: (folder) => onFolderChanged(folder), value: state.Folder ? state.Folder : null, placeholder: "Select Folder", marginRight: 2 })),
|
|
82
|
+
React.createElement(FormRow, { label: "Page" },
|
|
83
|
+
React.createElement(Input, { width: "50%", type: "text", placeholder: "Page Name", value: state.Page, onChange: onPageNameChange })),
|
|
84
|
+
state.ErrorMessage ? (React.createElement(FormRow, { label: "" },
|
|
85
|
+
React.createElement(ErrorBox, null, state.ErrorMessage))) : null)))));
|
|
90
86
|
};
|
|
91
87
|
function mapStateToProps(state) {
|
|
92
88
|
return {
|
|
@@ -101,4 +97,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
101
97
|
},
|
|
102
98
|
};
|
|
103
99
|
}
|
|
104
|
-
|
|
100
|
+
export let IPushPullAddPagePopup = connect(mapStateToProps, mapDispatchToProps)(IPushPullAddPageComponent);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
2
3
|
interface IPushPullLoginPopupProps {
|
|
3
4
|
pushpullLogin: string | undefined;
|
|
@@ -6,5 +7,5 @@ interface IPushPullLoginPopupProps {
|
|
|
6
7
|
onLogin: (login: string, password: string) => IPushPullRedux.IPushPullLoginAction;
|
|
7
8
|
onCancel: () => any;
|
|
8
9
|
}
|
|
9
|
-
export declare let IPushPullLoginPopup: import("react-redux").ConnectedComponent<(props: IPushPullLoginPopupProps) => JSX.Element, import("react-redux").Omit<
|
|
10
|
+
export declare let IPushPullLoginPopup: import("react-redux").ConnectedComponent<(props: IPushPullLoginPopupProps) => JSX.Element, import("react-redux").Omit<JSX.LibraryManagedAttributes<C, import("react-redux").GetProps<C>>, keyof IPushPullLoginPopupProps>>;
|
|
10
11
|
export {};
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const PopupContext_1 = require("@adaptabletools/adaptable/src/View/Components/Popups/AdaptablePopup/PopupContext");
|
|
17
|
-
const ErrorBox_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/components/ErrorBox"));
|
|
18
|
-
const HelpBlock_1 = tslib_1.__importDefault(require("@adaptabletools/adaptable/src/components/HelpBlock"));
|
|
19
|
-
const rebass_1 = require("rebass");
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { useAdaptable } from '@adaptabletools/adaptable/src/View/AdaptableContext';
|
|
4
|
+
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
5
|
+
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
6
|
+
import { StringExtensions } from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
7
|
+
import FormLayout, { FormRow } from '@adaptabletools/adaptable/src/components/FormLayout';
|
|
8
|
+
import Input from '@adaptabletools/adaptable/src/components/Input';
|
|
9
|
+
import SimpleButton from '@adaptabletools/adaptable/src/components/SimpleButton';
|
|
10
|
+
import FlexWithFooter from '@adaptabletools/adaptable/src/components/FlexWithFooter';
|
|
11
|
+
import { PanelWithImage } from '@adaptabletools/adaptable/src/View/Components/Panels/PanelWithImage';
|
|
12
|
+
import { usePopupContext } from '@adaptabletools/adaptable/src/View/Components/Popups/AdaptablePopup/PopupContext';
|
|
13
|
+
import ErrorBox from '@adaptabletools/adaptable/src/components/ErrorBox';
|
|
14
|
+
import HelpBlock from '@adaptabletools/adaptable/src/components/HelpBlock';
|
|
15
|
+
import { Flex } from 'rebass';
|
|
20
16
|
const IPushPullLoginComponent = (props) => {
|
|
21
|
-
const adaptable =
|
|
17
|
+
const adaptable = useAdaptable();
|
|
22
18
|
const options = adaptable.getPlugin('ipushpull').options;
|
|
23
19
|
const [state, setState] = React.useState({
|
|
24
20
|
Login: options.username || '',
|
|
25
21
|
Password: options.password || '',
|
|
26
22
|
});
|
|
27
|
-
const { hidePopup } =
|
|
23
|
+
const { hidePopup } = usePopupContext();
|
|
28
24
|
const onSubmit = () => {
|
|
29
25
|
props.onLogin(state.Login || '', state.Password || '');
|
|
30
26
|
};
|
|
@@ -36,28 +32,28 @@ const IPushPullLoginComponent = (props) => {
|
|
|
36
32
|
const e = event.target;
|
|
37
33
|
setState(Object.assign(Object.assign({}, state), { Password: e.value }));
|
|
38
34
|
};
|
|
39
|
-
return (React.createElement(
|
|
40
|
-
React.createElement(
|
|
35
|
+
return (React.createElement(PanelWithImage, { header: "ipushpull Login Details", glyphicon: "login", variant: "primary", style: { height: '100%' } },
|
|
36
|
+
React.createElement(FlexWithFooter, { as: "form", onSubmit: (e) => {
|
|
41
37
|
e.preventDefault();
|
|
42
38
|
onSubmit();
|
|
43
39
|
}, footerProps: {
|
|
44
40
|
fontSize: 'var(--ab-font-size-4)',
|
|
45
41
|
}, footer: React.createElement(React.Fragment, null,
|
|
46
|
-
React.createElement(
|
|
42
|
+
React.createElement(SimpleButton, { tone: "neutral", variant: "text", tooltip: "Close", onClick: (e) => {
|
|
47
43
|
e.stopPropagation();
|
|
48
44
|
hidePopup();
|
|
49
45
|
} }, "CLOSE"),
|
|
50
46
|
React.createElement("div", { style: { flex: 1 } }),
|
|
51
|
-
React.createElement(
|
|
52
|
-
React.createElement(
|
|
53
|
-
React.createElement(
|
|
54
|
-
React.createElement(
|
|
55
|
-
React.createElement(
|
|
56
|
-
React.createElement(
|
|
57
|
-
React.createElement(
|
|
58
|
-
React.createElement(
|
|
59
|
-
props.pushpullLoginErrorMessage ? (React.createElement(
|
|
60
|
-
React.createElement(
|
|
47
|
+
React.createElement(SimpleButton, { tone: "accent", variant: "raised", type: "submit", disabled: StringExtensions.IsNullOrEmpty(state.Password), icon: 'check' }, "Login")) },
|
|
48
|
+
React.createElement(Flex, { flexDirection: "column", padding: 2, margin: 2 },
|
|
49
|
+
React.createElement(HelpBlock, { marginBottom: 1 }, "Login to ipushpull using your login (email address) and password."),
|
|
50
|
+
React.createElement(FormLayout, { margin: 3 },
|
|
51
|
+
React.createElement(FormRow, { label: "ipushpull login:" },
|
|
52
|
+
React.createElement(Input, { width: "100%", type: "email", placeholder: "Email address", value: state.Login, onChange: onLoginChange })),
|
|
53
|
+
React.createElement(FormRow, { label: "ipushpull password:" },
|
|
54
|
+
React.createElement(Input, { width: "100%", type: "password", placeholder: "Password", value: state.Password, onChange: onPasswordChange })),
|
|
55
|
+
props.pushpullLoginErrorMessage ? (React.createElement(FormRow, { label: "" },
|
|
56
|
+
React.createElement(ErrorBox, null, props.pushpullLoginErrorMessage))) : null)))));
|
|
61
57
|
};
|
|
62
58
|
function mapStateToProps(state) {
|
|
63
59
|
return {
|
|
@@ -76,4 +72,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
76
72
|
},
|
|
77
73
|
};
|
|
78
74
|
}
|
|
79
|
-
|
|
75
|
+
export let IPushPullLoginPopup = connect(mapStateToProps, mapDispatchToProps)(IPushPullLoginComponent);
|
|
@@ -18,5 +18,5 @@ declare class IPushPullPopupComponent extends React.Component<IPushPullPopupProp
|
|
|
18
18
|
render(): JSX.Element;
|
|
19
19
|
onApplyExport(iPushPullReport: IPushPullReport): void;
|
|
20
20
|
}
|
|
21
|
-
export declare let IPushPullPopup: import("react-redux").ConnectedComponent<typeof IPushPullPopupComponent, import("react-redux").Omit<
|
|
21
|
+
export declare let IPushPullPopup: import("react-redux").ConnectedComponent<typeof IPushPullPopupComponent, import("react-redux").Omit<JSX.LibraryManagedAttributes<C, import("react-redux").GetProps<C>>, keyof IPushPullPopupProps>>;
|
|
22
22
|
export {};
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const IPushPullRedux = tslib_1.__importStar(require("../Redux/ActionReducers/IPushPullRedux"));
|
|
9
|
-
const TeamSharingRedux = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Redux/ActionsReducers/TeamSharingRedux"));
|
|
10
|
-
const ModuleConstants = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants"));
|
|
11
|
-
const UIHelper_1 = require("@adaptabletools/adaptable/src/View/UIHelper");
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { PanelWithButton } from '@adaptabletools/adaptable/src/View/Components/Panels/PanelWithButton';
|
|
4
|
+
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
5
|
+
import * as TeamSharingRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/TeamSharingRedux';
|
|
6
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
7
|
+
import { UIHelper } from '@adaptabletools/adaptable/src/View/UIHelper';
|
|
12
8
|
class IPushPullPopupComponent extends React.Component {
|
|
13
9
|
constructor(props) {
|
|
14
10
|
super(props);
|
|
15
11
|
this.shouldClosePopupOnFinishWizard = false;
|
|
16
|
-
this.state =
|
|
12
|
+
this.state = UIHelper.getEmptyConfigState();
|
|
17
13
|
}
|
|
18
14
|
componentDidMount() {
|
|
19
15
|
if (this.props.popupParams) {
|
|
@@ -22,7 +18,7 @@ class IPushPullPopupComponent extends React.Component {
|
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
render() {
|
|
25
|
-
return (React.createElement(
|
|
21
|
+
return (React.createElement(PanelWithButton, { headerText: this.props.moduleInfo.FriendlyName, bodyProps: { padding: 0 }, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed() }));
|
|
26
22
|
}
|
|
27
23
|
onApplyExport(iPushPullReport) {
|
|
28
24
|
this.props.onIPushPullSendSnapshot(iPushPullReport);
|
|
@@ -38,4 +34,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
38
34
|
onShare: (entity, config) => dispatch(TeamSharingRedux.TeamSharingShare(entity, ModuleConstants.IPushPullModuleId, config)),
|
|
39
35
|
};
|
|
40
36
|
}
|
|
41
|
-
|
|
37
|
+
export let IPushPullPopup = connect(mapStateToProps, mapDispatchToProps)(IPushPullPopupComponent);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ViewPanelProps } from '@adaptabletools/adaptable/src/View/Components/SharedProps/ViewPanelProps';
|
|
2
3
|
import { IPushPullDomain, IPushPullReport, IPushPullSchedule } from '@adaptabletools/adaptable/src/PredefinedConfig/IPushPullState';
|
|
3
4
|
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
@@ -24,4 +25,4 @@ export interface IPushPullViewPanelComponentProps extends ViewPanelProps {
|
|
|
24
25
|
onCurrentIPushPullFolderChange: (folder: string) => IPushPullRedux.IPushPullSetCurrentFolderAction;
|
|
25
26
|
onCurrentIPushPullPageChange: (page: string) => IPushPullRedux.IPushPullSetCurrentPageAction;
|
|
26
27
|
}
|
|
27
|
-
export declare const IPushPullViewPanelControl: import("react-redux").ConnectedComponent<(props: IPushPullViewPanelComponentProps) => JSX.Element, import("react-redux").Omit<
|
|
28
|
+
export declare const IPushPullViewPanelControl: import("react-redux").ConnectedComponent<(props: IPushPullViewPanelComponentProps) => JSX.Element, import("react-redux").Omit<JSX.LibraryManagedAttributes<C, import("react-redux").GetProps<C>>, keyof IPushPullViewPanelComponentProps>>;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const ButtonLogout_1 = require("@adaptabletools/adaptable/src/View/Components/Buttons/ButtonLogout");
|
|
20
|
-
const ButtonLogin_1 = require("@adaptabletools/adaptable/src/View/Components/Buttons/ButtonLogin");
|
|
21
|
-
const ModuleConstants = tslib_1.__importStar(require("@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants"));
|
|
22
|
-
const react_redux_1 = require("react-redux");
|
|
1
|
+
import * as IPushPullRedux from '../Redux/ActionReducers/IPushPullRedux';
|
|
2
|
+
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import ObjectFactory from '@adaptabletools/adaptable/src/Utilities/ObjectFactory';
|
|
5
|
+
import { StringExtensions } from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
6
|
+
import { Flex } from 'rebass';
|
|
7
|
+
import DropdownButton from '@adaptabletools/adaptable/src/components/DropdownButton';
|
|
8
|
+
import { ButtonExport } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonExport';
|
|
9
|
+
import { ButtonPause } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonPause';
|
|
10
|
+
import { ButtonPlay } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonPlay';
|
|
11
|
+
import join from '@adaptabletools/adaptable/src/components/utils/join';
|
|
12
|
+
import * as GeneralConstants from '@adaptabletools/adaptable/src/Utilities/Constants/GeneralConstants';
|
|
13
|
+
import { ButtonSchedule } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonSchedule';
|
|
14
|
+
import { ButtonNewPage } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonNewPage';
|
|
15
|
+
import { ButtonLogout } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonLogout';
|
|
16
|
+
import { ButtonLogin } from '@adaptabletools/adaptable/src/View/Components/Buttons/ButtonLogin';
|
|
17
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
18
|
+
import { connect } from 'react-redux';
|
|
23
19
|
const IPushPullViewPanelComponent = (props) => {
|
|
24
20
|
var _a, _b, _c, _d;
|
|
25
21
|
const [_, update] = React.useState(0);
|
|
@@ -50,7 +46,7 @@ const IPushPullViewPanelComponent = (props) => {
|
|
|
50
46
|
props.onIPushPullStartLiveData(createIPushPullReportFromState());
|
|
51
47
|
};
|
|
52
48
|
const onNewIPushPullSchedule = () => {
|
|
53
|
-
let iPushPullSchedule =
|
|
49
|
+
let iPushPullSchedule = ObjectFactory.CreateIPushPullSchedule(createIPushPullReportFromState());
|
|
54
50
|
props.onNewIPushPullSchedule(iPushPullSchedule);
|
|
55
51
|
};
|
|
56
52
|
// perhaps this should be props and in real state?
|
|
@@ -90,35 +86,35 @@ const IPushPullViewPanelComponent = (props) => {
|
|
|
90
86
|
})) !== null && _d !== void 0 ? _d : [];
|
|
91
87
|
// this is clearly ridiculous!
|
|
92
88
|
// im getting tired...
|
|
93
|
-
let isCompletedReport =
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
let isCompletedReport = StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullReportName) &&
|
|
90
|
+
StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullFolder) &&
|
|
91
|
+
StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullPage);
|
|
96
92
|
let isLiveIPushPullReport = isCompletedReport &&
|
|
97
93
|
props.CurrentLiveIPushPullReport &&
|
|
98
94
|
props.CurrentIPushPullReportName == props.CurrentLiveIPushPullReport.ReportName &&
|
|
99
95
|
props.CurrentIPushPullFolder == props.CurrentLiveIPushPullReport.Folder &&
|
|
100
96
|
props.CurrentIPushPullPage == props.CurrentLiveIPushPullReport.Page;
|
|
101
97
|
const elementType = props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
102
|
-
return props.IsIPushPullRunning ? (React.createElement(
|
|
103
|
-
React.createElement(
|
|
104
|
-
React.createElement(
|
|
98
|
+
return props.IsIPushPullRunning ? (React.createElement(Flex, { flexDirection: "row", className: `ab-${elementType}__IPushPull__wrap`, flexWrap: props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
|
|
99
|
+
React.createElement(Flex, null,
|
|
100
|
+
React.createElement(DropdownButton, { disabled: allReports.length == 0 || isLiveIPushPullReport, style: { minWidth: 140, fontSize: 'small' }, items: availableReports, columns: ['label'], className: `ab-${elementType}__IPushPull__select`, onClear: () => onSelectedReportChanged(''), showClearButton: StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullReportName), variant: "outlined", marginRight: 2 }, StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullReportName)
|
|
105
101
|
? props.CurrentIPushPullReportName
|
|
106
102
|
: 'Select Report')),
|
|
107
|
-
React.createElement(
|
|
108
|
-
React.createElement(
|
|
103
|
+
React.createElement(Flex, null,
|
|
104
|
+
React.createElement(DropdownButton, { disabled: allReports.length == 0 || isLiveIPushPullReport, style: { minWidth: 140, fontSize: 'small' }, items: availableFolders, columns: ['label'], className: `ab-${elementType}__IPushPull__select`, onClear: () => onFolderChanged(''), showClearButton: StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullFolder), variant: "outlined", marginRight: 2 }, StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullFolder)
|
|
109
105
|
? props.CurrentIPushPullFolder
|
|
110
106
|
: 'Select Folder')),
|
|
111
|
-
React.createElement(
|
|
112
|
-
React.createElement(
|
|
107
|
+
React.createElement(Flex, null,
|
|
108
|
+
React.createElement(DropdownButton, { disabled: allReports.length == 0 || isLiveIPushPullReport, style: { minWidth: 140, fontSize: 'small' }, items: availablePages, columns: ['label'], className: `ab-${elementType}__IPushPull__select`, onClear: () => onPageChanged(''), showClearButton: StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullPage), variant: "outlined", marginRight: 2 }, StringExtensions.IsNotNullOrEmpty(props.CurrentIPushPullPage)
|
|
113
109
|
? props.CurrentIPushPullPage
|
|
114
110
|
: 'Select Page')),
|
|
115
|
-
React.createElement(
|
|
116
|
-
React.createElement(
|
|
117
|
-
true ? (React.createElement(
|
|
118
|
-
isCompletedReport && (React.createElement(
|
|
111
|
+
React.createElement(Flex, { style: { minWidth: '148px' } },
|
|
112
|
+
React.createElement(ButtonExport, { marginLeft: 1, className: `ab-${elementType}__IPushPull__export`, onClick: () => onIPushPullSendSnapshot(), tooltip: "Send Snapshot to ipushpull", disabled: isLiveIPushPullReport || !isCompletedReport, accessLevel: props.accessLevel }),
|
|
113
|
+
true ? (React.createElement(ButtonPause, { fillColor: 'red', marginLeft: 1, className: `ab-${elementType}__IPushPull__pause`, onClick: () => props.onIPushPullStopLiveData(), tooltip: "Stop sync with ipushpull", disabled: !isLiveIPushPullReport, accessLevel: props.accessLevel })) : (React.createElement(ButtonPlay, { marginLeft: 1, className: `ab-${elementType}__IPushPull__play`, onClick: () => onIPushPullStartLiveData(), tooltip: "Start sync with ipushpull", disabled: isLiveIPushPullReport || !isCompletedReport, accessLevel: props.accessLevel })),
|
|
114
|
+
isCompletedReport && (React.createElement(Flex, { className: join(props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__IPushPull__controls`), alignItems: "stretch" }, props.api.internalApi.getEntitlementService().isModuleFullEntitlement('Schedule') && (React.createElement(ButtonSchedule, { marginLeft: 1, className: `ab-${elementType}__IPushPull__schedule`, onClick: () => onNewIPushPullSchedule(), tooltip: "Schedule", disabled: isLiveIPushPullReport || !isCompletedReport, accessLevel: props.accessLevel })))),
|
|
119
115
|
' ',
|
|
120
|
-
React.createElement(
|
|
121
|
-
React.createElement(
|
|
116
|
+
React.createElement(ButtonNewPage, { marginLeft: 1, className: `ab-${elementType}__IPushPull__newpage`, onClick: () => props.onShowAddIPushPullPage(), tooltip: "New Page", disabled: isLiveIPushPullReport, accessLevel: props.accessLevel }),
|
|
117
|
+
React.createElement(ButtonLogout, { marginLeft: 1, className: `ab-${elementType}__IPushPull__logout`, onClick: () => getIPPApi().logoutFromIPushPull(), tooltip: "Logout", disabled: isLiveIPushPullReport, accessLevel: props.accessLevel })))) : (React.createElement(ButtonLogin, { marginLeft: 1, className: `ab-${elementType}__IPushPull__login`, onClick: () => props.onShowIPushPullLogin(), tooltip: "Login to ipushpull", accessLevel: props.accessLevel },
|
|
122
118
|
' ',
|
|
123
119
|
"Login"));
|
|
124
120
|
};
|
|
@@ -155,4 +151,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
155
151
|
onCurrentIPushPullPageChange: (page) => dispatch(IPushPullRedux.IPushPullSetCurrentPage(page)),
|
|
156
152
|
};
|
|
157
153
|
}
|
|
158
|
-
|
|
154
|
+
export const IPushPullViewPanelControl = connect(mapStateToProps, mapDispatchToProps)(IPushPullViewPanelComponent);
|
package/src/env.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
1
|
+
export default {
|
|
4
2
|
IPUSHPULL_API_KEY: "CbBaMaoqHVifScrYwKssGnGyNkv5xHOhQVGm3cYP",
|
|
5
3
|
IPUSHPULL_API_SECRET: "xYzE51kuHyyt9kQCvMe0tz0H2sDSjyEQcF5SOBlPQmcL9em0NqcCzyqLYj5fhpuZxQ8BiVcYl6zoOHeI6GYZj1TkUiiLVFoW3HUxiCdEUjlPS8Vl2YHUMEPD5qkLYnGj",
|
|
6
4
|
};
|
package/src/index.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const IPushPullViewPanel_1 = require("./View/IPushPullViewPanel");
|
|
22
|
-
if (package_json_1.version !== version_1.default) {
|
|
1
|
+
import { AdaptablePlugin } from '@adaptabletools/adaptable/types';
|
|
2
|
+
import env from './env';
|
|
3
|
+
import { version, name } from '../package.json';
|
|
4
|
+
import { version as coreVersion } from '@adaptabletools/adaptable/package.json';
|
|
5
|
+
import * as ModuleConstants from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
6
|
+
import { IPushPullModuleId } from '@adaptabletools/adaptable/src/Utilities/Constants/ModuleConstants';
|
|
7
|
+
import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PopupRedux';
|
|
8
|
+
import { AdaptableViewFactory, AdaptableViewPanelFactory, } from '@adaptabletools/adaptable/src/View/AdaptableViewFactory';
|
|
9
|
+
import { PushPullModule } from './Module/PushPullModule';
|
|
10
|
+
import { IPushPullApiImpl } from './IPushPullApiImpl';
|
|
11
|
+
import { PushPullService } from './Utilities/Services/PushPullService';
|
|
12
|
+
import ipushpull from 'ipushpull-js';
|
|
13
|
+
import { iPushPullInitialState, IPushPullReducer, IPushPullSetCurrentAvailablePages, IPushPullSetCurrentPage, } from './Redux/ActionReducers/IPushPullRedux';
|
|
14
|
+
import { IPushPullLoginPopup } from './View/IPushPullLoginPopup';
|
|
15
|
+
import { IPushPullAddPagePopup } from './View/IPushPullAddPagePopup';
|
|
16
|
+
import { IPUSHPULL_ADD_PAGE, IPUSHPULL_DOMAIN_PAGES_SET, IPUSHPULL_LOGIN, IPUSHPULL_SEND_SNAPSHOT, IPUSHPULL_SET_CURRENT_FOLDER, IPUSHPULL_START_LIVE_DATA, IPUSHPULL_STOP_LIVE_DATA, } from '@adaptabletools/adaptable/src/Redux/ActionsReducers/PluginsRedux';
|
|
17
|
+
import StringExtensions from '@adaptabletools/adaptable/src/Utilities/Extensions/StringExtensions';
|
|
18
|
+
import { IPushPullViewPanelControl } from './View/IPushPullViewPanel';
|
|
19
|
+
const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
20
|
+
if (version !== coreVersion) {
|
|
23
21
|
console.warn(`
|
|
24
22
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
25
|
-
!!!!!!! "@adaptabletools/adaptable-plugin-ipushpull" (v @${
|
|
23
|
+
!!!!!!! "@adaptabletools/adaptable-plugin-ipushpull${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
|
|
26
24
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
27
25
|
`);
|
|
28
26
|
}
|
|
29
27
|
const getApiKey = () => {
|
|
30
|
-
let key =
|
|
28
|
+
let key = env.IPUSHPULL_API_KEY; // need to make sure that is always there
|
|
31
29
|
return key;
|
|
32
30
|
};
|
|
33
31
|
const getApiSecret = () => {
|
|
34
|
-
let secret =
|
|
32
|
+
let secret = env.IPUSHPULL_API_SECRET; // need to make sure that is always there
|
|
35
33
|
return secret;
|
|
36
34
|
};
|
|
37
35
|
const defaultOptions = {
|
|
@@ -50,7 +48,7 @@ const defaultOptions = {
|
|
|
50
48
|
throttleTime: 2000,
|
|
51
49
|
includeSystemReports: true,
|
|
52
50
|
};
|
|
53
|
-
class IPushPullPlugin extends
|
|
51
|
+
class IPushPullPlugin extends AdaptablePlugin {
|
|
54
52
|
constructor(options) {
|
|
55
53
|
super(options);
|
|
56
54
|
this.pluginId = 'ipushpull';
|
|
@@ -61,9 +59,9 @@ class IPushPullPlugin extends types_1.AdaptablePlugin {
|
|
|
61
59
|
if (!state) {
|
|
62
60
|
// required for store initialization
|
|
63
61
|
// (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,
|
|
62
|
+
augmentedState = Object.assign({}, augmentedState, iPushPullInitialState);
|
|
65
63
|
}
|
|
66
|
-
return
|
|
64
|
+
return IPushPullReducer(augmentedState, action);
|
|
67
65
|
},
|
|
68
66
|
};
|
|
69
67
|
};
|
|
@@ -71,57 +69,57 @@ class IPushPullPlugin extends types_1.AdaptablePlugin {
|
|
|
71
69
|
return (next) => {
|
|
72
70
|
return (action) => {
|
|
73
71
|
switch (action.type) {
|
|
74
|
-
case
|
|
72
|
+
case IPUSHPULL_LOGIN: {
|
|
75
73
|
const actionTyped = action;
|
|
76
74
|
this.iPushPullApi.loginToIPushPull(actionTyped.username, actionTyped.password);
|
|
77
75
|
return next(action);
|
|
78
76
|
}
|
|
79
|
-
case
|
|
77
|
+
case IPUSHPULL_SEND_SNAPSHOT: {
|
|
80
78
|
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
81
79
|
const actionTyped = action;
|
|
82
80
|
iPushPullModule.sendSnapshot(actionTyped.iPushPullReport);
|
|
83
81
|
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
84
82
|
return next(action);
|
|
85
83
|
}
|
|
86
|
-
case
|
|
84
|
+
case IPUSHPULL_START_LIVE_DATA: {
|
|
87
85
|
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
88
86
|
const actionTyped = action;
|
|
89
87
|
iPushPullModule.startLiveData(actionTyped.iPushPullReport);
|
|
90
88
|
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
91
89
|
return next(action);
|
|
92
90
|
}
|
|
93
|
-
case
|
|
91
|
+
case IPUSHPULL_STOP_LIVE_DATA: {
|
|
94
92
|
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
95
93
|
iPushPullModule.stopLiveData();
|
|
96
94
|
return next(action);
|
|
97
95
|
}
|
|
98
|
-
case
|
|
96
|
+
case IPUSHPULL_ADD_PAGE: {
|
|
99
97
|
const actionTyped = action;
|
|
100
98
|
this.iPushPullApi.addNewIPushPullPage(actionTyped.folder, actionTyped.page);
|
|
101
99
|
return next(action);
|
|
102
100
|
}
|
|
103
|
-
case
|
|
101
|
+
case IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
104
102
|
const actionTyped = action;
|
|
105
103
|
const currentFolder = actionTyped.folder;
|
|
106
|
-
const isFolderValid =
|
|
104
|
+
const isFolderValid = StringExtensions.IsNotNullOrEmpty(currentFolder);
|
|
107
105
|
const availablePages = isFolderValid
|
|
108
106
|
? adaptable.api.pluginsApi
|
|
109
107
|
.getipushpullPluginApi()
|
|
110
108
|
.getPagesForIPushPullDomain(currentFolder)
|
|
111
109
|
: [];
|
|
112
|
-
middlewareAPI.dispatch(
|
|
113
|
-
middlewareAPI.dispatch(
|
|
110
|
+
middlewareAPI.dispatch(IPushPullSetCurrentAvailablePages(availablePages));
|
|
111
|
+
middlewareAPI.dispatch(IPushPullSetCurrentPage(''));
|
|
114
112
|
return next(action);
|
|
115
113
|
}
|
|
116
|
-
case
|
|
114
|
+
case IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
117
115
|
//refresh the available pages
|
|
118
116
|
const currentFolder = middlewareAPI.getState().System.IPushPullCurrentFolder;
|
|
119
|
-
const isFolderValid =
|
|
117
|
+
const isFolderValid = StringExtensions.IsNotNullOrEmpty(currentFolder);
|
|
120
118
|
if (isFolderValid) {
|
|
121
119
|
const availablePages = adaptable.api.pluginsApi
|
|
122
120
|
.getipushpullPluginApi()
|
|
123
121
|
.getPagesForIPushPullDomain(currentFolder);
|
|
124
|
-
middlewareAPI.dispatch(
|
|
122
|
+
middlewareAPI.dispatch(IPushPullSetCurrentAvailablePages(availablePages));
|
|
125
123
|
}
|
|
126
124
|
return next(action);
|
|
127
125
|
}
|
|
@@ -146,20 +144,20 @@ class IPushPullPlugin extends types_1.AdaptablePlugin {
|
|
|
146
144
|
* Includes ipushpull config and objects and, optionally, any ipushpull Reports (including schedules).
|
|
147
145
|
*/
|
|
148
146
|
// IPushPull?: IPushPullState;
|
|
149
|
-
|
|
147
|
+
ipushpull.config.set(this.options.ippConfig);
|
|
150
148
|
}
|
|
151
149
|
afterInitApi(adaptable) {
|
|
152
|
-
this.iPushPullApi = new
|
|
153
|
-
this.PushPullService = new
|
|
154
|
-
this.iPushPullApi.setIPushPullInstance(
|
|
150
|
+
this.iPushPullApi = new IPushPullApiImpl(adaptable, this.options);
|
|
151
|
+
this.PushPullService = new PushPullService(adaptable);
|
|
152
|
+
this.iPushPullApi.setIPushPullInstance(ipushpull);
|
|
155
153
|
this.registerProperty('api', () => this.iPushPullApi);
|
|
156
154
|
this.registerProperty('service', () => this.PushPullService);
|
|
157
155
|
}
|
|
158
156
|
afterInitModules(adaptable, modules) {
|
|
159
|
-
modules.set(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
modules.set(IPushPullModuleId, new PushPullModule(adaptable.api));
|
|
158
|
+
AdaptableViewFactory.IPushPullLoginPopup = IPushPullLoginPopup;
|
|
159
|
+
AdaptableViewFactory.IPushPullAddPagePopup = IPushPullAddPagePopup;
|
|
160
|
+
AdaptableViewPanelFactory.set(IPushPullModuleId, IPushPullViewPanelControl);
|
|
163
161
|
}
|
|
164
162
|
}
|
|
165
|
-
|
|
163
|
+
export default (options) => new IPushPullPlugin(options);
|