querysub 0.399.0 → 0.400.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/package.json +1 -1
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleInstanceTableView.tsx +61 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCyclePage.tsx +9 -5
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleRenderer.tsx +33 -14
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycleSearch.tsx +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { qreact } from "../../../4-dom/qreact";
|
|
2
|
+
import { Table } from "../../../5-diagnostics/Table";
|
|
3
|
+
import { formatValue } from "../../../5-diagnostics/GenericFormat";
|
|
4
|
+
import { LifeCycle, getVariables } from "./lifeCycles";
|
|
5
|
+
import { LifecycleInstance } from "./lifeCycleSearch";
|
|
6
|
+
|
|
7
|
+
export class LifeCycleInstanceTableView extends qreact.Component<{
|
|
8
|
+
lifeCycle: LifeCycle;
|
|
9
|
+
instance: LifecycleInstance;
|
|
10
|
+
}> {
|
|
11
|
+
render() {
|
|
12
|
+
let { lifeCycle, instance } = this.props;
|
|
13
|
+
|
|
14
|
+
let columnKeyToTitle = new Map<string, string>();
|
|
15
|
+
let allColumnKeys = new Set<string>();
|
|
16
|
+
|
|
17
|
+
for (let entryData of instance.entries) {
|
|
18
|
+
let entry = lifeCycle.entries.find(e => e.matchPattern === entryData.matchPattern);
|
|
19
|
+
if (!entry) continue;
|
|
20
|
+
|
|
21
|
+
let variables = getVariables(entry);
|
|
22
|
+
for (let variable of variables) {
|
|
23
|
+
allColumnKeys.add(variable.key);
|
|
24
|
+
if (variable.title && !columnKeyToTitle.has(variable.key)) {
|
|
25
|
+
columnKeyToTitle.set(variable.key, variable.title);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let rows = instance.entries.map((entryData) => {
|
|
31
|
+
let entry = lifeCycle.entries.find(e => e.matchPattern === entryData.matchPattern);
|
|
32
|
+
let entryTitle = entry && (entry.description || entry.matchPattern) || entryData.matchPattern;
|
|
33
|
+
|
|
34
|
+
let row: { entryTitle: string;[key: string]: unknown } = {
|
|
35
|
+
entryTitle: entryTitle,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (entry) {
|
|
39
|
+
let variables = getVariables(entry);
|
|
40
|
+
for (let variable of variables) {
|
|
41
|
+
row[variable.key] = entryData.datum[variable.key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return row;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
let columns: any = {
|
|
49
|
+
entryTitle: { title: "Entry" },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
for (let columnKey of allColumnKeys) {
|
|
53
|
+
columns[columnKey] = {
|
|
54
|
+
title: columnKeyToTitle.get(columnKey) || columnKey,
|
|
55
|
+
formatter: (value: unknown) => formatValue(value),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return <Table rows={rows} columns={columns} />;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { qreact } from "../../../4-dom/qreact";
|
|
2
2
|
import { t } from "../../../2-proxy/schema2";
|
|
3
3
|
import { css } from "typesafecss";
|
|
4
|
-
import { deepCloneJSON, nextId } from "socket-function/src/misc";
|
|
4
|
+
import { deepCloneJSON, nextId, sort } from "socket-function/src/misc";
|
|
5
5
|
import { Querysub } from "../../../4-querysub/QuerysubController";
|
|
6
6
|
import { InputLabel } from "../../../library-components/InputLabel";
|
|
7
7
|
import { Button } from "../../../library-components/Button";
|
|
@@ -32,6 +32,7 @@ import { isPublic } from "../../../config";
|
|
|
32
32
|
export let lifecycleIdURL = new URLParam("lifecycleid", "");
|
|
33
33
|
export let limitURL = new URLParam("lifecyclelimit", 16);
|
|
34
34
|
export let additionalSearchURL = new URLParam("lifecyclesearch", "");
|
|
35
|
+
export let lifecycleTableViewURL = new URLParam("lifecycletable", false);
|
|
35
36
|
|
|
36
37
|
export class LifeCyclePage extends qreact.Component {
|
|
37
38
|
controller = LifeCyclesController(SocketFunction.browserNodeId());
|
|
@@ -69,9 +70,10 @@ export class LifeCyclePage extends qreact.Component {
|
|
|
69
70
|
<div>Loading...</div>
|
|
70
71
|
</div>;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
lifeCycles = deepCloneJSON(lifeCycles);
|
|
74
|
+
sort(lifeCycles, x => -x.id.split("_")[0]);
|
|
73
75
|
|
|
74
|
-
let filteredLifeCycles =
|
|
76
|
+
let filteredLifeCycles = lifeCycles.filter(x =>
|
|
75
77
|
matchFilter({ value: this.state.filterText }, JSON.stringify(x))
|
|
76
78
|
);
|
|
77
79
|
|
|
@@ -83,6 +85,7 @@ export class LifeCyclePage extends qreact.Component {
|
|
|
83
85
|
filteredLifeCycles = filteredLifeCycles.filter(lc => lc.id === this.state.searchingLifeCycleId);
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
|
|
86
89
|
return <div className={css.vbox(16).pad2(16).fillWidth}>
|
|
87
90
|
<style>{`
|
|
88
91
|
.LifeCycleInstanceRenderer:has(.LifeCycleEntryEditor:hover) {
|
|
@@ -112,6 +115,7 @@ export class LifeCyclePage extends qreact.Component {
|
|
|
112
115
|
fillWidth
|
|
113
116
|
onKeyDown={(e) => {
|
|
114
117
|
if (e.key === "Enter" && lifecycleIdURL.value) {
|
|
118
|
+
additionalSearchURL.value = e.currentTarget.value;
|
|
115
119
|
void this.searchLifeCycle(lifecycleIdURL.value);
|
|
116
120
|
}
|
|
117
121
|
}}
|
|
@@ -149,7 +153,7 @@ export class LifeCyclePage extends qreact.Component {
|
|
|
149
153
|
}}
|
|
150
154
|
className={css.width(500)}
|
|
151
155
|
/>
|
|
152
|
-
<span>({filteredLifeCycles.length} / {
|
|
156
|
+
<span>({filteredLifeCycles.length} / {lifeCycles.length})</span>
|
|
153
157
|
{this.state.searchingLifeCycleId && (
|
|
154
158
|
<Button
|
|
155
159
|
hue={120}
|
|
@@ -264,7 +268,7 @@ export class LifeCyclePage extends qreact.Component {
|
|
|
264
268
|
)}
|
|
265
269
|
|
|
266
270
|
{this.state.lifecycleInstances.length > 0 && (() => {
|
|
267
|
-
let searchedLifeCycle =
|
|
271
|
+
let searchedLifeCycle = lifeCycles.find(lc => lc.id === this.state.searchingLifeCycleId);
|
|
268
272
|
if (!searchedLifeCycle) return <div>Cannot find life cycle instance {this.state.searchingLifeCycleId}</div>;
|
|
269
273
|
|
|
270
274
|
let lc = searchedLifeCycle;
|
|
@@ -13,9 +13,10 @@ import { niceStringify } from "../../../niceStringify";
|
|
|
13
13
|
import { getPathStr } from "../../../path";
|
|
14
14
|
import { MachineThreadInfo } from "../../MachineThreadInfo";
|
|
15
15
|
import { LifeCycleEntryEditor } from "./LifeCycleEntryEditor";
|
|
16
|
-
import { lifecycleIdURL } from "./LifeCyclePage";
|
|
16
|
+
import { lifecycleIdURL, lifecycleTableViewURL } from "./LifeCyclePage";
|
|
17
17
|
import { LifecycleInstance } from "./lifeCycleSearch";
|
|
18
18
|
import { LifeCycle, LifeCyclesController, LifeCycleEntry } from "./lifeCycles";
|
|
19
|
+
import { LifeCycleInstanceTableView } from "./LifeCycleInstanceTableView";
|
|
19
20
|
|
|
20
21
|
export class LifeCycleRenderer extends qreact.Component<{
|
|
21
22
|
lifeCycle: LifeCycle;
|
|
@@ -200,7 +201,7 @@ export class LifeCycleInstanceRenderer extends qreact.Component<{
|
|
|
200
201
|
}
|
|
201
202
|
title={statusTitle}
|
|
202
203
|
onClick={(e) => {
|
|
203
|
-
if ((e.target as HTMLElement).closest(".
|
|
204
|
+
if ((e.target as HTMLElement).closest(".LifeCycleRenderer-contents")) {
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
206
207
|
this.state.expanded = !this.state.expanded;
|
|
@@ -270,19 +271,37 @@ export class LifeCycleInstanceRenderer extends qreact.Component<{
|
|
|
270
271
|
</div>
|
|
271
272
|
|
|
272
273
|
{this.state.expanded && (
|
|
273
|
-
<div className={css.vbox(8)}>
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
<div className={css.vbox(8) + "LifeCycleRenderer-contents"}>
|
|
275
|
+
<Button
|
|
276
|
+
hue={200}
|
|
277
|
+
onClick={() => {
|
|
278
|
+
lifecycleTableViewURL.value = !lifecycleTableViewURL.value;
|
|
279
|
+
}}
|
|
280
|
+
>
|
|
281
|
+
{lifecycleTableViewURL.value && "List View" || "Table View"}
|
|
282
|
+
</Button>
|
|
283
|
+
|
|
284
|
+
{lifecycleTableViewURL.value && (
|
|
285
|
+
<LifeCycleInstanceTableView
|
|
279
286
|
lifeCycle={lifeCycle}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
instance={instance}
|
|
288
|
+
/>
|
|
289
|
+
) || (
|
|
290
|
+
<div className={css.vbox(8)}>
|
|
291
|
+
{instance.entries.map((entryData, idx) => {
|
|
292
|
+
let entryIndex = lifeCycle.entries.findIndex(e => e.matchPattern === entryData.matchPattern);
|
|
293
|
+
let entry = lifeCycle.entries[entryIndex];
|
|
294
|
+
return <LifeCycleEntryEditor
|
|
295
|
+
key={idx}
|
|
296
|
+
lifeCycle={lifeCycle}
|
|
297
|
+
entry={entry}
|
|
298
|
+
entryIndex={entryIndex}
|
|
299
|
+
defaultEditMode={false}
|
|
300
|
+
datum={entryData.datum}
|
|
301
|
+
/>;
|
|
302
|
+
})}
|
|
303
|
+
</div>
|
|
304
|
+
)}
|
|
286
305
|
</div>
|
|
287
306
|
)}
|
|
288
307
|
</div>;
|