mirror of
https://github.com/khairul169/garage-webui.git
synced 2026-09-18 10:23:21 +07:00
feat: add bucket browser
This commit is contained in:
@@ -10,16 +10,22 @@ const BucketsPage = () => {
|
||||
const [search, setSearch] = useState("");
|
||||
|
||||
const items = useMemo(() => {
|
||||
if (!search?.length) {
|
||||
return data;
|
||||
let buckets = data || [];
|
||||
|
||||
if (search?.length > 0) {
|
||||
const q = search.toLowerCase();
|
||||
buckets = buckets.filter(
|
||||
(bucket) =>
|
||||
bucket.id.includes(q) ||
|
||||
bucket.globalAliases.find((alias) => alias.includes(q))
|
||||
);
|
||||
}
|
||||
|
||||
const q = search.toLowerCase();
|
||||
return data?.filter(
|
||||
(bucket) =>
|
||||
bucket.id.includes(q) ||
|
||||
bucket.globalAliases.find((alias) => alias.includes(q))
|
||||
buckets = buckets.sort((a, b) =>
|
||||
a.globalAliases[0].localeCompare(b.globalAliases[0])
|
||||
);
|
||||
|
||||
return buckets;
|
||||
}, [data, search]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user