diff --git a/CHANGELOG b/CHANGELOG index 12f3c32bd..5134370bd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ This project _loosely_ adheres to [Semantic Versioning](https://semver.org/spec/ ## unreleased ### Added + - Add ability to get and add Holochain agent infos through launcher [PR#463](https://github.com/coasys/ad4m/pull/463) ### Changed - Much improved ADAM Launcher setup flow [PR#440](https://github.com/coasys/ad4m/pull/440) and [PR#444](https://github.com/coasys/ad4m/pull/444): diff --git a/ui/src/components/Settings.tsx b/ui/src/components/Settings.tsx index 90de84d33..b0b813037 100644 --- a/ui/src/components/Settings.tsx +++ b/ui/src/components/Settings.tsx @@ -15,6 +15,7 @@ import { AgentContext } from "../context/AgentContext"; import ActionButton from "./ActionButton"; import { appWindow } from "@tauri-apps/api/window"; import { open } from "@tauri-apps/api/shell"; +import { writeText } from '@tauri-apps/api/clipboard' type Props = { did: String; @@ -67,12 +68,18 @@ const Profile = (props: Props) => { const [qrcodeModal, setQRCodeModal] = useState(false); + const [copied, setCopied] = useState(false); + const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [loadingProxy, setLoadingProxy] = useState(false); + const [showAddHcAgentInfos, setShowAddHcAgentInfos] = useState(false); + + const [addHcAgentInfos, setAddHcAgentInfos] = useState(""); + function openLogs() { appWindow.emit("copyLogs"); } @@ -123,6 +130,26 @@ const Profile = (props: Props) => { } }, [url]); + const getAgentInfo = async () => { + const info = await client?.runtime.hcAgentInfos(); + + console.log("info", info); + + await writeText(info); + + setCopied(true); + + setTimeout(() => { + setCopied(false); + closeSecretCodeModal(); + }, 3000); + } + + const addAgentInfo = async (info: string) => { + await client?.runtime.hcAddAgentInfos(info); + setShowAddHcAgentInfos(false); + } + useEffect(() => { fetchCurrentAgentProfile(); getTrustedAgents(); @@ -253,6 +280,36 @@ const Profile = (props: Props) => { + {expertMode && ( +