@pb33f/cowboy-components 0.1.8 → 0.1.9
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/attention-box/attention-box.d.ts +5 -0
- package/dist/components/attention-box/attention-box.js +28 -5
- package/dist/components/footer/footer.css.d.ts +2 -0
- package/dist/components/footer/footer.css.js +21 -0
- package/dist/components/footer/footer.d.ts +8 -0
- package/dist/components/footer/footer.js +36 -0
- package/dist/components/header/header.css.js +98 -89
- package/dist/components/header/header.d.ts +1 -0
- package/dist/components/header/header.js +6 -2
- package/dist/components/the-doctor/activity-spinner.d.ts +8 -0
- package/dist/components/the-doctor/activity-spinner.js +43 -0
- package/dist/components/the-doctor/feedback.css.d.ts +2 -0
- package/dist/components/the-doctor/feedback.css.js +30 -0
- package/dist/components/the-doctor/feedback.d.ts +14 -0
- package/dist/components/the-doctor/feedback.js +83 -0
- package/dist/components/the-doctor/status-bar.js +2 -1
- package/dist/components/the-doctor/the-doctor.css.js +7 -3
- package/dist/components/the-doctor/the-doctor.d.ts +7 -1
- package/dist/components/the-doctor/the-doctor.js +58 -7
- package/dist/cowboy-components.d.ts +1 -0
- package/dist/cowboy-components.js +1 -0
- package/dist/cowboy-components.umd.cjs +480 -368
- package/dist/css/cowboy-components.css +0 -17
- package/dist/model/feedback.d.ts +4 -0
- package/dist/model/feedback.js +2 -0
- package/dist/services/feedback-service.d.ts +5 -0
- package/dist/services/feedback-service.js +30 -0
- package/dist/services/linting-service.d.ts +1 -0
- package/dist/services/linting-service.js +15 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -21,10 +21,14 @@ import { ProblemList } from "../../components/problem-list/problem-list.js";
|
|
|
21
21
|
import { Problem } from "../../model/problem.js";
|
|
22
22
|
import { ProblemDetailsDrawer, ProblemDrawerEventType } from "../problem-list/details-drawer.js";
|
|
23
23
|
import RuleDocumentationWorker from "../../workers/rule-documentation.worker.js?worker";
|
|
24
|
-
import theDoctorCss from "./the-doctor.css.js";
|
|
25
24
|
import { ProblemsOverview } from "../problems-overview/problems-overview.js";
|
|
26
25
|
import { ErrorBanner } from "../error-banner/error-banner.js";
|
|
27
26
|
import { StatusBar } from "../the-doctor/status-bar.js";
|
|
27
|
+
import { FeedbackComponent } from "./feedback.js";
|
|
28
|
+
import theDoctorCss from "./the-doctor.css.js";
|
|
29
|
+
import linksCss from "../../css/links.css";
|
|
30
|
+
import { FeedbackService } from "@/services/feedback-service";
|
|
31
|
+
import { ActivitySpinner } from "@/components/the-doctor/activity-spinner";
|
|
28
32
|
export const DoctorDocumentBag = "pb33f-doctor-editor";
|
|
29
33
|
export const HowToFixBag = "pb33f-doctor-howtofix";
|
|
30
34
|
export const RuleDocumentationBag = "pb33f-doctor-ruledocs";
|
|
@@ -49,6 +53,8 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
49
53
|
this.statusBar = new StatusBar();
|
|
50
54
|
this.ruleDocsWorker = new RuleDocumentationWorker();
|
|
51
55
|
this.unavailable = false;
|
|
56
|
+
this.feedback = new FeedbackComponent();
|
|
57
|
+
this.activitySpinner = new ActivitySpinner();
|
|
52
58
|
// extract the doctor endpoint from session storage.
|
|
53
59
|
const sessionEndpoint = sessionStorage.getItem(DoctorEndpoint);
|
|
54
60
|
if (sessionEndpoint) {
|
|
@@ -120,6 +126,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
lintSpec(value) {
|
|
129
|
+
this.activitySpinner.show();
|
|
123
130
|
LintingService.lintFile(value, this.OWASPEnabled).then((result) => {
|
|
124
131
|
if (result && !Array.isArray(result)) {
|
|
125
132
|
this.editor.setMarkers([result]);
|
|
@@ -139,6 +146,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
139
146
|
LintingService.fetchStatistics().then((result) => {
|
|
140
147
|
this.problemsOverview.statistics = result;
|
|
141
148
|
this.diagnosticBag?.set(DiagnosticBag, result);
|
|
149
|
+
this.activitySpinner.hide();
|
|
142
150
|
if (result?.remainingCredit <= 10) {
|
|
143
151
|
this.statusBar.callsRemaining = result.remainingCredit;
|
|
144
152
|
this.statusBar.visible = true;
|
|
@@ -203,6 +211,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
203
211
|
}
|
|
204
212
|
loadState() {
|
|
205
213
|
LintingService.doctorEndpoint = this.doctorEndpoint;
|
|
214
|
+
FeedbackService.doctorEndpoint = this.doctorEndpoint;
|
|
206
215
|
this.docBag = this.bagManager.getBag(DoctorDocumentBag);
|
|
207
216
|
if (this.docBag) {
|
|
208
217
|
const doc = this.docBag.get(DefaultDocument);
|
|
@@ -240,9 +249,14 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
240
249
|
this.fetchDocs();
|
|
241
250
|
}
|
|
242
251
|
fetchDocs() {
|
|
252
|
+
this.activitySpinner.show();
|
|
243
253
|
// the first this we need to do is start a session
|
|
244
254
|
LintingService.startSession().then((session) => {
|
|
245
255
|
this.session = session;
|
|
256
|
+
// bootstrap async
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
this.boostrap();
|
|
259
|
+
});
|
|
246
260
|
LintingService.fetchAllHowToFix().then((result) => {
|
|
247
261
|
if (result) {
|
|
248
262
|
result.forEach((howToFix) => {
|
|
@@ -260,6 +274,7 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
260
274
|
if (data) {
|
|
261
275
|
data.forEach((doc) => {
|
|
262
276
|
this.ruleDocsBag?.set(doc.ruleId, doc);
|
|
277
|
+
this.activitySpinner.hide();
|
|
263
278
|
});
|
|
264
279
|
}
|
|
265
280
|
});
|
|
@@ -286,14 +301,37 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
286
301
|
this.lintSpec(doc);
|
|
287
302
|
}
|
|
288
303
|
}
|
|
304
|
+
boostrap() {
|
|
305
|
+
if (this.editor.getValue() === '') {
|
|
306
|
+
LintingService.bootstrapEditor().then((result) => {
|
|
307
|
+
this.editor.setValue(result, true);
|
|
308
|
+
this.specChanged(new CustomEvent(EditorUpdated, {
|
|
309
|
+
detail: {
|
|
310
|
+
content: result
|
|
311
|
+
}
|
|
312
|
+
}));
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
289
316
|
render() {
|
|
290
317
|
let overlay = html ``;
|
|
291
318
|
if (this.unavailable) {
|
|
292
319
|
overlay = html `
|
|
293
320
|
<div class="overlay" @click="return false"></div>`;
|
|
294
321
|
}
|
|
322
|
+
let welcomeBox = html ` <pb33f-attention-box id="welcome" type="success" headerText="Welcome to the clinic, I am the OpenAPI doctor." closeable>
|
|
323
|
+
This is an <strong>early preview</strong> of a new <a href="https://pb33f.io">pb33f</a> product, built on top of our very own open source and free software.
|
|
324
|
+
If you find a bug, please let us know in the <strong>feedback</strong> tab. <br/><br/>
|
|
325
|
+
<a href="#" @click="${this.closeWelcome}">[Close this message]</a>
|
|
326
|
+
</pb33f-attention-box>`;
|
|
327
|
+
const welcomeClosed = localStorage.getItem("pb33f-doctor-welcome");
|
|
328
|
+
if (welcomeClosed) {
|
|
329
|
+
welcomeBox = html ``;
|
|
330
|
+
}
|
|
295
331
|
return html `
|
|
332
|
+
${welcomeBox}
|
|
296
333
|
<div class="doctor">
|
|
334
|
+
${this.activitySpinner}
|
|
297
335
|
${this.errorBanner}
|
|
298
336
|
${overlay}
|
|
299
337
|
<sl-split-panel class="split-panel ${this.unavailable ? 'unavailable' : ''}">
|
|
@@ -307,17 +345,23 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
307
345
|
<sl-tab slot="nav" panel="overview" class="tab" id="overviewPanel">Overview</sl-tab>
|
|
308
346
|
<sl-tab slot="nav" panel="problems" class="tab" id="problemsPanel">Problems</sl-tab>
|
|
309
347
|
<sl-tab slot="nav" panel="ruleset" class="tab" id="rulesetPanel">Rules</sl-tab>
|
|
348
|
+
<sl-tab slot="nav" panel="feedback" class="tab" id="feedbackPanel">Feedback</sl-tab>
|
|
310
349
|
<sl-tab-panel name="overview" class="tab-panel">${this.problemsOverview}</sl-tab-panel>
|
|
311
350
|
<sl-tab-panel name="problems" class="tab-panel">${this.problemList}</sl-tab-panel>
|
|
312
351
|
<sl-tab-panel name="ruleset" class="tab-panel">
|
|
313
352
|
<div class="ruleset">
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
<sl-switch size="small" @sl-change="${this.toggleOWASP}" id="owasp">Enable <a
|
|
318
|
-
|
|
353
|
+
<pb33f-attention-box type="info" headerText="Manage RuleSets">
|
|
354
|
+
Feature coming soon, you will be able to manage your ruleset(s) here.
|
|
355
|
+
</pb33f-attention-box>
|
|
356
|
+
<sl-switch size="small" @sl-change="${this.toggleOWASP}" id="owasp">Enable <a
|
|
357
|
+
href="https://quobix.com/vacuum/rulesets/owasp/">OWASP</a>
|
|
358
|
+
Rules</a>?
|
|
359
|
+
</sl-switch>
|
|
319
360
|
</div>
|
|
320
361
|
</sl-tab-panel>
|
|
362
|
+
<sl-tab-panel name="feedback" class="tab-panel">
|
|
363
|
+
${this.feedback}
|
|
364
|
+
</sl-tab-panel>
|
|
321
365
|
</sl-tab-group>
|
|
322
366
|
</div>
|
|
323
367
|
</sl-split-panel>
|
|
@@ -325,8 +369,12 @@ let TheDoctor = class TheDoctor extends LitElement {
|
|
|
325
369
|
</div>
|
|
326
370
|
`;
|
|
327
371
|
}
|
|
372
|
+
closeWelcome() {
|
|
373
|
+
this.welcomeBox.hide();
|
|
374
|
+
localStorage.setItem("pb33f-doctor-welcome", "closed");
|
|
375
|
+
}
|
|
328
376
|
};
|
|
329
|
-
TheDoctor.styles = [theDoctorCss];
|
|
377
|
+
TheDoctor.styles = [theDoctorCss, linksCss];
|
|
330
378
|
__decorate([
|
|
331
379
|
query('#overviewPanel')
|
|
332
380
|
], TheDoctor.prototype, "overviewPanel", void 0);
|
|
@@ -339,6 +387,9 @@ __decorate([
|
|
|
339
387
|
__decorate([
|
|
340
388
|
query('sl-switch#owasp')
|
|
341
389
|
], TheDoctor.prototype, "owaspSwitch", void 0);
|
|
390
|
+
__decorate([
|
|
391
|
+
query('pb33f-attention-box#welcome')
|
|
392
|
+
], TheDoctor.prototype, "welcomeBox", void 0);
|
|
342
393
|
__decorate([
|
|
343
394
|
property({ type: Boolean })
|
|
344
395
|
], TheDoctor.prototype, "unavailable", void 0);
|
|
@@ -14,6 +14,7 @@ import './components/changelog/release.js';
|
|
|
14
14
|
import './components/attention-box/attention-box.js';
|
|
15
15
|
import './components/render-operation-path/render-operation-path.js';
|
|
16
16
|
import './components/render-json-path/render-json-path.js';
|
|
17
|
+
import './components/footer/footer.js';
|
|
17
18
|
import './components/problem-list/problem-list.js';
|
|
18
19
|
import './components/problem-list/problem-item.js';
|
|
19
20
|
import './components/the-doctor/the-doctor.js';
|
|
@@ -14,6 +14,7 @@ import './components/changelog/release.js';
|
|
|
14
14
|
import './components/attention-box/attention-box.js';
|
|
15
15
|
import './components/render-operation-path/render-operation-path.js';
|
|
16
16
|
import './components/render-json-path/render-json-path.js';
|
|
17
|
+
import './components/footer/footer.js';
|
|
17
18
|
// problems
|
|
18
19
|
import './components/problem-list/problem-list.js';
|
|
19
20
|
import './components/problem-list/problem-item.js';
|