@ms-cloudpack/overlay 0.16.79-beta.0 → 0.16.79
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/browser-esm/chunks/js/chunk-PDWQRLCD.js +30 -0
- package/dist/browser-esm/chunks/js/chunk-PDWQRLCD.js.map +7 -0
- package/dist/browser-esm/lib/constants.js +9 -0
- package/dist/browser-esm/lib/constants.js.map +7 -0
- package/dist/browser-esm/lib/index.js +1339 -0
- package/dist/browser-esm/lib/index.js.map +7 -0
- package/dist/browser-esm/ori-input.json +63 -0
- package/dist/browser-esm/ori-output.json +917 -0
- package/dist/browser-esm/result.json +44 -0
- package/dist/ori/logs/2dJ5EDQ7O1fbqi4lzh1LMOwIGr9-logger.log +0 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +3 -3
|
@@ -0,0 +1,1339 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cookieNames,
|
|
3
|
+
elementIds
|
|
4
|
+
} from "../chunks/js/chunk-PDWQRLCD.js";
|
|
5
|
+
|
|
6
|
+
// packages/overlay/src/index.tsx
|
|
7
|
+
import React15 from "react";
|
|
8
|
+
import ReactDOM from "react-dom";
|
|
9
|
+
|
|
10
|
+
// packages/overlay/src/components/CloudpackProvider/CloudpackProvider.tsx
|
|
11
|
+
import React, { createContext, useState, useContext } from "react";
|
|
12
|
+
|
|
13
|
+
// packages/overlay/src/components/CloudpackProvider/getCookies.ts
|
|
14
|
+
function getCookies() {
|
|
15
|
+
return document.cookie.split(";").map((s9) => s9.split("=")).reduce((current, nextValue) => {
|
|
16
|
+
const name2 = nextValue[0]?.trim();
|
|
17
|
+
const value3 = decodeURIComponent(nextValue[1]?.trim());
|
|
18
|
+
if (name2 && value3) {
|
|
19
|
+
current[name2] = value3;
|
|
20
|
+
}
|
|
21
|
+
return current;
|
|
22
|
+
}, {});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// packages/overlay/src/components/CloudpackProvider/createCloudpackClient.ts
|
|
26
|
+
import { createDataBus } from "@ms-cloudpack/data-bus";
|
|
27
|
+
function createCloudpackClient() {
|
|
28
|
+
const cookies = getCookies();
|
|
29
|
+
const bus = createDataBus();
|
|
30
|
+
let subCounter = 0;
|
|
31
|
+
const subIds = {};
|
|
32
|
+
bus.addProvider({
|
|
33
|
+
path: [],
|
|
34
|
+
onActivate: ({ path }) => {
|
|
35
|
+
const id = subCounter++;
|
|
36
|
+
subIds[path.join("/")] = id;
|
|
37
|
+
sendMessage({ type: "subscribe", data: { path, id } });
|
|
38
|
+
},
|
|
39
|
+
onDeactivate: ({ path }) => {
|
|
40
|
+
const pathString = path.join("/");
|
|
41
|
+
const id = subIds[pathString];
|
|
42
|
+
delete subIds[pathString];
|
|
43
|
+
sendMessage({ type: "unsubscribe", data: { path, id } });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const enqueuedMessages = [];
|
|
47
|
+
const sessionId = cookies[cookieNames.sessionId];
|
|
48
|
+
const apiUrl = cookies[cookieNames.apiUrl];
|
|
49
|
+
const currentSequence = cookies[cookieNames.sessionSequence];
|
|
50
|
+
let socket;
|
|
51
|
+
let idCount = 0;
|
|
52
|
+
function openConnection() {
|
|
53
|
+
if (apiUrl && sessionId) {
|
|
54
|
+
const newSocket = new WebSocket(apiUrl);
|
|
55
|
+
newSocket.onopen = () => {
|
|
56
|
+
console.log("socket opened");
|
|
57
|
+
socket = newSocket;
|
|
58
|
+
socket.onmessage = onMessageReceived;
|
|
59
|
+
socket.onclose = () => {
|
|
60
|
+
socket = void 0;
|
|
61
|
+
};
|
|
62
|
+
for (const message of enqueuedMessages) {
|
|
63
|
+
socket.send(message);
|
|
64
|
+
}
|
|
65
|
+
enqueuedMessages.length = 0;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function sendMessage(options) {
|
|
70
|
+
const { type, requestId, data } = options;
|
|
71
|
+
const message = JSON.stringify({ type, requestId, data });
|
|
72
|
+
if (socket) {
|
|
73
|
+
socket.send(message);
|
|
74
|
+
} else {
|
|
75
|
+
enqueuedMessages.push(message);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const activeRequests = {};
|
|
79
|
+
function sendRequest(options) {
|
|
80
|
+
const { type, data } = options;
|
|
81
|
+
const requestId = `${idCount++}`;
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const timeoutId = setTimeout(() => {
|
|
84
|
+
if (activeRequests[requestId]) {
|
|
85
|
+
reject(new Error("Request timed out."));
|
|
86
|
+
}
|
|
87
|
+
}, 1e4);
|
|
88
|
+
activeRequests[requestId] = {
|
|
89
|
+
resolve: (resultData) => {
|
|
90
|
+
delete activeRequests[requestId];
|
|
91
|
+
clearTimeout(timeoutId);
|
|
92
|
+
resolve(resultData);
|
|
93
|
+
},
|
|
94
|
+
reject: (error3) => {
|
|
95
|
+
delete activeRequests[requestId];
|
|
96
|
+
clearTimeout(timeoutId);
|
|
97
|
+
reject(error3);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
sendMessage({ type, requestId, data });
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function onMessageReceived(message) {
|
|
104
|
+
const response = JSON.parse(message.data);
|
|
105
|
+
const requestId = response.requestId;
|
|
106
|
+
if (requestId !== void 0) {
|
|
107
|
+
activeRequests[requestId].resolve(response.data);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
switch (response.type) {
|
|
111
|
+
case "notify": {
|
|
112
|
+
const { path, data } = response;
|
|
113
|
+
bus.publish(path, data);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case "reload": {
|
|
117
|
+
window.location.reload();
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "sequence": {
|
|
121
|
+
const { sequence } = response;
|
|
122
|
+
if (Number(sequence) > Number(currentSequence)) {
|
|
123
|
+
window.location.reload();
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
openConnection();
|
|
130
|
+
const client = {
|
|
131
|
+
dispose: () => {
|
|
132
|
+
socket?.close();
|
|
133
|
+
socket = void 0;
|
|
134
|
+
},
|
|
135
|
+
getValue: (path) => {
|
|
136
|
+
return bus.getData(path);
|
|
137
|
+
},
|
|
138
|
+
open: (options) => {
|
|
139
|
+
sendMessage({ type: "open", data: options });
|
|
140
|
+
},
|
|
141
|
+
openSource: (options) => {
|
|
142
|
+
sendMessage({ type: "openSource", data: options });
|
|
143
|
+
},
|
|
144
|
+
subscribe: (path, callback) => {
|
|
145
|
+
return bus.subscribe(path, callback);
|
|
146
|
+
},
|
|
147
|
+
editConfig: () => {
|
|
148
|
+
sendMessage({ type: "editConfig", data: {} });
|
|
149
|
+
},
|
|
150
|
+
addOverride: (options) => {
|
|
151
|
+
sendMessage({ type: "addOverride", data: options });
|
|
152
|
+
},
|
|
153
|
+
restartTask: (options) => {
|
|
154
|
+
sendMessage({ type: "restartTask", data: options });
|
|
155
|
+
},
|
|
156
|
+
restartAllTasks: () => {
|
|
157
|
+
sendMessage({ type: "restartAllTasks", data: {} });
|
|
158
|
+
},
|
|
159
|
+
validateOverride: (options) => {
|
|
160
|
+
return sendRequest({ type: "validateOverride", data: options });
|
|
161
|
+
},
|
|
162
|
+
reportMetric: (options) => {
|
|
163
|
+
sendMessage({ type: "reportMetric", data: options });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return client;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// packages/overlay/src/components/CloudpackProvider/CloudpackProvider.tsx
|
|
170
|
+
var CloudpackContext = createContext(null);
|
|
171
|
+
function CloudpackProvider({ children }) {
|
|
172
|
+
const [client] = useState(createCloudpackClient);
|
|
173
|
+
return /* @__PURE__ */ React.createElement(CloudpackContext.Provider, { value: client }, children);
|
|
174
|
+
}
|
|
175
|
+
var useCloudpack = () => useContext(CloudpackContext);
|
|
176
|
+
|
|
177
|
+
// packages/overlay/src/components/StatusOverlay/StatusOverlay.tsx
|
|
178
|
+
import React13, { useCallback as useCallback3, useState as useState7, useRef as useRef3 } from "react";
|
|
179
|
+
|
|
180
|
+
// packages/overlay/src/components/StatusBadge/StatusBadge.tsx
|
|
181
|
+
import React2, { useCallback, useRef, useState as useState4 } from "react";
|
|
182
|
+
|
|
183
|
+
// packages/overlay/src/hooks/useDraggable.ts
|
|
184
|
+
import { useEffect, useState as useState2 } from "react";
|
|
185
|
+
function useDraggable(options) {
|
|
186
|
+
const { enabled, containerElementRef, dragElementRef } = options;
|
|
187
|
+
const [isDragging, setIsDragging] = useState2(false);
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
const moveTarget = containerElementRef?.current;
|
|
190
|
+
const dragTarget = dragElementRef?.current;
|
|
191
|
+
if (!enabled || !moveTarget || !dragTarget) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let originalX = 0;
|
|
195
|
+
let originalY = 0;
|
|
196
|
+
let offset = { x: 0, y: 0 };
|
|
197
|
+
const onPointerMove = (event) => {
|
|
198
|
+
moveTarget.style.transform = `translate(${offset.x + event.clientX - originalX}px, ${offset.y + event.clientY - originalY}px)`;
|
|
199
|
+
};
|
|
200
|
+
const onPointerUp = (event) => {
|
|
201
|
+
setIsDragging(false);
|
|
202
|
+
offset = {
|
|
203
|
+
x: offset.x + event.clientX - originalX,
|
|
204
|
+
y: offset.y + event.clientY - originalY
|
|
205
|
+
};
|
|
206
|
+
dragTarget.releasePointerCapture(event.pointerId);
|
|
207
|
+
dragTarget.removeEventListener("pointerup", onPointerUp);
|
|
208
|
+
dragTarget.removeEventListener("pointermove", onPointerMove);
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
};
|
|
211
|
+
const onPointerDown = (event) => {
|
|
212
|
+
setIsDragging(true);
|
|
213
|
+
originalX = event.clientX;
|
|
214
|
+
originalY = event.clientY;
|
|
215
|
+
dragTarget.setPointerCapture(event.pointerId);
|
|
216
|
+
dragTarget.addEventListener("pointerup", onPointerUp);
|
|
217
|
+
dragTarget.addEventListener("pointermove", onPointerMove);
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
};
|
|
220
|
+
dragTarget.addEventListener("pointerdown", onPointerDown);
|
|
221
|
+
return () => {
|
|
222
|
+
dragTarget.removeEventListener("pointerdown", onPointerDown);
|
|
223
|
+
dragTarget.removeEventListener("pointermove", onPointerMove);
|
|
224
|
+
dragTarget.removeEventListener("pointerup", onPointerUp);
|
|
225
|
+
};
|
|
226
|
+
}, [enabled, containerElementRef, dragElementRef]);
|
|
227
|
+
return {
|
|
228
|
+
isDragging
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// packages/overlay/src/components/StatusBadge/StatusBadge.module.css
|
|
233
|
+
var compiledModule = `.uHuWYf-StatusBadgemodule--fixedOverlay {
|
|
234
|
+
position: fixed;
|
|
235
|
+
pointer-events: none;
|
|
236
|
+
background: transparent;
|
|
237
|
+
top: 0;
|
|
238
|
+
bottom: 0;
|
|
239
|
+
left: 0;
|
|
240
|
+
right: 0;
|
|
241
|
+
z-index: 99999;
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.uHuWYf-StatusBadgemodule--gripArea {
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-direction: row;
|
|
248
|
+
gap: 2px;
|
|
249
|
+
height: 100%;
|
|
250
|
+
width: 12px;
|
|
251
|
+
cursor: move;
|
|
252
|
+
margin-right: -4px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.uHuWYf-StatusBadgemodule--grip {
|
|
256
|
+
width: 2px;
|
|
257
|
+
height: 100%;
|
|
258
|
+
background: rgba(0, 0, 0, 0.2);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.uHuWYf-StatusBadgemodule--contentSurface {
|
|
262
|
+
pointer-events: auto;
|
|
263
|
+
display: contents;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.uHuWYf-StatusBadgemodule--badge {
|
|
267
|
+
position: absolute;
|
|
268
|
+
bottom: 4px;
|
|
269
|
+
right: 4px;
|
|
270
|
+
font-size: 12px;
|
|
271
|
+
display: inline-flex;
|
|
272
|
+
gap: 8px;
|
|
273
|
+
background: #dddddd;
|
|
274
|
+
box-shadow: 0 0 12px -6px rgba(0, 0, 0, 0.75);
|
|
275
|
+
border: 1px solid #999999;
|
|
276
|
+
border-radius: 4px;
|
|
277
|
+
height: 28px;
|
|
278
|
+
flex-shrink: 0;
|
|
279
|
+
justify-content: center;
|
|
280
|
+
align-items: center;
|
|
281
|
+
box-sizing: border-box;
|
|
282
|
+
padding: 3px;
|
|
283
|
+
padding-right: 8px;
|
|
284
|
+
|
|
285
|
+
transition: background-color 0.2s ease-in-out;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.uHuWYf-StatusBadgemodule--inline {
|
|
289
|
+
flex-shrink: 0;
|
|
290
|
+
position: relative;
|
|
291
|
+
bottom: auto;
|
|
292
|
+
right: auto;
|
|
293
|
+
top: auto;
|
|
294
|
+
left: auto;
|
|
295
|
+
box-shadow: none;
|
|
296
|
+
padding-left: 8px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.uHuWYf-StatusBadgemodule--building {
|
|
300
|
+
background: #bbb;
|
|
301
|
+
color: #000;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.uHuWYf-StatusBadgemodule--success {
|
|
305
|
+
background: #7ad17a;
|
|
306
|
+
color: #000;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.uHuWYf-StatusBadgemodule--warning {
|
|
310
|
+
background: #e4e68b;
|
|
311
|
+
color: #000;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.uHuWYf-StatusBadgemodule--error {
|
|
315
|
+
background: #ffb9b9;
|
|
316
|
+
color: #000;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.uHuWYf-StatusBadgemodule--button {
|
|
320
|
+
cursor: pointer;
|
|
321
|
+
background: inherit;
|
|
322
|
+
border: none;
|
|
323
|
+
border-radius: 3px;
|
|
324
|
+
display: flex;
|
|
325
|
+
align-self: stretch;
|
|
326
|
+
align-items: center;
|
|
327
|
+
justify-content: center;
|
|
328
|
+
box-sizing: border-box;
|
|
329
|
+
padding: 0;
|
|
330
|
+
margin: 0;
|
|
331
|
+
font-weight: inherit;
|
|
332
|
+
font-size: inherit;
|
|
333
|
+
font-family: inherit;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.uHuWYf-StatusBadgemodule--button:hover {
|
|
337
|
+
filter: invert(0.1);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.uHuWYf-StatusBadgemodule--value {
|
|
341
|
+
font-weight: 600;
|
|
342
|
+
background: rgba(255, 255, 255, 0.4);
|
|
343
|
+
box-shadow: 2px 2px 3px -1px rgba(0, 0, 0, 0.15) inset;
|
|
344
|
+
padding: 2px 8px;
|
|
345
|
+
border-radius: 3px;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.uHuWYf-StatusBadgemodule--metric {
|
|
349
|
+
margin-left: 2px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.uHuWYf-StatusBadgemodule--collapsed {
|
|
353
|
+
overflow: hidden;
|
|
354
|
+
padding: 0;
|
|
355
|
+
}
|
|
356
|
+
.uHuWYf-StatusBadgemodule--collapsed *:not(.uHuWYf-StatusBadgemodule--chevron) {
|
|
357
|
+
display: none;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.uHuWYf-StatusBadgemodule--chevron {
|
|
361
|
+
padding: 0 3px;
|
|
362
|
+
}
|
|
363
|
+
`;
|
|
364
|
+
var s = document.createElement("style");
|
|
365
|
+
s.setAttribute("data-sourceFile", "packages/overlay/src/components/StatusBadge/StatusBadge.module.css");
|
|
366
|
+
s.appendChild(document.createTextNode(compiledModule));
|
|
367
|
+
document.head.appendChild(s);
|
|
368
|
+
var badge = "uHuWYf-StatusBadgemodule--badge";
|
|
369
|
+
var building = "uHuWYf-StatusBadgemodule--building";
|
|
370
|
+
var button = "uHuWYf-StatusBadgemodule--button";
|
|
371
|
+
var chevron = "uHuWYf-StatusBadgemodule--chevron";
|
|
372
|
+
var collapsed = "uHuWYf-StatusBadgemodule--collapsed";
|
|
373
|
+
var contentSurface = "uHuWYf-StatusBadgemodule--contentSurface";
|
|
374
|
+
var error = "uHuWYf-StatusBadgemodule--error";
|
|
375
|
+
var fixedOverlay = "uHuWYf-StatusBadgemodule--fixedOverlay";
|
|
376
|
+
var grip = "uHuWYf-StatusBadgemodule--grip";
|
|
377
|
+
var gripArea = "uHuWYf-StatusBadgemodule--gripArea";
|
|
378
|
+
var inline = "uHuWYf-StatusBadgemodule--inline";
|
|
379
|
+
var metric = "uHuWYf-StatusBadgemodule--metric";
|
|
380
|
+
var success = "uHuWYf-StatusBadgemodule--success";
|
|
381
|
+
var value = "uHuWYf-StatusBadgemodule--value";
|
|
382
|
+
var warning = "uHuWYf-StatusBadgemodule--warning";
|
|
383
|
+
var StatusBadge_module_default = { badge, building, button, chevron, collapsed, contentSurface, error, fixedOverlay, grip, gripArea, inline, metric, success, value, warning };
|
|
384
|
+
|
|
385
|
+
// packages/overlay/src/components/StatusBadge/StatusBadge.tsx
|
|
386
|
+
import { default as cx } from "classnames";
|
|
387
|
+
|
|
388
|
+
// packages/overlay/src/components/CloudpackProvider/useStatus.ts
|
|
389
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
390
|
+
import { taskStatsSource } from "@ms-cloudpack/api-server/client";
|
|
391
|
+
var defaultStatus = {
|
|
392
|
+
status: "unknown",
|
|
393
|
+
remainingTasks: 0,
|
|
394
|
+
totalTasks: 0,
|
|
395
|
+
totalErrors: 0,
|
|
396
|
+
totalWarnings: 0
|
|
397
|
+
};
|
|
398
|
+
var useStatus = () => {
|
|
399
|
+
const service = useCloudpack();
|
|
400
|
+
const [status, setStatus] = useState3(() => service?.getValue(taskStatsSource) || defaultStatus);
|
|
401
|
+
useEffect2(() => service?.subscribe(taskStatsSource, setStatus), [service]);
|
|
402
|
+
return status;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// packages/overlay/src/components/StatusBadge/StatusBadge.tsx
|
|
406
|
+
function StatusBadge({ inline: inline2, onExpand, pageLoadTime }) {
|
|
407
|
+
const badgeStatusKey = "cloudpack.badgeStatus";
|
|
408
|
+
const rootElementRef = useRef(null);
|
|
409
|
+
const dragElementRef = useRef(null);
|
|
410
|
+
const status = useStatus();
|
|
411
|
+
const [isCollapsed, setIsCollapsed] = useState4(!!localStorage.getItem(badgeStatusKey));
|
|
412
|
+
const shouldRender = status.status !== "unknown";
|
|
413
|
+
const toggleBadgeVisibility = useCallback(() => {
|
|
414
|
+
const newCollapsedState = !isCollapsed;
|
|
415
|
+
console.log("Status badge collapsed state:", newCollapsedState);
|
|
416
|
+
setIsCollapsed(newCollapsedState);
|
|
417
|
+
localStorage.setItem(badgeStatusKey, newCollapsedState ? "collapsed" : "");
|
|
418
|
+
}, [isCollapsed]);
|
|
419
|
+
useDraggable({
|
|
420
|
+
// If we're not yet able to render, don't enable dragging yet.
|
|
421
|
+
// Otherwise the event handlers won't be attached when the component renders.
|
|
422
|
+
enabled: shouldRender && !inline2,
|
|
423
|
+
containerElementRef: rootElementRef,
|
|
424
|
+
dragElementRef
|
|
425
|
+
});
|
|
426
|
+
if (!shouldRender) {
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
const metric2 = pageLoadTime ? /* @__PURE__ */ React2.createElement("span", { className: StatusBadge_module_default.metric, title: "Page Load Time" }, "in ", pageLoadTime.toFixed(2), " ms") : null;
|
|
430
|
+
const leftChevron = "\xAB";
|
|
431
|
+
const rightChevron = "\xBB";
|
|
432
|
+
const badge2 = /* @__PURE__ */ React2.createElement(
|
|
433
|
+
"div",
|
|
434
|
+
{
|
|
435
|
+
id: elementIds.statusBadgeRoot,
|
|
436
|
+
ref: rootElementRef,
|
|
437
|
+
className: `${getStatusClassName(status, !!inline2)} ${getCollapsedClassName(isCollapsed)}`
|
|
438
|
+
},
|
|
439
|
+
!inline2 && /* @__PURE__ */ React2.createElement("div", { ref: dragElementRef, className: StatusBadge_module_default.gripArea }, /* @__PURE__ */ React2.createElement("div", { className: StatusBadge_module_default.grip }), /* @__PURE__ */ React2.createElement("div", { className: StatusBadge_module_default.grip })),
|
|
440
|
+
/* @__PURE__ */ React2.createElement("button", { className: StatusBadge_module_default.button, onClick: onExpand, "aria-label": "Expand overlay" }, /* @__PURE__ */ React2.createElement("div", { className: StatusBadge_module_default.value }, getStatusString(status))),
|
|
441
|
+
/* @__PURE__ */ React2.createElement("div", null, getStatsString(status), metric2),
|
|
442
|
+
/* @__PURE__ */ React2.createElement("button", { className: `${StatusBadge_module_default.button} ${StatusBadge_module_default.chevron}`, onClick: toggleBadgeVisibility }, isCollapsed ? leftChevron : rightChevron)
|
|
443
|
+
);
|
|
444
|
+
return inline2 ? badge2 : /* @__PURE__ */ React2.createElement("div", { className: StatusBadge_module_default.fixedOverlay }, /* @__PURE__ */ React2.createElement("div", { className: StatusBadge_module_default.contentSurface }, badge2));
|
|
445
|
+
}
|
|
446
|
+
function getStatusString(status) {
|
|
447
|
+
if (status.status === "pending") {
|
|
448
|
+
return "Running";
|
|
449
|
+
}
|
|
450
|
+
if (status.totalTasks === 0) {
|
|
451
|
+
return "Idle";
|
|
452
|
+
}
|
|
453
|
+
return status.totalErrors === 0 ? "Success" : "Errors";
|
|
454
|
+
}
|
|
455
|
+
function getStatusClassName({ status, totalTasks, totalErrors, totalWarnings }, inline2) {
|
|
456
|
+
return cx(StatusBadge_module_default.badge, {
|
|
457
|
+
[StatusBadge_module_default.inline]: inline2,
|
|
458
|
+
[StatusBadge_module_default.building]: status === "pending",
|
|
459
|
+
[StatusBadge_module_default.success]: status === "idle" && totalTasks > 0 && totalErrors === 0 && totalWarnings === 0,
|
|
460
|
+
[StatusBadge_module_default.error]: status === "idle" && totalErrors > 0,
|
|
461
|
+
[StatusBadge_module_default.warning]: status === "idle" && totalErrors === 0 && totalWarnings > 0
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function getCollapsedClassName(isCollapsed) {
|
|
465
|
+
return cx(StatusBadge_module_default.badge, {
|
|
466
|
+
[StatusBadge_module_default.collapsed]: isCollapsed
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function getStatsString({ totalTasks, remainingTasks, totalErrors, totalWarnings }) {
|
|
470
|
+
if (totalTasks === 0) {
|
|
471
|
+
return "";
|
|
472
|
+
}
|
|
473
|
+
return [
|
|
474
|
+
remainingTasks > 0 && `${remainingTasks} of ${totalTasks} tasks pending`,
|
|
475
|
+
remainingTasks === 0 && `${totalTasks} tasks completed`,
|
|
476
|
+
totalErrors === 1 && `${totalErrors} error`,
|
|
477
|
+
totalErrors > 1 && `${totalErrors} errors`,
|
|
478
|
+
totalWarnings === 1 && `${totalWarnings} warning`,
|
|
479
|
+
totalWarnings > 1 && `${totalWarnings} warnings`
|
|
480
|
+
].filter(Boolean).join(", ");
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// packages/overlay/src/components/StatusDialog/StatusDialog.tsx
|
|
484
|
+
import React9, { useCallback as useCallback2 } from "react";
|
|
485
|
+
|
|
486
|
+
// packages/overlay/src/components/StatusDialog/TaskList.tsx
|
|
487
|
+
import React6 from "react";
|
|
488
|
+
|
|
489
|
+
// packages/overlay/src/components/StatusDialog/TaskStatus.tsx
|
|
490
|
+
import React5 from "react";
|
|
491
|
+
|
|
492
|
+
// packages/overlay/src/components/StatusDialog/TaskResultItem.tsx
|
|
493
|
+
import React3 from "react";
|
|
494
|
+
|
|
495
|
+
// packages/overlay/src/components/StatusDialog/TaskResultItem.module.css
|
|
496
|
+
var compiledModule2 = `.FSsdmcQ-TaskResultItemmodule--root {
|
|
497
|
+
display: flex;
|
|
498
|
+
background: #f5f5f5;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.FSsdmcQ-TaskResultItemmodule--statusBar {
|
|
502
|
+
flex-shrink: 0;
|
|
503
|
+
border-radius: 4px;
|
|
504
|
+
width: 4px;
|
|
505
|
+
background: #aa0000;
|
|
506
|
+
box-shadow: 2px 0 4px 0 rgb(220 0 0 / 20%);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.FSsdmcQ-TaskResultItemmodule--content {
|
|
510
|
+
padding: 8px;
|
|
511
|
+
display: flex;
|
|
512
|
+
flex-grow: 1;
|
|
513
|
+
overflow: hidden;
|
|
514
|
+
flex-direction: column;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.FSsdmcQ-TaskResultItemmodule--titleArea {
|
|
518
|
+
display: flex;
|
|
519
|
+
align-items: center;
|
|
520
|
+
flex-direction: row;
|
|
521
|
+
gap: 4px;
|
|
522
|
+
padding: 4px 0;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.FSsdmcQ-TaskResultItemmodule--file {
|
|
526
|
+
display: inline-flex;
|
|
527
|
+
margin: 0;
|
|
528
|
+
padding: 0;
|
|
529
|
+
border: none;
|
|
530
|
+
background: inherit;
|
|
531
|
+
font-family: inherit;
|
|
532
|
+
flex-grow: 1;
|
|
533
|
+
font-weight: 500;
|
|
534
|
+
font-size: 14px;
|
|
535
|
+
flex-shrink: 0;
|
|
536
|
+
text-decoration: none;
|
|
537
|
+
color: #000;
|
|
538
|
+
cursor: pointer;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.FSsdmcQ-TaskResultItemmodule--file:hover {
|
|
542
|
+
text-decoration: underline;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.FSsdmcQ-TaskResultItemmodule--actionArea {
|
|
546
|
+
display: flex;
|
|
547
|
+
flex-direction: row;
|
|
548
|
+
gap: 8px;
|
|
549
|
+
flex-shrink: 0;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.FSsdmcQ-TaskResultItemmodule--text {
|
|
553
|
+
word-wrap: break-word;
|
|
554
|
+
color: #333;
|
|
555
|
+
}
|
|
556
|
+
`;
|
|
557
|
+
var s2 = document.createElement("style");
|
|
558
|
+
s2.setAttribute("data-sourceFile", "packages/overlay/src/components/StatusDialog/TaskResultItem.module.css");
|
|
559
|
+
s2.appendChild(document.createTextNode(compiledModule2));
|
|
560
|
+
document.head.appendChild(s2);
|
|
561
|
+
var actionArea = "FSsdmcQ-TaskResultItemmodule--actionArea";
|
|
562
|
+
var content = "FSsdmcQ-TaskResultItemmodule--content";
|
|
563
|
+
var file = "FSsdmcQ-TaskResultItemmodule--file";
|
|
564
|
+
var root = "FSsdmcQ-TaskResultItemmodule--root";
|
|
565
|
+
var statusBar = "FSsdmcQ-TaskResultItemmodule--statusBar";
|
|
566
|
+
var text = "FSsdmcQ-TaskResultItemmodule--text";
|
|
567
|
+
var titleArea = "FSsdmcQ-TaskResultItemmodule--titleArea";
|
|
568
|
+
var TaskResultItem_module_default = { actionArea, content, file, root, statusBar, text, titleArea };
|
|
569
|
+
|
|
570
|
+
// packages/overlay/src/components/StatusDialog/TaskResultItem.tsx
|
|
571
|
+
function TaskResultItem({ item, projectPath, index }) {
|
|
572
|
+
const service = useCloudpack();
|
|
573
|
+
const openSource = (ev) => {
|
|
574
|
+
if (item.location) {
|
|
575
|
+
service.openSource({
|
|
576
|
+
rootPath: projectPath,
|
|
577
|
+
relativePath: item.location?.file,
|
|
578
|
+
line: item.location?.line,
|
|
579
|
+
column: item.location?.column
|
|
580
|
+
});
|
|
581
|
+
ev.preventDefault();
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
const filename = item.location?.file || "(path unavailable)";
|
|
585
|
+
const location = ["", item.location?.line, item.location?.column].filter(Boolean).join(":");
|
|
586
|
+
return /* @__PURE__ */ React3.createElement("div", { className: TaskResultItem_module_default.root }, /* @__PURE__ */ React3.createElement("div", { className: TaskResultItem_module_default.statusBar }), /* @__PURE__ */ React3.createElement("div", { className: TaskResultItem_module_default.content }, /* @__PURE__ */ React3.createElement("div", { className: TaskResultItem_module_default.titleArea }, /* @__PURE__ */ React3.createElement("button", { onClick: openSource, className: TaskResultItem_module_default.file }, index, ". ", filename, location && ` (${location})`, ":")), /* @__PURE__ */ React3.createElement("div", { className: TaskResultItem_module_default.text }, item.text), /* @__PURE__ */ React3.createElement("pre", { className: TaskResultItem_module_default.text }, JSON.stringify(item, null, 2))));
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// packages/overlay/src/components/StatusDialog/TaskStatus.module.css
|
|
590
|
+
var compiledModule3 = `.WGSBzu-TaskStatusmodule--root {
|
|
591
|
+
border: 1px solid #ccc;
|
|
592
|
+
border-radius: 3px;
|
|
593
|
+
box-shadow: 0 0 12px -6px rgba(0, 0, 0, 0.25);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.WGSBzu-TaskStatusmodule--header {
|
|
597
|
+
display: flex;
|
|
598
|
+
gap: 8px;
|
|
599
|
+
padding: 8px 16px;
|
|
600
|
+
background: #f0f0f0;
|
|
601
|
+
align-items: center;
|
|
602
|
+
line-height: 1;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.WGSBzu-TaskStatusmodule--commands {
|
|
606
|
+
display: flex;
|
|
607
|
+
flex-direction: row;
|
|
608
|
+
gap: 8px;
|
|
609
|
+
align-items: center;
|
|
610
|
+
flex-shrink: 0;
|
|
611
|
+
height: 40px;
|
|
612
|
+
padding: 0 16px;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.WGSBzu-TaskStatusmodule--expandButton {
|
|
616
|
+
background: transparent;
|
|
617
|
+
border: none;
|
|
618
|
+
border-radius: 4px;
|
|
619
|
+
width: 32px;
|
|
620
|
+
height: 32px;
|
|
621
|
+
}
|
|
622
|
+
.WGSBzu-TaskStatusmodule--expandButton:hover {
|
|
623
|
+
background: rgba(0, 0, 0, 0.1);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.WGSBzu-TaskStatusmodule--expandButton:active {
|
|
627
|
+
background: rgba(0, 0, 0, 0.2);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.WGSBzu-TaskStatusmodule--expandIcon {
|
|
631
|
+
transition: transform 0.1s ease-in-out;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.WGSBzu-TaskStatusmodule--collapsed {
|
|
635
|
+
transform: rotate(-90deg);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.WGSBzu-TaskStatusmodule--farArea {
|
|
639
|
+
line-height: 1;
|
|
640
|
+
font-size: 13px;
|
|
641
|
+
text-align: end;
|
|
642
|
+
display: flex;
|
|
643
|
+
align-items: baseline;
|
|
644
|
+
flex-direction: row;
|
|
645
|
+
gap: 8px;
|
|
646
|
+
display: flex;
|
|
647
|
+
flex-grow: 1;
|
|
648
|
+
justify-content: end;
|
|
649
|
+
flex-direction: row;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.WGSBzu-TaskStatusmodule--title {
|
|
653
|
+
font-size: 16px;
|
|
654
|
+
font-weight: 500;
|
|
655
|
+
color: #333;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.WGSBzu-TaskStatusmodule--subTitle {
|
|
659
|
+
font-size: 13px;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.WGSBzu-TaskStatusmodule--content {
|
|
663
|
+
border-top: 1px solid #ccc;
|
|
664
|
+
background: #fafafa;
|
|
665
|
+
padding: 8px 16px;
|
|
666
|
+
display: flex;
|
|
667
|
+
flex-direction: column;
|
|
668
|
+
gap: 8px;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.WGSBzu-TaskStatusmodule--resultItems {
|
|
672
|
+
display: flex;
|
|
673
|
+
flex-direction: column;
|
|
674
|
+
gap: 8px;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.WGSBzu-TaskStatusmodule--error {
|
|
678
|
+
background: #ffe9e9;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
.WGSBzu-TaskStatusmodule--success {
|
|
682
|
+
background: #e9f9e9;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.WGSBzu-TaskStatusmodule--warning {
|
|
686
|
+
background: #fff9e9;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.WGSBzu-TaskStatusmodule--name {
|
|
690
|
+
font-size: 12px;
|
|
691
|
+
font-weight: 600;
|
|
692
|
+
text-transform: uppercase;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
.WGSBzu-TaskStatusmodule--value {
|
|
696
|
+
display: flex;
|
|
697
|
+
flex-direction: column;
|
|
698
|
+
font-size: 14px;
|
|
699
|
+
color: #333;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
.WGSBzu-TaskStatusmodule--linkButton {
|
|
703
|
+
display: inline-flex;
|
|
704
|
+
align-items: flex-start;
|
|
705
|
+
text-align: start;
|
|
706
|
+
margin: 0;
|
|
707
|
+
padding: 0;
|
|
708
|
+
border: none;
|
|
709
|
+
background: inherit;
|
|
710
|
+
font-family: inherit;
|
|
711
|
+
flex-grow: 1;
|
|
712
|
+
|
|
713
|
+
font-size: 14px;
|
|
714
|
+
flex-shrink: 0;
|
|
715
|
+
text-decoration: none;
|
|
716
|
+
color: #000;
|
|
717
|
+
cursor: pointer;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.WGSBzu-TaskStatusmodule--linkButton:hover {
|
|
721
|
+
text-decoration: underline;
|
|
722
|
+
}
|
|
723
|
+
`;
|
|
724
|
+
var s3 = document.createElement("style");
|
|
725
|
+
s3.setAttribute("data-sourceFile", "packages/overlay/src/components/StatusDialog/TaskStatus.module.css");
|
|
726
|
+
s3.appendChild(document.createTextNode(compiledModule3));
|
|
727
|
+
document.head.appendChild(s3);
|
|
728
|
+
var collapsed2 = "WGSBzu-TaskStatusmodule--collapsed";
|
|
729
|
+
var commands = "WGSBzu-TaskStatusmodule--commands";
|
|
730
|
+
var content2 = "WGSBzu-TaskStatusmodule--content";
|
|
731
|
+
var error2 = "WGSBzu-TaskStatusmodule--error";
|
|
732
|
+
var expandButton = "WGSBzu-TaskStatusmodule--expandButton";
|
|
733
|
+
var expandIcon = "WGSBzu-TaskStatusmodule--expandIcon";
|
|
734
|
+
var farArea = "WGSBzu-TaskStatusmodule--farArea";
|
|
735
|
+
var header = "WGSBzu-TaskStatusmodule--header";
|
|
736
|
+
var linkButton = "WGSBzu-TaskStatusmodule--linkButton";
|
|
737
|
+
var name = "WGSBzu-TaskStatusmodule--name";
|
|
738
|
+
var resultItems = "WGSBzu-TaskStatusmodule--resultItems";
|
|
739
|
+
var root2 = "WGSBzu-TaskStatusmodule--root";
|
|
740
|
+
var subTitle = "WGSBzu-TaskStatusmodule--subTitle";
|
|
741
|
+
var success2 = "WGSBzu-TaskStatusmodule--success";
|
|
742
|
+
var title = "WGSBzu-TaskStatusmodule--title";
|
|
743
|
+
var value2 = "WGSBzu-TaskStatusmodule--value";
|
|
744
|
+
var warning2 = "WGSBzu-TaskStatusmodule--warning";
|
|
745
|
+
var TaskStatus_module_default = { collapsed: collapsed2, commands, content: content2, error: error2, expandButton, expandIcon, farArea, header, linkButton, name, resultItems, root: root2, subTitle, success: success2, title, value: value2, warning: warning2 };
|
|
746
|
+
|
|
747
|
+
// packages/overlay/src/components/StatusDialog/TaskStatus.tsx
|
|
748
|
+
import { default as cx2 } from "classnames";
|
|
749
|
+
|
|
750
|
+
// packages/overlay/src/images/error-24.inline.svg
|
|
751
|
+
var error_24_inline_default = 'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<path d="M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM15.5303 8.46967L15.4462 8.39705C15.1852 8.2034 14.827 8.20101 14.5636 8.38988L14.4697 8.46967L12 10.939L9.53033 8.46967L9.44621 8.39705C9.18522 8.2034 8.82701 8.20101 8.56362 8.38988L8.46967 8.46967L8.39705 8.55379C8.2034 8.81478 8.20101 9.17299 8.38988 9.43638L8.46967 9.53033L10.939 12L8.46967 14.4697L8.39705 14.5538C8.2034 14.8148 8.20101 15.173 8.38988 15.4364L8.46967 15.5303L8.55379 15.6029C8.81478 15.7966 9.17299 15.799 9.43638 15.6101L9.53033 15.5303L12 13.061L14.4697 15.5303L14.5538 15.6029C14.8148 15.7966 15.173 15.799 15.4364 15.6101L15.5303 15.5303L15.6029 15.4462C15.7966 15.1852 15.799 14.827 15.6101 14.5636L15.5303 14.4697L13.061 12L15.5303 9.53033L15.6029 9.44621C15.7966 9.18522 15.799 8.82701 15.6101 8.56362L15.5303 8.46967L15.4462 8.39705L15.5303 8.46967Z" fill="%23aa0000"/>%0A</svg>%0A';
|
|
752
|
+
|
|
753
|
+
// packages/overlay/src/images/success-24.inline.svg
|
|
754
|
+
var success_24_inline_default = 'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<path d="M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM15.2197 8.96967L10.75 13.4393L8.78033 11.4697C8.48744 11.1768 8.01256 11.1768 7.71967 11.4697C7.42678 11.7626 7.42678 12.2374 7.71967 12.5303L10.2197 15.0303C10.5126 15.3232 10.9874 15.3232 11.2803 15.0303L16.2803 10.0303C16.5732 9.73744 16.5732 9.26256 16.2803 8.96967C15.9874 8.67678 15.5126 8.67678 15.2197 8.96967Z" fill="%2300aa00"/>%0A</svg>%0A';
|
|
755
|
+
|
|
756
|
+
// packages/overlay/src/images/chevrondown-20.inline.svg
|
|
757
|
+
var chevrondown_20_inline_default = 'data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<path d="M15.794 7.73271C16.0797 8.03263 16.0681 8.50737 15.7682 8.79306L10.5178 13.7944C10.2281 14.0703 9.77285 14.0703 9.48318 13.7944L4.23271 8.79306C3.93279 8.50737 3.92125 8.03263 4.20694 7.73271C4.49264 7.43279 4.96737 7.42125 5.26729 7.70694L10.0005 12.2155L14.7336 7.70694C15.0336 7.42125 15.5083 7.43279 15.794 7.73271Z" fill="%23212121"/>%0A</svg>%0A';
|
|
758
|
+
|
|
759
|
+
// packages/overlay/src/components/Button/Button.tsx
|
|
760
|
+
import React4 from "react";
|
|
761
|
+
|
|
762
|
+
// packages/overlay/src/components/Button/Button.module.css
|
|
763
|
+
var compiledModule4 = `.RpmxvThK-Buttonmodule--standardButton {
|
|
764
|
+
outline: transparent;
|
|
765
|
+
position: relative;
|
|
766
|
+
font-family: inherit;
|
|
767
|
+
font-size: 14px;
|
|
768
|
+
font-weight: 600;
|
|
769
|
+
box-sizing: border-box;
|
|
770
|
+
border: 1px solid rgb(138, 136, 134);
|
|
771
|
+
display: inline-block;
|
|
772
|
+
text-decoration: none;
|
|
773
|
+
text-align: center;
|
|
774
|
+
cursor: pointer;
|
|
775
|
+
padding: 0px 16px;
|
|
776
|
+
border-radius: 2px;
|
|
777
|
+
min-width: 80px;
|
|
778
|
+
height: 32px;
|
|
779
|
+
background-color: rgb(255, 255, 255);
|
|
780
|
+
color: rgb(50, 49, 48);
|
|
781
|
+
user-select: none;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
.RpmxvThK-Buttonmodule--standardButton:active {
|
|
785
|
+
background-color: rgb(237, 235, 233);
|
|
786
|
+
color: rgb(32, 31, 30);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.RpmxvThK-Buttonmodule--standardButton:hover {
|
|
790
|
+
background-color: rgb(243, 242, 241);
|
|
791
|
+
color: rgb(32, 31, 30);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.RpmxvThK-Buttonmodule--standardButton:focus {
|
|
795
|
+
border: 3px solid rgb(0, 0, 0);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
.RpmxvThK-Buttonmodule--primaryButton {
|
|
799
|
+
outline: transparent;
|
|
800
|
+
position: relative;
|
|
801
|
+
font-family: inherit;
|
|
802
|
+
font-size: 14px;
|
|
803
|
+
font-weight: 600;
|
|
804
|
+
box-sizing: border-box;
|
|
805
|
+
border: 1px solid rgb(0, 120, 212);
|
|
806
|
+
display: inline-block;
|
|
807
|
+
text-decoration: none;
|
|
808
|
+
text-align: center;
|
|
809
|
+
cursor: pointer;
|
|
810
|
+
padding: 0px 16px;
|
|
811
|
+
border-radius: 2px;
|
|
812
|
+
min-width: 80px;
|
|
813
|
+
height: 32px;
|
|
814
|
+
background-color: rgb(0, 120, 212);
|
|
815
|
+
color: rgb(255, 255, 255);
|
|
816
|
+
user-select: none;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.RpmxvThK-Buttonmodule--primaryButton:active {
|
|
820
|
+
background-color: rgb(0, 90, 158);
|
|
821
|
+
border: 1px solid rgb(0, 90, 158);
|
|
822
|
+
color: rgb(255, 255, 255);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
.RpmxvThK-Buttonmodule--primaryButton:hover {
|
|
826
|
+
background-color: rgb(16, 110, 190);
|
|
827
|
+
border: 1px solid rgb(16, 110, 190);
|
|
828
|
+
color: rgb(255, 255, 255);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
.RpmxvThK-Buttonmodule--primaryButton:focus {
|
|
832
|
+
border: 3px solid rgb(0, 0, 0);
|
|
833
|
+
}
|
|
834
|
+
`;
|
|
835
|
+
var s4 = document.createElement("style");
|
|
836
|
+
s4.setAttribute("data-sourceFile", "packages/overlay/src/components/Button/Button.module.css");
|
|
837
|
+
s4.appendChild(document.createTextNode(compiledModule4));
|
|
838
|
+
document.head.appendChild(s4);
|
|
839
|
+
var primaryButton = "RpmxvThK-Buttonmodule--primaryButton";
|
|
840
|
+
var standardButton = "RpmxvThK-Buttonmodule--standardButton";
|
|
841
|
+
var Button_module_default = { primaryButton, standardButton };
|
|
842
|
+
|
|
843
|
+
// packages/overlay/src/components/Button/Button.tsx
|
|
844
|
+
function Button(props) {
|
|
845
|
+
const { primary, ...other } = props;
|
|
846
|
+
const className = primary ? Button_module_default.primaryButton : Button_module_default.standardButton;
|
|
847
|
+
return /* @__PURE__ */ React4.createElement("button", { ...other, className, type: "button" });
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// packages/overlay/src/components/StatusDialog/TaskStatus.tsx
|
|
851
|
+
function getCompletion(task) {
|
|
852
|
+
if (task.status === "pending") {
|
|
853
|
+
return "Running";
|
|
854
|
+
}
|
|
855
|
+
return [
|
|
856
|
+
`Completed in ${task.durationMilliseconds}ms`,
|
|
857
|
+
task.errors?.length && `${task.errors.length} error${task.errors.length > 1 ? "s" : ""}`,
|
|
858
|
+
task.warnings?.length && `${task.warnings.length} warning${task.warnings.length > 1 ? "s" : ""}`
|
|
859
|
+
].filter(Boolean).join(", ");
|
|
860
|
+
}
|
|
861
|
+
function TaskStatus({ task }) {
|
|
862
|
+
const [isOpen, setIsOpen] = React5.useState(void 0);
|
|
863
|
+
const { name: name2, warnings, errors } = task;
|
|
864
|
+
const cloudpack = useCloudpack();
|
|
865
|
+
const showContent = isOpen === true || isOpen === void 0 && task.errors?.length > 0;
|
|
866
|
+
const open = (rootPath) => {
|
|
867
|
+
cloudpack.open({
|
|
868
|
+
rootPath
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
const openPackage = () => {
|
|
872
|
+
cloudpack.openSource({
|
|
873
|
+
rootPath: task.inputPath,
|
|
874
|
+
relativePath: "package.json",
|
|
875
|
+
line: 0,
|
|
876
|
+
column: 0
|
|
877
|
+
});
|
|
878
|
+
};
|
|
879
|
+
const restartTask = () => {
|
|
880
|
+
cloudpack.restartTask({ id: task.id, inputPath: task.inputPath });
|
|
881
|
+
};
|
|
882
|
+
return /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.root }, /* @__PURE__ */ React5.createElement("div", { className: getHeaderClassName(task) }, /* @__PURE__ */ React5.createElement(
|
|
883
|
+
"button",
|
|
884
|
+
{
|
|
885
|
+
className: TaskStatus_module_default.expandButton,
|
|
886
|
+
onClick: () => setIsOpen(!showContent),
|
|
887
|
+
"aria-label": showContent ? `Minimize ${name2}` : `Expand ${name2}`
|
|
888
|
+
},
|
|
889
|
+
/* @__PURE__ */ React5.createElement(
|
|
890
|
+
"img",
|
|
891
|
+
{
|
|
892
|
+
className: cx2(TaskStatus_module_default.expandIcon, !showContent && TaskStatus_module_default.collapsed),
|
|
893
|
+
src: chevrondown_20_inline_default,
|
|
894
|
+
alt: "Chevron down icon"
|
|
895
|
+
}
|
|
896
|
+
)
|
|
897
|
+
), errors?.length === 0 && warnings?.length === 0 && /* @__PURE__ */ React5.createElement("img", { className: TaskStatus_module_default.errorIcon, src: success_24_inline_default, alt: "Success icon" }), errors?.length > 0 && /* @__PURE__ */ React5.createElement("img", { className: TaskStatus_module_default.errorIcon, src: error_24_inline_default, alt: "Error icon" }), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.title }, name2), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.farArea }, getCompletion(task))), showContent && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.commands }, /* @__PURE__ */ React5.createElement(Button, { onClick: restartTask }, "Restart task")), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.content }, /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.title }, "Details"), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.nameValueArea }, /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.name }, "Input path"), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.value }, /* @__PURE__ */ React5.createElement("button", { className: TaskStatus_module_default.linkButton, onClick: () => open(task.inputPath) }, task.inputPath), /* @__PURE__ */ React5.createElement("button", { className: TaskStatus_module_default.linkButton, onClick: openPackage }, "(Package.json)"))), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.nameValueArea }, /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.name }, "Output path"), /* @__PURE__ */ React5.createElement("button", { className: TaskStatus_module_default.linkButton, onClick: () => open(task.outputPath) }, task.outputPath)), errors?.length > 0 && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.title }, "Errors"), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.resultItems }, errors.map((error3, index) => /* @__PURE__ */ React5.createElement(TaskResultItem, { key: index, item: error3, projectPath: task.inputPath, index: index + 1 })))), warnings?.length > 0 && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.title }, "Warnings"), /* @__PURE__ */ React5.createElement("div", { className: TaskStatus_module_default.resultItems }, warnings.map((warning3, index) => /* @__PURE__ */ React5.createElement(TaskResultItem, { key: index, item: warning3, projectPath: task.inputPath, index: index + 1 })))))));
|
|
898
|
+
}
|
|
899
|
+
function getHeaderClassName(task) {
|
|
900
|
+
return cx2(TaskStatus_module_default.header, {
|
|
901
|
+
[TaskStatus_module_default.success]: task.errors?.length === 0 && task.warnings?.length === 0,
|
|
902
|
+
[TaskStatus_module_default.warning]: task.errors?.length === 0 && task.warnings?.length > 0,
|
|
903
|
+
[TaskStatus_module_default.error]: task.errors?.length > 0
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// packages/overlay/src/components/CloudpackProvider/useStatusDetails.ts
|
|
908
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
909
|
+
import { taskListSource } from "@ms-cloudpack/api-server/client";
|
|
910
|
+
var useStatusDetails = () => {
|
|
911
|
+
const service = useCloudpack();
|
|
912
|
+
const [details, setDetails] = useState5({ tasks: [] });
|
|
913
|
+
useEffect3(() => service?.subscribe(taskListSource, setDetails), [service]);
|
|
914
|
+
return details;
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
// packages/overlay/src/components/StatusDialog/TaskList.module.css
|
|
918
|
+
var compiledModule5 = `.ZnVPBoZ-TaskListmodule--root {
|
|
919
|
+
flex-grow: 1;
|
|
920
|
+
overflow: auto;
|
|
921
|
+
border-top: 1px solid #ccc;
|
|
922
|
+
box-sizing: border-box;
|
|
923
|
+
padding: 20px;
|
|
924
|
+
display: flex;
|
|
925
|
+
flex-direction: column;
|
|
926
|
+
gap: 8px;
|
|
927
|
+
}
|
|
928
|
+
`;
|
|
929
|
+
var s5 = document.createElement("style");
|
|
930
|
+
s5.setAttribute("data-sourceFile", "packages/overlay/src/components/StatusDialog/TaskList.module.css");
|
|
931
|
+
s5.appendChild(document.createTextNode(compiledModule5));
|
|
932
|
+
document.head.appendChild(s5);
|
|
933
|
+
var root3 = "ZnVPBoZ-TaskListmodule--root";
|
|
934
|
+
var TaskList_module_default = { root: root3 };
|
|
935
|
+
|
|
936
|
+
// packages/overlay/src/components/StatusDialog/TaskList.tsx
|
|
937
|
+
function TaskList({ searchFilter, issuesOnly }) {
|
|
938
|
+
const details = useStatusDetails();
|
|
939
|
+
const tasks = (details.tasks || []).sort(sortTasks);
|
|
940
|
+
let filteredTasks = tasks;
|
|
941
|
+
if (searchFilter) {
|
|
942
|
+
searchFilter = searchFilter.toLowerCase();
|
|
943
|
+
filteredTasks = filteredTasks.filter(({ name: name2 }) => searchFilter && name2.toLowerCase().includes(searchFilter));
|
|
944
|
+
}
|
|
945
|
+
if (issuesOnly) {
|
|
946
|
+
filteredTasks = filteredTasks.filter(({ errors, warnings }) => errors?.length || warnings?.length);
|
|
947
|
+
}
|
|
948
|
+
return /* @__PURE__ */ React6.createElement("div", { className: TaskList_module_default.root }, filteredTasks.map((task) => /* @__PURE__ */ React6.createElement(TaskStatus, { key: task.name, task })));
|
|
949
|
+
}
|
|
950
|
+
function sortTasks(a, b) {
|
|
951
|
+
const aStatus = a.status === "pending" ? 1 : 0;
|
|
952
|
+
const bStatus = b.status === "pending" ? 1 : 0;
|
|
953
|
+
if (aStatus !== bStatus) {
|
|
954
|
+
return aStatus > bStatus ? -1 : 1;
|
|
955
|
+
}
|
|
956
|
+
const aErrors = a.errors?.length || 0;
|
|
957
|
+
const bErrors = b.errors?.length || 0;
|
|
958
|
+
if (aErrors !== bErrors) {
|
|
959
|
+
return aErrors > bErrors ? -1 : 1;
|
|
960
|
+
}
|
|
961
|
+
return a.name < b.name ? -1 : 1;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
// packages/overlay/src/components/Dialog/Dialog.tsx
|
|
965
|
+
import { default as React7, useRef as useRef2 } from "react";
|
|
966
|
+
|
|
967
|
+
// packages/overlay/src/components/Dialog/Dialog.module.css
|
|
968
|
+
var compiledModule6 = `.XZLLsVjN-Dialogmodule--overlay {
|
|
969
|
+
background: rgba(0, 0, 0, 0.1);
|
|
970
|
+
border: 1px solid black;
|
|
971
|
+
position: fixed;
|
|
972
|
+
top: 0;
|
|
973
|
+
left: 0;
|
|
974
|
+
right: 0;
|
|
975
|
+
bottom: 0;
|
|
976
|
+
display: flex;
|
|
977
|
+
align-items: center;
|
|
978
|
+
justify-content: center;
|
|
979
|
+
z-index: 999;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
@keyframes fade-in {
|
|
983
|
+
0% {
|
|
984
|
+
opacity: 0;
|
|
985
|
+
}
|
|
986
|
+
100% {
|
|
987
|
+
opacity: 1;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
.XZLLsVjN-Dialogmodule--commands {
|
|
992
|
+
display: flex;
|
|
993
|
+
flex-direction: row;
|
|
994
|
+
gap: 8px;
|
|
995
|
+
align-items: center;
|
|
996
|
+
flex-shrink: 0;
|
|
997
|
+
height: 40px;
|
|
998
|
+
padding: 0 20px;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
.XZLLsVjN-Dialogmodule--dialog {
|
|
1002
|
+
animation: fade-in 0.1s ease-in-out;
|
|
1003
|
+
width: 80vw;
|
|
1004
|
+
align-self: stretch;
|
|
1005
|
+
margin: 20px 0;
|
|
1006
|
+
background: white;
|
|
1007
|
+
color: #000;
|
|
1008
|
+
box-sizing: border-box;
|
|
1009
|
+
display: flex;
|
|
1010
|
+
flex-direction: column;
|
|
1011
|
+
border-top: 4px solid rgb(0, 120, 212);
|
|
1012
|
+
border-radius: 3px;
|
|
1013
|
+
box-shadow:
|
|
1014
|
+
rgb(0 0 0 / 22%) 0px 25.6px 57.6px 0px,
|
|
1015
|
+
rgb(0 0 0 / 18%) 0px 4.8px 14.4px 0px;
|
|
1016
|
+
position: relative;
|
|
1017
|
+
outline: transparent solid 3px;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
.XZLLsVjN-Dialogmodule--titleArea {
|
|
1021
|
+
display: flex;
|
|
1022
|
+
flex-direction: row;
|
|
1023
|
+
align-items: center;
|
|
1024
|
+
padding: 8px 8px 8px 20px;
|
|
1025
|
+
gap: 8px;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
.XZLLsVjN-Dialogmodule--closeButton {
|
|
1029
|
+
display: flex;
|
|
1030
|
+
align-items: center;
|
|
1031
|
+
justify-content: center;
|
|
1032
|
+
width: 32px;
|
|
1033
|
+
height: 32px;
|
|
1034
|
+
margin: 0;
|
|
1035
|
+
padding: 0;
|
|
1036
|
+
background: transparent;
|
|
1037
|
+
border: none;
|
|
1038
|
+
border-radius: 4px;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
.XZLLsVjN-Dialogmodule--closeButton:hover {
|
|
1042
|
+
background: rgba(0, 0, 0, 0.1);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
.XZLLsVjN-Dialogmodule--closeButton:active {
|
|
1046
|
+
background: rgba(0, 0, 0, 0.2);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.XZLLsVjN-Dialogmodule--title {
|
|
1050
|
+
flex-grow: 1;
|
|
1051
|
+
font-size: 20px;
|
|
1052
|
+
font-weight: 600;
|
|
1053
|
+
color: rgb(0, 120, 212);
|
|
1054
|
+
}
|
|
1055
|
+
`;
|
|
1056
|
+
var s6 = document.createElement("style");
|
|
1057
|
+
s6.setAttribute("data-sourceFile", "packages/overlay/src/components/Dialog/Dialog.module.css");
|
|
1058
|
+
s6.appendChild(document.createTextNode(compiledModule6));
|
|
1059
|
+
document.head.appendChild(s6);
|
|
1060
|
+
var closeButton = "XZLLsVjN-Dialogmodule--closeButton";
|
|
1061
|
+
var commands2 = "XZLLsVjN-Dialogmodule--commands";
|
|
1062
|
+
var dialog = "XZLLsVjN-Dialogmodule--dialog";
|
|
1063
|
+
var overlay = "XZLLsVjN-Dialogmodule--overlay";
|
|
1064
|
+
var title2 = "XZLLsVjN-Dialogmodule--title";
|
|
1065
|
+
var titleArea2 = "XZLLsVjN-Dialogmodule--titleArea";
|
|
1066
|
+
var Dialog_module_default = { closeButton, commands: commands2, dialog, overlay, title: title2, titleArea: titleArea2 };
|
|
1067
|
+
|
|
1068
|
+
// packages/overlay/src/images/dismiss-16-filled.inline.svg
|
|
1069
|
+
var dismiss_16_filled_inline_default = 'data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<path d="M2.39705 2.55379L2.46967 2.46967C2.73594 2.2034 3.1526 2.1792 3.44621 2.39705L3.53033 2.46967L8 6.939L12.4697 2.46967C12.7626 2.17678 13.2374 2.17678 13.5303 2.46967C13.8232 2.76256 13.8232 3.23744 13.5303 3.53033L9.061 8L13.5303 12.4697C13.7966 12.7359 13.8208 13.1526 13.6029 13.4462L13.5303 13.5303C13.2641 13.7966 12.8474 13.8208 12.5538 13.6029L12.4697 13.5303L8 9.061L3.53033 13.5303C3.23744 13.8232 2.76256 13.8232 2.46967 13.5303C2.17678 13.2374 2.17678 12.7626 2.46967 12.4697L6.939 8L2.46967 3.53033C2.2034 3.26406 2.1792 2.8474 2.39705 2.55379L2.46967 2.46967L2.39705 2.55379Z" fill="%23212121"/>%0A</svg>%0A';
|
|
1070
|
+
|
|
1071
|
+
// packages/overlay/src/components/Dialog/Dialog.tsx
|
|
1072
|
+
function Dialog({ title: title3, id, style, draggable, onClose, commands: commands3, children }) {
|
|
1073
|
+
const draggableRef = useRef2(null);
|
|
1074
|
+
const draggableTargetRef = useRef2(null);
|
|
1075
|
+
const colorAccent = style === "error" ? "rgb(164, 38, 44)" : void 0;
|
|
1076
|
+
const cursorDraggable = draggable ? "move" : void 0;
|
|
1077
|
+
useDraggable({
|
|
1078
|
+
enabled: !!draggable,
|
|
1079
|
+
containerElementRef: draggableRef,
|
|
1080
|
+
dragElementRef: draggableTargetRef
|
|
1081
|
+
});
|
|
1082
|
+
return /* @__PURE__ */ React7.createElement("div", { id, className: Dialog_module_default.overlay }, /* @__PURE__ */ React7.createElement("div", { ref: draggableRef, className: Dialog_module_default.dialog, style: { borderTopColor: colorAccent } }, /* @__PURE__ */ React7.createElement("div", { className: Dialog_module_default.titleArea }, /* @__PURE__ */ React7.createElement(
|
|
1083
|
+
"div",
|
|
1084
|
+
{
|
|
1085
|
+
ref: draggableTargetRef,
|
|
1086
|
+
className: Dialog_module_default.title,
|
|
1087
|
+
style: { color: colorAccent, cursor: cursorDraggable }
|
|
1088
|
+
},
|
|
1089
|
+
title3
|
|
1090
|
+
), onClose && /* @__PURE__ */ React7.createElement("button", { className: Dialog_module_default.closeButton, onClick: onClose, "aria-label": "Minimize overlay" }, /* @__PURE__ */ React7.createElement("img", { src: dismiss_16_filled_inline_default, alt: "" }))), commands3 && /* @__PURE__ */ React7.createElement("div", { className: Dialog_module_default.commands }, ...commands3), children));
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// packages/overlay/src/components/StatusDialog/Searchbox.tsx
|
|
1094
|
+
import React8 from "react";
|
|
1095
|
+
|
|
1096
|
+
// packages/overlay/src/components/StatusDialog/Searchbox.module.css
|
|
1097
|
+
var compiledModule7 = `.aJeqJtva-Searchboxmodule--searchbox {
|
|
1098
|
+
position: absolute;
|
|
1099
|
+
font-size: 14px;
|
|
1100
|
+
font-weight: 400;
|
|
1101
|
+
box-shadow: none;
|
|
1102
|
+
padding: 0px 4px;
|
|
1103
|
+
box-sizing: border-box;
|
|
1104
|
+
color: rgb(50, 49, 48);
|
|
1105
|
+
background-color: rgb(255, 255, 255);
|
|
1106
|
+
display: flex;
|
|
1107
|
+
flex-flow: row nowrap;
|
|
1108
|
+
align-items: stretch;
|
|
1109
|
+
border-radius: 2px;
|
|
1110
|
+
border: 1px solid rgb(96, 94, 92);
|
|
1111
|
+
height: 32px;
|
|
1112
|
+
min-width: 160px;
|
|
1113
|
+
top: 52px;
|
|
1114
|
+
right: 20px;
|
|
1115
|
+
}
|
|
1116
|
+
`;
|
|
1117
|
+
var s7 = document.createElement("style");
|
|
1118
|
+
s7.setAttribute("data-sourceFile", "packages/overlay/src/components/StatusDialog/Searchbox.module.css");
|
|
1119
|
+
s7.appendChild(document.createTextNode(compiledModule7));
|
|
1120
|
+
document.head.appendChild(s7);
|
|
1121
|
+
var searchbox = "aJeqJtva-Searchboxmodule--searchbox";
|
|
1122
|
+
var Searchbox_module_default = { searchbox };
|
|
1123
|
+
|
|
1124
|
+
// packages/overlay/src/components/StatusDialog/Searchbox.tsx
|
|
1125
|
+
function Searchbox({ value: value3, onChange }) {
|
|
1126
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, typeof value3 === "string" && /* @__PURE__ */ React8.createElement("input", { type: "text", placeholder: "Search", className: Searchbox_module_default.searchbox, onChange, value: value3 }));
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// packages/overlay/src/components/StatusDialog/StatusDialog.tsx
|
|
1130
|
+
function StatusDialog({ onClose }) {
|
|
1131
|
+
const cloudpack = useCloudpack();
|
|
1132
|
+
const [searchFilter, setSearchFilter] = React9.useState("");
|
|
1133
|
+
const [issuesOnly, setIssuesOnly] = React9.useState(false);
|
|
1134
|
+
const handleSearchChange = useCallback2((event) => {
|
|
1135
|
+
event.preventDefault();
|
|
1136
|
+
setSearchFilter(event.target.value);
|
|
1137
|
+
}, []);
|
|
1138
|
+
const restartAllTasks = () => {
|
|
1139
|
+
cloudpack.restartAllTasks();
|
|
1140
|
+
};
|
|
1141
|
+
const toggleIssuesOnly = () => setIssuesOnly((value3) => !value3);
|
|
1142
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1143
|
+
Dialog,
|
|
1144
|
+
{
|
|
1145
|
+
title: "Task results",
|
|
1146
|
+
id: elementIds.statusDialogRoot,
|
|
1147
|
+
draggable: true,
|
|
1148
|
+
onClose,
|
|
1149
|
+
commands: [
|
|
1150
|
+
/* @__PURE__ */ React9.createElement(Button, { primary: true, onClick: restartAllTasks, key: "restart" }, "Restart all tasks"),
|
|
1151
|
+
/* @__PURE__ */ React9.createElement(Button, { onClick: toggleIssuesOnly, key: "issues" }, issuesOnly ? "Show all tasks" : "Show tasks with issues")
|
|
1152
|
+
]
|
|
1153
|
+
},
|
|
1154
|
+
/* @__PURE__ */ React9.createElement(Searchbox, { value: searchFilter, onChange: handleSearchChange }),
|
|
1155
|
+
/* @__PURE__ */ React9.createElement(TaskList, { searchFilter, issuesOnly })
|
|
1156
|
+
);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// packages/overlay/src/components/ErrorDialog/ErrorDialog.tsx
|
|
1160
|
+
import { default as React11 } from "react";
|
|
1161
|
+
|
|
1162
|
+
// packages/overlay/src/components/ErrorDialog/PathError.tsx
|
|
1163
|
+
import React10 from "react";
|
|
1164
|
+
import { default as cx3 } from "classnames";
|
|
1165
|
+
function PathError(props) {
|
|
1166
|
+
const [showContent, setshowContent] = React10.useState(false);
|
|
1167
|
+
const { packageName, importPath, issuerUrl, fixable } = props;
|
|
1168
|
+
const cloudpack = useCloudpack();
|
|
1169
|
+
const editConfig = () => {
|
|
1170
|
+
cloudpack.editConfig();
|
|
1171
|
+
};
|
|
1172
|
+
const addOverride = () => {
|
|
1173
|
+
cloudpack.addOverride({ packageName, importPath, issuerUrl });
|
|
1174
|
+
};
|
|
1175
|
+
return /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.root }, /* @__PURE__ */ React10.createElement("div", { className: cx3(TaskStatus_module_default.header, TaskStatus_module_default.error) }, /* @__PURE__ */ React10.createElement(
|
|
1176
|
+
"button",
|
|
1177
|
+
{
|
|
1178
|
+
className: TaskStatus_module_default.expandButton,
|
|
1179
|
+
onClick: () => setshowContent(!showContent),
|
|
1180
|
+
"aria-label": showContent ? `Minimize ${packageName}/${importPath}` : `Expand ${packageName}/${importPath}`
|
|
1181
|
+
},
|
|
1182
|
+
/* @__PURE__ */ React10.createElement(
|
|
1183
|
+
"img",
|
|
1184
|
+
{
|
|
1185
|
+
className: cx3(TaskStatus_module_default.expandIcon, !showContent && TaskStatus_module_default.collapsed),
|
|
1186
|
+
src: chevrondown_20_inline_default,
|
|
1187
|
+
alt: "Chevron down icon"
|
|
1188
|
+
}
|
|
1189
|
+
)
|
|
1190
|
+
), /* @__PURE__ */ React10.createElement("img", { className: TaskStatus_module_default.errorIcon, src: error_24_inline_default, alt: "Error icon" }), /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.title }, `${packageName}/${importPath}`)), showContent && /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.commands }, fixable && /* @__PURE__ */ React10.createElement(Button, { onClick: addOverride }, "Add override"), /* @__PURE__ */ React10.createElement(Button, { onClick: editConfig }, "Edit config file")), /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.content }, /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.title }, "Details"), /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.nameValueArea }, /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.name }, "Problem"), /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.value }, importPath === "." ? `An unrecognized package "${packageName}" was imported.` : `Path "${importPath}" was imported from package "${packageName}" but was not recognized as an exported path.`)), /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.nameValueArea }, /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.name }, "Solution"), /* @__PURE__ */ React10.createElement("div", { className: TaskStatus_module_default.value }, fixable ? `Remove the path from the import in your source. (Import from "${packageName}" rather than "${packageName}/${importPath}")` : importPath === "." ? `Make sure the package name is valid.` : `Import not found on package. Make sure the import path is valid.`)))));
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// packages/overlay/src/components/ErrorDialog/ErrorDialog.tsx
|
|
1194
|
+
function ErrorDialog({ unsupported }) {
|
|
1195
|
+
const cloudpack = useCloudpack();
|
|
1196
|
+
const reload = () => {
|
|
1197
|
+
cloudpack.restartAllTasks();
|
|
1198
|
+
};
|
|
1199
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1200
|
+
Dialog,
|
|
1201
|
+
{
|
|
1202
|
+
title: "Found unsupported paths in your project",
|
|
1203
|
+
id: elementIds.errorDialogRoot,
|
|
1204
|
+
style: "error",
|
|
1205
|
+
commands: [
|
|
1206
|
+
/* @__PURE__ */ React11.createElement(Button, { primary: true, onClick: reload, key: "1" }, "Restart all tasks")
|
|
1207
|
+
]
|
|
1208
|
+
},
|
|
1209
|
+
/* @__PURE__ */ React11.createElement("div", { className: TaskList_module_default.root }, unsupported.map((data, index) => /* @__PURE__ */ React11.createElement(PathError, { ...data, key: index })))
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
// packages/overlay/src/components/ErrorDialog/useErrorEvents.ts
|
|
1214
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1215
|
+
import { parseImportString } from "@ms-cloudpack/path-string-parsing";
|
|
1216
|
+
var reasonIsRecord = (event) => {
|
|
1217
|
+
return typeof event.reason === "object" && !Array.isArray(event.reason) && event.reason !== null;
|
|
1218
|
+
};
|
|
1219
|
+
var hasMessage = (event) => {
|
|
1220
|
+
return reasonIsRecord(event) && typeof event.reason.message === "string";
|
|
1221
|
+
};
|
|
1222
|
+
var useErrorEvents = () => {
|
|
1223
|
+
const [errorEvents, setErrorEvents] = useState6({ unsupported: [] });
|
|
1224
|
+
const cloudpack = useCloudpack();
|
|
1225
|
+
useEffect4(() => {
|
|
1226
|
+
const handleUnsupportedError = (message, issuerUrl) => {
|
|
1227
|
+
const errorRegex = /[Mm]odule specifier,? ['"](.*?)['"]/;
|
|
1228
|
+
const match = message.match(errorRegex);
|
|
1229
|
+
if (match) {
|
|
1230
|
+
const importString = parseImportString(match[1]);
|
|
1231
|
+
const { packageName } = importString;
|
|
1232
|
+
const importPath = importString.importPath.replace(/^\.\//, "");
|
|
1233
|
+
(async () => {
|
|
1234
|
+
const { fixable } = await cloudpack.validateOverride({ packageName, importPath, issuerUrl });
|
|
1235
|
+
setErrorEvents((prev) => ({
|
|
1236
|
+
...prev,
|
|
1237
|
+
unsupported: [...prev.unsupported, { packageName, importPath, issuerUrl, fixable }]
|
|
1238
|
+
}));
|
|
1239
|
+
})().catch(() => {
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
const pageErrors = window.__pageErrors;
|
|
1244
|
+
pageErrors.unregister();
|
|
1245
|
+
window.addEventListener("error", (event) => {
|
|
1246
|
+
handleUnsupportedError(event.message, event.filename);
|
|
1247
|
+
});
|
|
1248
|
+
for (const error3 of pageErrors.uncaughtErrors) {
|
|
1249
|
+
handleUnsupportedError(error3.message, error3.filename);
|
|
1250
|
+
}
|
|
1251
|
+
window.addEventListener("unhandledrejection", (event) => {
|
|
1252
|
+
hasMessage(event) && handleUnsupportedError(event.reason.message);
|
|
1253
|
+
});
|
|
1254
|
+
for (const error3 of pageErrors.uncaughtRejections) {
|
|
1255
|
+
hasMessage(error3) && handleUnsupportedError(error3.reason.message);
|
|
1256
|
+
}
|
|
1257
|
+
}, [cloudpack]);
|
|
1258
|
+
return errorEvents;
|
|
1259
|
+
};
|
|
1260
|
+
|
|
1261
|
+
// packages/overlay/src/hooks/usePageLoadTimeReporter.ts
|
|
1262
|
+
import React12 from "react";
|
|
1263
|
+
function usePageLoadTimeReporter() {
|
|
1264
|
+
const [pageLoadTime, setPageLoadTime] = React12.useState();
|
|
1265
|
+
const cloudpack = useCloudpack();
|
|
1266
|
+
React12.useEffect(() => {
|
|
1267
|
+
async function reportPageLoadTime() {
|
|
1268
|
+
const { getPageLoadTime, getBrowserCacheRatio } = window.__cloudpack;
|
|
1269
|
+
const newPageLoadTime = await getPageLoadTime();
|
|
1270
|
+
setPageLoadTime(newPageLoadTime);
|
|
1271
|
+
cloudpack.reportMetric({ metric: "PAGE_LOAD_TIME", value: newPageLoadTime });
|
|
1272
|
+
cloudpack.reportMetric({ metric: "BROWSER_CACHE_RATIO", value: getBrowserCacheRatio() });
|
|
1273
|
+
}
|
|
1274
|
+
void reportPageLoadTime();
|
|
1275
|
+
}, [cloudpack]);
|
|
1276
|
+
return pageLoadTime;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// packages/overlay/src/components/StatusOverlay/StatusOverlay.tsx
|
|
1280
|
+
function StatusOverlay() {
|
|
1281
|
+
const pageLoadTime = usePageLoadTimeReporter();
|
|
1282
|
+
const [isExpanded, setIsExpanded] = useState7(false);
|
|
1283
|
+
const status = useStatus();
|
|
1284
|
+
const prevStatus = useRef3();
|
|
1285
|
+
const { unsupported } = useErrorEvents();
|
|
1286
|
+
React13.useEffect(() => {
|
|
1287
|
+
if (!isExpanded && prevStatus.current?.status !== "idle" && status.status === "idle" && (prevStatus.current?.totalErrors || 0) !== (status.totalErrors || 0)) {
|
|
1288
|
+
setIsExpanded(true);
|
|
1289
|
+
}
|
|
1290
|
+
prevStatus.current = status;
|
|
1291
|
+
}, [status, isExpanded]);
|
|
1292
|
+
const toggleMinimized = useCallback3(() => {
|
|
1293
|
+
console.log(`Toggling minimized state to ${!isExpanded}`);
|
|
1294
|
+
setIsExpanded(!isExpanded);
|
|
1295
|
+
}, [isExpanded]);
|
|
1296
|
+
return unsupported.length ? /* @__PURE__ */ React13.createElement(ErrorDialog, { unsupported }) : isExpanded ? /* @__PURE__ */ React13.createElement(StatusDialog, { onClose: toggleMinimized }) : /* @__PURE__ */ React13.createElement(StatusBadge, { onExpand: toggleMinimized, pageLoadTime });
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
// packages/overlay/src/components/ThemeProvider/ThemeProvider.tsx
|
|
1300
|
+
import React14 from "react";
|
|
1301
|
+
|
|
1302
|
+
// packages/overlay/src/components/ThemeProvider/ThemeProvider.module.css
|
|
1303
|
+
var compiledModule8 = `.ASWLkl-ThemeProvidermodule--root {
|
|
1304
|
+
font-family:
|
|
1305
|
+
Inter,
|
|
1306
|
+
-apple-system,
|
|
1307
|
+
BlinkMacSystemFont,
|
|
1308
|
+
'Segoe UI',
|
|
1309
|
+
Roboto,
|
|
1310
|
+
Oxygen,
|
|
1311
|
+
Ubuntu,
|
|
1312
|
+
Cantarell,
|
|
1313
|
+
'Fira Sans',
|
|
1314
|
+
'Droid Sans',
|
|
1315
|
+
'Helvetica Neue',
|
|
1316
|
+
sans-serif;
|
|
1317
|
+
}
|
|
1318
|
+
`;
|
|
1319
|
+
var s8 = document.createElement("style");
|
|
1320
|
+
s8.setAttribute("data-sourceFile", "packages/overlay/src/components/ThemeProvider/ThemeProvider.module.css");
|
|
1321
|
+
s8.appendChild(document.createTextNode(compiledModule8));
|
|
1322
|
+
document.head.appendChild(s8);
|
|
1323
|
+
var root4 = "ASWLkl-ThemeProvidermodule--root";
|
|
1324
|
+
var ThemeProvider_module_default = { root: root4 };
|
|
1325
|
+
|
|
1326
|
+
// packages/overlay/src/components/ThemeProvider/ThemeProvider.tsx
|
|
1327
|
+
function ThemeProvider({ children }) {
|
|
1328
|
+
return /* @__PURE__ */ React14.createElement("div", { className: ThemeProvider_module_default.root }, children);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// packages/overlay/src/index.tsx
|
|
1332
|
+
var rootDiv = document.createElement("div");
|
|
1333
|
+
rootDiv.id = elementIds.root;
|
|
1334
|
+
ReactDOM.render(
|
|
1335
|
+
/* @__PURE__ */ React15.createElement(ThemeProvider, null, /* @__PURE__ */ React15.createElement(CloudpackProvider, null, /* @__PURE__ */ React15.createElement(StatusOverlay, null))),
|
|
1336
|
+
rootDiv
|
|
1337
|
+
);
|
|
1338
|
+
document.body.appendChild(rootDiv);
|
|
1339
|
+
//# sourceMappingURL=index.js.map
|