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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
3
|
|
|
4
|
-
import { RefreshCw, SlidersHorizontal, X } from "lucide-react";
|
|
4
|
+
import { ChevronDown, RefreshCw, SlidersHorizontal, X } from "lucide-react";
|
|
5
5
|
import { Button } from "@/components/ui/button";
|
|
6
6
|
import { Input } from "@/components/ui/input";
|
|
7
7
|
import { Label } from "@/components/ui/label";
|
|
@@ -10,172 +10,173 @@ import {
|
|
|
10
10
|
NativeSelectOption,
|
|
11
11
|
} from "@/components/ui/native-select";
|
|
12
12
|
import { Badge } from "@/components/ui/badge";
|
|
13
|
+
import {
|
|
14
|
+
Collapsible,
|
|
15
|
+
CollapsibleTrigger,
|
|
16
|
+
CollapsibleContent,
|
|
17
|
+
} from "@/components/ui/collapsible";
|
|
13
18
|
import { Card, CardContent } from "@/components/ui/card";
|
|
14
19
|
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
|
|
15
20
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "@/src/client/devices/use-devices-report";
|
|
21
|
+
import { Overview, useKindNames } from "@/src/client/devices/analytics";
|
|
22
|
+
import { Cohorts } from "@/src/client/devices/cohorts";
|
|
23
|
+
import { VersionAdoptionChart } from "@/src/client/devices/version-adoption-chart";
|
|
24
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
25
|
+
import { Registry, VersionTable } from "@/src/client/devices/registry";
|
|
26
|
+
import { useDevicesReport } from "@/src/client/devices/use-devices-report";
|
|
22
27
|
export default function DevicesPage() {
|
|
23
28
|
const { t, formatLocale } = useI18n();
|
|
24
29
|
const kindNames = useKindNames();
|
|
25
30
|
const {
|
|
26
31
|
filters,
|
|
27
|
-
|
|
28
|
-
applied,
|
|
32
|
+
update,
|
|
29
33
|
report,
|
|
30
34
|
error,
|
|
31
35
|
loading,
|
|
32
|
-
apply,
|
|
33
36
|
reset,
|
|
34
37
|
refresh,
|
|
35
38
|
paginate,
|
|
36
39
|
} = useDevicesReport();
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
([key, value]) => key !== "days" && value,
|
|
40
|
+
const activeFilters = Object.entries(filters).filter(
|
|
41
|
+
([key, value]) => key !== "days" && value.trim(),
|
|
40
42
|
).length;
|
|
41
|
-
const update = (key: keyof Filters, value: string) =>
|
|
42
|
-
setFilters((previous) => ({ ...previous, [key]: value }));
|
|
43
43
|
const options = report?.options;
|
|
44
|
+
const period =
|
|
45
|
+
filters.days === "1" ? t("24 часа") : t("{0} дней", [filters.days]);
|
|
44
46
|
return (
|
|
45
|
-
<
|
|
46
|
-
<header className="flex flex-wrap items-
|
|
47
|
+
<div className="mx-auto w-full max-w-[1600px] space-y-5 p-4 md:p-8">
|
|
48
|
+
<header className="flex flex-wrap items-center justify-between gap-3">
|
|
47
49
|
<div>
|
|
48
|
-
<
|
|
49
|
-
{t("Аналитика приложения")}
|
|
50
|
-
</p>
|
|
51
|
-
<h1 className="text-2xl font-semibold tracking-tight md:text-[28px]">
|
|
50
|
+
<h1 className="text-3xl font-semibold tracking-tight">
|
|
52
51
|
{t("Установки")}
|
|
53
52
|
</h1>
|
|
54
|
-
<p className="mt-1 text-sm text-muted-foreground">
|
|
55
|
-
{t("
|
|
53
|
+
<p className="mt-1.5 text-sm text-muted-foreground">
|
|
54
|
+
{t("Versions and activity reported by app installations.")}
|
|
56
55
|
</p>
|
|
57
56
|
</div>
|
|
58
|
-
<Button
|
|
57
|
+
<Button
|
|
58
|
+
size="sm"
|
|
59
|
+
disabled={loading}
|
|
60
|
+
onClick={refresh}
|
|
61
|
+
>
|
|
59
62
|
<RefreshCw
|
|
60
63
|
className={loading ? "animate-spin motion-reduce:animate-none" : ""}
|
|
61
64
|
/>
|
|
62
65
|
{loading ? t("Обновление…") : t("Обновить")}
|
|
63
66
|
</Button>
|
|
64
67
|
</header>
|
|
65
|
-
<Card className="gap-0 py-
|
|
66
|
-
<CardContent>
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
{t("Фильтры")}
|
|
70
|
-
{activeFilters > 0 && (
|
|
71
|
-
<Badge variant="secondary">{activeFilters}</Badge>
|
|
72
|
-
)}
|
|
73
|
-
<span className="ml-auto text-xs font-normal text-muted-foreground">
|
|
74
|
-
{t("Вся выборка")}
|
|
75
|
-
</span>
|
|
76
|
-
</div>
|
|
77
|
-
<form
|
|
78
|
-
onSubmit={(e) => {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
apply();
|
|
81
|
-
}}
|
|
82
|
-
className="grid grid-cols-2 items-end gap-3 lg:grid-cols-3 2xl:grid-cols-6"
|
|
83
|
-
>
|
|
84
|
-
<Filter
|
|
85
|
-
label={t("Период активности")}
|
|
86
|
-
id="days"
|
|
87
|
-
value={filters.days}
|
|
88
|
-
onChange={(v) => update("days", v)}
|
|
89
|
-
items={[
|
|
90
|
-
["1", t("24 часа")],
|
|
91
|
-
["7", t("7 дней")],
|
|
92
|
-
["30", t("30 дней")],
|
|
93
|
-
]}
|
|
94
|
-
/>
|
|
95
|
-
<Filter
|
|
96
|
-
label={t("Платформа")}
|
|
97
|
-
id="platform"
|
|
98
|
-
value={filters.platform}
|
|
99
|
-
onChange={(v) => update("platform", v)}
|
|
100
|
-
items={[
|
|
101
|
-
["", t("Все платформы")],
|
|
102
|
-
...["android", "ios"].map((v) => [
|
|
103
|
-
v,
|
|
104
|
-
v === "ios" ? "iOS" : "Android",
|
|
105
|
-
]),
|
|
106
|
-
]}
|
|
107
|
-
/>
|
|
108
|
-
<Filter
|
|
109
|
-
label={t("Канал")}
|
|
110
|
-
id="channel"
|
|
111
|
-
value={filters.channel}
|
|
112
|
-
onChange={(v) => update("channel", v)}
|
|
113
|
-
items={[
|
|
114
|
-
["", t("Все каналы")],
|
|
115
|
-
...(options?.channels || []).map((v) => [v, v]),
|
|
116
|
-
]}
|
|
117
|
-
/>
|
|
118
|
-
<Filter
|
|
119
|
-
label="Runtime"
|
|
120
|
-
id="runtime"
|
|
121
|
-
value={filters.runtime}
|
|
122
|
-
onChange={(v) => update("runtime", v)}
|
|
123
|
-
items={[
|
|
124
|
-
["", t("Все runtime")],
|
|
125
|
-
...(options?.runtimes || []).map((v) => [v, v]),
|
|
126
|
-
]}
|
|
127
|
-
/>
|
|
128
|
-
<Filter
|
|
129
|
-
label={t("Тип запуска")}
|
|
130
|
-
id="launchKind"
|
|
131
|
-
value={filters.launchKind}
|
|
132
|
-
onChange={(v) => update("launchKind", v)}
|
|
133
|
-
items={[["", t("Все типы")], ...Object.entries(kindNames)]}
|
|
134
|
-
/>
|
|
135
|
-
<div className="grid gap-2">
|
|
136
|
-
<Label htmlFor="installation-search">Installation ID</Label>
|
|
137
|
-
<Input
|
|
138
|
-
id="installation-search"
|
|
139
|
-
placeholder={t("ID или часть ID")}
|
|
140
|
-
value={filters.search}
|
|
141
|
-
maxLength={36}
|
|
142
|
-
pattern="[a-fA-F0-9\-]*"
|
|
143
|
-
title={t("Часть UUID: цифры, буквы a–f и дефисы")}
|
|
144
|
-
onChange={(e) => update("search", e.target.value)}
|
|
145
|
-
className="bg-background/40"
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
<div className="flex flex-wrap items-center gap-2 col-span-2 lg:col-span-3 2xl:col-span-6">
|
|
149
|
-
<Button type="submit" size="sm" disabled={loading}>
|
|
150
|
-
{t("Применить")}
|
|
151
|
-
</Button>
|
|
68
|
+
<Card className="gap-0 py-0 shadow-none">
|
|
69
|
+
<CardContent className="px-4 sm:px-5">
|
|
70
|
+
<Collapsible className="group/filters">
|
|
71
|
+
<CollapsibleTrigger asChild>
|
|
152
72
|
<Button
|
|
153
|
-
type="button"
|
|
154
|
-
size="sm"
|
|
155
73
|
variant="ghost"
|
|
156
|
-
|
|
157
|
-
|
|
74
|
+
className="h-auto w-full flex-wrap justify-start gap-x-3 gap-y-2 py-3.5 whitespace-normal"
|
|
75
|
+
aria-label={t("Фильтры")}
|
|
158
76
|
>
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<span className="
|
|
164
|
-
|
|
77
|
+
<SlidersHorizontal
|
|
78
|
+
aria-hidden="true"
|
|
79
|
+
className="size-4 text-primary"
|
|
80
|
+
/>
|
|
81
|
+
<span className="font-medium">{t("Фильтры")}</span>
|
|
82
|
+
<span className="border-l pl-3 text-xs text-muted-foreground">
|
|
83
|
+
{period}
|
|
165
84
|
</span>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
85
|
+
{activeFilters > 0 && (
|
|
86
|
+
<Badge variant="info">
|
|
87
|
+
{t("{0} filters applied", [activeFilters])}
|
|
88
|
+
</Badge>
|
|
89
|
+
)}
|
|
90
|
+
<ChevronDown
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
className="ml-auto size-4 text-muted-foreground group-data-[state=open]/filters:rotate-180"
|
|
93
|
+
/>
|
|
94
|
+
</Button>
|
|
95
|
+
</CollapsibleTrigger>
|
|
96
|
+
<CollapsibleContent>
|
|
97
|
+
<div
|
|
98
|
+
className="grid grid-cols-1 items-end gap-3 border-t py-4 min-[380px]:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-6"
|
|
99
|
+
>
|
|
100
|
+
<Filter
|
|
101
|
+
label={t("Период активности")}
|
|
102
|
+
id="days"
|
|
103
|
+
value={filters.days}
|
|
104
|
+
onChange={(v) => update("days", v)}
|
|
105
|
+
items={[
|
|
106
|
+
["1", t("24 часа")],
|
|
107
|
+
["7", t("7 дней")],
|
|
108
|
+
["30", t("30 дней")],
|
|
109
|
+
]}
|
|
110
|
+
/>
|
|
111
|
+
<Filter
|
|
112
|
+
label={t("Платформа")}
|
|
113
|
+
id="platform"
|
|
114
|
+
value={filters.platform}
|
|
115
|
+
onChange={(v) => update("platform", v)}
|
|
116
|
+
items={[
|
|
117
|
+
["", t("Все платформы")],
|
|
118
|
+
...["android", "ios"].map((v) => [
|
|
119
|
+
v,
|
|
120
|
+
v === "ios" ? "iOS" : "Android",
|
|
121
|
+
]),
|
|
122
|
+
]}
|
|
123
|
+
/>
|
|
124
|
+
<Filter
|
|
125
|
+
label={t("Канал")}
|
|
126
|
+
id="channel"
|
|
127
|
+
value={filters.channel}
|
|
128
|
+
onChange={(v) => update("channel", v)}
|
|
129
|
+
items={[
|
|
130
|
+
["", t("Все каналы")],
|
|
131
|
+
...(options?.channels || []).map((v) => [v, v]),
|
|
132
|
+
]}
|
|
133
|
+
/>
|
|
134
|
+
<Filter
|
|
135
|
+
label={t("Runtime")}
|
|
136
|
+
id="runtime"
|
|
137
|
+
value={filters.runtime}
|
|
138
|
+
onChange={(v) => update("runtime", v)}
|
|
139
|
+
items={[
|
|
140
|
+
["", t("Все runtime")],
|
|
141
|
+
...(options?.runtimes || []).map((v) => [v, v]),
|
|
142
|
+
]}
|
|
143
|
+
/>
|
|
144
|
+
<Filter
|
|
145
|
+
label={t("Тип запуска")}
|
|
146
|
+
id="launchKind"
|
|
147
|
+
value={filters.launchKind}
|
|
148
|
+
onChange={(v) => update("launchKind", v)}
|
|
149
|
+
items={[["", t("Все типы")], ...Object.entries(kindNames)]}
|
|
150
|
+
/>
|
|
151
|
+
<div className="grid gap-2">
|
|
152
|
+
<Label htmlFor="installation-search">
|
|
153
|
+
{t("Installation ID")}
|
|
154
|
+
</Label>
|
|
155
|
+
<Input
|
|
156
|
+
id="installation-search"
|
|
157
|
+
placeholder={t("ID или часть ID")}
|
|
158
|
+
value={filters.search}
|
|
159
|
+
maxLength={36}
|
|
160
|
+
pattern="[a-fA-F0-9\-]*"
|
|
161
|
+
title={t("Часть UUID: цифры, буквы a–f и дефисы")}
|
|
162
|
+
onChange={(e) => update("search", e.target.value)}
|
|
163
|
+
className="bg-background/40"
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
<div className="col-span-full flex flex-wrap items-center gap-2">
|
|
167
|
+
<Button
|
|
168
|
+
type="button"
|
|
169
|
+
size="sm"
|
|
170
|
+
variant="ghost"
|
|
171
|
+
onClick={reset}
|
|
172
|
+
>
|
|
173
|
+
<X />
|
|
174
|
+
{t("Сбросить")}
|
|
175
|
+
</Button>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</CollapsibleContent>
|
|
179
|
+
</Collapsible>
|
|
179
180
|
</CardContent>
|
|
180
181
|
</Card>
|
|
181
182
|
{error && (
|
|
@@ -210,20 +211,61 @@ export default function DevicesPage() {
|
|
|
210
211
|
<Skeleton className="h-64 rounded-xl" />
|
|
211
212
|
</div>
|
|
212
213
|
) : report ? (
|
|
213
|
-
<
|
|
214
|
-
|
|
214
|
+
<Tabs
|
|
215
|
+
defaultValue="overview"
|
|
216
|
+
className="min-w-0 gap-4"
|
|
215
217
|
aria-busy={loading}
|
|
216
218
|
>
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
"
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
<div className="flex min-w-0 flex-wrap items-center justify-between gap-3 border-b pb-2">
|
|
220
|
+
<TabsList
|
|
221
|
+
aria-label={t("Аналитика приложения")}
|
|
222
|
+
variant="line"
|
|
223
|
+
className="grid h-auto w-full grid-cols-2 justify-start gap-0 sm:flex sm:w-fit"
|
|
224
|
+
>
|
|
225
|
+
{[
|
|
226
|
+
["overview", t("Overview")],
|
|
227
|
+
["versions", t("Versions")],
|
|
228
|
+
["cohorts", t("Cohorts")],
|
|
229
|
+
["registry", t("Registry")],
|
|
230
|
+
].map(([id, label]) => (
|
|
231
|
+
<TabsTrigger
|
|
232
|
+
value={id}
|
|
233
|
+
key={id}
|
|
234
|
+
className="min-h-9 px-3 after:bottom-0! after:bg-primary"
|
|
235
|
+
>
|
|
236
|
+
{label}
|
|
237
|
+
</TabsTrigger>
|
|
238
|
+
))}
|
|
239
|
+
</TabsList>
|
|
240
|
+
<p className="text-xs text-muted-foreground">
|
|
241
|
+
{t("Данные на {0}", [
|
|
242
|
+
new Date(report.coverage.generatedAt).toLocaleTimeString(
|
|
243
|
+
formatLocale,
|
|
244
|
+
{
|
|
245
|
+
hour: "2-digit",
|
|
246
|
+
minute: "2-digit",
|
|
247
|
+
timeZone: "UTC",
|
|
248
|
+
},
|
|
249
|
+
) + " UTC",
|
|
250
|
+
])}
|
|
251
|
+
</p>
|
|
252
|
+
</div>
|
|
253
|
+
<TabsContent value="overview" className="min-w-0 space-y-4">
|
|
254
|
+
<Overview report={report} />
|
|
255
|
+
</TabsContent>
|
|
256
|
+
<TabsContent value="versions" className="min-w-0 space-y-4">
|
|
257
|
+
<VersionAdoptionChart report={report} />
|
|
258
|
+
<VersionTable report={report} />
|
|
259
|
+
</TabsContent>
|
|
260
|
+
<TabsContent value="cohorts" className="min-w-0">
|
|
261
|
+
<Cohorts report={report} />
|
|
262
|
+
</TabsContent>
|
|
263
|
+
<TabsContent value="registry" className="min-w-0">
|
|
264
|
+
<Registry report={report} loading={loading} paginate={paginate} />
|
|
265
|
+
</TabsContent>
|
|
266
|
+
</Tabs>
|
|
225
267
|
) : null}
|
|
226
|
-
</
|
|
268
|
+
</div>
|
|
227
269
|
);
|
|
228
270
|
}
|
|
229
271
|
function Filter({
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
3
|
+
import { useConfirmAction } from "@/components/admin/confirm-action";
|
|
4
|
+
import type { TranslationMessage } from "@/src/client/i18n/messages";
|
|
2
5
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
6
|
|
|
7
|
+
import { AdminRoleContext } from "@/components/admin/admin-role";
|
|
8
|
+
import { Input } from "@/components/ui/input";
|
|
4
9
|
import { Button } from "@/components/ui/button";
|
|
5
10
|
import { Card } from "@/components/ui/card";
|
|
11
|
+
import { PlatformBadge, ChannelBadge } from "@/components/admin/release-badges";
|
|
6
12
|
import { Badge } from "@/components/ui/badge";
|
|
7
13
|
import {
|
|
8
14
|
Table,
|
|
@@ -18,15 +24,18 @@ import {
|
|
|
18
24
|
getEmbeddedUpdates,
|
|
19
25
|
} from "@/src/client/admin-api";
|
|
20
26
|
import { EmbeddedUpdateItem } from "@/src/client/admin-types";
|
|
21
|
-
import { useCallback, useEffect, useState } from "react";
|
|
27
|
+
import { useContext, useCallback, useEffect, useState } from "react";
|
|
22
28
|
|
|
23
29
|
export default function EmbeddedUpdatesPage() {
|
|
30
|
+
const canWrite = useContext(AdminRoleContext) !== "viewer";
|
|
31
|
+
const [query, setQuery] = useState("");
|
|
32
|
+
const confirmAction = useConfirmAction();
|
|
24
33
|
const { t, formatLocale } = useI18n();
|
|
25
34
|
const [items, setItems] = useState<EmbeddedUpdateItem[]>([]);
|
|
26
35
|
const [loading, setLoading] = useState(true);
|
|
27
36
|
const [deletingId, setDeletingId] = useState<string | null>(null);
|
|
28
37
|
const [error, setError] = useState("");
|
|
29
|
-
const [success, setSuccess] = useState("");
|
|
38
|
+
const [success, setSuccess] = useState<TranslationMessage>("");
|
|
30
39
|
|
|
31
40
|
const loadItems = useCallback(async () => {
|
|
32
41
|
setLoading(true);
|
|
@@ -50,8 +59,10 @@ export default function EmbeddedUpdatesPage() {
|
|
|
50
59
|
}, [loadItems]);
|
|
51
60
|
|
|
52
61
|
const handleDelete = async (embeddedUpdateId: string) => {
|
|
53
|
-
const confirmed =
|
|
62
|
+
const confirmed = await confirmAction(
|
|
63
|
+
t("Удалить"),
|
|
54
64
|
t("Удалить запись embedded update {0}?", [embeddedUpdateId]),
|
|
65
|
+
true,
|
|
55
66
|
);
|
|
56
67
|
if (!confirmed) {
|
|
57
68
|
return;
|
|
@@ -63,7 +74,10 @@ export default function EmbeddedUpdatesPage() {
|
|
|
63
74
|
|
|
64
75
|
try {
|
|
65
76
|
await deleteEmbeddedUpdate(embeddedUpdateId);
|
|
66
|
-
setSuccess(
|
|
77
|
+
setSuccess({
|
|
78
|
+
key: "Запись удалена: {0}",
|
|
79
|
+
values: [embeddedUpdateId],
|
|
80
|
+
});
|
|
67
81
|
await loadItems();
|
|
68
82
|
} catch (deleteError: unknown) {
|
|
69
83
|
setError(
|
|
@@ -75,54 +89,80 @@ export default function EmbeddedUpdatesPage() {
|
|
|
75
89
|
}
|
|
76
90
|
};
|
|
77
91
|
|
|
92
|
+
const search = query.trim().toLowerCase();
|
|
93
|
+
const visible = items.filter((item) =>
|
|
94
|
+
[item.embeddedUpdateId, item.appVersion, item.platform, item.channel].some(
|
|
95
|
+
(field) => field?.toLowerCase().includes(search),
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
|
|
78
99
|
return (
|
|
79
100
|
<div className="mx-auto max-w-[1600px] space-y-6 p-4 md:p-8">
|
|
80
101
|
<div className="space-y-6">
|
|
81
102
|
<header className="flex flex-wrap items-start justify-between gap-4">
|
|
82
103
|
<div className="space-y-1">
|
|
83
104
|
<h1 className="text-2xl font-semibold tracking-tight">
|
|
84
|
-
Embedded builds
|
|
105
|
+
{t("Embedded builds")}
|
|
85
106
|
</h1>
|
|
86
107
|
<p className="text-sm text-muted-foreground">
|
|
87
108
|
{t("Встроенные версии приложения и регистрация нативных сборок.")}
|
|
88
109
|
</p>
|
|
89
110
|
</div>
|
|
90
|
-
<Badge variant="
|
|
91
|
-
{
|
|
111
|
+
<Badge variant="info" className="px-3 py-1">
|
|
112
|
+
{t("Builds: {0}", [items.length])}
|
|
92
113
|
</Badge>
|
|
93
114
|
</header>
|
|
94
115
|
|
|
95
116
|
{error ? (
|
|
96
|
-
<
|
|
97
|
-
{t(error)}
|
|
98
|
-
</
|
|
117
|
+
<Alert variant="destructive">
|
|
118
|
+
<AlertDescription>{t(error)}</AlertDescription>
|
|
119
|
+
</Alert>
|
|
99
120
|
) : null}
|
|
100
121
|
|
|
101
122
|
{success ? (
|
|
102
|
-
<
|
|
103
|
-
{success}
|
|
104
|
-
</
|
|
123
|
+
<Alert role="status">
|
|
124
|
+
<AlertDescription>{t(success)}</AlertDescription>
|
|
125
|
+
</Alert>
|
|
105
126
|
) : null}
|
|
106
127
|
|
|
107
128
|
<Card className="gap-0 overflow-hidden py-0 shadow-none">
|
|
129
|
+
<div className="flex flex-wrap items-center gap-2 border-b p-4">
|
|
130
|
+
<Input
|
|
131
|
+
type="search"
|
|
132
|
+
className="max-w-md"
|
|
133
|
+
placeholder={t("Search embedded builds")}
|
|
134
|
+
aria-label={t("Search embedded builds")}
|
|
135
|
+
value={query}
|
|
136
|
+
onChange={(event) => setQuery(event.target.value)}
|
|
137
|
+
/>
|
|
138
|
+
{query && (
|
|
139
|
+
<Button variant="ghost" onClick={() => setQuery("")}>
|
|
140
|
+
{t("Сбросить")}
|
|
141
|
+
</Button>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
108
144
|
<div className="overflow-x-auto">
|
|
109
145
|
<Table className="min-w-full text-sm">
|
|
110
146
|
<TableHeader className="bg-muted/40">
|
|
111
147
|
<TableRow>
|
|
112
148
|
<TableHead className="px-4 py-3 text-left">
|
|
113
|
-
Created At
|
|
149
|
+
{t("Created At")}
|
|
114
150
|
</TableHead>
|
|
115
151
|
<TableHead className="px-4 py-3 text-left">
|
|
116
|
-
App version
|
|
152
|
+
{t("App version")}
|
|
117
153
|
</TableHead>
|
|
118
154
|
<TableHead className="px-4 py-3 text-left">
|
|
119
|
-
Platform
|
|
155
|
+
{t("Platform")}
|
|
120
156
|
</TableHead>
|
|
121
|
-
<TableHead className="px-4 py-3 text-left">Channel</TableHead>
|
|
122
157
|
<TableHead className="px-4 py-3 text-left">
|
|
123
|
-
|
|
158
|
+
{t("Channel")}
|
|
159
|
+
</TableHead>
|
|
160
|
+
<TableHead className="px-4 py-3 text-left">
|
|
161
|
+
{t("Embedded ID")}
|
|
162
|
+
</TableHead>
|
|
163
|
+
<TableHead className="px-4 py-3 text-left">
|
|
164
|
+
{t("Action")}
|
|
124
165
|
</TableHead>
|
|
125
|
-
<TableHead className="px-4 py-3 text-left">Action</TableHead>
|
|
126
166
|
</TableRow>
|
|
127
167
|
</TableHeader>
|
|
128
168
|
<TableBody>
|
|
@@ -137,7 +177,7 @@ export default function EmbeddedUpdatesPage() {
|
|
|
137
177
|
</TableRow>
|
|
138
178
|
) : null}
|
|
139
179
|
|
|
140
|
-
{!loading &&
|
|
180
|
+
{!loading && visible.length === 0 ? (
|
|
141
181
|
<TableRow>
|
|
142
182
|
<TableCell
|
|
143
183
|
className="h-36 px-3 py-4 text-center text-muted-foreground"
|
|
@@ -149,7 +189,7 @@ export default function EmbeddedUpdatesPage() {
|
|
|
149
189
|
) : null}
|
|
150
190
|
|
|
151
191
|
{!loading
|
|
152
|
-
?
|
|
192
|
+
? visible.map((item) => (
|
|
153
193
|
<TableRow
|
|
154
194
|
key={item.embeddedUpdateId}
|
|
155
195
|
className="border-t border-border "
|
|
@@ -163,10 +203,10 @@ export default function EmbeddedUpdatesPage() {
|
|
|
163
203
|
{item.appVersion || "—"}
|
|
164
204
|
</TableCell>
|
|
165
205
|
<TableCell className="px-4 py-3">
|
|
166
|
-
{item.platform}
|
|
206
|
+
<PlatformBadge platform={item.platform} />
|
|
167
207
|
</TableCell>
|
|
168
208
|
<TableCell className="px-4 py-3">
|
|
169
|
-
<
|
|
209
|
+
<ChannelBadge channel={item.channel} />
|
|
170
210
|
</TableCell>
|
|
171
211
|
<TableCell className="px-4 py-3 font-mono text-xs">
|
|
172
212
|
<span
|
|
@@ -177,17 +217,23 @@ export default function EmbeddedUpdatesPage() {
|
|
|
177
217
|
</span>
|
|
178
218
|
</TableCell>
|
|
179
219
|
<TableCell className="px-4 py-3">
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
{canWrite ? (
|
|
221
|
+
<Button
|
|
222
|
+
variant="destructive"
|
|
223
|
+
size="sm"
|
|
224
|
+
type="button"
|
|
225
|
+
onClick={() =>
|
|
226
|
+
handleDelete(item.embeddedUpdateId)
|
|
227
|
+
}
|
|
228
|
+
disabled={deletingId === item.embeddedUpdateId}
|
|
229
|
+
>
|
|
230
|
+
{deletingId === item.embeddedUpdateId
|
|
231
|
+
? t("Удаление...")
|
|
232
|
+
: t("Удалить")}
|
|
233
|
+
</Button>
|
|
234
|
+
) : (
|
|
235
|
+
t("Read only")
|
|
236
|
+
)}
|
|
191
237
|
</TableCell>
|
|
192
238
|
</TableRow>
|
|
193
239
|
))
|