querysub 0.254.0 → 0.256.0
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/package.json
CHANGED
|
@@ -35,8 +35,16 @@ export class MachinesListPage extends qreact.Component {
|
|
|
35
35
|
return <div className={css.vbox(16)}>
|
|
36
36
|
<div className={css.hbox(12)}>
|
|
37
37
|
<h2 className={css.flexGrow(1)}>Machines</h2>
|
|
38
|
-
<div
|
|
39
|
-
|
|
38
|
+
<div
|
|
39
|
+
className={css.pad2(12, 8).bord2(200, 30, 70).hsl(200, 20, 95).colorhsl(200, 30, 30).button}
|
|
40
|
+
onClick={() => {
|
|
41
|
+
void navigator.clipboard.writeText("yarn setup-machine 153.34.64.2");
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
💡 Setup new machines with <code
|
|
45
|
+
className={css.pad2(4, 2).bord2(200, 20, 80).hsl(200, 15, 85)}
|
|
46
|
+
title="Click to copy command"
|
|
47
|
+
>yarn setup-machine 153.34.64.2</code>
|
|
40
48
|
</div>
|
|
41
49
|
|
|
42
50
|
{!this.state.isDeleteMode && likelyDeadMachines.length > 0 && (
|
|
@@ -8,6 +8,7 @@ import { formatTime } from "socket-function/src/formatting/format";
|
|
|
8
8
|
import { formatTimeJSX } from "../../misc/formatJSX";
|
|
9
9
|
import { MachineController } from "../machineController";
|
|
10
10
|
import { closeAllModals } from "../../5-diagnostics/Modal";
|
|
11
|
+
import { unique } from "../../misc";
|
|
11
12
|
|
|
12
13
|
module.hotreload = true;
|
|
13
14
|
|
|
@@ -26,7 +27,9 @@ export class RenderGitRefInfo extends qreact.Component<{
|
|
|
26
27
|
useQuerysub: this.props.isQuerysub,
|
|
27
28
|
});
|
|
28
29
|
if (!gitRefInfo) return undefined;
|
|
29
|
-
return <div className={css.fontWeight("normal")}>
|
|
30
|
+
return <div className={css.fontWeight("normal")}>
|
|
31
|
+
{formatTimeJSX(gitRefInfo.time)} AGO <span className={css.hsl(0, 0, 80).pad2(5, 2).italic}>{gitRefInfo.description}</span>
|
|
32
|
+
</div>;
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -43,7 +46,7 @@ export class UpdateButtons extends qreact.Component<{
|
|
|
43
46
|
let { gitRef, repoUrl } = service.parameters;
|
|
44
47
|
return repoUrl === gitInfo?.repoUrl && gitRef !== gitInfo?.latestRef;
|
|
45
48
|
});
|
|
46
|
-
let outdatedRefs = outdatedServices.map(service => service.parameters.gitRef);
|
|
49
|
+
let outdatedRefs = unique(outdatedServices.map(service => service.parameters.gitRef));
|
|
47
50
|
|
|
48
51
|
return <>
|
|
49
52
|
{!!gitInfo?.querysubUncommitted.length && <button
|
|
@@ -79,7 +82,10 @@ export class UpdateButtons extends qreact.Component<{
|
|
|
79
82
|
{bigEmoji("📚", -5)}
|
|
80
83
|
Publish & Commit & Push Querysub & Update Package.json ({gitInfo?.querysubUncommitted.length} Files Changed)
|
|
81
84
|
</div>
|
|
82
|
-
<
|
|
85
|
+
<div className={css.hbox(5)}>
|
|
86
|
+
<b>Current</b>
|
|
87
|
+
<RenderGitRefInfo gitRef={gitInfo.querysubRef} isQuerysub />
|
|
88
|
+
</div>
|
|
83
89
|
</button>}
|
|
84
90
|
{!!gitInfo?.uncommitted.length && <button
|
|
85
91
|
className={buttonStyle.hsl(210, 40, 50)}
|
|
@@ -192,12 +198,19 @@ export class DeployMachineButtons extends qreact.Component<{
|
|
|
192
198
|
className={buttonStyle.alignSelf("stretch").hsl(120, 70, 50)}
|
|
193
199
|
onClick={async () => {
|
|
194
200
|
let machineController = MachineController(SocketFunction.browserNodeId());
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
try {
|
|
202
|
+
await Promise.allSettled(outdatedMachines.map(machine => {
|
|
203
|
+
return machineController.deployMachineFromBrowser.promise({
|
|
204
|
+
machineNodeId: machine.applyNodeId,
|
|
205
|
+
gitRef: gitInfo.latestRef,
|
|
206
|
+
});
|
|
207
|
+
}));
|
|
208
|
+
} catch (error) {
|
|
209
|
+
// They should always end with a disconnect (which means the machine updated, so obviously it disconnected from us)
|
|
210
|
+
if (!String(error).includes("disconnected")) {
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
201
214
|
}}
|
|
202
215
|
>
|
|
203
216
|
<div>
|
package/src/misc/formatJSX.tsx
CHANGED
|
@@ -2,5 +2,5 @@ import { qreact } from "../4-dom/qreact";
|
|
|
2
2
|
import { formatTime, formatVeryNiceDateTime } from "socket-function/src/formatting/format";
|
|
3
3
|
|
|
4
4
|
export function formatTimeJSX(time: number) {
|
|
5
|
-
return <span title={formatVeryNiceDateTime(time)}>
|
|
5
|
+
return <span title={formatVeryNiceDateTime(time)}>{formatTime(Date.now() - time)}</span>;
|
|
6
6
|
}
|
package/src/misc.ts
CHANGED
|
@@ -49,4 +49,8 @@ export function joinVNodes(vNodes: preact.ComponentChild[], delimitter: preact.C
|
|
|
49
49
|
|
|
50
50
|
export function clamp(value: number, min: number, max: number) {
|
|
51
51
|
return Math.max(min, Math.min(max, value));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function unique<T>(array: T[]): T[] {
|
|
55
|
+
return Array.from(new Set(array));
|
|
52
56
|
}
|