mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
fix: open terminal and coder_app in a new tab, not window (#6044)
* fix!: open coder_app in a new tab, not window * terminal too
This commit is contained in:
@ -6,15 +6,9 @@ import Tooltip from "@material-ui/core/Tooltip"
|
|||||||
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
|
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
|
||||||
import { FC } from "react"
|
import { FC } from "react"
|
||||||
import * as TypesGen from "../../api/typesGenerated"
|
import * as TypesGen from "../../api/typesGenerated"
|
||||||
import { generateRandomString } from "../../util/random"
|
|
||||||
import { BaseIcon } from "./BaseIcon"
|
import { BaseIcon } from "./BaseIcon"
|
||||||
import { ShareIcon } from "./ShareIcon"
|
import { ShareIcon } from "./ShareIcon"
|
||||||
|
|
||||||
const Language = {
|
|
||||||
appTitle: (appName: string, identifier: string): string =>
|
|
||||||
`${appName} - ${identifier}`,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AppLinkProps {
|
export interface AppLinkProps {
|
||||||
appsHost?: string
|
appsHost?: string
|
||||||
workspace: TypesGen.Workspace
|
workspace: TypesGen.Workspace
|
||||||
@ -98,18 +92,6 @@ export const AppLink: FC<AppLinkProps> = ({
|
|||||||
href={href}
|
href={href}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className={canClick ? styles.link : styles.disabledLink}
|
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}
|
{button}
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -5,11 +5,9 @@ import ComputerIcon from "@material-ui/icons/Computer"
|
|||||||
import { FC } from "react"
|
import { FC } from "react"
|
||||||
import * as TypesGen from "../../api/typesGenerated"
|
import * as TypesGen from "../../api/typesGenerated"
|
||||||
import { combineClasses } from "../../util/combineClasses"
|
import { combineClasses } from "../../util/combineClasses"
|
||||||
import { generateRandomString } from "../../util/random"
|
|
||||||
|
|
||||||
export const Language = {
|
export const Language = {
|
||||||
linkText: "Terminal",
|
linkText: "Terminal",
|
||||||
terminalTitle: (identifier: string): string => `Terminal - ${identifier}`,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TerminalLinkProps {
|
export interface TerminalLinkProps {
|
||||||
@ -42,14 +40,6 @@ export const TerminalLink: FC<React.PropsWithChildren<TerminalLinkProps>> = ({
|
|||||||
href={href}
|
href={href}
|
||||||
className={combineClasses([styles.link, className])}
|
className={combineClasses([styles.link, className])}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
onClick={(event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
window.open(
|
|
||||||
href,
|
|
||||||
Language.terminalTitle(generateRandomString(12)),
|
|
||||||
"width=900,height=600",
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Button startIcon={<ComputerIcon />} size="small">
|
<Button startIcon={<ComputerIcon />} size="small">
|
||||||
{Language.linkText}
|
{Language.linkText}
|
||||||
|
Reference in New Issue
Block a user