@hpcc-js/eclwatch 3.3.5 → 3.4.0

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