File size: 2,152 Bytes
fc9bd9f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | import React from "react";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { useInstallExtra } from "@/hooks/useInstallExtra";
import {
InstallProgress,
InstallTitleIcon,
RestartInstructions,
installTitle,
} from "./InstallProgress";
interface Props {
open: boolean;
onOpenChange: (open: boolean) => void;
installHint: string;
}
const WandbInstallDialog: React.FC<Props> = ({ open, onOpenChange, installHint }) => {
const install = useInstallExtra("system/wandb-extra", open);
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="bg-slate-800 border-slate-700 text-white max-w-2xl">
<DialogHeader>
<DialogTitle className="flex items-center gap-3 text-white">
<InstallTitleIcon state={install.state} />
{installTitle(install.state, "Weights & Biases Not Installed")}
</DialogTitle>
<DialogDescription className="sr-only">
Install the wandb package to enable W&B logging.
</DialogDescription>
</DialogHeader>
<div className="space-y-4">
<InstallProgress
state={install.state}
error={install.error}
logs={install.logs}
logBoxRef={install.logBoxRef}
onInstall={install.handleInstall}
onRetry={install.handleRetry}
installHint={installHint}
packageName="wandb"
idleTitle="Weights & Biases Not Installed"
idleDescription={
<>
Enabling W&B logging requires the{" "}
<code className="px-1 py-0.5 rounded bg-slate-900 text-sky-300">
wandb
</code>{" "}
package, which isn't installed in this environment. Install it
to log this run to W&B.
</>
}
doneDescription={<RestartInstructions purpose="W&B logging" />}
/>
</div>
</DialogContent>
</Dialog>
);
};
export default WandbInstallDialog;
|