create-expo-updates-server 0.2.1 → 0.4.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/dist/template/README.md +1 -1
- package/dist/template/app/updates/[encodedKey]/page.tsx +55 -33
- package/dist/template/app/updates/devices/page.tsx +13 -7
- package/dist/template/app/updates/embedded/page.tsx +25 -13
- package/dist/template/app/updates/emergency-redirects/page.tsx +70 -38
- package/dist/template/app/updates/page.tsx +33 -20
- package/dist/template/components/admin/admin-shell.tsx +11 -5
- package/dist/template/components/admin/language-switcher.tsx +5 -2
- package/dist/template/components/ui/dialog.tsx +13 -4
- package/dist/template/components/ui/sheet.tsx +6 -2
- package/dist/template/components/ui/sidebar.tsx +62 -17
- package/dist/template/docs/admin-ui.md +18 -24
- package/dist/template/docs/device-targeting.md +4 -5
- package/dist/template/docs/expo-app-setup.md +8 -12
- package/dist/template/docs/getting-started.md +5 -5
- package/dist/template/docs/getting-started.ru.md +11 -544
- package/dist/template/docs/index.md +1 -1
- package/dist/template/docs/installation-telemetry.md +4 -4
- package/dist/template/docs/operations-guide.md +1 -1
- package/dist/template/docs/ota-client-lifecycle.md +46 -42
- package/dist/template/docs/ota-emergency-recovery.md +34 -57
- package/dist/template/docs/ru/admin-ui.md +29 -0
- package/dist/template/docs/ru/device-targeting.md +59 -0
- package/dist/template/docs/ru/doctor.md +98 -0
- package/dist/template/docs/ru/expo-app-setup.md +497 -0
- package/dist/template/docs/ru/getting-started.md +391 -0
- package/dist/template/docs/ru/index.md +50 -0
- package/dist/template/docs/ru/installation-telemetry.md +125 -0
- package/dist/template/docs/ru/npm-installer.md +71 -0
- package/dist/template/docs/ru/operations-guide.md +317 -0
- package/dist/template/docs/ru/ota-client-lifecycle.md +167 -0
- package/dist/template/docs/ru/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/ru/ota-update-policy.md +67 -0
- package/dist/template/docs/ru/publishing-npm-installer.md +49 -0
- package/dist/template/docs/ru/supabase-setup.md +120 -0
- package/dist/template/docs/uk/admin-ui.md +29 -0
- package/dist/template/docs/uk/device-targeting.md +59 -0
- package/dist/template/docs/uk/doctor.md +98 -0
- package/dist/template/docs/uk/expo-app-setup.md +497 -0
- package/dist/template/docs/uk/getting-started.md +391 -0
- package/dist/template/docs/uk/index.md +50 -0
- package/dist/template/docs/uk/installation-telemetry.md +125 -0
- package/dist/template/docs/uk/npm-installer.md +71 -0
- package/dist/template/docs/uk/operations-guide.md +317 -0
- package/dist/template/docs/uk/ota-client-lifecycle.md +167 -0
- package/dist/template/docs/uk/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/uk/ota-update-policy.md +67 -0
- package/dist/template/docs/uk/publishing-npm-installer.md +49 -0
- package/dist/template/docs/uk/supabase-setup.md +120 -0
- package/dist/template/package-lock.json +589 -0
- package/dist/template/package.json +2 -0
- package/dist/template/scripts/lib/device-identity.test.ts +2 -2
- package/dist/template/scripts/lib/doctor.mjs +3 -3
- package/dist/template/scripts/lib/doctor.test.mjs +1 -1
- package/dist/template/scripts/lib/ota-client-configurator.mjs +116 -34
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +210 -61
- package/dist/template/scripts/lib/ota-client.test.ts +1 -1
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +435 -118
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +243 -86
- package/dist/template/scripts/lib/ota-update-controller.test.ts +10 -9
- package/dist/template/scripts/lib/ota-updates-ui.test.tsx +154 -0
- package/dist/template/scripts/tests/fixtures/react-native-ui.tsx +34 -0
- package/dist/template/scripts/tests/ota-client-types.mjs +69 -0
- package/dist/template/src/client/devices/analytics.tsx +21 -8
- package/dist/template/src/client/devices/device-name.tsx +3 -1
- package/dist/template/src/client/devices/registry.tsx +38 -19
- package/dist/template/src/client/devices/version-adoption-chart.tsx +22 -10
- package/dist/template/src/client/distribution-control.tsx +27 -14
- package/dist/template/src/client/guard-action-combobox.test.ts +1 -1
- package/dist/template/src/client/guard-action-combobox.tsx +16 -10
- package/dist/template/src/client/i18n/en.json +203 -1
- package/dist/template/src/client/i18n/language-switching.test.tsx +224 -0
- package/dist/template/src/client/i18n/messages.test.ts +102 -19
- package/dist/template/src/client/i18n/messages.ts +31 -16
- package/dist/template/src/client/i18n/provider.tsx +6 -3
- package/dist/template/src/client/i18n/ru.json +488 -0
- package/dist/template/src/client/i18n/uk.json +488 -0
- package/dist/template/src/client/i18n/use-formatters.ts +5 -0
- package/dist/template/src/client/update-audience-editor.tsx +18 -11
- package/dist/template/src/client/update-policy-editor.tsx +64 -39
- package/dist/template/templates/expo-app/ota-client/README.md +16 -2
- package/dist/template/templates/expo-app/ota-client/controller.ts +107 -0
- package/dist/template/templates/expo-app/ota-client/device-identity.ts +48 -0
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +18 -9
- package/dist/template/templates/expo-app/ota-client/index.ts +16 -0
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +97 -0
- package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +293 -0
- package/dist/template/templates/expo-app/ota-client/runtime.ts +153 -0
- package/dist/template/templates/expo-app/ota-client/types.ts +85 -0
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +25 -0
- package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +196 -0
- package/dist/template/tsconfig.json +3 -1
- package/dist/template/vitest.config.mts +3 -0
- package/dist/template-manifest.json +302 -127
- package/package.json +1 -1
- package/dist/template/templates/expo-app/ota-client/controller.js +0 -60
- package/dist/template/templates/expo-app/ota-client/device-identity.js +0 -26
- package/dist/template/templates/expo-app/ota-client/index.d.ts +0 -47
- package/dist/template/templates/expo-app/ota-client/index.js +0 -3
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.js +0 -48
- package/dist/template/templates/expo-app/ota-client/model/update-controller.js +0 -182
- package/dist/template/templates/expo-app/ota-client/runtime.js +0 -112
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.js +0 -56
package/dist/template/README.md
CHANGED
|
@@ -24,7 +24,7 @@ or generate credentials/signing keys. It contains the template from its publishe
|
|
|
24
24
|
version, not unpublished changes on GitHub or in a local checkout.
|
|
25
25
|
|
|
26
26
|
Continue with the **[Quick Start](docs/getting-started.md)**
|
|
27
|
-
([Русский](docs/getting-started.
|
|
27
|
+
([Русский](docs/ru/getting-started.md) · [Українська](docs/uk/getting-started.md)). It covers one complete path:
|
|
28
28
|
|
|
29
29
|
1. Prepare Docker, server settings and a signing key pair.
|
|
30
30
|
2. Start the server and create an administrator.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import type { TranslationMessage } from "@/src/client/i18n/messages";
|
|
2
3
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
4
|
+
import { useFormatters } from "@/src/client/i18n/use-formatters";
|
|
3
5
|
|
|
4
6
|
import { Textarea } from "@/components/ui/textarea";
|
|
5
7
|
|
|
@@ -39,6 +41,7 @@ function prettyJson(value: unknown): string {
|
|
|
39
41
|
|
|
40
42
|
export default function UpdateDetailsPage() {
|
|
41
43
|
const { t } = useI18n();
|
|
44
|
+
const { fullDate } = useFormatters();
|
|
42
45
|
const params = useParams<{ encodedKey: string }>();
|
|
43
46
|
const router = useRouter();
|
|
44
47
|
const encodedKey = params.encodedKey;
|
|
@@ -47,7 +50,7 @@ export default function UpdateDetailsPage() {
|
|
|
47
50
|
const [loading, setLoading] = useState(true);
|
|
48
51
|
const [saving, setSaving] = useState(false);
|
|
49
52
|
const [error, setError] = useState("");
|
|
50
|
-
const [success, setSuccess] = useState("");
|
|
53
|
+
const [success, setSuccess] = useState<TranslationMessage>("");
|
|
51
54
|
const [selectedFile, setSelectedFile] =
|
|
52
55
|
useState<EditableFile>("update-info.json");
|
|
53
56
|
const [editorValue, setEditorValue] = useState("{}");
|
|
@@ -82,7 +85,9 @@ export default function UpdateDetailsPage() {
|
|
|
82
85
|
|
|
83
86
|
const currentServedUpdateId = activeUpdateId || latestUpdateId;
|
|
84
87
|
const isNewestInScope = Boolean(
|
|
85
|
-
detail?.updateId &&
|
|
88
|
+
detail?.updateId &&
|
|
89
|
+
newestUpdateId &&
|
|
90
|
+
detail.updateId === newestUpdateId,
|
|
86
91
|
);
|
|
87
92
|
|
|
88
93
|
return {
|
|
@@ -108,7 +113,8 @@ export default function UpdateDetailsPage() {
|
|
|
108
113
|
detail.updateId !== channelState.currentServedUpdateId,
|
|
109
114
|
);
|
|
110
115
|
const canToggleDisabled = Boolean(
|
|
111
|
-
detail &&
|
|
116
|
+
detail &&
|
|
117
|
+
!(channelState.rollbackActive && channelState.isNewestInScope),
|
|
112
118
|
);
|
|
113
119
|
const canDirectActivate = Boolean(
|
|
114
120
|
detail &&
|
|
@@ -178,7 +184,9 @@ export default function UpdateDetailsPage() {
|
|
|
178
184
|
const response = await getUpdate(encodedKey);
|
|
179
185
|
setDetail(response);
|
|
180
186
|
} catch (loadError: unknown) {
|
|
181
|
-
setError(
|
|
187
|
+
setError(
|
|
188
|
+
(loadError as Error).message || "Не удалось загрузить детали",
|
|
189
|
+
);
|
|
182
190
|
} finally {
|
|
183
191
|
setLoading(false);
|
|
184
192
|
}
|
|
@@ -208,7 +216,7 @@ export default function UpdateDetailsPage() {
|
|
|
208
216
|
try {
|
|
209
217
|
await updateJsonFile(encodedKey, selectedFile, parsed);
|
|
210
218
|
await reload();
|
|
211
|
-
setSuccess(
|
|
219
|
+
setSuccess({ key: "Файл {0} обновлён", values: [selectedFile] });
|
|
212
220
|
} catch (saveError: unknown) {
|
|
213
221
|
setError((saveError as Error).message || "Ошибка сохранения");
|
|
214
222
|
} finally {
|
|
@@ -232,7 +240,7 @@ export default function UpdateDetailsPage() {
|
|
|
232
240
|
try {
|
|
233
241
|
await rollbackUpdate(encodedKey);
|
|
234
242
|
await reload();
|
|
235
|
-
setSuccess(
|
|
243
|
+
setSuccess("Rollback активирован");
|
|
236
244
|
} catch (rollbackError: unknown) {
|
|
237
245
|
setError((rollbackError as Error).message || "Rollback не выполнен");
|
|
238
246
|
} finally {
|
|
@@ -254,7 +262,7 @@ export default function UpdateDetailsPage() {
|
|
|
254
262
|
try {
|
|
255
263
|
await promoteUpdate(encodedKey);
|
|
256
264
|
await reload();
|
|
257
|
-
setSuccess(
|
|
265
|
+
setSuccess("Promote выполнен: распространение возвращено к latest");
|
|
258
266
|
} catch (promoteError: unknown) {
|
|
259
267
|
setError((promoteError as Error).message || "Promote не выполнен");
|
|
260
268
|
} finally {
|
|
@@ -274,11 +282,11 @@ export default function UpdateDetailsPage() {
|
|
|
274
282
|
const disabled = detail.status !== "disabled";
|
|
275
283
|
await setUpdateDisabled(encodedKey, disabled);
|
|
276
284
|
await reload();
|
|
277
|
-
setSuccess(
|
|
278
|
-
disabled ? t("Апдейт деактивирован") : t("Апдейт активирован"),
|
|
279
|
-
);
|
|
285
|
+
setSuccess(disabled ? "Апдейт деактивирован" : "Апдейт активирован");
|
|
280
286
|
} catch (toggleError: unknown) {
|
|
281
|
-
setError(
|
|
287
|
+
setError(
|
|
288
|
+
(toggleError as Error).message || "Не удалось изменить статус",
|
|
289
|
+
);
|
|
282
290
|
} finally {
|
|
283
291
|
setSaving(false);
|
|
284
292
|
}
|
|
@@ -290,7 +298,9 @@ export default function UpdateDetailsPage() {
|
|
|
290
298
|
return;
|
|
291
299
|
}
|
|
292
300
|
|
|
293
|
-
const confirmed = window.confirm(
|
|
301
|
+
const confirmed = window.confirm(
|
|
302
|
+
t("Удалить апдейт полностью из bucket?"),
|
|
303
|
+
);
|
|
294
304
|
if (!confirmed) {
|
|
295
305
|
return;
|
|
296
306
|
}
|
|
@@ -303,7 +313,9 @@ export default function UpdateDetailsPage() {
|
|
|
303
313
|
await deleteUpdate(encodedKey);
|
|
304
314
|
router.replace("/updates");
|
|
305
315
|
} catch (deleteError: unknown) {
|
|
306
|
-
setError(
|
|
316
|
+
setError(
|
|
317
|
+
(deleteError as Error).message || "Не удалось удалить апдейт",
|
|
318
|
+
);
|
|
307
319
|
setSaving(false);
|
|
308
320
|
}
|
|
309
321
|
};
|
|
@@ -340,7 +352,7 @@ export default function UpdateDetailsPage() {
|
|
|
340
352
|
|
|
341
353
|
{success ? (
|
|
342
354
|
<div className="rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-700 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-300">
|
|
343
|
-
{success}
|
|
355
|
+
{t(success)}
|
|
344
356
|
</div>
|
|
345
357
|
) : null}
|
|
346
358
|
|
|
@@ -383,41 +395,51 @@ export default function UpdateDetailsPage() {
|
|
|
383
395
|
) : null}
|
|
384
396
|
|
|
385
397
|
<Card className="grid gap-4 rounded-xl border border-border bg-card p-5 md:grid-cols-2 lg:grid-cols-4 shadow-none">
|
|
386
|
-
<Info label="Runtime" value={detail.runtimeVersion} />
|
|
387
|
-
<Info label="Platform" value={detail.platform} />
|
|
388
|
-
<Info label="Channel" value={detail.channel} />
|
|
389
|
-
<Info label="Stage" value={detail.stage} />
|
|
398
|
+
<Info label={t("Runtime")} value={detail.runtimeVersion} />
|
|
399
|
+
<Info label={t("Platform")} value={detail.platform} />
|
|
400
|
+
<Info label={t("Channel")} value={detail.channel} />
|
|
401
|
+
<Info label={t("Stage")} value={detail.stage} />
|
|
390
402
|
<Info
|
|
391
|
-
label="Created"
|
|
392
|
-
value={
|
|
403
|
+
label={t("Created")}
|
|
404
|
+
value={
|
|
405
|
+
detail.createdAt
|
|
406
|
+
? fullDate(detail.createdAt)
|
|
407
|
+
: detail.createdAtPath
|
|
408
|
+
}
|
|
393
409
|
/>
|
|
394
|
-
<Info label="Status" value={detail.status} />
|
|
410
|
+
<Info label={t("Status")} value={t(detail.status)} />
|
|
395
411
|
<Info
|
|
396
|
-
label="Latest"
|
|
412
|
+
label={t("Latest")}
|
|
397
413
|
value={detail.isLatest ? t("Да") : t("Нет")}
|
|
398
414
|
/>
|
|
399
415
|
<Info
|
|
400
|
-
label="Rollback"
|
|
416
|
+
label={t("Rollback")}
|
|
401
417
|
value={detail.isRollbackActive ? t("Активен") : t("Нет")}
|
|
402
418
|
/>
|
|
403
419
|
<Info
|
|
404
420
|
label={t("Доставка")}
|
|
405
421
|
value={
|
|
406
422
|
detail.isIgnoredByRollback
|
|
407
|
-
? "Ignored by rollback"
|
|
423
|
+
? t("Ignored by rollback")
|
|
408
424
|
: detail.deliveryMode === "background"
|
|
409
|
-
? "Background"
|
|
410
|
-
: "Manual"
|
|
425
|
+
? t("Background")
|
|
426
|
+
: t("Manual")
|
|
411
427
|
}
|
|
412
428
|
/>
|
|
413
|
-
<Info label="Guard" value={detail.hasGuard ? "Yes" : "None"} />
|
|
414
429
|
<Info
|
|
415
|
-
label="
|
|
416
|
-
value={
|
|
430
|
+
label={t("Guard")}
|
|
431
|
+
value={detail.hasGuard ? t("Yes") : t("None")}
|
|
432
|
+
/>
|
|
433
|
+
<Info
|
|
434
|
+
label={t("Policy")}
|
|
435
|
+
value={`v${detail.policyVersion} · ${detail.policyEditable ? t("draft") : t("published")}`}
|
|
436
|
+
/>
|
|
437
|
+
<Info
|
|
438
|
+
label={t("Assets")}
|
|
439
|
+
value={String(detail.assetsCount)}
|
|
417
440
|
/>
|
|
418
|
-
<Info label="Assets" value={String(detail.assetsCount)} />
|
|
419
441
|
<Info
|
|
420
|
-
label="Update ID"
|
|
442
|
+
label={t("Update ID")}
|
|
421
443
|
value={detail.updateId}
|
|
422
444
|
className="md:col-span-2 lg:col-span-2"
|
|
423
445
|
/>
|
|
@@ -454,7 +476,7 @@ export default function UpdateDetailsPage() {
|
|
|
454
476
|
onClick={handleRollback}
|
|
455
477
|
disabled={saving}
|
|
456
478
|
>
|
|
457
|
-
Rollback
|
|
479
|
+
{t("Rollback")}
|
|
458
480
|
</Button>
|
|
459
481
|
) : null}
|
|
460
482
|
{canPromote ? (
|
|
@@ -465,7 +487,7 @@ export default function UpdateDetailsPage() {
|
|
|
465
487
|
onClick={handlePromote}
|
|
466
488
|
disabled={saving}
|
|
467
489
|
>
|
|
468
|
-
Promote
|
|
490
|
+
{t("Promote")}
|
|
469
491
|
</Button>
|
|
470
492
|
) : null}
|
|
471
493
|
{showToggleDisabledButton ? (
|
|
@@ -57,7 +57,9 @@ export default function DevicesPage() {
|
|
|
57
57
|
</div>
|
|
58
58
|
<Button variant="outline" disabled={loading} onClick={refresh}>
|
|
59
59
|
<RefreshCw
|
|
60
|
-
className={
|
|
60
|
+
className={
|
|
61
|
+
loading ? "animate-spin motion-reduce:animate-none" : ""
|
|
62
|
+
}
|
|
61
63
|
/>
|
|
62
64
|
{loading ? t("Обновление…") : t("Обновить")}
|
|
63
65
|
</Button>
|
|
@@ -116,7 +118,7 @@ export default function DevicesPage() {
|
|
|
116
118
|
]}
|
|
117
119
|
/>
|
|
118
120
|
<Filter
|
|
119
|
-
label="Runtime"
|
|
121
|
+
label={t("Runtime")}
|
|
120
122
|
id="runtime"
|
|
121
123
|
value={filters.runtime}
|
|
122
124
|
onChange={(v) => update("runtime", v)}
|
|
@@ -133,7 +135,9 @@ export default function DevicesPage() {
|
|
|
133
135
|
items={[["", t("Все типы")], ...Object.entries(kindNames)]}
|
|
134
136
|
/>
|
|
135
137
|
<div className="grid gap-2">
|
|
136
|
-
<Label htmlFor="installation-search">
|
|
138
|
+
<Label htmlFor="installation-search">
|
|
139
|
+
{t("Installation ID")}
|
|
140
|
+
</Label>
|
|
137
141
|
<Input
|
|
138
142
|
id="installation-search"
|
|
139
143
|
placeholder={t("ID или часть ID")}
|
|
@@ -167,10 +171,12 @@ export default function DevicesPage() {
|
|
|
167
171
|
<span className="ml-auto text-xs text-muted-foreground">
|
|
168
172
|
{report && !loading
|
|
169
173
|
? t("Данные на {0}", [
|
|
170
|
-
new Date(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
+
new Date(
|
|
175
|
+
report.coverage.generatedAt,
|
|
176
|
+
).toLocaleTimeString(formatLocale, {
|
|
177
|
+
hour: "2-digit",
|
|
178
|
+
minute: "2-digit",
|
|
179
|
+
}),
|
|
174
180
|
])
|
|
175
181
|
: ""}
|
|
176
182
|
</span>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import type { TranslationMessage } from "@/src/client/i18n/messages";
|
|
2
3
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
4
|
|
|
4
5
|
import { Button } from "@/components/ui/button";
|
|
@@ -26,7 +27,7 @@ export default function EmbeddedUpdatesPage() {
|
|
|
26
27
|
const [loading, setLoading] = useState(true);
|
|
27
28
|
const [deletingId, setDeletingId] = useState<string | null>(null);
|
|
28
29
|
const [error, setError] = useState("");
|
|
29
|
-
const [success, setSuccess] = useState("");
|
|
30
|
+
const [success, setSuccess] = useState<TranslationMessage>("");
|
|
30
31
|
|
|
31
32
|
const loadItems = useCallback(async () => {
|
|
32
33
|
setLoading(true);
|
|
@@ -63,7 +64,10 @@ export default function EmbeddedUpdatesPage() {
|
|
|
63
64
|
|
|
64
65
|
try {
|
|
65
66
|
await deleteEmbeddedUpdate(embeddedUpdateId);
|
|
66
|
-
setSuccess(
|
|
67
|
+
setSuccess({
|
|
68
|
+
key: "Запись удалена: {0}",
|
|
69
|
+
values: [embeddedUpdateId],
|
|
70
|
+
});
|
|
67
71
|
await loadItems();
|
|
68
72
|
} catch (deleteError: unknown) {
|
|
69
73
|
setError(
|
|
@@ -81,14 +85,16 @@ export default function EmbeddedUpdatesPage() {
|
|
|
81
85
|
<header className="flex flex-wrap items-start justify-between gap-4">
|
|
82
86
|
<div className="space-y-1">
|
|
83
87
|
<h1 className="text-2xl font-semibold tracking-tight">
|
|
84
|
-
Embedded builds
|
|
88
|
+
{t("Embedded builds")}
|
|
85
89
|
</h1>
|
|
86
90
|
<p className="text-sm text-muted-foreground">
|
|
87
|
-
{t(
|
|
91
|
+
{t(
|
|
92
|
+
"Встроенные версии приложения и регистрация нативных сборок.",
|
|
93
|
+
)}
|
|
88
94
|
</p>
|
|
89
95
|
</div>
|
|
90
96
|
<Badge variant="secondary" className="px-3 py-1">
|
|
91
|
-
{
|
|
97
|
+
{t("Builds: {0}", [items.length])}
|
|
92
98
|
</Badge>
|
|
93
99
|
</header>
|
|
94
100
|
|
|
@@ -100,7 +106,7 @@ export default function EmbeddedUpdatesPage() {
|
|
|
100
106
|
|
|
101
107
|
{success ? (
|
|
102
108
|
<div className="rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-700 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-300">
|
|
103
|
-
{success}
|
|
109
|
+
{t(success)}
|
|
104
110
|
</div>
|
|
105
111
|
) : null}
|
|
106
112
|
|
|
@@ -110,19 +116,23 @@ export default function EmbeddedUpdatesPage() {
|
|
|
110
116
|
<TableHeader className="bg-muted/40">
|
|
111
117
|
<TableRow>
|
|
112
118
|
<TableHead className="px-4 py-3 text-left">
|
|
113
|
-
Created At
|
|
119
|
+
{t("Created At")}
|
|
114
120
|
</TableHead>
|
|
115
121
|
<TableHead className="px-4 py-3 text-left">
|
|
116
|
-
App version
|
|
122
|
+
{t("App version")}
|
|
117
123
|
</TableHead>
|
|
118
124
|
<TableHead className="px-4 py-3 text-left">
|
|
119
|
-
Platform
|
|
125
|
+
{t("Platform")}
|
|
120
126
|
</TableHead>
|
|
121
|
-
<TableHead className="px-4 py-3 text-left">Channel</TableHead>
|
|
122
127
|
<TableHead className="px-4 py-3 text-left">
|
|
123
|
-
|
|
128
|
+
{t("Channel")}
|
|
129
|
+
</TableHead>
|
|
130
|
+
<TableHead className="px-4 py-3 text-left">
|
|
131
|
+
{t("Embedded ID")}
|
|
132
|
+
</TableHead>
|
|
133
|
+
<TableHead className="px-4 py-3 text-left">
|
|
134
|
+
{t("Action")}
|
|
124
135
|
</TableHead>
|
|
125
|
-
<TableHead className="px-4 py-3 text-left">Action</TableHead>
|
|
126
136
|
</TableRow>
|
|
127
137
|
</TableHeader>
|
|
128
138
|
<TableBody>
|
|
@@ -181,7 +191,9 @@ export default function EmbeddedUpdatesPage() {
|
|
|
181
191
|
variant="destructive"
|
|
182
192
|
size="sm"
|
|
183
193
|
type="button"
|
|
184
|
-
onClick={() =>
|
|
194
|
+
onClick={() =>
|
|
195
|
+
handleDelete(item.embeddedUpdateId)
|
|
196
|
+
}
|
|
185
197
|
disabled={deletingId === item.embeddedUpdateId}
|
|
186
198
|
>
|
|
187
199
|
{deletingId === item.embeddedUpdateId
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import type { TranslationMessage } from "@/src/client/i18n/messages";
|
|
2
3
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
4
|
|
|
4
5
|
import { NativeSelect } from "@/components/ui/native-select";
|
|
@@ -50,7 +51,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
50
51
|
const [loading, setLoading] = useState(true);
|
|
51
52
|
const [saving, setSaving] = useState(false);
|
|
52
53
|
const [error, setError] = useState("");
|
|
53
|
-
const [success, setSuccess] = useState("");
|
|
54
|
+
const [success, setSuccess] = useState<TranslationMessage>("");
|
|
54
55
|
|
|
55
56
|
const load = useCallback(async () => {
|
|
56
57
|
setLoading(true);
|
|
@@ -95,10 +96,10 @@ export default function EmergencyRedirectsPage() {
|
|
|
95
96
|
|
|
96
97
|
if (editingId) {
|
|
97
98
|
await updateEmergencyRedirect(editingId, payload);
|
|
98
|
-
setSuccess(
|
|
99
|
+
setSuccess("Emergency redirect обновлён");
|
|
99
100
|
} else {
|
|
100
101
|
await createEmergencyRedirect(payload);
|
|
101
|
-
setSuccess(
|
|
102
|
+
setSuccess("Emergency redirect создан");
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
resetForm();
|
|
@@ -134,15 +135,19 @@ export default function EmergencyRedirectsPage() {
|
|
|
134
135
|
setSuccess("");
|
|
135
136
|
try {
|
|
136
137
|
await updateEmergencyRedirect(item.id, { enabled: !item.enabled });
|
|
137
|
-
setSuccess(item.enabled ?
|
|
138
|
+
setSuccess(item.enabled ? "Redirect отключён" : "Redirect включён");
|
|
138
139
|
await load();
|
|
139
140
|
} catch (toggleError: unknown) {
|
|
140
|
-
setError(
|
|
141
|
+
setError(
|
|
142
|
+
(toggleError as Error).message || "Не удалось изменить статус",
|
|
143
|
+
);
|
|
141
144
|
}
|
|
142
145
|
};
|
|
143
146
|
|
|
144
147
|
const remove = async (item: EmergencyRedirectItem) => {
|
|
145
|
-
if (
|
|
148
|
+
if (
|
|
149
|
+
!window.confirm(t('Удалить emergency redirect "{0}"?', [item.name]))
|
|
150
|
+
) {
|
|
146
151
|
return;
|
|
147
152
|
}
|
|
148
153
|
|
|
@@ -150,13 +155,15 @@ export default function EmergencyRedirectsPage() {
|
|
|
150
155
|
setSuccess("");
|
|
151
156
|
try {
|
|
152
157
|
await deleteEmergencyRedirect(item.id);
|
|
153
|
-
setSuccess(
|
|
158
|
+
setSuccess("Emergency redirect удалён");
|
|
154
159
|
if (editingId === item.id) {
|
|
155
160
|
resetForm();
|
|
156
161
|
}
|
|
157
162
|
await load();
|
|
158
163
|
} catch (deleteError: unknown) {
|
|
159
|
-
setError(
|
|
164
|
+
setError(
|
|
165
|
+
(deleteError as Error).message || "Не удалось удалить redirect",
|
|
166
|
+
);
|
|
160
167
|
}
|
|
161
168
|
};
|
|
162
169
|
|
|
@@ -166,7 +173,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
166
173
|
<header className="flex flex-wrap items-start justify-between gap-4">
|
|
167
174
|
<div className="space-y-1">
|
|
168
175
|
<h1 className="text-2xl font-semibold tracking-tight">
|
|
169
|
-
Emergency redirects
|
|
176
|
+
{t("Emergency redirects")}
|
|
170
177
|
</h1>
|
|
171
178
|
<p className="text-sm text-muted-foreground">
|
|
172
179
|
{t(
|
|
@@ -175,7 +182,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
175
182
|
</p>
|
|
176
183
|
</div>
|
|
177
184
|
<Badge variant="secondary" className="px-3 py-1">
|
|
178
|
-
{
|
|
185
|
+
{t("Rules: {0}", [items.length])}
|
|
179
186
|
</Badge>
|
|
180
187
|
</header>
|
|
181
188
|
|
|
@@ -186,7 +193,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
186
193
|
) : null}
|
|
187
194
|
{success ? (
|
|
188
195
|
<div className="rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-700 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-300">
|
|
189
|
-
{success}
|
|
196
|
+
{t(success)}
|
|
190
197
|
</div>
|
|
191
198
|
) : null}
|
|
192
199
|
|
|
@@ -197,7 +204,9 @@ export default function EmergencyRedirectsPage() {
|
|
|
197
204
|
>
|
|
198
205
|
<div className="flex items-center justify-between">
|
|
199
206
|
<h2 className="font-semibold">
|
|
200
|
-
{editingId
|
|
207
|
+
{editingId
|
|
208
|
+
? t("Редактирование правила")
|
|
209
|
+
: t("Новое правило")}
|
|
201
210
|
</h2>
|
|
202
211
|
{editingId ? (
|
|
203
212
|
<Button
|
|
@@ -218,14 +227,14 @@ export default function EmergencyRedirectsPage() {
|
|
|
218
227
|
onChange={(value) => setForm({ ...form, name: value })}
|
|
219
228
|
/>
|
|
220
229
|
<Input
|
|
221
|
-
label="Runtime version"
|
|
230
|
+
label={t("Runtime version")}
|
|
222
231
|
value={form.runtimeVersion}
|
|
223
232
|
onChange={(value) =>
|
|
224
233
|
setForm({ ...form, runtimeVersion: value })
|
|
225
234
|
}
|
|
226
235
|
/>
|
|
227
236
|
<label className="space-y-1 text-sm">
|
|
228
|
-
<span>Platform</span>
|
|
237
|
+
<span>{t("Platform")}</span>
|
|
229
238
|
<NativeSelect
|
|
230
239
|
value={form.platform}
|
|
231
240
|
onChange={(event) =>
|
|
@@ -241,24 +250,26 @@ export default function EmergencyRedirectsPage() {
|
|
|
241
250
|
</NativeSelect>
|
|
242
251
|
</label>
|
|
243
252
|
<Input
|
|
244
|
-
label="Embedded update ID"
|
|
253
|
+
label={t("Embedded update ID")}
|
|
245
254
|
value={form.embeddedUpdateId}
|
|
246
255
|
onChange={(value) =>
|
|
247
256
|
setForm({ ...form, embeddedUpdateId: value })
|
|
248
257
|
}
|
|
249
258
|
/>
|
|
250
259
|
<Input
|
|
251
|
-
label="From channel"
|
|
260
|
+
label={t("From channel")}
|
|
252
261
|
value={form.fromChannel}
|
|
253
|
-
onChange={(value) =>
|
|
262
|
+
onChange={(value) =>
|
|
263
|
+
setForm({ ...form, fromChannel: value })
|
|
264
|
+
}
|
|
254
265
|
/>
|
|
255
266
|
<Input
|
|
256
|
-
label="To channel"
|
|
267
|
+
label={t("To channel")}
|
|
257
268
|
value={form.toChannel}
|
|
258
269
|
onChange={(value) => setForm({ ...form, toChannel: value })}
|
|
259
270
|
/>
|
|
260
271
|
<label className="space-y-1 text-sm">
|
|
261
|
-
<span>Target mode</span>
|
|
272
|
+
<span>{t("Target mode")}</span>
|
|
262
273
|
<NativeSelect
|
|
263
274
|
value={form.targetMode}
|
|
264
275
|
onChange={(event) =>
|
|
@@ -269,15 +280,15 @@ export default function EmergencyRedirectsPage() {
|
|
|
269
280
|
}
|
|
270
281
|
className="w-full rounded-md border border-input bg-background px-3 py-2 "
|
|
271
282
|
>
|
|
272
|
-
<option value="pinned">Pinned update</option>
|
|
273
|
-
<option value="follow">Follow channel</option>
|
|
283
|
+
<option value="pinned">{t("Pinned update")}</option>
|
|
284
|
+
<option value="follow">{t("Follow channel")}</option>
|
|
274
285
|
</NativeSelect>
|
|
275
286
|
</label>
|
|
276
287
|
<Input
|
|
277
288
|
label={
|
|
278
289
|
form.targetMode === "pinned"
|
|
279
|
-
? "Expected update ID"
|
|
280
|
-
: "Expected update ID (optional)"
|
|
290
|
+
? t("Expected update ID")
|
|
291
|
+
: t("Expected update ID (optional)")
|
|
281
292
|
}
|
|
282
293
|
value={form.expectedUpdateId || ""}
|
|
283
294
|
required={form.targetMode === "pinned"}
|
|
@@ -299,7 +310,12 @@ export default function EmergencyRedirectsPage() {
|
|
|
299
310
|
{t("Включить правило сразу после сохранения")}
|
|
300
311
|
</label>
|
|
301
312
|
|
|
302
|
-
<Button
|
|
313
|
+
<Button
|
|
314
|
+
variant="default"
|
|
315
|
+
size="sm"
|
|
316
|
+
type="submit"
|
|
317
|
+
disabled={saving}
|
|
318
|
+
>
|
|
303
319
|
{saving
|
|
304
320
|
? t("Сохранение...")
|
|
305
321
|
: editingId
|
|
@@ -314,17 +330,27 @@ export default function EmergencyRedirectsPage() {
|
|
|
314
330
|
<Table className="min-w-full text-sm">
|
|
315
331
|
<TableHeader className="bg-muted/40">
|
|
316
332
|
<TableRow>
|
|
317
|
-
<TableHead className="px-4 py-3 text-left">Status</TableHead>
|
|
318
|
-
<TableHead className="px-4 py-3 text-left">Name</TableHead>
|
|
319
|
-
<TableHead className="px-4 py-3 text-left">Scope</TableHead>
|
|
320
333
|
<TableHead className="px-4 py-3 text-left">
|
|
321
|
-
|
|
334
|
+
{t("Status")}
|
|
335
|
+
</TableHead>
|
|
336
|
+
<TableHead className="px-4 py-3 text-left">
|
|
337
|
+
{t("Name")}
|
|
338
|
+
</TableHead>
|
|
339
|
+
<TableHead className="px-4 py-3 text-left">
|
|
340
|
+
{t("Scope")}
|
|
322
341
|
</TableHead>
|
|
323
|
-
<TableHead className="px-4 py-3 text-left">Target</TableHead>
|
|
324
342
|
<TableHead className="px-4 py-3 text-left">
|
|
325
|
-
|
|
343
|
+
{t("Redirect")}
|
|
344
|
+
</TableHead>
|
|
345
|
+
<TableHead className="px-4 py-3 text-left">
|
|
346
|
+
{t("Target")}
|
|
347
|
+
</TableHead>
|
|
348
|
+
<TableHead className="px-4 py-3 text-left">
|
|
349
|
+
{t("Embedded ID")}
|
|
350
|
+
</TableHead>
|
|
351
|
+
<TableHead className="px-4 py-3 text-left">
|
|
352
|
+
{t("Actions")}
|
|
326
353
|
</TableHead>
|
|
327
|
-
<TableHead className="px-4 py-3 text-left">Actions</TableHead>
|
|
328
354
|
</TableRow>
|
|
329
355
|
</TableHeader>
|
|
330
356
|
<TableBody>
|
|
@@ -363,10 +389,12 @@ export default function EmergencyRedirectsPage() {
|
|
|
363
389
|
: ""
|
|
364
390
|
}
|
|
365
391
|
>
|
|
366
|
-
{item.enabled ? "Enabled" : "Disabled"}
|
|
392
|
+
{item.enabled ? t("Enabled") : t("Disabled")}
|
|
367
393
|
</Badge>
|
|
368
394
|
</TableCell>
|
|
369
|
-
<TableCell className="px-4 py-3">
|
|
395
|
+
<TableCell className="px-4 py-3">
|
|
396
|
+
{item.name}
|
|
397
|
+
</TableCell>
|
|
370
398
|
<TableCell className="px-4 py-3">
|
|
371
399
|
{item.runtimeVersion} / {item.platform}
|
|
372
400
|
</TableCell>
|
|
@@ -374,7 +402,11 @@ export default function EmergencyRedirectsPage() {
|
|
|
374
402
|
{item.fromChannel} → {item.toChannel}
|
|
375
403
|
</TableCell>
|
|
376
404
|
<TableCell className="px-4 py-3">
|
|
377
|
-
<Badge variant="outline">
|
|
405
|
+
<Badge variant="outline">
|
|
406
|
+
{item.targetMode === "pinned"
|
|
407
|
+
? t("Pinned update")
|
|
408
|
+
: t("Follow channel")}
|
|
409
|
+
</Badge>
|
|
378
410
|
{item.expectedUpdateId ? (
|
|
379
411
|
<div
|
|
380
412
|
title={item.expectedUpdateId}
|
|
@@ -401,7 +433,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
401
433
|
type="button"
|
|
402
434
|
onClick={() => edit(item)}
|
|
403
435
|
>
|
|
404
|
-
Edit
|
|
436
|
+
{t("Edit")}
|
|
405
437
|
</Button>
|
|
406
438
|
<Button
|
|
407
439
|
variant="outline"
|
|
@@ -409,7 +441,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
409
441
|
type="button"
|
|
410
442
|
onClick={() => void toggle(item)}
|
|
411
443
|
>
|
|
412
|
-
{item.enabled ? "Disable" : "Enable"}
|
|
444
|
+
{item.enabled ? t("Disable") : t("Enable")}
|
|
413
445
|
</Button>
|
|
414
446
|
<Button
|
|
415
447
|
variant="destructive"
|
|
@@ -417,12 +449,12 @@ export default function EmergencyRedirectsPage() {
|
|
|
417
449
|
type="button"
|
|
418
450
|
onClick={() => void remove(item)}
|
|
419
451
|
>
|
|
420
|
-
Delete
|
|
452
|
+
{t("Delete")}
|
|
421
453
|
</Button>
|
|
422
454
|
</div>
|
|
423
455
|
) : (
|
|
424
456
|
<span className="text-xs text-muted-foreground">
|
|
425
|
-
Read only
|
|
457
|
+
{t("Read only")}
|
|
426
458
|
</span>
|
|
427
459
|
)}
|
|
428
460
|
</TableCell>
|