create-expo-updates-server 0.4.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 +4 -9
- 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 +375 -263
- package/dist/template/app/updates/devices/page.tsx +188 -152
- package/dist/template/app/updates/embedded/page.tsx +63 -29
- package/dist/template/app/updates/emergency-redirects/page.tsx +93 -58
- package/dist/template/app/updates/layout.tsx +2 -1
- package/dist/template/app/updates/page.tsx +381 -283
- 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 -101
- package/dist/template/components/admin/confirm-action.tsx +123 -0
- package/dist/template/components/admin/language-switcher.tsx +25 -17
- 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/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/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 +7 -3
- package/dist/template/docs/device-targeting.md +2 -7
- 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/installation-telemetry.md +2 -8
- 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 +8 -6
- package/dist/template/docs/ota-client-lifecycle.md +30 -68
- package/dist/template/docs/ota-update-policy.md +9 -20
- package/dist/template/docs/ru/admin-ui.md +7 -3
- package/dist/template/docs/ru/device-targeting.md +2 -2
- package/dist/template/docs/ru/doctor.md +2 -2
- package/dist/template/docs/ru/expo-app-setup.md +9 -9
- package/dist/template/docs/ru/getting-started.md +3 -3
- package/dist/template/docs/ru/installation-telemetry.md +2 -2
- package/dist/template/docs/ru/npm-installer.md +3 -3
- package/dist/template/docs/ru/operations-guide.md +8 -3
- package/dist/template/docs/ru/ota-client-lifecycle.md +30 -35
- package/dist/template/docs/ru/ota-update-policy.md +9 -7
- package/dist/template/docs/ru/publishing-npm-installer.md +2 -2
- package/dist/template/docs/uk/admin-ui.md +7 -3
- package/dist/template/docs/uk/device-targeting.md +2 -2
- package/dist/template/docs/uk/doctor.md +2 -2
- package/dist/template/docs/uk/expo-app-setup.md +9 -9
- package/dist/template/docs/uk/getting-started.md +3 -3
- package/dist/template/docs/uk/installation-telemetry.md +2 -2
- package/dist/template/docs/uk/npm-installer.md +3 -3
- package/dist/template/docs/uk/operations-guide.md +8 -3
- package/dist/template/docs/uk/ota-client-lifecycle.md +30 -35
- package/dist/template/docs/uk/ota-update-policy.md +9 -7
- package/dist/template/docs/uk/publishing-npm-installer.md +2 -2
- package/dist/template/lib/audience-ids.ts +4 -0
- package/dist/template/package-lock.json +46 -0
- package/dist/template/package.json +3 -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 +168 -231
- package/dist/template/src/client/devices/cohorts.tsx +181 -0
- package/dist/template/src/client/devices/device-name.tsx +37 -23
- package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
- package/dist/template/src/client/devices/registry.tsx +258 -245
- 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 +47 -49
- package/dist/template/src/client/distribution-control.tsx +89 -57
- 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 +133 -239
- package/dist/template/src/client/guard-action-options.ts +4 -6
- package/dist/template/src/client/i18n/en.json +133 -2
- package/dist/template/src/client/i18n/language-switching.test.tsx +12 -3
- package/dist/template/src/client/i18n/ru.json +133 -2
- package/dist/template/src/client/i18n/uk.json +133 -2
- 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 -206
- package/dist/template/src/client/update-policy-editor.test.ts +101 -29
- package/dist/template/src/client/update-policy-editor.tsx +454 -320
- 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 +446 -301
- 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,178 +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
|
-
className={
|
|
61
|
-
loading ? "animate-spin motion-reduce:animate-none" : ""
|
|
62
|
-
}
|
|
63
|
+
className={loading ? "animate-spin motion-reduce:animate-none" : ""}
|
|
63
64
|
/>
|
|
64
65
|
{loading ? t("Обновление…") : t("Обновить")}
|
|
65
66
|
</Button>
|
|
66
67
|
</header>
|
|
67
|
-
<Card className="gap-0 py-
|
|
68
|
-
<CardContent>
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
{t("Фильтры")}
|
|
72
|
-
{activeFilters > 0 && (
|
|
73
|
-
<Badge variant="secondary">{activeFilters}</Badge>
|
|
74
|
-
)}
|
|
75
|
-
<span className="ml-auto text-xs font-normal text-muted-foreground">
|
|
76
|
-
{t("Вся выборка")}
|
|
77
|
-
</span>
|
|
78
|
-
</div>
|
|
79
|
-
<form
|
|
80
|
-
onSubmit={(e) => {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
apply();
|
|
83
|
-
}}
|
|
84
|
-
className="grid grid-cols-2 items-end gap-3 lg:grid-cols-3 2xl:grid-cols-6"
|
|
85
|
-
>
|
|
86
|
-
<Filter
|
|
87
|
-
label={t("Период активности")}
|
|
88
|
-
id="days"
|
|
89
|
-
value={filters.days}
|
|
90
|
-
onChange={(v) => update("days", v)}
|
|
91
|
-
items={[
|
|
92
|
-
["1", t("24 часа")],
|
|
93
|
-
["7", t("7 дней")],
|
|
94
|
-
["30", t("30 дней")],
|
|
95
|
-
]}
|
|
96
|
-
/>
|
|
97
|
-
<Filter
|
|
98
|
-
label={t("Платформа")}
|
|
99
|
-
id="platform"
|
|
100
|
-
value={filters.platform}
|
|
101
|
-
onChange={(v) => update("platform", v)}
|
|
102
|
-
items={[
|
|
103
|
-
["", t("Все платформы")],
|
|
104
|
-
...["android", "ios"].map((v) => [
|
|
105
|
-
v,
|
|
106
|
-
v === "ios" ? "iOS" : "Android",
|
|
107
|
-
]),
|
|
108
|
-
]}
|
|
109
|
-
/>
|
|
110
|
-
<Filter
|
|
111
|
-
label={t("Канал")}
|
|
112
|
-
id="channel"
|
|
113
|
-
value={filters.channel}
|
|
114
|
-
onChange={(v) => update("channel", v)}
|
|
115
|
-
items={[
|
|
116
|
-
["", t("Все каналы")],
|
|
117
|
-
...(options?.channels || []).map((v) => [v, v]),
|
|
118
|
-
]}
|
|
119
|
-
/>
|
|
120
|
-
<Filter
|
|
121
|
-
label={t("Runtime")}
|
|
122
|
-
id="runtime"
|
|
123
|
-
value={filters.runtime}
|
|
124
|
-
onChange={(v) => update("runtime", v)}
|
|
125
|
-
items={[
|
|
126
|
-
["", t("Все runtime")],
|
|
127
|
-
...(options?.runtimes || []).map((v) => [v, v]),
|
|
128
|
-
]}
|
|
129
|
-
/>
|
|
130
|
-
<Filter
|
|
131
|
-
label={t("Тип запуска")}
|
|
132
|
-
id="launchKind"
|
|
133
|
-
value={filters.launchKind}
|
|
134
|
-
onChange={(v) => update("launchKind", v)}
|
|
135
|
-
items={[["", t("Все типы")], ...Object.entries(kindNames)]}
|
|
136
|
-
/>
|
|
137
|
-
<div className="grid gap-2">
|
|
138
|
-
<Label htmlFor="installation-search">
|
|
139
|
-
{t("Installation ID")}
|
|
140
|
-
</Label>
|
|
141
|
-
<Input
|
|
142
|
-
id="installation-search"
|
|
143
|
-
placeholder={t("ID или часть ID")}
|
|
144
|
-
value={filters.search}
|
|
145
|
-
maxLength={36}
|
|
146
|
-
pattern="[a-fA-F0-9\-]*"
|
|
147
|
-
title={t("Часть UUID: цифры, буквы a–f и дефисы")}
|
|
148
|
-
onChange={(e) => update("search", e.target.value)}
|
|
149
|
-
className="bg-background/40"
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
<div className="flex flex-wrap items-center gap-2 col-span-2 lg:col-span-3 2xl:col-span-6">
|
|
153
|
-
<Button type="submit" size="sm" disabled={loading}>
|
|
154
|
-
{t("Применить")}
|
|
155
|
-
</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>
|
|
156
72
|
<Button
|
|
157
|
-
type="button"
|
|
158
|
-
size="sm"
|
|
159
73
|
variant="ghost"
|
|
160
|
-
|
|
161
|
-
|
|
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("Фильтры")}
|
|
162
76
|
>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
<span className="
|
|
168
|
-
|
|
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}
|
|
169
84
|
</span>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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>
|
|
185
180
|
</CardContent>
|
|
186
181
|
</Card>
|
|
187
182
|
{error && (
|
|
@@ -216,20 +211,61 @@ export default function DevicesPage() {
|
|
|
216
211
|
<Skeleton className="h-64 rounded-xl" />
|
|
217
212
|
</div>
|
|
218
213
|
) : report ? (
|
|
219
|
-
<
|
|
220
|
-
|
|
214
|
+
<Tabs
|
|
215
|
+
defaultValue="overview"
|
|
216
|
+
className="min-w-0 gap-4"
|
|
221
217
|
aria-busy={loading}
|
|
222
218
|
>
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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>
|
|
231
267
|
) : null}
|
|
232
|
-
</
|
|
268
|
+
</div>
|
|
233
269
|
);
|
|
234
270
|
}
|
|
235
271
|
function Filter({
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
3
|
+
import { useConfirmAction } from "@/components/admin/confirm-action";
|
|
2
4
|
import type { TranslationMessage } from "@/src/client/i18n/messages";
|
|
3
5
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
4
6
|
|
|
7
|
+
import { AdminRoleContext } from "@/components/admin/admin-role";
|
|
8
|
+
import { Input } from "@/components/ui/input";
|
|
5
9
|
import { Button } from "@/components/ui/button";
|
|
6
10
|
import { Card } from "@/components/ui/card";
|
|
11
|
+
import { PlatformBadge, ChannelBadge } from "@/components/admin/release-badges";
|
|
7
12
|
import { Badge } from "@/components/ui/badge";
|
|
8
13
|
import {
|
|
9
14
|
Table,
|
|
@@ -19,9 +24,12 @@ import {
|
|
|
19
24
|
getEmbeddedUpdates,
|
|
20
25
|
} from "@/src/client/admin-api";
|
|
21
26
|
import { EmbeddedUpdateItem } from "@/src/client/admin-types";
|
|
22
|
-
import { useCallback, useEffect, useState } from "react";
|
|
27
|
+
import { useContext, useCallback, useEffect, useState } from "react";
|
|
23
28
|
|
|
24
29
|
export default function EmbeddedUpdatesPage() {
|
|
30
|
+
const canWrite = useContext(AdminRoleContext) !== "viewer";
|
|
31
|
+
const [query, setQuery] = useState("");
|
|
32
|
+
const confirmAction = useConfirmAction();
|
|
25
33
|
const { t, formatLocale } = useI18n();
|
|
26
34
|
const [items, setItems] = useState<EmbeddedUpdateItem[]>([]);
|
|
27
35
|
const [loading, setLoading] = useState(true);
|
|
@@ -51,8 +59,10 @@ export default function EmbeddedUpdatesPage() {
|
|
|
51
59
|
}, [loadItems]);
|
|
52
60
|
|
|
53
61
|
const handleDelete = async (embeddedUpdateId: string) => {
|
|
54
|
-
const confirmed =
|
|
62
|
+
const confirmed = await confirmAction(
|
|
63
|
+
t("Удалить"),
|
|
55
64
|
t("Удалить запись embedded update {0}?", [embeddedUpdateId]),
|
|
65
|
+
true,
|
|
56
66
|
);
|
|
57
67
|
if (!confirmed) {
|
|
58
68
|
return;
|
|
@@ -79,6 +89,13 @@ export default function EmbeddedUpdatesPage() {
|
|
|
79
89
|
}
|
|
80
90
|
};
|
|
81
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
|
+
|
|
82
99
|
return (
|
|
83
100
|
<div className="mx-auto max-w-[1600px] space-y-6 p-4 md:p-8">
|
|
84
101
|
<div className="space-y-6">
|
|
@@ -88,29 +105,42 @@ export default function EmbeddedUpdatesPage() {
|
|
|
88
105
|
{t("Embedded builds")}
|
|
89
106
|
</h1>
|
|
90
107
|
<p className="text-sm text-muted-foreground">
|
|
91
|
-
{t(
|
|
92
|
-
"Встроенные версии приложения и регистрация нативных сборок.",
|
|
93
|
-
)}
|
|
108
|
+
{t("Встроенные версии приложения и регистрация нативных сборок.")}
|
|
94
109
|
</p>
|
|
95
110
|
</div>
|
|
96
|
-
<Badge variant="
|
|
111
|
+
<Badge variant="info" className="px-3 py-1">
|
|
97
112
|
{t("Builds: {0}", [items.length])}
|
|
98
113
|
</Badge>
|
|
99
114
|
</header>
|
|
100
115
|
|
|
101
116
|
{error ? (
|
|
102
|
-
<
|
|
103
|
-
{t(error)}
|
|
104
|
-
</
|
|
117
|
+
<Alert variant="destructive">
|
|
118
|
+
<AlertDescription>{t(error)}</AlertDescription>
|
|
119
|
+
</Alert>
|
|
105
120
|
) : null}
|
|
106
121
|
|
|
107
122
|
{success ? (
|
|
108
|
-
<
|
|
109
|
-
{t(success)}
|
|
110
|
-
</
|
|
123
|
+
<Alert role="status">
|
|
124
|
+
<AlertDescription>{t(success)}</AlertDescription>
|
|
125
|
+
</Alert>
|
|
111
126
|
) : null}
|
|
112
127
|
|
|
113
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>
|
|
114
144
|
<div className="overflow-x-auto">
|
|
115
145
|
<Table className="min-w-full text-sm">
|
|
116
146
|
<TableHeader className="bg-muted/40">
|
|
@@ -147,7 +177,7 @@ export default function EmbeddedUpdatesPage() {
|
|
|
147
177
|
</TableRow>
|
|
148
178
|
) : null}
|
|
149
179
|
|
|
150
|
-
{!loading &&
|
|
180
|
+
{!loading && visible.length === 0 ? (
|
|
151
181
|
<TableRow>
|
|
152
182
|
<TableCell
|
|
153
183
|
className="h-36 px-3 py-4 text-center text-muted-foreground"
|
|
@@ -159,7 +189,7 @@ export default function EmbeddedUpdatesPage() {
|
|
|
159
189
|
) : null}
|
|
160
190
|
|
|
161
191
|
{!loading
|
|
162
|
-
?
|
|
192
|
+
? visible.map((item) => (
|
|
163
193
|
<TableRow
|
|
164
194
|
key={item.embeddedUpdateId}
|
|
165
195
|
className="border-t border-border "
|
|
@@ -173,10 +203,10 @@ export default function EmbeddedUpdatesPage() {
|
|
|
173
203
|
{item.appVersion || "—"}
|
|
174
204
|
</TableCell>
|
|
175
205
|
<TableCell className="px-4 py-3">
|
|
176
|
-
{item.platform}
|
|
206
|
+
<PlatformBadge platform={item.platform} />
|
|
177
207
|
</TableCell>
|
|
178
208
|
<TableCell className="px-4 py-3">
|
|
179
|
-
<
|
|
209
|
+
<ChannelBadge channel={item.channel} />
|
|
180
210
|
</TableCell>
|
|
181
211
|
<TableCell className="px-4 py-3 font-mono text-xs">
|
|
182
212
|
<span
|
|
@@ -187,19 +217,23 @@ export default function EmbeddedUpdatesPage() {
|
|
|
187
217
|
</span>
|
|
188
218
|
</TableCell>
|
|
189
219
|
<TableCell className="px-4 py-3">
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
+
)}
|
|
203
237
|
</TableCell>
|
|
204
238
|
</TableRow>
|
|
205
239
|
))
|