@adaptabletools/adaptable-plugin-ipushpull-cjs 22.0.0-canary.1 → 22.0.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
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() {
|
|
@@ -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(() => {
|
|
@@ -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
|
|
@@ -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 =
|
package/src/index.js
CHANGED
|
@@ -54,87 +54,11 @@ const defaultOptions = {
|
|
|
54
54
|
includeSystemReports: true,
|
|
55
55
|
};
|
|
56
56
|
class IPushPullPlugin extends types_1.AdaptablePlugin {
|
|
57
|
+
pluginId = 'ipushpull';
|
|
58
|
+
iPushPullApi;
|
|
59
|
+
PushPullService;
|
|
57
60
|
constructor(options) {
|
|
58
61
|
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
62
|
const ippConfig = {
|
|
139
63
|
...defaultOptions.ippConfig,
|
|
140
64
|
...(options || {}).ippConfig,
|
|
@@ -165,6 +89,84 @@ class IPushPullPlugin extends types_1.AdaptablePlugin {
|
|
|
165
89
|
this.registerProperty('api', () => this.iPushPullApi);
|
|
166
90
|
this.registerProperty('service', () => this.PushPullService);
|
|
167
91
|
}
|
|
92
|
+
rootReducer = (rootReducer) => {
|
|
93
|
+
return {
|
|
94
|
+
System: (state, action) => {
|
|
95
|
+
let augmentedState = rootReducer.System(state, action);
|
|
96
|
+
if (!state) {
|
|
97
|
+
// required for store initialization
|
|
98
|
+
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
99
|
+
augmentedState = Object.assign({}, augmentedState, IPushPullRedux_1.iPushPullInitialState);
|
|
100
|
+
}
|
|
101
|
+
return (0, IPushPullRedux_1.IPushPullReducer)(augmentedState, action);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
reduxMiddleware = (adaptable) => (middlewareAPI) => {
|
|
106
|
+
return (next) => {
|
|
107
|
+
return (action) => {
|
|
108
|
+
switch (action.type) {
|
|
109
|
+
case PluginsRedux_1.IPUSHPULL_LOGIN: {
|
|
110
|
+
const actionTyped = action;
|
|
111
|
+
this.iPushPullApi.loginToIPushPull(actionTyped.username, actionTyped.password);
|
|
112
|
+
return next(action);
|
|
113
|
+
}
|
|
114
|
+
case PluginsRedux_1.IPUSHPULL_SEND_SNAPSHOT: {
|
|
115
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
116
|
+
const actionTyped = action;
|
|
117
|
+
iPushPullModule.sendSnapshot(actionTyped.iPushPullReport);
|
|
118
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
119
|
+
return next(action);
|
|
120
|
+
}
|
|
121
|
+
case PluginsRedux_1.IPUSHPULL_START_LIVE_DATA: {
|
|
122
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
123
|
+
const actionTyped = action;
|
|
124
|
+
iPushPullModule.startLiveData(actionTyped.iPushPullReport);
|
|
125
|
+
middlewareAPI.dispatch(PopupRedux.PopupHideScreen());
|
|
126
|
+
return next(action);
|
|
127
|
+
}
|
|
128
|
+
case PluginsRedux_1.IPUSHPULL_STOP_LIVE_DATA: {
|
|
129
|
+
let iPushPullModule = (adaptable.adaptableModules.get(ModuleConstants.IPushPullModuleId));
|
|
130
|
+
iPushPullModule.stopLiveData();
|
|
131
|
+
return next(action);
|
|
132
|
+
}
|
|
133
|
+
case PluginsRedux_1.IPUSHPULL_ADD_PAGE: {
|
|
134
|
+
const actionTyped = action;
|
|
135
|
+
this.iPushPullApi.addNewIPushPullPage(actionTyped.folder, actionTyped.page);
|
|
136
|
+
return next(action);
|
|
137
|
+
}
|
|
138
|
+
case PluginsRedux_1.IPUSHPULL_SET_CURRENT_FOLDER: {
|
|
139
|
+
const actionTyped = action;
|
|
140
|
+
const currentFolder = actionTyped.folder;
|
|
141
|
+
const isFolderValid = StringExtensions_1.default.IsNotNullOrEmpty(currentFolder);
|
|
142
|
+
const availablePages = isFolderValid
|
|
143
|
+
? adaptable.api.pluginsApi
|
|
144
|
+
.getipushpullPluginApi()
|
|
145
|
+
.getPagesForIPushPullDomain(currentFolder)
|
|
146
|
+
: [];
|
|
147
|
+
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentAvailablePages)(availablePages));
|
|
148
|
+
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentPage)(''));
|
|
149
|
+
return next(action);
|
|
150
|
+
}
|
|
151
|
+
case PluginsRedux_1.IPUSHPULL_DOMAIN_PAGES_SET: {
|
|
152
|
+
//refresh the available pages
|
|
153
|
+
const currentFolder = middlewareAPI.getState().Internal.IPushPullCurrentFolder;
|
|
154
|
+
const isFolderValid = StringExtensions_1.default.IsNotNullOrEmpty(currentFolder);
|
|
155
|
+
if (isFolderValid) {
|
|
156
|
+
const availablePages = adaptable.api.pluginsApi
|
|
157
|
+
.getipushpullPluginApi()
|
|
158
|
+
.getPagesForIPushPullDomain(currentFolder);
|
|
159
|
+
middlewareAPI.dispatch((0, IPushPullRedux_1.IPushPullSetCurrentAvailablePages)(availablePages));
|
|
160
|
+
}
|
|
161
|
+
return next(action);
|
|
162
|
+
}
|
|
163
|
+
default: {
|
|
164
|
+
return next(action);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
168
170
|
afterInitStore(adaptable) {
|
|
169
171
|
adaptable.adaptableModules.set(ModuleConstants_1.IPushPullModuleId, new PushPullModule_1.PushPullModule(adaptable.api));
|
|
170
172
|
AdaptableViewFactory_1.AdaptableViewFactory.IPushPullLoginPopup = IPushPullLoginPopup_1.IPushPullLoginPopup;
|