client/web: hide admin panel links for non-tailscale control servers

Updates #10261

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy
2023-11-29 15:58:56 -05:00
committed by Sonia Appasamy
parent 8af503b0c5
commit bcc9b44cb1
8 changed files with 105 additions and 40 deletions
+16 -14
View File
@@ -2,16 +2,17 @@
// SPDX-License-Identifier: BSD-3-Clause
import React from "react"
import { NodeUpdaters } from "src/hooks/node-data"
import * as Control from "src/components/control-components"
import { NodeData, NodeUpdaters } from "src/hooks/node-data"
import Toggle from "src/ui/toggle"
export default function SSHView({
readonly,
runningSSH,
node,
nodeUpdaters,
}: {
readonly: boolean
runningSSH: boolean
node: NodeData
nodeUpdaters: NodeUpdaters
}) {
return (
@@ -31,9 +32,12 @@ export default function SSHView({
</p>
<div className="-mx-5 px-4 py-3 bg-white rounded-lg border border-gray-200 flex gap-2.5 mb-3">
<Toggle
checked={runningSSH}
checked={node.RunningSSHServer}
onChange={() =>
nodeUpdaters.patchPrefs({ RunSSHSet: true, RunSSH: !runningSSH })
nodeUpdaters.patchPrefs({
RunSSHSet: true,
RunSSH: !node.RunningSSHServer,
})
}
disabled={readonly}
/>
@@ -41,18 +45,16 @@ export default function SSHView({
Run Tailscale SSH server
</div>
</div>
<p className="text-neutral-500 text-sm leading-tight">
<Control.AdminContainer
className="text-neutral-500 text-sm leading-tight"
node={node}
>
Remember to make sure that the{" "}
<a
href="https://login.tailscale.com/admin/acls/"
className="text-indigo-700"
target="_blank"
rel="noreferrer"
>
<Control.AdminLink node={node} path="/acls">
tailnet policy file
</a>{" "}
</Control.AdminLink>{" "}
allows other devices to SSH into this device.
</p>
</Control.AdminContainer>
</>
)
}