mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 04:30:06 +00:00
feat: 调整安装脚本复制位置
This commit is contained in:
@@ -4,9 +4,10 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu"
|
} from "@/components/ui/dropdown-menu"
|
||||||
import { ButtonProps } from "@/components/ui/button"
|
import { Button, ButtonProps } from "@/components/ui/button"
|
||||||
import { forwardRef, useState } from "react"
|
import { forwardRef, useState } from "react"
|
||||||
import { IconButton } from "./xui/icon-button"
|
import { Check, Clipboard } from "lucide-react"
|
||||||
|
import { t } from "i18next"
|
||||||
|
|
||||||
export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
||||||
const [copy, setCopy] = useState(false);
|
const [copy, setCopy] = useState(false);
|
||||||
@@ -17,16 +18,17 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
|
|||||||
await navigator.clipboard.writeText("stub");
|
await navigator.clipboard.writeText("stub");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setCopy(false);
|
setCopy(false);
|
||||||
}, 2 * 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<IconButton {...props} ref={ref} variant="outline" size="icon" icon={
|
<Button {...props} ref={ref}>
|
||||||
copy ? "check" : "clipboard"
|
{copy ? <Check /> : <Clipboard />}
|
||||||
} />
|
{t("InstallCommands")}
|
||||||
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent>
|
<DropdownMenuContent>
|
||||||
<DropdownMenuItem onClick={switchState}>Linux</DropdownMenuItem>
|
<DropdownMenuItem onClick={switchState}>Linux</DropdownMenuItem>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default function ServerPage() {
|
|||||||
toast(t("Error"), {
|
toast(t("Error"), {
|
||||||
description: t("Results.ErrorFetchingResource", { error: error.message }),
|
description: t("Results.ErrorFetchingResource", { error: error.message }),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [error]);
|
}, [error]);
|
||||||
|
|
||||||
const columns: ColumnDef<Server>[] = [
|
const columns: ColumnDef<Server>[] = [
|
||||||
@@ -46,7 +46,7 @@ export default function ServerPage() {
|
|||||||
<Checkbox
|
<Checkbox
|
||||||
checked={
|
checked={
|
||||||
table.getIsAllPageRowsSelected() ||
|
table.getIsAllPageRowsSelected() ||
|
||||||
(table.getIsSomePageRowsSelected() && "indeterminate")
|
(table.getIsSomePageRowsSelected() && "indeterminate")
|
||||||
}
|
}
|
||||||
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
||||||
aria-label="Select all"
|
aria-label="Select all"
|
||||||
@@ -108,11 +108,6 @@ export default function ServerPage() {
|
|||||||
accessorKey: "hideForGuest",
|
accessorKey: "hideForGuest",
|
||||||
accessorFn: (row) => row.hide_for_guest ?? false,
|
accessorFn: (row) => row.hide_for_guest ?? false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: "installCommands",
|
|
||||||
header: t("InstallCommands"),
|
|
||||||
cell: () => <InstallCommandsMenu />,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: "note",
|
id: "note",
|
||||||
header: t("Note"),
|
header: t("Note"),
|
||||||
@@ -187,13 +182,14 @@ export default function ServerPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toast(t("Done"), {
|
toast(t("Done"), {
|
||||||
description: t("Results.ForceUpdate")
|
description: t("Results.ForceUpdate")
|
||||||
+ (resp.success?.length ? t(`Success`) + ` [${resp.success.join(",")}]` : "")
|
+ (resp.success?.length ? t(`Success`) + ` [${resp.success.join(",")}]` : "")
|
||||||
+ (resp.failure?.length ? t(`Failure`) + ` [${resp.failure.join(",")}]` : "")
|
+ (resp.failure?.length ? t(`Failure`) + ` [${resp.failure.join(",")}]` : "")
|
||||||
+ (resp.offline?.length ? t(`Offline`) + ` [${resp.offline.join(",")}]` : "")
|
+ (resp.offline?.length ? t(`Offline`) + ` [${resp.offline.join(",")}]` : "")
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<InstallCommandsMenu className="bg-blue-700" />
|
||||||
</HeaderButtonGroup>
|
</HeaderButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
<Table>
|
<Table>
|
||||||
|
|||||||
Reference in New Issue
Block a user