@pb33f/cowboy-components 0.5.2 → 0.5.4
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 +54 -43
- package/dist/cowboy-components.umd.cjs +473 -472
- 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;
|
|
@@ -266,9 +266,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
266
266
|
this.whoAmI();
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
|
-
// TODO re-enable
|
|
270
269
|
this.bus.connectToBroker(config);
|
|
271
|
-
//this.startTheDoctor()
|
|
272
270
|
}
|
|
273
271
|
addClickTrack(node) {
|
|
274
272
|
history.pushState({ activeNode: node.idHash }, "", `?view=explore&node=${node.idHash}`);
|
|
@@ -375,7 +373,8 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
375
373
|
this.editor.editor?.revealLineInCenter(line);
|
|
376
374
|
this.rolodexTree.explorerClicked(rolodexId);
|
|
377
375
|
this.editor.setCurrentPath(file);
|
|
378
|
-
this.
|
|
376
|
+
this.fetchRefMap(file);
|
|
377
|
+
//this.lintSpec(result.rolodexRoot.instance);
|
|
379
378
|
// apply problems
|
|
380
379
|
if (this.rolodexProblemMap.has(this.rolodexActivePath)) {
|
|
381
380
|
const probs = this.rolodexProblemMap.get(this.rolodexActivePath);
|
|
@@ -437,6 +436,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
437
436
|
this.rolodexActiveHash = evt.detail.nodeHashId;
|
|
438
437
|
this.editor.setValue(result.instance, true);
|
|
439
438
|
this.editor.setCurrentPath(this.rolodexActivePath);
|
|
439
|
+
this.fetchRefMap(this.rolodexActivePath);
|
|
440
440
|
const probs = this.rolodexProblemMap.get(this.rolodexActivePath);
|
|
441
441
|
if (probs) {
|
|
442
442
|
this.editor.setMarkers(probs);
|
|
@@ -521,7 +521,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
521
521
|
}
|
|
522
522
|
this.editor.editor?.setPosition({ lineNumber: line, column: col });
|
|
523
523
|
this.editor.editor?.revealLineInCenter(line, col);
|
|
524
|
-
this.lintSpec(result.instance);
|
|
524
|
+
//this.lintSpec(result.instance);
|
|
525
525
|
if (evt.detail.path) {
|
|
526
526
|
this.rolodexTree.openNodeByPath(evt.detail.path);
|
|
527
527
|
}
|
|
@@ -817,6 +817,25 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
817
817
|
});
|
|
818
818
|
return this.rolodexProblemMap;
|
|
819
819
|
}
|
|
820
|
+
fetchRefMap(currentPath = '') {
|
|
821
|
+
ModelService.fetchReferenceMap().then((result) => {
|
|
822
|
+
this.editor.clearDecorations();
|
|
823
|
+
this.references = result;
|
|
824
|
+
this.editor.links = result;
|
|
825
|
+
this.editor.applyLinkDecorations();
|
|
826
|
+
// add references to our stateful bag
|
|
827
|
+
this.updateRefmapBag(currentPath, result);
|
|
828
|
+
}).catch(() => {
|
|
829
|
+
this.editor.clearDecorations();
|
|
830
|
+
this.editor.clearAllMarkers();
|
|
831
|
+
this.toastManager.addToastManually({
|
|
832
|
+
id: crypto.randomUUID(),
|
|
833
|
+
type: ToastType.INFO,
|
|
834
|
+
title: "File not analyzed",
|
|
835
|
+
body: "This file is not a JSON or YAML file, it has not been analyzed."
|
|
836
|
+
});
|
|
837
|
+
});
|
|
838
|
+
}
|
|
820
839
|
/* LINT SPEC <---------------------------------------------------------------------------------------------
|
|
821
840
|
*
|
|
822
841
|
* This is our main function, man we need to clean this all up, it's bloated to fuck
|
|
@@ -863,38 +882,10 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
863
882
|
// do nothing for now.
|
|
864
883
|
}
|
|
865
884
|
}
|
|
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
885
|
let revive = true;
|
|
896
886
|
LintingService.lintFile(value, this.brokerConnectionId, url, currentPath).then((result) => {
|
|
897
887
|
//if (replaceResults) {
|
|
888
|
+
this.activitySpinner.hide();
|
|
898
889
|
const map = this.buildRolodexResultMap(result);
|
|
899
890
|
if (url) {
|
|
900
891
|
this.urlOverlay.style.display = "none";
|
|
@@ -975,7 +966,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
975
966
|
this.editor.setMarkers(result);
|
|
976
967
|
}
|
|
977
968
|
else {
|
|
978
|
-
fetchRefMap();
|
|
969
|
+
this.fetchRefMap(currentPath);
|
|
979
970
|
return;
|
|
980
971
|
}
|
|
981
972
|
}
|
|
@@ -1000,15 +991,15 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1000
991
|
return;
|
|
1001
992
|
}
|
|
1002
993
|
// fetch graph
|
|
1003
|
-
if (this.rolodexRootPath == this.rolodexActivePath || this.rolodexActivePath == 'root') {
|
|
994
|
+
if ((this.rolodexRootPath == this.rolodexActivePath || this.rolodexActivePath == 'root') || url) {
|
|
1004
995
|
ModelService.createGraph().then((result) => {
|
|
1005
996
|
this.extractGraph(result);
|
|
1006
997
|
});
|
|
1007
998
|
}
|
|
1008
|
-
fetchRefMap();
|
|
1009
999
|
// TODO: rolodex query should happen elsewhere too!
|
|
1010
1000
|
if (this.rolodexNeedsReset) {
|
|
1011
1001
|
ModelService.queryRolodex().then((result) => {
|
|
1002
|
+
this.fetchRefMap(currentPath);
|
|
1012
1003
|
this.importDisabled = true;
|
|
1013
1004
|
this.editor.showBreadcrumb = true;
|
|
1014
1005
|
this.rolodexNeedsReset = false;
|
|
@@ -1034,6 +1025,9 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1034
1025
|
this.requestUpdate();
|
|
1035
1026
|
});
|
|
1036
1027
|
}
|
|
1028
|
+
else {
|
|
1029
|
+
this.fetchRefMap(currentPath);
|
|
1030
|
+
}
|
|
1037
1031
|
// update the overview statistics
|
|
1038
1032
|
LintingService.fetchStatistics().then((result) => {
|
|
1039
1033
|
let oldScore = 0;
|
|
@@ -1678,6 +1672,13 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1678
1672
|
this.creditTicker.credits = this.session.creditsRemaining;
|
|
1679
1673
|
}
|
|
1680
1674
|
this.creditTicker.visible = true;
|
|
1675
|
+
const url = new URL(window.location.href);
|
|
1676
|
+
const urlParam = url.searchParams.get('url');
|
|
1677
|
+
if (urlParam) {
|
|
1678
|
+
//this.urlInput.value = urlParam;
|
|
1679
|
+
this.activeURL = urlParam;
|
|
1680
|
+
this.lintSpec('', urlParam);
|
|
1681
|
+
}
|
|
1681
1682
|
LintingService.fetchAllHowToFix().then((result) => {
|
|
1682
1683
|
if (result) {
|
|
1683
1684
|
result.forEach((howToFix) => {
|
|
@@ -1745,7 +1746,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1745
1746
|
}
|
|
1746
1747
|
}).catch((e) => {
|
|
1747
1748
|
this.platformUnavailable(e);
|
|
1748
|
-
console.error("cannot start session");
|
|
1749
|
+
console.error("cannot start session", e);
|
|
1749
1750
|
});
|
|
1750
1751
|
}
|
|
1751
1752
|
fetchRulesetMap() {
|
|
@@ -1872,7 +1873,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1872
1873
|
const url = new URL(window.location.href);
|
|
1873
1874
|
const urlParam = url.searchParams.get('url');
|
|
1874
1875
|
if (urlParam) {
|
|
1875
|
-
this.urlInput.value = urlParam;
|
|
1876
|
+
//this.urlInput.value = urlParam;
|
|
1876
1877
|
this.activeURL = urlParam;
|
|
1877
1878
|
this.lintSpec('', urlParam);
|
|
1878
1879
|
return;
|
|
@@ -1991,6 +1992,16 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
1991
1992
|
this.explorer.moveToNode(this.activeNode);
|
|
1992
1993
|
}
|
|
1993
1994
|
this.explorerBooted = true;
|
|
1995
|
+
// check if ths is safari and fire a warning toast!
|
|
1996
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1997
|
+
if (isSafari) {
|
|
1998
|
+
this.sendToast({
|
|
1999
|
+
id: crypto.randomUUID(),
|
|
2000
|
+
type: ToastType.WARNING,
|
|
2001
|
+
body: "Safari is not supported by the explorer. Please use Chrome, Firefox or Edge. As you can see the icons are all messed up.",
|
|
2002
|
+
title: "Safari Warning"
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
1994
2005
|
}
|
|
1995
2006
|
closeExplorer() {
|
|
1996
2007
|
this.explorerVisible = false;
|
|
@@ -2156,15 +2167,15 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
2156
2167
|
<div class="main-view">
|
|
2157
2168
|
${this.statusBar}
|
|
2158
2169
|
<div id="editor-url-overlay" class="editor-url-overlay">
|
|
2159
|
-
|
|
2160
|
-
|
|
2170
|
+
|
|
2171
|
+
|
|
2161
2172
|
<div id="url-spinner">
|
|
2162
|
-
|
|
2173
|
+
<sl-icon name="arrow-repeat" class="url-spinner-icon"></sl-icon>
|
|
2163
2174
|
<h3>Fetching URL</h3>
|
|
2164
2175
|
<p>${this.activeURL}</p>
|
|
2165
2176
|
</div>
|
|
2166
|
-
|
|
2167
|
-
|
|
2177
|
+
|
|
2178
|
+
|
|
2168
2179
|
<div id="url-problem" class="url-problem">
|
|
2169
2180
|
<pb33f-attention-box type="warning" headerText="Problem with URL">
|
|
2170
2181
|
<h4>Error: ${this.urlErrorCode}</h4>
|