@hpcc-js/eclwatch 2.76.1 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.js +51 -1650
  2. package/dist/index.js.map +7 -1
  3. package/package.json +38 -42
  4. package/src/WUGraph.ts +2 -2
  5. package/src/WUResult.ts +32 -21
  6. package/src/WUResultStore.ts +1 -1
  7. package/src/WUScopeController.ts +1 -1
  8. package/src/__package__.ts +2 -2
  9. package/src/index.ts +7 -7
  10. package/types/ECLArchiveViewer.d.ts +0 -1
  11. package/types/WUGraph.d.ts +1 -2
  12. package/types/WUGraphLegend.d.ts +0 -1
  13. package/types/WUResult.d.ts +21 -38
  14. package/types/WUResultStore.d.ts +0 -1
  15. package/types/WUScopeController.d.ts +1 -2
  16. package/types/WUStatus.d.ts +0 -1
  17. package/types/WUTimeline.d.ts +0 -1
  18. package/types/__package__.d.ts +2 -3
  19. package/types/index.d.ts +7 -8
  20. package/dist/index.es6.js +0 -1647
  21. package/dist/index.es6.js.map +0 -1
  22. package/dist/index.min.js +0 -2
  23. package/dist/index.min.js.map +0 -1
  24. package/types/ECLArchiveViewer.d.ts.map +0 -1
  25. package/types/WUGraph.d.ts.map +0 -1
  26. package/types/WUGraphLegend.d.ts.map +0 -1
  27. package/types/WUResult.d.ts.map +0 -1
  28. package/types/WUResultStore.d.ts.map +0 -1
  29. package/types/WUScopeController.d.ts.map +0 -1
  30. package/types/WUStatus.d.ts.map +0 -1
  31. package/types/WUTimeline.d.ts.map +0 -1
  32. package/types/__package__.d.ts.map +0 -1
  33. package/types/index.d.ts.map +0 -1
  34. package/types-3.4/ECLArchiveViewer.d.ts +0 -48
  35. package/types-3.4/WUGraph.d.ts +0 -44
  36. package/types-3.4/WUGraphLegend.d.ts +0 -22
  37. package/types-3.4/WUResult.d.ts +0 -53
  38. package/types-3.4/WUResultStore.d.ts +0 -27
  39. package/types-3.4/WUScopeController.d.ts +0 -65
  40. package/types-3.4/WUStatus.d.ts +0 -40
  41. package/types-3.4/WUTimeline.d.ts +0 -24
  42. package/types-3.4/__package__.d.ts +0 -4
  43. package/types-3.4/index.d.ts +0 -8
package/dist/index.js CHANGED
@@ -1,1651 +1,52 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/codemirror'), require('@hpcc-js/comms'), require('@hpcc-js/phosphor'), require('@hpcc-js/tree'), require('@hpcc-js/util'), require('@hpcc-js/common'), require('@hpcc-js/dgrid'), require('@hpcc-js/graph'), require('@hpcc-js/layout'), require('@hpcc-js/timeline')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/codemirror', '@hpcc-js/comms', '@hpcc-js/phosphor', '@hpcc-js/tree', '@hpcc-js/util', '@hpcc-js/common', '@hpcc-js/dgrid', '@hpcc-js/graph', '@hpcc-js/layout', '@hpcc-js/timeline'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/eclwatch"] = {}, global["@hpcc-js/codemirror"], global["@hpcc-js/comms"], global["@hpcc-js/phosphor"], global["@hpcc-js/tree"], global["@hpcc-js/util"], global["@hpcc-js/common"], global["@hpcc-js/dgrid"], global["@hpcc-js/graph"], global["@hpcc-js/layout"], global["@hpcc-js/timeline"]));
5
- })(this, (function (exports, codemirror, comms, phosphor, tree, util, common, dgrid, graph, layout, timeline) {
6
- var PKG_NAME = "@hpcc-js/eclwatch";
7
- var PKG_VERSION = "2.76.1";
8
- var BUILD_VERSION = "2.107.1";
9
-
10
- /******************************************************************************
11
- Copyright (c) Microsoft Corporation.
12
-
13
- Permission to use, copy, modify, and/or distribute this software for any
14
- purpose with or without fee is hereby granted.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
- PERFORMANCE OF THIS SOFTWARE.
23
- ***************************************************************************** */
24
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
25
-
26
- var extendStatics = function(d, b) {
27
- extendStatics = Object.setPrototypeOf ||
28
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
30
- return extendStatics(d, b);
31
- };
32
-
33
- function __extends(d, b) {
34
- if (typeof b !== "function" && b !== null)
35
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
36
- extendStatics(d, b);
37
- function __() { this.constructor = d; }
38
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39
- }
40
-
41
- var __assign = function() {
42
- __assign = Object.assign || function __assign(t) {
43
- for (var s, i = 1, n = arguments.length; i < n; i++) {
44
- s = arguments[i];
45
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
46
- }
47
- return t;
48
- };
49
- return __assign.apply(this, arguments);
50
- };
51
-
52
- function __decorate(decorators, target, key, desc) {
53
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
54
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
55
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
56
- return c > 3 && r && Object.defineProperty(target, key, r), r;
57
- }
58
-
59
- function __metadata(metadataKey, metadataValue) {
60
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
61
- }
62
-
63
- function __spreadArray(to, from, pack) {
64
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
65
- if (ar || !(i in from)) {
66
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
67
- ar[i] = from[i];
68
- }
69
- }
70
- return to.concat(ar || Array.prototype.slice.call(from));
71
- }
72
-
73
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
74
- var e = new Error(message);
75
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
76
- };
77
-
78
- var ECLArchiveViewer = /** @class */ (function (_super) {
79
- __extends(ECLArchiveViewer, _super);
80
- function ECLArchiveViewer() {
81
- var _this = _super.call(this, "horizontal") || this;
82
- _this._directoryPane = new tree.DirectoryTree();
83
- _this._fileEditorPane = new codemirror.Editor()
84
- .text("");
85
- _this._directoryPane.rowClick = function (text) {
86
- _this._fileEditorPane
87
- .text(text)
88
- .render();
89
- };
90
- return _this;
91
- }
92
- ECLArchiveViewer.prototype.transformArchiveTreeData = function (json) {
93
- var ret = {
94
- label: json.name,
95
- children: json._children.map(transformNode).filter(function (n) { return n; })
96
- };
97
- if (ret.children && ret.children[0] && ret.children[0].label === "html") {
98
- // must be parsererror
99
- return {
100
- label: "root",
101
- children: [
102
- {
103
- label: "error",
104
- content: JSON.stringify(ret, null, 4)
105
- }
106
- ]
107
- };
108
- }
109
- return ret;
110
- function transformNode(node) {
111
- var _node = {};
112
- _node.label = node.name + (node["$"] && node["$"].key ? " (".concat(node["$"].key, ")") : "");
113
- if (node._children && node._children.length > 0) {
114
- _node.children = node._children.map(function (_node) {
115
- return transformNode(_node);
116
- })
117
- .filter(function (n) { return n; });
118
- }
119
- else if (typeof node.content === "string" && node.content.trim()) {
120
- _node.content = node.content;
121
- }
122
- else {
123
- return false;
124
- }
125
- return _node;
126
- }
127
- };
128
- ECLArchiveViewer.prototype.updateDirectoryPane = function (contentStr) {
129
- var json;
130
- if (contentStr) {
131
- try {
132
- json = JSON.parse(contentStr);
133
- }
134
- catch (e) {
135
- json = util.xml2json(contentStr);
136
- }
137
- }
138
- if (json) {
139
- var _data = this.transformArchiveTreeData(json);
140
- this._directoryPane
141
- .data(_data)
142
- .render();
143
- }
144
- };
145
- ECLArchiveViewer.prototype.enter = function (domNode, element) {
146
- _super.prototype.enter.call(this, domNode, element);
147
- this
148
- .addWidget(this._directoryPane)
149
- .addWidget(this._fileEditorPane);
150
- };
151
- ECLArchiveViewer.prototype.update = function (domNode, element) {
152
- var _this = this;
153
- _super.prototype.update.call(this, domNode, element);
154
- var hash = util.hashSum({
155
- baseUrl: this.baseUrl(),
156
- wuid: this.wuid()
157
- });
158
- if (this._prevHash !== hash || typeof this._contentStr === "undefined") {
159
- comms.Workunit.attach({ baseUrl: this.baseUrl() }, this.wuid())
160
- .fetchArchive()
161
- .then(function (resp) {
162
- _this._contentStr = resp;
163
- _this.updateDirectoryPane(_this._contentStr);
164
- _this._prevHash = hash;
165
- });
166
- }
167
- else {
168
- this.updateDirectoryPane(this._contentStr);
169
- }
170
- this.relativeSizes([this.directoryWidthRatio(), 1 - this.directoryWidthRatio()]);
171
- };
172
- return ECLArchiveViewer;
173
- }(phosphor.SplitPanel));
174
- ECLArchiveViewer.prototype._class += " eclwatch_ECLArchiveViewer";
175
- ECLArchiveViewer.prototype.publish("baseUrl", "", "string", "HPCC Platform Base URL");
176
- ECLArchiveViewer.prototype.publish("wuid", "", "string", "Workunit ID");
177
- ECLArchiveViewer.prototype.publish("directoryWidthRatio", 0.38, "number", "Default directory panel width ratio relative to the full width");
178
- ECLArchiveViewer.prototype.publish("contentString", null, "string", "XML/JSON archive content string");
179
- ECLArchiveViewer.prototype.publishProxy("directoryPaneColor", "_directoryPane", "backgroundColor");
180
- ECLArchiveViewer.prototype.publishProxy("directoryPaneHoverColor", "_directoryPane", "hoverBackgroundColor");
181
- ECLArchiveViewer.prototype.publishProxy("iconSize", "_directoryPane");
182
- ECLArchiveViewer.prototype.publishProxy("fontColor", "_directoryPane");
183
- ECLArchiveViewer.prototype.publishProxy("fontFamily", "_directoryPane");
184
- ECLArchiveViewer.prototype.publishProxy("fontSize", "_directoryPane");
185
- ECLArchiveViewer.prototype.publishProxy("folderIconOpen", "_directoryPane");
186
- ECLArchiveViewer.prototype.publishProxy("folderIconClosed", "_directoryPane");
187
- ECLArchiveViewer.prototype.publishProxy("textFileIcon", "_directoryPane");
188
- ECLArchiveViewer.prototype.publishProxy("codeFileIcon", "_directoryPane");
189
- ECLArchiveViewer.prototype.publishProxy("verticalScroll", "_directoryPane");
190
-
191
- function styleInject(css, ref) {
192
- if ( ref === void 0 ) ref = {};
193
- var insertAt = ref.insertAt;
194
-
195
- if (!css || typeof document === 'undefined') { return; }
196
-
197
- var head = document.head || document.getElementsByTagName('head')[0];
198
- var style = document.createElement('style');
199
- style.type = 'text/css';
200
-
201
- if (insertAt === 'top') {
202
- if (head.firstChild) {
203
- head.insertBefore(style, head.firstChild);
204
- } else {
205
- head.appendChild(style);
206
- }
207
- } else {
208
- head.appendChild(style);
209
- }
210
-
211
- if (style.styleSheet) {
212
- style.styleSheet.cssText = css;
213
- } else {
214
- style.appendChild(document.createTextNode(css));
215
- }
216
- }
217
-
218
- var css_248z$1 = ".eclwatch_WUGraphLegend .graph_Vertex{cursor:auto}.eclwatch_WUGraphLegend .graph_Vertex .common_Icon{cursor:pointer}";
219
- styleInject(css_248z$1);
220
-
221
- var LegendVertex = /** @class */ (function (_super) {
222
- __extends(LegendVertex, _super);
223
- function LegendVertex() {
224
- return _super.call(this) || this;
225
- }
226
- LegendVertex.prototype.enter = function (domNode, element) {
227
- var _this = this;
228
- _super.prototype.enter.call(this, domNode, element);
229
- this._icon.on("click", function () {
230
- _this.click(_this.data());
231
- });
232
- };
233
- LegendVertex.prototype.click = function (kind) {
234
- };
235
- return LegendVertex;
236
- }(graph.Vertex));
237
- var WUGraphLegend = /** @class */ (function (_super) {
238
- __extends(WUGraphLegend, _super);
239
- function WUGraphLegend() {
240
- var _this = _super !== null && _super.apply(this, arguments) || this;
241
- _this.icon = common.local();
242
- _this._disabled2 = {
243
- /* TODO: Default some to disabled?
244
- 43: true,
245
- 71: true,
246
- 82: true,
247
- 88: true
248
- */
249
- };
250
- return _this;
251
- }
252
- WUGraphLegend.prototype.disabled = function (_) {
253
- var _this = this;
254
- if (!arguments.length) {
255
- var retVal = [];
256
- for (var key in this._disabled2) {
257
- if (this._disabled2[key]) {
258
- retVal.push(key);
259
- }
260
- }
261
- return retVal;
262
- }
263
- this._disabled2 = {};
264
- _.forEach(function (kind) { return _this._disabled2[kind] = true; });
265
- return this;
266
- };
267
- WUGraphLegend.prototype.toggle = function (kind) {
268
- this._disabled2[kind] = !this._disabled2[kind];
269
- };
270
- WUGraphLegend.prototype.update = function (domNode, element) {
271
- _super.prototype.update.call(this, domNode, element);
272
- var context = this;
273
- var items = this._g.selectAll(".legendItem").data(this.data(), function (d) { return d.kind; });
274
- items.enter().append("g")
275
- .attr("class", "legendItem")
276
- .each(function (d) {
277
- context.icon.set(this, new LegendVertex()
278
- .target(this)
279
- .data(d.kind)
280
- .textbox_shape_colorStroke("none")
281
- .textbox_shape_colorFill("none")
282
- .iconAnchor("left")
283
- .faChar(d.faChar)
284
- .text("".concat(d.label, " (").concat(d.count, ")"))
285
- .tooltip("".concat(d.kind, " - ").concat(d.label))
286
- .on("click", function (kind) {
287
- context.toggle(kind);
288
- context.render();
289
- context.click(kind);
290
- })
291
- .on("mouseover", function (kind) {
292
- context.mouseover(kind);
293
- })
294
- .on("mouseout", function (kind) {
295
- context.mouseout(kind);
296
- }));
297
- })
298
- .merge(items)
299
- .each(function (d, i) {
300
- var bbox = context.icon.get(this)
301
- .icon_shape_colorFill(context._disabled2[d.kind] ? "gray" : null)
302
- .render().getBBox();
303
- common.select(this)
304
- .attr("transform", "translate(".concat(+bbox.width / 2, ", ").concat(i * 30, ")"));
305
- });
306
- items.exit()
307
- .each(function (d) {
308
- context.icon.get(this)
309
- .target(null)
310
- .render();
311
- })
312
- .remove();
313
- var bbox = this.getBBox(true, true);
314
- this._g.attr("transform", "translate(16, ".concat(this.height() / 2 - bbox.height / 2, ")"));
315
- };
316
- // Events ---
317
- WUGraphLegend.prototype.click = function (kind) {
318
- };
319
- WUGraphLegend.prototype.mouseover = function (kind) {
320
- };
321
- WUGraphLegend.prototype.mouseout = function (kind) {
322
- };
323
- return WUGraphLegend;
324
- }(layout.Legend));
325
- WUGraphLegend.prototype._class += " eclwatch_WUGraphLegend";
326
-
327
- function faCharFactory(kind) {
328
- switch (kind) {
329
- case "2": return "\uf0c7"; // Disk Write
330
- case "3": return "\uf15d"; // sort
331
- case "5": return "\uf0b0"; // Filter
332
- case "6": return "\uf1e0"; // Split
333
- case "12": return "\uf039"; // First N
334
- case "15": return "\uf126"; // Lightweight Join
335
- case "17": return "\uf126"; // Lookup Join
336
- case "22": return "\uf1e6"; // Pipe Output
337
- case "23": return "\uf078"; // Funnel
338
- case "25": return "\uf0ce"; // Inline Dataset
339
- case "26": return "\uf074"; // distribute
340
- case "29": return "\uf005"; // Store Internal Result
341
- case "36": return "\uf128"; // If
342
- case "44": return "\uf0c7"; // write csv
343
- case "47": return "\uf0c7"; // write
344
- case "54": return "\uf013"; // Workunit Read
345
- case "56": return "\uf0c7"; // Spill
346
- case "59": return "\uf126"; // Merge
347
- case "61": return "\uf0c7"; // write xml
348
- case "82": return "\uf1c0"; // Projected Disk Read Spill
349
- case "88": return "\uf1c0"; // Projected Disk Read Spill
350
- case "92": return "\uf129"; // Limted Index Read
351
- case "93": return "\uf129"; // Limted Index Read
352
- case "99": return "\uf1c0"; // CSV Read
353
- case "105": return "\uf1c0"; // CSV Read
354
- case "7": return "\uf090"; // Project
355
- case "9": return "\uf0e2"; // Local Iterate
356
- case "16": return "\uf005"; // Output Internal
357
- case "19": return "\uf074"; // Hash Distribute
358
- case "21": return "\uf275"; // Normalize
359
- case "35": return "\uf0c7"; // CSV Write
360
- case "37": return "\uf0c7"; // Index Write
361
- case "71": return "\uf1c0"; // Disk Read Spill
362
- case "133": return "\uf0ce"; // Inline Dataset
363
- case "148": return "\uf0ce"; // Inline Dataset
364
- case "168": return "\uf275"; // Local Denormalize
365
- }
366
- return "\uf063";
367
- }
368
- var WUScopeController = /** @class */ (function () {
369
- function WUScopeController() {
370
- this.subgraphsMap = {};
371
- this.rSubgraphsMap = {};
372
- this.verticesMap = {};
373
- this.rVerticesMap = {};
374
- this.edgesMap = {};
375
- this.rEdgesMap = {};
376
- this.kindMap = {};
377
- this._disabled = {};
378
- }
379
- WUScopeController.prototype.clear = function () {
380
- this.subgraphsMap = {};
381
- this.rSubgraphsMap = {};
382
- this.verticesMap = {};
383
- this.rVerticesMap = {};
384
- this.edgesMap = {};
385
- this.rEdgesMap = {};
386
- };
387
- WUScopeController.prototype.set = function (masterGraph) {
388
- var _this = this;
389
- this.graphDB = masterGraph;
390
- this.graphGui(this.graphDB);
391
- this.kindMap = {};
392
- this.graphDB.walk(function (item) {
393
- if (item instanceof util.Subgraph) ;
394
- else if (item instanceof util.Vertex) {
395
- var kind = item._.attr("Kind").RawValue;
396
- if (!_this.kindMap[kind]) {
397
- _this.kindMap[kind] = [];
398
- }
399
- _this.kindMap[kind].push(item);
400
- }
401
- else ;
402
- });
403
- };
404
- WUScopeController.prototype.disabled = function (_) {
405
- var _this = this;
406
- if (!arguments.length) {
407
- var retVal = [];
408
- for (var key in this._disabled) {
409
- if (this._disabled[key]) {
410
- retVal.push(key);
411
- }
412
- }
413
- return retVal;
414
- }
415
- this._disabled = {};
416
- _.forEach(function (kind) { return _this._disabled[kind] = true; });
417
- return this;
418
- };
419
- WUScopeController.prototype.graphGui = function (graphDB) {
420
- var _this = this;
421
- var graphGui = {
422
- subgraphs: [],
423
- vertices: [],
424
- edges: [],
425
- hierarchy: []
426
- };
427
- graphDB.walk(function (item) {
428
- if (item instanceof util.Subgraph) {
429
- var subgraph = _this.appendSubgraph(item, graphGui.hierarchy, graphGui.subgraphs);
430
- subgraph.showMinMax(item.vertices.length > 3 || subgraph.minState() !== "normal");
431
- }
432
- else if (item instanceof util.Vertex) {
433
- _this.appendVertex(item, graphGui.hierarchy, graphGui.vertices);
434
- }
435
- else if (item instanceof util.Edge) {
436
- _this.appendEdge(item, graphGui.edges);
437
- }
438
- });
439
- return graphGui;
440
- };
441
- WUScopeController.prototype.format = function (labelTpl, obj) {
442
- var retVal = "";
443
- var lpos = labelTpl.indexOf("%");
444
- var rpos = -1;
445
- while (lpos >= 0) {
446
- retVal += labelTpl.substring(rpos + 1, lpos);
447
- rpos = labelTpl.indexOf("%", lpos + 1);
448
- if (rpos < 0) {
449
- console.warn("Invalid Label Template");
450
- break;
451
- }
452
- var key = labelTpl.substring(lpos + 1, rpos);
453
- retVal += !key ? "%" : (obj[labelTpl.substring(lpos + 1, rpos)] || "");
454
- lpos = labelTpl.indexOf("%", rpos + 1);
455
- }
456
- retVal += labelTpl.substring(rpos + 1, labelTpl.length);
457
- return retVal.split("\\n").join("\n");
458
- };
459
- WUScopeController.prototype.createSubgraph = function (subgraph) {
460
- var _this = this;
461
- var sg = this.subgraphsMap[subgraph._.Id];
462
- if (!sg) {
463
- sg = new graph.Subgraph()
464
- .title(subgraph._.Id)
465
- .on("minClick", function () {
466
- _this.minClick(sg);
467
- });
468
- this.subgraphsMap[subgraph._.Id] = sg;
469
- this.rSubgraphsMap[sg.id()] = subgraph;
470
- }
471
- return sg;
472
- };
473
- WUScopeController.prototype.createVertex = function (vertex) {
474
- var _this = this;
475
- var v = this.verticesMap[vertex._.Id];
476
- if (!v) {
477
- var attrs = vertex._.rawAttrs();
478
- if (vertex._.ScopeType === "dummy") {
479
- var parent_1 = this.subgraphsMap[vertex.parent._.Id];
480
- v = new common.Icon()
481
- .shape_colorFill("darkred")
482
- .shape_colorStroke("darkred")
483
- .image_colorFill("white")
484
- .faChar("\uf067")
485
- .on("click", function () {
486
- parent_1.minState("normal");
487
- _this.minClick(parent_1);
488
- });
489
- }
490
- else {
491
- v = new graph.Vertex()
492
- .icon_shape_colorFill("#1f77b4")
493
- .icon_image_colorFill("white")
494
- .faChar(faCharFactory(attrs["Kind"]))
495
- .text(attrs["Label"]);
496
- var annotations = [];
497
- if (vertex._.hasAttr("Definition")) {
498
- annotations.push({
499
- faChar: "\uf036",
500
- tooltip: "Definition",
501
- shape_colorFill: "lightgray",
502
- shape_colorStroke: "lightgray",
503
- image_colorFill: "black"
504
- });
505
- }
506
- if (vertex._.hasAttr("IsInternal")) {
507
- annotations.push({
508
- faChar: "\uf085",
509
- tooltip: "IsInternal",
510
- shape_colorFill: "red",
511
- shape_colorStroke: "red",
512
- image_colorFill: "white"
513
- });
514
- }
515
- v.annotationIcons(annotations);
516
- }
517
- this.verticesMap[vertex._.Id] = v;
518
- this.rVerticesMap[v.id()] = vertex;
519
- }
520
- return v;
521
- };
522
- WUScopeController.prototype.isSpill = function (edge) {
523
- var sourceKind = edge.source._.attr("Kind").RawValue;
524
- var targetKind = edge.target._.attr("Kind").RawValue;
525
- return sourceKind === "2" || targetKind === "71";
526
- };
527
- WUScopeController.prototype.spansSubgraph = function (edge) {
528
- return edge.source.parent._.Id !== edge.target.parent._.Id;
529
- };
530
- WUScopeController.prototype.createEdge = function (edge) {
531
- var e = this.edgesMap[edge._.Id];
532
- if (!e) {
533
- var attrs = edge._.rawAttrs();
534
- var sourceV = this.verticesMap[edge.source._.Id];
535
- var targetV = this.verticesMap[edge.target._.Id];
536
- if (sourceV && targetV) {
537
- var isSpill = this.isSpill(edge);
538
- var spansSubgraph = this.spansSubgraph(edge);
539
- var label = this.format("%Label%\n%NumRowsProcessed%", attrs);
540
- /* TODO: Add extra annotations once WUDetails is fixed...
541
- const numSlaves = parseInt(attrs["NumSlaves"]);
542
- const numStarts = parseInt(attrs["NumStarts"]);
543
- const numStops = parseInt(attrs["NumStops"]);
544
- const started = numStarts > 0;
545
- const finished = numStops === numSlaves;
546
- const active = started && !finished;
547
- */
548
- var strokeDasharray = null;
549
- var weight = 100;
550
- if (attrs["IsDependency"]) {
551
- weight = 10;
552
- strokeDasharray = "1,5";
553
- }
554
- else if (attrs["_childGraph"]) {
555
- strokeDasharray = "5,5";
556
- }
557
- else if (isSpill) {
558
- weight = 25;
559
- strokeDasharray = "5,5,10,5";
560
- }
561
- else if (spansSubgraph) {
562
- weight = 5;
563
- strokeDasharray = "5,5";
564
- }
565
- e = new graph.Edge()
566
- .sourceVertex(sourceV)
567
- .targetVertex(targetV)
568
- .sourceMarker("circle")
569
- .targetMarker("arrow")
570
- .weight(weight)
571
- .strokeDasharray(strokeDasharray)
572
- .text(label);
573
- this.edgesMap[edge._.Id] = e;
574
- this.rEdgesMap[e.id()] = edge;
575
- }
576
- }
577
- return e;
578
- };
579
- WUScopeController.prototype.appendSubgraph = function (subgraph, hierarchy, subgraphs) {
580
- var sg = this.createSubgraph(subgraph);
581
- subgraphs.push(sg);
582
- var parent = this.subgraphsMap[subgraph.parent._.Id];
583
- if (parent) {
584
- hierarchy.push({ parent: parent, child: sg });
585
- }
586
- return sg;
587
- };
588
- WUScopeController.prototype.appendVertex = function (vertex, hierarchy, vertices) {
589
- var v = this.createVertex(vertex);
590
- vertices.push(v);
591
- var parent = this.subgraphsMap[vertex.parent._.Id];
592
- if (parent) {
593
- hierarchy.push({ parent: parent, child: v });
594
- }
595
- return v;
596
- };
597
- WUScopeController.prototype.appendEdge = function (edge, edges) {
598
- var e = this.createEdge(edge);
599
- if (e) {
600
- edges.push(e);
601
- }
602
- return e;
603
- };
604
- WUScopeController.prototype.filterLegend = function (graphDB) {
605
- var _loop_1 = function (i) {
606
- var vertex = graphDB.vertices[i];
607
- var kind = vertex._.attr("Kind").RawValue;
608
- if (this_1._disabled[kind]) {
609
- vertex.remove(false, function (source, target) {
610
- return new comms.BaseScope({
611
- ScopeName: vertex._.ScopeName + ":in",
612
- Id: source.Id + "->" + target.Id,
613
- ScopeType: "dummy-edge",
614
- Properties: {
615
- Property: [vertex._.attr("Label")]
616
- },
617
- Notes: {
618
- Note: []
619
- },
620
- SinkActivity: ""
621
- });
622
- });
623
- }
624
- };
625
- var this_1 = this;
626
- for (var i = graphDB.vertices.length - 1; i >= 0; --i) {
627
- _loop_1(i);
628
- }
629
- };
630
- WUScopeController.prototype.filterPartial = function (graphDB) {
631
- for (var _i = 0, _a = graphDB.subgraphs; _i < _a.length; _i++) {
632
- var subgraph = _a[_i];
633
- var sg = this.subgraphsMap[subgraph._.Id];
634
- switch (sg.minState()) {
635
- case "partial":
636
- var childVertices = subgraph.vertices;
637
- var vShow = [];
638
- var vHide = [];
639
- for (var _b = 0, childVertices_1 = childVertices; _b < childVertices_1.length; _b++) {
640
- var vertex = childVertices_1[_b];
641
- if (vertex.inEdges.length === 0 || vertex.inEdges.some(function (edge) { return edge.source.parent !== edge.target.parent; }) ||
642
- vertex.outEdges.length === 0 || vertex.outEdges.some(function (edge) { return edge.source.parent !== edge.target.parent; })) {
643
- vShow.push(vertex);
644
- }
645
- else {
646
- vHide.push(vertex);
647
- }
648
- }
649
- if (vHide.length > 1) {
650
- var dummyDetails = {
651
- ScopeName: subgraph._.ScopeName,
652
- Id: subgraph._.Id + ":dummy",
653
- ScopeType: "dummy",
654
- Properties: {
655
- Property: [{
656
- Name: "Activities",
657
- RawValue: "" + vHide.length,
658
- Formatted: "" + vHide.length,
659
- Measure: "count",
660
- Creator: "",
661
- CreatorType: ""
662
- }]
663
- },
664
- Notes: {
665
- Note: []
666
- },
667
- SinkActivity: ""
668
- };
669
- var dummyScope = new comms.BaseScope(dummyDetails);
670
- var dummyVertex = subgraph.createVertex(dummyScope);
671
- for (var _c = 0, vHide_1 = vHide; _c < vHide_1.length; _c++) {
672
- var vertex = vHide_1[_c];
673
- for (var _d = 0, _e = vertex.inEdges; _d < _e.length; _d++) {
674
- var edge = _e[_d];
675
- if (vShow.indexOf(edge.source) >= 0) {
676
- var dummyEdgeScope = new comms.BaseScope({
677
- ScopeName: edge.source._.ScopeName,
678
- Id: edge.source._.Id + "->" + dummyVertex._.Id,
679
- ScopeType: "dummy-in",
680
- Properties: {
681
- Property: []
682
- },
683
- Notes: {
684
- Note: []
685
- },
686
- SinkActivity: ""
687
- });
688
- subgraph.createEdge(edge.source, dummyVertex, dummyEdgeScope);
689
- }
690
- }
691
- for (var _f = 0, _g = vertex.outEdges; _f < _g.length; _f++) {
692
- var edge = _g[_f];
693
- if (vShow.indexOf(edge.target) >= 0) {
694
- var dummyEdgeScope = new comms.BaseScope({
695
- ScopeName: edge.target._.ScopeName,
696
- Id: dummyVertex._.Id + "->" + edge.target._.Id,
697
- ScopeType: "dummy-out",
698
- Properties: {
699
- Property: []
700
- },
701
- Notes: {
702
- Note: []
703
- },
704
- SinkActivity: ""
705
- });
706
- subgraph.createEdge(dummyVertex, edge.target, dummyEdgeScope);
707
- }
708
- }
709
- }
710
- vHide.forEach(function (vertex) { return vertex.remove(true); });
711
- }
712
- break;
713
- }
714
- }
715
- };
716
- WUScopeController.prototype.filterEmptySubgraphs = function (graphDB) {
717
- while (true) {
718
- var emptySubgraphs = graphDB.subgraphs.filter(function (subgraph) { return subgraph.subgraphs.length === 0 && subgraph.vertices.length === 0; });
719
- if (emptySubgraphs.length === 0)
720
- break;
721
- emptySubgraphs.forEach(function (subgraph) { return subgraph.remove(true); });
722
- }
723
- };
724
- WUScopeController.prototype.removeObsoleteSubgraphs = function (graphDB) {
725
- for (var _i = 0, _a = __spreadArray([], graphDB.subgraphs, true); _i < _a.length; _i++) {
726
- var subgraph = _a[_i];
727
- if (subgraph.vertices.length === 0) {
728
- subgraph.remove(false);
729
- }
730
- }
731
- };
732
- WUScopeController.prototype.graphData = function () {
733
- var graphDB = this.graphDB.clone();
734
- this.filterLegend(graphDB);
735
- this.filterPartial(graphDB);
736
- this.filterEmptySubgraphs(graphDB);
737
- this.removeObsoleteSubgraphs(graphDB);
738
- return this.graphGui(graphDB);
739
- };
740
- WUScopeController.prototype.calcLegend = function () {
741
- var retVal = [];
742
- for (var kind in this.kindMap) {
743
- retVal.push({
744
- kind: parseInt(kind),
745
- faChar: faCharFactory(kind),
746
- label: this.kindMap[kind][0]._.attr("Label").RawValue.split("\n")[0],
747
- count: this.kindMap[kind].length
748
- });
749
- }
750
- return retVal;
751
- };
752
- WUScopeController.prototype.vertices = function (kind) {
753
- var retVal = [];
754
- for (var _i = 0, _a = this.kindMap[kind]; _i < _a.length; _i++) {
755
- var v = _a[_i];
756
- retVal.push(this.verticesMap[v._.Id]);
757
- }
758
- return retVal;
759
- };
760
- WUScopeController.prototype.formatRow = function (item, columns, row) {
761
- var attrs = item._.formattedAttrs();
762
- for (var key in attrs) {
763
- var idx = columns.indexOf(key);
764
- if (idx === -1) {
765
- columns.push(key);
766
- row.push(attrs[key]);
767
- }
768
- else {
769
- row[idx] = attrs[key];
770
- }
771
- }
772
- for (var i = 0; i < 100; ++i) {
773
- if (row[i] === undefined) {
774
- row[i] = "";
775
- }
776
- }
777
- return row;
778
- };
779
- WUScopeController.prototype.activityData = function () {
780
- var _this = this;
781
- var columns = ["Id", "Kind", "Label"];
782
- var data = this.graphDB.vertices.map(function (v) {
783
- var row = [parseInt(v._.Id.split("a")[1])];
784
- return _this.formatRow(v, columns, row);
785
- });
786
- return { columns: columns, data: data };
787
- };
788
- WUScopeController.prototype.edgeData = function () {
789
- var _this = this;
790
- var columns = ["Id", "Label"];
791
- var data = this.graphDB.edges.map(function (e) {
792
- var row = [e._.Id];
793
- return _this.formatRow(e, columns, row);
794
- });
795
- return { columns: columns, data: data };
796
- };
797
- WUScopeController.prototype.subgraphData = function () {
798
- var _this = this;
799
- var columns = ["Id", "Label"];
800
- var data = this.graphDB.subgraphs.map(function (sg) {
801
- var row = [sg._.Id];
802
- return _this.formatRow(sg, columns, row);
803
- });
804
- return { columns: columns, data: data };
805
- };
806
- WUScopeController.prototype.calcGraphTooltip = function (item) {
807
- var scope;
808
- var parentScope;
809
- if (item instanceof graph.Subgraph) {
810
- var subgraph = this.rSubgraphsMap[item.id()];
811
- scope = subgraph._;
812
- parentScope = subgraph.parent._;
813
- }
814
- else if (item instanceof graph.Vertex || item instanceof common.Icon) {
815
- var vertex = this.rVerticesMap[item.id()];
816
- scope = vertex._;
817
- parentScope = vertex.parent._;
818
- }
819
- else if (item instanceof graph.Edge) {
820
- var edge = this.rEdgesMap[item.id()];
821
- scope = edge._;
822
- parentScope = edge.parent._;
823
- }
824
- if (scope) {
825
- return scope.calcTooltip(parentScope);
826
- }
827
- return "";
828
- };
829
- WUScopeController.prototype.subgraph = function (id) {
830
- return this.subgraphsMap[id];
831
- };
832
- WUScopeController.prototype.vertex = function (id) {
833
- return this.verticesMap[id];
834
- };
835
- WUScopeController.prototype.edge = function (id) {
836
- return this.edgesMap[id];
837
- };
838
- // Events ---
839
- WUScopeController.prototype.minClick = function (sg) {
840
- };
841
- return WUScopeController;
842
- }());
843
-
844
- var css_248z = ".eclwatch_WUGraph .graph_Vertex{cursor:auto}.eclwatch_WUGraph .marker{fill:#656565;stroke:none;stroke-width:1px}.eclwatch_WUGraph .zoom{fill:none;pointer-events:all}.eclwatch_WUGraph .selectionBrush{fill:none;stroke:#a9a9a9}.d3-tip .eclwatch_WUGraph_Tooltip h3,.d3-tip .eclwatch_WUGraph_Tooltip h4{margin:0}.d3-tip .eclwatch_WUGraph_Tooltip table{border-collapse:separate;border-spacing:5px}.d3-tip .eclwatch_WUGraph_Tooltip table .key{font-weight:700}.d3-tip .eclwatch_WUGraph_Tooltip table .value{font-weight:400}";
845
- styleInject(css_248z);
846
-
847
- var WUGraph = /** @class */ (function (_super) {
848
- __extends(WUGraph, _super);
849
- function WUGraph() {
850
- var _this = _super.call(this) || this;
851
- _this._partialAll = new common.Button().faChar("fa-window-restore").tooltip("Partial All")
852
- .on("click", function () {
853
- _this.stateClick(_this._partialAll);
854
- });
855
- _this._maxAll = new common.Button().faChar("fa-window-maximize").tooltip("Max All")
856
- .on("click", function () {
857
- _this.stateClick(_this._maxAll);
858
- });
859
- _this._toggleGraph = new common.ToggleButton().faChar("fa-chain").tooltip("Graph")
860
- .selected(true)
861
- .on("click", function () {
862
- _this.viewClick(_this._toggleGraph);
863
- });
864
- _this._toggleActivities = new common.ToggleButton().faChar("fa-table").tooltip("Activitiies")
865
- .selected(false)
866
- .on("click", function () {
867
- _this.viewClick(_this._toggleActivities);
868
- });
869
- _this._toggleEdges = new common.ToggleButton().faChar("fa-table").tooltip("Edges")
870
- .selected(false)
871
- .on("click", function () {
872
- _this.viewClick(_this._toggleEdges);
873
- });
874
- _this._toggleSubgraphs = new common.ToggleButton().faChar("fa-table").tooltip("Subgraphs")
875
- .selected(false)
876
- .on("click", function () {
877
- _this.viewClick(_this._toggleSubgraphs);
878
- });
879
- _this._graph = new graph.Graph()
880
- .layout("Hierarchy")
881
- .applyScaleOnLayout(true)
882
- .showToolbar(false)
883
- .allowDragging(false);
884
- _this._activities = new dgrid.Table()
885
- .pagination(false);
886
- _this._edges = new dgrid.Table()
887
- .pagination(false);
888
- _this._subgraphs = new dgrid.Table()
889
- .pagination(false);
890
- _this._legend = new WUGraphLegend(_this)
891
- .on("click", function (kind) {
892
- _this.render();
893
- })
894
- .on("mouseover", function (kind) {
895
- var verticesMap = {};
896
- for (var _i = 0, _a = _this._gc.vertices(kind); _i < _a.length; _i++) {
897
- var vertex = _a[_i];
898
- verticesMap[vertex.id()] = true;
899
- }
900
- _this._graph.highlightVerticies(verticesMap);
901
- })
902
- .on("mouseout", function (kind) {
903
- _this._graph.highlightVerticies();
904
- });
905
- _this._view = new layout.Carousel().widgets([_this._graph, _this._activities, _this._edges, _this._subgraphs]);
906
- _this._gc = new WUScopeController();
907
- _this.topOverlay(false);
908
- _this.widget(_this._view);
909
- var buttons = __spreadArray(__spreadArray([
910
- _this._toggleGraph,
911
- _this._toggleActivities,
912
- _this._toggleEdges,
913
- _this._toggleSubgraphs,
914
- new common.Spacer(),
915
- _this._partialAll,
916
- _this._maxAll,
917
- new common.Spacer()
918
- ], _this._graph.iconBarButtons(), true), [
919
- new common.Spacer()
920
- ], false);
921
- _this.buttons(buttons.concat(_this.buttons()));
922
- _this._gc.minClick = function (sg) {
923
- _this.loadGraph();
924
- _this._graph.render(function (w) {
925
- _this._graph
926
- .selection([sg])
927
- .centerOnItem(sg);
928
- });
929
- };
930
- _this._graph.tooltipHTML(function (v) {
931
- return _this._gc.calcGraphTooltip(v);
932
- });
933
- return _this;
934
- }
935
- WUGraph.prototype.stateClick = function (sourceB) {
936
- switch (sourceB) {
937
- case this._partialAll:
938
- this._graph.data().subgraphs.forEach(function (sg) {
939
- sg.minState("partial");
940
- });
941
- break;
942
- case this._maxAll:
943
- this._graph.data().subgraphs.forEach(function (sg) {
944
- sg.minState("normal");
945
- });
946
- break;
947
- }
948
- this.render();
949
- };
950
- WUGraph.prototype.viewClick = function (sourceTB) {
951
- this._toggleGraph.selected(sourceTB === this._toggleGraph);
952
- this._toggleActivities.selected(sourceTB === this._toggleActivities);
953
- this._toggleEdges.selected(sourceTB === this._toggleEdges);
954
- this._toggleSubgraphs.selected(sourceTB === this._toggleSubgraphs);
955
- switch (sourceTB) {
956
- case this._toggleGraph:
957
- this._view.active(0);
958
- break;
959
- case this._toggleActivities:
960
- this._view.active(1);
961
- break;
962
- case this._toggleEdges:
963
- this._view.active(2);
964
- break;
965
- case this._toggleSubgraphs:
966
- this._view.active(3);
967
- break;
968
- }
969
- this.render(function (w) {
970
- });
971
- };
972
- WUGraph.prototype.fetchScopeGraph = function () {
973
- var _this = this;
974
- var hash = util.hashSum({
975
- baseUrl: this.baseUrl(),
976
- wuid: this.wuid(),
977
- graphID: this.graphID(),
978
- subgraphID: this.subgraphID()
979
- });
980
- if (!this._prevScopeGraph || this._prevHashSum !== hash) {
981
- this.startProgress();
982
- this._prevHashSum = hash;
983
- this._gc.clear();
984
- var wu = comms.Workunit.attach({ baseUrl: this.baseUrl() }, this.wuid());
985
- return wu.fetchGraphs().then(function (graphs) {
986
- for (var _i = 0, graphs_1 = graphs; _i < graphs_1.length; _i++) {
987
- var graph = graphs_1[_i];
988
- if (graph.Name === _this.graphID()) {
989
- _this.finishProgress();
990
- return graph.fetchScopeGraph(_this.subgraphID());
991
- }
992
- }
993
- }).then(function (scopeGraph) {
994
- _this._prevScopeGraph = scopeGraph;
995
- return _this._prevScopeGraph;
996
- });
997
- }
998
- return Promise.resolve(this._prevScopeGraph);
999
- };
1000
- WUGraph.prototype.enter = function (domNode, _element) {
1001
- _super.prototype.enter.call(this, domNode, _element);
1002
- };
1003
- WUGraph.prototype.update = function (domNode, element) {
1004
- _super.prototype.update.call(this, domNode, element);
1005
- };
1006
- WUGraph.prototype.exit = function (domNode, element) {
1007
- _super.prototype.exit.call(this, domNode, element);
1008
- };
1009
- WUGraph.prototype.loadGraph = function () {
1010
- this._gc.disabled(this._legend.disabled());
1011
- this._graph
1012
- .data(this._gc.graphData(), true);
1013
- {
1014
- var _a = this._gc.activityData(), columns = _a.columns, data = _a.data;
1015
- this._activities
1016
- .columns(columns)
1017
- .data(data);
1018
- }
1019
- {
1020
- var _b = this._gc.edgeData(), columns = _b.columns, data = _b.data;
1021
- this._edges
1022
- .columns(columns)
1023
- .data(data);
1024
- }
1025
- {
1026
- var _c = this._gc.subgraphData(), columns = _c.columns, data = _c.data;
1027
- this._subgraphs
1028
- .columns(columns)
1029
- .data(data);
1030
- }
1031
- };
1032
- WUGraph.prototype.render = function (callback) {
1033
- var _this = this;
1034
- if (this.wuid() && this.graphID()) {
1035
- this.fetchScopeGraph().then(function (scopedGraph) {
1036
- _this._gc.set(scopedGraph);
1037
- _this._legend.data(_this._gc.calcLegend());
1038
- _this.loadGraph();
1039
- _super.prototype.render.call(_this, callback);
1040
- });
1041
- }
1042
- else {
1043
- _super.prototype.render.call(this, callback);
1044
- }
1045
- return this;
1046
- };
1047
- WUGraph.prototype.selection = function (_) {
1048
- if (!arguments.length)
1049
- return this._graph.selection();
1050
- var item = this._gc.vertex(_) || this._gc.edge(_) || this._gc.subgraph(_);
1051
- if (item) {
1052
- this._graph.selection([item]);
1053
- }
1054
- return this;
1055
- };
1056
- return WUGraph;
1057
- }(layout.ChartPanel));
1058
- WUGraph.prototype._class += " eclwatch_WUGraph";
1059
- WUGraph.prototype.publish("baseUrl", "", "string", "HPCC Platform Base URL");
1060
- WUGraph.prototype.publish("wuid", "", "string", "Workunit ID");
1061
- WUGraph.prototype.publish("graphID", "", "string", "Graph ID");
1062
- WUGraph.prototype.publish("subgraphID", "", "string", "Subgraph ID");
1063
-
1064
- function entitiesEncode(str) {
1065
- return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1066
- }
1067
- function safeEncode(item) {
1068
- switch (Object.prototype.toString.call(item)) {
1069
- case "[object Undefined]":
1070
- case "[object Boolean]":
1071
- case "[object Number]":
1072
- return item;
1073
- case "[object String]":
1074
- return entitiesEncode(item);
1075
- default:
1076
- console.warn("Unknown cell type: " + Object.prototype.toString.call(item));
1077
- }
1078
- return item;
1079
- }
1080
- var Store = /** @class */ (function () {
1081
- function Store(wuResult, schema, renderHtml, filter) {
1082
- if (filter === void 0) { filter = {}; }
1083
- this._cache = {};
1084
- this._filter = {};
1085
- this.wuResult = wuResult;
1086
- this.schema = schema;
1087
- this._columns = this.schema2Columns(this.schema.root);
1088
- this.rowFormatter = new dgrid.RowFormatter(this._columns, renderHtml);
1089
- this._filter = filter;
1090
- }
1091
- Store.prototype.columns = function () {
1092
- return this._columns;
1093
- };
1094
- Store.prototype.schema2Columns = function (parentNode, prefix) {
1095
- var _this = this;
1096
- if (prefix === void 0) { prefix = ""; }
1097
- if (!parentNode)
1098
- return [];
1099
- return parentNode.children().filter(function (node) { return node.name.indexOf("__hidden", node.name.length - "__hidden".length) === -1; }).map(function (node, idx) {
1100
- var label = node.name;
1101
- var keyed = node.attrs["hpcc:keyed"];
1102
- var column = {
1103
- field: prefix + label,
1104
- leafID: label,
1105
- idx: idx,
1106
- label: label + (keyed ? " (i)" : ""),
1107
- className: "resultGridCell",
1108
- sortable: false,
1109
- width: keyed ? 16 : 0,
1110
- isSet: node.isSet
1111
- };
1112
- var children = _this.schema2Columns(node, prefix + label + "_");
1113
- if (children.length) {
1114
- column.width += 10 + children.reduce(function (prev, childNode) {
1115
- return prev + childNode.width;
1116
- }, 0);
1117
- column.children = children;
1118
- }
1119
- else {
1120
- column.width += node.charWidth() * 9;
1121
- column.formatter = function (cell, row) {
1122
- switch (typeof cell) {
1123
- case "string":
1124
- return {
1125
- html: cell.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;").trim()
1126
- };
1127
- case "undefined":
1128
- return "";
1129
- }
1130
- return cell;
1131
- };
1132
- }
1133
- return column;
1134
- });
1135
- };
1136
- Store.prototype.isChildDataset = function (cell) {
1137
- if (Object.prototype.toString.call(cell) !== "[object Object]") {
1138
- return false;
1139
- }
1140
- var propCount = 0;
1141
- var firstPropType = null;
1142
- for (var key in cell) {
1143
- if (!firstPropType) {
1144
- firstPropType = Object.prototype.toString.call(cell[key]);
1145
- }
1146
- propCount++;
1147
- }
1148
- return propCount === 1 && firstPropType === "[object Array]";
1149
- };
1150
- Store.prototype.rowToTable = function (cell, __row, node) {
1151
- if (this.isChildDataset(cell)) { // Don't display "Row" as a header ---
1152
- for (var key in cell) {
1153
- this.rowToTable(cell[key], __row, node);
1154
- }
1155
- return;
1156
- }
1157
- var table = dgrid.domConstruct.create("table", { border: 1, cellspacing: 0, width: "100%" }, node);
1158
- switch (Object.prototype.toString.call(cell)) {
1159
- case "[object Object]":
1160
- var tr = dgrid.domConstruct.create("tr", null, table);
1161
- for (var key in cell) {
1162
- dgrid.domConstruct.create("th", { innerHTML: safeEncode(key) }, tr);
1163
- }
1164
- tr = dgrid.domConstruct.create("tr", null, table);
1165
- for (var key in cell) {
1166
- switch (Object.prototype.toString.call(cell[key])) {
1167
- case "[object Object]":
1168
- case "[object Array]":
1169
- this.rowToTable(cell[key], __row, node);
1170
- break;
1171
- default:
1172
- dgrid.domConstruct.create("td", { innerHTML: safeEncode(cell[key]) }, tr);
1173
- break;
1174
- }
1175
- }
1176
- break;
1177
- case "[object Array]":
1178
- for (var i = 0; i < cell.length; ++i) {
1179
- switch (Object.prototype.toString.call(cell[i])) {
1180
- case "[object Boolean]":
1181
- case "[object Number]":
1182
- case "[object String]":
1183
- // Item in Scalar ---
1184
- var tr1 = dgrid.domConstruct.create("tr", null, table);
1185
- dgrid.domConstruct.create("td", { innerHTML: safeEncode(cell[i]) }, tr1);
1186
- break;
1187
- default:
1188
- // Child Dataset ---
1189
- if (i === 0) {
1190
- var tr2 = dgrid.domConstruct.create("tr", null, table);
1191
- for (var key in cell[i]) {
1192
- dgrid.domConstruct.create("th", { innerHTML: safeEncode(key) }, tr2);
1193
- }
1194
- }
1195
- dgrid.domConstruct.create("tr", null, table);
1196
- for (var key in cell[i]) {
1197
- if (cell[i][key]) {
1198
- if (Object.prototype.toString.call(cell[i][key]) === "[object Object]" || Object.prototype.toString.call(cell[i][key]) === "[object Array]") {
1199
- var td = dgrid.domConstruct.create("td", null, tr1);
1200
- this.rowToTable(cell[i][key], cell[i], td);
1201
- }
1202
- else if (key.indexOf("__html", key.length - "__html".length) !== -1) {
1203
- dgrid.domConstruct.create("td", { innerHTML: cell[i][key] }, tr1);
1204
- }
1205
- else if (key.indexOf("__javascript", key.length - "__javascript".length) !== -1) {
1206
- /*const td = */ dgrid.domConstruct.create("td", null, tr1);
1207
- // this.injectJavascript(cell[i][key], cell[i], td);
1208
- }
1209
- else {
1210
- var val = cell[i][key];
1211
- dgrid.domConstruct.create("td", { innerHTML: safeEncode(val) }, tr1);
1212
- }
1213
- }
1214
- else {
1215
- dgrid.domConstruct.create("td", { innerHTML: "" }, tr1);
1216
- }
1217
- }
1218
- }
1219
- }
1220
- break;
1221
- }
1222
- };
1223
- Store.prototype.getIdentity = function (row) {
1224
- return row.__hpcc_id;
1225
- };
1226
- Store.prototype._request = function (start, end) {
1227
- var _this = this;
1228
- if (!this.wuResult)
1229
- return Promise.resolve({ totalLength: 0, data: [] });
1230
- var cacheKey = "".concat(start, "->").concat(end);
1231
- if (this._cache[cacheKey])
1232
- return this._cache[cacheKey];
1233
- var retVal = this.wuResult.fetchRows(start, end - start, false, this._filter).then(function (rows) {
1234
- return {
1235
- totalLength: _this.wuResult.Total,
1236
- data: rows.map(function (row, idx) {
1237
- var formattedRow = _this.rowFormatter.format(row);
1238
- formattedRow.__hpcc_id = start + idx;
1239
- formattedRow.__hpcc_orig = row;
1240
- return formattedRow;
1241
- })
1242
- };
1243
- });
1244
- this._cache[cacheKey] = retVal;
1245
- return retVal;
1246
- };
1247
- Store.prototype.fetchRange = function (options) {
1248
- var retVal = new dgrid.Deferred();
1249
- this._request(options.start, options.end).then(function (response) { return retVal.resolve(response); });
1250
- return new dgrid.QueryResults(retVal.then(function (response) { return response.data; }), {
1251
- totalLength: retVal.then(function (response) { return response.totalLength; })
1252
- });
1253
- };
1254
- return Store;
1255
- }());
1256
-
1257
- var WUResult = /** @class */ (function (_super) {
1258
- __extends(WUResult, _super);
1259
- function WUResult() {
1260
- var _this = _super.call(this) || this;
1261
- _this.renderHtml(false);
1262
- return _this;
1263
- }
1264
- WUResult.prototype.hashSum = function (opts) {
1265
- if (opts === void 0) { opts = {}; }
1266
- return util.hashSum(__assign({ baseUrl: this.baseUrl(), wuid: this.wuid(), resultName: this.resultName(), sequence: this.sequence(), nodeGroup: this.nodeGroup(), logicalFile: this.logicalFile(), userID: this.user(), password: this.password() }, opts));
1267
- };
1268
- WUResult.prototype.calcResult = function () {
1269
- var resultHash = this.hashSum();
1270
- if (this._prevResultHash !== resultHash) {
1271
- this._prevResultHash = resultHash;
1272
- var opts = {
1273
- baseUrl: this.baseUrl(),
1274
- userID: this.user(),
1275
- password: this.password()
1276
- };
1277
- if (this.wuid() && this.resultName()) {
1278
- this._result = comms.Result.attach(opts, this.wuid(), this.resultName());
1279
- }
1280
- else if (this.wuid() && this.sequence() !== undefined) {
1281
- this._result = comms.Result.attach(opts, this.wuid(), this.sequence());
1282
- }
1283
- else if (this.logicalFile() && this.nodeGroup()) {
1284
- this._result = comms.Result.attachLogicalFile(opts, this.nodeGroup(), this.logicalFile());
1285
- }
1286
- else if (this.logicalFile()) {
1287
- this._result = comms.Result.attachLogicalFile(opts, "", this.logicalFile());
1288
- }
1289
- }
1290
- return this._result;
1291
- };
1292
- WUResult.prototype.fetch = function (row, count, abortController) {
1293
- if (abortController === void 0) { abortController = new AbortController(); }
1294
- var result = this.calcResult();
1295
- if (result) {
1296
- return result.fetchRows(row, count, false, {}, abortController.signal);
1297
- }
1298
- return Promise.resolve([]);
1299
- };
1300
- WUResult.prototype.update = function (domNode, element) {
1301
- var _this = this;
1302
- _super.prototype.update.call(this, domNode, element);
1303
- var storeHash = this.hashSum({
1304
- renderHtml: this.renderHtml(),
1305
- filter: this.filter()
1306
- });
1307
- if (this._prevStoreHash !== storeHash) {
1308
- this._prevStoreHash = storeHash;
1309
- var result_1 = this.calcResult();
1310
- if (result_1) {
1311
- result_1.fetchXMLSchema().then(function (schema) {
1312
- var _a, _b;
1313
- _this._localStore = new Store(result_1, schema, _this.renderHtml(), _this.filter());
1314
- (_a = _this._dgrid) === null || _a === void 0 ? void 0 : _a.set("columns", _this._localStore.columns());
1315
- (_b = _this._dgrid) === null || _b === void 0 ? void 0 : _b.set("collection", _this._localStore);
1316
- });
1317
- }
1318
- }
1319
- };
1320
- WUResult.prototype.click = function (row, col, sel) {
1321
- };
1322
- __decorate([
1323
- common.publish("", "string", "URL to WsWorkunits"),
1324
- __metadata("design:type", Object)
1325
- ], WUResult.prototype, "baseUrl", void 0);
1326
- __decorate([
1327
- common.publish(undefined, "string", "Workunit ID"),
1328
- __metadata("design:type", Object)
1329
- ], WUResult.prototype, "user", void 0);
1330
- __decorate([
1331
- common.publish(undefined, "string", "User ID"),
1332
- __metadata("design:type", Object)
1333
- ], WUResult.prototype, "password", void 0);
1334
- __decorate([
1335
- common.publish(undefined, "string", "Password"),
1336
- __metadata("design:type", Object)
1337
- ], WUResult.prototype, "wuid", void 0);
1338
- __decorate([
1339
- common.publish(undefined, "string", "Result Name"),
1340
- __metadata("design:type", Object)
1341
- ], WUResult.prototype, "resultName", void 0);
1342
- __decorate([
1343
- common.publish(undefined, "number", "Sequence Number"),
1344
- __metadata("design:type", Object)
1345
- ], WUResult.prototype, "sequence", void 0);
1346
- __decorate([
1347
- common.publish("", "string", "NodeGroup"),
1348
- __metadata("design:type", Object)
1349
- ], WUResult.prototype, "nodeGroup", void 0);
1350
- __decorate([
1351
- common.publish("", "string", "Logical File Name"),
1352
- __metadata("design:type", Object)
1353
- ], WUResult.prototype, "logicalFile", void 0);
1354
- __decorate([
1355
- common.publish({}, "object", "Filter"),
1356
- __metadata("design:type", Object)
1357
- ], WUResult.prototype, "filter", void 0);
1358
- return WUResult;
1359
- }(dgrid.Common));
1360
- WUResult.prototype._class += " eclwatch_WUResult";
1361
-
1362
- exports.STATUS = void 0;
1363
- (function (STATUS) {
1364
- STATUS["CREATE"] = "Created";
1365
- STATUS["COMPILE"] = "Compiled";
1366
- STATUS["EXECUTE"] = "Executed";
1367
- STATUS["COMPLETE"] = "Completed";
1368
- })(exports.STATUS || (exports.STATUS = {}));
1369
- exports.STATUS_ACTIVE = void 0;
1370
- (function (STATUS_ACTIVE) {
1371
- STATUS_ACTIVE["CREATE"] = "Creating";
1372
- STATUS_ACTIVE["COMPILE"] = "Compiling";
1373
- STATUS_ACTIVE["EXECUTE"] = "Executing";
1374
- STATUS_ACTIVE["COMPLETE"] = "Completed";
1375
- })(exports.STATUS_ACTIVE || (exports.STATUS_ACTIVE = {}));
1376
- var WUStatus = /** @class */ (function (_super) {
1377
- __extends(WUStatus, _super);
1378
- function WUStatus() {
1379
- var _this = _super.call(this) || this;
1380
- _this
1381
- .zoomable(false)
1382
- .zoomToFitLimit(1)
1383
- .layout("Hierarchy")
1384
- .hierarchyRankDirection("LR")
1385
- .showToolbar(false)
1386
- .allowDragging(false);
1387
- return _this;
1388
- }
1389
- WUStatus.prototype.attachWorkunit = function () {
1390
- var _this = this;
1391
- var hash = util.hashSum({
1392
- baseUrl: this.baseUrl(),
1393
- wuid: this.wuid()
1394
- });
1395
- if (this._prevHash !== hash) {
1396
- this._prevHash = hash;
1397
- this._wu = comms.Workunit.attach({ baseUrl: this.baseUrl() }, this.wuid());
1398
- if (this._wuHandle) {
1399
- this._wuHandle.release();
1400
- }
1401
- this._wuHandle = this._wu.watch(function (changes) {
1402
- _this.lazyRender();
1403
- });
1404
- }
1405
- };
1406
- WUStatus.prototype.createVertex = function (faChar) {
1407
- return new graph.Vertex()
1408
- .icon_diameter(32)
1409
- .icon_shape_colorFill("none")
1410
- .icon_shape_colorStroke("none")
1411
- .icon_image_colorFill("darkgray")
1412
- .iconAnchor("middle")
1413
- .textbox_shape_colorFill("none")
1414
- .textbox_shape_colorStroke("none")
1415
- .textbox_text_colorFill("darkgray")
1416
- .faChar(faChar);
1417
- };
1418
- WUStatus.prototype.updateVertex = function (vertex, color) {
1419
- vertex
1420
- .icon_image_colorFill(color)
1421
- .textbox_text_colorFill(color);
1422
- };
1423
- WUStatus.prototype.updateVertexStatus = function (level, active) {
1424
- if (active === void 0) { active = false; }
1425
- var completeColor = this._wu.isFailed() ? "darkred" : "darkgreen";
1426
- this._create.text(exports.STATUS.CREATE);
1427
- this._compile.text(exports.STATUS.COMPILE);
1428
- this._execute.text(exports.STATUS.EXECUTE);
1429
- this._complete.text(exports.STATUS.COMPLETE);
1430
- switch (level) {
1431
- case 0:
1432
- this.updateVertex(this._create, "darkgray");
1433
- this.updateVertex(this._compile, "darkgray");
1434
- this.updateVertex(this._execute, "darkgray");
1435
- this.updateVertex(this._complete, "darkgray");
1436
- break;
1437
- case 1:
1438
- this._create.text(exports.STATUS_ACTIVE.CREATE);
1439
- this.updateVertex(this._create, active ? "orange" : completeColor);
1440
- this.updateVertex(this._compile, "darkgray");
1441
- this.updateVertex(this._execute, "darkgray");
1442
- this.updateVertex(this._complete, "darkgray");
1443
- break;
1444
- case 2:
1445
- this._compile.text(exports.STATUS_ACTIVE.COMPILE);
1446
- this.updateVertex(this._create, completeColor);
1447
- this.updateVertex(this._compile, active ? "orange" : completeColor);
1448
- this.updateVertex(this._execute, completeColor);
1449
- this.updateVertex(this._complete, "darkgray");
1450
- break;
1451
- case 3:
1452
- this._execute.text(exports.STATUS_ACTIVE.EXECUTE);
1453
- this.updateVertex(this._create, completeColor);
1454
- this.updateVertex(this._compile, completeColor);
1455
- this.updateVertex(this._execute, active ? "orange" : completeColor);
1456
- this.updateVertex(this._complete, "darkgray");
1457
- break;
1458
- case 4:
1459
- this.updateVertex(this._create, completeColor);
1460
- this.updateVertex(this._compile, completeColor);
1461
- this.updateVertex(this._execute, completeColor);
1462
- this.updateVertex(this._complete, completeColor);
1463
- break;
1464
- }
1465
- };
1466
- WUStatus.prototype.createEdge = function (source, target) {
1467
- return new graph.Edge()
1468
- .sourceVertex(source)
1469
- .targetVertex(target)
1470
- .strokeColor("black")
1471
- .showArc(false);
1472
- };
1473
- WUStatus.prototype.enter = function (domNode, element) {
1474
- _super.prototype.enter.call(this, domNode, element);
1475
- this._create = this.createVertex("\uf11d");
1476
- this._compile = this.createVertex("\uf085");
1477
- this._execute = this.createVertex("\uf275");
1478
- this._complete = this.createVertex("\uf11e");
1479
- var e1 = this.createEdge(this._create, this._compile);
1480
- var e2 = this.createEdge(this._compile, this._execute);
1481
- var e3 = this.createEdge(this._execute, this._complete);
1482
- this.data({
1483
- vertices: [this._create, this._compile, this._execute, this._complete],
1484
- edges: [e1, e2, e3]
1485
- });
1486
- };
1487
- WUStatus.prototype.update = function (domNode, element) {
1488
- this.attachWorkunit();
1489
- switch (this._wu.StateID) {
1490
- case comms.WUStateID.Blocked:
1491
- case comms.WUStateID.Wait:
1492
- case comms.WUStateID.Scheduled:
1493
- case comms.WUStateID.UploadingFiled:
1494
- this.updateVertexStatus(1);
1495
- break;
1496
- case comms.WUStateID.Compiling:
1497
- this.updateVertexStatus(2, true);
1498
- break;
1499
- case comms.WUStateID.Submitted:
1500
- this.updateVertexStatus(1, true);
1501
- break;
1502
- case comms.WUStateID.Compiled:
1503
- this.updateVertexStatus(2);
1504
- break;
1505
- case comms.WUStateID.Aborting:
1506
- case comms.WUStateID.Running:
1507
- this.updateVertexStatus(3, true);
1508
- break;
1509
- case comms.WUStateID.Aborted:
1510
- case comms.WUStateID.Archived:
1511
- case comms.WUStateID.Completed:
1512
- this.updateVertexStatus(4);
1513
- break;
1514
- case comms.WUStateID.Failed:
1515
- this.updateVertexStatus(4, false);
1516
- break;
1517
- case comms.WUStateID.DebugPaused:
1518
- case comms.WUStateID.DebugRunning:
1519
- case comms.WUStateID.Paused:
1520
- case comms.WUStateID.Unknown:
1521
- default:
1522
- this.updateVertexStatus(0);
1523
- break;
1524
- }
1525
- _super.prototype.update.call(this, domNode, element);
1526
- this.zoomToFit();
1527
- };
1528
- WUStatus.prototype.exit = function (domNode, element) {
1529
- if (this._wuHandle) {
1530
- this._wuHandle.release();
1531
- }
1532
- _super.prototype.exit.call(this, domNode, element);
1533
- };
1534
- return WUStatus;
1535
- }(graph.Graph));
1536
- WUStatus.prototype._class += " eclwatch_WUStatus";
1537
- WUStatus.prototype.publish("baseUrl", "", "string", "HPCC Platform Base URL");
1538
- WUStatus.prototype.publish("wuid", "", "string", "Workunit ID");
1539
-
1540
- var columns = ["label", "start", "end", "icon", "color", "series"];
1541
- var WUTimeline = /** @class */ (function (_super) {
1542
- __extends(WUTimeline, _super);
1543
- function WUTimeline() {
1544
- var _this = _super.call(this) || this;
1545
- _this._palette = common.Palette.ordinal("default");
1546
- _this
1547
- .columns(columns)
1548
- .titleColumn("label")
1549
- .iconColumn("icon")
1550
- .colorColumn("color")
1551
- .seriesColumn("series")
1552
- .timePattern("%Y-%m-%dT%H:%M:%S.%LZ")
1553
- .tickFormat("%H:%M")
1554
- .tooltipTimeFormat("%H:%M:%S.%L")
1555
- .tooltipHTML(function (d) {
1556
- return d[columns.length].calcTooltip();
1557
- });
1558
- return _this;
1559
- }
1560
- WUTimeline.prototype.clear = function () {
1561
- delete this._prevHashSum;
1562
- return this;
1563
- };
1564
- WUTimeline.prototype.fetchScopes = function () {
1565
- var _this = this;
1566
- var hash = util.hashSum({
1567
- baseUrl: this.baseUrl(),
1568
- wuid: this.wuid(),
1569
- request: this.request()
1570
- });
1571
- if (this._prevHashSum !== hash) {
1572
- this._prevHashSum = hash;
1573
- var wu = comms.Workunit.attach({ baseUrl: this.baseUrl() }, this.wuid());
1574
- wu.fetchDetails(this.request()).then(function (scopes) {
1575
- return scopes.filter(function (scope) { return scope.Id && scope.attr("WhenStarted").RawValue; }).map(function (scope) {
1576
- var whenStarted = +scope.attr("WhenStarted").RawValue / 1000;
1577
- var timeElapsed = +scope.attr("TimeElapsed").RawValue / 1000000;
1578
- return [
1579
- scope.Id,
1580
- new Date(whenStarted).toISOString(),
1581
- timeElapsed ? new Date(whenStarted + timeElapsed).toISOString() : undefined,
1582
- null,
1583
- _this._palette(scope.ScopeType),
1584
- scope.ScopeName.split("::").join(":").split(":").slice(0, 1),
1585
- scope
1586
- ];
1587
- });
1588
- }).then(function (scopes) {
1589
- _this
1590
- .data(scopes)
1591
- .render();
1592
- });
1593
- }
1594
- };
1595
- WUTimeline.prototype.enter = function (domNode, _element) {
1596
- _super.prototype.enter.call(this, domNode, _element);
1597
- };
1598
- WUTimeline.prototype.update = function (domNode, element) {
1599
- this.fetchScopes();
1600
- _super.prototype.update.call(this, domNode, element);
1601
- };
1602
- WUTimeline.prototype.exit = function (domNode, element) {
1603
- _super.prototype.exit.call(this, domNode, element);
1604
- };
1605
- return WUTimeline;
1606
- }(timeline.ReactTimelineSeries));
1607
- WUTimeline.prototype._class += " eclwatch_WUTimeline";
1608
- WUTimeline.prototype.publish("baseUrl", "", "string", "HPCC Platform Base URL");
1609
- WUTimeline.prototype.publish("wuid", "", "string", "Workunit ID");
1610
- WUTimeline.prototype.publish("request", {
1611
- ScopeFilter: {
1612
- MaxDepth: 3,
1613
- ScopeTypes: ["graph", "subgraph"]
1614
- },
1615
- NestedFilter: {
1616
- Depth: 0,
1617
- ScopeTypes: []
1618
- },
1619
- PropertiesToReturn: {
1620
- AllProperties: false,
1621
- AllStatistics: true,
1622
- AllHints: false,
1623
- Properties: ["WhenStarted", "TimeElapsed"]
1624
- },
1625
- ScopeOptions: {
1626
- IncludeId: true,
1627
- IncludeScope: true,
1628
- IncludeScopeType: true
1629
- },
1630
- PropertyOptions: {
1631
- IncludeName: true,
1632
- IncludeRawValue: true,
1633
- IncludeFormatted: true,
1634
- IncludeMeasure: true,
1635
- IncludeCreator: false,
1636
- IncludeCreatorType: false
1637
- }
1638
- }, "object", "WUDetails Request");
1639
-
1640
- exports.BUILD_VERSION = BUILD_VERSION;
1641
- exports.ECLArchiveViewer = ECLArchiveViewer;
1642
- exports.PKG_NAME = PKG_NAME;
1643
- exports.PKG_VERSION = PKG_VERSION;
1644
- exports.WUGraph = WUGraph;
1645
- exports.WUResult = WUResult;
1646
- exports.WUScopeController = WUScopeController;
1647
- exports.WUStatus = WUStatus;
1648
- exports.WUTimeline = WUTimeline;
1649
-
1650
- }));
1
+ var O=Object.defineProperty;var l=(c,e)=>O(c,"name",{value:e,configurable:!0});var we="@hpcc-js/eclwatch",xe="3.1.1",ke="3.2.1";import{Editor as N}from"@hpcc-js/codemirror";import{Workunit as j}from"@hpcc-js/comms";import{SplitPanel as B}from"@hpcc-js/phosphor";import{DirectoryTree as q}from"@hpcc-js/tree";import{hashSum as z,xml2json as X}from"@hpcc-js/util";var p=class extends B{static{l(this,"ECLArchiveViewer")}_prevHash;_contentStr;_directoryPane=new q;_fileEditorPane=new N().text("");constructor(){super("horizontal"),this._directoryPane.rowClick=e=>{this._fileEditorPane.text(e).render()}}transformArchiveTreeData(e){let t={label:e.name,children:e._children.map(r).filter(s=>s)};if(t.children&&t.children[0]&&t.children[0].label==="html")return{label:"root",children:[{label:"error",content:JSON.stringify(t,null,4)}]};return t;function r(s){let a={};if(a.label=s.name+(s.$&&s.$.key?` (${s.$.key})`:""),s._children&&s._children.length>0)a.children=s._children.map(i=>r(i)).filter(i=>i);else if(typeof s.content=="string"&&s.content.trim())a.content=s.content;else return!1;return a}}updateDirectoryPane(e){let t;if(e)try{t=JSON.parse(e)}catch{t=X(e)}if(t){let r=this.transformArchiveTreeData(t);this._directoryPane.data(r).render()}}enter(e,t){super.enter(e,t),this.addWidget(this._directoryPane).addWidget(this._fileEditorPane)}update(e,t){super.update(e,t);let r=z({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==r||typeof this._contentStr>"u"?j.attach({baseUrl:this.baseUrl()},this.wuid()).fetchArchive().then(s=>{this._contentStr=s,this.updateDirectoryPane(this._contentStr),this._prevHash=r}):this.updateDirectoryPane(this._contentStr),this.relativeSizes([this.directoryWidthRatio(),1-this.directoryWidthRatio()])}};p.prototype._class+=" eclwatch_ECLArchiveViewer";p.prototype.publish("baseUrl","","string","HPCC Platform Base URL");p.prototype.publish("wuid","","string","Workunit ID");p.prototype.publish("directoryWidthRatio",.38,"number","Default directory panel width ratio relative to the full width");p.prototype.publish("contentString",null,"string","XML/JSON archive content string");p.prototype.publishProxy("directoryPaneColor","_directoryPane","backgroundColor");p.prototype.publishProxy("directoryPaneHoverColor","_directoryPane","hoverBackgroundColor");p.prototype.publishProxy("iconSize","_directoryPane");p.prototype.publishProxy("fontColor","_directoryPane");p.prototype.publishProxy("fontFamily","_directoryPane");p.prototype.publishProxy("fontSize","_directoryPane");p.prototype.publishProxy("folderIconOpen","_directoryPane");p.prototype.publishProxy("folderIconClosed","_directoryPane");p.prototype.publishProxy("textFileIcon","_directoryPane");p.prototype.publishProxy("codeFileIcon","_directoryPane");p.prototype.publishProxy("verticalScroll","_directoryPane");import{Button as W,Spacer as P,ToggleButton as v}from"@hpcc-js/common";import{Workunit as Y}from"@hpcc-js/comms";import{Table as D}from"@hpcc-js/dgrid";import{Graph as Z}from"@hpcc-js/graph";import{Carousel as ee,ChartPanel as te}from"@hpcc-js/layout";import{hashSum as re}from"@hpcc-js/util";import{Vertex as $}from"@hpcc-js/graph";import{Legend as K}from"@hpcc-js/layout";import{local as J,select as Q}from"@hpcc-js/common";(function(){if(!document.getElementById("9b8733e7")){var c=document.createElement("style");c.id="9b8733e7",c.textContent=`.eclwatch_WUGraphLegend .graph_Vertex {
2
+ cursor: auto;
3
+ }
4
+
5
+ .eclwatch_WUGraphLegend .graph_Vertex .common_Icon {
6
+ cursor: pointer;
7
+ }
8
+ `,document.head.appendChild(c)}})();var E=class extends ${static{l(this,"LegendVertex")}constructor(){super()}enter(e,t){super.enter(e,t),this._icon.on("click",()=>{this.click(this.data())})}click(e){}},S=class extends K{static{l(this,"WUGraphLegend")}icon=J();_disabled2={};disabled(e){if(!arguments.length){let t=[];for(let r in this._disabled2)this._disabled2[r]&&t.push(r);return t}return this._disabled2={},e.forEach(t=>this._disabled2[t]=!0),this}toggle(e){this._disabled2[e]=!this._disabled2[e]}update(e,t){super.update(e,t);let r=this,s=this._g.selectAll(".legendItem").data(this.data(),i=>i.kind);s.enter().append("g").attr("class","legendItem").each(function(i){r.icon.set(this,new E().target(this).data(i.kind).textbox_shape_colorStroke("none").textbox_shape_colorFill("none").iconAnchor("left").faChar(i.faChar).text(`${i.label} (${i.count})`).tooltip(`${i.kind} - ${i.label}`).on("click",o=>{r.toggle(o),r.render(),r.click(o)}).on("mouseover",o=>{r.mouseover(o)}).on("mouseout",o=>{r.mouseout(o)}))}).merge(s).each(function(i,o){let n=r.icon.get(this).icon_shape_colorFill(r._disabled2[i.kind]?"gray":null).render().getBBox();Q(this).attr("transform",`translate(${+n.width/2}, ${o*30})`)}),s.exit().each(function(i){r.icon.get(this).target(null).render()}).remove();let a=this.getBBox(!0,!0);this._g.attr("transform",`translate(16, ${this.height()/2-a.height/2})`)}click(e){}mouseover(e){}mouseout(e){}};S.prototype._class+=" eclwatch_WUGraphLegend";import{Icon as M}from"@hpcc-js/common";import{BaseScope as x}from"@hpcc-js/comms";import{Edge as U,Subgraph as G,Vertex as R}from"@hpcc-js/graph";import{Edge as T,Subgraph as L,Vertex as F}from"@hpcc-js/util";function H(c){switch(c){case"2":return"\uF0C7";case"3":return"\uF15D";case"5":return"\uF0B0";case"6":return"\uF1E0";case"12":return"\uF039";case"15":return"\uF126";case"17":return"\uF126";case"22":return"\uF1E6";case"23":return"\uF078";case"25":return"\uF0CE";case"26":return"\uF074";case"29":return"\uF005";case"36":return"\uF128";case"44":return"\uF0C7";case"47":return"\uF0C7";case"54":return"\uF013";case"56":return"\uF0C7";case"59":return"\uF126";case"61":return"\uF0C7";case"82":return"\uF1C0";case"88":return"\uF1C0";case"92":return"\uF129";case"93":return"\uF129";case"99":return"\uF1C0";case"105":return"\uF1C0";case"7":return"\uF090";case"9":return"\uF0E2";case"16":return"\uF005";case"19":return"\uF074";case"21":return"\uF275";case"35":return"\uF0C7";case"37":return"\uF0C7";case"71":return"\uF1C0";case"133":return"\uF0CE";case"148":return"\uF0CE";case"168":return"\uF275"}return"\uF063"}l(H,"faCharFactory");var k=class{static{l(this,"WUScopeController")}graphDB;subgraphsMap={};rSubgraphsMap={};verticesMap={};rVerticesMap={};edgesMap={};rEdgesMap={};kindMap={};_disabled={};constructor(){}clear(){this.subgraphsMap={},this.rSubgraphsMap={},this.verticesMap={},this.rVerticesMap={},this.edgesMap={},this.rEdgesMap={}}set(e){this.graphDB=e,this.graphGui(this.graphDB),this.kindMap={},this.graphDB.walk(t=>{if(!(t instanceof L))if(t instanceof F){let r=t._.attr("Kind").RawValue;this.kindMap[r]||(this.kindMap[r]=[]),this.kindMap[r].push(t)}else t instanceof T})}disabled(e){if(!arguments.length){let t=[];for(let r in this._disabled)this._disabled[r]&&t.push(r);return t}return this._disabled={},e.forEach(t=>this._disabled[t]=!0),this}graphGui(e){let t={subgraphs:[],vertices:[],edges:[],hierarchy:[]};return e.walk(r=>{if(r instanceof L){let s=this.appendSubgraph(r,t.hierarchy,t.subgraphs);s.showMinMax(r.vertices.length>3||s.minState()!=="normal")}else r instanceof F?this.appendVertex(r,t.hierarchy,t.vertices):r instanceof T&&this.appendEdge(r,t.edges)}),t}format(e,t){let r="",s=e.indexOf("%"),a=-1;for(;s>=0;){if(r+=e.substring(a+1,s),a=e.indexOf("%",s+1),a<0){console.warn("Invalid Label Template");break}let i=e.substring(s+1,a);r+=i?t[e.substring(s+1,a)]||"":"%",s=e.indexOf("%",a+1)}return r+=e.substring(a+1,e.length),r.split("\\n").join(`
9
+ `)}createSubgraph(e){let t=this.subgraphsMap[e._.Id];return t||(t=new G().title(e._.Id).on("minClick",()=>{this.minClick(t)}),this.subgraphsMap[e._.Id]=t,this.rSubgraphsMap[t.id()]=e),t}createVertex(e){let t=this.verticesMap[e._.Id];if(!t){let r=e._.rawAttrs();if(e._.ScopeType==="dummy"){let s=this.subgraphsMap[e.parent._.Id];t=new M().shape_colorFill("darkred").shape_colorStroke("darkred").image_colorFill("white").faChar("\uF067").on("click",()=>{s.minState("normal"),this.minClick(s)})}else{t=new R().icon_shape_colorFill("#1f77b4").icon_image_colorFill("white").faChar(H(r.Kind)).text(r.Label);let s=[];e._.hasAttr("Definition")&&s.push({faChar:"\uF036",tooltip:"Definition",shape_colorFill:"lightgray",shape_colorStroke:"lightgray",image_colorFill:"black"}),e._.hasAttr("IsInternal")&&s.push({faChar:"\uF085",tooltip:"IsInternal",shape_colorFill:"red",shape_colorStroke:"red",image_colorFill:"white"}),t.annotationIcons(s)}this.verticesMap[e._.Id]=t,this.rVerticesMap[t.id()]=e}return t}isSpill(e){let t=e.source._.attr("Kind").RawValue,r=e.target._.attr("Kind").RawValue;return t==="2"||r==="71"}spansSubgraph(e){return e.source.parent._.Id!==e.target.parent._.Id}createEdge(e){let t=this.edgesMap[e._.Id];if(!t){let r=e._.rawAttrs(),s=this.verticesMap[e.source._.Id],a=this.verticesMap[e.target._.Id];if(s&&a){let i=this.isSpill(e),o=this.spansSubgraph(e),n=this.format(`%Label%
10
+ %NumRowsProcessed%`,r),h=null,g=100;r.IsDependency?(g=10,h="1,5"):r._childGraph?h="5,5":i?(g=25,h="5,5,10,5"):o&&(g=5,h="5,5"),t=new U().sourceVertex(s).targetVertex(a).sourceMarker("circle").targetMarker("arrow").weight(g).strokeDasharray(h).text(n),this.edgesMap[e._.Id]=t,this.rEdgesMap[t.id()]=e}}return t}appendSubgraph(e,t,r){let s=this.createSubgraph(e);r.push(s);let a=this.subgraphsMap[e.parent._.Id];return a&&t.push({parent:a,child:s}),s}appendVertex(e,t,r){let s=this.createVertex(e);r.push(s);let a=this.subgraphsMap[e.parent._.Id];return a&&t.push({parent:a,child:s}),s}appendEdge(e,t){let r=this.createEdge(e);return r&&t.push(r),r}filterLegend(e){for(let t=e.vertices.length-1;t>=0;--t){let r=e.vertices[t],s=r._.attr("Kind").RawValue;this._disabled[s]&&r.remove(!1,(a,i)=>new x({ScopeName:r._.ScopeName+":in",Id:a.Id+"->"+i.Id,ScopeType:"dummy-edge",Properties:{Property:[r._.attr("Label")]},Notes:{Note:[]},SinkActivity:""}))}}filterPartial(e){for(let t of e.subgraphs)switch(this.subgraphsMap[t._.Id].minState()){case"partial":let s=t.vertices,a=[],i=[];for(let o of s)o.inEdges.length===0||o.inEdges.some(n=>n.source.parent!==n.target.parent)||o.outEdges.length===0||o.outEdges.some(n=>n.source.parent!==n.target.parent)?a.push(o):i.push(o);if(i.length>1){let o={ScopeName:t._.ScopeName,Id:t._.Id+":dummy",ScopeType:"dummy",Properties:{Property:[{Name:"Activities",RawValue:""+i.length,Formatted:""+i.length,Measure:"count",Creator:"",CreatorType:""}]},Notes:{Note:[]},SinkActivity:""},n=new x(o),h=t.createVertex(n);for(let g of i){for(let f of g.inEdges)if(a.indexOf(f.source)>=0){let C=new x({ScopeName:f.source._.ScopeName,Id:f.source._.Id+"->"+h._.Id,ScopeType:"dummy-in",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});t.createEdge(f.source,h,C)}for(let f of g.outEdges)if(a.indexOf(f.target)>=0){let C=new x({ScopeName:f.target._.ScopeName,Id:h._.Id+"->"+f.target._.Id,ScopeType:"dummy-out",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});t.createEdge(h,f.target,C)}}i.forEach(g=>g.remove(!0))}break}}filterEmptySubgraphs(e){for(;;){let t=e.subgraphs.filter(r=>r.subgraphs.length===0&&r.vertices.length===0);if(t.length===0)break;t.forEach(r=>r.remove(!0))}}removeObsoleteSubgraphs(e){for(let t of[...e.subgraphs])t.vertices.length===0&&t.remove(!1)}graphData(){let e=this.graphDB.clone();return this.filterLegend(e),this.filterPartial(e),this.filterEmptySubgraphs(e),this.removeObsoleteSubgraphs(e),this.graphGui(e)}calcLegend(){let e=[];for(let t in this.kindMap)e.push({kind:parseInt(t),faChar:H(t),label:this.kindMap[t][0]._.attr("Label").RawValue.split(`
11
+ `)[0],count:this.kindMap[t].length});return e}vertices(e){let t=[];for(let r of this.kindMap[e])t.push(this.verticesMap[r._.Id]);return t}formatRow(e,t,r){let s=e._.formattedAttrs();for(let a in s){let i=t.indexOf(a);i===-1?(t.push(a),r.push(s[a])):r[i]=s[a]}for(let a=0;a<100;++a)r[a]===void 0&&(r[a]="");return r}activityData(){let e=["Id","Kind","Label"],t=this.graphDB.vertices.map(r=>{let s=[parseInt(r._.Id.split("a")[1])];return this.formatRow(r,e,s)});return{columns:e,data:t}}edgeData(){let e=["Id","Label"],t=this.graphDB.edges.map(r=>{let s=[r._.Id];return this.formatRow(r,e,s)});return{columns:e,data:t}}subgraphData(){let e=["Id","Label"],t=this.graphDB.subgraphs.map(r=>{let s=[r._.Id];return this.formatRow(r,e,s)});return{columns:e,data:t}}calcGraphTooltip(e){let t,r;if(e instanceof G){let s=this.rSubgraphsMap[e.id()];t=s._,r=s.parent._}else if(e instanceof R||e instanceof M){let s=this.rVerticesMap[e.id()];t=s._,r=s.parent._}else if(e instanceof U){let s=this.rEdgesMap[e.id()];t=s._,r=s.parent._}return t?t.calcTooltip(r):""}subgraph(e){return this.subgraphsMap[e]}vertex(e){return this.verticesMap[e]}edge(e){return this.edgesMap[e]}minClick(e){}};(function(){if(!document.getElementById("641d6c4b")){var c=document.createElement("style");c.id="641d6c4b",c.textContent=`.eclwatch_WUGraph .graph_Vertex {
12
+ cursor: auto;
13
+ }
14
+
15
+ .eclwatch_WUGraph .marker {
16
+ fill: #656565;
17
+ stroke: none;
18
+ stroke-width: 1.0px;
19
+ }
20
+
21
+ .eclwatch_WUGraph .zoom {
22
+ fill: none;
23
+ pointer-events: all;
24
+ }
25
+
26
+ .eclwatch_WUGraph .selectionBrush {
27
+ fill: none;
28
+ stroke: darkgray;
29
+ }
30
+
31
+ .d3-tip .eclwatch_WUGraph_Tooltip h3 {
32
+ margin:0px;
33
+ }
34
+
35
+ .d3-tip .eclwatch_WUGraph_Tooltip h4 {
36
+ margin:0px;
37
+ }
38
+
39
+ .d3-tip .eclwatch_WUGraph_Tooltip table {
40
+ border-collapse: separate;
41
+ border-spacing: 5px;
42
+ }
43
+
44
+ .d3-tip .eclwatch_WUGraph_Tooltip table .key {
45
+ font-weight: bold;
46
+ }
47
+
48
+ .d3-tip .eclwatch_WUGraph_Tooltip table .value {
49
+ font-weight: normal;
50
+ }
51
+ `,document.head.appendChild(c)}})();var m=class extends te{static{l(this,"WUGraph")}_partialAll=new W().faChar("fa-window-restore").tooltip("Partial All").on("click",()=>{this.stateClick(this._partialAll)});_maxAll=new W().faChar("fa-window-maximize").tooltip("Max All").on("click",()=>{this.stateClick(this._maxAll)});_toggleGraph=new v().faChar("fa-chain").tooltip("Graph").selected(!0).on("click",()=>{this.viewClick(this._toggleGraph)});_toggleActivities=new v().faChar("fa-table").tooltip("Activitiies").selected(!1).on("click",()=>{this.viewClick(this._toggleActivities)});_toggleEdges=new v().faChar("fa-table").tooltip("Edges").selected(!1).on("click",()=>{this.viewClick(this._toggleEdges)});_toggleSubgraphs=new v().faChar("fa-table").tooltip("Subgraphs").selected(!1).on("click",()=>{this.viewClick(this._toggleSubgraphs)});_graph=new Z().layout("Hierarchy").applyScaleOnLayout(!0).showToolbar(!1).allowDragging(!1);_activities=new D().pagination(!1);_edges=new D().pagination(!1);_subgraphs=new D().pagination(!1);_legend=new S(this).on("click",e=>{this.render()}).on("mouseover",e=>{let t={};for(let r of this._gc.vertices(e))t[r.id()]=!0;this._graph.highlightVerticies(t)}).on("mouseout",e=>{this._graph.highlightVerticies()});_view=new ee().widgets([this._graph,this._activities,this._edges,this._subgraphs]);_gc=new k;constructor(){super(),this.topOverlay(!1),this.widget(this._view);let e=[this._toggleGraph,this._toggleActivities,this._toggleEdges,this._toggleSubgraphs,new P,this._partialAll,this._maxAll,new P,...this._graph.iconBarButtons(),new P];this.buttons(e.concat(this.buttons())),this._gc.minClick=t=>{this.loadGraph(),this._graph.render(r=>{this._graph.selection([t]).centerOnItem(t)})},this._graph.tooltipHTML(t=>this._gc.calcGraphTooltip(t))}stateClick(e){switch(e){case this._partialAll:this._graph.data().subgraphs.forEach(t=>{t.minState("partial")});break;case this._maxAll:this._graph.data().subgraphs.forEach(t=>{t.minState("normal")});break}this.render()}viewClick(e){switch(this._toggleGraph.selected(e===this._toggleGraph),this._toggleActivities.selected(e===this._toggleActivities),this._toggleEdges.selected(e===this._toggleEdges),this._toggleSubgraphs.selected(e===this._toggleSubgraphs),e){case this._toggleGraph:this._view.active(0);break;case this._toggleActivities:this._view.active(1);break;case this._toggleEdges:this._view.active(2);break;case this._toggleSubgraphs:this._view.active(3);break}this.render(t=>{})}_prevHashSum;_prevScopeGraph;fetchScopeGraph(){let e=re({baseUrl:this.baseUrl(),wuid:this.wuid(),graphID:this.graphID(),subgraphID:this.subgraphID()});return!this._prevScopeGraph||this._prevHashSum!==e?(this.startProgress(),this._prevHashSum=e,this._gc.clear(),Y.attach({baseUrl:this.baseUrl()},this.wuid()).fetchGraphs().then(r=>{for(let s of r)if(s.Name===this.graphID())return this.finishProgress(),s.fetchScopeGraph(this.subgraphID())}).then(r=>(this._prevScopeGraph=r,this._prevScopeGraph))):Promise.resolve(this._prevScopeGraph)}enter(e,t){super.enter(e,t)}update(e,t){super.update(e,t)}exit(e,t){super.exit(e,t)}loadGraph(){this._gc.disabled(this._legend.disabled()),this._graph.data(this._gc.graphData(),!0);{let{columns:e,data:t}=this._gc.activityData();this._activities.columns(e).data(t)}{let{columns:e,data:t}=this._gc.edgeData();this._edges.columns(e).data(t)}{let{columns:e,data:t}=this._gc.subgraphData();this._subgraphs.columns(e).data(t)}}render(e){return this.wuid()&&this.graphID()?this.fetchScopeGraph().then(t=>{this._gc.set(t),this._legend.data(this._gc.calcLegend()),this.loadGraph(),super.render(e)}):super.render(e),this}selection(e){if(!arguments.length)return this._graph.selection();let t=this._gc.vertex(e)||this._gc.edge(e)||this._gc.subgraph(e);return t&&this._graph.selection([t]),this}};m.prototype._class+=" eclwatch_WUGraph";m.prototype.publish("baseUrl","","string","HPCC Platform Base URL");m.prototype.publish("wuid","","string","Workunit ID");m.prototype.publish("graphID","","string","Graph ID");m.prototype.publish("subgraphID","","string","Subgraph ID");import{Result as V}from"@hpcc-js/comms";import{Common as ne}from"@hpcc-js/dgrid";import{hashSum as ce}from"@hpcc-js/util";import{Deferred as se,domConstruct as d,QueryResults as ie,RowFormatter as ae}from"@hpcc-js/dgrid";function oe(c){return String(c).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}l(oe,"entitiesEncode");function y(c){switch(Object.prototype.toString.call(c)){case"[object Undefined]":case"[object Boolean]":case"[object Number]":return c;case"[object String]":return oe(c);default:console.warn("Unknown cell type: "+Object.prototype.toString.call(c))}return c}l(y,"safeEncode");var I=class{static{l(this,"Store")}wuResult;schema;_columns;_cache={};rowFormatter;_filter={};constructor(e,t,r,s={}){this.wuResult=e,this.schema=t,this._columns=this.schema2Columns(this.schema.root),this.rowFormatter=new ae(this._columns,r),this._filter=s}columns(){return this._columns}schema2Columns(e,t=""){return e?e.children().filter(r=>r.name.indexOf("__hidden",r.name.length-8)===-1).map((r,s)=>{let a=r.name,i=r.attrs["hpcc:keyed"],o={field:t+a,leafID:a,idx:s,label:a+(i?" (i)":""),className:"resultGridCell",sortable:!1,width:i?16:0,isSet:r.isSet},n=this.schema2Columns(r,t+a+"_");return n.length?(o.width+=10+n.reduce((h,g)=>h+g.width,0),o.children=n):(o.width+=r.charWidth()*9,o.formatter=(h,g)=>{switch(typeof h){case"string":return{html:h.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").trim()};case"undefined":return""}return h}),o}):[]}isChildDataset(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=0,r=null;for(let s in e)r||(r=Object.prototype.toString.call(e[s])),t++;return t===1&&r==="[object Array]"}rowToTable(e,t,r){if(this.isChildDataset(e)){for(let a in e)this.rowToTable(e[a],t,r);return}let s=d.create("table",{border:1,cellspacing:0,width:"100%"},r);switch(Object.prototype.toString.call(e)){case"[object Object]":let a=d.create("tr",null,s);for(let i in e)d.create("th",{innerHTML:y(i)},a);a=d.create("tr",null,s);for(let i in e)switch(Object.prototype.toString.call(e[i])){case"[object Object]":case"[object Array]":this.rowToTable(e[i],t,r);break;default:d.create("td",{innerHTML:y(e[i])},a);break}break;case"[object Array]":for(let i=0;i<e.length;++i)switch(Object.prototype.toString.call(e[i])){case"[object Boolean]":case"[object Number]":case"[object String]":let o=d.create("tr",null,s);d.create("td",{innerHTML:y(e[i])},o);break;default:if(i===0){let n=d.create("tr",null,s);for(let h in e[i])d.create("th",{innerHTML:y(h)},n)}d.create("tr",null,s);for(let n in e[i])if(e[i][n])if(Object.prototype.toString.call(e[i][n])==="[object Object]"||Object.prototype.toString.call(e[i][n])==="[object Array]"){let h=d.create("td",null,o);this.rowToTable(e[i][n],e[i],h)}else if(n.indexOf("__html",n.length-6)!==-1)d.create("td",{innerHTML:e[i][n]},o);else if(n.indexOf("__javascript",n.length-12)!==-1)d.create("td",null,o);else{let h=e[i][n];d.create("td",{innerHTML:y(h)},o)}else d.create("td",{innerHTML:""},o)}break}}getIdentity(e){return e.__hpcc_id}_request(e,t){if(!this.wuResult)return Promise.resolve({totalLength:0,data:[]});let r=`${e}->${t}`;if(this._cache[r])return this._cache[r];let s=this.wuResult.fetchRows(e,t-e,!1,this._filter).then(a=>({totalLength:this.wuResult.Total,data:a.map((i,o)=>{let n=this.rowFormatter.format(i);return n.__hpcc_id=e+o,n.__hpcc_orig=i,n})}));return this._cache[r]=s,s}fetchRange(e){let t=new se;return this._request(e.start,e.end).then(r=>t.resolve(r)),new ie(t.then(r=>r.data),{totalLength:t.then(r=>r.totalLength)})}};var _=class extends ne{static{l(this,"WUResult")}_result;_localStore;constructor(){super(),this.renderHtml(!1)}hashSum(e={}){return ce({baseUrl:this.baseUrl(),wuid:this.wuid(),resultName:this.resultName(),sequence:this.sequence(),nodeGroup:this.nodeGroup(),logicalFile:this.logicalFile(),userID:this.user(),password:this.password(),...e})}_prevResultHash;calcResult(){let e=this.hashSum();if(this._prevResultHash!==e){this._prevResultHash=e;let t={baseUrl:this.baseUrl(),userID:this.user(),password:this.password()};this.wuid()&&this.resultName()?this._result=V.attach(t,this.wuid(),this.resultName()):this.wuid()&&this.sequence()!==void 0?this._result=V.attach(t,this.wuid(),this.sequence()):this.logicalFile()&&this.nodeGroup()?this._result=V.attachLogicalFile(t,this.nodeGroup(),this.logicalFile()):this.logicalFile()&&(this._result=V.attachLogicalFile(t,"",this.logicalFile()))}return this._result}fetch(e,t,r=new AbortController){let s=this.calcResult();return s?s.fetchRows(e,t,!1,{},r.signal):Promise.resolve([])}_prevStoreHash;_prevQueryHash;update(e,t){super.update(e,t);let r=this.hashSum({renderHtml:this.renderHtml(),filter:this.filter()});if(this._prevStoreHash!==r){this._prevStoreHash=r;let s=this.calcResult();s&&s.fetchXMLSchema().then(a=>{this._localStore=new I(s,a,this.renderHtml(),this.filter()),this._dgrid?.set("columns",this._localStore.columns()),this._dgrid?.set("collection",this._localStore)})}}click(e,t,r){}};_.prototype._class+=" eclwatch_WUResult";_.prototype.publish("baseUrl","","string","URL to WsWorkunits");_.prototype.publish("user","","string","User ID");_.prototype.publish("password","","string","Password");_.prototype.publish("wuid","","string","Workunit ID");_.prototype.publish("resultName","","string","Result Name");_.prototype.publish("sequence",void 0,"number","Sequence Number");_.prototype.publish("nodeGroup","","string","NodeGroup");_.prototype.publish("logicalFile","","string","Logical File Name");_.prototype.publish("filter",{},"object","Filter");import{Workunit as he,WUStateID as u}from"@hpcc-js/comms";import{Edge as le,Graph as pe,Vertex as ue}from"@hpcc-js/graph";import{hashSum as de}from"@hpcc-js/util";var ge=(s=>(s.CREATE="Created",s.COMPILE="Compiled",s.EXECUTE="Executed",s.COMPLETE="Completed",s))(ge||{}),_e=(s=>(s.CREATE="Creating",s.COMPILE="Compiling",s.EXECUTE="Executing",s.COMPLETE="Completed",s))(_e||{}),w=class extends pe{static{l(this,"WUStatus")}_wu;_wuHandle;_create;_compile;_execute;_complete;constructor(){super(),this.zoomable(!1).zoomToFitLimit(1).layout("Hierarchy").hierarchyRankDirection("LR").showToolbar(!1).allowDragging(!1)}_prevHash;attachWorkunit(){let e=de({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==e&&(this._prevHash=e,this._wu=he.attach({baseUrl:this.baseUrl()},this.wuid()),this._wuHandle&&this._wuHandle.release(),this._wuHandle=this._wu.watch(t=>{this.lazyRender()}))}createVertex(e){return new ue().icon_diameter(32).icon_shape_colorFill("none").icon_shape_colorStroke("none").icon_image_colorFill("darkgray").iconAnchor("middle").textbox_shape_colorFill("none").textbox_shape_colorStroke("none").textbox_text_colorFill("darkgray").faChar(e)}updateVertex(e,t){e.icon_image_colorFill(t).textbox_text_colorFill(t)}updateVertexStatus(e,t=!1){let r=this._wu.isFailed()?"darkred":"darkgreen";switch(this._create.text("Created"),this._compile.text("Compiled"),this._execute.text("Executed"),this._complete.text("Completed"),e){case 0:this.updateVertex(this._create,"darkgray"),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 1:this._create.text("Creating"),this.updateVertex(this._create,t?"orange":r),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 2:this._compile.text("Compiling"),this.updateVertex(this._create,r),this.updateVertex(this._compile,t?"orange":r),this.updateVertex(this._execute,r),this.updateVertex(this._complete,"darkgray");break;case 3:this._execute.text("Executing"),this.updateVertex(this._create,r),this.updateVertex(this._compile,r),this.updateVertex(this._execute,t?"orange":r),this.updateVertex(this._complete,"darkgray");break;case 4:this.updateVertex(this._create,r),this.updateVertex(this._compile,r),this.updateVertex(this._execute,r),this.updateVertex(this._complete,r);break}}createEdge(e,t){return new le().sourceVertex(e).targetVertex(t).strokeColor("black").showArc(!1)}enter(e,t){super.enter(e,t),this._create=this.createVertex("\uF11D"),this._compile=this.createVertex("\uF085"),this._execute=this.createVertex("\uF275"),this._complete=this.createVertex("\uF11E");let r=this.createEdge(this._create,this._compile),s=this.createEdge(this._compile,this._execute),a=this.createEdge(this._execute,this._complete);this.data({vertices:[this._create,this._compile,this._execute,this._complete],edges:[r,s,a]})}update(e,t){switch(this.attachWorkunit(),this._wu.StateID){case u.Blocked:case u.Wait:case u.Scheduled:case u.UploadingFiled:this.updateVertexStatus(1);break;case u.Compiling:this.updateVertexStatus(2,!0);break;case u.Submitted:this.updateVertexStatus(1,!0);break;case u.Compiled:this.updateVertexStatus(2);break;case u.Aborting:case u.Running:this.updateVertexStatus(3,!0);break;case u.Aborted:case u.Archived:case u.Completed:this.updateVertexStatus(4);break;case u.Failed:this.updateVertexStatus(4,!1);break;case u.DebugPaused:case u.DebugRunning:case u.Paused:case u.Unknown:default:this.updateVertexStatus(0);break}super.update(e,t),this.zoomToFit()}exit(e,t){this._wuHandle&&this._wuHandle.release(),super.exit(e,t)}};w.prototype._class+=" eclwatch_WUStatus";w.prototype.publish("baseUrl","","string","HPCC Platform Base URL");w.prototype.publish("wuid","","string","Workunit ID");import{Palette as fe}from"@hpcc-js/common";import{Workunit as me}from"@hpcc-js/comms";import{ReactTimelineSeries as be}from"@hpcc-js/timeline";import{hashSum as Se}from"@hpcc-js/util";var A=["label","start","end","icon","color","series"],b=class extends be{static{l(this,"WUTimeline")}_palette=fe.ordinal("default");constructor(){super(),this.columns(A).titleColumn("label").iconColumn("icon").colorColumn("color").seriesColumn("series").timePattern("%Y-%m-%dT%H:%M:%S.%LZ").tickFormat("%H:%M").tooltipTimeFormat("%H:%M:%S.%L").tooltipHTML(e=>e[A.length].calcTooltip())}_prevHashSum;clear(){return delete this._prevHashSum,this}fetchScopes(){let e=Se({baseUrl:this.baseUrl(),wuid:this.wuid(),request:this.request()});this._prevHashSum!==e&&(this._prevHashSum=e,me.attach({baseUrl:this.baseUrl()},this.wuid()).fetchDetails(this.request()).then(r=>r.filter(s=>s.Id&&s.attr("WhenStarted").RawValue).map(s=>{let a=+s.attr("WhenStarted").RawValue/1e3,i=+s.attr("TimeElapsed").RawValue/1e6;return[s.Id,new Date(a).toISOString(),i?new Date(a+i).toISOString():void 0,null,this._palette(s.ScopeType),s.ScopeName.split("::").join(":").split(":").slice(0,1),s]})).then(r=>{this.data(r).render()}))}enter(e,t){super.enter(e,t)}update(e,t){this.fetchScopes(),super.update(e,t)}exit(e,t){super.exit(e,t)}};b.prototype._class+=" eclwatch_WUTimeline";b.prototype.publish("baseUrl","","string","HPCC Platform Base URL");b.prototype.publish("wuid","","string","Workunit ID");b.prototype.publish("request",{ScopeFilter:{MaxDepth:3,ScopeTypes:["graph","subgraph"]},NestedFilter:{Depth:0,ScopeTypes:[]},PropertiesToReturn:{AllProperties:!1,AllStatistics:!0,AllHints:!1,Properties:["WhenStarted","TimeElapsed"]},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},"object","WUDetails Request");export{ke as BUILD_VERSION,p as ECLArchiveViewer,we as PKG_NAME,xe as PKG_VERSION,ge as STATUS,_e as STATUS_ACTIVE,m as WUGraph,_ as WUResult,k as WUScopeController,w as WUStatus,b as WUTimeline};
1651
52
  //# sourceMappingURL=index.js.map