client/web: pipe newSession through to readonly view

Updates tailscale/corp#14335

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy 2023-11-07 10:55:55 -05:00 committed by Sonia Appasamy
parent d73e923b73
commit de2af54ffc

View File

@ -4,7 +4,7 @@ import LegacyClientView from "src/components/views/legacy-client-view"
import LoginClientView from "src/components/views/login-client-view" import LoginClientView from "src/components/views/login-client-view"
import ManagementClientView from "src/components/views/management-client-view" import ManagementClientView from "src/components/views/management-client-view"
import ReadonlyClientView from "src/components/views/readonly-client-view" import ReadonlyClientView from "src/components/views/readonly-client-view"
import useAuth, { AuthResponse, SessionsCallbacks } from "src/hooks/auth" import useAuth, { AuthResponse } from "src/hooks/auth"
import useNodeData, { NodeData, NodeUpdate } from "src/hooks/node-data" import useNodeData, { NodeData, NodeUpdate } from "src/hooks/node-data"
import { ReactComponent as TailscaleIcon } from "src/icons/tailscale-icon.svg" import { ReactComponent as TailscaleIcon } from "src/icons/tailscale-icon.svg"
import ProfilePic from "src/ui/profile-pic" import ProfilePic from "src/ui/profile-pic"
@ -12,7 +12,7 @@ import { Link, Route, Switch, useLocation } from "wouter"
import DeviceDetailsView from "./views/device-details-view" import DeviceDetailsView from "./views/device-details-view"
export default function App() { export default function App() {
const { data: auth, loading: loadingAuth, sessions } = useAuth() const { data: auth, loading: loadingAuth, newSession } = useAuth()
const { data, refreshData, updateNode } = useNodeData() const { data, refreshData, updateNode } = useNodeData()
useEffect(() => { useEffect(() => {
refreshData() refreshData()
@ -32,7 +32,7 @@ export default function App() {
<HomeView <HomeView
auth={auth} auth={auth}
data={data} data={data}
sessions={sessions} newSession={newSession}
refreshData={refreshData} refreshData={refreshData}
updateNode={updateNode} updateNode={updateNode}
/> />
@ -60,13 +60,13 @@ export default function App() {
function HomeView({ function HomeView({
auth, auth,
data, data,
sessions, newSession,
refreshData, refreshData,
updateNode, updateNode,
}: { }: {
auth?: AuthResponse auth?: AuthResponse
data: NodeData data: NodeData
sessions: SessionsCallbacks newSession: () => Promise<void>
refreshData: () => Promise<void> refreshData: () => Promise<void>
updateNode: (update: NodeUpdate) => void updateNode: (update: NodeUpdate) => void
}) { }) {
@ -83,7 +83,7 @@ function HomeView({
<ManagementClientView {...data} /> <ManagementClientView {...data} />
) : data.DebugMode === "login" || data.DebugMode === "full" ? ( ) : data.DebugMode === "login" || data.DebugMode === "full" ? (
// Render new client interface in readonly mode. // Render new client interface in readonly mode.
<ReadonlyClientView data={data} auth={auth} sessions={sessions} /> <ReadonlyClientView data={data} auth={auth} newSession={newSession} />
) : ( ) : (
// Render legacy client interface. // Render legacy client interface.
<LegacyClientView <LegacyClientView