create-expo-updates-server 0.3.0 → 0.6.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/README.md +4 -2
- package/dist/template/Dockerfile +4 -6
- package/dist/template/README.md +5 -10
- package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
- package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
- package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
- package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
- package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
- package/dist/template/app/api/admin/updates/route.test.ts +21 -0
- package/dist/template/app/api/admin/updates/route.ts +12 -1
- package/dist/template/app/globals.css +65 -68
- package/dist/template/app/login/page.tsx +66 -42
- package/dist/template/app/updates/[encodedKey]/page.tsx +382 -248
- package/dist/template/app/updates/devices/page.tsx +187 -145
- package/dist/template/app/updates/embedded/page.tsx +80 -34
- package/dist/template/app/updates/emergency-redirects/page.tsx +138 -71
- package/dist/template/app/updates/layout.tsx +2 -1
- package/dist/template/app/updates/page.tsx +385 -274
- package/dist/template/app/updates/releases.test.tsx +156 -0
- package/dist/template/components/admin/admin-role.ts +5 -0
- package/dist/template/components/admin/admin-shell.tsx +166 -95
- package/dist/template/components/admin/confirm-action.tsx +123 -0
- package/dist/template/components/admin/language-switcher.tsx +27 -16
- package/dist/template/components/admin/release-badges.test.tsx +50 -0
- package/dist/template/components/admin/release-badges.tsx +101 -0
- package/dist/template/components/ui/alert.tsx +10 -3
- package/dist/template/components/ui/avatar.tsx +108 -0
- package/dist/template/components/ui/badge.tsx +2 -2
- package/dist/template/components/ui/breadcrumb.tsx +108 -0
- package/dist/template/components/ui/button.tsx +5 -5
- package/dist/template/components/ui/card.tsx +2 -2
- package/dist/template/components/ui/chart.tsx +1 -1
- package/dist/template/components/ui/collapsible.tsx +7 -0
- package/dist/template/components/ui/dialog.tsx +13 -4
- package/dist/template/components/ui/empty.tsx +103 -0
- package/dist/template/components/ui/field.tsx +248 -0
- package/dist/template/components/ui/input-group.tsx +170 -0
- package/dist/template/components/ui/input.tsx +1 -1
- package/dist/template/components/ui/native-select.tsx +1 -1
- package/dist/template/components/ui/radio-group.tsx +41 -0
- package/dist/template/components/ui/sheet.tsx +6 -2
- package/dist/template/components/ui/sidebar.tsx +62 -17
- package/dist/template/components/ui/status-tones.ts +15 -0
- package/dist/template/components/ui/table.tsx +1 -1
- package/dist/template/components/ui/textarea.tsx +1 -1
- package/dist/template/docs/admin-ui.md +22 -24
- package/dist/template/docs/device-targeting.md +6 -12
- package/dist/template/docs/doctor.md +2 -2
- package/dist/template/docs/expo-app-setup.md +9 -27
- package/dist/template/docs/getting-started.md +3 -4
- 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 +6 -12
- package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
- package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
- package/dist/template/docs/migrations/schema.sql +349 -0
- package/dist/template/docs/npm-installer.md +3 -3
- package/dist/template/docs/operations-guide.md +9 -7
- package/dist/template/docs/ota-client-lifecycle.md +30 -68
- package/dist/template/docs/ota-emergency-recovery.md +34 -57
- package/dist/template/docs/ota-update-policy.md +9 -20
- package/dist/template/docs/ru/admin-ui.md +33 -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 +322 -0
- package/dist/template/docs/ru/ota-client-lifecycle.md +162 -0
- package/dist/template/docs/ru/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/ru/ota-update-policy.md +69 -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 +33 -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 +322 -0
- package/dist/template/docs/uk/ota-client-lifecycle.md +162 -0
- package/dist/template/docs/uk/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/uk/ota-update-policy.md +69 -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/lib/audience-ids.ts +4 -0
- package/dist/template/package-lock.json +46 -0
- package/dist/template/package.json +4 -1
- package/dist/template/scripts/configure-expo-app.mjs +3 -3
- package/dist/template/scripts/create-access-token.mjs +1 -1
- package/dist/template/scripts/lib/doctor.mjs +10 -7
- package/dist/template/scripts/lib/doctor.test.mjs +7 -5
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
- package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
- package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
- package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
- package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
- package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
- package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
- package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
- package/dist/template/scripts/tests/e2e/console.mjs +86 -0
- package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
- package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
- package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
- package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
- package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
- package/dist/template/scripts/tests/e2e/release-matrix.mjs +307 -0
- package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
- package/dist/template/scripts/tests/e2e/run.mjs +224 -0
- package/dist/template/scripts/tests/manifest-identity.sql +7 -5
- package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
- package/dist/template/src/client/admin-api.ts +45 -10
- package/dist/template/src/client/admin-types.ts +35 -1
- package/dist/template/src/client/devices/analytics.tsx +169 -219
- package/dist/template/src/client/devices/cohorts.tsx +181 -0
- package/dist/template/src/client/devices/device-name.tsx +37 -21
- package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
- package/dist/template/src/client/devices/registry.tsx +265 -233
- package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
- package/dist/template/src/client/devices/use-devices-report.ts +53 -82
- package/dist/template/src/client/devices/version-adoption-chart.tsx +48 -38
- package/dist/template/src/client/distribution-control.tsx +98 -53
- package/dist/template/src/client/distribution-history.tsx +353 -0
- package/dist/template/src/client/guard-action-catalog.tsx +183 -0
- package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
- package/dist/template/src/client/guard-action-combobox.tsx +134 -234
- package/dist/template/src/client/guard-action-options.ts +4 -6
- package/dist/template/src/client/i18n/en.json +335 -2
- package/dist/template/src/client/i18n/language-switching.test.tsx +233 -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 +619 -0
- package/dist/template/src/client/i18n/uk.json +619 -0
- package/dist/template/src/client/i18n/use-formatters.ts +5 -0
- package/dist/template/src/client/logout-button.tsx +3 -3
- package/dist/template/src/client/policy-draft.ts +138 -0
- package/dist/template/src/client/update-audience-editor.tsx +597 -199
- package/dist/template/src/client/update-policy-editor.test.ts +101 -29
- package/dist/template/src/client/update-policy-editor.tsx +466 -307
- package/dist/template/src/client/use-filtered-results.ts +55 -0
- package/dist/template/src/server/controllers/manifest.test.ts +23 -3
- package/dist/template/src/server/controllers/manifest.ts +15 -1
- package/dist/template/src/server/devices/audience.ts +9 -5
- package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
- package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
- package/dist/template/src/server/lib/admin-updates.ts +160 -534
- package/dist/template/src/server/lib/distribution-history.ts +97 -0
- package/dist/template/src/server/lib/supabase.js +24 -0
- package/dist/template/src/server/lib/supabase.test.ts +38 -1
- package/dist/template/src/server/lib/update-policy.test.ts +20 -0
- package/dist/template/src/server/lib/update-policy.ts +23 -10
- package/dist/template/src/server/manifest/manifest-repository.ts +11 -3
- package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
- package/dist/template/src/server/manifest/manifest-values.ts +21 -13
- package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
- package/dist/template/tsconfig.json +2 -2
- package/dist/template-manifest.json +571 -271
- package/package.json +1 -1
- package/dist/template/scripts/lib/device-identity.test.ts +0 -29
- package/dist/template/scripts/lib/ota-client.test.ts +0 -55
- package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
- package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
- package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
- package/dist/template/templates/expo-app/ota-client/README.md +0 -73
- package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
- package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
- package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
- package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
- package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
- package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
- package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
|
@@ -3,9 +3,16 @@ import { useFormatters } from "@/src/client/i18n/use-formatters";
|
|
|
3
3
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
4
4
|
|
|
5
5
|
import { DeviceName } from "./device-name";
|
|
6
|
-
import {
|
|
6
|
+
import { AdminRoleContext } from "@/components/admin/admin-role";
|
|
7
|
+
import { BookmarkTarget, useFavoriteTargets } from "./favorite-targets";
|
|
8
|
+
import { useContext, useRef, useState } from "react";
|
|
7
9
|
import { Copy, Check, ChevronLeft, ChevronRight, Search } from "lucide-react";
|
|
8
10
|
import { Button } from "@/components/ui/button";
|
|
11
|
+
import {
|
|
12
|
+
PlatformBadge,
|
|
13
|
+
ChannelBadge,
|
|
14
|
+
launchKindTone,
|
|
15
|
+
} from "@/components/admin/release-badges";
|
|
9
16
|
import { Badge } from "@/components/ui/badge";
|
|
10
17
|
import {
|
|
11
18
|
Card,
|
|
@@ -14,7 +21,6 @@ import {
|
|
|
14
21
|
CardDescription,
|
|
15
22
|
CardContent,
|
|
16
23
|
} from "@/components/ui/card";
|
|
17
|
-
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
|
|
18
24
|
import {
|
|
19
25
|
Table,
|
|
20
26
|
TableHeader,
|
|
@@ -34,7 +40,7 @@ import type {
|
|
|
34
40
|
DeviceInstallation,
|
|
35
41
|
DevicesReport,
|
|
36
42
|
} from "@/src/server/devices/report-types";
|
|
37
|
-
import { useKindNames
|
|
43
|
+
import { useKindNames } from "./analytics";
|
|
38
44
|
function CopyValue({ value }: { value: string }) {
|
|
39
45
|
const { t } = useI18n();
|
|
40
46
|
const [state, setState] = useState<"idle" | "copied" | "failed">("idle");
|
|
@@ -85,15 +91,24 @@ export function Registry({
|
|
|
85
91
|
const { t } = useI18n();
|
|
86
92
|
const opener = useRef<HTMLButtonElement | null>(null);
|
|
87
93
|
const kindNames = useKindNames();
|
|
88
|
-
const { number, fullDate } = useFormatters();
|
|
94
|
+
const { number, fullDate, calendarDate } = useFormatters();
|
|
89
95
|
const [selected, setSelected] = useState<DeviceInstallation | null>(null);
|
|
96
|
+
const role = useContext(AdminRoleContext);
|
|
97
|
+
const canBookmark = role === "admin" || role === "operator";
|
|
98
|
+
const personal = useFavoriteTargets(
|
|
99
|
+
selected?.platform ?? "",
|
|
100
|
+
!!selected && canBookmark,
|
|
101
|
+
0,
|
|
102
|
+
);
|
|
90
103
|
return (
|
|
91
104
|
<>
|
|
92
105
|
<Card className="min-w-0 shadow-none">
|
|
93
106
|
<CardHeader>
|
|
94
107
|
<div className="flex flex-wrap items-center gap-3">
|
|
95
|
-
<CardTitle>
|
|
96
|
-
|
|
108
|
+
<CardTitle>
|
|
109
|
+
<h2>{t("Реестр установок")}</h2>
|
|
110
|
+
</CardTitle>
|
|
111
|
+
<Badge variant="info">{number(report.total)}</Badge>
|
|
97
112
|
</div>
|
|
98
113
|
<CardDescription>
|
|
99
114
|
{t(
|
|
@@ -101,225 +116,136 @@ export function Registry({
|
|
|
101
116
|
)}
|
|
102
117
|
</CardDescription>
|
|
103
118
|
</CardHeader>
|
|
104
|
-
<CardContent>
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
{t("
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</TableCell>
|
|
178
|
-
<TableCell>
|
|
179
|
-
<Badge
|
|
180
|
-
variant={
|
|
181
|
-
d.launch_kind === "ota" ? "default" : "secondary"
|
|
182
|
-
}
|
|
183
|
-
>
|
|
184
|
-
{kindNames[d.launch_kind]}
|
|
185
|
-
</Badge>
|
|
186
|
-
{d.emergency_launch && (
|
|
187
|
-
<Badge
|
|
188
|
-
variant="destructive"
|
|
189
|
-
className="mt-1 block w-fit"
|
|
190
|
-
>
|
|
191
|
-
Emergency
|
|
192
|
-
</Badge>
|
|
193
|
-
)}
|
|
194
|
-
</TableCell>
|
|
195
|
-
<TableCell className="text-xs tabular-nums">
|
|
196
|
-
{fullDate(d.last_seen_at).replace(" UTC", "")}
|
|
197
|
-
</TableCell>
|
|
198
|
-
</TableRow>
|
|
199
|
-
))}
|
|
200
|
-
</TableBody>
|
|
201
|
-
</Table>
|
|
202
|
-
{!report.devices.length && (
|
|
203
|
-
<div className="flex flex-col items-center gap-2 py-12 text-center">
|
|
204
|
-
<Search className="size-6 text-muted-foreground" />
|
|
205
|
-
<p className="text-sm font-medium">
|
|
206
|
-
{t("Установки не найдены")}
|
|
207
|
-
</p>
|
|
208
|
-
<p className="max-w-sm text-xs leading-5 text-muted-foreground">
|
|
209
|
-
{t(
|
|
210
|
-
"Измените фильтры или дождитесь heartbeat от приложения с подключённой телеметрией.",
|
|
119
|
+
<CardContent className="min-w-0 px-4 sm:px-6">
|
|
120
|
+
<Table aria-label={t("Реестр установок")}>
|
|
121
|
+
<TableHeader>
|
|
122
|
+
<TableRow>
|
|
123
|
+
<TableHead>{t("Установка")}</TableHead>
|
|
124
|
+
<TableHead>{t("Платформа / канал")}</TableHead>
|
|
125
|
+
<TableHead>{t("Версия")}</TableHead>
|
|
126
|
+
<TableHead>{t("Запуск")}</TableHead>
|
|
127
|
+
<TableHead>{t("Последняя связь · UTC")}</TableHead>
|
|
128
|
+
</TableRow>
|
|
129
|
+
</TableHeader>
|
|
130
|
+
<TableBody>
|
|
131
|
+
{report.devices.map((d) => (
|
|
132
|
+
<TableRow key={`${d.platform}:${d.installation_id}`}>
|
|
133
|
+
<TableCell>
|
|
134
|
+
<Button
|
|
135
|
+
variant="link"
|
|
136
|
+
className="h-auto p-0 font-mono text-xs"
|
|
137
|
+
title={d.installation_id}
|
|
138
|
+
onClick={(event) => {
|
|
139
|
+
opener.current = event.currentTarget;
|
|
140
|
+
setSelected(d);
|
|
141
|
+
}}
|
|
142
|
+
aria-label={t("Детали установки {0}", [
|
|
143
|
+
d.installation_id,
|
|
144
|
+
])}
|
|
145
|
+
>
|
|
146
|
+
{d.installation_id.slice(0, 8)}…
|
|
147
|
+
{d.installation_id.slice(-4)}
|
|
148
|
+
</Button>
|
|
149
|
+
<p className="mt-1 text-xs text-muted-foreground">
|
|
150
|
+
{t("С ")}
|
|
151
|
+
{calendarDate(d.first_seen_at)}
|
|
152
|
+
</p>
|
|
153
|
+
</TableCell>
|
|
154
|
+
<TableCell>
|
|
155
|
+
<div className="flex max-w-52 flex-wrap items-center gap-1">
|
|
156
|
+
<PlatformBadge platform={d.platform} />
|
|
157
|
+
<ChannelBadge channel={d.channel} />
|
|
158
|
+
</div>
|
|
159
|
+
</TableCell>
|
|
160
|
+
<TableCell>
|
|
161
|
+
<p
|
|
162
|
+
className="max-w-56 truncate text-sm"
|
|
163
|
+
title={
|
|
164
|
+
d.update_label ||
|
|
165
|
+
d.resolved_update_id ||
|
|
166
|
+
kindNames[d.launch_kind]
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
{d.update_label ||
|
|
170
|
+
d.resolved_update_id?.slice(0, 8) ||
|
|
171
|
+
kindNames[d.launch_kind]}
|
|
172
|
+
</p>
|
|
173
|
+
<p
|
|
174
|
+
className="mt-1 text-xs text-muted-foreground"
|
|
175
|
+
title={d.runtime_version}
|
|
176
|
+
>
|
|
177
|
+
{d.runtime_version}
|
|
178
|
+
</p>
|
|
179
|
+
<p className="mt-1 text-xs text-muted-foreground">
|
|
180
|
+
{t("Native")} {d.native_version || "—"} (
|
|
181
|
+
{d.native_build || "—"})
|
|
182
|
+
</p>
|
|
183
|
+
</TableCell>
|
|
184
|
+
<TableCell>
|
|
185
|
+
<Badge variant={launchKindTone[d.launch_kind]}>
|
|
186
|
+
{kindNames[d.launch_kind]}
|
|
187
|
+
</Badge>
|
|
188
|
+
{d.emergency_launch && (
|
|
189
|
+
<Badge variant="destructive" className="mt-1 block w-fit">
|
|
190
|
+
{t("Emergency")}
|
|
191
|
+
</Badge>
|
|
211
192
|
)}
|
|
212
|
-
</
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
</
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
</TableRow>
|
|
269
|
-
</TableHeader>
|
|
270
|
-
<TableBody>
|
|
271
|
-
{report.versions.map((v, i) => (
|
|
272
|
-
<TableRow key={i}>
|
|
273
|
-
<TableCell>
|
|
274
|
-
<p
|
|
275
|
-
className="max-w-56 truncate font-medium"
|
|
276
|
-
title={v.update_label || undefined}
|
|
277
|
-
>
|
|
278
|
-
{v.update_label || kindNames[v.launch_kind]}
|
|
279
|
-
</p>
|
|
280
|
-
{v.update_id && (
|
|
281
|
-
<code
|
|
282
|
-
className="mt-1 block text-xs text-muted-foreground"
|
|
283
|
-
title={v.update_id}
|
|
284
|
-
>
|
|
285
|
-
{v.update_id}
|
|
286
|
-
</code>
|
|
287
|
-
)}
|
|
288
|
-
</TableCell>
|
|
289
|
-
<TableCell>
|
|
290
|
-
{v.platform}
|
|
291
|
-
<p className="text-xs text-muted-foreground">
|
|
292
|
-
{v.channel}
|
|
293
|
-
</p>
|
|
294
|
-
</TableCell>
|
|
295
|
-
<TableCell>
|
|
296
|
-
{v.runtime_version}
|
|
297
|
-
<p className="text-xs text-muted-foreground">
|
|
298
|
-
{v.native_version || "—"} ({v.native_build || "—"})
|
|
299
|
-
</p>
|
|
300
|
-
</TableCell>
|
|
301
|
-
<TableCell>
|
|
302
|
-
<Badge variant="secondary">
|
|
303
|
-
{kindNames[v.launch_kind]}
|
|
304
|
-
</Badge>
|
|
305
|
-
</TableCell>
|
|
306
|
-
<TableCell className="text-right tabular-nums">
|
|
307
|
-
{number(v.installations)}
|
|
308
|
-
</TableCell>
|
|
309
|
-
<TableCell className="text-right tabular-nums">
|
|
310
|
-
{percent(v.installations, report.total)}
|
|
311
|
-
</TableCell>
|
|
312
|
-
</TableRow>
|
|
313
|
-
))}
|
|
314
|
-
</TableBody>
|
|
315
|
-
</Table>
|
|
316
|
-
{!report.versions.length && (
|
|
317
|
-
<p className="py-8 text-center text-sm text-muted-foreground">
|
|
318
|
-
{t("Нет версий в выбранной выборке.")}
|
|
319
|
-
</p>
|
|
320
|
-
)}
|
|
321
|
-
</TabsContent>
|
|
322
|
-
</Tabs>
|
|
193
|
+
</TableCell>
|
|
194
|
+
<TableCell className="text-xs tabular-nums">
|
|
195
|
+
{fullDate(d.last_seen_at).replace(" UTC", "")}
|
|
196
|
+
</TableCell>
|
|
197
|
+
</TableRow>
|
|
198
|
+
))}
|
|
199
|
+
</TableBody>
|
|
200
|
+
</Table>
|
|
201
|
+
{!report.devices.length && (
|
|
202
|
+
<div className="flex flex-col items-center gap-2 py-12 text-center">
|
|
203
|
+
<Search className="size-6 text-muted-foreground" />
|
|
204
|
+
<p className="text-sm font-medium">{t("Установки не найдены")}</p>
|
|
205
|
+
<p className="max-w-sm text-xs leading-5 text-muted-foreground">
|
|
206
|
+
{t(
|
|
207
|
+
"Измените фильтры или дождитесь heartbeat от приложения с подключённой телеметрией.",
|
|
208
|
+
)}
|
|
209
|
+
</p>
|
|
210
|
+
</div>
|
|
211
|
+
)}
|
|
212
|
+
<div className="mt-4 flex flex-wrap items-center justify-between gap-3 border-t pt-4">
|
|
213
|
+
<p className="text-xs text-muted-foreground">
|
|
214
|
+
{report.total
|
|
215
|
+
? t("{0}–{1} из {2}", [
|
|
216
|
+
number(report.offset + 1),
|
|
217
|
+
number(
|
|
218
|
+
Math.min(report.offset + report.pageSize, report.total),
|
|
219
|
+
),
|
|
220
|
+
number(report.total),
|
|
221
|
+
])
|
|
222
|
+
: t("0 установок")}
|
|
223
|
+
</p>
|
|
224
|
+
<div className="flex gap-2">
|
|
225
|
+
<Button
|
|
226
|
+
size="sm"
|
|
227
|
+
variant="outline"
|
|
228
|
+
disabled={loading || report.offset === 0}
|
|
229
|
+
onClick={() =>
|
|
230
|
+
paginate(Math.max(0, report.offset - report.pageSize))
|
|
231
|
+
}
|
|
232
|
+
>
|
|
233
|
+
<ChevronLeft />
|
|
234
|
+
{t("Назад")}
|
|
235
|
+
</Button>
|
|
236
|
+
<Button
|
|
237
|
+
size="sm"
|
|
238
|
+
variant="outline"
|
|
239
|
+
disabled={
|
|
240
|
+
loading || report.offset + report.pageSize >= report.total
|
|
241
|
+
}
|
|
242
|
+
onClick={() => paginate(report.offset + report.pageSize)}
|
|
243
|
+
>
|
|
244
|
+
{t("Далее")}
|
|
245
|
+
<ChevronRight />
|
|
246
|
+
</Button>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
323
249
|
</CardContent>
|
|
324
250
|
</Card>
|
|
325
251
|
<Sheet
|
|
@@ -343,6 +269,24 @@ export function Registry({
|
|
|
343
269
|
)}
|
|
344
270
|
</SheetDescription>
|
|
345
271
|
</SheetHeader>
|
|
272
|
+
{selected && canBookmark && (
|
|
273
|
+
<div className="mx-4 space-y-2 sm:mx-6">
|
|
274
|
+
{personal.error && (
|
|
275
|
+
<p role="alert" className="text-sm text-destructive">
|
|
276
|
+
{t(personal.error)}
|
|
277
|
+
</p>
|
|
278
|
+
)}
|
|
279
|
+
<BookmarkTarget
|
|
280
|
+
platform={selected.platform}
|
|
281
|
+
deviceId={selected.device_id ?? null}
|
|
282
|
+
installationId={selected.installation_id}
|
|
283
|
+
displayName={null}
|
|
284
|
+
showLabel
|
|
285
|
+
favorites={personal.favorites ?? []}
|
|
286
|
+
onChanged={personal.refresh}
|
|
287
|
+
/>
|
|
288
|
+
</div>
|
|
289
|
+
)}
|
|
346
290
|
{selected?.device_id && (
|
|
347
291
|
<DeviceName
|
|
348
292
|
key={selected.device_id}
|
|
@@ -351,23 +295,23 @@ export function Registry({
|
|
|
351
295
|
/>
|
|
352
296
|
)}
|
|
353
297
|
{selected && (
|
|
354
|
-
<dl className="
|
|
298
|
+
<dl className="divide-y px-4 pb-6 sm:px-6">
|
|
355
299
|
{[
|
|
356
|
-
["Installation ID", selected.installation_id],
|
|
357
|
-
["Device ID", selected.device_id || "—"],
|
|
300
|
+
[t("Installation ID"), selected.installation_id],
|
|
301
|
+
[t("Device ID"), selected.device_id || "—"],
|
|
358
302
|
[t("Платформа"), selected.platform],
|
|
359
303
|
[t("Канал"), selected.channel],
|
|
360
|
-
["Runtime", selected.runtime_version],
|
|
304
|
+
[t("Runtime"), selected.runtime_version],
|
|
361
305
|
[
|
|
362
|
-
"Native version / build",
|
|
306
|
+
t("Native version / build"),
|
|
363
307
|
`${selected.native_version || "—"} (${selected.native_build || "—"})`,
|
|
364
308
|
],
|
|
365
309
|
[t("Тип запуска"), kindNames[selected.launch_kind]],
|
|
366
310
|
[t("Название обновления"), selected.update_label || "—"],
|
|
367
|
-
["OTA artifact ID", selected.resolved_update_id || "—"],
|
|
368
|
-
["Launch update ID", selected.reported_update_id || "—"],
|
|
311
|
+
[t("OTA artifact ID"), selected.resolved_update_id || "—"],
|
|
312
|
+
[t("Launch update ID"), selected.reported_update_id || "—"],
|
|
369
313
|
[
|
|
370
|
-
"Emergency launch",
|
|
314
|
+
t("Emergency launch"),
|
|
371
315
|
selected.emergency_launch ? t("Да") : t("Нет"),
|
|
372
316
|
],
|
|
373
317
|
[t("Первый heartbeat"), fullDate(selected.first_seen_at)],
|
|
@@ -377,7 +321,10 @@ export function Registry({
|
|
|
377
321
|
fullDate(selected.observed_at),
|
|
378
322
|
],
|
|
379
323
|
].map(([label, value]) => (
|
|
380
|
-
<div
|
|
324
|
+
<div
|
|
325
|
+
key={label}
|
|
326
|
+
className="grid items-start gap-1.5 py-3 sm:grid-cols-[9rem_1fr]"
|
|
327
|
+
>
|
|
381
328
|
<dt className="mb-1 text-xs font-medium text-muted-foreground">
|
|
382
329
|
{label}
|
|
383
330
|
</dt>
|
|
@@ -397,3 +344,88 @@ export function Registry({
|
|
|
397
344
|
</>
|
|
398
345
|
);
|
|
399
346
|
}
|
|
347
|
+
|
|
348
|
+
export function VersionTable({ report }: { report: DevicesReport }) {
|
|
349
|
+
const { t } = useI18n();
|
|
350
|
+
const kindNames = useKindNames();
|
|
351
|
+
const { number, share } = useFormatters();
|
|
352
|
+
return (
|
|
353
|
+
<Card className="min-w-0 gap-4 shadow-none">
|
|
354
|
+
<CardHeader>
|
|
355
|
+
<CardTitle>
|
|
356
|
+
<h2>
|
|
357
|
+
{t("Все версии · ")}
|
|
358
|
+
{number(report.versions.length)}
|
|
359
|
+
</h2>
|
|
360
|
+
</CardTitle>
|
|
361
|
+
<CardDescription>
|
|
362
|
+
{t("Shares across all installations in the selected period.")}
|
|
363
|
+
</CardDescription>
|
|
364
|
+
</CardHeader>
|
|
365
|
+
<CardContent className="min-w-0 px-4 sm:px-6">
|
|
366
|
+
<Table>
|
|
367
|
+
<TableHeader>
|
|
368
|
+
<TableRow>
|
|
369
|
+
<TableHead>{t("Версия / ID")}</TableHead>
|
|
370
|
+
<TableHead>{t("Платформа / канал")}</TableHead>
|
|
371
|
+
<TableHead>{t("Runtime / native")}</TableHead>
|
|
372
|
+
<TableHead>{t("Запуск")}</TableHead>
|
|
373
|
+
<TableHead className="text-right">{t("Установки")}</TableHead>
|
|
374
|
+
<TableHead className="text-right">{t("Доля")}</TableHead>
|
|
375
|
+
</TableRow>
|
|
376
|
+
</TableHeader>
|
|
377
|
+
<TableBody>
|
|
378
|
+
{report.versions.map((v, i) => (
|
|
379
|
+
<TableRow key={i}>
|
|
380
|
+
<TableCell>
|
|
381
|
+
<p
|
|
382
|
+
className="max-w-56 truncate font-medium"
|
|
383
|
+
title={v.update_label || undefined}
|
|
384
|
+
>
|
|
385
|
+
{v.update_label || kindNames[v.launch_kind]}
|
|
386
|
+
</p>
|
|
387
|
+
{v.update_id && (
|
|
388
|
+
<code
|
|
389
|
+
className="mt-1 block text-xs text-muted-foreground"
|
|
390
|
+
title={v.update_id}
|
|
391
|
+
>
|
|
392
|
+
{v.update_id}
|
|
393
|
+
</code>
|
|
394
|
+
)}
|
|
395
|
+
</TableCell>
|
|
396
|
+
<TableCell>
|
|
397
|
+
<div className="flex max-w-52 flex-wrap items-center gap-1">
|
|
398
|
+
<PlatformBadge platform={v.platform} />
|
|
399
|
+
<ChannelBadge channel={v.channel} />
|
|
400
|
+
</div>
|
|
401
|
+
</TableCell>
|
|
402
|
+
<TableCell>
|
|
403
|
+
{v.runtime_version}
|
|
404
|
+
<p className="text-xs text-muted-foreground">
|
|
405
|
+
{v.native_version || "—"} ({v.native_build || "—"})
|
|
406
|
+
</p>
|
|
407
|
+
</TableCell>
|
|
408
|
+
<TableCell>
|
|
409
|
+
<Badge variant={launchKindTone[v.launch_kind]}>
|
|
410
|
+
{kindNames[v.launch_kind]}
|
|
411
|
+
</Badge>
|
|
412
|
+
</TableCell>
|
|
413
|
+
<TableCell className="text-right tabular-nums">
|
|
414
|
+
{number(v.installations)}
|
|
415
|
+
</TableCell>
|
|
416
|
+
<TableCell className="text-right tabular-nums">
|
|
417
|
+
{share(v.installations, report.total)}
|
|
418
|
+
</TableCell>
|
|
419
|
+
</TableRow>
|
|
420
|
+
))}
|
|
421
|
+
</TableBody>
|
|
422
|
+
</Table>
|
|
423
|
+
{!report.versions.length && (
|
|
424
|
+
<p className="py-8 text-center text-sm text-muted-foreground">
|
|
425
|
+
{t("Нет версий в выбранной выборке.")}
|
|
426
|
+
</p>
|
|
427
|
+
)}
|
|
428
|
+
</CardContent>
|
|
429
|
+
</Card>
|
|
430
|
+
);
|
|
431
|
+
}
|