@@ -31,6 +31,52 @@ import { Props as BaseProps } from "./RestartableTerminal"
31
31
import "../../web/scss/components/Allotment/_index.scss"
32
32
import "allotment/dist/style.css"
33
33
34
+ export type Props = Pick < BaseProps , "tab" | "REPL" | "onExit" | "searchable" | "fontSizeAdjust" > & {
35
+ /** Default guidebook (if not given, we will take the value from the client definition); `null` means do not show anything */
36
+ defaultGuidebook ?: string | null
37
+
38
+ /** Run guidebook in non-interactive mode? */
39
+ defaultNoninteractive ?: boolean
40
+
41
+ /** Any extra env vars to add to the guidebook execution. These will be pre-joined with the default env. */
42
+ extraEnv ?: BaseProps [ "env" ]
43
+
44
+ /** Callback when user selects a profile */
45
+ onSelectProfile ?( profile : string , profiles ?: import ( "madwizard" ) . Profiles . Profile [ ] ) : void
46
+
47
+ /** Content to place above the terminal */
48
+ aboveTerminal ?: React . ReactNode
49
+
50
+ /** Default left-right split */
51
+ lrSplit ?: [ number , number ]
52
+ }
53
+
54
+ type State = Partial < Pick < BaseProps , "cmdline" | "env" > > & {
55
+ /** Number of times we have called this.init() */
56
+ initCount : number
57
+
58
+ /** Internal error in rendering */
59
+ error ?: boolean
60
+
61
+ /** Use this guidebook in the terminal execution */
62
+ guidebook ?: string | null
63
+
64
+ /** Any extra env vars to add to the guidebook execution. These will be pre-joined with the default env. */
65
+ extraEnv ?: BaseProps [ "env" ]
66
+
67
+ /** Run guidebook in non-interactive mode? */
68
+ noninteractive ?: boolean
69
+
70
+ /** Interactive only for the given guidebook? */
71
+ ifor ?: boolean
72
+
73
+ /** Use this profile in the terminal execution */
74
+ selectedProfile ?: string
75
+
76
+ /** Hide terminal? */
77
+ hideTerminal ?: boolean
78
+ }
79
+
34
80
/**
35
81
* ProfileExplorer | props.aboveTerminal?
36
82
* | ----------
@@ -230,59 +276,24 @@ export default class WorkloadDesigner extends React.PureComponent<Props, State>
230
276
}
231
277
}
232
278
279
+ private get defaultSizes ( ) {
280
+ return this . props . lrSplit || this . splits . horizontal
281
+ }
282
+
283
+ private get minSize ( ) {
284
+ return this . defaultSizes [ 0 ] === 0 ? 0 : 275
285
+ }
286
+
233
287
public render ( ) {
234
288
if ( this . state . error ) {
235
289
return "Internal Error"
236
290
}
237
291
238
292
return (
239
- < Allotment snap defaultSizes = { this . splits . horizontal } >
240
- < AllotmentFillPane minSize = { 400 } > { this . left ( ) } </ AllotmentFillPane >
293
+ < Allotment snap defaultSizes = { this . defaultSizes } minSize = { this . minSize } >
294
+ < AllotmentFillPane minSize = { this . minSize } > { this . left ( ) } </ AllotmentFillPane >
241
295
< AllotmentFillPane > { this . right ( ) } </ AllotmentFillPane >
242
296
</ Allotment >
243
297
)
244
298
}
245
299
}
246
-
247
- export type Props = Pick < BaseProps , "tab" | "REPL" | "onExit" | "searchable" | "fontSizeAdjust" > & {
248
- /** Default guidebook (if not given, we will take the value from the client definition); `null` means do not show anything */
249
- defaultGuidebook ?: string | null
250
-
251
- /** Run guidebook in non-interactive mode? */
252
- defaultNoninteractive ?: boolean
253
-
254
- /** Any extra env vars to add to the guidebook execution. These will be pre-joined with the default env. */
255
- extraEnv ?: BaseProps [ "env" ]
256
-
257
- /** Callback when user selects a profile */
258
- onSelectProfile ?( profile : string , profiles ?: import ( "madwizard" ) . Profiles . Profile [ ] ) : void
259
-
260
- /** Content to place above the terminal */
261
- aboveTerminal ?: React . ReactNode
262
- }
263
-
264
- type State = Partial < Pick < BaseProps , "cmdline" | "env" > > & {
265
- /** Number of times we have called this.init() */
266
- initCount : number
267
-
268
- /** Internal error in rendering */
269
- error ?: boolean
270
-
271
- /** Use this guidebook in the terminal execution */
272
- guidebook ?: string | null
273
-
274
- /** Any extra env vars to add to the guidebook execution. These will be pre-joined with the default env. */
275
- extraEnv ?: BaseProps [ "env" ]
276
-
277
- /** Run guidebook in non-interactive mode? */
278
- noninteractive ?: boolean
279
-
280
- /** Interactive only for the given guidebook? */
281
- ifor ?: boolean
282
-
283
- /** Use this profile in the terminal execution */
284
- selectedProfile ?: string
285
-
286
- /** Hide terminal? */
287
- hideTerminal ?: boolean
288
- }
0 commit comments