mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-10-14 23:09:32 +07:00
Delete all related to object lock
This commit is contained in:
parent
2f86d52dac
commit
e9efea9309
@ -1,8 +1,11 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"khairul169/garage-webui/utils"
|
"khairul169/garage-webui/utils"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -10,6 +13,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func ProxyHandler(w http.ResponseWriter, r *http.Request) {
|
func ProxyHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Log CreateBucket requests
|
||||||
|
if strings.Contains(r.URL.Path, "CreateBucket") && r.Method == "POST" {
|
||||||
|
body, err := io.ReadAll(r.Body)
|
||||||
|
if err == nil {
|
||||||
|
log.Printf("CreateBucket request body: %s", string(body))
|
||||||
|
// Restore body for proxy
|
||||||
|
r.Body = io.NopCloser(bytes.NewReader(body))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
target, err := url.Parse(utils.Garage.GetAdminEndpoint())
|
target, err := url.Parse(utils.Garage.GetAdminEndpoint())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.ResponseError(w, err)
|
utils.ResponseError(w, err)
|
||||||
|
@ -14,9 +14,16 @@ const BucketCard = ({ data }: Props) => {
|
|||||||
<div className="flex flex-row items-start gap-x-3 col-span-2">
|
<div className="flex flex-row items-start gap-x-3 col-span-2">
|
||||||
<ArchiveIcon size={28} className="shrink-0" />
|
<ArchiveIcon size={28} className="shrink-0" />
|
||||||
|
|
||||||
<p className="text-xl font-medium truncate">
|
<div className="flex-1 min-w-0">
|
||||||
{data.aliases?.join(", ")}
|
<div className="flex flex-row items-center gap-2">
|
||||||
</p>
|
<p className="text-xl font-medium truncate">
|
||||||
|
{data.aliases?.join(", ")}
|
||||||
|
</p>
|
||||||
|
{data.websiteAccess && (
|
||||||
|
<div className="badge badge-sm badge-primary">Website</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -29,7 +29,7 @@ export const useCreateBucket = (
|
|||||||
options?: UseMutationOptions<any, Error, CreateBucketSchema>
|
options?: UseMutationOptions<any, Error, CreateBucketSchema>
|
||||||
) => {
|
) => {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (body) => api.post("/v2/CreateBucket", { body }),
|
mutationFn: (body) => api.post("/v2/CreateBucket", body),
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
import { useDenyKey } from "../hooks";
|
import { useDenyKey } from "../hooks";
|
||||||
import { Card, Checkbox, Table } from "react-daisyui";
|
import { Card, Checkbox, Table } from "react-daisyui";
|
||||||
import Button from "@/components/ui/button";
|
import Button from "@/components/ui/button";
|
||||||
import { Trash, Shield, Lock, Settings } from "lucide-react";
|
import { Trash, Shield } from "lucide-react";
|
||||||
import AllowKeyDialog from "./allow-key-dialog";
|
import AllowKeyDialog from "./allow-key-dialog";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { handleError } from "@/lib/utils";
|
import { handleError } from "@/lib/utils";
|
||||||
import { useBucketContext } from "../context";
|
import { useBucketContext } from "../context";
|
||||||
import KeyPermissionsEditor from "@/components/s3-permissions/key-permissions-editor";
|
import KeyPermissionsEditor from "@/components/s3-permissions/key-permissions-editor";
|
||||||
import ObjectLockingManager from "@/components/s3-permissions/object-locking-manager";
|
|
||||||
|
|
||||||
const PermissionsTab = () => {
|
const PermissionsTab = () => {
|
||||||
const { bucket, refetch } = useBucketContext();
|
const { bucket, refetch } = useBucketContext();
|
||||||
const [selectedKey, setSelectedKey] = useState<{accessKeyId: string, name: string} | null>(null);
|
const [selectedKey, setSelectedKey] = useState<{accessKeyId: string, name: string} | null>(null);
|
||||||
const [showKeyEditor, setShowKeyEditor] = useState(false);
|
const [showKeyEditor, setShowKeyEditor] = useState(false);
|
||||||
const [showObjectLocking, setShowObjectLocking] = useState(false);
|
|
||||||
|
|
||||||
const denyKey = useDenyKey(bucket.id, {
|
const denyKey = useDenyKey(bucket.id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@ -55,13 +53,6 @@ const PermissionsTab = () => {
|
|||||||
<Card className="card-body">
|
<Card className="card-body">
|
||||||
<div className="flex flex-row items-center gap-2">
|
<div className="flex flex-row items-center gap-2">
|
||||||
<Card.Title className="flex-1 truncate">Access Keys</Card.Title>
|
<Card.Title className="flex-1 truncate">Access Keys</Card.Title>
|
||||||
<Button
|
|
||||||
icon={Lock}
|
|
||||||
onClick={() => setShowObjectLocking(true)}
|
|
||||||
className="btn-outline btn-sm"
|
|
||||||
>
|
|
||||||
Object Lock
|
|
||||||
</Button>
|
|
||||||
<AllowKeyDialog currentKeys={keys?.map((key) => key.accessKeyId)} />
|
<AllowKeyDialog currentKeys={keys?.map((key) => key.accessKeyId)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -140,15 +131,6 @@ const PermissionsTab = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Object Locking Manager Modal */}
|
|
||||||
{showObjectLocking && (
|
|
||||||
<ObjectLockingManager
|
|
||||||
bucketId={bucket.id}
|
|
||||||
bucketName={bucket.globalAliases?.[0] || bucket.id}
|
|
||||||
isOpen={showObjectLocking}
|
|
||||||
onClose={() => setShowObjectLocking(false)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user