@sankhyalabs/sankhyablocks 3.4.0 → 3.4.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/dist/cjs/{ConfigStorage-8b5e3261.js → ConfigStorage-cfac5a0b.js} +184 -36
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -111
- package/dist/cjs/snk-configurator_3.cjs.entry.js +9 -8
- package/dist/cjs/snk-data-exporter_8.cjs.entry.js +23 -33
- package/dist/cjs/snk-form-config.cjs.entry.js +3 -5
- package/dist/cjs/snk-form.cjs.entry.js +10 -12
- package/dist/collection/components/snk-application/snk-application.js +2 -129
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +15 -12
- package/dist/collection/components/snk-form/snk-form.js +9 -11
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +2 -4
- package/dist/collection/components/snk-grid/snk-grid.js +8 -7
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +23 -45
- package/dist/collection/lib/configs/ConfigStorage.js +22 -12
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +49 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +8 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +23 -18
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +11 -5
- package/dist/collection/lib/http/data-fetcher/interfaces/IClientEventResponse.js +1 -0
- package/dist/collection/lib/http/data-fetcher/recaller/DataFetcherRecaller.js +14 -0
- package/dist/components/ConfigStorage.js +123 -35
- package/dist/components/DataFetcher.js +62 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/snk-application2.js +0 -113
- package/dist/components/snk-filter-bar2.js +15 -12
- package/dist/components/snk-form-config2.js +2 -4
- package/dist/components/snk-form2.js +9 -11
- package/dist/components/snk-grid-config.js +2 -2
- package/dist/components/snk-grid-config2.js +9 -21
- package/dist/components/snk-grid2.js +8 -7
- package/dist/esm/{ConfigStorage-4654f57b.js → ConfigStorage-77bd9902.js} +185 -37
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -111
- package/dist/esm/snk-configurator_3.entry.js +9 -8
- package/dist/esm/snk-data-exporter_8.entry.js +23 -33
- package/dist/esm/snk-form-config.entry.js +3 -5
- package/dist/esm/snk-form.entry.js +10 -12
- package/dist/sankhyablocks/p-032e1308.entry.js +1 -0
- package/dist/sankhyablocks/{p-e906ba66.entry.js → p-32f9dc8a.entry.js} +5 -5
- package/dist/sankhyablocks/p-43c135c4.entry.js +1 -0
- package/dist/sankhyablocks/{p-f559c71a.entry.js → p-705b7671.entry.js} +1 -1
- package/dist/sankhyablocks/{p-93d8ea09.js → p-bbd0cf7a.js} +6 -6
- package/dist/sankhyablocks/p-db6d6b59.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -16
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +2 -2
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +5 -5
- package/dist/types/components.d.ts +8 -16
- package/dist/types/lib/configs/ConfigStorage.d.ts +7 -2
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -1
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +5 -1
- package/dist/types/lib/http/data-fetcher/interfaces/IClientEventResponse.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/recaller/DataFetcherRecaller.d.ts +7 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-125c2d01.entry.js +0 -1
- package/dist/sankhyablocks/p-a2ea13ed.entry.js +0 -1
- package/dist/sankhyablocks/p-b326cf51.entry.js +0 -1
package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CheckMode } from '@sankhyalabs/ezui/dist/collection/components/ez-check
|
|
|
4
4
|
import { h, Host } from '@stencil/core';
|
|
5
5
|
import { ConfigStorage } from '../../../../lib/configs/ConfigStorage';
|
|
6
6
|
import { ORDER_VALUES } from '../../../../lib/utils/constants';
|
|
7
|
-
export class
|
|
7
|
+
export class SnkGridConfig {
|
|
8
8
|
constructor() {
|
|
9
9
|
this._orderListItems = [];
|
|
10
10
|
this._orderPriorityList = [];
|
|
@@ -16,24 +16,9 @@ export class EzGridConfig {
|
|
|
16
16
|
this.application = undefined;
|
|
17
17
|
this.columns = undefined;
|
|
18
18
|
this.config = undefined;
|
|
19
|
+
this.configName = undefined;
|
|
19
20
|
}
|
|
20
21
|
/* Creation Methods */
|
|
21
|
-
/**
|
|
22
|
-
* Salva as configurações da grade.
|
|
23
|
-
*/
|
|
24
|
-
async saveConfig(config) {
|
|
25
|
-
var _a;
|
|
26
|
-
if (config == undefined || ((_a = this.application) === null || _a === void 0 ? void 0 : _a.configName) == undefined) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
ConfigStorage.saveGridConfig(config, this.application.configName)
|
|
30
|
-
.then((response) => {
|
|
31
|
-
if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
|
|
32
|
-
this.configChange.emit(config);
|
|
33
|
-
this._orderList.clearHistory();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
22
|
/**
|
|
38
23
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
39
24
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -255,8 +240,11 @@ export class EzGridConfig {
|
|
|
255
240
|
}
|
|
256
241
|
}
|
|
257
242
|
_newConfig.columns = _newColumnConfigList;
|
|
258
|
-
|
|
243
|
+
ConfigStorage.saveGridConfig(_newConfig, this.configName)
|
|
244
|
+
.then((response) => {
|
|
259
245
|
ApplicationUtils.info(this.getMessage("snkGridConfig.info.successfullyConfigSaved"), { iconName: "check" });
|
|
246
|
+
this.configChange.emit(response);
|
|
247
|
+
this._orderList.clearHistory();
|
|
260
248
|
});
|
|
261
249
|
function adjustPriorityOrder(column, _newColumnConfig) {
|
|
262
250
|
if (orderArray) {
|
|
@@ -564,6 +552,23 @@ export class EzGridConfig {
|
|
|
564
552
|
"tags": [],
|
|
565
553
|
"text": "Configura\u00E7\u00F5es da grade."
|
|
566
554
|
}
|
|
555
|
+
},
|
|
556
|
+
"configName": {
|
|
557
|
+
"type": "string",
|
|
558
|
+
"mutable": false,
|
|
559
|
+
"complexType": {
|
|
560
|
+
"original": "string",
|
|
561
|
+
"resolved": "string",
|
|
562
|
+
"references": {}
|
|
563
|
+
},
|
|
564
|
+
"required": false,
|
|
565
|
+
"optional": false,
|
|
566
|
+
"docs": {
|
|
567
|
+
"tags": [],
|
|
568
|
+
"text": "Nome usado para salvar/recuperar a configura\u00E7\u00E3o."
|
|
569
|
+
},
|
|
570
|
+
"attribute": "config-name",
|
|
571
|
+
"reflect": false
|
|
567
572
|
}
|
|
568
573
|
};
|
|
569
574
|
}
|
|
@@ -605,32 +610,5 @@ export class EzGridConfig {
|
|
|
605
610
|
}
|
|
606
611
|
}];
|
|
607
612
|
}
|
|
608
|
-
static get methods() {
|
|
609
|
-
return {
|
|
610
|
-
"saveConfig": {
|
|
611
|
-
"complexType": {
|
|
612
|
-
"signature": "(config: IGridConfig) => Promise<void>",
|
|
613
|
-
"parameters": [{
|
|
614
|
-
"tags": [],
|
|
615
|
-
"text": ""
|
|
616
|
-
}],
|
|
617
|
-
"references": {
|
|
618
|
-
"Promise": {
|
|
619
|
-
"location": "global"
|
|
620
|
-
},
|
|
621
|
-
"IGridConfig": {
|
|
622
|
-
"location": "import",
|
|
623
|
-
"path": "@sankhyalabs/ezui/dist/types/components/ez-grid/controller/EzGridController"
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
"return": "Promise<void>"
|
|
627
|
-
},
|
|
628
|
-
"docs": {
|
|
629
|
-
"text": "Salva as configura\u00E7\u00F5es da grade.",
|
|
630
|
-
"tags": []
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
613
|
static get elementRef() { return "_element"; }
|
|
636
614
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ApplicationContext } from "@sankhyalabs/core";
|
|
2
2
|
import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fetcher";
|
|
3
3
|
import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
|
|
4
|
+
import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
|
|
4
5
|
const CONFIG_SOURCE = {
|
|
5
6
|
form: "form",
|
|
6
|
-
grid: "grid"
|
|
7
|
+
grid: "grid",
|
|
8
|
+
filterBar: "filterBar"
|
|
7
9
|
};
|
|
8
10
|
export class ConfigStorage {
|
|
9
11
|
static async get() {
|
|
@@ -14,16 +16,21 @@ export class ConfigStorage {
|
|
|
14
16
|
const resourceID = await application.getResourceID();
|
|
15
17
|
ConfigStorage.instance = new ConfigStorage();
|
|
16
18
|
ConfigStorage.resourceID = resourceID;
|
|
19
|
+
ConfigStorage.instance.loadFilterBarConfig(configName);
|
|
17
20
|
ConfigStorage.instance.loadFormConfig(configName);
|
|
18
21
|
ConfigStorage.instance.loadGridConfig(configName);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
return this.instance;
|
|
22
25
|
}
|
|
23
|
-
async
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
async loadFilterBarConfig(name) {
|
|
27
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
|
28
|
+
if (!ConfigStorage.configById.has(cacheID)) {
|
|
29
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name));
|
|
26
30
|
}
|
|
31
|
+
return ConfigStorage.configById.get(cacheID);
|
|
32
|
+
}
|
|
33
|
+
async loadFormConfig(name) {
|
|
27
34
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
|
|
28
35
|
if (!ConfigStorage.configById.has(cacheID)) {
|
|
29
36
|
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
|
|
@@ -31,35 +38,38 @@ export class ConfigStorage {
|
|
|
31
38
|
return ConfigStorage.configById.get(cacheID);
|
|
32
39
|
}
|
|
33
40
|
async loadGridConfig(name) {
|
|
34
|
-
if (name == undefined) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
41
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
|
|
38
42
|
if (!ConfigStorage.configById.has(cacheID)) {
|
|
39
43
|
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
|
|
40
44
|
}
|
|
41
45
|
return ConfigStorage.configById.get(cacheID);
|
|
42
46
|
}
|
|
47
|
+
static async saveFilterBarConfig(config, name) {
|
|
48
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
|
49
|
+
this.configById.delete(cacheID);
|
|
50
|
+
return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
|
|
51
|
+
}
|
|
43
52
|
static async saveFormConfig(config, name) {
|
|
44
|
-
if (config == undefined || name == undefined) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
53
|
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
|
|
48
54
|
this.configById.delete(cacheID);
|
|
49
55
|
return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
|
|
50
56
|
}
|
|
51
57
|
static async saveGridConfig(config, name) {
|
|
52
|
-
if (config == undefined
|
|
58
|
+
if (config == undefined) {
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
61
|
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
|
|
56
62
|
this.configById.delete(cacheID);
|
|
57
|
-
return this.gridConfigFetcher.saveConfig(config, this.resourceID);
|
|
63
|
+
return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
|
|
58
64
|
}
|
|
59
65
|
static buildCacheID(name, source) {
|
|
66
|
+
if (name == undefined) {
|
|
67
|
+
return `req_${source}_${this.resourceID}`;
|
|
68
|
+
}
|
|
60
69
|
return `req_${source}_${name}_${this.resourceID}`;
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
ConfigStorage.configById = new Map();
|
|
73
|
+
ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
|
|
64
74
|
ConfigStorage.formConfigFetcher = new FormConfigFetcher();
|
|
65
75
|
ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ErrorException, WarningException } from '@sankhyalabs/core';
|
|
1
|
+
import { ErrorException, ObjectUtils, WarningException } from '@sankhyalabs/core';
|
|
2
2
|
import { batchRequests } from 'graphql-request';
|
|
3
3
|
import UrlUtils from "../../../lib/utils/urlutils";
|
|
4
4
|
import { StringUtils } from '@sankhyalabs/core';
|
|
5
|
+
import { DataFetcherRecaller } from './recaller/DataFetcherRecaller';
|
|
5
6
|
export class DataFetcher {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.GRAPHQL_PATH = "/mge/graphql";
|
|
@@ -101,14 +102,44 @@ export class DataFetcher {
|
|
|
101
102
|
const url = `${ctx.baseUrl}?serviceName=${name}&counter=21&application=${ctx.appName}&outputType=json&preventTransform=false&mgeSession=${ctx.mgeSession}&resourceID=${ctx.resourceID}&globalID=${ctx.globalID}&allowConcurrentCalls=true`;
|
|
102
103
|
document.cookie = `JSESSIONID=${ctx.mgeSession};`;
|
|
103
104
|
const http = new XMLHttpRequest();
|
|
105
|
+
var payloadJson = {};
|
|
106
|
+
if ('string' == typeof payload) {
|
|
107
|
+
payload = ObjectUtils.stringToObject(payload);
|
|
108
|
+
}
|
|
109
|
+
if (!payload.hasOwnProperty('requestBody')) {
|
|
110
|
+
payloadJson['requestBody'] = payload;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
payloadJson = payload;
|
|
114
|
+
}
|
|
115
|
+
for (let [key] of DataFetcher.clientEventsByID) {
|
|
116
|
+
if (!payloadJson['requestBody'].hasOwnProperty('clientEventList')) {
|
|
117
|
+
payloadJson['requestBody']['clientEventList'] = {
|
|
118
|
+
clientEvent: []
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
|
|
122
|
+
}
|
|
104
123
|
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
|
|
105
124
|
http.open("POST", url, true);
|
|
106
125
|
http.withCredentials = true;
|
|
107
|
-
http.send(
|
|
126
|
+
http.send(ObjectUtils.objectToString(payloadJson));
|
|
108
127
|
http.onreadystatechange = function () {
|
|
109
128
|
if (this.readyState == 4 && this.status == 200) {
|
|
110
129
|
try {
|
|
111
130
|
const jsonResp = JSON.parse(this.responseText);
|
|
131
|
+
if (jsonResp.hasOwnProperty('clientEvents')) {
|
|
132
|
+
jsonResp.clientEvents.forEach(clientEvent => {
|
|
133
|
+
if (DataFetcher.hasClientEvent(clientEvent.id)) {
|
|
134
|
+
var handlers = DataFetcher.clientEventsByID.get(clientEvent.id);
|
|
135
|
+
handlers.forEach(handler => {
|
|
136
|
+
handler({ id: clientEvent.id, content: clientEvent }, new DataFetcherRecaller(serviceName, payloadJson, accept));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (jsonResp.status == 4)
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
112
143
|
if (jsonResp.status == 1) {
|
|
113
144
|
accept(jsonResp.responseBody);
|
|
114
145
|
}
|
|
@@ -231,9 +262,25 @@ export class DataFetcher {
|
|
|
231
262
|
error.index = Number(requestIndex);
|
|
232
263
|
return error;
|
|
233
264
|
}
|
|
265
|
+
static addClientEvent(eventID, handler) {
|
|
266
|
+
let clientEvent = DataFetcher.clientEventsByID.get(eventID);
|
|
267
|
+
if (clientEvent != undefined) {
|
|
268
|
+
clientEvent.push(handler);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
DataFetcher.clientEventsByID.set(eventID, [handler]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
static hasClientEvent(eventID) {
|
|
275
|
+
return DataFetcher.clientEventsByID.has(eventID);
|
|
276
|
+
}
|
|
277
|
+
static removeClientEvent(eventID) {
|
|
278
|
+
return DataFetcher.clientEventsByID.delete(eventID);
|
|
279
|
+
}
|
|
234
280
|
}
|
|
235
281
|
DataFetcher.appTagName = "snk-application";
|
|
236
282
|
DataFetcher.requestListener = [];
|
|
283
|
+
DataFetcher.clientEventsByID = new Map();
|
|
237
284
|
class WaitingRequest {
|
|
238
285
|
constructor(req) {
|
|
239
286
|
this._resolve = () => { };
|
|
@@ -41,11 +41,11 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
|
|
|
41
41
|
}
|
|
42
42
|
return stateItem;
|
|
43
43
|
});
|
|
44
|
-
return this.saveResource(state,
|
|
44
|
+
return this.saveResource(state, this.getPath(resourceID, configName));
|
|
45
45
|
}
|
|
46
46
|
getConfig(resourceID, configName) {
|
|
47
47
|
return new Promise((accept, reject) => {
|
|
48
|
-
this.loadResource(
|
|
48
|
+
this.loadResource(this.getPath(resourceID, configName))
|
|
49
49
|
.then((configAsString) => {
|
|
50
50
|
let fieldsList;
|
|
51
51
|
if (configAsString) {
|
|
@@ -59,4 +59,10 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
|
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
getPath(resourceID, name) {
|
|
63
|
+
if (name) {
|
|
64
|
+
return `cfg://filter/FilterBarState:${resourceID}/${name}`;
|
|
65
|
+
}
|
|
66
|
+
return `cfg://filter/FilterBarState:${resourceID}`;
|
|
67
|
+
}
|
|
62
68
|
}
|
|
@@ -31,15 +31,17 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
31
31
|
}
|
|
32
32
|
loadFormConfig(formName, resourceID) {
|
|
33
33
|
return new Promise((accept, reject) => {
|
|
34
|
-
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
34
|
+
Promise.all([
|
|
35
|
+
this.loadResource(this.getPath(resourceID, formName))
|
|
36
|
+
])
|
|
37
|
+
.then(([configAsString]) => {
|
|
38
|
+
const config = configAsString ? JSON.parse(configAsString) : {};
|
|
39
|
+
const { tabs, fields } = config;
|
|
40
|
+
if (tabs) {
|
|
41
|
+
const allTabs = new Map(tabs.map(t => [t.label, t]));
|
|
42
|
+
fields === null || fields === void 0 ? void 0 : fields.forEach(f => { var _a; return f.tab = ((_a = allTabs.get(this.getTabName(f.tab))) === null || _a === void 0 ? void 0 : _a.label) || allTabs.get(this.getTabName(f.tab)); });
|
|
43
|
+
}
|
|
44
|
+
if (fields) {
|
|
43
45
|
config.fields = fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
44
46
|
if ("readonly" in field) {
|
|
45
47
|
const readOnly = field['readonly'] === true;
|
|
@@ -48,11 +50,8 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
48
50
|
}
|
|
49
51
|
return field;
|
|
50
52
|
});
|
|
51
|
-
accept(config);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
reject(`Sem configuração pro formulário "${formName}".`);
|
|
55
53
|
}
|
|
54
|
+
accept(config);
|
|
56
55
|
})
|
|
57
56
|
.catch((error) => {
|
|
58
57
|
reject(error);
|
|
@@ -66,11 +65,11 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
66
65
|
return tab; //string type
|
|
67
66
|
}
|
|
68
67
|
saveConfig(config, formName, resourceID) {
|
|
69
|
-
const completePath =
|
|
68
|
+
const completePath = this.getPath(resourceID, formName);
|
|
70
69
|
return new Promise((resolve, reject) => {
|
|
71
70
|
this.saveResource(config, completePath)
|
|
72
71
|
.then((resp) => {
|
|
73
|
-
resolve(resp);
|
|
72
|
+
resolve(JSON.parse(resp.resource));
|
|
74
73
|
})
|
|
75
74
|
.catch((error) => {
|
|
76
75
|
reject(error);
|
|
@@ -78,7 +77,7 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
fetchUserAvailableConfigs(formName, resourceID) {
|
|
81
|
-
const name =
|
|
80
|
+
const name = this.getPath(resourceID, formName);
|
|
82
81
|
return new Promise((resolve, reject) => {
|
|
83
82
|
DataFetcher.get()
|
|
84
83
|
.callGraphQL({
|
|
@@ -94,7 +93,7 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
94
93
|
});
|
|
95
94
|
}
|
|
96
95
|
fetchLegacyConfig(formName, resourceID) {
|
|
97
|
-
const name =
|
|
96
|
+
const name = this.getPath(resourceID, formName);
|
|
98
97
|
return new Promise((resolve, reject) => {
|
|
99
98
|
DataFetcher.get()
|
|
100
99
|
.callGraphQL({
|
|
@@ -110,7 +109,7 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
110
109
|
});
|
|
111
110
|
}
|
|
112
111
|
fetchDefaultConfig(formName, resourceID) {
|
|
113
|
-
const name =
|
|
112
|
+
const name = this.getPath(resourceID, formName);
|
|
114
113
|
return new Promise((resolve, reject) => {
|
|
115
114
|
DataFetcher.get()
|
|
116
115
|
.callGraphQL({
|
|
@@ -125,6 +124,12 @@ export class FormConfigFetcher extends ResourceFetcher {
|
|
|
125
124
|
});
|
|
126
125
|
});
|
|
127
126
|
}
|
|
127
|
+
getPath(resourceID, name, authority = "form") {
|
|
128
|
+
if (name) {
|
|
129
|
+
return `cfg://${authority}/${resourceID}/${name}`;
|
|
130
|
+
}
|
|
131
|
+
return `cfg://${authority}/${resourceID}`;
|
|
132
|
+
}
|
|
128
133
|
}
|
|
129
134
|
export var UserConfigType;
|
|
130
135
|
(function (UserConfigType) {
|
|
@@ -4,8 +4,8 @@ export default class GridConfigFetcher extends ResourceFetcher {
|
|
|
4
4
|
super(...arguments);
|
|
5
5
|
this.GRID_CONFIG_VERSION = "V3:";
|
|
6
6
|
}
|
|
7
|
-
getConfig(
|
|
8
|
-
const completePath =
|
|
7
|
+
getConfig(gridName, resourceID) {
|
|
8
|
+
const completePath = this.getPath(resourceID, gridName);
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
this.loadResource(completePath)
|
|
11
11
|
.then(loadedResource => {
|
|
@@ -19,16 +19,22 @@ export default class GridConfigFetcher extends ResourceFetcher {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
saveConfig(config, resourceID) {
|
|
23
|
-
const completePath =
|
|
22
|
+
saveConfig(config, gridName, resourceID) {
|
|
23
|
+
const completePath = this.getPath(resourceID, gridName);
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
25
|
this.saveResource(config, completePath)
|
|
26
26
|
.then((resp) => {
|
|
27
|
-
resolve(resp);
|
|
27
|
+
resolve(JSON.parse(resp.resource));
|
|
28
28
|
})
|
|
29
29
|
.catch((error) => {
|
|
30
30
|
reject(error);
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
getPath(resourceID, name) {
|
|
35
|
+
if (name) {
|
|
36
|
+
return `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}/${name}`;
|
|
37
|
+
}
|
|
38
|
+
return `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
|
|
39
|
+
}
|
|
34
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataFetcher } from "../DataFetcher";
|
|
2
|
+
export class DataFetcherRecaller {
|
|
3
|
+
constructor(serviceName, requestBody, callback) {
|
|
4
|
+
this.serviceName = serviceName;
|
|
5
|
+
this.requestBody = requestBody;
|
|
6
|
+
this.callback = callback;
|
|
7
|
+
}
|
|
8
|
+
reCall(requestBody) {
|
|
9
|
+
if (requestBody) {
|
|
10
|
+
this.requestBody = requestBody;
|
|
11
|
+
}
|
|
12
|
+
DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody);
|
|
13
|
+
}
|
|
14
|
+
}
|