Skip to content

Commit 6d45da6

Browse files
committed
feat: add on-demand migration management
1 parent fd02c55 commit 6d45da6

36 files changed

Lines changed: 6656 additions & 27 deletions
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"use client"
2+
3+
import Link from "next/link"
4+
import { useSearchParams } from "next/navigation"
5+
import { useTranslation } from "react-i18next"
6+
import { RiArrowLeftLine } from "@remixicon/react"
7+
import { BucketList } from "@/components/buckets/list"
8+
import { OnDemandMigrationManagement } from "@/components/on-demand-migration/management"
9+
import { Page } from "@/components/page"
10+
import { PageHeader } from "@/components/page-header"
11+
import { Button } from "@/components/ui/button"
12+
import { buildModuleBucketPath } from "@/lib/module-bucket-route"
13+
14+
export default function OnDemandMigrationPage() {
15+
const { t } = useTranslation()
16+
const searchParams = useSearchParams()
17+
const bucketName = searchParams.get("bucket") ?? ""
18+
19+
if (!bucketName) {
20+
return (
21+
<Page>
22+
<BucketList
23+
title={<h1 className="text-2xl font-bold">{t("On-demand migration")}</h1>}
24+
emptyDescription={t("Create a bucket before configuring an external migration source.")}
25+
getBucketHref={(name) => buildModuleBucketPath("/on-demand-migration", name)}
26+
/>
27+
</Page>
28+
)
29+
}
30+
31+
return (
32+
<Page>
33+
<OnDemandMigrationManagement
34+
key={bucketName}
35+
bucketName={bucketName}
36+
renderHeader={(actions) => (
37+
<PageHeader
38+
description={
39+
<p className="text-sm text-muted-foreground">
40+
{t("Bucket")}: <span className="break-all font-medium text-foreground">{bucketName}</span>
41+
</p>
42+
}
43+
actions={
44+
<>
45+
<Button
46+
variant="outline"
47+
className="min-h-11 sm:min-h-0"
48+
nativeButton={false}
49+
render={<Link href="/on-demand-migration" />}
50+
>
51+
<RiArrowLeftLine data-icon="inline-start" aria-hidden />
52+
<span>{t("Buckets")}</span>
53+
</Button>
54+
{actions}
55+
</>
56+
}
57+
>
58+
<h1 className="text-2xl font-bold">{t("On-demand migration")}</h1>
59+
</PageHeader>
60+
)}
61+
/>
62+
</Page>
63+
)
64+
}

‎components/buckets/info.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useBucket } from "@/hooks/use-bucket"
88
import { usePermissions } from "@/hooks/use-permissions"
99
import { useSSE } from "@/hooks/use-sse"
1010
import { BucketSettingRow, BucketSettingsSection } from "@/components/buckets/settings-layout"
11+
import { OnDemandMigrationSettingsRow } from "@/components/on-demand-migration/settings-row"
1112
import { Button } from "@/components/ui/button"
1213
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
1314
import { Switch } from "@/components/ui/switch"
@@ -1061,6 +1062,7 @@ export function BucketInfo({ bucketName }: BucketInfoProps) {
10611062
}
10621063
/>
10631064
))}
1065+
<OnDemandMigrationSettingsRow bucketName={bucketName} />
10641066
</BucketSettingsSection>
10651067
</div>
10661068

0 commit comments

Comments
 (0)