create-expo-updates-server 0.4.0 → 0.6.1
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 +303 -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 +25 -3
- package/dist/template/src/server/controllers/manifest.ts +1 -2
- 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 +2 -2
- 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 +445 -300
- 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,369 +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
|
-
|
|
69
|
-
|
|
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,
|
|
70
91
|
);
|
|
92
|
+
}
|
|
71
93
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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);
|
|
75
108
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
sortBy,
|
|
81
|
-
order,
|
|
82
|
-
});
|
|
83
|
-
setItems(response.items);
|
|
84
|
-
setRollbackScopes(response.rollbackLockByScope || []);
|
|
85
|
-
setTotalPages(response.totalPages);
|
|
86
|
-
setTotal(response.total);
|
|
87
|
-
} catch (loadError: unknown) {
|
|
88
|
-
setError(
|
|
89
|
-
(loadError as Error).message || "Не удалось загрузить список",
|
|
90
|
-
);
|
|
91
|
-
} finally {
|
|
92
|
-
setLoading(false);
|
|
93
|
-
}
|
|
94
|
-
}, [page, sortBy, order]);
|
|
109
|
+
function refreshReleases() {
|
|
110
|
+
requestPage({ ...query });
|
|
111
|
+
setHistoryRevision((value) => value + 1);
|
|
112
|
+
}
|
|
95
113
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
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;
|
|
99
147
|
|
|
100
148
|
return (
|
|
101
|
-
<div className="mx-auto max-w-[
|
|
102
|
-
<header className="flex flex-wrap items-
|
|
103
|
-
<div
|
|
104
|
-
<h1 className="text-
|
|
105
|
-
{t("
|
|
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("Публикации")}
|
|
106
154
|
</h1>
|
|
107
|
-
<p className="text-sm text-muted-foreground">
|
|
108
|
-
{t("
|
|
155
|
+
<p className="mt-1.5 text-sm text-muted-foreground">
|
|
156
|
+
{t("Manage release audiences, delivery policies and rollbacks.")}
|
|
109
157
|
</p>
|
|
110
158
|
</div>
|
|
111
159
|
<Button
|
|
112
|
-
|
|
113
|
-
onClick={() => void loadUpdates()}
|
|
160
|
+
size="sm"
|
|
114
161
|
disabled={loading}
|
|
162
|
+
onClick={refreshReleases}
|
|
115
163
|
>
|
|
116
|
-
<RefreshCw className={loading ? "animate-spin" : ""} />
|
|
117
|
-
{t("
|
|
164
|
+
<RefreshCw className={loading ? "animate-spin" : ""} />
|
|
165
|
+
{t("Обновить")}
|
|
118
166
|
</Button>
|
|
119
167
|
</header>
|
|
120
168
|
|
|
121
|
-
<DistributionControl />
|
|
169
|
+
<DistributionControl onAvailabilityChange={setDistributionBlocked} />
|
|
122
170
|
|
|
123
|
-
{
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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>
|
|
130
182
|
)}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<div>
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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>
|
|
142
280
|
</div>
|
|
143
281
|
</div>
|
|
144
|
-
)}
|
|
145
|
-
{lockedScopes.length > 0 && (
|
|
146
|
-
<p className="text-xs text-muted-foreground">
|
|
147
|
-
{t("Rollback lock:")}{" "}
|
|
148
|
-
{lockedScopes
|
|
149
|
-
.map(
|
|
150
|
-
(scope) =>
|
|
151
|
-
`${scope.runtimeVersion} / ${scope.platform} / ${scope.channel}`,
|
|
152
|
-
)
|
|
153
|
-
.join("; ")}
|
|
154
|
-
</p>
|
|
155
|
-
)}
|
|
156
282
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
</div>
|
|
164
|
-
<div className="flex items-center gap-2">
|
|
165
|
-
<NativeSelect
|
|
166
|
-
value={sortBy}
|
|
167
|
-
onChange={(event) => {
|
|
168
|
-
setSortBy(event.target.value as SortBy);
|
|
169
|
-
setPage(1);
|
|
170
|
-
}}
|
|
171
|
-
aria-label={t("Сортировка списка апдейтов")}
|
|
172
|
-
className="h-9 rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
173
|
-
>
|
|
174
|
-
<option value="createdAt">{t("По дате")}</option>
|
|
175
|
-
<option value="runtimeVersion">{t("По runtime")}</option>
|
|
176
|
-
<option value="platform">{t("По платформе")}</option>
|
|
177
|
-
<option value="channel">{t("По каналу")}</option>
|
|
178
|
-
<option value="stage">{t("По stage")}</option>
|
|
179
|
-
<option value="status">{t("По статусу")}</option>
|
|
180
|
-
<option value="updateId">{t("По ID")}</option>
|
|
181
|
-
</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.")}{" "}
|
|
182
289
|
<Button
|
|
183
|
-
variant="outline"
|
|
184
290
|
size="sm"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
setPage(1);
|
|
188
|
-
}}
|
|
189
|
-
aria-label={
|
|
190
|
-
order === "asc"
|
|
191
|
-
? t("Сортировать по убыванию")
|
|
192
|
-
: t("Сортировать по возрастанию")
|
|
193
|
-
}
|
|
291
|
+
variant="outline"
|
|
292
|
+
onClick={() => requestPage({ ...query })}
|
|
194
293
|
>
|
|
195
|
-
|
|
196
|
-
{order === "asc" ? t("Ascending") : t("Descending")}
|
|
294
|
+
{t("Retry")}
|
|
197
295
|
</Button>
|
|
198
296
|
</div>
|
|
199
|
-
|
|
200
|
-
<Table>
|
|
297
|
+
)}
|
|
298
|
+
<Table aria-busy={loading}>
|
|
201
299
|
<TableHeader>
|
|
202
|
-
<TableRow className="bg-muted/
|
|
203
|
-
<TableHead className="pl-5">{t("
|
|
204
|
-
<TableHead
|
|
205
|
-
|
|
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>
|
|
206
305
|
<TableHead>{t("Состояние")}</TableHead>
|
|
207
|
-
<TableHead
|
|
208
|
-
|
|
209
|
-
|
|
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">
|
|
210
313
|
{t("Создано")}
|
|
211
314
|
</TableHead>
|
|
212
315
|
</TableRow>
|
|
213
316
|
</TableHeader>
|
|
214
317
|
<TableBody>
|
|
215
|
-
{loading && (
|
|
318
|
+
{!result && loading && (
|
|
216
319
|
<TableRow>
|
|
217
320
|
<TableCell
|
|
218
|
-
colSpan={
|
|
321
|
+
colSpan={6}
|
|
219
322
|
className="h-36 text-center text-muted-foreground"
|
|
220
323
|
>
|
|
221
|
-
<RefreshCw className="mx-auto mb-2 size-5 animate-spin" />
|
|
222
324
|
{t("Загрузка обновлений…")}
|
|
223
325
|
</TableCell>
|
|
224
326
|
</TableRow>
|
|
225
327
|
)}
|
|
226
|
-
{
|
|
328
|
+
{result?.items.length === 0 && (
|
|
227
329
|
<TableRow>
|
|
228
|
-
<TableCell colSpan={
|
|
229
|
-
<
|
|
230
|
-
<p className="font-medium">
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
"
|
|
234
|
-
)}
|
|
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("Обновлений пока нет")}
|
|
235
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
|
+
)}
|
|
236
348
|
</TableCell>
|
|
237
349
|
</TableRow>
|
|
238
350
|
)}
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
{item.comment || t("Без комментария")}
|
|
252
|
-
</span>
|
|
253
|
-
<ArrowRight className="size-3.5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100" />
|
|
254
|
-
</Link>
|
|
255
|
-
<Link
|
|
256
|
-
href={`/updates/${item.encodedKey}`}
|
|
257
|
-
className="mt-1 block max-w-60 truncate font-mono text-[11px] text-muted-foreground hover:text-primary"
|
|
258
|
-
title={item.updateId}
|
|
259
|
-
>
|
|
260
|
-
{item.updateId}
|
|
261
|
-
</Link>
|
|
262
|
-
</TableCell>
|
|
263
|
-
<TableCell>
|
|
264
|
-
<p className="font-medium">{item.runtimeVersion}</p>
|
|
265
|
-
<p className="mt-1 text-xs text-muted-foreground">
|
|
266
|
-
{t("App")} {item.appVersion || "—"}
|
|
267
|
-
</p>
|
|
268
|
-
</TableCell>
|
|
269
|
-
<TableCell>
|
|
270
|
-
<span className="text-sm">
|
|
271
|
-
{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)]))}
|
|
272
363
|
</span>
|
|
273
|
-
<
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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) && (
|
|
279
397
|
<Badge
|
|
280
398
|
variant={
|
|
281
|
-
item.
|
|
282
|
-
}
|
|
283
|
-
className={
|
|
284
|
-
item.status === "active"
|
|
285
|
-
? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
286
|
-
: ""
|
|
399
|
+
item.isRollbackActive ? "destructive" : "warning"
|
|
287
400
|
}
|
|
401
|
+
className="max-w-36 whitespace-normal text-left"
|
|
288
402
|
>
|
|
289
|
-
{
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
<Badge variant="outline">{t("Latest")}</Badge>
|
|
293
|
-
)}
|
|
294
|
-
{item.audienceMode === "devices" && (
|
|
295
|
-
<Badge variant="outline">
|
|
296
|
-
{t("Выбранные устройства")}
|
|
297
|
-
</Badge>
|
|
298
|
-
)}
|
|
299
|
-
</div>
|
|
300
|
-
<p className="mt-1.5 text-xs text-muted-foreground">
|
|
301
|
-
{item.stage}
|
|
302
|
-
</p>
|
|
303
|
-
</TableCell>
|
|
304
|
-
<TableCell>
|
|
305
|
-
<div className="flex flex-wrap gap-1.5">
|
|
306
|
-
<Badge variant="outline">
|
|
307
|
-
{item.deliveryMode === "background"
|
|
308
|
-
? t("Background")
|
|
309
|
-
: t("Manual")}
|
|
403
|
+
{item.isRollbackActive
|
|
404
|
+
? t("Rollback")
|
|
405
|
+
: t("Ignored by rollback")}
|
|
310
406
|
</Badge>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
407
|
+
)}
|
|
408
|
+
<div className="max-w-32 sm:hidden">
|
|
409
|
+
<AudienceBadge mode={item.audienceMode} compact />
|
|
314
410
|
</div>
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
</TableRow>
|
|
334
|
-
))}
|
|
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
|
+
))}
|
|
335
429
|
</TableBody>
|
|
336
430
|
</Table>
|
|
337
|
-
<
|
|
338
|
-
<
|
|
339
|
-
{
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
</
|
|
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>
|
|
343
437
|
<div className="flex gap-2">
|
|
344
438
|
<Button
|
|
345
|
-
variant="outline"
|
|
346
439
|
size="sm"
|
|
347
|
-
|
|
348
|
-
disabled={page <= 1
|
|
440
|
+
variant="outline"
|
|
441
|
+
disabled={loading || page <= 1}
|
|
442
|
+
onClick={() => requestPage({ ...query, page: page - 1 })}
|
|
349
443
|
>
|
|
350
444
|
<ChevronLeft />
|
|
351
445
|
{t("Назад")}
|
|
352
446
|
</Button>
|
|
353
447
|
<Button
|
|
354
|
-
variant="outline"
|
|
355
448
|
size="sm"
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
disabled={page >= totalPages || loading}
|
|
449
|
+
variant="outline"
|
|
450
|
+
disabled={loading || page >= pages}
|
|
451
|
+
onClick={() => requestPage({ ...query, page: page + 1 })}
|
|
360
452
|
>
|
|
361
453
|
{t("Вперёд")}
|
|
362
454
|
<ChevronRight />
|
|
363
455
|
</Button>
|
|
364
456
|
</div>
|
|
365
|
-
</
|
|
457
|
+
</footer>
|
|
366
458
|
</Card>
|
|
459
|
+
|
|
460
|
+
<DistributionHistory
|
|
461
|
+
revision={historyRevision}
|
|
462
|
+
blocked={distributionBlocked}
|
|
463
|
+
onRestored={refreshReleases}
|
|
464
|
+
/>
|
|
367
465
|
</div>
|
|
368
466
|
);
|
|
369
467
|
}
|