File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,15 @@ import Tooltip from "@material-ui/core/Tooltip"
6
6
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
7
7
import { FC } from "react"
8
8
import * as TypesGen from "../../api/typesGenerated"
9
+ import { generateRandomString } from "../../util/random"
9
10
import { BaseIcon } from "./BaseIcon"
10
11
import { ShareIcon } from "./ShareIcon"
11
12
13
+ const Language = {
14
+ appTitle : ( appName : string , identifier : string ) : string =>
15
+ `${ appName } - ${ identifier } ` ,
16
+ }
17
+
12
18
export interface AppLinkProps {
13
19
appsHost ?: string
14
20
workspace : TypesGen . Workspace
@@ -92,6 +98,18 @@ export const AppLink: FC<AppLinkProps> = ({
92
98
href = { href }
93
99
target = "_blank"
94
100
className = { canClick ? styles . link : styles . disabledLink }
101
+ onClick = {
102
+ canClick
103
+ ? ( event ) => {
104
+ event . preventDefault ( )
105
+ window . open (
106
+ href ,
107
+ Language . appTitle ( appDisplayName , generateRandomString ( 12 ) ) ,
108
+ "width=900,height=600" ,
109
+ )
110
+ }
111
+ : undefined
112
+ }
95
113
>
96
114
{ button }
97
115
</ Link >
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import ComputerIcon from "@material-ui/icons/Computer"
5
5
import { FC } from "react"
6
6
import * as TypesGen from "../../api/typesGenerated"
7
7
import { combineClasses } from "../../util/combineClasses"
8
+ import { generateRandomString } from "../../util/random"
8
9
9
10
export const Language = {
10
11
linkText : "Terminal" ,
12
+ terminalTitle : ( identifier : string ) : string => `Terminal - ${ identifier } ` ,
11
13
}
12
14
13
15
export interface TerminalLinkProps {
@@ -40,6 +42,14 @@ export const TerminalLink: FC<React.PropsWithChildren<TerminalLinkProps>> = ({
40
42
href = { href }
41
43
className = { combineClasses ( [ styles . link , className ] ) }
42
44
target = "_blank"
45
+ onClick = { ( event ) => {
46
+ event . preventDefault ( )
47
+ window . open (
48
+ href ,
49
+ Language . terminalTitle ( generateRandomString ( 12 ) ) ,
50
+ "width=900,height=600" ,
51
+ )
52
+ } }
43
53
>
44
54
< Button startIcon = { < ComputerIcon /> } size = "small" >
45
55
{ Language . linkText }
You can’t perform that action at this time.
0 commit comments