Skip to content

fix: use workspace name when opening links via the terminal #6077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions site/src/pages/TerminalPage/TerminalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const TerminalPage: FC<
> = ({ renderer }) => {
const navigate = useNavigate()
const styles = useStyles()
const { username, workspace } = useParams()
const { username, workspace: workspaceName } = useParams()
const xtermRef = useRef<HTMLDivElement>(null)
const [terminal, setTerminal] = useState<XTerm.Terminal | null>(null)
const [fitAddon, setFitAddon] = useState<FitAddon | null>(null)
Expand All @@ -68,7 +68,7 @@ const TerminalPage: FC<
const command = searchParams.get("command") || undefined
// The workspace name is in the format:
// <workspace name>[.<agent name>]
const workspaceNameParts = workspace?.split(".")
const workspaceNameParts = workspaceName?.split(".")
const [terminalState, sendEvent] = useMachine(terminalMachine, {
context: {
agentName: workspaceNameParts?.[1],
Expand All @@ -93,6 +93,7 @@ const TerminalPage: FC<
const isDisconnected = terminalState.matches("disconnected")
const {
workspaceError,
workspace,
workspaceAgentError,
workspaceAgent,
websocketError,
Expand Down Expand Up @@ -134,9 +135,9 @@ const TerminalPage: FC<
applicationsHost,
parseInt(url.port),
workspaceAgent.name,
workspace,
workspace.name,
username,
),
) + url.pathname,
)
} catch (ex) {
open(uri)
Expand Down