@pb33f/cowboy-components 0.3.5 → 0.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/assets/css.worker-CTSQecos.js +84 -0
- package/dist/assets/editor.worker-CYC0jP-p.js +12 -0
- package/dist/assets/equalizer.worker-CdIiiqfH.js +1 -0
- package/dist/assets/html.worker-C1BIaUKh.js +461 -0
- package/dist/assets/json.worker-BCyBlh8h.js +49 -0
- package/dist/assets/rule-documentation.worker-B7xOWY5M.js +1 -0
- package/dist/components/credit-ticker/credit-ticker.css.d.ts +2 -0
- package/dist/components/credit-ticker/credit-ticker.css.js +36 -0
- package/dist/components/credit-ticker/credit-ticker.d.ts +14 -0
- package/dist/components/credit-ticker/credit-ticker.js +88 -0
- package/dist/components/editor/editor-breadcrumb.css.d.ts +2 -0
- package/dist/components/editor/editor-breadcrumb.css.js +49 -0
- package/dist/components/editor/editor-breadcrumb.d.ts +9 -0
- package/dist/components/editor/editor-breadcrumb.js +60 -0
- package/dist/components/editor/editor.css.d.ts +2 -0
- package/dist/components/editor/editor.css.js +62 -0
- package/dist/components/editor/editor.d.ts +25 -4
- package/dist/components/editor/editor.js +412 -76
- package/dist/components/manage-ruleset/manage-ruleset.css.js +5 -0
- package/dist/components/manage-ruleset/manage-ruleset.js +8 -6
- package/dist/components/model-icon/model-icon.d.ts +7 -0
- package/dist/components/model-icon/model-icon.js +56 -7
- package/dist/components/model-renderer/clickable-ref.d.ts +2 -2
- package/dist/components/model-renderer/clickable-ref.js +5 -4
- package/dist/components/model-renderer/header.js +10 -10
- package/dist/components/model-renderer/operation.js +2 -2
- package/dist/components/model-renderer/rendered-node.css.js +1 -1
- package/dist/components/model-renderer/schema.js +1 -1
- package/dist/components/model-tree/tree.css.js +1 -0
- package/dist/components/model-tree/tree.d.ts +8 -0
- package/dist/components/model-tree/tree.js +232 -24
- package/dist/components/paginator/paginator.css.js +6 -2
- package/dist/components/paginator/paginator.d.ts +1 -0
- package/dist/components/paginator/paginator.js +8 -4
- package/dist/components/problem-list/details-drawer.css.js +1 -1
- package/dist/components/problem-list/problem-item.js +6 -3
- package/dist/components/problem-list/problem-label-view-filter.d.ts +2 -1
- package/dist/components/problem-list/problem-label-view-filter.js +1 -0
- package/dist/components/problem-list/problem-list.d.ts +1 -0
- package/dist/components/problem-list/problem-list.js +19 -1
- package/dist/components/problem-list/problem-mainview.css.js +1 -1
- package/dist/components/problem-list/problem-mainview.js +6 -0
- package/dist/components/problem-list/problem-sort-filter.d.ts +2 -1
- package/dist/components/problem-list/problem-sort-filter.js +1 -0
- package/dist/components/problems-overview/diagnostic-evaluation.css.js +14 -4
- package/dist/components/problems-overview/diagnostic-evaluation.js +42 -1
- package/dist/components/problems-overview/problems-overview.css.js +1 -0
- package/dist/components/the-doctor/nuke-workspace.d.ts +13 -0
- package/dist/components/the-doctor/nuke-workspace.js +70 -0
- package/dist/components/the-doctor/sparks.d.ts +1 -0
- package/dist/components/the-doctor/sparks.js +11 -2
- package/dist/components/the-doctor/status-bar.css.js +6 -5
- package/dist/components/the-doctor/the-doctor.css.js +117 -16
- package/dist/components/the-doctor/the-doctor.d.ts +70 -21
- package/dist/components/the-doctor/the-doctor.js +1023 -166
- package/dist/components/the-doctor/upload-archive.css.d.ts +2 -0
- package/dist/components/the-doctor/upload-archive.css.js +98 -0
- package/dist/components/the-doctor/upload-archive.d.ts +33 -0
- package/dist/components/the-doctor/upload-archive.js +281 -0
- package/dist/components/visualizer/equalizer.d.ts +3 -1
- package/dist/components/visualizer/equalizer.js +55 -31
- package/dist/components/visualizer/explorer.js +6 -5
- package/dist/cowboy-components.umd.cjs +1846 -1273
- package/dist/css/hr.css.d.ts +2 -0
- package/dist/css/hr.css.js +12 -0
- package/dist/css/pb33f-theme.css +1 -0
- package/dist/events/doctor.d.ts +19 -1
- package/dist/events/doctor.js +5 -0
- package/dist/model/channels.d.ts +1 -0
- package/dist/model/channels.js +1 -0
- package/dist/model/graph.d.ts +17 -0
- package/dist/model/graph.js +17 -1
- package/dist/model/link.d.ts +8 -0
- package/dist/model/node_type.d.ts +22 -1
- package/dist/model/node_type.js +22 -0
- package/dist/model/panel-state.d.ts +5 -0
- package/dist/model/panel-state.js +1 -0
- package/dist/model/problem.d.ts +3 -1
- package/dist/model/problem.js +4 -2
- package/dist/model/rolodex.d.ts +34 -0
- package/dist/model/rolodex.js +1 -0
- package/dist/services/linting-service.d.ts +1 -1
- package/dist/services/linting-service.js +23 -11
- package/dist/services/model-service.d.ts +8 -1
- package/dist/services/model-service.js +127 -0
- package/dist/style.css +1 -1
- package/dist/workers/equalizer.worker.js +4 -3
- package/dist/workers/rule-documentation.worker.d.ts +2 -2
- package/dist/workers/rule-documentation.worker.js +26 -15
- package/package.json +3 -3
- package/dist/assets/css.worker-B_qZXUzt.js +0 -84
- package/dist/assets/editor.worker-HEmB0D7P.js +0 -11
- package/dist/assets/equalizer.worker-icLzyXQ7.js +0 -1
- package/dist/assets/html.worker-D3WUrk8Q.js +0 -458
- package/dist/assets/json.worker-CAhUaBo4.js +0 -42
- package/dist/assets/rule-documentation.worker-D39NS8Lx.js +0 -1
|
@@ -9,25 +9,40 @@ import '@shoelace-style/shoelace/dist/components/tree-item/tree-item.js';
|
|
|
9
9
|
import { customElement, property, state } from "lit/decorators.js";
|
|
10
10
|
import { html, LitElement } from "lit";
|
|
11
11
|
import treeCss from "./tree.css.js";
|
|
12
|
-
import { ModelTreeNodeClicked } from "../../events/doctor.js";
|
|
12
|
+
import { ModelTreeNodeClicked, RolodexTreeNodeClicked } from "../../events/doctor.js";
|
|
13
13
|
import { IconColor, IconSize } from "../model-icon/model-icon.js";
|
|
14
14
|
import { ExtractStatusStyleFromCodeByCode } from "../../model/extract_status.js";
|
|
15
15
|
import modelSharedCss from "../model-renderer/model-shared.css.js";
|
|
16
16
|
import tooltipCss from "../../css/tooltip.css.js";
|
|
17
|
+
import { NodeType } from "../../model/node_type";
|
|
17
18
|
let ModelTree = class ModelTree extends LitElement {
|
|
18
19
|
constructor(nodeMap, nodeIdMap, nodeIdHashMap) {
|
|
19
20
|
super();
|
|
21
|
+
this.selectedNodes = [];
|
|
20
22
|
this.nodeMap = nodeMap;
|
|
21
23
|
this.nodeIdMap = nodeIdMap;
|
|
22
24
|
this.nodeIdHashMap = nodeIdHashMap;
|
|
25
|
+
this.isRolodex = false;
|
|
23
26
|
this.filteredNodes = new Map();
|
|
27
|
+
this.pendingNavigationHash = "";
|
|
28
|
+
this.pendingNavigationPath = "";
|
|
24
29
|
}
|
|
25
30
|
nodeClicked(nodeHashId) {
|
|
26
31
|
this.dispatchEvent(new CustomEvent(ModelTreeNodeClicked, {
|
|
27
32
|
bubbles: true,
|
|
28
33
|
composed: true,
|
|
29
34
|
detail: {
|
|
30
|
-
nodeHashId: nodeHashId
|
|
35
|
+
nodeHashId: nodeHashId,
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
rolodexClicked(nodeHashId, path = '') {
|
|
40
|
+
this.dispatchEvent(new CustomEvent(RolodexTreeNodeClicked, {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
composed: true,
|
|
43
|
+
detail: {
|
|
44
|
+
nodeHashId: nodeHashId,
|
|
45
|
+
path: path
|
|
31
46
|
}
|
|
32
47
|
}));
|
|
33
48
|
}
|
|
@@ -38,18 +53,76 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
38
53
|
this.openNode(parent.parentId);
|
|
39
54
|
}
|
|
40
55
|
this.renderRoot.querySelectorAll(`sl-tree-item#model-${parent?.idHash}`)[0]?.setAttribute('expanded', 'true');
|
|
56
|
+
this.requestUpdate();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const model = this.renderRoot.querySelectorAll(`sl-tree-item#model-${parentId}`)[0];
|
|
61
|
+
if (model) {
|
|
62
|
+
model.setAttribute('expanded', 'true');
|
|
63
|
+
// check if the model has a parent
|
|
64
|
+
const nodeParent = model.getAttribute('data-parentid');
|
|
65
|
+
if (nodeParent) {
|
|
66
|
+
this.openNode(nodeParent);
|
|
67
|
+
}
|
|
68
|
+
this.requestUpdate();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
updated() {
|
|
74
|
+
if (this.pendingNavigationHash != "") {
|
|
75
|
+
this.explorerClicked(this.pendingNavigationHash);
|
|
76
|
+
}
|
|
77
|
+
if (this.pendingNavigationPath && this.pendingNavigationPath != "") {
|
|
78
|
+
const pnp = this.pendingNavigationPath;
|
|
79
|
+
this.openNodeByPath(pnp);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
openNodeByPath(path) {
|
|
83
|
+
const treeItems = this.renderRoot?.querySelectorAll(`sl-tree-item`);
|
|
84
|
+
if (treeItems) {
|
|
85
|
+
let selected = null;
|
|
86
|
+
for (let i = 0; i < treeItems?.length; i++) {
|
|
87
|
+
const item = treeItems[i];
|
|
88
|
+
const itemPath = item.getAttribute('data-path');
|
|
89
|
+
item.selected = itemPath === path;
|
|
90
|
+
if (item.selected) {
|
|
91
|
+
selected = item;
|
|
92
|
+
item.expanded = true;
|
|
93
|
+
const parentId = item.getAttribute('data-parentid');
|
|
94
|
+
if (parentId) {
|
|
95
|
+
this.pendingNavigationPath = "";
|
|
96
|
+
this.openNode(parentId);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (selected) {
|
|
101
|
+
requestAnimationFrame(() => {
|
|
102
|
+
selected?.scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
41
105
|
}
|
|
42
106
|
}
|
|
43
107
|
explorerClicked(nodeHashId) {
|
|
44
|
-
const treeItems = this.renderRoot
|
|
108
|
+
const treeItems = this.renderRoot?.querySelectorAll(`sl-tree-item`);
|
|
109
|
+
if (!treeItems) {
|
|
110
|
+
this.pendingNavigationHash = nodeHashId;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
if (this.pendingNavigationHash != "") {
|
|
114
|
+
nodeHashId = this.pendingNavigationHash;
|
|
115
|
+
this.pendingNavigationHash = "";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
45
118
|
let selected = null;
|
|
46
|
-
for (let i = 0; i < treeItems
|
|
119
|
+
for (let i = 0; i < treeItems?.length; i++) {
|
|
47
120
|
const item = treeItems[i];
|
|
48
121
|
item.selected = item.id === `model-${nodeHashId}`;
|
|
49
122
|
if (item.selected) {
|
|
50
123
|
selected = item;
|
|
51
124
|
item.expanded = true;
|
|
52
|
-
const parentId = item.getAttribute('data-
|
|
125
|
+
const parentId = item.getAttribute('data-parentid');
|
|
53
126
|
if (parentId) {
|
|
54
127
|
this.openNode(parentId);
|
|
55
128
|
}
|
|
@@ -74,13 +147,17 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
74
147
|
return html `<span style="color: var(--font-color-sub1)">${node.label}</span>`;
|
|
75
148
|
}
|
|
76
149
|
switch (node.type) {
|
|
77
|
-
case
|
|
150
|
+
case NodeType.ROLODEX_FILE:
|
|
151
|
+
return html `<span style="color: var(--font-color)"><strong>${node.label}</strong></span>`;
|
|
152
|
+
case NodeType.RESPONSE:
|
|
78
153
|
const label = parseInt(node.label);
|
|
79
154
|
return html `<span class="${ExtractStatusStyleFromCodeByCode(label)}">${node.label}</span>`;
|
|
80
|
-
case
|
|
81
|
-
return html
|
|
82
|
-
|
|
83
|
-
|
|
155
|
+
case NodeType.OPERATION:
|
|
156
|
+
return html `
|
|
157
|
+
<pb33f-http-method tiny method="${node.label}"></pb33f-http-method>`;
|
|
158
|
+
case NodeType.PATH_ITEM:
|
|
159
|
+
return html `
|
|
160
|
+
<pb33f-render-operation-path nowrap path="${node.label}"></pb33f-render-operation-path>`;
|
|
84
161
|
default:
|
|
85
162
|
if (node.instance) {
|
|
86
163
|
return html `<strong>${node.label}</strong>`;
|
|
@@ -91,7 +168,16 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
91
168
|
buildTree(node, depth) {
|
|
92
169
|
let results = [];
|
|
93
170
|
if (node.nodes && node.nodes.length > 0) {
|
|
94
|
-
|
|
171
|
+
// check if this is a path item, if so make sure the parameters are first.
|
|
172
|
+
if (node.type === NodeType.PATH_ITEM) {
|
|
173
|
+
const operations = node.nodes.filter(n => n.type === NodeType.OPERATION);
|
|
174
|
+
const parameters = node.nodes.filter(n => (n.type === NodeType.PARAMETER || n.type === NodeType.PARAMETERS));
|
|
175
|
+
const other = node.nodes.filter(n => n.type !== NodeType.OPERATION && (n.type !== NodeType.PARAMETER && n.type !== NodeType.PARAMETERS));
|
|
176
|
+
node.nodes = parameters.concat(operations).concat(other);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
node.nodes.sort((a, b) => a.label.localeCompare(b.label));
|
|
180
|
+
}
|
|
95
181
|
for (let i = 0; i < node.nodes.length; i++) {
|
|
96
182
|
depth++;
|
|
97
183
|
results.push(this.buildTree(node.nodes[i], depth));
|
|
@@ -103,7 +189,7 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
103
189
|
}
|
|
104
190
|
let styleIco = IconColor.primary;
|
|
105
191
|
const filtered = (this.filteredNodes.size > 0 && !this.filteredNodes.get(node.idHash));
|
|
106
|
-
if (node.type ===
|
|
192
|
+
if (node.type === NodeType.RESPONSE) {
|
|
107
193
|
const label = parseInt(node.label);
|
|
108
194
|
const style = ExtractStatusStyleFromCodeByCode(label);
|
|
109
195
|
switch (style) {
|
|
@@ -118,6 +204,9 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
118
204
|
break;
|
|
119
205
|
}
|
|
120
206
|
}
|
|
207
|
+
if (node.type === NodeType.ROLODEX_FILE) {
|
|
208
|
+
styleIco = IconColor.secondary;
|
|
209
|
+
}
|
|
121
210
|
if (filtered) {
|
|
122
211
|
styleIco = IconColor.filtered;
|
|
123
212
|
}
|
|
@@ -138,14 +227,106 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
138
227
|
}
|
|
139
228
|
}
|
|
140
229
|
if (warnings > 0) {
|
|
141
|
-
warnBadge = html
|
|
230
|
+
warnBadge = html `
|
|
231
|
+
<sl-badge class="warn">${warnings}</sl-badge>`;
|
|
142
232
|
}
|
|
143
233
|
if (errors > 0) {
|
|
144
|
-
errorBadge = html
|
|
234
|
+
errorBadge = html `
|
|
235
|
+
<sl-badge class="err">${errors}</sl-badge>`;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
let icon = html `
|
|
240
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${node.type}" color=${styleIco}></pb33f-model-icon>`;
|
|
241
|
+
if (node.openapi) {
|
|
242
|
+
icon = html `
|
|
243
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.OPENAPI}"
|
|
244
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
// determine if this is something other than a JSON or YAML file by looking at the extension.
|
|
248
|
+
if (!node.label.endsWith('.json') || !node.label.endsWith('.yaml') || !node.label.endsWith('.yml')) {
|
|
249
|
+
if (node.label.includes('.')) {
|
|
250
|
+
const ext = node.label.split('.').pop();
|
|
251
|
+
if (ext) {
|
|
252
|
+
switch (ext) {
|
|
253
|
+
case NodeType.JS:
|
|
254
|
+
icon = html `
|
|
255
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.JS}"
|
|
256
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
257
|
+
break;
|
|
258
|
+
case NodeType.GO:
|
|
259
|
+
icon = html `
|
|
260
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.GO}"
|
|
261
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
262
|
+
break;
|
|
263
|
+
case NodeType.TS:
|
|
264
|
+
icon = html `
|
|
265
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.TS}"
|
|
266
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
267
|
+
break;
|
|
268
|
+
case NodeType.CS:
|
|
269
|
+
icon = html `
|
|
270
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.CS}"
|
|
271
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
272
|
+
break;
|
|
273
|
+
case NodeType.C:
|
|
274
|
+
icon = html `
|
|
275
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.C}"
|
|
276
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
277
|
+
break;
|
|
278
|
+
case NodeType.CPP:
|
|
279
|
+
icon = html `
|
|
280
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.CPP}"
|
|
281
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
282
|
+
break;
|
|
283
|
+
case NodeType.PHP:
|
|
284
|
+
icon = html `
|
|
285
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.PHP}"
|
|
286
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
287
|
+
break;
|
|
288
|
+
case NodeType.PY:
|
|
289
|
+
icon = html `
|
|
290
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.PY}"
|
|
291
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
292
|
+
break;
|
|
293
|
+
case NodeType.HTML:
|
|
294
|
+
icon = html `
|
|
295
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.HTML}"
|
|
296
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
297
|
+
break;
|
|
298
|
+
case NodeType.MD:
|
|
299
|
+
icon = html `
|
|
300
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.MD}"
|
|
301
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
302
|
+
break;
|
|
303
|
+
case NodeType.JAVA:
|
|
304
|
+
icon = html `
|
|
305
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.JAVA}"
|
|
306
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
307
|
+
break;
|
|
308
|
+
case NodeType.RS:
|
|
309
|
+
icon = html `
|
|
310
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.RS}"
|
|
311
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
312
|
+
break;
|
|
313
|
+
case NodeType.ZIG:
|
|
314
|
+
icon = html `
|
|
315
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.ZIG}"
|
|
316
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
317
|
+
break;
|
|
318
|
+
case NodeType.RB:
|
|
319
|
+
icon = html `
|
|
320
|
+
<pb33f-model-icon size="${IconSize.small}" icon="${NodeType.RB}"
|
|
321
|
+
color=${styleIco}></pb33f-model-icon>`;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
145
325
|
}
|
|
146
326
|
}
|
|
147
327
|
}
|
|
148
328
|
return html `
|
|
329
|
+
|
|
149
330
|
<sl-tree-item id="model-${node.idHash}" ?expanded="${expanded}"
|
|
150
331
|
@sl-expand="${(evt) => {
|
|
151
332
|
this.expanded(evt, node);
|
|
@@ -153,12 +334,14 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
153
334
|
@sl-collapse="${(evt) => {
|
|
154
335
|
this.collapse(evt, node);
|
|
155
336
|
}}"
|
|
156
|
-
data-
|
|
157
|
-
data-
|
|
337
|
+
data-parentid="${node.parentId}"
|
|
338
|
+
data-hashid="${node.idHash}"
|
|
339
|
+
data-path="${node.path ? node.path : node.nodePath}">
|
|
158
340
|
<div style="display: flex">
|
|
159
|
-
|
|
341
|
+
${icon}
|
|
160
342
|
<div style="padding-left:8px; flex-grow: 4; white-space: nowrap">
|
|
161
|
-
${filtered ? html `<span
|
|
343
|
+
${filtered ? html `<span
|
|
344
|
+
style="color: var(--font-color-sub1)">${this.renderLabel(node, filtered)}
|
|
162
345
|
<sl-tooltip content="filtered item">
|
|
163
346
|
<sl-icon name="eye-slash" style="vertical-align: middle; font-size: 0.8rem"></sl-icon>
|
|
164
347
|
</sl-tooltip>
|
|
@@ -171,10 +354,30 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
171
354
|
`;
|
|
172
355
|
}
|
|
173
356
|
nodesSelected(treeItems) {
|
|
357
|
+
this.selectedNodes = treeItems;
|
|
174
358
|
for (let i = 0; i < treeItems.length; i++) {
|
|
175
359
|
const hash = treeItems[i].getAttribute('data-hashId');
|
|
176
|
-
|
|
177
|
-
|
|
360
|
+
const path = treeItems[i].getAttribute('data-path');
|
|
361
|
+
if (hash) {
|
|
362
|
+
if (!this.isRolodex) {
|
|
363
|
+
this.nodeClicked(hash);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
if (path && path != '') {
|
|
367
|
+
this.rolodexClicked(hash, path);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
treeClicked(event) {
|
|
374
|
+
// which tree item was actually clicked?
|
|
375
|
+
const clickedItem = event.target?.closest('sl-tree-item');
|
|
376
|
+
if (!clickedItem)
|
|
377
|
+
return;
|
|
378
|
+
// if the clicked item is already in selectedNodes, re-fire
|
|
379
|
+
if (this.selectedNodes.some(item => item === clickedItem)) {
|
|
380
|
+
this.nodesSelected(this.selectedNodes);
|
|
178
381
|
}
|
|
179
382
|
}
|
|
180
383
|
render() {
|
|
@@ -184,13 +387,15 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
184
387
|
const tree = this.buildTree(this.node, 0);
|
|
185
388
|
let nodeLimitExceeded = html ``;
|
|
186
389
|
if (this.nodeLimitExceeded) {
|
|
187
|
-
nodeLimitExceeded = html
|
|
188
|
-
<
|
|
189
|
-
|
|
390
|
+
nodeLimitExceeded = html `
|
|
391
|
+
<div class="node-limit-exceeded">
|
|
392
|
+
<sl-icon name="exclamation-triangle" style="vertical-align: middle"></sl-icon>
|
|
393
|
+
Objects exceed limit of ${this.nodeLimit}.
|
|
394
|
+
</div>`;
|
|
190
395
|
}
|
|
191
396
|
return html `
|
|
192
397
|
${nodeLimitExceeded}
|
|
193
|
-
<sl-tree @sl-selection-change="${(evt) => {
|
|
398
|
+
<sl-tree @click=${this.treeClicked} @sl-selection-change="${(evt) => {
|
|
194
399
|
{
|
|
195
400
|
const selected = evt.detail.selection;
|
|
196
401
|
this.nodesSelected(selected);
|
|
@@ -217,6 +422,9 @@ __decorate([
|
|
|
217
422
|
__decorate([
|
|
218
423
|
property()
|
|
219
424
|
], ModelTree.prototype, "filteredNodes", void 0);
|
|
425
|
+
__decorate([
|
|
426
|
+
property()
|
|
427
|
+
], ModelTree.prototype, "isRolodex", void 0);
|
|
220
428
|
ModelTree = __decorate([
|
|
221
429
|
customElement("pb33f-model-tree")
|
|
222
430
|
], ModelTree);
|
|
@@ -21,15 +21,19 @@ export default css `
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.no-values {
|
|
24
|
+
min-height: 550px;
|
|
24
25
|
width: 500px;
|
|
25
26
|
margin: 0 auto;
|
|
26
27
|
padding-top: 50px;
|
|
27
28
|
text-align: center;
|
|
28
29
|
font-size: 1.9em;
|
|
29
|
-
color: var(--font-color-
|
|
30
|
+
color: var(--font-color-sub4);
|
|
30
31
|
font-family: var(--font-stack-bold), monospace;
|
|
31
32
|
overflow-y: hidden;
|
|
32
|
-
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.error {
|
|
36
|
+
color: var(--error-color);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
.no-values sl-icon {
|
|
@@ -19,6 +19,7 @@ let Paginator = class Paginator extends LitElement {
|
|
|
19
19
|
this.totalItems = 0;
|
|
20
20
|
this.itemsPerPage = 20;
|
|
21
21
|
this.activeIndex = 0;
|
|
22
|
+
this.invalid = false;
|
|
22
23
|
this.paginatorNavigator = new PaginatorNavigation();
|
|
23
24
|
this.paginatorNavigator.currentPage = this.currentPage;
|
|
24
25
|
this.paginatorNavigator.totalPages = this.totalPages;
|
|
@@ -82,13 +83,13 @@ let Paginator = class Paginator extends LitElement {
|
|
|
82
83
|
this.renderValues = this.values?.slice(this.paginatorNavigator.getRangeStart(), this.paginatorNavigator.getRangeEnd());
|
|
83
84
|
}
|
|
84
85
|
render() {
|
|
85
|
-
|
|
86
|
+
this.sparks.isError = this.invalid;
|
|
86
87
|
if (this.renderValues?.length === 0 || !this.renderValues) {
|
|
87
88
|
return html `
|
|
88
|
-
<div class="no-values" style="position: relative">
|
|
89
|
+
<div class="no-values ${this.invalid ? 'error' : ''}" style="position: relative">
|
|
89
90
|
<div style="position: absolute; width: 100%; top: -50px; left: 0;">${this.sparks}</div>
|
|
90
|
-
<sl-icon name="
|
|
91
|
-
|
|
91
|
+
<sl-icon name="prescription2"></sl-icon><br/>
|
|
92
|
+
${this.invalid ? 'invalid / error' : 'healthy!'}
|
|
92
93
|
</div>
|
|
93
94
|
`;
|
|
94
95
|
}
|
|
@@ -122,6 +123,9 @@ __decorate([
|
|
|
122
123
|
__decorate([
|
|
123
124
|
property()
|
|
124
125
|
], Paginator.prototype, "activeIndex", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
property({ type: Boolean })
|
|
128
|
+
], Paginator.prototype, "invalid", void 0);
|
|
125
129
|
Paginator = __decorate([
|
|
126
130
|
customElement("pb33f-paginator-navigation")
|
|
127
131
|
], Paginator);
|
|
@@ -30,13 +30,16 @@ let ProblemItem = class ProblemItem extends LitElement {
|
|
|
30
30
|
class="${this.selectedSibling ? 'selectedPath' : ''}"></pb33f-render-json-path>`;
|
|
31
31
|
break;
|
|
32
32
|
case ProblemLabelView.RuleViolation:
|
|
33
|
-
render = html `${this.problemObject.source}
|
|
33
|
+
render = html `${this.problemObject.source}`;
|
|
34
34
|
break;
|
|
35
35
|
case ProblemLabelView.Message:
|
|
36
|
-
render = html `${unsafeHTML(marked.parse(this.problemObject.message).toString())}
|
|
36
|
+
render = html `${unsafeHTML(marked.parse(this.problemObject.message).toString())}`;
|
|
37
37
|
break;
|
|
38
38
|
case ProblemLabelView.Category:
|
|
39
|
-
render = html `${this.problemObject.category}
|
|
39
|
+
render = html `${this.problemObject.category}`;
|
|
40
|
+
break;
|
|
41
|
+
case ProblemLabelView.Source:
|
|
42
|
+
render = html `${this.problemObject.sourceLocation}`;
|
|
40
43
|
break;
|
|
41
44
|
}
|
|
42
45
|
return render;
|
|
@@ -6,7 +6,8 @@ export declare enum ProblemLabelView {
|
|
|
6
6
|
JSONPath = "Path",
|
|
7
7
|
RuleViolation = "Rule Violation",
|
|
8
8
|
Message = "Message",
|
|
9
|
-
Category = "Category"
|
|
9
|
+
Category = "Category",
|
|
10
|
+
Source = "Source Location"
|
|
10
11
|
}
|
|
11
12
|
export declare class ProblemLabelViewFilter extends LitElement {
|
|
12
13
|
static styles: import("lit").CSSResult[];
|
|
@@ -18,6 +18,7 @@ export var ProblemLabelView;
|
|
|
18
18
|
ProblemLabelView["RuleViolation"] = "Rule Violation";
|
|
19
19
|
ProblemLabelView["Message"] = "Message";
|
|
20
20
|
ProblemLabelView["Category"] = "Category";
|
|
21
|
+
ProblemLabelView["Source"] = "Source Location";
|
|
21
22
|
})(ProblemLabelView || (ProblemLabelView = {}));
|
|
22
23
|
let ProblemLabelViewFilter = class ProblemLabelViewFilter extends LitElement {
|
|
23
24
|
constructor() {
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement } from "lit/decorators.js";
|
|
7
|
+
import { customElement, property } from "lit/decorators.js";
|
|
8
8
|
import { html, LitElement } from "lit";
|
|
9
9
|
import { ProblemItem } from "./problem-item.js";
|
|
10
10
|
import { ProblemMainView } from "./problem-mainview.js";
|
|
@@ -29,6 +29,7 @@ let ProblemList = class ProblemList extends LitElement {
|
|
|
29
29
|
this.unfilteredProblems = [];
|
|
30
30
|
this.searchWorker = new SearchWorker();
|
|
31
31
|
this.activeSearch = false;
|
|
32
|
+
this.isInvalid = false;
|
|
32
33
|
this.addSearchWorkerListener();
|
|
33
34
|
// @ts-ignore
|
|
34
35
|
this.addEventListener(ProblemClicked, this.problemClicked);
|
|
@@ -139,6 +140,10 @@ let ProblemList = class ProblemList extends LitElement {
|
|
|
139
140
|
this.problemList[i].problemLabelView = ProblemLabelView.Category;
|
|
140
141
|
this.problemLabelView = ProblemLabelView.Category;
|
|
141
142
|
break;
|
|
143
|
+
case ProblemLabelView.Source:
|
|
144
|
+
this.problemList[i].problemLabelView = ProblemLabelView.Source;
|
|
145
|
+
this.problemLabelView = ProblemLabelView.Source;
|
|
146
|
+
break;
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
}
|
|
@@ -189,6 +194,15 @@ let ProblemList = class ProblemList extends LitElement {
|
|
|
189
194
|
return 0;
|
|
190
195
|
});
|
|
191
196
|
break;
|
|
197
|
+
case ProblemSortView.SourceLocation:
|
|
198
|
+
this.problemList = this.problemList.sort((a, b) => {
|
|
199
|
+
if (a.problemObject.sourceLocation < b.problemObject.sourceLocation)
|
|
200
|
+
return 1;
|
|
201
|
+
if (a.problemObject.sourceLocation > b.problemObject.sourceLocation)
|
|
202
|
+
return -1;
|
|
203
|
+
return 0;
|
|
204
|
+
});
|
|
205
|
+
break;
|
|
192
206
|
}
|
|
193
207
|
this.problemList = this.problemList.slice(0, this.problemList.length);
|
|
194
208
|
this.requestUpdate();
|
|
@@ -311,6 +325,7 @@ let ProblemList = class ProblemList extends LitElement {
|
|
|
311
325
|
}
|
|
312
326
|
render() {
|
|
313
327
|
this.paginator.values = this.problemList;
|
|
328
|
+
this.paginator.invalid = this.isInvalid;
|
|
314
329
|
return html `
|
|
315
330
|
<div class="problem-list-container">
|
|
316
331
|
<div class="main-view">
|
|
@@ -327,6 +342,9 @@ let ProblemList = class ProblemList extends LitElement {
|
|
|
327
342
|
}
|
|
328
343
|
};
|
|
329
344
|
ProblemList.styles = [problemListCss, sharedCss];
|
|
345
|
+
__decorate([
|
|
346
|
+
property({ type: Boolean })
|
|
347
|
+
], ProblemList.prototype, "isInvalid", void 0);
|
|
330
348
|
ProblemList = __decorate([
|
|
331
349
|
customElement("pb33f-problem-list")
|
|
332
350
|
], ProblemList);
|
|
@@ -96,6 +96,11 @@ let ProblemMainView = class ProblemMainView extends LitElement {
|
|
|
96
96
|
<div class="main-view empty">Pick a problem...<br/><sl-icon name="pin-angle"></sl-icon><br/></div>`;
|
|
97
97
|
}
|
|
98
98
|
renderProblem(problem) {
|
|
99
|
+
let sourceLocation = html ``;
|
|
100
|
+
if (problem.sourceLocation && problem.sourceLocation.length > 0 &&
|
|
101
|
+
(problem.sourceLocation != 'root.yaml' && problem.sourceLocation != 'root')) {
|
|
102
|
+
sourceLocation = html `<div class="source-location">Problem file:<br/> <strong>${problem.sourceLocation}</strong></div>`;
|
|
103
|
+
}
|
|
99
104
|
return html `
|
|
100
105
|
<div class="problem">
|
|
101
106
|
<div class="icon ${getProblemClass(problem)}">
|
|
@@ -106,6 +111,7 @@ let ProblemMainView = class ProblemMainView extends LitElement {
|
|
|
106
111
|
<div class="location">
|
|
107
112
|
Location: <pb33f-render-json-path path="${problem.jsonPath}"></pb33f-render-json-path>
|
|
108
113
|
</div>
|
|
114
|
+
${sourceLocation}
|
|
109
115
|
</div>
|
|
110
116
|
</div>
|
|
111
117
|
<div class="source">
|
|
@@ -7,7 +7,8 @@ export declare enum ProblemSortView {
|
|
|
7
7
|
Rule = "Rule Violation",
|
|
8
8
|
JSONPath = "Path",
|
|
9
9
|
Category = "Category",
|
|
10
|
-
Severity = "Severity"
|
|
10
|
+
Severity = "Severity",
|
|
11
|
+
SourceLocation = "Source Location"
|
|
11
12
|
}
|
|
12
13
|
export declare class ProblemSortFilter extends LitElement {
|
|
13
14
|
static styles: import("lit").CSSResult[];
|
|
@@ -19,6 +19,7 @@ export var ProblemSortView;
|
|
|
19
19
|
ProblemSortView["JSONPath"] = "Path";
|
|
20
20
|
ProblemSortView["Category"] = "Category";
|
|
21
21
|
ProblemSortView["Severity"] = "Severity";
|
|
22
|
+
ProblemSortView["SourceLocation"] = "Source Location";
|
|
22
23
|
})(ProblemSortView || (ProblemSortView = {}));
|
|
23
24
|
let ProblemSortFilter = class ProblemSortFilter extends LitElement {
|
|
24
25
|
constructor() {
|
|
@@ -24,20 +24,30 @@ export default css `
|
|
|
24
24
|
.score {
|
|
25
25
|
width: 100px;
|
|
26
26
|
height: 100px;
|
|
27
|
-
line-height: 100px;
|
|
27
|
+
//line-height: 100px;
|
|
28
28
|
border: 1px solid var(--primary-color);
|
|
29
29
|
text-align: center;
|
|
30
30
|
margin-top: 10px;
|
|
31
31
|
margin-bottom: 10px;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
.score .score-percent {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
vertical-align: middle;
|
|
37
|
+
line-height: normal;
|
|
38
|
+
font-size: 1rem;
|
|
39
|
+
color: var(--primary-color);
|
|
40
|
+
padding-top: 8px;
|
|
41
|
+
font-family: var(--font-stack-bold), monospace;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.score .score-grade {
|
|
34
45
|
display: inline-block;
|
|
35
46
|
vertical-align: middle;
|
|
36
47
|
line-height: normal;
|
|
37
|
-
font-size: 2rem;
|
|
48
|
+
font-size: 3.2rem;
|
|
38
49
|
color: var(--primary-color);
|
|
39
50
|
font-family: var(--font-stack-bold), monospace;
|
|
40
|
-
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
.evaluation {
|