mirror of
https://github.com/khairul169/garage-webui.git
synced 2026-09-15 00:43:21 +07:00
feat: add cluster & bucket management
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Hono } from "hono";
|
||||
import api from "../lib/api";
|
||||
|
||||
export const buckets = new Hono()
|
||||
|
||||
/**
|
||||
* Get all buckets
|
||||
*/
|
||||
.get("/", async (c) => {
|
||||
const data = await api.get("/v1/bucket?list");
|
||||
|
||||
const buckets = await Promise.all(
|
||||
data.map(async (bucket: any) => {
|
||||
return api.get("/v1/bucket", { params: { id: bucket.id } });
|
||||
})
|
||||
);
|
||||
|
||||
return c.json(buckets);
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Hono } from "hono";
|
||||
import { config } from "../lib/garage";
|
||||
|
||||
export const configRoute = new Hono()
|
||||
|
||||
/**
|
||||
* Get garage config
|
||||
*/
|
||||
.get("/", async (c) => {
|
||||
const data = {
|
||||
...(config || {}),
|
||||
rpc_secret: undefined,
|
||||
admin: {
|
||||
...(config?.admin || {}),
|
||||
admin_token: undefined,
|
||||
metrics_token: undefined,
|
||||
},
|
||||
};
|
||||
|
||||
return c.json(data);
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Hono } from "hono";
|
||||
import { buckets } from "./buckets";
|
||||
import { configRoute } from "./config";
|
||||
|
||||
const router = new Hono()
|
||||
//
|
||||
.route("/config", configRoute)
|
||||
.route("/buckets", buckets);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user