mirror of https://github.com/coder/coder.git
fix: make public menu item selectable (#12484)
This commit is contained in:
parent
5e9bf31229
commit
dc69341583
|
@ -205,21 +205,15 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
|
|||
const canSharePortsPublic =
|
||||
canSharePorts && template.max_port_share_level === "public";
|
||||
|
||||
const publicMenuItem = (
|
||||
<>
|
||||
{canSharePortsPublic ? (
|
||||
<MenuItem value="public">Public</MenuItem>
|
||||
) : (
|
||||
<Tooltip title="This workspace template does not allow sharing ports with unauthenticated users.">
|
||||
{/* Tooltips don't work directly on disabled MenuItem components so you must wrap in div. */}
|
||||
<div>
|
||||
<MenuItem value="public" disabled>
|
||||
Public
|
||||
</MenuItem>
|
||||
</div>
|
||||
</Tooltip>
|
||||
)}
|
||||
</>
|
||||
const disabledPublicMenuItem = (
|
||||
<Tooltip title="This workspace template does not allow sharing ports with unauthenticated users.">
|
||||
{/* Tooltips don't work directly on disabled MenuItem components so you must wrap in div. */}
|
||||
<div>
|
||||
<MenuItem value="public" disabled>
|
||||
Public
|
||||
</MenuItem>
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -447,7 +441,11 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
|
|||
<MenuItem value="authenticated">
|
||||
Authenticated
|
||||
</MenuItem>
|
||||
{publicMenuItem}
|
||||
{canSharePortsPublic ? (
|
||||
<MenuItem value="public">Public</MenuItem>
|
||||
) : (
|
||||
disabledPublicMenuItem
|
||||
)}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<Button
|
||||
|
@ -512,7 +510,11 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
|
|||
label="Sharing Level"
|
||||
>
|
||||
<MenuItem value="authenticated">Authenticated</MenuItem>
|
||||
{publicMenuItem}
|
||||
{canSharePortsPublic ? (
|
||||
<MenuItem value="public">Public</MenuItem>
|
||||
) : (
|
||||
disabledPublicMenuItem
|
||||
)}
|
||||
</TextField>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
|
|
Loading…
Reference in New Issue