Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: open terminal and coder_app in a new tab, not window #6044

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 2 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
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
18 changes: 0 additions & 18 deletions site/src/components/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ import Tooltip from "@material-ui/core/Tooltip"
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
import { FC } from "react"
import * as TypesGen from "../../api/typesGenerated"
import { generateRandomString } from "../../util/random"
import { BaseIcon } from "./BaseIcon"
import { ShareIcon } from "./ShareIcon"

const Language = {
appTitle: (appName: string, identifier: string): string =>
`${appName} - ${identifier}`,
}

export interface AppLinkProps {
appsHost?: string
workspace: TypesGen.Workspace
Expand Down Expand Up @@ -98,18 +92,6 @@ export const AppLink: FC<AppLinkProps> = ({
href={href}
target="_blank"
className={canClick ? styles.link : styles.disabledLink}
onClick={
canClick
? (event) => {
event.preventDefault()
window.open(
href,
Language.appTitle(appDisplayName, generateRandomString(12)),
"width=900,height=600",
)
}
: undefined
}
>
{button}
</Link>
Expand Down
10 changes: 0 additions & 10 deletions site/src/components/TerminalLink/TerminalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import ComputerIcon from "@material-ui/icons/Computer"
import { FC } from "react"
import * as TypesGen from "../../api/typesGenerated"
import { combineClasses } from "../../util/combineClasses"
import { generateRandomString } from "../../util/random"

export const Language = {
linkText: "Terminal",
terminalTitle: (identifier: string): string => `Terminal - ${identifier}`,
}

export interface TerminalLinkProps {
Expand Down Expand Up @@ -42,14 +40,6 @@ export const TerminalLink: FC<React.PropsWithChildren<TerminalLinkProps>> = ({
href={href}
className={combineClasses([styles.link, className])}
target="_blank"
onClick={(event) => {
event.preventDefault()
window.open(
href,
Language.terminalTitle(generateRandomString(12)),
"width=900,height=600",
)
}}
>
<Button startIcon={<ComputerIcon />} size="small">
{Language.linkText}
Expand Down