@pb33f/cowboy-components 0.7.8 → 0.7.10
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/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 +49 -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/diagnostic-controller.d.ts +1 -0
- package/dist/controllers/diagnostic-controller.js +9 -8
- package/dist/controllers/rolodex-controller.d.ts +1 -1
- package/dist/controllers/rolodex-controller.js +1 -1
- package/dist/controllers/workspace-controller.d.ts +15 -0
- package/dist/controllers/workspace-controller.js +156 -0
- package/dist/cowboy-components.umd.cjs +1558 -1094
- 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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { customElement, state } from "lit/decorators.js";
|
|
9
|
+
import { Formable } from "../../model/formable.js";
|
|
10
|
+
import { WorkspaceForm } from "./workspace-form.js";
|
|
11
|
+
import { WorkspaceDestroyView } from "./workspace-destroy-dialog.js";
|
|
12
|
+
import { DeleteWorkspace, SwitchWorkspace, FormSubmitComplete, RefreshWorkspaces, CreateWorkspace, UpdateWorkspace } from "../../events/doctor.js";
|
|
13
|
+
import { AttentionType } from "../attention-box/attention-box.js";
|
|
14
|
+
import listsCss from "../../css/lists.css.js";
|
|
15
|
+
import workspaceViewCss from "./workspace-view.css.js";
|
|
16
|
+
import badgesCss from "../../css/badges.css.js";
|
|
17
|
+
import linksCss from "../../css/links.css.js";
|
|
18
|
+
import tooltipCss from "../../css/tooltip.css.js";
|
|
19
|
+
let WorkspacesView = class WorkspacesView extends Formable {
|
|
20
|
+
constructor(doc, wsController) {
|
|
21
|
+
super(doc);
|
|
22
|
+
this.doc = doc;
|
|
23
|
+
this.wsController = wsController;
|
|
24
|
+
this.active = false;
|
|
25
|
+
this.mutateWorkspaceActive = false;
|
|
26
|
+
this.workspaceForm = new WorkspaceForm();
|
|
27
|
+
this.destroyDialog = new WorkspaceDestroyView();
|
|
28
|
+
this.setupDestroyDialogEvents();
|
|
29
|
+
this.setupWorkspaceFormEvents();
|
|
30
|
+
}
|
|
31
|
+
setupDestroyDialogEvents() {
|
|
32
|
+
this.destroyDialog.addEventListener('cancel', () => this.handleDestroyCancel());
|
|
33
|
+
this.destroyDialog.addEventListener('destroy', (event) => this.handleDestroyConfirm(event));
|
|
34
|
+
}
|
|
35
|
+
setupWorkspaceFormEvents() {
|
|
36
|
+
this.workspaceForm.addEventListener(FormSubmitComplete, (event) => {
|
|
37
|
+
this.handleWorkspaceFormComplete(event);
|
|
38
|
+
});
|
|
39
|
+
this.workspaceForm.addEventListener(CreateWorkspace, (event) => {
|
|
40
|
+
this.wsController.dispatchEvent(new CustomEvent(CreateWorkspace, {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
composed: true,
|
|
43
|
+
detail: event.detail
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
46
|
+
this.workspaceForm.addEventListener(UpdateWorkspace, (event) => {
|
|
47
|
+
this.wsController.dispatchEvent(new CustomEvent(UpdateWorkspace, {
|
|
48
|
+
bubbles: true,
|
|
49
|
+
composed: true,
|
|
50
|
+
detail: event.detail
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
handleWorkspaceFormComplete(_) {
|
|
55
|
+
// Refresh the workspace list after create/update
|
|
56
|
+
this.wsController.dispatchEvent(new CustomEvent(RefreshWorkspaces, {
|
|
57
|
+
bubbles: true,
|
|
58
|
+
composed: true
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
openCreateWorkspaceDialog() {
|
|
62
|
+
this.workspaceForm.setCreateMode();
|
|
63
|
+
this.workspaceForm.open = true;
|
|
64
|
+
}
|
|
65
|
+
selectWorkspace(workspace) {
|
|
66
|
+
this.wsController.dispatchEvent(new CustomEvent(SwitchWorkspace, {
|
|
67
|
+
bubbles: true,
|
|
68
|
+
composed: true,
|
|
69
|
+
detail: workspace
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
lightWorkspace(id) {
|
|
73
|
+
if (id) {
|
|
74
|
+
let li = this.shadowRoot?.querySelector('li#workspace-' + id);
|
|
75
|
+
if (li) {
|
|
76
|
+
li.classList.add('active');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
dimWorkspace(id) {
|
|
81
|
+
if (id) {
|
|
82
|
+
let li = this.shadowRoot?.querySelector('li#workspace-' + id);
|
|
83
|
+
if (li) {
|
|
84
|
+
li.classList.remove('active');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
showDestroyDialog(w) {
|
|
89
|
+
this.destroyDialog.workspace = w;
|
|
90
|
+
this.destroyDialog.show();
|
|
91
|
+
this.lightWorkspace(w.workspaceId);
|
|
92
|
+
}
|
|
93
|
+
showEditDialog(w) {
|
|
94
|
+
this.workspaceForm.setEditMode(w);
|
|
95
|
+
this.workspaceForm.open = true;
|
|
96
|
+
}
|
|
97
|
+
handleDestroyCancel() {
|
|
98
|
+
this.destroyDialog.hide().then(() => {
|
|
99
|
+
this.dimWorkspace(this.destroyDialog.workspace?.workspaceId);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
handleDestroyConfirm(event) {
|
|
103
|
+
this.wsController.dispatchEvent(new CustomEvent(DeleteWorkspace, {
|
|
104
|
+
bubbles: true,
|
|
105
|
+
composed: true,
|
|
106
|
+
detail: event.detail
|
|
107
|
+
}));
|
|
108
|
+
this.destroyDialog.clearError();
|
|
109
|
+
}
|
|
110
|
+
deleteWorkspaceError(error) {
|
|
111
|
+
this.destroyDialog.setError(error);
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
if (!this.workspaces || this.workspaces.length === 0) {
|
|
115
|
+
return html ``;
|
|
116
|
+
}
|
|
117
|
+
return html `
|
|
118
|
+
<div class="workspace-area">
|
|
119
|
+
${this.destroyDialog}
|
|
120
|
+
|
|
121
|
+
${this.workspaceForm}
|
|
122
|
+
|
|
123
|
+
<h2>workspaces</h2>
|
|
124
|
+
|
|
125
|
+
<p>The best way to think of a workspace is like a project. Keep all your stuff in one place, and
|
|
126
|
+
switch between workspaces when you need to flip to a different spec or project.</p>
|
|
127
|
+
|
|
128
|
+
${this.workspaces.length >= 5 ? html `
|
|
129
|
+
<sl-tooltip content="maximum limit reached, cannot create any more">
|
|
130
|
+
<sl-button disabled>
|
|
131
|
+
Add workspace
|
|
132
|
+
</sl-button>
|
|
133
|
+
</sl-tooltip>
|
|
134
|
+
` : html `
|
|
135
|
+
<sl-button @click="${() => {
|
|
136
|
+
this.openCreateWorkspaceDialog();
|
|
137
|
+
}}">
|
|
138
|
+
Add workspace
|
|
139
|
+
</sl-button>
|
|
140
|
+
`}
|
|
141
|
+
|
|
142
|
+
${this.workspaces.length >= 5 ? html `
|
|
143
|
+
<pb33f-attention-box type="${AttentionType.Info}"
|
|
144
|
+
headerText="maximum workspace count reached">
|
|
145
|
+
In order to create more workspaces, you will need to upgrade to pro (coming soon).
|
|
146
|
+
</pb33f-attention-box>
|
|
147
|
+
` : ''}
|
|
148
|
+
|
|
149
|
+
<hr class="main-break"/>
|
|
150
|
+
<ul>
|
|
151
|
+
|
|
152
|
+
${this.workspaces.map((w) => {
|
|
153
|
+
// Determine workspace content based on active status
|
|
154
|
+
const workspaceContent = w.active
|
|
155
|
+
? html `<strong>${w.name}</strong> <sl-badge pulse>active</sl-badge>`
|
|
156
|
+
: html `<a href="#" class="workspace-link" @click=${() => this.selectWorkspace(w)}>${w.name}</a>`;
|
|
157
|
+
// Determine CSS classes and styling
|
|
158
|
+
const liClasses = w.active ? 'secondary' : '';
|
|
159
|
+
const liStyles = w.active ? 'color: var(--secondary-color)' : '';
|
|
160
|
+
return html `
|
|
161
|
+
<li id="workspace-${w.workspaceId}"
|
|
162
|
+
class="${liClasses}"
|
|
163
|
+
style="${liStyles}"
|
|
164
|
+
@mouseover="${() => this.lightWorkspace(w.workspaceId)}"
|
|
165
|
+
@mouseout="${() => this.dimWorkspace(w.workspaceId)}">
|
|
166
|
+
|
|
167
|
+
${workspaceContent}
|
|
168
|
+
|
|
169
|
+
<div style="display: inline-block; float: right">
|
|
170
|
+
<sl-icon-button class="edit-workspace" name="pencil-square"
|
|
171
|
+
@click="${() => { this.showEditDialog(w); }}"></sl-icon-button>
|
|
172
|
+
${!w.default && !w.active ? html `
|
|
173
|
+
<sl-icon-button class="delete-workspace" name="trash3"
|
|
174
|
+
@click="${() => { this.showDestroyDialog(w); }}"></sl-icon-button>
|
|
175
|
+
` : ''}
|
|
176
|
+
</div>
|
|
177
|
+
</li>
|
|
178
|
+
`;
|
|
179
|
+
})}
|
|
180
|
+
</ul>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
WorkspacesView.styles = [...Formable.styles, workspaceViewCss, badgesCss, linksCss, listsCss, tooltipCss];
|
|
187
|
+
__decorate([
|
|
188
|
+
state()
|
|
189
|
+
], WorkspacesView.prototype, "active", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
state()
|
|
192
|
+
], WorkspacesView.prototype, "mutateWorkspaceActive", void 0);
|
|
193
|
+
WorkspacesView = __decorate([
|
|
194
|
+
customElement("pb33f-doctor-workspaces")
|
|
195
|
+
], WorkspacesView);
|
|
196
|
+
export { WorkspacesView };
|
|
@@ -6,8 +6,13 @@ export class DiagnosticController extends EventTarget {
|
|
|
6
6
|
constructor(doc) {
|
|
7
7
|
super();
|
|
8
8
|
this.doc = doc;
|
|
9
|
+
this.oldScore = 0;
|
|
9
10
|
}
|
|
10
11
|
lintSpec(value, url) {
|
|
12
|
+
// capture old score before any operations
|
|
13
|
+
if (this.doc.problemsOverview.statistics?.statistics.overallScore > 0) {
|
|
14
|
+
this.oldScore = this.doc.problemsOverview.statistics.statistics.overallScore;
|
|
15
|
+
}
|
|
11
16
|
this.doc.activitySpinner.show();
|
|
12
17
|
this.doc.editor.breadcumb.isInvalid = false;
|
|
13
18
|
if (url) {
|
|
@@ -177,10 +182,6 @@ export class DiagnosticController extends EventTarget {
|
|
|
177
182
|
}
|
|
178
183
|
// update the overview statistics
|
|
179
184
|
LintingService.fetchStatistics().then((result) => {
|
|
180
|
-
let oldScore = 0;
|
|
181
|
-
if (this.doc.problemsOverview.statistics) {
|
|
182
|
-
oldScore = this.doc.problemsOverview.statistics.statistics.overallScore;
|
|
183
|
-
}
|
|
184
185
|
this.doc.diagnosticBag?.set(DiagnosticBag, result);
|
|
185
186
|
this.doc.activitySpinner.hide();
|
|
186
187
|
if (result?.remainingCredit <= 10) {
|
|
@@ -196,20 +197,20 @@ export class DiagnosticController extends EventTarget {
|
|
|
196
197
|
if (!settings?.autoDiagnose) {
|
|
197
198
|
if (this.doc.problemsOverview.statistics) {
|
|
198
199
|
const newScore = result.statistics.overallScore;
|
|
199
|
-
if (oldScore > newScore) {
|
|
200
|
+
if (this.oldScore > newScore) {
|
|
200
201
|
this.doc.sendToast({
|
|
201
202
|
id: crypto.randomUUID(),
|
|
202
203
|
type: ToastType.SCOREDOWN,
|
|
203
204
|
body: "Your score has decreased. It is now " + newScore + "%",
|
|
204
|
-
title: "Score went down by " + (oldScore - newScore) + "%"
|
|
205
|
+
title: "Score went down by " + (this.oldScore - newScore) + "%"
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
|
-
if (oldScore < newScore) {
|
|
208
|
+
if (this.oldScore < newScore) {
|
|
208
209
|
this.doc.sendToast({
|
|
209
210
|
id: crypto.randomUUID(),
|
|
210
211
|
type: ToastType.SCOREUP,
|
|
211
212
|
body: "Your score has increased to " + newScore + "%",
|
|
212
|
-
title: "Score went up by " + (newScore - oldScore) + "%"
|
|
213
|
+
title: "Score went up by " + (newScore - this.oldScore) + "%"
|
|
213
214
|
});
|
|
214
215
|
}
|
|
215
216
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TheDoctor } from "../components/the-doctor/the-doctor.js";
|
|
2
2
|
import { NodeClickedEvent } from "../events/doctor.js";
|
|
3
|
-
import { Problem } from "../model/problem";
|
|
3
|
+
import { Problem } from "../model/problem.js";
|
|
4
4
|
export declare class RolodexController extends EventTarget {
|
|
5
5
|
doc: TheDoctor;
|
|
6
6
|
constructor(doc: TheDoctor);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RolodexResponseBag, RolodexStateBag } from "../components/the-doctor/the-doctor.js";
|
|
2
|
-
import { ModelService } from "../services/model-service";
|
|
2
|
+
import { ModelService } from "../services/model-service.js";
|
|
3
3
|
export class RolodexController extends EventTarget {
|
|
4
4
|
constructor(doc) {
|
|
5
5
|
super();
|
|
@@ -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
|
+
}
|