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