@hpcc-js/eclwatch 2.77.6 → 2.77.7

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.
@@ -1,126 +1,126 @@
1
- import { Vertex } from "@hpcc-js/graph";
2
- import { Legend } from "@hpcc-js/layout";
3
- import { local as d3Local, select as d3Select } from "d3-selection";
4
-
5
- import "../src/WUGraphLegend.css";
6
-
7
- export interface WUGraphLegendData {
8
- kind: number;
9
- faChar: string;
10
- label: string;
11
- count: number;
12
- }
13
-
14
- class LegendVertex extends Vertex {
15
-
16
- constructor() {
17
- super();
18
- }
19
-
20
- enter(domNode, element) {
21
- super.enter(domNode, element);
22
- this._icon.on("click", () => {
23
- this.click(this.data());
24
- });
25
- }
26
-
27
- click(kind: number) {
28
- }
29
- }
30
-
31
- export class WUGraphLegend extends Legend {
32
-
33
- private icon = d3Local<Vertex>();
34
- protected _disabled2: { [kind: number]: boolean } = {
35
- /* TODO: Default some to disabled?
36
- 43: true,
37
- 71: true,
38
- 82: true,
39
- 88: true
40
- */
41
- };
42
-
43
- disabled(): number[];
44
- disabled(_: number[]): this;
45
- disabled(_?: number[]): number[] | this {
46
- if (!arguments.length) {
47
- const retVal = [];
48
- for (const key in this._disabled2) {
49
- if (this._disabled2[key]) {
50
- retVal.push(key);
51
- }
52
- }
53
- return retVal;
54
- }
55
- this._disabled2 = {};
56
- _.forEach(kind => this._disabled2[kind] = true);
57
- return this;
58
- }
59
-
60
- toggle(kind: number) {
61
- this._disabled2[kind] = !this._disabled2[kind];
62
- }
63
-
64
- update(domNode, element) {
65
- super.update(domNode, element);
66
-
67
- const context = this;
68
- const items = this._g.selectAll(".legendItem").data(this.data(), (d: any) => d.kind);
69
- items.enter().append("g")
70
- .attr("class", "legendItem")
71
- .each(function (this: HTMLElement, d) {
72
- context.icon.set(this, new LegendVertex()
73
- .target(this)
74
- .data(d.kind)
75
- .textbox_shape_colorStroke("none")
76
- .textbox_shape_colorFill("none")
77
- .iconAnchor("left")
78
- .faChar(d.faChar)
79
- .text(`${d.label} (${d.count})`)
80
- .tooltip(`${d.kind} - ${d.label}`)
81
- .on("click", kind => {
82
- context.toggle(kind);
83
- context.render();
84
- context.click(kind);
85
- })
86
- .on("mouseover", kind => {
87
- context.mouseover(kind);
88
- })
89
- .on("mouseout", kind => {
90
- context.mouseout(kind);
91
- })
92
- );
93
- })
94
- .merge(items)
95
- .each(function (this: HTMLElement, d, i) {
96
- const bbox = context.icon.get(this)
97
- .icon_shape_colorFill(context._disabled2[d.kind] ? "gray" : null)
98
- .render().getBBox();
99
-
100
- d3Select(this)
101
- .attr("transform", `translate(${+bbox.width / 2}, ${i * 30})`)
102
- ;
103
- })
104
- ;
105
- items.exit()
106
- .each(function (this: HTMLElement, d) {
107
- context.icon.get(this)
108
- .target(null)
109
- .render();
110
- })
111
- .remove();
112
- const bbox = this.getBBox(true, true);
113
- this._g.attr("transform", `translate(16, ${this.height() / 2 - bbox.height / 2})`);
114
- }
115
-
116
- // Events ---
117
- click(kind: number) {
118
- }
119
-
120
- mouseover(kind: number) {
121
- }
122
-
123
- mouseout(kind: number) {
124
- }
125
- }
126
- WUGraphLegend.prototype._class += " eclwatch_WUGraphLegend";
1
+ import { Vertex } from "@hpcc-js/graph";
2
+ import { Legend } from "@hpcc-js/layout";
3
+ import { local as d3Local, select as d3Select } from "d3-selection";
4
+
5
+ import "../src/WUGraphLegend.css";
6
+
7
+ export interface WUGraphLegendData {
8
+ kind: number;
9
+ faChar: string;
10
+ label: string;
11
+ count: number;
12
+ }
13
+
14
+ class LegendVertex extends Vertex {
15
+
16
+ constructor() {
17
+ super();
18
+ }
19
+
20
+ enter(domNode, element) {
21
+ super.enter(domNode, element);
22
+ this._icon.on("click", () => {
23
+ this.click(this.data());
24
+ });
25
+ }
26
+
27
+ click(kind: number) {
28
+ }
29
+ }
30
+
31
+ export class WUGraphLegend extends Legend {
32
+
33
+ private icon = d3Local<Vertex>();
34
+ protected _disabled2: { [kind: number]: boolean } = {
35
+ /* TODO: Default some to disabled?
36
+ 43: true,
37
+ 71: true,
38
+ 82: true,
39
+ 88: true
40
+ */
41
+ };
42
+
43
+ disabled(): number[];
44
+ disabled(_: number[]): this;
45
+ disabled(_?: number[]): number[] | this {
46
+ if (!arguments.length) {
47
+ const retVal = [];
48
+ for (const key in this._disabled2) {
49
+ if (this._disabled2[key]) {
50
+ retVal.push(key);
51
+ }
52
+ }
53
+ return retVal;
54
+ }
55
+ this._disabled2 = {};
56
+ _.forEach(kind => this._disabled2[kind] = true);
57
+ return this;
58
+ }
59
+
60
+ toggle(kind: number) {
61
+ this._disabled2[kind] = !this._disabled2[kind];
62
+ }
63
+
64
+ update(domNode, element) {
65
+ super.update(domNode, element);
66
+
67
+ const context = this;
68
+ const items = this._g.selectAll(".legendItem").data(this.data(), (d: any) => d.kind);
69
+ items.enter().append("g")
70
+ .attr("class", "legendItem")
71
+ .each(function (this: HTMLElement, d) {
72
+ context.icon.set(this, new LegendVertex()
73
+ .target(this)
74
+ .data(d.kind)
75
+ .textbox_shape_colorStroke("none")
76
+ .textbox_shape_colorFill("none")
77
+ .iconAnchor("left")
78
+ .faChar(d.faChar)
79
+ .text(`${d.label} (${d.count})`)
80
+ .tooltip(`${d.kind} - ${d.label}`)
81
+ .on("click", kind => {
82
+ context.toggle(kind);
83
+ context.render();
84
+ context.click(kind);
85
+ })
86
+ .on("mouseover", kind => {
87
+ context.mouseover(kind);
88
+ })
89
+ .on("mouseout", kind => {
90
+ context.mouseout(kind);
91
+ })
92
+ );
93
+ })
94
+ .merge(items)
95
+ .each(function (this: HTMLElement, d, i) {
96
+ const bbox = context.icon.get(this)
97
+ .icon_shape_colorFill(context._disabled2[d.kind] ? "gray" : null)
98
+ .render().getBBox();
99
+
100
+ d3Select(this)
101
+ .attr("transform", `translate(${+bbox.width / 2}, ${i * 30})`)
102
+ ;
103
+ })
104
+ ;
105
+ items.exit()
106
+ .each(function (this: HTMLElement, d) {
107
+ context.icon.get(this)
108
+ .target(null)
109
+ .render();
110
+ })
111
+ .remove();
112
+ const bbox = this.getBBox(true, true);
113
+ this._g.attr("transform", `translate(16, ${this.height() / 2 - bbox.height / 2})`);
114
+ }
115
+
116
+ // Events ---
117
+ click(kind: number) {
118
+ }
119
+
120
+ mouseover(kind: number) {
121
+ }
122
+
123
+ mouseout(kind: number) {
124
+ }
125
+ }
126
+ WUGraphLegend.prototype._class += " eclwatch_WUGraphLegend";
package/src/WUResult.ts CHANGED
@@ -1,111 +1,111 @@
1
- import { publish } from "@hpcc-js/common";
2
- import { ResultFilter, IOptions, Result } from "@hpcc-js/comms";
3
- import { Common } from "@hpcc-js/dgrid";
4
- import { hashSum } from "@hpcc-js/util";
5
- import { Store } from "./WUResultStore";
6
-
7
- export class WUResult extends Common {
8
-
9
- protected _result: Result;
10
- protected _localStore: Store;
11
-
12
- constructor() {
13
- super();
14
- this.renderHtml(false);
15
- }
16
-
17
- @publish("", "string", "URL to WsWorkunits")
18
- baseUrl: { (): string, (_: string): WUResult };
19
- @publish(undefined, "string", "Workunit ID")
20
- user: { (): string, (_: string): WUResult };
21
- @publish(undefined, "string", "User ID")
22
- password: { (): string, (_: string): WUResult };
23
- @publish(undefined, "string", "Password")
24
- wuid: { (): string, (_: string): WUResult };
25
- @publish(undefined, "string", "Result Name")
26
- resultName: { (): string, (_: string): WUResult };
27
- @publish(undefined, "number", "Sequence Number")
28
- sequence: { (): number, (_: number): WUResult };
29
- @publish("", "string", "NodeGroup")
30
- nodeGroup: { (): string, (_: string): WUResult };
31
- @publish("", "string", "Logical File Name")
32
- logicalFile: { (): string, (_: string): WUResult };
33
- @publish({}, "object", "Filter")
34
- filter: { (): ResultFilter, (_: ResultFilter): WUResult };
35
-
36
- hashSum(opts: any = {}) {
37
- return hashSum({
38
- baseUrl: this.baseUrl(),
39
- wuid: this.wuid(),
40
- resultName: this.resultName(),
41
- sequence: this.sequence(),
42
- nodeGroup: this.nodeGroup(),
43
- logicalFile: this.logicalFile(),
44
- userID: this.user(),
45
- password: this.password(),
46
- ...opts
47
- });
48
- }
49
-
50
- protected _prevResultHash: string;
51
- calcResult(): Result | null {
52
- const resultHash = this.hashSum();
53
- if (this._prevResultHash !== resultHash) {
54
- this._prevResultHash = resultHash;
55
-
56
- const opts: IOptions = {
57
- baseUrl: this.baseUrl(),
58
- userID: this.user(),
59
- password: this.password()
60
- };
61
- if (this.wuid() && this.resultName()) {
62
- this._result = Result.attach(opts, this.wuid(), this.resultName());
63
- } else if (this.wuid() && this.sequence() !== undefined) {
64
- this._result = Result.attach(opts, this.wuid(), this.sequence());
65
- } else if (this.logicalFile() && this.nodeGroup()) {
66
- this._result = Result.attachLogicalFile(opts, this.nodeGroup(), this.logicalFile());
67
- } else if (this.logicalFile()) {
68
- this._result = Result.attachLogicalFile(opts, "", this.logicalFile());
69
- }
70
- }
71
- return this._result;
72
- }
73
-
74
- fetch(row, count, abortController = new AbortController()): Promise<object[]> {
75
- const result = this.calcResult();
76
- if (result) {
77
- return result.fetchRows(row, count, false, {}, abortController.signal);
78
- }
79
- return Promise.resolve([]);
80
- }
81
-
82
- protected _prevStoreHash: string;
83
- protected _prevQueryHash: string;
84
- update(domNode, element) {
85
- super.update(domNode, element);
86
- const storeHash = this.hashSum({
87
- renderHtml: this.renderHtml(),
88
- filter: this.filter()
89
- });
90
- if (this._prevStoreHash !== storeHash) {
91
- this._prevStoreHash = storeHash;
92
- const result = this.calcResult();
93
- if (result) {
94
- result.fetchXMLSchema().then(schema => {
95
- this._localStore = new Store(result, schema, this.renderHtml(), this.filter(), (msg) => {
96
- if (this._dgrid) {
97
- this._dgrid.noDataMessage = `<span class='dojoxGridNoData'>${msg}</span>`;
98
- this._dgrid.refresh();
99
- }
100
- });
101
- this._dgrid?.set("columns", this._localStore.columns());
102
- this._dgrid?.set("collection", this._localStore);
103
- });
104
- }
105
- }
106
- }
107
-
108
- click(row, col, sel) {
109
- }
110
- }
111
- WUResult.prototype._class += " eclwatch_WUResult";
1
+ import { publish } from "@hpcc-js/common";
2
+ import { ResultFilter, IOptions, Result } from "@hpcc-js/comms";
3
+ import { Common } from "@hpcc-js/dgrid";
4
+ import { hashSum } from "@hpcc-js/util";
5
+ import { Store } from "./WUResultStore";
6
+
7
+ export class WUResult extends Common {
8
+
9
+ protected _result: Result;
10
+ protected _localStore: Store;
11
+
12
+ constructor() {
13
+ super();
14
+ this.renderHtml(false);
15
+ }
16
+
17
+ @publish("", "string", "URL to WsWorkunits")
18
+ baseUrl: { (): string, (_: string): WUResult };
19
+ @publish(undefined, "string", "Workunit ID")
20
+ user: { (): string, (_: string): WUResult };
21
+ @publish(undefined, "string", "User ID")
22
+ password: { (): string, (_: string): WUResult };
23
+ @publish(undefined, "string", "Password")
24
+ wuid: { (): string, (_: string): WUResult };
25
+ @publish(undefined, "string", "Result Name")
26
+ resultName: { (): string, (_: string): WUResult };
27
+ @publish(undefined, "number", "Sequence Number")
28
+ sequence: { (): number, (_: number): WUResult };
29
+ @publish("", "string", "NodeGroup")
30
+ nodeGroup: { (): string, (_: string): WUResult };
31
+ @publish("", "string", "Logical File Name")
32
+ logicalFile: { (): string, (_: string): WUResult };
33
+ @publish({}, "object", "Filter")
34
+ filter: { (): ResultFilter, (_: ResultFilter): WUResult };
35
+
36
+ hashSum(opts: any = {}) {
37
+ return hashSum({
38
+ baseUrl: this.baseUrl(),
39
+ wuid: this.wuid(),
40
+ resultName: this.resultName(),
41
+ sequence: this.sequence(),
42
+ nodeGroup: this.nodeGroup(),
43
+ logicalFile: this.logicalFile(),
44
+ userID: this.user(),
45
+ password: this.password(),
46
+ ...opts
47
+ });
48
+ }
49
+
50
+ protected _prevResultHash: string;
51
+ calcResult(): Result | null {
52
+ const resultHash = this.hashSum();
53
+ if (this._prevResultHash !== resultHash) {
54
+ this._prevResultHash = resultHash;
55
+
56
+ const opts: IOptions = {
57
+ baseUrl: this.baseUrl(),
58
+ userID: this.user(),
59
+ password: this.password()
60
+ };
61
+ if (this.wuid() && this.resultName()) {
62
+ this._result = Result.attach(opts, this.wuid(), this.resultName());
63
+ } else if (this.wuid() && this.sequence() !== undefined) {
64
+ this._result = Result.attach(opts, this.wuid(), this.sequence());
65
+ } else if (this.logicalFile() && this.nodeGroup()) {
66
+ this._result = Result.attachLogicalFile(opts, this.nodeGroup(), this.logicalFile());
67
+ } else if (this.logicalFile()) {
68
+ this._result = Result.attachLogicalFile(opts, "", this.logicalFile());
69
+ }
70
+ }
71
+ return this._result;
72
+ }
73
+
74
+ fetch(row, count, abortController = new AbortController()): Promise<object[]> {
75
+ const result = this.calcResult();
76
+ if (result) {
77
+ return result.fetchRows(row, count, false, {}, abortController.signal);
78
+ }
79
+ return Promise.resolve([]);
80
+ }
81
+
82
+ protected _prevStoreHash: string;
83
+ protected _prevQueryHash: string;
84
+ update(domNode, element) {
85
+ super.update(domNode, element);
86
+ const storeHash = this.hashSum({
87
+ renderHtml: this.renderHtml(),
88
+ filter: this.filter()
89
+ });
90
+ if (this._prevStoreHash !== storeHash) {
91
+ this._prevStoreHash = storeHash;
92
+ const result = this.calcResult();
93
+ if (result) {
94
+ result.fetchXMLSchema().then(schema => {
95
+ this._localStore = new Store(result, schema, this.renderHtml(), this.filter(), (msg) => {
96
+ if (this._dgrid) {
97
+ this._dgrid.noDataMessage = `<span class='dojoxGridNoData'>${msg}</span>`;
98
+ this._dgrid.refresh();
99
+ }
100
+ });
101
+ this._dgrid?.set("columns", this._localStore.columns());
102
+ this._dgrid?.set("collection", this._localStore);
103
+ });
104
+ }
105
+ }
106
+ }
107
+
108
+ click(row, col, sel) {
109
+ }
110
+ }
111
+ WUResult.prototype._class += " eclwatch_WUResult";