create-expo-updates-server 0.1.5 → 0.2.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/.dockerignore +16 -0
- package/dist/template/README.md +51 -660
- package/dist/template/app/api/admin/device-targets/route.test.ts +43 -0
- package/dist/template/app/api/admin/device-targets/route.ts +91 -0
- package/dist/template/app/api/admin/devices/route.test.ts +41 -0
- package/dist/template/app/api/admin/devices/route.ts +15 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/audience/route.ts +75 -0
- package/dist/template/app/api/device-heartbeat/route.ts +2 -0
- package/dist/template/app/globals.css +114 -15
- package/dist/template/app/layout.tsx +12 -4
- package/dist/template/app/login/page.tsx +22 -18
- package/dist/template/app/updates/[encodedKey]/page.tsx +112 -88
- package/dist/template/app/updates/devices/page.tsx +264 -0
- package/dist/template/app/updates/embedded/page.tsx +102 -68
- package/dist/template/app/updates/emergency-redirects/page.tsx +144 -111
- package/dist/template/app/updates/layout.tsx +6 -1
- package/dist/template/app/updates/page.tsx +262 -212
- package/dist/template/components/admin/admin-shell.tsx +196 -0
- package/dist/template/components/admin/language-switcher.tsx +25 -0
- package/dist/template/components/admin/theme-provider.tsx +15 -0
- package/dist/template/components/ui/alert.tsx +65 -0
- package/dist/template/components/ui/badge.tsx +47 -0
- package/dist/template/components/ui/button.tsx +63 -0
- package/dist/template/components/ui/card.tsx +91 -0
- package/dist/template/components/ui/chart.tsx +373 -0
- package/dist/template/components/ui/checkbox.tsx +31 -0
- package/dist/template/components/ui/dialog.tsx +158 -0
- package/dist/template/components/ui/dropdown-menu.tsx +256 -0
- package/dist/template/components/ui/input.tsx +20 -0
- package/dist/template/components/ui/label.tsx +23 -0
- package/dist/template/components/ui/native-select.tsx +61 -0
- package/dist/template/components/ui/popover.tsx +88 -0
- package/dist/template/components/ui/scroll-area.tsx +57 -0
- package/dist/template/components/ui/select.tsx +189 -0
- package/dist/template/components/ui/separator.tsx +27 -0
- package/dist/template/components/ui/sheet.tsx +142 -0
- package/dist/template/components/ui/sidebar.tsx +736 -0
- package/dist/template/components/ui/skeleton.tsx +13 -0
- package/dist/template/components/ui/switch.tsx +34 -0
- package/dist/template/components/ui/table.tsx +115 -0
- package/dist/template/components/ui/tabs.tsx +90 -0
- package/dist/template/components/ui/textarea.tsx +17 -0
- package/dist/template/components/ui/tooltip.tsx +56 -0
- package/dist/template/components.json +22 -0
- package/dist/template/docs/admin-ui.md +35 -0
- package/dist/template/docs/device-targeting.md +129 -0
- package/dist/template/docs/doctor.md +137 -0
- package/dist/template/docs/expo-app-setup.md +174 -47
- package/dist/template/docs/getting-started.md +105 -146
- package/dist/template/docs/getting-started.ru.md +106 -191
- package/dist/template/docs/index.md +14 -33
- package/dist/template/docs/installation-telemetry.md +233 -0
- package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +89 -0
- package/dist/template/docs/migrations/2026-10-19-device-heartbeat.sql +131 -0
- package/dist/template/docs/migrations/2026-10-22-device-analytics.sql +264 -0
- package/dist/template/docs/migrations/2026-10-22-device-targeting-activation.sql +108 -0
- package/dist/template/docs/migrations/2026-10-22-device-targeting.sql +130 -0
- package/dist/template/docs/migrations/2026-10-22-device-version-metadata.sql +154 -0
- package/dist/template/docs/migrations/schema.sql +868 -6
- package/dist/template/docs/npm-installer.md +15 -30
- package/dist/template/docs/operations-guide.md +87 -0
- package/dist/template/docs/ota-client-lifecycle.md +263 -0
- package/dist/template/docs/ota-update-policy.md +36 -2
- package/dist/template/docs/supabase-setup.md +4 -0
- package/dist/template/hooks/use-mobile.ts +21 -0
- package/dist/template/lib/utils.ts +6 -0
- package/dist/template/package-lock.json +2325 -101
- package/dist/template/package.json +13 -3
- package/dist/template/scripts/configure-expo-app.mjs +11 -15
- package/dist/template/scripts/doctor.mjs +51 -0
- package/dist/template/scripts/ensure-test-bucket.mjs +21 -0
- package/dist/template/scripts/lib/device-identity.test.ts +29 -0
- package/dist/template/scripts/lib/doctor-probes.mjs +139 -0
- package/dist/template/scripts/lib/doctor.mjs +208 -0
- package/dist/template/scripts/lib/doctor.test.mjs +262 -0
- package/dist/template/scripts/lib/expo-app-configurator.mjs +14 -9
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +3 -2
- package/dist/template/scripts/lib/ota-client-configurator.mjs +69 -0
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +88 -0
- package/dist/template/scripts/lib/ota-client.test.ts +55 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +173 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +123 -0
- package/dist/template/scripts/lib/ota-update-controller.test.ts +231 -0
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +80 -0
- package/dist/template/scripts/tests/device-analytics.mjs +126 -0
- package/dist/template/scripts/tests/device-heartbeat.mjs +86 -0
- package/dist/template/scripts/tests/device-targeting-activation.mjs +111 -0
- package/dist/template/scripts/tests/device-targeting.mjs +39 -0
- package/dist/template/scripts/tests/device-version-metadata.mjs +31 -0
- package/dist/template/scripts/tests/manifest-identity-concurrency.mjs +106 -0
- package/dist/template/scripts/tests/manifest-identity.sql +204 -0
- package/dist/template/src/client/admin-types.ts +1 -0
- package/dist/template/src/client/devices/analytics.tsx +429 -0
- package/dist/template/src/client/devices/device-name.tsx +82 -0
- package/dist/template/src/client/devices/registry.tsx +399 -0
- package/dist/template/src/client/devices/use-devices-report.ts +108 -0
- package/dist/template/src/client/devices/version-adoption-chart.tsx +269 -0
- package/dist/template/src/client/devices/version-groups.test.ts +57 -0
- package/dist/template/src/client/devices/version-groups.ts +101 -0
- package/dist/template/src/client/distribution-control.tsx +135 -81
- package/dist/template/src/client/guard-action-combobox.tsx +13 -24
- package/dist/template/src/client/i18n/en.json +286 -0
- package/dist/template/src/client/i18n/messages.test.ts +42 -0
- package/dist/template/src/client/i18n/messages.ts +31 -0
- package/dist/template/src/client/i18n/provider.tsx +55 -0
- package/dist/template/src/client/i18n/use-formatters.ts +38 -0
- package/dist/template/src/client/logout-button.tsx +3 -1
- package/dist/template/src/client/update-audience-editor.tsx +285 -0
- package/dist/template/src/client/update-policy-editor.tsx +53 -41
- package/dist/template/src/server/controllers/manifest.test.ts +250 -7
- package/dist/template/src/server/controllers/manifest.ts +39 -31
- package/dist/template/src/server/devices/audience.test.ts +48 -0
- package/dist/template/src/server/devices/audience.ts +86 -0
- package/dist/template/src/server/devices/heartbeat.test.ts +39 -0
- package/dist/template/src/server/devices/heartbeat.ts +75 -0
- package/dist/template/src/server/devices/report-types.ts +114 -0
- package/dist/template/src/server/devices/report.test.ts +29 -0
- package/dist/template/src/server/devices/report.ts +27 -0
- package/dist/template/src/server/lib/admin-audience-activation.test.ts +94 -0
- package/dist/template/src/server/lib/admin-updates.ts +32 -168
- package/dist/template/src/server/lib/distribution-control.test.ts +23 -2
- package/dist/template/src/server/lib/distribution-control.ts +13 -4
- package/dist/template/src/server/lib/supabase.js +10 -10
- package/dist/template/src/server/lib/supabase.test.ts +11 -0
- package/dist/template/src/server/manifest/manifest-identity.test.ts +30 -0
- package/dist/template/src/server/manifest/manifest-identity.ts +24 -0
- package/dist/template/src/server/manifest/manifest-repository.ts +31 -102
- package/dist/template/src/server/manifest/manifest-response.ts +1 -1
- package/dist/template/templates/expo-app/ota-client/README.md +59 -0
- package/dist/template/templates/expo-app/ota-client/controller.js +60 -0
- package/dist/template/templates/expo-app/ota-client/device-identity.js +26 -0
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +52 -0
- package/dist/template/templates/expo-app/ota-client/index.d.ts +47 -0
- package/dist/template/templates/expo-app/ota-client/index.js +3 -0
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.js +48 -0
- package/dist/template/templates/expo-app/ota-client/model/update-controller.js +182 -0
- package/dist/template/templates/expo-app/ota-client/runtime.js +112 -0
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.js +56 -0
- package/dist/template-manifest.json +582 -77
- package/lib/cli.mjs +4 -6
- package/package.json +1 -1
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
|
+
|
|
4
|
+
import { NativeSelect } from "@/components/ui/native-select";
|
|
5
|
+
|
|
6
|
+
import { Button } from "@/components/ui/button";
|
|
7
|
+
import { Card } from "@/components/ui/card";
|
|
8
|
+
import { Badge } from "@/components/ui/badge";
|
|
9
|
+
import {
|
|
10
|
+
Table,
|
|
11
|
+
TableHeader,
|
|
12
|
+
TableBody,
|
|
13
|
+
TableRow,
|
|
14
|
+
TableHead,
|
|
15
|
+
TableCell,
|
|
16
|
+
} from "@/components/ui/table";
|
|
17
|
+
import { Input as TextInput } from "@/components/ui/input";
|
|
2
18
|
|
|
3
19
|
import {
|
|
4
20
|
createEmergencyRedirect,
|
|
@@ -11,8 +27,6 @@ import {
|
|
|
11
27
|
EmergencyRedirectInput,
|
|
12
28
|
EmergencyRedirectItem,
|
|
13
29
|
} from "@/src/client/admin-types";
|
|
14
|
-
import LogoutButton from "@/src/client/logout-button";
|
|
15
|
-
import Link from "next/link";
|
|
16
30
|
import { FormEvent, useCallback, useEffect, useState } from "react";
|
|
17
31
|
|
|
18
32
|
const EMPTY_FORM: EmergencyRedirectInput = {
|
|
@@ -28,6 +42,7 @@ const EMPTY_FORM: EmergencyRedirectInput = {
|
|
|
28
42
|
};
|
|
29
43
|
|
|
30
44
|
export default function EmergencyRedirectsPage() {
|
|
45
|
+
const { t } = useI18n();
|
|
31
46
|
const [items, setItems] = useState<EmergencyRedirectItem[]>([]);
|
|
32
47
|
const [form, setForm] = useState<EmergencyRedirectInput>(EMPTY_FORM);
|
|
33
48
|
const [editingId, setEditingId] = useState<string | null>(null);
|
|
@@ -80,10 +95,10 @@ export default function EmergencyRedirectsPage() {
|
|
|
80
95
|
|
|
81
96
|
if (editingId) {
|
|
82
97
|
await updateEmergencyRedirect(editingId, payload);
|
|
83
|
-
setSuccess("Emergency redirect обновлён");
|
|
98
|
+
setSuccess(t("Emergency redirect обновлён"));
|
|
84
99
|
} else {
|
|
85
100
|
await createEmergencyRedirect(payload);
|
|
86
|
-
setSuccess("Emergency redirect создан");
|
|
101
|
+
setSuccess(t("Emergency redirect создан"));
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
resetForm();
|
|
@@ -119,7 +134,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
119
134
|
setSuccess("");
|
|
120
135
|
try {
|
|
121
136
|
await updateEmergencyRedirect(item.id, { enabled: !item.enabled });
|
|
122
|
-
setSuccess(item.enabled ? "Redirect отключён" : "Redirect включён");
|
|
137
|
+
setSuccess(item.enabled ? t("Redirect отключён") : t("Redirect включён"));
|
|
123
138
|
await load();
|
|
124
139
|
} catch (toggleError: unknown) {
|
|
125
140
|
setError((toggleError as Error).message || "Не удалось изменить статус");
|
|
@@ -127,7 +142,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
127
142
|
};
|
|
128
143
|
|
|
129
144
|
const remove = async (item: EmergencyRedirectItem) => {
|
|
130
|
-
if (!window.confirm(
|
|
145
|
+
if (!window.confirm(t('Удалить emergency redirect "{0}"?', [item.name]))) {
|
|
131
146
|
return;
|
|
132
147
|
}
|
|
133
148
|
|
|
@@ -135,7 +150,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
135
150
|
setSuccess("");
|
|
136
151
|
try {
|
|
137
152
|
await deleteEmergencyRedirect(item.id);
|
|
138
|
-
setSuccess("Emergency redirect удалён");
|
|
153
|
+
setSuccess(t("Emergency redirect удалён"));
|
|
139
154
|
if (editingId === item.id) {
|
|
140
155
|
resetForm();
|
|
141
156
|
}
|
|
@@ -146,29 +161,27 @@ export default function EmergencyRedirectsPage() {
|
|
|
146
161
|
};
|
|
147
162
|
|
|
148
163
|
return (
|
|
149
|
-
<
|
|
150
|
-
<div className="
|
|
151
|
-
<header className="flex flex-
|
|
152
|
-
<div>
|
|
153
|
-
<h1 className="text-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
<div className="mx-auto max-w-[1600px] space-y-6 p-4 md:p-8">
|
|
165
|
+
<div className="space-y-6">
|
|
166
|
+
<header className="flex flex-wrap items-start justify-between gap-4">
|
|
167
|
+
<div className="space-y-1">
|
|
168
|
+
<h1 className="text-2xl font-semibold tracking-tight">
|
|
169
|
+
Emergency redirects
|
|
170
|
+
</h1>
|
|
171
|
+
<p className="text-sm text-muted-foreground">
|
|
172
|
+
{t(
|
|
173
|
+
"Точечное перенаправление ошибочных embedded builds между каналами.",
|
|
174
|
+
)}
|
|
156
175
|
</p>
|
|
157
176
|
</div>
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
className="rounded-md border border-zinc-300 px-4 py-3 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
|
|
162
|
-
>
|
|
163
|
-
OTA Updates
|
|
164
|
-
</Link>
|
|
165
|
-
<LogoutButton />
|
|
166
|
-
</div>
|
|
177
|
+
<Badge variant="secondary" className="px-3 py-1">
|
|
178
|
+
{items.length} {t(" правил")}
|
|
179
|
+
</Badge>
|
|
167
180
|
</header>
|
|
168
181
|
|
|
169
182
|
{error ? (
|
|
170
183
|
<div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300">
|
|
171
|
-
{error}
|
|
184
|
+
{t(error)}
|
|
172
185
|
</div>
|
|
173
186
|
) : null}
|
|
174
187
|
{success ? (
|
|
@@ -180,26 +193,27 @@ export default function EmergencyRedirectsPage() {
|
|
|
180
193
|
{canWrite ? (
|
|
181
194
|
<form
|
|
182
195
|
onSubmit={handleSubmit}
|
|
183
|
-
className="space-y-4 rounded-xl border border-
|
|
196
|
+
className="space-y-4 rounded-xl border border-border bg-card p-5 "
|
|
184
197
|
>
|
|
185
198
|
<div className="flex items-center justify-between">
|
|
186
199
|
<h2 className="font-semibold">
|
|
187
|
-
{editingId ? "Редактирование правила" : "Новое правило"}
|
|
200
|
+
{editingId ? t("Редактирование правила") : t("Новое правило")}
|
|
188
201
|
</h2>
|
|
189
202
|
{editingId ? (
|
|
190
|
-
<
|
|
203
|
+
<Button
|
|
204
|
+
variant="outline"
|
|
205
|
+
size="sm"
|
|
191
206
|
type="button"
|
|
192
207
|
onClick={resetForm}
|
|
193
|
-
className="text-sm text-zinc-600 hover:underline dark:text-zinc-400"
|
|
194
208
|
>
|
|
195
|
-
Отменить
|
|
196
|
-
</
|
|
209
|
+
{t("Отменить")}
|
|
210
|
+
</Button>
|
|
197
211
|
) : null}
|
|
198
212
|
</div>
|
|
199
213
|
|
|
200
214
|
<div className="grid gap-3 md:grid-cols-2 lg:grid-cols-4">
|
|
201
215
|
<Input
|
|
202
|
-
label="Название"
|
|
216
|
+
label={t("Название")}
|
|
203
217
|
value={form.name}
|
|
204
218
|
onChange={(value) => setForm({ ...form, name: value })}
|
|
205
219
|
/>
|
|
@@ -212,7 +226,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
212
226
|
/>
|
|
213
227
|
<label className="space-y-1 text-sm">
|
|
214
228
|
<span>Platform</span>
|
|
215
|
-
<
|
|
229
|
+
<NativeSelect
|
|
216
230
|
value={form.platform}
|
|
217
231
|
onChange={(event) =>
|
|
218
232
|
setForm({
|
|
@@ -220,11 +234,11 @@ export default function EmergencyRedirectsPage() {
|
|
|
220
234
|
platform: event.target.value as "ios" | "android",
|
|
221
235
|
})
|
|
222
236
|
}
|
|
223
|
-
className="w-full rounded-md border border-
|
|
237
|
+
className="w-full rounded-md border border-input bg-background px-3 py-2 "
|
|
224
238
|
>
|
|
225
239
|
<option value="android">Android</option>
|
|
226
240
|
<option value="ios">iOS</option>
|
|
227
|
-
</
|
|
241
|
+
</NativeSelect>
|
|
228
242
|
</label>
|
|
229
243
|
<Input
|
|
230
244
|
label="Embedded update ID"
|
|
@@ -245,7 +259,7 @@ export default function EmergencyRedirectsPage() {
|
|
|
245
259
|
/>
|
|
246
260
|
<label className="space-y-1 text-sm">
|
|
247
261
|
<span>Target mode</span>
|
|
248
|
-
<
|
|
262
|
+
<NativeSelect
|
|
249
263
|
value={form.targetMode}
|
|
250
264
|
onChange={(event) =>
|
|
251
265
|
setForm({
|
|
@@ -253,11 +267,11 @@ export default function EmergencyRedirectsPage() {
|
|
|
253
267
|
targetMode: event.target.value as "pinned" | "follow",
|
|
254
268
|
})
|
|
255
269
|
}
|
|
256
|
-
className="w-full rounded-md border border-
|
|
270
|
+
className="w-full rounded-md border border-input bg-background px-3 py-2 "
|
|
257
271
|
>
|
|
258
272
|
<option value="pinned">Pinned update</option>
|
|
259
273
|
<option value="follow">Follow channel</option>
|
|
260
|
-
</
|
|
274
|
+
</NativeSelect>
|
|
261
275
|
</label>
|
|
262
276
|
<Input
|
|
263
277
|
label={
|
|
@@ -275,133 +289,152 @@ export default function EmergencyRedirectsPage() {
|
|
|
275
289
|
|
|
276
290
|
<label className="flex items-center gap-2 text-sm">
|
|
277
291
|
<input
|
|
292
|
+
className="size-4 rounded border-input accent-primary"
|
|
278
293
|
type="checkbox"
|
|
279
294
|
checked={form.enabled}
|
|
280
295
|
onChange={(event) =>
|
|
281
296
|
setForm({ ...form, enabled: event.target.checked })
|
|
282
297
|
}
|
|
283
298
|
/>
|
|
284
|
-
Включить правило сразу после сохранения
|
|
299
|
+
{t("Включить правило сразу после сохранения")}
|
|
285
300
|
</label>
|
|
286
301
|
|
|
287
|
-
<
|
|
288
|
-
type="submit"
|
|
289
|
-
disabled={saving}
|
|
290
|
-
className="rounded-md bg-zinc-900 px-4 py-2 text-sm text-white disabled:opacity-60 dark:bg-zinc-100 dark:text-zinc-900"
|
|
291
|
-
>
|
|
302
|
+
<Button variant="default" size="sm" type="submit" disabled={saving}>
|
|
292
303
|
{saving
|
|
293
|
-
? "Сохранение..."
|
|
304
|
+
? t("Сохранение...")
|
|
294
305
|
: editingId
|
|
295
|
-
? "Сохранить изменения"
|
|
296
|
-
: "Создать redirect"}
|
|
297
|
-
</
|
|
306
|
+
? t("Сохранить изменения")
|
|
307
|
+
: t("Создать redirect")}
|
|
308
|
+
</Button>
|
|
298
309
|
</form>
|
|
299
310
|
) : null}
|
|
300
311
|
|
|
301
|
-
<
|
|
312
|
+
<Card className="gap-0 overflow-hidden py-0 shadow-none">
|
|
302
313
|
<div className="overflow-x-auto">
|
|
303
|
-
<
|
|
304
|
-
<
|
|
305
|
-
<
|
|
306
|
-
<
|
|
307
|
-
<
|
|
308
|
-
<
|
|
309
|
-
<
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
<
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
<Table className="min-w-full text-sm">
|
|
315
|
+
<TableHeader className="bg-muted/40">
|
|
316
|
+
<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
|
+
<TableHead className="px-4 py-3 text-left">
|
|
321
|
+
Redirect
|
|
322
|
+
</TableHead>
|
|
323
|
+
<TableHead className="px-4 py-3 text-left">Target</TableHead>
|
|
324
|
+
<TableHead className="px-4 py-3 text-left">
|
|
325
|
+
Embedded ID
|
|
326
|
+
</TableHead>
|
|
327
|
+
<TableHead className="px-4 py-3 text-left">Actions</TableHead>
|
|
328
|
+
</TableRow>
|
|
329
|
+
</TableHeader>
|
|
330
|
+
<TableBody>
|
|
316
331
|
{loading ? (
|
|
317
|
-
<
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
332
|
+
<TableRow>
|
|
333
|
+
<TableCell
|
|
334
|
+
colSpan={7}
|
|
335
|
+
className="h-32 px-4 py-3 text-center text-muted-foreground"
|
|
336
|
+
>
|
|
337
|
+
{t("Загрузка...")}
|
|
338
|
+
</TableCell>
|
|
339
|
+
</TableRow>
|
|
322
340
|
) : null}
|
|
323
341
|
{!loading && items.length === 0 ? (
|
|
324
|
-
<
|
|
325
|
-
<
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
342
|
+
<TableRow>
|
|
343
|
+
<TableCell
|
|
344
|
+
colSpan={7}
|
|
345
|
+
className="h-32 px-4 py-3 text-center text-muted-foreground"
|
|
346
|
+
>
|
|
347
|
+
{t("Emergency redirects не настроены")}
|
|
348
|
+
</TableCell>
|
|
349
|
+
</TableRow>
|
|
329
350
|
) : null}
|
|
330
351
|
{!loading
|
|
331
352
|
? items.map((item) => (
|
|
332
|
-
<
|
|
353
|
+
<TableRow
|
|
333
354
|
key={item.id}
|
|
334
|
-
className="border-t border-
|
|
355
|
+
className="border-t border-border "
|
|
335
356
|
>
|
|
336
|
-
<
|
|
337
|
-
<
|
|
357
|
+
<TableCell className="px-4 py-3">
|
|
358
|
+
<Badge
|
|
359
|
+
variant="secondary"
|
|
338
360
|
className={
|
|
339
361
|
item.enabled
|
|
340
|
-
? "text-emerald-
|
|
341
|
-
: "
|
|
362
|
+
? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
363
|
+
: ""
|
|
342
364
|
}
|
|
343
365
|
>
|
|
344
|
-
{item.enabled ? "
|
|
345
|
-
</
|
|
346
|
-
</
|
|
347
|
-
<
|
|
348
|
-
<
|
|
366
|
+
{item.enabled ? "Enabled" : "Disabled"}
|
|
367
|
+
</Badge>
|
|
368
|
+
</TableCell>
|
|
369
|
+
<TableCell className="px-4 py-3">{item.name}</TableCell>
|
|
370
|
+
<TableCell className="px-4 py-3">
|
|
349
371
|
{item.runtimeVersion} / {item.platform}
|
|
350
|
-
</
|
|
351
|
-
<
|
|
372
|
+
</TableCell>
|
|
373
|
+
<TableCell className="px-4 py-3">
|
|
352
374
|
{item.fromChannel} → {item.toChannel}
|
|
353
|
-
</
|
|
354
|
-
<
|
|
355
|
-
<
|
|
375
|
+
</TableCell>
|
|
376
|
+
<TableCell className="px-4 py-3">
|
|
377
|
+
<Badge variant="outline">{item.targetMode}</Badge>
|
|
356
378
|
{item.expectedUpdateId ? (
|
|
357
|
-
<div
|
|
379
|
+
<div
|
|
380
|
+
title={item.expectedUpdateId}
|
|
381
|
+
className="mt-1.5 max-w-36 truncate font-mono text-xs text-muted-foreground select-all"
|
|
382
|
+
>
|
|
358
383
|
{item.expectedUpdateId}
|
|
359
384
|
</div>
|
|
360
385
|
) : null}
|
|
361
|
-
</
|
|
362
|
-
<
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
386
|
+
</TableCell>
|
|
387
|
+
<TableCell className="px-4 py-3 font-mono text-xs">
|
|
388
|
+
<span
|
|
389
|
+
className="block max-w-40 truncate select-all"
|
|
390
|
+
title={item.embeddedUpdateId}
|
|
391
|
+
>
|
|
392
|
+
{item.embeddedUpdateId}
|
|
393
|
+
</span>
|
|
394
|
+
</TableCell>
|
|
395
|
+
<TableCell className="px-4 py-3">
|
|
366
396
|
{canWrite ? (
|
|
367
397
|
<div className="flex gap-2">
|
|
368
|
-
<
|
|
398
|
+
<Button
|
|
399
|
+
variant="outline"
|
|
400
|
+
size="sm"
|
|
369
401
|
type="button"
|
|
370
402
|
onClick={() => edit(item)}
|
|
371
|
-
className="text-blue-600 hover:underline dark:text-blue-400"
|
|
372
403
|
>
|
|
373
404
|
Edit
|
|
374
|
-
</
|
|
375
|
-
<
|
|
405
|
+
</Button>
|
|
406
|
+
<Button
|
|
407
|
+
variant="outline"
|
|
408
|
+
size="sm"
|
|
376
409
|
type="button"
|
|
377
410
|
onClick={() => void toggle(item)}
|
|
378
|
-
className="text-amber-700 hover:underline dark:text-amber-400"
|
|
379
411
|
>
|
|
380
412
|
{item.enabled ? "Disable" : "Enable"}
|
|
381
|
-
</
|
|
382
|
-
<
|
|
413
|
+
</Button>
|
|
414
|
+
<Button
|
|
415
|
+
variant="destructive"
|
|
416
|
+
size="sm"
|
|
383
417
|
type="button"
|
|
384
418
|
onClick={() => void remove(item)}
|
|
385
|
-
className="text-red-600 hover:underline dark:text-red-400"
|
|
386
419
|
>
|
|
387
420
|
Delete
|
|
388
|
-
</
|
|
421
|
+
</Button>
|
|
389
422
|
</div>
|
|
390
423
|
) : (
|
|
391
|
-
<span className="text-xs text-
|
|
424
|
+
<span className="text-xs text-muted-foreground">
|
|
392
425
|
Read only
|
|
393
426
|
</span>
|
|
394
427
|
)}
|
|
395
|
-
</
|
|
396
|
-
</
|
|
428
|
+
</TableCell>
|
|
429
|
+
</TableRow>
|
|
397
430
|
))
|
|
398
431
|
: null}
|
|
399
|
-
</
|
|
400
|
-
</
|
|
432
|
+
</TableBody>
|
|
433
|
+
</Table>
|
|
401
434
|
</div>
|
|
402
|
-
</
|
|
435
|
+
</Card>
|
|
403
436
|
</div>
|
|
404
|
-
</
|
|
437
|
+
</div>
|
|
405
438
|
);
|
|
406
439
|
}
|
|
407
440
|
|
|
@@ -419,11 +452,11 @@ function Input({
|
|
|
419
452
|
return (
|
|
420
453
|
<label className="space-y-1 text-sm">
|
|
421
454
|
<span>{label}</span>
|
|
422
|
-
<
|
|
455
|
+
<TextInput
|
|
423
456
|
value={value}
|
|
424
457
|
required={required}
|
|
425
458
|
onChange={(event) => onChange(event.target.value)}
|
|
426
|
-
className="w-full rounded-md border border-
|
|
459
|
+
className="w-full rounded-md border border-input bg-background px-3 py-2 "
|
|
427
460
|
/>
|
|
428
461
|
</label>
|
|
429
462
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getAdminSessionFromServerCookies } from "@/src/server/lib/admin-auth";
|
|
2
|
+
import { AdminShell } from "@/components/admin/admin-shell";
|
|
2
3
|
import { redirect } from "next/navigation";
|
|
3
4
|
|
|
4
5
|
export default async function UpdatesLayout({
|
|
@@ -10,5 +11,9 @@ export default async function UpdatesLayout({
|
|
|
10
11
|
redirect("/login");
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
return
|
|
14
|
+
return (
|
|
15
|
+
<AdminShell session={{ username: session.username, role: session.role }}>
|
|
16
|
+
{children}
|
|
17
|
+
</AdminShell>
|
|
18
|
+
);
|
|
14
19
|
}
|