@hpcc-js/eclwatch 3.6.5 → 3.6.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,130 +1,130 @@
1
- import { ResultFilter, IOptions, Result } from "@hpcc-js/comms";
2
- import { Common } from "@hpcc-js/dgrid";
3
- import { hashSum } from "@hpcc-js/util";
4
- import { Store } from "./WUResultStore.ts";
5
-
6
- export class WUResult extends Common {
7
-
8
- protected _result: Result;
9
- protected _localStore: Store;
10
-
11
- constructor() {
12
- super();
13
- this.renderHtml(false);
14
- }
15
-
16
- hashSum(opts: any = {}) {
17
- return hashSum({
18
- baseUrl: this.baseUrl(),
19
- wuid: this.wuid(),
20
- resultName: this.resultName(),
21
- sequence: this.sequence(),
22
- nodeGroup: this.nodeGroup(),
23
- logicalFile: this.logicalFile(),
24
- userID: this.user(),
25
- password: this.password(),
26
- bypassCache: this.bypassCache(),
27
- ...opts
28
- });
29
- }
30
-
31
- protected _prevResultHash: string;
32
- calcResult(): Result | null {
33
- const resultHash = this.hashSum();
34
- if (this._prevResultHash !== resultHash) {
35
- this._prevResultHash = resultHash;
36
-
37
- const opts: IOptions = {
38
- baseUrl: this.baseUrl(),
39
- userID: this.user(),
40
- password: this.password()
41
- };
42
- if (this.wuid() && this.resultName()) {
43
- this._result = Result.attach(opts, this.wuid(), this.resultName());
44
- } else if (this.wuid() && this.sequence() !== undefined) {
45
- this._result = Result.attach(opts, this.wuid(), this.sequence());
46
- } else if (this.logicalFile() && this.nodeGroup()) {
47
- this._result = Result.attachLogicalFile(opts, this.nodeGroup(), this.logicalFile());
48
- } else if (this.logicalFile()) {
49
- this._result = Result.attachLogicalFile(opts, "", this.logicalFile());
50
- }
51
-
52
- if (this._result && this.bypassCache()) {
53
- this._result.bypassCache(this.bypassCache());
54
- }
55
- }
56
- return this._result;
57
- }
58
-
59
- fetch(row, count, abortController = new AbortController()): Promise<object[]> {
60
- const result = this.calcResult();
61
- if (result) {
62
- return result.fetchRows(row, count, false, {}, abortController.signal);
63
- }
64
- return Promise.resolve([]);
65
- }
66
-
67
- protected _prevStoreHash: string;
68
- protected _prevQueryHash: string;
69
- update(domNode, element) {
70
- super.update(domNode, element);
71
- const storeHash = this.hashSum({
72
- renderHtml: this.renderHtml(),
73
- filter: this.filter()
74
- });
75
- if (this._prevStoreHash !== storeHash) {
76
- this._prevStoreHash = storeHash;
77
- const result = this.calcResult();
78
- if (result) {
79
- result.fetchXMLSchema().then(schema => {
80
- this._localStore = new Store(result, schema, this.renderHtml(), this.filter(), (msg) => {
81
- if (this._dgrid) {
82
- this._dgrid.noDataMessage = `<span class='dojoxGridNoData'>${msg}</span>`;
83
- this._dgrid.refresh();
84
- }
85
- });
86
- this._dgrid?.set("columns", this._localStore.columns());
87
- this._dgrid?.set("collection", this._localStore);
88
- });
89
- }
90
- }
91
- }
92
-
93
- click(row, col, sel) {
94
- }
95
- }
96
- WUResult.prototype._class += " eclwatch_WUResult";
97
-
98
- export interface WUResult {
99
- baseUrl(): string;
100
- baseUrl(_: string): this;
101
- user(): string;
102
- user(_: string): this;
103
- password(): string;
104
- password(_: string): this;
105
- wuid(): string;
106
- wuid(_: string): this;
107
- resultName(): string;
108
- resultName(_: string): this;
109
- sequence(): number;
110
- sequence(_: number): this;
111
- nodeGroup(): string;
112
- nodeGroup(_: string): this;
113
- logicalFile(): string;
114
- logicalFile(_: string): this;
115
- filter(): ResultFilter;
116
- filter(_: ResultFilter): this;
117
- bypassCache(): boolean;
118
- bypassCache(_: boolean): this;
119
- }
120
-
121
- WUResult.prototype.publish("baseUrl", "", "string", "URL to WsWorkunits");
122
- WUResult.prototype.publish("user", "", "string", "User ID");
123
- WUResult.prototype.publish("password", "", "string", "Password");
124
- WUResult.prototype.publish("wuid", "", "string", "Workunit ID");
125
- WUResult.prototype.publish("resultName", "", "string", "Result Name");
126
- WUResult.prototype.publish("sequence", undefined, "number", "Sequence Number");
127
- WUResult.prototype.publish("nodeGroup", "", "string", "NodeGroup");
128
- WUResult.prototype.publish("logicalFile", "", "string", "Logical File Name");
129
- WUResult.prototype.publish("filter", {}, "object", "Filter");
130
- WUResult.prototype.publish("bypassCache", false, "boolean", "Bypass cached results");
1
+ import { ResultFilter, IOptions, Result } from "@hpcc-js/comms";
2
+ import { Common } from "@hpcc-js/dgrid";
3
+ import { hashSum } from "@hpcc-js/util";
4
+ import { Store } from "./WUResultStore.ts";
5
+
6
+ export class WUResult extends Common {
7
+
8
+ protected _result: Result;
9
+ protected _localStore: Store;
10
+
11
+ constructor() {
12
+ super();
13
+ this.renderHtml(false);
14
+ }
15
+
16
+ hashSum(opts: any = {}) {
17
+ return hashSum({
18
+ baseUrl: this.baseUrl(),
19
+ wuid: this.wuid(),
20
+ resultName: this.resultName(),
21
+ sequence: this.sequence(),
22
+ nodeGroup: this.nodeGroup(),
23
+ logicalFile: this.logicalFile(),
24
+ userID: this.user(),
25
+ password: this.password(),
26
+ bypassCache: this.bypassCache(),
27
+ ...opts
28
+ });
29
+ }
30
+
31
+ protected _prevResultHash: string;
32
+ calcResult(): Result | null {
33
+ const resultHash = this.hashSum();
34
+ if (this._prevResultHash !== resultHash) {
35
+ this._prevResultHash = resultHash;
36
+
37
+ const opts: IOptions = {
38
+ baseUrl: this.baseUrl(),
39
+ userID: this.user(),
40
+ password: this.password()
41
+ };
42
+ if (this.wuid() && this.resultName()) {
43
+ this._result = Result.attach(opts, this.wuid(), this.resultName());
44
+ } else if (this.wuid() && this.sequence() !== undefined) {
45
+ this._result = Result.attach(opts, this.wuid(), this.sequence());
46
+ } else if (this.logicalFile() && this.nodeGroup()) {
47
+ this._result = Result.attachLogicalFile(opts, this.nodeGroup(), this.logicalFile());
48
+ } else if (this.logicalFile()) {
49
+ this._result = Result.attachLogicalFile(opts, "", this.logicalFile());
50
+ }
51
+
52
+ if (this._result && this.bypassCache()) {
53
+ this._result.bypassCache(this.bypassCache());
54
+ }
55
+ }
56
+ return this._result;
57
+ }
58
+
59
+ fetch(row, count, abortController = new AbortController()): Promise<object[]> {
60
+ const result = this.calcResult();
61
+ if (result) {
62
+ return result.fetchRows(row, count, false, {}, abortController.signal);
63
+ }
64
+ return Promise.resolve([]);
65
+ }
66
+
67
+ protected _prevStoreHash: string;
68
+ protected _prevQueryHash: string;
69
+ update(domNode, element) {
70
+ super.update(domNode, element);
71
+ const storeHash = this.hashSum({
72
+ renderHtml: this.renderHtml(),
73
+ filter: this.filter()
74
+ });
75
+ if (this._prevStoreHash !== storeHash) {
76
+ this._prevStoreHash = storeHash;
77
+ const result = this.calcResult();
78
+ if (result) {
79
+ result.fetchXMLSchema().then(schema => {
80
+ this._localStore = new Store(result, schema, this.renderHtml(), this.filter(), (msg) => {
81
+ if (this._dgrid) {
82
+ this._dgrid.noDataMessage = `<span class='dojoxGridNoData'>${msg}</span>`;
83
+ this._dgrid.refresh();
84
+ }
85
+ });
86
+ this._dgrid?.set("columns", this._localStore.columns());
87
+ this._dgrid?.set("collection", this._localStore);
88
+ });
89
+ }
90
+ }
91
+ }
92
+
93
+ click(row, col, sel) {
94
+ }
95
+ }
96
+ WUResult.prototype._class += " eclwatch_WUResult";
97
+
98
+ export interface WUResult {
99
+ baseUrl(): string;
100
+ baseUrl(_: string): this;
101
+ user(): string;
102
+ user(_: string): this;
103
+ password(): string;
104
+ password(_: string): this;
105
+ wuid(): string;
106
+ wuid(_: string): this;
107
+ resultName(): string;
108
+ resultName(_: string): this;
109
+ sequence(): number;
110
+ sequence(_: number): this;
111
+ nodeGroup(): string;
112
+ nodeGroup(_: string): this;
113
+ logicalFile(): string;
114
+ logicalFile(_: string): this;
115
+ filter(): ResultFilter;
116
+ filter(_: ResultFilter): this;
117
+ bypassCache(): boolean;
118
+ bypassCache(_: boolean): this;
119
+ }
120
+
121
+ WUResult.prototype.publish("baseUrl", "", "string", "URL to WsWorkunits");
122
+ WUResult.prototype.publish("user", "", "string", "User ID");
123
+ WUResult.prototype.publish("password", "", "string", "Password");
124
+ WUResult.prototype.publish("wuid", "", "string", "Workunit ID");
125
+ WUResult.prototype.publish("resultName", "", "string", "Result Name");
126
+ WUResult.prototype.publish("sequence", undefined, "number", "Sequence Number");
127
+ WUResult.prototype.publish("nodeGroup", "", "string", "NodeGroup");
128
+ WUResult.prototype.publish("logicalFile", "", "string", "Logical File Name");
129
+ WUResult.prototype.publish("filter", {}, "object", "Filter");
130
+ WUResult.prototype.publish("bypassCache", false, "boolean", "Bypass cached results");