diff --git a/ee/tabby-ui/app/(dashboard)/cluster/components/cluster.tsx b/ee/tabby-ui/app/(dashboard)/cluster/components/cluster.tsx index 95fd0f0..9436c75 100644 --- a/ee/tabby-ui/app/(dashboard)/cluster/components/cluster.tsx +++ b/ee/tabby-ui/app/(dashboard)/cluster/components/cluster.tsx @@ -6,7 +6,8 @@ import { useHealth } from '@/lib/hooks/use-health' import { useWorkers } from '@/lib/hooks/use-workers' import { useAuthenticatedGraphQLQuery, useGraphQLForm } from '@/lib/tabby/gql' import { Button } from '@/components/ui/button' -import { IconRefresh } from '@/components/ui/icons' +import { IconRotate } from '@/components/ui/icons' +import { Input } from '@/components/ui/input' import { Separator } from '@/components/ui/separator' import { CopyButton } from '@/components/copy-button' @@ -66,16 +67,17 @@ export default function Workers() { {!!registrationTokenRes?.registrationToken && (
Registration token: - - {registrationTokenRes.registrationToken} - +
diff --git a/ee/tabby-ui/app/(dashboard)/page.tsx b/ee/tabby-ui/app/(dashboard)/page.tsx index 82d9e5a..b939aeb 100644 --- a/ee/tabby-ui/app/(dashboard)/page.tsx +++ b/ee/tabby-ui/app/(dashboard)/page.tsx @@ -4,14 +4,17 @@ import { useEffect, useState } from 'react' import { graphql } from '@/lib/gql/generates' import { useHealth } from '@/lib/hooks/use-health' -import { useAuthenticatedGraphQLQuery } from '@/lib/tabby/gql' +import { useAuthenticatedGraphQLQuery, useGraphQLForm } from '@/lib/tabby/gql' +import { Button } from '@/components/ui/button' import { CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card' +import { IconRotate } from '@/components/ui/icons' import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' import { CopyButton } from '@/components/copy-button' import SlackDialog from '@/components/slack-dialog' @@ -32,14 +35,27 @@ const meQuery = graphql(/* GraphQL */ ` } `) +const resetUserAuthTokenDocument = graphql(/* GraphQL */ ` + mutation ResetUserAuthToken { + resetUserAuthToken + } +`) + function MainPanel() { const { data: healthInfo } = useHealth() - const { data } = useAuthenticatedGraphQLQuery(meQuery) + const { data, mutate } = useAuthenticatedGraphQLQuery(meQuery) const [origin, setOrigin] = useState('') useEffect(() => { setOrigin(new URL(window.location.href).origin) }, []) + const { onSubmit: resetUserAuthToken } = useGraphQLForm( + resetUserAuthTokenDocument, + { + onSuccess: () => mutate() + } + ) + if (!healthInfo || !data) return return ( @@ -47,21 +63,28 @@ function MainPanel() { Getting Started - - - Endpoint URL - - - - + + + + + - - Token - - - - + + + + + diff --git a/ee/tabby-ui/components/ui/icons.tsx b/ee/tabby-ui/components/ui/icons.tsx index ea15ee7..5abadda 100644 --- a/ee/tabby-ui/components/ui/icons.tsx +++ b/ee/tabby-ui/components/ui/icons.tsx @@ -660,6 +660,27 @@ function IconNetwork({ className, ...props }: React.ComponentProps<'svg'>) { ) } +function IconRotate({ className, ...props }: React.ComponentProps<'svg'>) { + return ( + + + + + ) +} + export { IconEdit, IconNextChat, @@ -694,5 +715,6 @@ export { IconLogout, IconUnlock, IconHome, - IconNetwork + IconNetwork, + IconRotate }