@pb33f/cowboy-components 0.7.7 → 0.7.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/auth/login-button.d.ts +4 -2
- package/dist/components/auth/login-button.js +25 -7
- package/dist/components/auth/login-panel.d.ts +1 -1
- package/dist/components/auth/login-panel.js +1 -1
- package/dist/components/auth/oauth-login.d.ts +1 -1
- package/dist/components/auth/oauth-login.js +3 -3
- package/dist/components/the-doctor/status-bar.js +3 -3
- package/dist/components/the-doctor/the-doctor.css.js +16 -0
- package/dist/components/the-doctor/the-doctor.d.ts +3 -0
- package/dist/components/the-doctor/the-doctor.js +50 -3
- package/dist/components/time-vortex/tardis-control.css.js +0 -16
- package/dist/components/workspaces/workspace-destroy-dialog.d.ts +17 -0
- package/dist/components/workspaces/workspace-destroy-dialog.js +85 -0
- package/dist/components/workspaces/workspace-form.d.ts +22 -0
- package/dist/components/workspaces/workspace-form.js +194 -0
- package/dist/components/workspaces/workspace-view.css.d.ts +2 -0
- package/dist/components/workspaces/workspace-view.css.js +40 -0
- package/dist/components/workspaces/workspace-view.d.ts +30 -0
- package/dist/components/workspaces/workspace-view.js +196 -0
- package/dist/controllers/auth-controller.d.ts +1 -0
- package/dist/controllers/auth-controller.js +26 -8
- package/dist/controllers/diagnostic-controller.d.ts +1 -0
- package/dist/controllers/diagnostic-controller.js +15 -10
- package/dist/controllers/docs-controller.js +9 -33
- package/dist/controllers/workspace-controller.d.ts +15 -0
- package/dist/controllers/workspace-controller.js +156 -0
- package/dist/cowboy-components.umd.cjs +1559 -1095
- package/dist/css/badges.css.d.ts +2 -0
- package/dist/css/badges.css.js +12 -0
- package/dist/css/button.css.js +1 -1
- package/dist/css/forms.css.js +127 -1
- package/dist/css/lists.css.js +8 -0
- package/dist/css/pb33f-theme.css +1 -0
- package/dist/css/spinner.css.js +29 -0
- package/dist/events/doctor.d.ts +15 -0
- package/dist/events/doctor.js +10 -0
- package/dist/model/form-types.d.ts +32 -0
- package/dist/model/form-types.js +19 -0
- package/dist/model/formable.d.ts +51 -0
- package/dist/model/formable.js +542 -0
- package/dist/model/workspace.d.ts +6 -0
- package/dist/model/workspace.js +1 -0
- package/dist/monacoeditorwork/yaml.worker..bundle.js +14801 -14800
- package/dist/services/workspace-service.d.ts +10 -0
- package/dist/services/workspace-service.js +132 -0
- package/dist/style.css +1 -1
- package/package.json +7 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FunctionDocumentationBag, RuleDocumentationBag } from "../components/the-doctor/the-doctor";
|
|
2
2
|
import { LintingService } from "../services/linting-service";
|
|
3
3
|
import { ProblemDrawerEventType } from "../components/problem-list/details-drawer";
|
|
4
4
|
import { ToastType } from "../model/toast";
|
|
@@ -8,7 +8,13 @@ export class DocsController extends EventTarget {
|
|
|
8
8
|
this.doc = doc;
|
|
9
9
|
}
|
|
10
10
|
fetchDocs() {
|
|
11
|
-
|
|
11
|
+
const db = this.doc.bagManager.getBag(RuleDocumentationBag);
|
|
12
|
+
const fb = this.doc.bagManager.getBag(FunctionDocumentationBag);
|
|
13
|
+
this.doc.ruleDocsBag = db;
|
|
14
|
+
this.doc.functionDocsBag = fb;
|
|
15
|
+
if ((fb?.export().size ?? 0 > 0) && (db?.export().size ?? 0 > 0)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
12
18
|
this.doc.activitySpinner.show();
|
|
13
19
|
const url = new URL(window.location.href);
|
|
14
20
|
const urlParam = url.searchParams.get('url');
|
|
@@ -27,8 +33,6 @@ export class DocsController extends EventTarget {
|
|
|
27
33
|
this.doc.platformUnavailable(e);
|
|
28
34
|
console.error("documentation service is down");
|
|
29
35
|
});
|
|
30
|
-
this.doc.ruleDocsBag = this.doc.bagManager.getBag(RuleDocumentationBag);
|
|
31
|
-
this.doc.functionDocsBag = this.doc.bagManager.getBag(FunctionDocumentationBag);
|
|
32
36
|
// populate docs via worker.
|
|
33
37
|
this.doc.ruleDocsWorker.addEventListener("message", (event) => {
|
|
34
38
|
const data = event.data;
|
|
@@ -44,14 +48,6 @@ export class DocsController extends EventTarget {
|
|
|
44
48
|
this.doc.activitySpinner.hide();
|
|
45
49
|
}
|
|
46
50
|
});
|
|
47
|
-
// let ruleDocs: string[] = [];
|
|
48
|
-
// let functionDocs: string[] = [];
|
|
49
|
-
// if (this.ruleDocsBag) {
|
|
50
|
-
// ruleDocs = Array.from(this.ruleDocsBag.export().keys());
|
|
51
|
-
// }
|
|
52
|
-
// if (this.functionDocsBag) {
|
|
53
|
-
// functionDocs = Array.from(this.functionDocsBag.export().keys());
|
|
54
|
-
// }
|
|
55
51
|
const fetchDocs = () => {
|
|
56
52
|
this.doc.ruleDocsWorker.postMessage({
|
|
57
53
|
start: true,
|
|
@@ -60,27 +56,7 @@ export class DocsController extends EventTarget {
|
|
|
60
56
|
existingFunctions: []
|
|
61
57
|
});
|
|
62
58
|
};
|
|
63
|
-
|
|
64
|
-
if (this.doc.docExpirationBag) {
|
|
65
|
-
const expiration = this.doc.docExpirationBag.get(DocumentationExpirationBag);
|
|
66
|
-
// if the docs are older than 15 days, refresh them.
|
|
67
|
-
if (expiration) {
|
|
68
|
-
const now = new Date().getTime();
|
|
69
|
-
const then = new Date(expiration).getTime();
|
|
70
|
-
// if (now - then > 1296000000) {
|
|
71
|
-
// fetchDocs();
|
|
72
|
-
// } else {
|
|
73
|
-
// this.activitySpinner.hide();
|
|
74
|
-
// }
|
|
75
|
-
fetchDocs(); // always fetch for now.
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
fetchDocs();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
fetchDocs();
|
|
83
|
-
}
|
|
59
|
+
fetchDocs();
|
|
84
60
|
}
|
|
85
61
|
ruleDocsClicked(event) {
|
|
86
62
|
const ruleId = event.detail.rule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TheDoctor } from "../components/the-doctor/the-doctor.js";
|
|
2
|
+
import { WorkspacesView } from "../components/workspaces/workspace-view.js";
|
|
3
|
+
import { Workspace } from "../model/workspace.js";
|
|
4
|
+
export declare class WorkspaceController extends EventTarget {
|
|
5
|
+
readonly workspaceView: WorkspacesView;
|
|
6
|
+
private readonly bus;
|
|
7
|
+
readonly doc: TheDoctor;
|
|
8
|
+
workspaces: Workspace[] | undefined;
|
|
9
|
+
constructor(doc: TheDoctor);
|
|
10
|
+
getWorkspaces(): void;
|
|
11
|
+
switchWorkspace(evt: CustomEvent<Workspace>): void;
|
|
12
|
+
deleteWorkspace(evt: CustomEvent<Workspace>): void;
|
|
13
|
+
createWorkspace(evt: CustomEvent<string>): void;
|
|
14
|
+
updateWorkspace(evt: CustomEvent<Workspace>): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { CreateBus } from "@pb33f/ranch";
|
|
2
|
+
import { WorkspacesView } from "../components/workspaces/workspace-view.js";
|
|
3
|
+
import { WorkspaceService } from "../services/workspace-service.js";
|
|
4
|
+
import { AddToast, DeleteWorkspace, Reboot, RefreshWorkspaces, SwitchWorkspace, CreateWorkspace, UpdateWorkspace } from "../events/doctor";
|
|
5
|
+
import { ToastType } from "../model/toast";
|
|
6
|
+
export class WorkspaceController extends EventTarget {
|
|
7
|
+
constructor(doc) {
|
|
8
|
+
super();
|
|
9
|
+
this.doc = doc;
|
|
10
|
+
this.bus = CreateBus();
|
|
11
|
+
this.workspaceView = new WorkspacesView(this.doc, this);
|
|
12
|
+
this.addEventListener(RefreshWorkspaces, this.getWorkspaces.bind(this));
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
this.addEventListener(SwitchWorkspace, this.switchWorkspace.bind(this));
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
this.addEventListener(DeleteWorkspace, this.deleteWorkspace.bind(this));
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
this.addEventListener(CreateWorkspace, this.createWorkspace.bind(this));
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
this.addEventListener(UpdateWorkspace, this.updateWorkspace.bind(this));
|
|
21
|
+
}
|
|
22
|
+
getWorkspaces() {
|
|
23
|
+
WorkspaceService.getWorkspaces().then(workspaces => {
|
|
24
|
+
if (workspaces && workspaces.response) {
|
|
25
|
+
this.workspaces = workspaces.response;
|
|
26
|
+
this.workspaceView.workspaces = workspaces.response;
|
|
27
|
+
this.workspaceView.requestUpdate();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
switchWorkspace(evt) {
|
|
32
|
+
WorkspaceService.switchWorkspace(evt.detail).then(() => {
|
|
33
|
+
this.doc.dispatchEvent(new Event(Reboot));
|
|
34
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
35
|
+
bubbles: true,
|
|
36
|
+
composed: true,
|
|
37
|
+
detail: {
|
|
38
|
+
toast: {
|
|
39
|
+
id: crypto.randomUUID(),
|
|
40
|
+
title: "switched workspace",
|
|
41
|
+
type: ToastType.SUCCESS,
|
|
42
|
+
body: `Active workspace changed to '${evt.detail.name}'`
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
this.getWorkspaces();
|
|
47
|
+
}).catch((e) => {
|
|
48
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
49
|
+
bubbles: true,
|
|
50
|
+
composed: true,
|
|
51
|
+
detail: {
|
|
52
|
+
toast: {
|
|
53
|
+
id: crypto.randomUUID(),
|
|
54
|
+
title: "failed switching workspace",
|
|
55
|
+
type: ToastType.ERROR,
|
|
56
|
+
body: `Failed to switch workspace: ${e.detail}`
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
deleteWorkspace(evt) {
|
|
63
|
+
WorkspaceService.deleteWorkspace(evt.detail).then(() => {
|
|
64
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
65
|
+
bubbles: true,
|
|
66
|
+
composed: true,
|
|
67
|
+
detail: {
|
|
68
|
+
toast: {
|
|
69
|
+
id: crypto.randomUUID(),
|
|
70
|
+
title: "workspace was deleted",
|
|
71
|
+
type: ToastType.SUCCESS,
|
|
72
|
+
body: `All gone, destroyed! Good riddance!`
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
this.workspaceView.destroyDialog.hide();
|
|
77
|
+
this.getWorkspaces();
|
|
78
|
+
}).catch((e) => {
|
|
79
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
80
|
+
bubbles: true,
|
|
81
|
+
composed: true,
|
|
82
|
+
detail: {
|
|
83
|
+
toast: {
|
|
84
|
+
id: crypto.randomUUID(),
|
|
85
|
+
title: "failed deleting workspace",
|
|
86
|
+
type: ToastType.ERROR,
|
|
87
|
+
body: `Failed to delete workspace: ${e.detail}`
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
this.workspaceView.deleteWorkspaceError(e);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
createWorkspace(evt) {
|
|
95
|
+
WorkspaceService.createWorkspace(evt.detail).then((workspace) => {
|
|
96
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
97
|
+
bubbles: true,
|
|
98
|
+
composed: true,
|
|
99
|
+
detail: {
|
|
100
|
+
toast: {
|
|
101
|
+
id: crypto.randomUUID(),
|
|
102
|
+
title: "workspace created",
|
|
103
|
+
type: ToastType.SUCCESS,
|
|
104
|
+
body: `Workspace '${workspace.name}' has been created!`
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
this.workspaceView.workspaceForm.handleSuccess(workspace);
|
|
109
|
+
}).catch((e) => {
|
|
110
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
111
|
+
bubbles: true,
|
|
112
|
+
composed: true,
|
|
113
|
+
detail: {
|
|
114
|
+
toast: {
|
|
115
|
+
id: crypto.randomUUID(),
|
|
116
|
+
title: "failed creating workspace",
|
|
117
|
+
type: ToastType.ERROR,
|
|
118
|
+
body: `Failed to create workspace: ${e.detail}`
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
this.workspaceView.workspaceForm.handleError(e);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
updateWorkspace(evt) {
|
|
126
|
+
WorkspaceService.updateWorkspace(evt.detail).then((workspace) => {
|
|
127
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
128
|
+
bubbles: true,
|
|
129
|
+
composed: true,
|
|
130
|
+
detail: {
|
|
131
|
+
toast: {
|
|
132
|
+
id: crypto.randomUUID(),
|
|
133
|
+
title: "workspace updated",
|
|
134
|
+
type: ToastType.SUCCESS,
|
|
135
|
+
body: `Workspace '${workspace.name}' has been updated!`
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
this.workspaceView.workspaceForm.handleSuccess(workspace);
|
|
140
|
+
}).catch((e) => {
|
|
141
|
+
this.doc.dispatchEvent(new CustomEvent(AddToast, {
|
|
142
|
+
bubbles: true,
|
|
143
|
+
composed: true,
|
|
144
|
+
detail: {
|
|
145
|
+
toast: {
|
|
146
|
+
id: crypto.randomUUID(),
|
|
147
|
+
title: "failed updating workspace",
|
|
148
|
+
type: ToastType.ERROR,
|
|
149
|
+
body: `Failed to update workspace: ${e.detail}`
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
this.workspaceView.workspaceForm.handleError(e);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|