@pb33f/cowboy-components 0.5.2 → 0.5.3
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/components/model-renderer/schema.js +1 -1
- package/dist/components/model-tree/tree.d.ts +2 -0
- package/dist/components/model-tree/tree.js +5 -0
- package/dist/components/paginator/paginator.css.js +1 -1
- package/dist/components/problems-overview/problems-overview.css.js +2 -2
- package/dist/components/the-doctor/the-doctor.css.js +4 -3
- package/dist/components/the-doctor/the-doctor.d.ts +1 -0
- package/dist/components/the-doctor/the-doctor.js +45 -39
- package/dist/cowboy-components.umd.cjs +453 -452
- package/dist/services/model-service.js +1 -1
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ let RenderedSchemaNodeComponent = class RenderedSchemaNodeComponent extends HasE
|
|
|
46
46
|
composed: true,
|
|
47
47
|
detail: {
|
|
48
48
|
toast: {
|
|
49
|
-
title: '
|
|
49
|
+
title: 'Mock failed',
|
|
50
50
|
id: crypto.randomUUID(),
|
|
51
51
|
type: ToastType.ERROR,
|
|
52
52
|
time: new Date().toISOString(),
|
|
@@ -28,6 +28,8 @@ export declare class ModelTree extends LitElement {
|
|
|
28
28
|
renderLabel(node: Node, filtered?: boolean): TemplateResult;
|
|
29
29
|
buildTree(node: Node, depth: number): TemplateResult;
|
|
30
30
|
private selectedNodes;
|
|
31
|
+
private currentHash;
|
|
32
|
+
private currentPath;
|
|
31
33
|
nodesSelected(treeItems: SlTreeItem[]): void;
|
|
32
34
|
treeClicked(event: MouseEvent): void;
|
|
33
35
|
render(): TemplateResult<1>;
|
|
@@ -364,6 +364,11 @@ let ModelTree = class ModelTree extends LitElement {
|
|
|
364
364
|
}
|
|
365
365
|
else {
|
|
366
366
|
if (path && path != '') {
|
|
367
|
+
if (this.currentHash === hash && this.currentPath === path) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
this.currentHash = hash;
|
|
371
|
+
this.currentPath = path;
|
|
367
372
|
this.rolodexClicked(hash, path);
|
|
368
373
|
}
|
|
369
374
|
}
|
|
@@ -9,11 +9,11 @@ export default css `
|
|
|
9
9
|
|
|
10
10
|
.paginator {
|
|
11
11
|
overflow-y: auto;
|
|
12
|
-
height: calc(100vh - 485px);
|
|
12
|
+
//height: calc(100vh - 485px);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
pb33f-paginator-navigation::part(values) {
|
|
16
|
-
max-height: calc(100vh -
|
|
16
|
+
max-height: calc(100vh - 490px);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.paginator::part(values) {
|
|
@@ -34,16 +34,17 @@ export default css `
|
|
|
34
34
|
height: min-content;
|
|
35
35
|
max-height: calc(100vh - 50px);
|
|
36
36
|
}
|
|
37
|
+
|
|
37
38
|
|
|
38
|
-
.problems::-webkit-scrollbar {
|
|
39
|
+
.problems::-webkit-scrollbar,.problems-data::-webkit-scrollbar {
|
|
39
40
|
width: 8px;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
.problems::-webkit-scrollbar-track {
|
|
43
|
+
.problems::-webkit-scrollbar-track, .problems-data::-webkit-scrollbar-track {
|
|
43
44
|
background-color: black;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
.problems::-webkit-scrollbar-thumb {
|
|
47
|
+
.problems::-webkit-scrollbar-thumb, .problems-data::-webkit-scrollbar-thumb {
|
|
47
48
|
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
48
49
|
background: var(--secondary-color-lowalpha);
|
|
49
50
|
padding: var(--global-padding);
|
|
@@ -191,6 +191,7 @@ export declare class TheDoctor extends LitElement {
|
|
|
191
191
|
ruleDocsClicked(event: CustomEvent<ProblemDrawerEvent>): void;
|
|
192
192
|
rulesetSaved(evt: CustomEvent<RulesetSavedEvent>): void;
|
|
193
193
|
private buildRolodexResultMap;
|
|
194
|
+
private fetchRefMap;
|
|
194
195
|
private lintSpec;
|
|
195
196
|
updateInspectorDivider(): void;
|
|
196
197
|
updateExplorerDivider(): void;
|
|
@@ -375,7 +375,8 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
375
375
|
this.editor.editor?.revealLineInCenter(line);
|
|
376
376
|
this.rolodexTree.explorerClicked(rolodexId);
|
|
377
377
|
this.editor.setCurrentPath(file);
|
|
378
|
-
this.
|
|
378
|
+
this.fetchRefMap(file);
|
|
379
|
+
//this.lintSpec(result.rolodexRoot.instance);
|
|
379
380
|
// apply problems
|
|
380
381
|
if (this.rolodexProblemMap.has(this.rolodexActivePath)) {
|
|
381
382
|
const probs = this.rolodexProblemMap.get(this.rolodexActivePath);
|
|
@@ -437,6 +438,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
437
438
|
this.rolodexActiveHash = evt.detail.nodeHashId;
|
|
438
439
|
this.editor.setValue(result.instance, true);
|
|
439
440
|
this.editor.setCurrentPath(this.rolodexActivePath);
|
|
441
|
+
this.fetchRefMap(this.rolodexActivePath);
|
|
440
442
|
const probs = this.rolodexProblemMap.get(this.rolodexActivePath);
|
|
441
443
|
if (probs) {
|
|
442
444
|
this.editor.setMarkers(probs);
|
|
@@ -521,7 +523,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
521
523
|
}
|
|
522
524
|
this.editor.editor?.setPosition({ lineNumber: line, column: col });
|
|
523
525
|
this.editor.editor?.revealLineInCenter(line, col);
|
|
524
|
-
this.lintSpec(result.instance);
|
|
526
|
+
//this.lintSpec(result.instance);
|
|
525
527
|
if (evt.detail.path) {
|
|
526
528
|
this.rolodexTree.openNodeByPath(evt.detail.path);
|
|
527
529
|
}
|
|
@@ -817,6 +819,25 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
817
819
|
});
|
|
818
820
|
return this.rolodexProblemMap;
|
|
819
821
|
}
|
|
822
|
+
fetchRefMap(currentPath = '') {
|
|
823
|
+
ModelService.fetchReferenceMap().then((result) => {
|
|
824
|
+
this.editor.clearDecorations();
|
|
825
|
+
this.references = result;
|
|
826
|
+
this.editor.links = result;
|
|
827
|
+
this.editor.applyLinkDecorations();
|
|
828
|
+
// add references to our stateful bag
|
|
829
|
+
this.updateRefmapBag(currentPath, result);
|
|
830
|
+
}).catch(() => {
|
|
831
|
+
this.editor.clearDecorations();
|
|
832
|
+
this.editor.clearAllMarkers();
|
|
833
|
+
this.toastManager.addToastManually({
|
|
834
|
+
id: crypto.randomUUID(),
|
|
835
|
+
type: ToastType.INFO,
|
|
836
|
+
title: "File not analyzed",
|
|
837
|
+
body: "This file is not a JSON or YAML file, it has not been analyzed."
|
|
838
|
+
});
|
|
839
|
+
});
|
|
840
|
+
}
|
|
820
841
|
/* LINT SPEC <---------------------------------------------------------------------------------------------
|
|
821
842
|
*
|
|
822
843
|
* This is our main function, man we need to clean this all up, it's bloated to fuck
|
|
@@ -863,38 +884,10 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
863
884
|
// do nothing for now.
|
|
864
885
|
}
|
|
865
886
|
}
|
|
866
|
-
const fetchRefMap = (dead = false) => {
|
|
867
|
-
const currentRefs = this.referenceMapBag?.export().size;
|
|
868
|
-
ModelService.fetchReferenceMap().then((result) => {
|
|
869
|
-
if (dead) {
|
|
870
|
-
this.editor.clearDecorations();
|
|
871
|
-
this.editor.clearAllMarkers();
|
|
872
|
-
this.editor.breadcumb.isInvalid = true;
|
|
873
|
-
this.editor.dead();
|
|
874
|
-
this.problemList.isInvalid = true;
|
|
875
|
-
this.editor.requestUpdate();
|
|
876
|
-
}
|
|
877
|
-
else {
|
|
878
|
-
this.references = result;
|
|
879
|
-
this.editor.links = result;
|
|
880
|
-
this.editor.applyLinkDecorations();
|
|
881
|
-
}
|
|
882
|
-
// add references to our stateful bag
|
|
883
|
-
this.updateRefmapBag(currentPath, result);
|
|
884
|
-
}).catch(() => {
|
|
885
|
-
this.editor.clearDecorations();
|
|
886
|
-
this.editor.clearAllMarkers();
|
|
887
|
-
this.toastManager.addToastManually({
|
|
888
|
-
id: crypto.randomUUID(),
|
|
889
|
-
type: ToastType.INFO,
|
|
890
|
-
title: "File not analyzed",
|
|
891
|
-
body: "This file is not a JSON or YAML file, it has not been analyzed."
|
|
892
|
-
});
|
|
893
|
-
});
|
|
894
|
-
};
|
|
895
887
|
let revive = true;
|
|
896
888
|
LintingService.lintFile(value, this.brokerConnectionId, url, currentPath).then((result) => {
|
|
897
889
|
//if (replaceResults) {
|
|
890
|
+
this.activitySpinner.hide();
|
|
898
891
|
const map = this.buildRolodexResultMap(result);
|
|
899
892
|
if (url) {
|
|
900
893
|
this.urlOverlay.style.display = "none";
|
|
@@ -975,7 +968,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
975
968
|
this.editor.setMarkers(result);
|
|
976
969
|
}
|
|
977
970
|
else {
|
|
978
|
-
fetchRefMap();
|
|
971
|
+
this.fetchRefMap(currentPath);
|
|
979
972
|
return;
|
|
980
973
|
}
|
|
981
974
|
}
|
|
@@ -1000,15 +993,15 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1000
993
|
return;
|
|
1001
994
|
}
|
|
1002
995
|
// fetch graph
|
|
1003
|
-
if (this.rolodexRootPath == this.rolodexActivePath || this.rolodexActivePath == 'root') {
|
|
996
|
+
if ((this.rolodexRootPath == this.rolodexActivePath || this.rolodexActivePath == 'root') || url) {
|
|
1004
997
|
ModelService.createGraph().then((result) => {
|
|
1005
998
|
this.extractGraph(result);
|
|
1006
999
|
});
|
|
1007
1000
|
}
|
|
1008
|
-
fetchRefMap();
|
|
1009
1001
|
// TODO: rolodex query should happen elsewhere too!
|
|
1010
1002
|
if (this.rolodexNeedsReset) {
|
|
1011
1003
|
ModelService.queryRolodex().then((result) => {
|
|
1004
|
+
this.fetchRefMap(currentPath);
|
|
1012
1005
|
this.importDisabled = true;
|
|
1013
1006
|
this.editor.showBreadcrumb = true;
|
|
1014
1007
|
this.rolodexNeedsReset = false;
|
|
@@ -1034,6 +1027,9 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1034
1027
|
this.requestUpdate();
|
|
1035
1028
|
});
|
|
1036
1029
|
}
|
|
1030
|
+
else {
|
|
1031
|
+
this.fetchRefMap(currentPath);
|
|
1032
|
+
}
|
|
1037
1033
|
// update the overview statistics
|
|
1038
1034
|
LintingService.fetchStatistics().then((result) => {
|
|
1039
1035
|
let oldScore = 0;
|
|
@@ -1991,6 +1987,16 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1991
1987
|
this.explorer.moveToNode(this.activeNode);
|
|
1992
1988
|
}
|
|
1993
1989
|
this.explorerBooted = true;
|
|
1990
|
+
// check if ths is safari and fire a warning toast!
|
|
1991
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1992
|
+
if (isSafari) {
|
|
1993
|
+
this.sendToast({
|
|
1994
|
+
id: crypto.randomUUID(),
|
|
1995
|
+
type: ToastType.WARNING,
|
|
1996
|
+
body: "Safari is not supported by the explorer. Please use Chrome, Firefox or Edge. As you can see the icons are all messed up.",
|
|
1997
|
+
title: "Safari Warning"
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
1994
2000
|
}
|
|
1995
2001
|
closeExplorer() {
|
|
1996
2002
|
this.explorerVisible = false;
|
|
@@ -2156,15 +2162,15 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
2156
2162
|
<div class="main-view">
|
|
2157
2163
|
${this.statusBar}
|
|
2158
2164
|
<div id="editor-url-overlay" class="editor-url-overlay">
|
|
2159
|
-
|
|
2160
|
-
|
|
2165
|
+
|
|
2166
|
+
|
|
2161
2167
|
<div id="url-spinner">
|
|
2162
|
-
|
|
2168
|
+
<sl-icon name="arrow-repeat" class="url-spinner-icon"></sl-icon>
|
|
2163
2169
|
<h3>Fetching URL</h3>
|
|
2164
2170
|
<p>${this.activeURL}</p>
|
|
2165
2171
|
</div>
|
|
2166
|
-
|
|
2167
|
-
|
|
2172
|
+
|
|
2173
|
+
|
|
2168
2174
|
<div id="url-problem" class="url-problem">
|
|
2169
2175
|
<pb33f-attention-box type="warning" headerText="Problem with URL">
|
|
2170
2176
|
<h4>Error: ${this.urlErrorCode}</h4>
|