querysub 0.515.0 → 0.516.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
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SocketFunction } from "socket-function/SocketFunction";
|
|
2
2
|
import { qreact } from "../../4-dom/qreact";
|
|
3
|
-
import { DEFAULT_OVERLAP_TIME, MachineServiceController, ServiceConfig } from "../machineSchema";
|
|
3
|
+
import { DEFAULT_OVERLAP_TIME, MachineServiceController, ServiceConfig, getLiveServiceParameters } from "../machineSchema";
|
|
4
4
|
import { css } from "typesafecss";
|
|
5
5
|
import { t } from "../../2-proxy/schema2";
|
|
6
6
|
import { Querysub } from "../../4-querysub/Querysub";
|
|
7
7
|
import { currentViewParam, selectedServiceIdParam } from "../urlParams";
|
|
8
|
-
import { formatNiceDateTime, formatTime, formatVeryNiceDateTime } from "socket-function/src/formatting/format";
|
|
9
|
-
import { sort, timeInMinute } from "socket-function/src/misc";
|
|
8
|
+
import { formatDateTimeDetailed, formatNiceDateTime, formatTime, formatVeryNiceDateTime } from "socket-function/src/formatting/format";
|
|
9
|
+
import { sort, timeInMinute, timeInSecond } from "socket-function/src/misc";
|
|
10
10
|
import { cache } from "socket-function/src/caching";
|
|
11
11
|
import { Anchor } from "../../library-components/ATag";
|
|
12
12
|
import { isPublic } from "../../config";
|
|
13
|
-
import { UpdateButtons, UpdateServiceButtons } from "./deployButtons";
|
|
13
|
+
import { PendingDeployInfo, UpdateButtons, UpdateServiceButtons } from "./deployButtons";
|
|
14
14
|
import { isDefined } from "../../misc";
|
|
15
15
|
import { formatDateJSX } from "../../misc/formatJSX";
|
|
16
16
|
import { Tools } from "./Tools";
|
|
@@ -26,6 +26,8 @@ export class ServicesListPage extends qreact.Component {
|
|
|
26
26
|
|
|
27
27
|
if (!serviceList) return <div>Loading services...</div>;
|
|
28
28
|
|
|
29
|
+
let now = Querysub.nowDelayed(timeInSecond);
|
|
30
|
+
|
|
29
31
|
let services = serviceList.map(serviceId => [serviceId, controller.getServiceConfig(serviceId)] as const);
|
|
30
32
|
sort(services, x => -(x[1]?.info.lastUpdatedTime || Date.now()) - (x[1]?.parameters.deploy && (Number.MAX_SAFE_INTEGER / 2) || 0));
|
|
31
33
|
|
|
@@ -140,10 +142,32 @@ export class ServicesListPage extends qreact.Component {
|
|
|
140
142
|
<div className={css.vbox(4)}>
|
|
141
143
|
<div>Updated {formatDateJSX(config.info.lastUpdatedTime)} AGO</div>
|
|
142
144
|
{config.parameters.overlapTime && <div className={css.colorhsl(210, 50, 50).fontSize(14).fontWeight("bold")}>Deploy overlap: {formatTime(config.parameters.overlapTime)}</div> || undefined}
|
|
145
|
+
{(() => {
|
|
146
|
+
let releaseTime = config.parameters.releaseTime || 0;
|
|
147
|
+
if (!releaseTime || releaseTime <= now || !config.oldParameters) return undefined;
|
|
148
|
+
let live = getLiveServiceParameters(config) as Record<string, unknown>;
|
|
149
|
+
let next = config.parameters as Record<string, unknown>;
|
|
150
|
+
let diffLines: string[] = [];
|
|
151
|
+
for (let key of new Set([...Object.keys(live), ...Object.keys(next)])) {
|
|
152
|
+
if (key === "releaseTime") continue;
|
|
153
|
+
let oldValue = JSON.stringify(live[key]);
|
|
154
|
+
let newValue = JSON.stringify(next[key]);
|
|
155
|
+
if (oldValue !== newValue) {
|
|
156
|
+
diffLines.push(`${key}: ${oldValue} -> ${newValue}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return <div
|
|
160
|
+
className={css.colorhsl(35, 80, 45).fontSize(14).fontWeight("bold")}
|
|
161
|
+
title={`Deploys at ${formatDateTimeDetailed(releaseTime)}\n\n${diffLines.join("\n")}`}
|
|
162
|
+
>
|
|
163
|
+
🕐 Deploys in {formatTime(releaseTime - now)}
|
|
164
|
+
</div>;
|
|
165
|
+
})()}
|
|
143
166
|
</div>
|
|
144
167
|
</div>
|
|
145
168
|
</Anchor>
|
|
146
169
|
<UpdateServiceButtons service={config} />
|
|
170
|
+
<PendingDeployInfo service={config} />
|
|
147
171
|
</div>
|
|
148
172
|
;
|
|
149
173
|
})}
|
|
@@ -5,7 +5,8 @@ import { Querysub } from "../../4-querysub/Querysub";
|
|
|
5
5
|
import { DEFAULT_OVERLAP_TIME, MachineServiceController, MachineInfo, ServiceConfig } from "../machineSchema";
|
|
6
6
|
import { showFullscreenModal } from "../../5-diagnostics/FullscreenModal";
|
|
7
7
|
import { css } from "../../4-dom/css";
|
|
8
|
-
import { formatTime } from "socket-function/src/formatting/format";
|
|
8
|
+
import { formatDateTimeDetailed, formatTime } from "socket-function/src/formatting/format";
|
|
9
|
+
import { timeInSecond } from "socket-function/src/misc";
|
|
9
10
|
import { formatDateJSX } from "../../misc/formatJSX";
|
|
10
11
|
import { MachineController } from "../machineController";
|
|
11
12
|
import { deepCloneJSON } from "socket-function/src/misc";
|
|
@@ -192,6 +193,36 @@ export class UpdateServiceButtons extends qreact.Component<{
|
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
|
|
196
|
+
/** Shows a service's scheduled (not yet live) deploy, in the same style as the update buttons (but blue, and not clickable): when it goes live, and the new vs currently live commit. */
|
|
197
|
+
export class PendingDeployInfo extends qreact.Component<{
|
|
198
|
+
service: ServiceConfig;
|
|
199
|
+
}> {
|
|
200
|
+
render() {
|
|
201
|
+
let service = this.props.service;
|
|
202
|
+
let releaseTime = service.parameters.releaseTime || 0;
|
|
203
|
+
let now = Querysub.nowDelayed(timeInSecond);
|
|
204
|
+
const oldParameters = service.oldParameters;
|
|
205
|
+
if (!releaseTime || releaseTime <= now || !oldParameters) return undefined;
|
|
206
|
+
|
|
207
|
+
return <div
|
|
208
|
+
className={css.pad2(12, 8).bord2(210, 60, 40).fontWeight("bold").vbox(2).alignItems("center").alignSelf("stretch").hsl(210, 70, 90)}
|
|
209
|
+
title={formatDateTimeDetailed(releaseTime)}
|
|
210
|
+
>
|
|
211
|
+
<div>
|
|
212
|
+
{bigEmoji("🕐", -4)} <span>Deploys in {formatTime(releaseTime - now)}</span>
|
|
213
|
+
</div>
|
|
214
|
+
<div className={css.hbox(5)}>
|
|
215
|
+
<b>New</b>
|
|
216
|
+
<RenderGitRefInfo gitRef={service.parameters.gitRef} />
|
|
217
|
+
</div>
|
|
218
|
+
<div className={css.hbox(5)}>
|
|
219
|
+
<b>Current</b>
|
|
220
|
+
<RenderGitRefInfo gitRef={oldParameters.gitRef} />
|
|
221
|
+
</div>
|
|
222
|
+
</div>;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
195
226
|
export class DeployMachineButtons extends qreact.Component<{
|
|
196
227
|
machines: MachineInfo[];
|
|
197
228
|
}> {
|