Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/(dashboard)/tiers/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function getConfig(row: TierRow): TierConfig | undefined {
return row.s3
case "aliyun":
return row.aliyun
case "tencent":
return row.tencent
case "huaweicloud":
return row.huaweicloud
case "azure":
return row.azure
case "gcs":
Expand Down
9 changes: 7 additions & 2 deletions components/tiers/new-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ interface TiersNewFormProps {

const TYPE_OPTIONS = [
{ labelKey: "RustFS", value: "rustfs", icon: "/logo.svg", descKey: "RustFS built-in cold storage" },
{ labelKey: "Minio", value: "minio", icon: "/svg/minio.svg", descKey: "External MinIO tier" },
{ labelKey: "MinIO", value: "minio", icon: "/svg/minio.svg", descKey: "External MinIO tier" },
{ labelKey: "AWS S3", value: "s3", icon: "/svg/aws.svg", descKey: "Standard AWS S3 tier" },
{ labelKey: "Aliyun OSS", value: "aliyun", icon: "/svg/aliyun.svg", descKey: "Alibaba Cloud Object Storage Service" },
{
labelKey: "Alibaba Cloud",
value: "aliyun",
icon: "/svg/aliyun.svg",
descKey: "Alibaba Cloud Object Storage Service",
},
{ labelKey: "Azure Blob", value: "azure", icon: "/svg/azure.svg", descKey: "Microsoft Azure Blob Storage" },
{ labelKey: "Google Cloud Storage", value: "gcs", icon: "/svg/google.svg", descKey: "Google Cloud Storage" },
{ labelKey: "Cloudflare R2", value: "r2", icon: "/svg/cloudflare.svg", descKey: "Cloudflare R2 Storage" },
Expand Down
7 changes: 3 additions & 4 deletions hooks/use-tiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export interface TierRow {
minio?: TierConfig
s3?: TierConfig
aliyun?: TierConfig
tencent?: TierConfig
huaweicloud?: TierConfig
azure?: TierConfig
gcs?: TierConfig
r2?: TierConfig
[key: string]: unknown
}

const UNSUPPORTED_TIER_TYPES = new Set(["huaweicloud", "tencent"])

export function useTiers() {
const api = useApi()

Expand All @@ -44,8 +44,7 @@ export function useTiers() {
)

const listTiers = useCallback(async () => {
const tiers = (await api.get("/tier")) as TierRow[] | undefined
return (tiers ?? []).filter((tier) => !UNSUPPORTED_TIER_TYPES.has(tier.type))
return api.get("/tier") as Promise<TierRow[]>
}, [api])

const removeTiers = useCallback(
Expand Down
16 changes: 10 additions & 6 deletions tests/lib/tier-support-source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from "node:test"
import assert from "node:assert/strict"
import fs from "node:fs"

test("tier UI no longer offers Huawei or Tencent storage support", () => {
test("tier picker hides Huawei and Tencent without filtering existing rows", () => {
const newFormSource = fs.readFileSync("components/tiers/new-form.tsx", "utf8")
const pageSource = fs.readFileSync("app/(dashboard)/tiers/page.tsx", "utf8")
const hookSource = fs.readFileSync("hooks/use-tiers.ts", "utf8")
Expand All @@ -11,9 +11,13 @@ test("tier UI no longer offers Huawei or Tencent storage support", () => {
assert.equal(newFormSource.includes("huaweiyun.svg"), false)
assert.equal(newFormSource.includes("Tencent COS"), false)
assert.equal(newFormSource.includes("tenxunyun.svg"), false)
assert.equal(pageSource.includes("row.huaweicloud"), false)
assert.equal(pageSource.includes("row.tencent"), false)
assert.equal(hookSource.includes("huaweicloud?: TierConfig"), false)
assert.equal(hookSource.includes("tencent?: TierConfig"), false)
assert.equal(hookSource.includes('UNSUPPORTED_TIER_TYPES = new Set(["huaweicloud", "tencent"])'), true)
assert.equal(newFormSource.includes('labelKey: "Aliyun OSS"'), false)
assert.equal(newFormSource.includes('labelKey: "Minio"'), false)
assert.equal(newFormSource.includes('labelKey: "Alibaba Cloud"'), true)
assert.equal(newFormSource.includes('labelKey: "MinIO"'), true)
assert.equal(pageSource.includes("row.huaweicloud"), true)
assert.equal(pageSource.includes("row.tencent"), true)
assert.equal(hookSource.includes("huaweicloud?: TierConfig"), true)
assert.equal(hookSource.includes("tencent?: TierConfig"), true)
assert.equal(hookSource.includes("UNSUPPORTED_TIER_TYPES"), false)
})