@@ -40,18 +40,26 @@ import {
40
40
AccessRequestButton ,
41
41
} from './ActionButtons' ;
42
42
43
- type StoryProps = { vnet : boolean } ;
43
+ type StoryProps = {
44
+ vnet : boolean ;
45
+ lotsOfMenuItems : boolean ;
46
+ } ;
44
47
45
48
const meta : Meta < StoryProps > = {
46
49
title : 'Teleterm/DocumentCluster/ActionButtons' ,
47
50
component : Buttons ,
48
51
argTypes : {
49
- vnet : {
52
+ vnet : { control : { type : 'boolean' } } ,
53
+ lotsOfMenuItems : {
50
54
control : { type : 'boolean' } ,
55
+ description :
56
+ // TODO(ravicious): Support this prop in more places than just TCP ports.
57
+ 'Renders long lists of options in menus. Currently works only with ports for multi-port TCP apps.' ,
51
58
} ,
52
59
} ,
53
60
args : {
54
61
vnet : true ,
62
+ lotsOfMenuItems : false ,
55
63
} ,
56
64
} ;
57
65
@@ -66,14 +74,14 @@ export function Story(props: StoryProps) {
66
74
< MockAppContextProvider appContext = { appContext } >
67
75
< ConnectionsContextProvider >
68
76
< VnetContextProvider >
69
- < Buttons />
77
+ < Buttons { ... props } />
70
78
</ VnetContextProvider >
71
79
</ ConnectionsContextProvider >
72
80
</ MockAppContextProvider >
73
81
) ;
74
82
}
75
83
76
- function Buttons ( ) {
84
+ function Buttons ( props : StoryProps ) {
77
85
return (
78
86
< Flex gap = { 4 } >
79
87
< Flex gap = { 3 } flexDirection = "column" >
@@ -83,7 +91,7 @@ function Buttons() {
83
91
</ Box >
84
92
< Box >
85
93
< Text > multi-port TCP app</ Text >
86
- < TcpMultiPortApp />
94
+ < TcpMultiPortApp lotsOfMenuItems = { props . lotsOfMenuItems } />
87
95
</ Box >
88
96
< Box >
89
97
< Text > Web app</ Text >
@@ -151,17 +159,23 @@ function TcpApp() {
151
159
) ;
152
160
}
153
161
154
- function TcpMultiPortApp ( ) {
162
+ function TcpMultiPortApp ( props : { lotsOfMenuItems : boolean } ) {
163
+ let tcpPorts = [
164
+ { port : 1337 , endPort : 0 } ,
165
+ { port : 4242 , endPort : 0 } ,
166
+ { port : 54221 , endPort : 61879 } ,
167
+ ] ;
168
+
169
+ if ( props . lotsOfMenuItems ) {
170
+ tcpPorts = new Array ( 50 ) . fill ( tcpPorts ) . flat ( ) ;
171
+ }
172
+
155
173
return (
156
174
< ConnectAppActionButton
157
175
app = { makeApp ( {
158
176
uri : `${ testCluster . uri } /apps/bar` ,
159
177
endpointUri : 'tcp://localhost' ,
160
- tcpPorts : [
161
- { port : 1337 , endPort : 0 } ,
162
- { port : 4242 , endPort : 0 } ,
163
- { port : 54221 , endPort : 61879 } ,
164
- ] ,
178
+ tcpPorts,
165
179
} ) }
166
180
/>
167
181
) ;
0 commit comments