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,356 +1,467 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
|
-
|
|
4
|
-
import { NativeSelect } from "@/components/ui/native-select";
|
|
5
2
|
|
|
6
|
-
import { getUpdates } from "@/src/client/admin-api";
|
|
7
|
-
import { UpdateItem } from "@/src/client/admin-types";
|
|
8
|
-
import DistributionControl from "@/src/client/distribution-control";
|
|
9
3
|
import Link from "next/link";
|
|
10
|
-
import {
|
|
11
|
-
import { Badge } from "@/components/ui/badge";
|
|
12
|
-
import { Card } from "@/components/ui/card";
|
|
13
|
-
import {
|
|
14
|
-
Table,
|
|
15
|
-
TableHeader,
|
|
16
|
-
TableBody,
|
|
17
|
-
TableRow,
|
|
18
|
-
TableHead,
|
|
19
|
-
TableCell,
|
|
20
|
-
} from "@/components/ui/table";
|
|
4
|
+
import { useState } from "react";
|
|
21
5
|
import {
|
|
22
6
|
ArrowDownUp,
|
|
23
|
-
|
|
7
|
+
ArrowUpRight,
|
|
24
8
|
ChevronLeft,
|
|
25
9
|
ChevronRight,
|
|
10
|
+
Layers3,
|
|
26
11
|
RefreshCw,
|
|
27
|
-
|
|
12
|
+
Search,
|
|
28
13
|
ShieldAlert,
|
|
29
14
|
} from "lucide-react";
|
|
30
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
PlatformBadge,
|
|
17
|
+
ChannelBadge,
|
|
18
|
+
ReleaseStatusBadge,
|
|
19
|
+
AudienceBadge,
|
|
20
|
+
DeliveryBadge,
|
|
21
|
+
} from "@/components/admin/release-badges";
|
|
22
|
+
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
|
23
|
+
import { Badge } from "@/components/ui/badge";
|
|
24
|
+
import { Button } from "@/components/ui/button";
|
|
25
|
+
import { Card } from "@/components/ui/card";
|
|
26
|
+
import {
|
|
27
|
+
InputGroup,
|
|
28
|
+
InputGroupAddon,
|
|
29
|
+
InputGroupInput,
|
|
30
|
+
} from "@/components/ui/input-group";
|
|
31
|
+
import DistributionHistory from "@/src/client/distribution-history";
|
|
32
|
+
import {
|
|
33
|
+
Select,
|
|
34
|
+
SelectContent,
|
|
35
|
+
SelectItem,
|
|
36
|
+
SelectTrigger,
|
|
37
|
+
SelectValue,
|
|
38
|
+
} from "@/components/ui/select";
|
|
39
|
+
import { NativeSelect } from "@/components/ui/native-select";
|
|
40
|
+
import {
|
|
41
|
+
Table,
|
|
42
|
+
TableBody,
|
|
43
|
+
TableCell,
|
|
44
|
+
TableHead,
|
|
45
|
+
TableHeader,
|
|
46
|
+
TableRow,
|
|
47
|
+
} from "@/components/ui/table";
|
|
48
|
+
import { getUpdates } from "@/src/client/admin-api";
|
|
49
|
+
import type { ReleaseFilters } from "@/src/client/admin-types";
|
|
50
|
+
import { useFilteredResults } from "@/src/client/use-filtered-results";
|
|
51
|
+
import DistributionControl from "@/src/client/distribution-control";
|
|
52
|
+
import { useI18n } from "@/src/client/i18n/provider";
|
|
53
|
+
import { useFormatters } from "@/src/client/i18n/use-formatters";
|
|
31
54
|
|
|
32
|
-
const
|
|
55
|
+
const emptyFilters: ReleaseFilters = {
|
|
56
|
+
q: "",
|
|
57
|
+
platform: "",
|
|
58
|
+
channel: "",
|
|
59
|
+
runtime: "",
|
|
60
|
+
status: "",
|
|
61
|
+
audience: "",
|
|
62
|
+
};
|
|
63
|
+
const sorts = [
|
|
64
|
+
["createdAt", "По дате"],
|
|
65
|
+
["runtimeVersion", "По runtime"],
|
|
66
|
+
["platform", "По платформе"],
|
|
67
|
+
["channel", "По каналу"],
|
|
68
|
+
["status", "По статусу"],
|
|
69
|
+
["updateId", "По ID"],
|
|
70
|
+
];
|
|
33
71
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
| "
|
|
39
|
-
|
|
40
|
-
| "status"
|
|
41
|
-
| "updateId";
|
|
72
|
+
const initialQuery = {
|
|
73
|
+
...emptyFilters,
|
|
74
|
+
page: 1,
|
|
75
|
+
sortBy: "createdAt",
|
|
76
|
+
order: "desc" as "asc" | "desc",
|
|
77
|
+
};
|
|
42
78
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const [rollbackScopes, setRollbackScopes] = useState<
|
|
47
|
-
Array<{
|
|
48
|
-
scopeKey: string;
|
|
49
|
-
runtimeVersion: string;
|
|
50
|
-
channel: string;
|
|
51
|
-
platform: "ios" | "android";
|
|
52
|
-
rollbackActive: boolean;
|
|
53
|
-
autoDeliveryEnabled: boolean;
|
|
54
|
-
activeUpdateId: string | null;
|
|
55
|
-
latestUpdateId: string | null;
|
|
56
|
-
}>
|
|
57
|
-
>([]);
|
|
58
|
-
const [page, setPage] = useState(1);
|
|
59
|
-
const [totalPages, setTotalPages] = useState(1);
|
|
60
|
-
const [total, setTotal] = useState(0);
|
|
61
|
-
const [sortBy, setSortBy] = useState<SortBy>("createdAt");
|
|
62
|
-
const [order, setOrder] = useState<"asc" | "desc">("desc");
|
|
63
|
-
const [loading, setLoading] = useState(true);
|
|
64
|
-
const [error, setError] = useState("");
|
|
79
|
+
function loadReleases(query: typeof initialQuery, signal: AbortSignal) {
|
|
80
|
+
return getUpdates({ ...query, q: query.q.trim(), pageSize: 20 }, signal);
|
|
81
|
+
}
|
|
65
82
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
function hasFilters(query: ReleaseFilters) {
|
|
84
|
+
return Boolean(
|
|
85
|
+
query.q.trim() ||
|
|
86
|
+
query.platform ||
|
|
87
|
+
query.channel ||
|
|
88
|
+
query.runtime ||
|
|
89
|
+
query.status ||
|
|
90
|
+
query.audience,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
69
93
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
94
|
+
export default function UpdatesPage() {
|
|
95
|
+
const { t } = useI18n();
|
|
96
|
+
const { number, fullDate } = useFormatters();
|
|
97
|
+
const [historyRevision, setHistoryRevision] = useState(0);
|
|
98
|
+
const [distributionBlocked, setDistributionBlocked] = useState(true);
|
|
99
|
+
const {
|
|
100
|
+
query,
|
|
101
|
+
success,
|
|
102
|
+
loading,
|
|
103
|
+
error,
|
|
104
|
+
request: requestPage,
|
|
105
|
+
} = useFilteredResults(initialQuery, loadReleases);
|
|
106
|
+
const result = success?.data;
|
|
107
|
+
const resultsFiltered = success && hasFilters(success.query);
|
|
73
108
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
sortBy,
|
|
79
|
-
order,
|
|
80
|
-
});
|
|
81
|
-
setItems(response.items);
|
|
82
|
-
setRollbackScopes(response.rollbackLockByScope || []);
|
|
83
|
-
setTotalPages(response.totalPages);
|
|
84
|
-
setTotal(response.total);
|
|
85
|
-
} catch (loadError: unknown) {
|
|
86
|
-
setError((loadError as Error).message || "Не удалось загрузить список");
|
|
87
|
-
} finally {
|
|
88
|
-
setLoading(false);
|
|
89
|
-
}
|
|
90
|
-
}, [page, sortBy, order]);
|
|
109
|
+
function refreshReleases() {
|
|
110
|
+
requestPage({ ...query });
|
|
111
|
+
setHistoryRevision((value) => value + 1);
|
|
112
|
+
}
|
|
91
113
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
114
|
+
function reset() {
|
|
115
|
+
requestPage({ ...query, ...emptyFilters, page: 1 });
|
|
116
|
+
}
|
|
117
|
+
function filter(
|
|
118
|
+
key: keyof ReleaseFilters,
|
|
119
|
+
label: string,
|
|
120
|
+
options: [string, string][],
|
|
121
|
+
) {
|
|
122
|
+
return (
|
|
123
|
+
<Select
|
|
124
|
+
value={"option:" + query[key]}
|
|
125
|
+
onValueChange={(value) =>
|
|
126
|
+
requestPage({ ...query, [key]: value.slice(7), page: 1 })
|
|
127
|
+
}
|
|
128
|
+
>
|
|
129
|
+
<SelectTrigger aria-label={label} className="max-w-48">
|
|
130
|
+
<SelectValue />
|
|
131
|
+
</SelectTrigger>
|
|
132
|
+
<SelectContent>
|
|
133
|
+
<SelectItem value="option:">{label}</SelectItem>
|
|
134
|
+
{options.map(([value, title]) => (
|
|
135
|
+
<SelectItem key={value} value={"option:" + value}>
|
|
136
|
+
{title}
|
|
137
|
+
</SelectItem>
|
|
138
|
+
))}
|
|
139
|
+
</SelectContent>
|
|
140
|
+
</Select>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
const locked =
|
|
144
|
+
result?.rollbackLockByScope.filter((scope) => scope.rollbackActive) ?? [];
|
|
145
|
+
const page = result?.page ?? 1;
|
|
146
|
+
const pages = result?.totalPages ?? 1;
|
|
95
147
|
|
|
96
148
|
return (
|
|
97
|
-
<div className="mx-auto max-w-[
|
|
98
|
-
<header className="flex flex-wrap items-
|
|
99
|
-
<div
|
|
100
|
-
<h1 className="text-
|
|
101
|
-
|
|
102
|
-
|
|
149
|
+
<div className="mx-auto max-w-[1500px] space-y-5 p-4 sm:p-6 lg:p-8">
|
|
150
|
+
<header className="flex flex-wrap items-center justify-between gap-4">
|
|
151
|
+
<div>
|
|
152
|
+
<h1 className="text-3xl font-semibold tracking-tight">
|
|
153
|
+
{t("Публикации")}
|
|
154
|
+
</h1>
|
|
155
|
+
<p className="mt-1.5 text-sm text-muted-foreground">
|
|
156
|
+
{t("Manage release audiences, delivery policies and rollbacks.")}
|
|
103
157
|
</p>
|
|
104
158
|
</div>
|
|
105
159
|
<Button
|
|
106
|
-
|
|
107
|
-
onClick={() => void loadUpdates()}
|
|
160
|
+
size="sm"
|
|
108
161
|
disabled={loading}
|
|
162
|
+
onClick={refreshReleases}
|
|
109
163
|
>
|
|
110
|
-
<RefreshCw className={loading ? "animate-spin" : ""} />
|
|
111
|
-
{t("
|
|
164
|
+
<RefreshCw className={loading ? "animate-spin" : ""} />
|
|
165
|
+
{t("Обновить")}
|
|
112
166
|
</Button>
|
|
113
167
|
</header>
|
|
114
168
|
|
|
115
|
-
<DistributionControl />
|
|
169
|
+
<DistributionControl onAvailabilityChange={setDistributionBlocked} />
|
|
116
170
|
|
|
117
|
-
{
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
171
|
+
{locked.length > 0 && (
|
|
172
|
+
<Alert role="status" variant="destructive">
|
|
173
|
+
<ShieldAlert aria-hidden="true" />
|
|
174
|
+
<AlertTitle>{t("Rollback активен")}</AlertTitle>
|
|
175
|
+
<AlertDescription className="break-words">
|
|
176
|
+
{t("Автодоставка новых обновлений временно отключена.")}{" "}
|
|
177
|
+
{locked
|
|
178
|
+
.map((s) => [s.runtimeVersion, s.platform, s.channel].join(" / "))
|
|
179
|
+
.join(" · ")}
|
|
180
|
+
</AlertDescription>
|
|
181
|
+
</Alert>
|
|
124
182
|
)}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<div>
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
183
|
+
|
|
184
|
+
<Card className="min-w-0 gap-0 overflow-hidden py-0 shadow-none">
|
|
185
|
+
<div className="space-y-4 border-b p-4 sm:p-5">
|
|
186
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
187
|
+
<div className="flex items-center gap-2">
|
|
188
|
+
<h2 className="text-lg font-semibold">{t("Release history")}</h2>
|
|
189
|
+
{result && (
|
|
190
|
+
<Badge variant="info" className="tabular-nums">
|
|
191
|
+
{number(result.total)}
|
|
192
|
+
</Badge>
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
<div className="flex items-center gap-1.5">
|
|
196
|
+
<NativeSelect
|
|
197
|
+
size="sm"
|
|
198
|
+
aria-label={t("Сортировка списка апдейтов")}
|
|
199
|
+
value={query.sortBy}
|
|
200
|
+
onChange={(e) =>
|
|
201
|
+
requestPage({ ...query, sortBy: e.target.value, page: 1 })
|
|
202
|
+
}
|
|
203
|
+
>
|
|
204
|
+
{sorts.map(([key, label]) => (
|
|
205
|
+
<option key={key} value={key}>
|
|
206
|
+
{t(label)}
|
|
207
|
+
</option>
|
|
208
|
+
))}
|
|
209
|
+
</NativeSelect>
|
|
210
|
+
<Button
|
|
211
|
+
variant="outline"
|
|
212
|
+
size="sm"
|
|
213
|
+
aria-label={
|
|
214
|
+
query.order === "desc"
|
|
215
|
+
? t("Сортировать по возрастанию")
|
|
216
|
+
: t("Сортировать по убыванию")
|
|
217
|
+
}
|
|
218
|
+
onClick={() =>
|
|
219
|
+
requestPage({
|
|
220
|
+
...query,
|
|
221
|
+
order: query.order === "desc" ? "asc" : "desc",
|
|
222
|
+
page: 1,
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
>
|
|
226
|
+
<ArrowDownUp />
|
|
227
|
+
{query.order === "desc" ? t("Descending") : t("Ascending")}
|
|
228
|
+
</Button>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
<div role="search" className="space-y-3">
|
|
232
|
+
<InputGroup>
|
|
233
|
+
<InputGroupAddon>
|
|
234
|
+
<Search />
|
|
235
|
+
</InputGroupAddon>
|
|
236
|
+
<InputGroupInput
|
|
237
|
+
type="search"
|
|
238
|
+
aria-label={t("Search releases")}
|
|
239
|
+
placeholder={t(
|
|
240
|
+
"Search by comment, update ID, version or channel",
|
|
241
|
+
)}
|
|
242
|
+
value={query.q}
|
|
243
|
+
onChange={(event) => {
|
|
244
|
+
const q = event.target.value;
|
|
245
|
+
requestPage({ ...query, q, page: 1 }, Boolean(q.trim()));
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
</InputGroup>
|
|
249
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
250
|
+
{filter("platform", t("Все платформы"), [
|
|
251
|
+
["ios", "iOS"],
|
|
252
|
+
["android", "Android"],
|
|
253
|
+
])}
|
|
254
|
+
{filter(
|
|
255
|
+
"channel",
|
|
256
|
+
t("Все каналы"),
|
|
257
|
+
(result?.filters?.channels ?? []).map((v) => [v, v]),
|
|
258
|
+
)}
|
|
259
|
+
{filter(
|
|
260
|
+
"runtime",
|
|
261
|
+
t("All runtimes"),
|
|
262
|
+
(result?.filters?.runtimes ?? []).map((v) => [v, v]),
|
|
263
|
+
)}
|
|
264
|
+
{filter("status", t("All statuses"), [
|
|
265
|
+
["active", t("active")],
|
|
266
|
+
["draft", t("draft")],
|
|
267
|
+
["disabled", t("disabled")],
|
|
268
|
+
["rollback", t("Rollback")],
|
|
269
|
+
])}
|
|
270
|
+
{filter("audience", t("All audiences"), [
|
|
271
|
+
["all", t("Все совместимые устройства")],
|
|
272
|
+
["devices", t("Выбранные устройства")],
|
|
273
|
+
])}
|
|
274
|
+
{(hasFilters(query) || resultsFiltered) && (
|
|
275
|
+
<Button type="button" variant="ghost" size="sm" onClick={reset}>
|
|
276
|
+
{t("Сбросить")}
|
|
277
|
+
</Button>
|
|
278
|
+
)}
|
|
279
|
+
</div>
|
|
136
280
|
</div>
|
|
137
281
|
</div>
|
|
138
|
-
)}
|
|
139
|
-
{lockedScopes.length > 0 && (
|
|
140
|
-
<p className="text-xs text-muted-foreground">
|
|
141
|
-
Rollback lock:{" "}
|
|
142
|
-
{lockedScopes
|
|
143
|
-
.map(
|
|
144
|
-
(scope) =>
|
|
145
|
-
`${scope.runtimeVersion} / ${scope.platform} / ${scope.channel}`,
|
|
146
|
-
)
|
|
147
|
-
.join("; ")}
|
|
148
|
-
</p>
|
|
149
|
-
)}
|
|
150
282
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
</div>
|
|
158
|
-
<div className="flex items-center gap-2">
|
|
159
|
-
<NativeSelect
|
|
160
|
-
value={sortBy}
|
|
161
|
-
onChange={(event) => {
|
|
162
|
-
setSortBy(event.target.value as SortBy);
|
|
163
|
-
setPage(1);
|
|
164
|
-
}}
|
|
165
|
-
aria-label={t("Сортировка списка апдейтов")}
|
|
166
|
-
className="h-9 rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
167
|
-
>
|
|
168
|
-
<option value="createdAt">{t("По дате")}</option>
|
|
169
|
-
<option value="runtimeVersion">{t("По runtime")}</option>
|
|
170
|
-
<option value="platform">{t("По платформе")}</option>
|
|
171
|
-
<option value="channel">{t("По каналу")}</option>
|
|
172
|
-
<option value="stage">{t("По stage")}</option>
|
|
173
|
-
<option value="status">{t("По статусу")}</option>
|
|
174
|
-
<option value="updateId">{t("По ID")}</option>
|
|
175
|
-
</NativeSelect>
|
|
283
|
+
{error && (
|
|
284
|
+
<div
|
|
285
|
+
role="alert"
|
|
286
|
+
className="border-b bg-destructive/5 p-4 text-sm text-destructive"
|
|
287
|
+
>
|
|
288
|
+
{t(error)} {result && t("Showing the previous results.")}{" "}
|
|
176
289
|
<Button
|
|
177
|
-
variant="outline"
|
|
178
290
|
size="sm"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
setPage(1);
|
|
182
|
-
}}
|
|
183
|
-
aria-label={
|
|
184
|
-
order === "asc"
|
|
185
|
-
? t("Сортировать по убыванию")
|
|
186
|
-
: t("Сортировать по возрастанию")
|
|
187
|
-
}
|
|
291
|
+
variant="outline"
|
|
292
|
+
onClick={() => requestPage({ ...query })}
|
|
188
293
|
>
|
|
189
|
-
|
|
190
|
-
{order === "asc" ? "ASC" : "DESC"}
|
|
294
|
+
{t("Retry")}
|
|
191
295
|
</Button>
|
|
192
296
|
</div>
|
|
193
|
-
|
|
194
|
-
<Table>
|
|
297
|
+
)}
|
|
298
|
+
<Table aria-busy={loading}>
|
|
195
299
|
<TableHeader>
|
|
196
|
-
<TableRow className="bg-muted/
|
|
197
|
-
<TableHead className="pl-5">{t("
|
|
198
|
-
<TableHead
|
|
199
|
-
|
|
300
|
+
<TableRow className="bg-muted/35">
|
|
301
|
+
<TableHead className="pl-4 sm:pl-5">{t("Release")}</TableHead>
|
|
302
|
+
<TableHead className="hidden lg:table-cell">
|
|
303
|
+
{t("Compatibility")}
|
|
304
|
+
</TableHead>
|
|
200
305
|
<TableHead>{t("Состояние")}</TableHead>
|
|
201
|
-
<TableHead
|
|
202
|
-
|
|
203
|
-
|
|
306
|
+
<TableHead className="hidden sm:table-cell">
|
|
307
|
+
{t("Audience")}
|
|
308
|
+
</TableHead>
|
|
309
|
+
<TableHead className="hidden xl:table-cell">
|
|
310
|
+
{t("Доставка")}
|
|
311
|
+
</TableHead>
|
|
312
|
+
<TableHead className="hidden pr-5 text-right md:table-cell">
|
|
313
|
+
{t("Создано")}
|
|
314
|
+
</TableHead>
|
|
204
315
|
</TableRow>
|
|
205
316
|
</TableHeader>
|
|
206
317
|
<TableBody>
|
|
207
|
-
{loading && (
|
|
318
|
+
{!result && loading && (
|
|
208
319
|
<TableRow>
|
|
209
320
|
<TableCell
|
|
210
|
-
colSpan={
|
|
321
|
+
colSpan={6}
|
|
211
322
|
className="h-36 text-center text-muted-foreground"
|
|
212
323
|
>
|
|
213
|
-
<RefreshCw className="mx-auto mb-2 size-5 animate-spin" />
|
|
214
324
|
{t("Загрузка обновлений…")}
|
|
215
325
|
</TableCell>
|
|
216
326
|
</TableRow>
|
|
217
327
|
)}
|
|
218
|
-
{
|
|
328
|
+
{result?.items.length === 0 && (
|
|
219
329
|
<TableRow>
|
|
220
|
-
<TableCell colSpan={
|
|
221
|
-
<
|
|
222
|
-
<p className="font-medium">
|
|
223
|
-
|
|
224
|
-
|
|
330
|
+
<TableCell colSpan={6} className="h-40 text-center">
|
|
331
|
+
<Layers3 className="mx-auto mb-3 size-6 text-muted-foreground" />
|
|
332
|
+
<p className="font-medium">
|
|
333
|
+
{resultsFiltered
|
|
334
|
+
? t("No matching releases")
|
|
335
|
+
: t("Обновлений пока нет")}
|
|
225
336
|
</p>
|
|
337
|
+
{resultsFiltered ? (
|
|
338
|
+
<Button variant="link" size="sm" onClick={reset}>
|
|
339
|
+
{t("Сбросить")}
|
|
340
|
+
</Button>
|
|
341
|
+
) : (
|
|
342
|
+
<p className="mt-1 whitespace-normal text-sm text-muted-foreground">
|
|
343
|
+
{t(
|
|
344
|
+
"Опубликуйте OTA, чтобы управлять его доставкой здесь.",
|
|
345
|
+
)}
|
|
346
|
+
</p>
|
|
347
|
+
)}
|
|
226
348
|
</TableCell>
|
|
227
349
|
</TableRow>
|
|
228
350
|
)}
|
|
229
|
-
{
|
|
230
|
-
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
{item.comment || t("Без комментария")}
|
|
242
|
-
</span>
|
|
243
|
-
<ArrowRight className="size-3.5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100" />
|
|
244
|
-
</Link>
|
|
245
|
-
<Link
|
|
246
|
-
href={`/updates/${item.encodedKey}`}
|
|
247
|
-
className="mt-1 block max-w-60 truncate font-mono text-[11px] text-muted-foreground hover:text-primary"
|
|
248
|
-
title={item.updateId}
|
|
249
|
-
>
|
|
250
|
-
{item.updateId}
|
|
251
|
-
</Link>
|
|
252
|
-
</TableCell>
|
|
253
|
-
<TableCell>
|
|
254
|
-
<p className="font-medium">{item.runtimeVersion}</p>
|
|
255
|
-
<p className="mt-1 text-xs text-muted-foreground">
|
|
256
|
-
App {item.appVersion || "—"}
|
|
257
|
-
</p>
|
|
258
|
-
</TableCell>
|
|
259
|
-
<TableCell>
|
|
260
|
-
<span className="text-sm">
|
|
261
|
-
{item.platform === "ios" ? "iOS" : "Android"}
|
|
351
|
+
{result?.items.map((item) => (
|
|
352
|
+
<TableRow key={item.key}>
|
|
353
|
+
<TableCell className="max-w-44 whitespace-normal py-4 pl-4 sm:max-w-80 sm:pl-5">
|
|
354
|
+
<Link
|
|
355
|
+
href={`/updates/${item.encodedKey}`}
|
|
356
|
+
className="group inline-flex max-w-full items-start gap-1.5 rounded-sm font-semibold hover:text-primary"
|
|
357
|
+
>
|
|
358
|
+
<span className="line-clamp-2 break-words">
|
|
359
|
+
{item.comment ||
|
|
360
|
+
(item.appVersion
|
|
361
|
+
? t("Version {0}", [item.appVersion])
|
|
362
|
+
: t("Release {0}", [item.updateId.slice(0, 8)]))}
|
|
262
363
|
</span>
|
|
263
|
-
<
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
364
|
+
<ArrowUpRight className="mt-0.5 size-3.5 shrink-0 text-muted-foreground group-hover:text-primary" />
|
|
365
|
+
</Link>
|
|
366
|
+
<div
|
|
367
|
+
className="mt-1 font-mono text-xs text-muted-foreground"
|
|
368
|
+
title={item.updateId}
|
|
369
|
+
>
|
|
370
|
+
{item.updateId.slice(0, 8)}
|
|
371
|
+
</div>
|
|
372
|
+
<div className="mt-1 flex min-w-0 flex-wrap items-center gap-1 text-xs text-muted-foreground lg:hidden">
|
|
373
|
+
<PlatformBadge platform={item.platform} />
|
|
374
|
+
<ChannelBadge channel={item.channel} />
|
|
375
|
+
<span className="break-all">{item.runtimeVersion}</span>
|
|
376
|
+
</div>
|
|
377
|
+
</TableCell>
|
|
378
|
+
<TableCell className="hidden max-w-60 whitespace-normal lg:table-cell">
|
|
379
|
+
<div className="flex min-w-0 flex-wrap items-center gap-1">
|
|
380
|
+
<PlatformBadge platform={item.platform} />
|
|
381
|
+
<ChannelBadge channel={item.channel} />
|
|
382
|
+
</div>
|
|
383
|
+
<div className="mt-1 break-words text-xs text-muted-foreground">
|
|
384
|
+
{t("Runtime {0}", [item.runtimeVersion])}
|
|
385
|
+
{item.appVersion ? ` · ${t("App")} ${item.appVersion}` : ""}
|
|
386
|
+
</div>
|
|
387
|
+
</TableCell>
|
|
388
|
+
<TableCell>
|
|
389
|
+
<div className="flex flex-col items-start gap-1.5">
|
|
390
|
+
<ReleaseStatusBadge release={item} />
|
|
391
|
+
{item.isLatest && (
|
|
392
|
+
<span className="text-xs text-muted-foreground">
|
|
393
|
+
{t("Latest")}
|
|
394
|
+
</span>
|
|
395
|
+
)}
|
|
396
|
+
{(item.isRollbackActive || item.isIgnoredByRollback) && (
|
|
269
397
|
<Badge
|
|
270
398
|
variant={
|
|
271
|
-
item.
|
|
272
|
-
}
|
|
273
|
-
className={
|
|
274
|
-
item.status === "active"
|
|
275
|
-
? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
276
|
-
: ""
|
|
399
|
+
item.isRollbackActive ? "destructive" : "warning"
|
|
277
400
|
}
|
|
401
|
+
className="max-w-36 whitespace-normal text-left"
|
|
278
402
|
>
|
|
279
|
-
{item.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
{item.audienceMode === "devices" && (
|
|
283
|
-
<Badge variant="outline">
|
|
284
|
-
{t("Выбранные устройства")}
|
|
285
|
-
</Badge>
|
|
286
|
-
)}
|
|
287
|
-
</div>
|
|
288
|
-
<p className="mt-1.5 text-xs text-muted-foreground">
|
|
289
|
-
{item.stage}
|
|
290
|
-
</p>
|
|
291
|
-
</TableCell>
|
|
292
|
-
<TableCell>
|
|
293
|
-
<div className="flex flex-wrap gap-1.5">
|
|
294
|
-
<Badge variant="outline">
|
|
295
|
-
{item.deliveryMode === "background"
|
|
296
|
-
? "Background"
|
|
297
|
-
: "Manual"}
|
|
403
|
+
{item.isRollbackActive
|
|
404
|
+
? t("Rollback")
|
|
405
|
+
: t("Ignored by rollback")}
|
|
298
406
|
</Badge>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
407
|
+
)}
|
|
408
|
+
<div className="max-w-32 sm:hidden">
|
|
409
|
+
<AudienceBadge mode={item.audienceMode} compact />
|
|
302
410
|
</div>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
))}
|
|
411
|
+
</div>
|
|
412
|
+
</TableCell>
|
|
413
|
+
<TableCell className="hidden sm:table-cell">
|
|
414
|
+
<AudienceBadge mode={item.audienceMode} compact />
|
|
415
|
+
</TableCell>
|
|
416
|
+
<TableCell className="hidden xl:table-cell">
|
|
417
|
+
<DeliveryBadge mode={item.deliveryMode} />
|
|
418
|
+
{item.hasGuard && (
|
|
419
|
+
<Badge className="ml-1.5" variant="warning">
|
|
420
|
+
{t("Guard")}
|
|
421
|
+
</Badge>
|
|
422
|
+
)}
|
|
423
|
+
</TableCell>
|
|
424
|
+
<TableCell className="hidden pr-5 text-right text-xs text-muted-foreground md:table-cell">
|
|
425
|
+
{fullDate(item.createdAt)}
|
|
426
|
+
</TableCell>
|
|
427
|
+
</TableRow>
|
|
428
|
+
))}
|
|
322
429
|
</TableBody>
|
|
323
430
|
</Table>
|
|
324
|
-
<
|
|
325
|
-
<
|
|
326
|
-
{
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
</
|
|
431
|
+
<footer className="flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 sm:px-5">
|
|
432
|
+
<span aria-live="polite" className="text-sm text-muted-foreground">
|
|
433
|
+
{loading
|
|
434
|
+
? t("Загрузка...")
|
|
435
|
+
: t("Page {0} of {1}", [number(page), number(pages)])}
|
|
436
|
+
</span>
|
|
330
437
|
<div className="flex gap-2">
|
|
331
438
|
<Button
|
|
332
|
-
variant="outline"
|
|
333
439
|
size="sm"
|
|
334
|
-
|
|
335
|
-
disabled={page <= 1
|
|
440
|
+
variant="outline"
|
|
441
|
+
disabled={loading || page <= 1}
|
|
442
|
+
onClick={() => requestPage({ ...query, page: page - 1 })}
|
|
336
443
|
>
|
|
337
444
|
<ChevronLeft />
|
|
338
445
|
{t("Назад")}
|
|
339
446
|
</Button>
|
|
340
447
|
<Button
|
|
341
|
-
variant="outline"
|
|
342
448
|
size="sm"
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
346
|
-
disabled={page >= totalPages || loading}
|
|
449
|
+
variant="outline"
|
|
450
|
+
disabled={loading || page >= pages}
|
|
451
|
+
onClick={() => requestPage({ ...query, page: page + 1 })}
|
|
347
452
|
>
|
|
348
453
|
{t("Вперёд")}
|
|
349
454
|
<ChevronRight />
|
|
350
455
|
</Button>
|
|
351
456
|
</div>
|
|
352
|
-
</
|
|
457
|
+
</footer>
|
|
353
458
|
</Card>
|
|
459
|
+
|
|
460
|
+
<DistributionHistory
|
|
461
|
+
revision={historyRevision}
|
|
462
|
+
blocked={distributionBlocked}
|
|
463
|
+
onRestored={refreshReleases}
|
|
464
|
+
/>
|
|
354
465
|
</div>
|
|
355
466
|
);
|
|
356
467
|
}
|