@hpcc-js/ddl-shim 2.18.1 → 2.20.0
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/LICENSE +43 -43
- package/dist/cli.js +994 -994
- package/dist/cli.js.map +1 -1
- package/dist/index.es6.js +1017 -1017
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +1017 -1017
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +7 -7
- package/src/__package__.ts +2 -2
- package/src/cli.ts +60 -60
- package/src/ddl/v0_0_22.ts +344 -344
- package/src/ddl/v1.ts +313 -313
- package/src/ddl/v2.ts +426 -426
- package/src/ddl/v2_0_23.ts +395 -395
- package/src/ddl/v2_1_0.ts +406 -406
- package/src/dermatology.ts +229 -229
- package/src/index.ts +11 -11
- package/src/upgrade.ts +734 -734
- package/src/validate.ts +39 -39
- package/types/__package__.d.ts +3 -3
- package/types/cli.d.ts +1 -1
- package/types/ddl/v0_0_22.d.ts +270 -270
- package/types/ddl/v1.d.ts +234 -234
- package/types/ddl/v2.d.ts +338 -338
- package/types/ddl/v2_0_23.d.ts +314 -314
- package/types/ddl/v2_1_0.d.ts +321 -321
- package/types/dermatology.d.ts +10 -10
- package/types/index.d.ts +7 -7
- package/types/upgrade.d.ts +3 -3
- package/types/validate.d.ts +7 -7
package/dist/index.js
CHANGED
|
@@ -19,51 +19,51 @@
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
var PKG_NAME = "@hpcc-js/ddl-shim";
|
|
23
|
-
var PKG_VERSION = "2.
|
|
24
|
-
var BUILD_VERSION = "2.
|
|
25
|
-
|
|
26
|
-
function isWorkunitDatasource(ref) {
|
|
27
|
-
return ref.WUID !== undefined;
|
|
28
|
-
}
|
|
29
|
-
function isDatabombDatasource(ref) {
|
|
30
|
-
return ref.databomb === true;
|
|
31
|
-
}
|
|
32
|
-
function isHipieDatasource(ref) {
|
|
33
|
-
return ref.URL !== undefined;
|
|
34
|
-
}
|
|
35
|
-
function isPieVisualization(viz) {
|
|
36
|
-
return viz.type === "PIE" || viz.type === "BAR";
|
|
37
|
-
}
|
|
38
|
-
function isLineVisualization(viz) {
|
|
39
|
-
return viz.type === "LINE";
|
|
40
|
-
}
|
|
41
|
-
function isChoroVisualization(viz) {
|
|
42
|
-
return viz.type === "CHORO";
|
|
43
|
-
}
|
|
44
|
-
function isTableVisualization(viz) {
|
|
45
|
-
return viz.type === "TABLE";
|
|
46
|
-
}
|
|
47
|
-
function isSliderVisualization(viz) {
|
|
48
|
-
return viz.type === "SLIDER";
|
|
49
|
-
}
|
|
50
|
-
function isGraphVisualization(viz) {
|
|
51
|
-
return viz.type === "GRAPH";
|
|
52
|
-
}
|
|
53
|
-
function isHeatMapVisualization(viz) {
|
|
54
|
-
return viz.type === "HEAT_MAP";
|
|
55
|
-
}
|
|
56
|
-
function isFormVisualization(viz) {
|
|
57
|
-
return viz.type === "FORM";
|
|
58
|
-
}
|
|
59
|
-
function isUSStateMapping(mappings) {
|
|
60
|
-
return mappings.state !== undefined;
|
|
61
|
-
}
|
|
62
|
-
function isUSCountyMapping(mappings) {
|
|
63
|
-
return mappings.county !== undefined;
|
|
64
|
-
}
|
|
65
|
-
function isGeohashMapping(mappings) {
|
|
66
|
-
return mappings.geohash !== undefined;
|
|
22
|
+
var PKG_NAME = "@hpcc-js/ddl-shim";
|
|
23
|
+
var PKG_VERSION = "2.20.0";
|
|
24
|
+
var BUILD_VERSION = "2.104.2";
|
|
25
|
+
|
|
26
|
+
function isWorkunitDatasource(ref) {
|
|
27
|
+
return ref.WUID !== undefined;
|
|
28
|
+
}
|
|
29
|
+
function isDatabombDatasource(ref) {
|
|
30
|
+
return ref.databomb === true;
|
|
31
|
+
}
|
|
32
|
+
function isHipieDatasource(ref) {
|
|
33
|
+
return ref.URL !== undefined;
|
|
34
|
+
}
|
|
35
|
+
function isPieVisualization(viz) {
|
|
36
|
+
return viz.type === "PIE" || viz.type === "BAR";
|
|
37
|
+
}
|
|
38
|
+
function isLineVisualization(viz) {
|
|
39
|
+
return viz.type === "LINE";
|
|
40
|
+
}
|
|
41
|
+
function isChoroVisualization(viz) {
|
|
42
|
+
return viz.type === "CHORO";
|
|
43
|
+
}
|
|
44
|
+
function isTableVisualization(viz) {
|
|
45
|
+
return viz.type === "TABLE";
|
|
46
|
+
}
|
|
47
|
+
function isSliderVisualization(viz) {
|
|
48
|
+
return viz.type === "SLIDER";
|
|
49
|
+
}
|
|
50
|
+
function isGraphVisualization(viz) {
|
|
51
|
+
return viz.type === "GRAPH";
|
|
52
|
+
}
|
|
53
|
+
function isHeatMapVisualization(viz) {
|
|
54
|
+
return viz.type === "HEAT_MAP";
|
|
55
|
+
}
|
|
56
|
+
function isFormVisualization(viz) {
|
|
57
|
+
return viz.type === "FORM";
|
|
58
|
+
}
|
|
59
|
+
function isUSStateMapping(mappings) {
|
|
60
|
+
return mappings.state !== undefined;
|
|
61
|
+
}
|
|
62
|
+
function isUSCountyMapping(mappings) {
|
|
63
|
+
return mappings.county !== undefined;
|
|
64
|
+
}
|
|
65
|
+
function isGeohashMapping(mappings) {
|
|
66
|
+
return mappings.geohash !== undefined;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
var v1 = /*#__PURE__*/Object.freeze({
|
|
@@ -84,36 +84,36 @@
|
|
|
84
84
|
isGeohashMapping: isGeohashMapping
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
function isDatabombRef(ref) {
|
|
88
|
-
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
89
|
-
}
|
|
90
|
-
function isWUResultRef(ref) {
|
|
91
|
-
return ref.output !== undefined && !isRoxieServiceRef(ref);
|
|
92
|
-
}
|
|
93
|
-
function isRoxieServiceRef(ref) {
|
|
94
|
-
return ref.request !== undefined;
|
|
95
|
-
}
|
|
96
|
-
function isIFilterCondition(fc) {
|
|
97
|
-
return !!fc.viewID;
|
|
98
|
-
}
|
|
99
|
-
function isFilterActivity(activity) {
|
|
100
|
-
return activity.type === "filter";
|
|
101
|
-
}
|
|
102
|
-
function isProjectActivity(activity) {
|
|
103
|
-
return activity.type === "project";
|
|
104
|
-
}
|
|
105
|
-
function isMappingsActivity(activity) {
|
|
106
|
-
return activity.type === "mappings";
|
|
107
|
-
}
|
|
108
|
-
function isGroupByActivity(activity) {
|
|
109
|
-
return activity.type === "groupby";
|
|
110
|
-
}
|
|
111
|
-
function isSortActivity(activity) {
|
|
112
|
-
return activity.type === "sort";
|
|
113
|
-
}
|
|
114
|
-
function isLimitActivity(activity) {
|
|
115
|
-
return activity.type === "limit";
|
|
116
|
-
}
|
|
87
|
+
function isDatabombRef(ref) {
|
|
88
|
+
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
89
|
+
}
|
|
90
|
+
function isWUResultRef(ref) {
|
|
91
|
+
return ref.output !== undefined && !isRoxieServiceRef(ref);
|
|
92
|
+
}
|
|
93
|
+
function isRoxieServiceRef(ref) {
|
|
94
|
+
return ref.request !== undefined;
|
|
95
|
+
}
|
|
96
|
+
function isIFilterCondition(fc) {
|
|
97
|
+
return !!fc.viewID;
|
|
98
|
+
}
|
|
99
|
+
function isFilterActivity(activity) {
|
|
100
|
+
return activity.type === "filter";
|
|
101
|
+
}
|
|
102
|
+
function isProjectActivity(activity) {
|
|
103
|
+
return activity.type === "project";
|
|
104
|
+
}
|
|
105
|
+
function isMappingsActivity(activity) {
|
|
106
|
+
return activity.type === "mappings";
|
|
107
|
+
}
|
|
108
|
+
function isGroupByActivity(activity) {
|
|
109
|
+
return activity.type === "groupby";
|
|
110
|
+
}
|
|
111
|
+
function isSortActivity(activity) {
|
|
112
|
+
return activity.type === "sort";
|
|
113
|
+
}
|
|
114
|
+
function isLimitActivity(activity) {
|
|
115
|
+
return activity.type === "limit";
|
|
116
|
+
}
|
|
117
117
|
var VisibilitySet = ["normal", "flyout"];
|
|
118
118
|
|
|
119
119
|
var v2$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
VisibilitySet: VisibilitySet
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
/******************************************************************************
|
|
135
135
|
Copyright (c) Microsoft Corporation.
|
|
136
136
|
|
|
137
137
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -167,927 +167,927 @@
|
|
|
167
167
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
var classMappings = {
|
|
171
|
-
c3chart_Bar: "chart_Bar",
|
|
172
|
-
c3chart_Column: "chart_Column",
|
|
173
|
-
c3chart_Pie: "chart_Pie",
|
|
174
|
-
c3chart_Area: "chart_Area",
|
|
175
|
-
c3chart_Line: "chart_Line",
|
|
176
|
-
amchart_Bar: "chart_Bar",
|
|
177
|
-
amchart_Column: "chart_Column",
|
|
178
|
-
amchart_Pie: "chart_Pie",
|
|
179
|
-
amchart_Area: "chart_Area",
|
|
180
|
-
amchart_Line: "chart_Line",
|
|
181
|
-
google_Bar: "chart_Bar",
|
|
182
|
-
google_Column: "chart_Column",
|
|
183
|
-
google_Pie: "chart_Pie",
|
|
184
|
-
google_Area: "chart_Area",
|
|
185
|
-
google_Line: "chart_Line",
|
|
186
|
-
other_Table: "dgrid_Table"
|
|
187
|
-
};
|
|
188
|
-
var propertyMappings = {
|
|
189
|
-
xAxisLabelRotation: [
|
|
190
|
-
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
191
|
-
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
192
|
-
],
|
|
193
|
-
tooltipLabelColor: {
|
|
194
|
-
name: "tooltipLabelColor"
|
|
195
|
-
},
|
|
196
|
-
tooltipSeriesColor: {
|
|
197
|
-
name: "tooltipSeriesColor"
|
|
198
|
-
},
|
|
199
|
-
tooltipValueColor: {
|
|
200
|
-
name: "tooltipValueColor"
|
|
201
|
-
},
|
|
202
|
-
tooltipValueFormat: {
|
|
203
|
-
name: "tooltipValueFormat"
|
|
204
|
-
},
|
|
205
|
-
timePattern: {
|
|
206
|
-
name: "xAxisTypeTimePattern"
|
|
207
|
-
},
|
|
208
|
-
smoothLines: {
|
|
209
|
-
name: "interpolate",
|
|
210
|
-
transform: function (n) {
|
|
211
|
-
if (n === false)
|
|
212
|
-
return "linear";
|
|
213
|
-
return "catmullRom";
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
holePercent: {
|
|
217
|
-
name: "innerRadius"
|
|
218
|
-
},
|
|
219
|
-
flip: {
|
|
220
|
-
name: "orientation",
|
|
221
|
-
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
222
|
-
},
|
|
223
|
-
bottomText: {
|
|
224
|
-
name: "xAxisTitle"
|
|
225
|
-
},
|
|
226
|
-
xAxisTypeTimePattern: {
|
|
227
|
-
name: "xAxisTypeTimePattern"
|
|
228
|
-
},
|
|
229
|
-
yAxisTypeTimePattern: {
|
|
230
|
-
name: "yAxisTypeTimePattern"
|
|
231
|
-
},
|
|
232
|
-
valueFormat: {
|
|
233
|
-
name: "tooltipValueFormat"
|
|
234
|
-
},
|
|
235
|
-
stacked: {
|
|
236
|
-
name: "yAxisStacked"
|
|
237
|
-
},
|
|
238
|
-
showYGrid: {
|
|
239
|
-
name: "yAxisGuideLines"
|
|
240
|
-
},
|
|
241
|
-
showXGrid: {
|
|
242
|
-
name: "xAxisGuideLines"
|
|
243
|
-
},
|
|
244
|
-
showValueLabel: {
|
|
245
|
-
name: "showValue"
|
|
246
|
-
},
|
|
247
|
-
low: {
|
|
248
|
-
name: "yAxisDomainLow"
|
|
249
|
-
},
|
|
250
|
-
high: {
|
|
251
|
-
name: "yAxisDomainHigh"
|
|
252
|
-
},
|
|
253
|
-
fillOpacity: {
|
|
254
|
-
name: "interpolateFillOpacity"
|
|
255
|
-
},
|
|
256
|
-
areaFillOpacity: {
|
|
257
|
-
name: "interpolateFillOpacity"
|
|
258
|
-
},
|
|
259
|
-
showToolbar: {
|
|
260
|
-
name: "titleVisible"
|
|
261
|
-
},
|
|
262
|
-
showCSV: {
|
|
263
|
-
name: "downloadButtonVisible"
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
function findKeyVal(object, key, val) {
|
|
267
|
-
var value;
|
|
268
|
-
for (var k in object) {
|
|
269
|
-
if (k === key && object[k] === val) {
|
|
270
|
-
value = object;
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
if (object[k] && typeof object[k] === "object") {
|
|
274
|
-
value = findKeyVal(object[k], key, val);
|
|
275
|
-
if (value !== undefined) {
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return value;
|
|
281
|
-
}
|
|
282
|
-
function apply_to_dataviews(ddl2, dermObj) {
|
|
283
|
-
ddl2.dataviews.forEach(apply_to_dataview);
|
|
284
|
-
function apply_to_dataview(dv) {
|
|
285
|
-
var widgetId = dv.id;
|
|
286
|
-
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
287
|
-
if (dermPanelObj) {
|
|
288
|
-
var dermPanelProps = dermPanelObj.__properties;
|
|
289
|
-
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
290
|
-
var dermWidgetProps = dermWidgetObj.__properties;
|
|
291
|
-
apply_class_mapping(dermWidgetObj);
|
|
292
|
-
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
293
|
-
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
294
|
-
if (dv.visualization.properties.chartType) {
|
|
295
|
-
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
console.warn(widgetId + " not found in dermObj");
|
|
300
|
-
}
|
|
301
|
-
function apply_class_mapping(dermWidgetObj) {
|
|
302
|
-
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
303
|
-
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
304
|
-
if (!dv.visualization.properties.widget)
|
|
305
|
-
dv.visualization.properties.widget = {};
|
|
306
|
-
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
307
|
-
function swap_with_supported_class(_class) {
|
|
308
|
-
return classMappings[_class] ? classMappings[_class] : _class;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
312
|
-
dv.visualization.title = dermPanelProps.title || "";
|
|
313
|
-
dv.visualization.description = "";
|
|
314
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
315
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
316
|
-
for (var propName in dermPanelProps) {
|
|
317
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
318
|
-
var newPropName = propertyMappings[propName].name;
|
|
319
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
320
|
-
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
328
|
-
dv.visualization.properties.legendVisible = true;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
332
|
-
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
333
|
-
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
334
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
335
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
336
|
-
var _loop_1 = function (propName) {
|
|
337
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
338
|
-
if (propertyMappings[propName] instanceof Array) {
|
|
339
|
-
propertyMappings[propName].forEach(function (p) {
|
|
340
|
-
var newPropName = p.name;
|
|
341
|
-
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
342
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
343
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
var newPropName = propertyMappings[propName].name;
|
|
352
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
for (var propName in dermWidgetProps) {
|
|
357
|
-
_loop_1(propName);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function apply_to_properties_layout(ddl2, dermObj) {
|
|
363
|
-
var retVal = {
|
|
364
|
-
layout: []
|
|
365
|
-
};
|
|
366
|
-
if (!dermObj || !dermObj.__properties)
|
|
367
|
-
return;
|
|
368
|
-
dermObj.__properties.content.forEach(function (cell) {
|
|
369
|
-
var cellPosition = {
|
|
370
|
-
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
371
|
-
id: cell.__properties.widget.__id,
|
|
372
|
-
position: [
|
|
373
|
-
cell.__properties.gridCol,
|
|
374
|
-
cell.__properties.gridRow,
|
|
375
|
-
cell.__properties.gridColSpan,
|
|
376
|
-
cell.__properties.gridRowSpan
|
|
377
|
-
]
|
|
378
|
-
};
|
|
379
|
-
retVal.layout.push(cellPosition);
|
|
380
|
-
});
|
|
381
|
-
return retVal;
|
|
382
|
-
}
|
|
383
|
-
function upgrade$1(ddl2, dermObj) {
|
|
384
|
-
apply_to_dataviews(ddl2, dermObj);
|
|
385
|
-
return apply_to_properties_layout(ddl2, dermObj);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function faCharFix(faChar) {
|
|
389
|
-
return faChar;
|
|
390
|
-
}
|
|
391
|
-
var DDLUpgrade = /** @class */ (function () {
|
|
392
|
-
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
393
|
-
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
394
|
-
if (wuid === void 0) { wuid = "WUID"; }
|
|
395
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
396
|
-
this._datasources = {};
|
|
397
|
-
this._datasourceUpdates = {};
|
|
398
|
-
this._visualizations = {};
|
|
399
|
-
this._ddl2Datasources = {};
|
|
400
|
-
this._ddl2DatasourceFields = {};
|
|
401
|
-
this._ddl2Dataviews = {};
|
|
402
|
-
this._ddl2DataviewActivities = {};
|
|
403
|
-
this._ddl = ddl;
|
|
404
|
-
this._baseUrl = baseUrl;
|
|
405
|
-
this._wuid = wuid;
|
|
406
|
-
this._toLowerCase = toLowerCase;
|
|
407
|
-
this.indexDDL();
|
|
408
|
-
this.readDDL();
|
|
409
|
-
}
|
|
410
|
-
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
411
|
-
return this._toLowerCase ? s.toLowerCase() : s;
|
|
412
|
-
};
|
|
413
|
-
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
414
|
-
if (viz.source) {
|
|
415
|
-
var ds = this._datasources[viz.source.id];
|
|
416
|
-
if (isHipieDatasource(ds)) {
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
return false;
|
|
421
|
-
};
|
|
422
|
-
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
423
|
-
var retVal = [];
|
|
424
|
-
var datasource = this._datasources[dsID];
|
|
425
|
-
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
426
|
-
var output = _a[_i];
|
|
427
|
-
if (output.notify) {
|
|
428
|
-
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
429
|
-
var notify = _c[_b];
|
|
430
|
-
if (notify === vizID) {
|
|
431
|
-
retVal.push({
|
|
432
|
-
datasource: datasource,
|
|
433
|
-
output: output
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
return retVal;
|
|
440
|
-
};
|
|
441
|
-
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
442
|
-
var retVal = {};
|
|
443
|
-
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
444
|
-
var dsOut = _a[_i];
|
|
445
|
-
if (dsOut.output.filter) {
|
|
446
|
-
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
447
|
-
var filter = _c[_b];
|
|
448
|
-
retVal[filter.fieldid] = {
|
|
449
|
-
datasource: dsOut.datasource,
|
|
450
|
-
output: dsOut.output,
|
|
451
|
-
filter: filter
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
return retVal;
|
|
457
|
-
};
|
|
458
|
-
DDLUpgrade.prototype.indexDDL = function () {
|
|
459
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
460
|
-
var dash = _a[_i];
|
|
461
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
462
|
-
var viz = _c[_b];
|
|
463
|
-
this._visualizations[viz.id] = viz;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
467
|
-
var ds = _e[_d];
|
|
468
|
-
this._datasources[ds.id] = ds;
|
|
469
|
-
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
470
|
-
var output = _g[_f];
|
|
471
|
-
if (output.notify) {
|
|
472
|
-
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
473
|
-
var notify = _j[_h];
|
|
474
|
-
this._datasourceUpdates[notify] = {
|
|
475
|
-
id: ds.id,
|
|
476
|
-
output: output.from || output.id
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
DDLUpgrade.prototype.readDDL = function () {
|
|
484
|
-
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
485
|
-
var ds = _a[_i];
|
|
486
|
-
if (isWorkunitDatasource(ds)) {
|
|
487
|
-
var ddl2DS = {
|
|
488
|
-
type: "wuresult",
|
|
489
|
-
id: ds.id,
|
|
490
|
-
url: this._baseUrl,
|
|
491
|
-
wuid: this._wuid,
|
|
492
|
-
outputs: {}
|
|
493
|
-
};
|
|
494
|
-
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
495
|
-
var output = _c[_b];
|
|
496
|
-
this.output2output(output, ddl2DS.outputs);
|
|
497
|
-
}
|
|
498
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
499
|
-
}
|
|
500
|
-
else if (isDatabombDatasource(ds)) ;
|
|
501
|
-
else {
|
|
502
|
-
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
503
|
-
var hostParts = urlParts[0];
|
|
504
|
-
var roxieParts = urlParts[1].split("/");
|
|
505
|
-
var ddl2DS = {
|
|
506
|
-
type: "hipie",
|
|
507
|
-
id: ds.id,
|
|
508
|
-
url: hostParts,
|
|
509
|
-
querySet: roxieParts[0],
|
|
510
|
-
queryID: roxieParts[1],
|
|
511
|
-
inputs: [],
|
|
512
|
-
outputs: {}
|
|
513
|
-
};
|
|
514
|
-
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
515
|
-
var output = _e[_d];
|
|
516
|
-
this.output2output(output, ddl2DS.outputs);
|
|
517
|
-
}
|
|
518
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
522
|
-
var dash = _g[_f];
|
|
523
|
-
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
524
|
-
var viz = _j[_h];
|
|
525
|
-
if (viz.type === "FORM") {
|
|
526
|
-
this._ddl2Datasources[viz.id] = {
|
|
527
|
-
type: "form",
|
|
528
|
-
id: viz.id,
|
|
529
|
-
fields: this.formFields2field(viz.fields)
|
|
530
|
-
};
|
|
531
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
532
|
-
}
|
|
533
|
-
else if (viz.type === "SLIDER") {
|
|
534
|
-
this._ddl2Datasources[viz.id] = {
|
|
535
|
-
type: "form",
|
|
536
|
-
id: viz.id,
|
|
537
|
-
fields: this.formFields2field(viz.fields, true)
|
|
538
|
-
};
|
|
539
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
540
|
-
}
|
|
541
|
-
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
this.readGroupBy();
|
|
545
|
-
this.readFilters();
|
|
546
|
-
this.readSort();
|
|
547
|
-
this.readMappings();
|
|
548
|
-
};
|
|
549
|
-
DDLUpgrade.prototype.readGroupBy = function () {
|
|
550
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
551
|
-
var dash = _a[_i];
|
|
552
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
553
|
-
var viz = _c[_b];
|
|
554
|
-
if (viz.fields) {
|
|
555
|
-
var projectTransformations = [];
|
|
556
|
-
var groupByColumns = [];
|
|
557
|
-
var aggrFields = [];
|
|
558
|
-
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
559
|
-
var field = _e[_d];
|
|
560
|
-
if (field.properties && field.properties.function) {
|
|
561
|
-
switch (field.properties.function) {
|
|
562
|
-
case "SUM":
|
|
563
|
-
case "MIN":
|
|
564
|
-
case "MAX":
|
|
565
|
-
aggrFields.push({
|
|
566
|
-
type: this.func2aggr(field.properties.function),
|
|
567
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
568
|
-
fieldID: this.toLowerCase(field.id)
|
|
569
|
-
});
|
|
570
|
-
break;
|
|
571
|
-
case "AVE":
|
|
572
|
-
aggrFields.push({
|
|
573
|
-
type: this.func2aggr(field.properties.function),
|
|
574
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
575
|
-
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
576
|
-
fieldID: this.toLowerCase(field.id)
|
|
577
|
-
});
|
|
578
|
-
break;
|
|
579
|
-
case "SCALE":
|
|
580
|
-
if (typeof field.properties.params.param1 === "object") {
|
|
581
|
-
var props = field.properties.params.param1;
|
|
582
|
-
switch (props.function) {
|
|
583
|
-
case "SUM":
|
|
584
|
-
case "MIN":
|
|
585
|
-
case "MAX":
|
|
586
|
-
aggrFields.push({
|
|
587
|
-
type: this.func2aggr(props.function),
|
|
588
|
-
inFieldID: this.toLowerCase(props.params.param1),
|
|
589
|
-
fieldID: this.toLowerCase(field.id)
|
|
590
|
-
});
|
|
591
|
-
break;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
projectTransformations.push({
|
|
595
|
-
type: "scale",
|
|
596
|
-
sourceFieldID: this.toLowerCase(field.id),
|
|
597
|
-
fieldID: this.toLowerCase(field.id),
|
|
598
|
-
factor: +field.properties.params.param2
|
|
599
|
-
});
|
|
600
|
-
break;
|
|
601
|
-
default:
|
|
602
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
603
|
-
throw new Error("Unhandled field function: ".concat(field.properties.function));
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
if (projectTransformations.length) {
|
|
611
|
-
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
612
|
-
}
|
|
613
|
-
if (aggrFields.length) {
|
|
614
|
-
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
|
|
615
|
-
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
622
|
-
switch (func) {
|
|
623
|
-
case "SUM":
|
|
624
|
-
return "sum";
|
|
625
|
-
case "AVE":
|
|
626
|
-
return "mean";
|
|
627
|
-
case "MIN":
|
|
628
|
-
return "min";
|
|
629
|
-
case "MAX":
|
|
630
|
-
return "max";
|
|
631
|
-
}
|
|
632
|
-
throw new Error("Unknown DDL1 Function Type: ".concat(func));
|
|
633
|
-
};
|
|
634
|
-
DDLUpgrade.prototype.readMappings = function () {
|
|
635
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
636
|
-
var dash = _a[_i];
|
|
637
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
638
|
-
var viz = _c[_b];
|
|
639
|
-
if (isFormVisualization(viz)) ;
|
|
640
|
-
else if (isPieVisualization(viz)) {
|
|
641
|
-
this.readPieMappings(viz);
|
|
642
|
-
}
|
|
643
|
-
else if (isChoroVisualization(viz)) {
|
|
644
|
-
this.readChoroMappings(viz);
|
|
645
|
-
}
|
|
646
|
-
else if (isLineVisualization(viz)) {
|
|
647
|
-
this.readLineMappings(viz);
|
|
648
|
-
}
|
|
649
|
-
else if (isTableVisualization(viz)) {
|
|
650
|
-
this.readTableMappings(viz);
|
|
651
|
-
}
|
|
652
|
-
else if (isGraphVisualization(viz)) {
|
|
653
|
-
this.readGraphMappings(viz);
|
|
654
|
-
}
|
|
655
|
-
else if (isSliderVisualization(viz)) {
|
|
656
|
-
this.readSliderMappings(viz);
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
665
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
666
|
-
mappings.transformations.push({
|
|
667
|
-
fieldID: "label",
|
|
668
|
-
type: "=",
|
|
669
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
670
|
-
});
|
|
671
|
-
mappings.transformations.push({
|
|
672
|
-
fieldID: "weight",
|
|
673
|
-
type: "=",
|
|
674
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
675
|
-
});
|
|
676
|
-
};
|
|
677
|
-
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
678
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
679
|
-
mappings.transformations.push({
|
|
680
|
-
fieldID: "label",
|
|
681
|
-
type: "=",
|
|
682
|
-
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
683
|
-
});
|
|
684
|
-
mappings.transformations.push({
|
|
685
|
-
fieldID: "weight",
|
|
686
|
-
type: "=",
|
|
687
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
688
|
-
});
|
|
689
|
-
};
|
|
690
|
-
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
691
|
-
return mapping.state || mapping.county || mapping.geohash;
|
|
692
|
-
};
|
|
693
|
-
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
694
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
695
|
-
mappings.transformations.push({
|
|
696
|
-
fieldID: viz.source.mappings.x[0],
|
|
697
|
-
type: "=",
|
|
698
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
699
|
-
});
|
|
700
|
-
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
701
|
-
mappings.transformations.push({
|
|
702
|
-
fieldID: viz.source.mappings.y[i],
|
|
703
|
-
type: "=",
|
|
704
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
709
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
710
|
-
for (var i = 0; i < viz.label.length; ++i) {
|
|
711
|
-
mappings.transformations.push({
|
|
712
|
-
fieldID: viz.label[i],
|
|
713
|
-
type: "=",
|
|
714
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
719
|
-
if (annotation === void 0) { annotation = false; }
|
|
720
|
-
var retVal = [];
|
|
721
|
-
if (valueMappings) {
|
|
722
|
-
for (var value in valueMappings) {
|
|
723
|
-
var newValue = {};
|
|
724
|
-
for (var key in valueMappings[value]) {
|
|
725
|
-
if (key === "faChar") {
|
|
726
|
-
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
727
|
-
}
|
|
728
|
-
else if (annotation && key.indexOf("icon_") === 0) {
|
|
729
|
-
console.
|
|
730
|
-
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
731
|
-
}
|
|
732
|
-
else {
|
|
733
|
-
newValue[key] = valueMappings[value][key];
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
737
|
-
if (!annotation || value !== "0") {
|
|
738
|
-
retVal.push({
|
|
739
|
-
value: value,
|
|
740
|
-
newValue: newValue
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
return retVal;
|
|
746
|
-
};
|
|
747
|
-
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
748
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
749
|
-
mappings.transformations.push({
|
|
750
|
-
fieldID: "uid",
|
|
751
|
-
type: "=",
|
|
752
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
753
|
-
});
|
|
754
|
-
mappings.transformations.push({
|
|
755
|
-
fieldID: "label",
|
|
756
|
-
type: "=",
|
|
757
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
758
|
-
});
|
|
759
|
-
if (viz.icon.fieldid) {
|
|
760
|
-
mappings.transformations.push({
|
|
761
|
-
fieldID: "icon",
|
|
762
|
-
type: "map",
|
|
763
|
-
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
764
|
-
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
765
|
-
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
var idx = 0;
|
|
769
|
-
if (viz.flag) {
|
|
770
|
-
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
771
|
-
var flag = _a[_i];
|
|
772
|
-
if (flag.fieldid) {
|
|
773
|
-
mappings.transformations.push({
|
|
774
|
-
fieldID: "annotation_".concat(idx++),
|
|
775
|
-
type: "map",
|
|
776
|
-
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
777
|
-
default: {},
|
|
778
|
-
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
mappings.transformations.push({
|
|
784
|
-
fieldID: "links",
|
|
785
|
-
type: "=",
|
|
786
|
-
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
787
|
-
transformations: [{
|
|
788
|
-
fieldID: "uid",
|
|
789
|
-
type: "=",
|
|
790
|
-
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
791
|
-
}]
|
|
792
|
-
});
|
|
793
|
-
};
|
|
794
|
-
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
795
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
796
|
-
mappings.transformations.push({
|
|
797
|
-
fieldID: "label",
|
|
798
|
-
type: "=",
|
|
799
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
800
|
-
});
|
|
801
|
-
};
|
|
802
|
-
DDLUpgrade.prototype.readFilters = function () {
|
|
803
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
804
|
-
var dash = _a[_i];
|
|
805
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
806
|
-
var viz = _c[_b];
|
|
807
|
-
if (viz.events) {
|
|
808
|
-
for (var eventID in viz.events) {
|
|
809
|
-
var event_1 = viz.events[eventID];
|
|
810
|
-
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
811
|
-
var update = _e[_d];
|
|
812
|
-
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
813
|
-
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
814
|
-
if (update.mappings) {
|
|
815
|
-
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
816
|
-
for (var key in update.mappings) {
|
|
817
|
-
otherViz.datasource.request.push({
|
|
818
|
-
source: viz.id,
|
|
819
|
-
remoteFieldID: this.toLowerCase(key),
|
|
820
|
-
localFieldID: this.toLowerCase(update.mappings[key])
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
else {
|
|
825
|
-
var condition = {
|
|
826
|
-
viewID: viz.id,
|
|
827
|
-
mappings: []
|
|
828
|
-
};
|
|
829
|
-
for (var key in update.mappings) {
|
|
830
|
-
var mapping = update.mappings[key];
|
|
831
|
-
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
832
|
-
if (!dsFilter) {
|
|
833
|
-
console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
|
|
834
|
-
}
|
|
835
|
-
else {
|
|
836
|
-
condition.mappings.push({
|
|
837
|
-
remoteFieldID: this.toLowerCase(key),
|
|
838
|
-
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
839
|
-
condition: this.rule2condition(dsFilter.rule),
|
|
840
|
-
nullable: dsFilter.nullable
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
854
|
-
switch (_) {
|
|
855
|
-
case "set":
|
|
856
|
-
return "in";
|
|
857
|
-
case "notequals":
|
|
858
|
-
return "!=";
|
|
859
|
-
}
|
|
860
|
-
return _;
|
|
861
|
-
};
|
|
862
|
-
DDLUpgrade.prototype.readSort = function () {
|
|
863
|
-
var _this = this;
|
|
864
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
865
|
-
var dash = _a[_i];
|
|
866
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
867
|
-
var viz = _c[_b];
|
|
868
|
-
if (viz.source) {
|
|
869
|
-
if (viz.source.sort) {
|
|
870
|
-
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
871
|
-
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
872
|
-
if (s.indexOf("-") === 0) {
|
|
873
|
-
return {
|
|
874
|
-
fieldID: _this.toLowerCase(s.substr(1)),
|
|
875
|
-
descending: true
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
return {
|
|
879
|
-
fieldID: _this.toLowerCase(s),
|
|
880
|
-
descending: false
|
|
881
|
-
};
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
if (viz.source.first) {
|
|
885
|
-
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
886
|
-
vizLimit.limit = +viz.source.first;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
};
|
|
892
|
-
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
893
|
-
var project = {
|
|
894
|
-
type: "project",
|
|
895
|
-
transformations: []
|
|
896
|
-
};
|
|
897
|
-
var filters = {
|
|
898
|
-
type: "filter",
|
|
899
|
-
conditions: []
|
|
900
|
-
};
|
|
901
|
-
var groupBy = {
|
|
902
|
-
type: "groupby",
|
|
903
|
-
groupByIDs: [],
|
|
904
|
-
aggregates: []
|
|
905
|
-
};
|
|
906
|
-
var sort = {
|
|
907
|
-
type: "sort",
|
|
908
|
-
conditions: []
|
|
909
|
-
};
|
|
910
|
-
var limit = {
|
|
911
|
-
type: "limit",
|
|
912
|
-
limit: 0
|
|
913
|
-
};
|
|
914
|
-
var mappings = {
|
|
915
|
-
type: "mappings",
|
|
916
|
-
transformations: []
|
|
917
|
-
};
|
|
918
|
-
this._ddl2DataviewActivities[viz.id] = {
|
|
919
|
-
project: project,
|
|
920
|
-
filters: filters,
|
|
921
|
-
sort: sort,
|
|
922
|
-
groupBy: groupBy,
|
|
923
|
-
limit: limit,
|
|
924
|
-
mappings: mappings
|
|
925
|
-
};
|
|
926
|
-
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
927
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
928
|
-
request: [],
|
|
929
|
-
output: this._datasourceUpdates[viz.id].output
|
|
930
|
-
} : {
|
|
931
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
932
|
-
output: this._datasourceUpdates[viz.id].output
|
|
933
|
-
};
|
|
934
|
-
return {
|
|
935
|
-
id: viz.id,
|
|
936
|
-
datasource: datasourceRef,
|
|
937
|
-
activities: [
|
|
938
|
-
project,
|
|
939
|
-
filters,
|
|
940
|
-
sort,
|
|
941
|
-
groupBy,
|
|
942
|
-
limit
|
|
943
|
-
],
|
|
944
|
-
visualization: __assign(__assign({ id: viz.id, title: viz.title || "", description: "", visibility: viz.properties && viz.properties.flyout === true ? "flyout" : "normal" }, this.type2chartType(viz.type)), { mappings: mappings, properties: (viz.properties || {}) })
|
|
945
|
-
};
|
|
946
|
-
};
|
|
947
|
-
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
948
|
-
switch (chartType) {
|
|
949
|
-
case "LINE":
|
|
950
|
-
return { chartType: "Line", __class: "chart_Line" };
|
|
951
|
-
case "BUBBLE":
|
|
952
|
-
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
953
|
-
case "PIE":
|
|
954
|
-
return { chartType: "Pie", __class: "chart_Pie" };
|
|
955
|
-
case "BAR":
|
|
956
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
957
|
-
case "FORM":
|
|
958
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
959
|
-
case "WORD_CLOUD":
|
|
960
|
-
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
961
|
-
case "CHORO":
|
|
962
|
-
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
963
|
-
case "SUMMARY":
|
|
964
|
-
return { chartType: "Summary", __class: "chart_Summary" };
|
|
965
|
-
case "SLIDER":
|
|
966
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
967
|
-
case "HEAT_MAP":
|
|
968
|
-
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
969
|
-
case "2DCHART":
|
|
970
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
971
|
-
case "GRAPH":
|
|
972
|
-
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
973
|
-
case "TABLE":
|
|
974
|
-
default:
|
|
975
|
-
return { chartType: "Table", __class: "dgrid_Table" };
|
|
976
|
-
}
|
|
977
|
-
};
|
|
978
|
-
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
979
|
-
var _this = this;
|
|
980
|
-
if (slider === void 0) { slider = false; }
|
|
981
|
-
if (!fields)
|
|
982
|
-
return [];
|
|
983
|
-
return fields.map(function (field) {
|
|
984
|
-
switch (field.properties.type) {
|
|
985
|
-
case "range":
|
|
986
|
-
return {
|
|
987
|
-
type: "range",
|
|
988
|
-
id: field.id,
|
|
989
|
-
default: (field.properties.default ? field.properties.default : undefined)
|
|
990
|
-
};
|
|
991
|
-
case "dataset":
|
|
992
|
-
return {
|
|
993
|
-
type: "dataset",
|
|
994
|
-
id: field.id,
|
|
995
|
-
default: [],
|
|
996
|
-
children: []
|
|
997
|
-
};
|
|
998
|
-
default:
|
|
999
|
-
return {
|
|
1000
|
-
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
1001
|
-
id: field.id,
|
|
1002
|
-
default: field.properties.default ? field.properties.default[0] : undefined
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1006
|
-
};
|
|
1007
|
-
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
1008
|
-
switch (fieldType) {
|
|
1009
|
-
case "bool":
|
|
1010
|
-
case "boolean":
|
|
1011
|
-
return "boolean";
|
|
1012
|
-
case "integer":
|
|
1013
|
-
case "unsigned":
|
|
1014
|
-
case "float":
|
|
1015
|
-
case "double":
|
|
1016
|
-
case "real":
|
|
1017
|
-
return "number";
|
|
1018
|
-
case "string":
|
|
1019
|
-
return "string";
|
|
1020
|
-
default:
|
|
1021
|
-
return slider ? "number" : "string";
|
|
1022
|
-
}
|
|
1023
|
-
};
|
|
1024
|
-
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
1025
|
-
target[output.from || output.id] = {
|
|
1026
|
-
fields: this.filters2fields(output.filter)
|
|
1027
|
-
};
|
|
1028
|
-
};
|
|
1029
|
-
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
1030
|
-
if (!filters)
|
|
1031
|
-
return [];
|
|
1032
|
-
return filters.filter(function (filter) {
|
|
1033
|
-
var idParts = filter.fieldid.split("-");
|
|
1034
|
-
return idParts.length === 1 || idParts[1] === "range";
|
|
1035
|
-
}).map(function (filter) {
|
|
1036
|
-
var idParts = filter.fieldid.split("-");
|
|
1037
|
-
var retVal = {
|
|
1038
|
-
type: "string",
|
|
1039
|
-
id: idParts[0]
|
|
1040
|
-
};
|
|
1041
|
-
return retVal;
|
|
1042
|
-
});
|
|
1043
|
-
};
|
|
1044
|
-
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
1045
|
-
return {
|
|
1046
|
-
type: "string",
|
|
1047
|
-
id: "",
|
|
1048
|
-
default: ""
|
|
1049
|
-
};
|
|
1050
|
-
};
|
|
1051
|
-
DDLUpgrade.prototype.writeDatasources = function () {
|
|
1052
|
-
var retVal = [];
|
|
1053
|
-
for (var id in this._ddl2Datasources) {
|
|
1054
|
-
retVal.push(this._ddl2Datasources[id]);
|
|
1055
|
-
}
|
|
1056
|
-
return retVal;
|
|
1057
|
-
};
|
|
1058
|
-
DDLUpgrade.prototype.writeDataviews = function () {
|
|
1059
|
-
var retVal = [];
|
|
1060
|
-
for (var id in this._ddl2Dataviews) {
|
|
1061
|
-
retVal.push(this._ddl2Dataviews[id]);
|
|
1062
|
-
}
|
|
1063
|
-
return retVal;
|
|
1064
|
-
};
|
|
1065
|
-
DDLUpgrade.prototype.writeProperties = function () {
|
|
1066
|
-
return {
|
|
1067
|
-
// TODO
|
|
1068
|
-
};
|
|
1069
|
-
};
|
|
1070
|
-
DDLUpgrade.prototype.write = function () {
|
|
1071
|
-
return {
|
|
1072
|
-
version: "2.2.1",
|
|
1073
|
-
createdBy: {
|
|
1074
|
-
name: PKG_NAME,
|
|
1075
|
-
version: PKG_VERSION
|
|
1076
|
-
},
|
|
1077
|
-
datasources: this.writeDatasources(),
|
|
1078
|
-
dataviews: this.writeDataviews(),
|
|
1079
|
-
properties: this.writeProperties()
|
|
1080
|
-
};
|
|
1081
|
-
};
|
|
1082
|
-
return DDLUpgrade;
|
|
1083
|
-
}());
|
|
1084
|
-
function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
|
|
1085
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1086
|
-
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
1087
|
-
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1088
|
-
var retVal = ddlUp.write();
|
|
1089
|
-
retVal.properties = upgrade$1(retVal, dermatologyJson);
|
|
1090
|
-
return retVal;
|
|
170
|
+
var classMappings = {
|
|
171
|
+
c3chart_Bar: "chart_Bar",
|
|
172
|
+
c3chart_Column: "chart_Column",
|
|
173
|
+
c3chart_Pie: "chart_Pie",
|
|
174
|
+
c3chart_Area: "chart_Area",
|
|
175
|
+
c3chart_Line: "chart_Line",
|
|
176
|
+
amchart_Bar: "chart_Bar",
|
|
177
|
+
amchart_Column: "chart_Column",
|
|
178
|
+
amchart_Pie: "chart_Pie",
|
|
179
|
+
amchart_Area: "chart_Area",
|
|
180
|
+
amchart_Line: "chart_Line",
|
|
181
|
+
google_Bar: "chart_Bar",
|
|
182
|
+
google_Column: "chart_Column",
|
|
183
|
+
google_Pie: "chart_Pie",
|
|
184
|
+
google_Area: "chart_Area",
|
|
185
|
+
google_Line: "chart_Line",
|
|
186
|
+
other_Table: "dgrid_Table"
|
|
187
|
+
};
|
|
188
|
+
var propertyMappings = {
|
|
189
|
+
xAxisLabelRotation: [
|
|
190
|
+
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
191
|
+
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
192
|
+
],
|
|
193
|
+
tooltipLabelColor: {
|
|
194
|
+
name: "tooltipLabelColor"
|
|
195
|
+
},
|
|
196
|
+
tooltipSeriesColor: {
|
|
197
|
+
name: "tooltipSeriesColor"
|
|
198
|
+
},
|
|
199
|
+
tooltipValueColor: {
|
|
200
|
+
name: "tooltipValueColor"
|
|
201
|
+
},
|
|
202
|
+
tooltipValueFormat: {
|
|
203
|
+
name: "tooltipValueFormat"
|
|
204
|
+
},
|
|
205
|
+
timePattern: {
|
|
206
|
+
name: "xAxisTypeTimePattern"
|
|
207
|
+
},
|
|
208
|
+
smoothLines: {
|
|
209
|
+
name: "interpolate",
|
|
210
|
+
transform: function (n) {
|
|
211
|
+
if (n === false)
|
|
212
|
+
return "linear";
|
|
213
|
+
return "catmullRom";
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
holePercent: {
|
|
217
|
+
name: "innerRadius"
|
|
218
|
+
},
|
|
219
|
+
flip: {
|
|
220
|
+
name: "orientation",
|
|
221
|
+
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
222
|
+
},
|
|
223
|
+
bottomText: {
|
|
224
|
+
name: "xAxisTitle"
|
|
225
|
+
},
|
|
226
|
+
xAxisTypeTimePattern: {
|
|
227
|
+
name: "xAxisTypeTimePattern"
|
|
228
|
+
},
|
|
229
|
+
yAxisTypeTimePattern: {
|
|
230
|
+
name: "yAxisTypeTimePattern"
|
|
231
|
+
},
|
|
232
|
+
valueFormat: {
|
|
233
|
+
name: "tooltipValueFormat"
|
|
234
|
+
},
|
|
235
|
+
stacked: {
|
|
236
|
+
name: "yAxisStacked"
|
|
237
|
+
},
|
|
238
|
+
showYGrid: {
|
|
239
|
+
name: "yAxisGuideLines"
|
|
240
|
+
},
|
|
241
|
+
showXGrid: {
|
|
242
|
+
name: "xAxisGuideLines"
|
|
243
|
+
},
|
|
244
|
+
showValueLabel: {
|
|
245
|
+
name: "showValue"
|
|
246
|
+
},
|
|
247
|
+
low: {
|
|
248
|
+
name: "yAxisDomainLow"
|
|
249
|
+
},
|
|
250
|
+
high: {
|
|
251
|
+
name: "yAxisDomainHigh"
|
|
252
|
+
},
|
|
253
|
+
fillOpacity: {
|
|
254
|
+
name: "interpolateFillOpacity"
|
|
255
|
+
},
|
|
256
|
+
areaFillOpacity: {
|
|
257
|
+
name: "interpolateFillOpacity"
|
|
258
|
+
},
|
|
259
|
+
showToolbar: {
|
|
260
|
+
name: "titleVisible"
|
|
261
|
+
},
|
|
262
|
+
showCSV: {
|
|
263
|
+
name: "downloadButtonVisible"
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
function findKeyVal(object, key, val) {
|
|
267
|
+
var value;
|
|
268
|
+
for (var k in object) {
|
|
269
|
+
if (k === key && object[k] === val) {
|
|
270
|
+
value = object;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
if (object[k] && typeof object[k] === "object") {
|
|
274
|
+
value = findKeyVal(object[k], key, val);
|
|
275
|
+
if (value !== undefined) {
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return value;
|
|
281
|
+
}
|
|
282
|
+
function apply_to_dataviews(ddl2, dermObj) {
|
|
283
|
+
ddl2.dataviews.forEach(apply_to_dataview);
|
|
284
|
+
function apply_to_dataview(dv) {
|
|
285
|
+
var widgetId = dv.id;
|
|
286
|
+
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
287
|
+
if (dermPanelObj) {
|
|
288
|
+
var dermPanelProps = dermPanelObj.__properties;
|
|
289
|
+
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
290
|
+
var dermWidgetProps = dermWidgetObj.__properties;
|
|
291
|
+
apply_class_mapping(dermWidgetObj);
|
|
292
|
+
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
293
|
+
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
294
|
+
if (dv.visualization.properties.chartType) {
|
|
295
|
+
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
console.warn(widgetId + " not found in dermObj");
|
|
300
|
+
}
|
|
301
|
+
function apply_class_mapping(dermWidgetObj) {
|
|
302
|
+
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
303
|
+
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
304
|
+
if (!dv.visualization.properties.widget)
|
|
305
|
+
dv.visualization.properties.widget = {};
|
|
306
|
+
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
307
|
+
function swap_with_supported_class(_class) {
|
|
308
|
+
return classMappings[_class] ? classMappings[_class] : _class;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
312
|
+
dv.visualization.title = dermPanelProps.title || "";
|
|
313
|
+
dv.visualization.description = "";
|
|
314
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
315
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
316
|
+
for (var propName in dermPanelProps) {
|
|
317
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
318
|
+
var newPropName = propertyMappings[propName].name;
|
|
319
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
320
|
+
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
328
|
+
dv.visualization.properties.legendVisible = true;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
332
|
+
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
333
|
+
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
334
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
335
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
336
|
+
var _loop_1 = function (propName) {
|
|
337
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
338
|
+
if (propertyMappings[propName] instanceof Array) {
|
|
339
|
+
propertyMappings[propName].forEach(function (p) {
|
|
340
|
+
var newPropName = p.name;
|
|
341
|
+
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
342
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
343
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
var newPropName = propertyMappings[propName].name;
|
|
352
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
for (var propName in dermWidgetProps) {
|
|
357
|
+
_loop_1(propName);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function apply_to_properties_layout(ddl2, dermObj) {
|
|
363
|
+
var retVal = {
|
|
364
|
+
layout: []
|
|
365
|
+
};
|
|
366
|
+
if (!dermObj || !dermObj.__properties)
|
|
367
|
+
return;
|
|
368
|
+
dermObj.__properties.content.forEach(function (cell) {
|
|
369
|
+
var cellPosition = {
|
|
370
|
+
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
371
|
+
id: cell.__properties.widget.__id,
|
|
372
|
+
position: [
|
|
373
|
+
cell.__properties.gridCol,
|
|
374
|
+
cell.__properties.gridRow,
|
|
375
|
+
cell.__properties.gridColSpan,
|
|
376
|
+
cell.__properties.gridRowSpan
|
|
377
|
+
]
|
|
378
|
+
};
|
|
379
|
+
retVal.layout.push(cellPosition);
|
|
380
|
+
});
|
|
381
|
+
return retVal;
|
|
382
|
+
}
|
|
383
|
+
function upgrade$1(ddl2, dermObj) {
|
|
384
|
+
apply_to_dataviews(ddl2, dermObj);
|
|
385
|
+
return apply_to_properties_layout(ddl2, dermObj);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function faCharFix(faChar) {
|
|
389
|
+
return faChar;
|
|
390
|
+
}
|
|
391
|
+
var DDLUpgrade = /** @class */ (function () {
|
|
392
|
+
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
393
|
+
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
394
|
+
if (wuid === void 0) { wuid = "WUID"; }
|
|
395
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
396
|
+
this._datasources = {};
|
|
397
|
+
this._datasourceUpdates = {};
|
|
398
|
+
this._visualizations = {};
|
|
399
|
+
this._ddl2Datasources = {};
|
|
400
|
+
this._ddl2DatasourceFields = {};
|
|
401
|
+
this._ddl2Dataviews = {};
|
|
402
|
+
this._ddl2DataviewActivities = {};
|
|
403
|
+
this._ddl = ddl;
|
|
404
|
+
this._baseUrl = baseUrl;
|
|
405
|
+
this._wuid = wuid;
|
|
406
|
+
this._toLowerCase = toLowerCase;
|
|
407
|
+
this.indexDDL();
|
|
408
|
+
this.readDDL();
|
|
409
|
+
}
|
|
410
|
+
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
411
|
+
return this._toLowerCase ? s.toLowerCase() : s;
|
|
412
|
+
};
|
|
413
|
+
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
414
|
+
if (viz.source) {
|
|
415
|
+
var ds = this._datasources[viz.source.id];
|
|
416
|
+
if (isHipieDatasource(ds)) {
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return false;
|
|
421
|
+
};
|
|
422
|
+
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
423
|
+
var retVal = [];
|
|
424
|
+
var datasource = this._datasources[dsID];
|
|
425
|
+
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
426
|
+
var output = _a[_i];
|
|
427
|
+
if (output.notify) {
|
|
428
|
+
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
429
|
+
var notify = _c[_b];
|
|
430
|
+
if (notify === vizID) {
|
|
431
|
+
retVal.push({
|
|
432
|
+
datasource: datasource,
|
|
433
|
+
output: output
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return retVal;
|
|
440
|
+
};
|
|
441
|
+
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
442
|
+
var retVal = {};
|
|
443
|
+
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
444
|
+
var dsOut = _a[_i];
|
|
445
|
+
if (dsOut.output.filter) {
|
|
446
|
+
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
447
|
+
var filter = _c[_b];
|
|
448
|
+
retVal[filter.fieldid] = {
|
|
449
|
+
datasource: dsOut.datasource,
|
|
450
|
+
output: dsOut.output,
|
|
451
|
+
filter: filter
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return retVal;
|
|
457
|
+
};
|
|
458
|
+
DDLUpgrade.prototype.indexDDL = function () {
|
|
459
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
460
|
+
var dash = _a[_i];
|
|
461
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
462
|
+
var viz = _c[_b];
|
|
463
|
+
this._visualizations[viz.id] = viz;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
467
|
+
var ds = _e[_d];
|
|
468
|
+
this._datasources[ds.id] = ds;
|
|
469
|
+
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
470
|
+
var output = _g[_f];
|
|
471
|
+
if (output.notify) {
|
|
472
|
+
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
473
|
+
var notify = _j[_h];
|
|
474
|
+
this._datasourceUpdates[notify] = {
|
|
475
|
+
id: ds.id,
|
|
476
|
+
output: output.from || output.id
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
DDLUpgrade.prototype.readDDL = function () {
|
|
484
|
+
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
485
|
+
var ds = _a[_i];
|
|
486
|
+
if (isWorkunitDatasource(ds)) {
|
|
487
|
+
var ddl2DS = {
|
|
488
|
+
type: "wuresult",
|
|
489
|
+
id: ds.id,
|
|
490
|
+
url: this._baseUrl,
|
|
491
|
+
wuid: this._wuid,
|
|
492
|
+
outputs: {}
|
|
493
|
+
};
|
|
494
|
+
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
495
|
+
var output = _c[_b];
|
|
496
|
+
this.output2output(output, ddl2DS.outputs);
|
|
497
|
+
}
|
|
498
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
499
|
+
}
|
|
500
|
+
else if (isDatabombDatasource(ds)) ;
|
|
501
|
+
else {
|
|
502
|
+
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
503
|
+
var hostParts = urlParts[0];
|
|
504
|
+
var roxieParts = urlParts[1].split("/");
|
|
505
|
+
var ddl2DS = {
|
|
506
|
+
type: "hipie",
|
|
507
|
+
id: ds.id,
|
|
508
|
+
url: hostParts,
|
|
509
|
+
querySet: roxieParts[0],
|
|
510
|
+
queryID: roxieParts[1],
|
|
511
|
+
inputs: [],
|
|
512
|
+
outputs: {}
|
|
513
|
+
};
|
|
514
|
+
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
515
|
+
var output = _e[_d];
|
|
516
|
+
this.output2output(output, ddl2DS.outputs);
|
|
517
|
+
}
|
|
518
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
522
|
+
var dash = _g[_f];
|
|
523
|
+
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
524
|
+
var viz = _j[_h];
|
|
525
|
+
if (viz.type === "FORM") {
|
|
526
|
+
this._ddl2Datasources[viz.id] = {
|
|
527
|
+
type: "form",
|
|
528
|
+
id: viz.id,
|
|
529
|
+
fields: this.formFields2field(viz.fields)
|
|
530
|
+
};
|
|
531
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
532
|
+
}
|
|
533
|
+
else if (viz.type === "SLIDER") {
|
|
534
|
+
this._ddl2Datasources[viz.id] = {
|
|
535
|
+
type: "form",
|
|
536
|
+
id: viz.id,
|
|
537
|
+
fields: this.formFields2field(viz.fields, true)
|
|
538
|
+
};
|
|
539
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
540
|
+
}
|
|
541
|
+
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
this.readGroupBy();
|
|
545
|
+
this.readFilters();
|
|
546
|
+
this.readSort();
|
|
547
|
+
this.readMappings();
|
|
548
|
+
};
|
|
549
|
+
DDLUpgrade.prototype.readGroupBy = function () {
|
|
550
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
551
|
+
var dash = _a[_i];
|
|
552
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
553
|
+
var viz = _c[_b];
|
|
554
|
+
if (viz.fields) {
|
|
555
|
+
var projectTransformations = [];
|
|
556
|
+
var groupByColumns = [];
|
|
557
|
+
var aggrFields = [];
|
|
558
|
+
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
559
|
+
var field = _e[_d];
|
|
560
|
+
if (field.properties && field.properties.function) {
|
|
561
|
+
switch (field.properties.function) {
|
|
562
|
+
case "SUM":
|
|
563
|
+
case "MIN":
|
|
564
|
+
case "MAX":
|
|
565
|
+
aggrFields.push({
|
|
566
|
+
type: this.func2aggr(field.properties.function),
|
|
567
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
568
|
+
fieldID: this.toLowerCase(field.id)
|
|
569
|
+
});
|
|
570
|
+
break;
|
|
571
|
+
case "AVE":
|
|
572
|
+
aggrFields.push({
|
|
573
|
+
type: this.func2aggr(field.properties.function),
|
|
574
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
575
|
+
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
576
|
+
fieldID: this.toLowerCase(field.id)
|
|
577
|
+
});
|
|
578
|
+
break;
|
|
579
|
+
case "SCALE":
|
|
580
|
+
if (typeof field.properties.params.param1 === "object") {
|
|
581
|
+
var props = field.properties.params.param1;
|
|
582
|
+
switch (props.function) {
|
|
583
|
+
case "SUM":
|
|
584
|
+
case "MIN":
|
|
585
|
+
case "MAX":
|
|
586
|
+
aggrFields.push({
|
|
587
|
+
type: this.func2aggr(props.function),
|
|
588
|
+
inFieldID: this.toLowerCase(props.params.param1),
|
|
589
|
+
fieldID: this.toLowerCase(field.id)
|
|
590
|
+
});
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
projectTransformations.push({
|
|
595
|
+
type: "scale",
|
|
596
|
+
sourceFieldID: this.toLowerCase(field.id),
|
|
597
|
+
fieldID: this.toLowerCase(field.id),
|
|
598
|
+
factor: +field.properties.params.param2
|
|
599
|
+
});
|
|
600
|
+
break;
|
|
601
|
+
default:
|
|
602
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
603
|
+
throw new Error("Unhandled field function: ".concat(field.properties.function));
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (projectTransformations.length) {
|
|
611
|
+
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
612
|
+
}
|
|
613
|
+
if (aggrFields.length) {
|
|
614
|
+
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
|
|
615
|
+
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
622
|
+
switch (func) {
|
|
623
|
+
case "SUM":
|
|
624
|
+
return "sum";
|
|
625
|
+
case "AVE":
|
|
626
|
+
return "mean";
|
|
627
|
+
case "MIN":
|
|
628
|
+
return "min";
|
|
629
|
+
case "MAX":
|
|
630
|
+
return "max";
|
|
631
|
+
}
|
|
632
|
+
throw new Error("Unknown DDL1 Function Type: ".concat(func));
|
|
633
|
+
};
|
|
634
|
+
DDLUpgrade.prototype.readMappings = function () {
|
|
635
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
636
|
+
var dash = _a[_i];
|
|
637
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
638
|
+
var viz = _c[_b];
|
|
639
|
+
if (isFormVisualization(viz)) ;
|
|
640
|
+
else if (isPieVisualization(viz)) {
|
|
641
|
+
this.readPieMappings(viz);
|
|
642
|
+
}
|
|
643
|
+
else if (isChoroVisualization(viz)) {
|
|
644
|
+
this.readChoroMappings(viz);
|
|
645
|
+
}
|
|
646
|
+
else if (isLineVisualization(viz)) {
|
|
647
|
+
this.readLineMappings(viz);
|
|
648
|
+
}
|
|
649
|
+
else if (isTableVisualization(viz)) {
|
|
650
|
+
this.readTableMappings(viz);
|
|
651
|
+
}
|
|
652
|
+
else if (isGraphVisualization(viz)) {
|
|
653
|
+
this.readGraphMappings(viz);
|
|
654
|
+
}
|
|
655
|
+
else if (isSliderVisualization(viz)) {
|
|
656
|
+
this.readSliderMappings(viz);
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
665
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
666
|
+
mappings.transformations.push({
|
|
667
|
+
fieldID: "label",
|
|
668
|
+
type: "=",
|
|
669
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
670
|
+
});
|
|
671
|
+
mappings.transformations.push({
|
|
672
|
+
fieldID: "weight",
|
|
673
|
+
type: "=",
|
|
674
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
675
|
+
});
|
|
676
|
+
};
|
|
677
|
+
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
678
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
679
|
+
mappings.transformations.push({
|
|
680
|
+
fieldID: "label",
|
|
681
|
+
type: "=",
|
|
682
|
+
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
683
|
+
});
|
|
684
|
+
mappings.transformations.push({
|
|
685
|
+
fieldID: "weight",
|
|
686
|
+
type: "=",
|
|
687
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
691
|
+
return mapping.state || mapping.county || mapping.geohash;
|
|
692
|
+
};
|
|
693
|
+
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
694
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
695
|
+
mappings.transformations.push({
|
|
696
|
+
fieldID: viz.source.mappings.x[0],
|
|
697
|
+
type: "=",
|
|
698
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
699
|
+
});
|
|
700
|
+
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
701
|
+
mappings.transformations.push({
|
|
702
|
+
fieldID: viz.source.mappings.y[i],
|
|
703
|
+
type: "=",
|
|
704
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
709
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
710
|
+
for (var i = 0; i < viz.label.length; ++i) {
|
|
711
|
+
mappings.transformations.push({
|
|
712
|
+
fieldID: viz.label[i],
|
|
713
|
+
type: "=",
|
|
714
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
719
|
+
if (annotation === void 0) { annotation = false; }
|
|
720
|
+
var retVal = [];
|
|
721
|
+
if (valueMappings) {
|
|
722
|
+
for (var value in valueMappings) {
|
|
723
|
+
var newValue = {};
|
|
724
|
+
for (var key in valueMappings[value]) {
|
|
725
|
+
if (key === "faChar") {
|
|
726
|
+
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
727
|
+
}
|
|
728
|
+
else if (annotation && key.indexOf("icon_") === 0) {
|
|
729
|
+
console.warn("Deprecated flag property: " + key);
|
|
730
|
+
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
newValue[key] = valueMappings[value][key];
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
737
|
+
if (!annotation || value !== "0") {
|
|
738
|
+
retVal.push({
|
|
739
|
+
value: value,
|
|
740
|
+
newValue: newValue
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return retVal;
|
|
746
|
+
};
|
|
747
|
+
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
748
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
749
|
+
mappings.transformations.push({
|
|
750
|
+
fieldID: "uid",
|
|
751
|
+
type: "=",
|
|
752
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
753
|
+
});
|
|
754
|
+
mappings.transformations.push({
|
|
755
|
+
fieldID: "label",
|
|
756
|
+
type: "=",
|
|
757
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
758
|
+
});
|
|
759
|
+
if (viz.icon.fieldid) {
|
|
760
|
+
mappings.transformations.push({
|
|
761
|
+
fieldID: "icon",
|
|
762
|
+
type: "map",
|
|
763
|
+
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
764
|
+
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
765
|
+
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
var idx = 0;
|
|
769
|
+
if (viz.flag) {
|
|
770
|
+
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
771
|
+
var flag = _a[_i];
|
|
772
|
+
if (flag.fieldid) {
|
|
773
|
+
mappings.transformations.push({
|
|
774
|
+
fieldID: "annotation_".concat(idx++),
|
|
775
|
+
type: "map",
|
|
776
|
+
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
777
|
+
default: {},
|
|
778
|
+
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
mappings.transformations.push({
|
|
784
|
+
fieldID: "links",
|
|
785
|
+
type: "=",
|
|
786
|
+
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
787
|
+
transformations: [{
|
|
788
|
+
fieldID: "uid",
|
|
789
|
+
type: "=",
|
|
790
|
+
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
791
|
+
}]
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
795
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
796
|
+
mappings.transformations.push({
|
|
797
|
+
fieldID: "label",
|
|
798
|
+
type: "=",
|
|
799
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
800
|
+
});
|
|
801
|
+
};
|
|
802
|
+
DDLUpgrade.prototype.readFilters = function () {
|
|
803
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
804
|
+
var dash = _a[_i];
|
|
805
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
806
|
+
var viz = _c[_b];
|
|
807
|
+
if (viz.events) {
|
|
808
|
+
for (var eventID in viz.events) {
|
|
809
|
+
var event_1 = viz.events[eventID];
|
|
810
|
+
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
811
|
+
var update = _e[_d];
|
|
812
|
+
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
813
|
+
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
814
|
+
if (update.mappings) {
|
|
815
|
+
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
816
|
+
for (var key in update.mappings) {
|
|
817
|
+
otherViz.datasource.request.push({
|
|
818
|
+
source: viz.id,
|
|
819
|
+
remoteFieldID: this.toLowerCase(key),
|
|
820
|
+
localFieldID: this.toLowerCase(update.mappings[key])
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
var condition = {
|
|
826
|
+
viewID: viz.id,
|
|
827
|
+
mappings: []
|
|
828
|
+
};
|
|
829
|
+
for (var key in update.mappings) {
|
|
830
|
+
var mapping = update.mappings[key];
|
|
831
|
+
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
832
|
+
if (!dsFilter) {
|
|
833
|
+
console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
condition.mappings.push({
|
|
837
|
+
remoteFieldID: this.toLowerCase(key),
|
|
838
|
+
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
839
|
+
condition: this.rule2condition(dsFilter.rule),
|
|
840
|
+
nullable: dsFilter.nullable
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
854
|
+
switch (_) {
|
|
855
|
+
case "set":
|
|
856
|
+
return "in";
|
|
857
|
+
case "notequals":
|
|
858
|
+
return "!=";
|
|
859
|
+
}
|
|
860
|
+
return _;
|
|
861
|
+
};
|
|
862
|
+
DDLUpgrade.prototype.readSort = function () {
|
|
863
|
+
var _this = this;
|
|
864
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
865
|
+
var dash = _a[_i];
|
|
866
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
867
|
+
var viz = _c[_b];
|
|
868
|
+
if (viz.source) {
|
|
869
|
+
if (viz.source.sort) {
|
|
870
|
+
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
871
|
+
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
872
|
+
if (s.indexOf("-") === 0) {
|
|
873
|
+
return {
|
|
874
|
+
fieldID: _this.toLowerCase(s.substr(1)),
|
|
875
|
+
descending: true
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
fieldID: _this.toLowerCase(s),
|
|
880
|
+
descending: false
|
|
881
|
+
};
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
if (viz.source.first) {
|
|
885
|
+
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
886
|
+
vizLimit.limit = +viz.source.first;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
893
|
+
var project = {
|
|
894
|
+
type: "project",
|
|
895
|
+
transformations: []
|
|
896
|
+
};
|
|
897
|
+
var filters = {
|
|
898
|
+
type: "filter",
|
|
899
|
+
conditions: []
|
|
900
|
+
};
|
|
901
|
+
var groupBy = {
|
|
902
|
+
type: "groupby",
|
|
903
|
+
groupByIDs: [],
|
|
904
|
+
aggregates: []
|
|
905
|
+
};
|
|
906
|
+
var sort = {
|
|
907
|
+
type: "sort",
|
|
908
|
+
conditions: []
|
|
909
|
+
};
|
|
910
|
+
var limit = {
|
|
911
|
+
type: "limit",
|
|
912
|
+
limit: 0
|
|
913
|
+
};
|
|
914
|
+
var mappings = {
|
|
915
|
+
type: "mappings",
|
|
916
|
+
transformations: []
|
|
917
|
+
};
|
|
918
|
+
this._ddl2DataviewActivities[viz.id] = {
|
|
919
|
+
project: project,
|
|
920
|
+
filters: filters,
|
|
921
|
+
sort: sort,
|
|
922
|
+
groupBy: groupBy,
|
|
923
|
+
limit: limit,
|
|
924
|
+
mappings: mappings
|
|
925
|
+
};
|
|
926
|
+
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
927
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
928
|
+
request: [],
|
|
929
|
+
output: this._datasourceUpdates[viz.id].output
|
|
930
|
+
} : {
|
|
931
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
932
|
+
output: this._datasourceUpdates[viz.id].output
|
|
933
|
+
};
|
|
934
|
+
return {
|
|
935
|
+
id: viz.id,
|
|
936
|
+
datasource: datasourceRef,
|
|
937
|
+
activities: [
|
|
938
|
+
project,
|
|
939
|
+
filters,
|
|
940
|
+
sort,
|
|
941
|
+
groupBy,
|
|
942
|
+
limit
|
|
943
|
+
],
|
|
944
|
+
visualization: __assign(__assign({ id: viz.id, title: viz.title || "", description: "", visibility: viz.properties && viz.properties.flyout === true ? "flyout" : "normal" }, this.type2chartType(viz.type)), { mappings: mappings, properties: (viz.properties || {}) })
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
948
|
+
switch (chartType) {
|
|
949
|
+
case "LINE":
|
|
950
|
+
return { chartType: "Line", __class: "chart_Line" };
|
|
951
|
+
case "BUBBLE":
|
|
952
|
+
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
953
|
+
case "PIE":
|
|
954
|
+
return { chartType: "Pie", __class: "chart_Pie" };
|
|
955
|
+
case "BAR":
|
|
956
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
957
|
+
case "FORM":
|
|
958
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
959
|
+
case "WORD_CLOUD":
|
|
960
|
+
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
961
|
+
case "CHORO":
|
|
962
|
+
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
963
|
+
case "SUMMARY":
|
|
964
|
+
return { chartType: "Summary", __class: "chart_Summary" };
|
|
965
|
+
case "SLIDER":
|
|
966
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
967
|
+
case "HEAT_MAP":
|
|
968
|
+
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
969
|
+
case "2DCHART":
|
|
970
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
971
|
+
case "GRAPH":
|
|
972
|
+
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
973
|
+
case "TABLE":
|
|
974
|
+
default:
|
|
975
|
+
return { chartType: "Table", __class: "dgrid_Table" };
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
979
|
+
var _this = this;
|
|
980
|
+
if (slider === void 0) { slider = false; }
|
|
981
|
+
if (!fields)
|
|
982
|
+
return [];
|
|
983
|
+
return fields.map(function (field) {
|
|
984
|
+
switch (field.properties.type) {
|
|
985
|
+
case "range":
|
|
986
|
+
return {
|
|
987
|
+
type: "range",
|
|
988
|
+
id: field.id,
|
|
989
|
+
default: (field.properties.default ? field.properties.default : undefined)
|
|
990
|
+
};
|
|
991
|
+
case "dataset":
|
|
992
|
+
return {
|
|
993
|
+
type: "dataset",
|
|
994
|
+
id: field.id,
|
|
995
|
+
default: [],
|
|
996
|
+
children: []
|
|
997
|
+
};
|
|
998
|
+
default:
|
|
999
|
+
return {
|
|
1000
|
+
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
1001
|
+
id: field.id,
|
|
1002
|
+
default: field.properties.default ? field.properties.default[0] : undefined
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
1008
|
+
switch (fieldType) {
|
|
1009
|
+
case "bool":
|
|
1010
|
+
case "boolean":
|
|
1011
|
+
return "boolean";
|
|
1012
|
+
case "integer":
|
|
1013
|
+
case "unsigned":
|
|
1014
|
+
case "float":
|
|
1015
|
+
case "double":
|
|
1016
|
+
case "real":
|
|
1017
|
+
return "number";
|
|
1018
|
+
case "string":
|
|
1019
|
+
return "string";
|
|
1020
|
+
default:
|
|
1021
|
+
return slider ? "number" : "string";
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
1025
|
+
target[output.from || output.id] = {
|
|
1026
|
+
fields: this.filters2fields(output.filter)
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
1030
|
+
if (!filters)
|
|
1031
|
+
return [];
|
|
1032
|
+
return filters.filter(function (filter) {
|
|
1033
|
+
var idParts = filter.fieldid.split("-");
|
|
1034
|
+
return idParts.length === 1 || idParts[1] === "range";
|
|
1035
|
+
}).map(function (filter) {
|
|
1036
|
+
var idParts = filter.fieldid.split("-");
|
|
1037
|
+
var retVal = {
|
|
1038
|
+
type: "string",
|
|
1039
|
+
id: idParts[0]
|
|
1040
|
+
};
|
|
1041
|
+
return retVal;
|
|
1042
|
+
});
|
|
1043
|
+
};
|
|
1044
|
+
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
1045
|
+
return {
|
|
1046
|
+
type: "string",
|
|
1047
|
+
id: "",
|
|
1048
|
+
default: ""
|
|
1049
|
+
};
|
|
1050
|
+
};
|
|
1051
|
+
DDLUpgrade.prototype.writeDatasources = function () {
|
|
1052
|
+
var retVal = [];
|
|
1053
|
+
for (var id in this._ddl2Datasources) {
|
|
1054
|
+
retVal.push(this._ddl2Datasources[id]);
|
|
1055
|
+
}
|
|
1056
|
+
return retVal;
|
|
1057
|
+
};
|
|
1058
|
+
DDLUpgrade.prototype.writeDataviews = function () {
|
|
1059
|
+
var retVal = [];
|
|
1060
|
+
for (var id in this._ddl2Dataviews) {
|
|
1061
|
+
retVal.push(this._ddl2Dataviews[id]);
|
|
1062
|
+
}
|
|
1063
|
+
return retVal;
|
|
1064
|
+
};
|
|
1065
|
+
DDLUpgrade.prototype.writeProperties = function () {
|
|
1066
|
+
return {
|
|
1067
|
+
// TODO
|
|
1068
|
+
};
|
|
1069
|
+
};
|
|
1070
|
+
DDLUpgrade.prototype.write = function () {
|
|
1071
|
+
return {
|
|
1072
|
+
version: "2.2.1",
|
|
1073
|
+
createdBy: {
|
|
1074
|
+
name: PKG_NAME,
|
|
1075
|
+
version: PKG_VERSION
|
|
1076
|
+
},
|
|
1077
|
+
datasources: this.writeDatasources(),
|
|
1078
|
+
dataviews: this.writeDataviews(),
|
|
1079
|
+
properties: this.writeProperties()
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
return DDLUpgrade;
|
|
1083
|
+
}());
|
|
1084
|
+
function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
|
|
1085
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1086
|
+
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
1087
|
+
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1088
|
+
var retVal = ddlUp.write();
|
|
1089
|
+
retVal.properties = upgrade$1(retVal, dermatologyJson);
|
|
1090
|
+
return retVal;
|
|
1091
1091
|
}
|
|
1092
1092
|
|
|
1093
1093
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -9811,28 +9811,28 @@
|
|
|
9811
9811
|
'default': v2
|
|
9812
9812
|
});
|
|
9813
9813
|
|
|
9814
|
-
var Ajv = ajv || _Ajv;
|
|
9815
|
-
var ddl2Schema = _ddl2Schema;
|
|
9816
|
-
var options = {
|
|
9817
|
-
allErrors: false,
|
|
9818
|
-
verbose: true,
|
|
9819
|
-
jsonPointers: false
|
|
9820
|
-
};
|
|
9821
|
-
function doValidate(ddl, schema) {
|
|
9822
|
-
var ajv = new Ajv(options);
|
|
9823
|
-
var validate = ajv.compile(schema);
|
|
9824
|
-
var success = validate(ddl);
|
|
9825
|
-
return {
|
|
9826
|
-
success: success,
|
|
9827
|
-
errors: validate.errors
|
|
9828
|
-
};
|
|
9829
|
-
}
|
|
9830
|
-
function validate2(ddl) {
|
|
9831
|
-
return doValidate(ddl, _ddl2Schema);
|
|
9814
|
+
var Ajv = ajv || _Ajv;
|
|
9815
|
+
var ddl2Schema = _ddl2Schema;
|
|
9816
|
+
var options = {
|
|
9817
|
+
allErrors: false,
|
|
9818
|
+
verbose: true,
|
|
9819
|
+
jsonPointers: false
|
|
9820
|
+
};
|
|
9821
|
+
function doValidate(ddl, schema) {
|
|
9822
|
+
var ajv = new Ajv(options);
|
|
9823
|
+
var validate = ajv.compile(schema);
|
|
9824
|
+
var success = validate(ddl);
|
|
9825
|
+
return {
|
|
9826
|
+
success: success,
|
|
9827
|
+
errors: validate.errors
|
|
9828
|
+
};
|
|
9829
|
+
}
|
|
9830
|
+
function validate2(ddl) {
|
|
9831
|
+
return doValidate(ddl, _ddl2Schema);
|
|
9832
9832
|
}
|
|
9833
9833
|
|
|
9834
|
-
function isDDL2Schema(ref) {
|
|
9835
|
-
return ref.version !== undefined && ref.datasources !== undefined && ref.dataviews !== undefined;
|
|
9834
|
+
function isDDL2Schema(ref) {
|
|
9835
|
+
return ref.version !== undefined && ref.datasources !== undefined && ref.dataviews !== undefined;
|
|
9836
9836
|
}
|
|
9837
9837
|
|
|
9838
9838
|
exports.BUILD_VERSION = BUILD_VERSION;
|