@@ -1166,30 +1166,6 @@ export class ImageRunModal extends React.Component {
11661166 </ Form >
11671167 ) ;
11681168
1169- const cardFooter = ( ) => {
1170- let createRunText = _ ( "Create and run" ) ;
1171- let createText = _ ( "Create" ) ;
1172-
1173- if ( this . props . prefill ) {
1174- createRunText = _ ( "Clone and run" ) ;
1175- createText = _ ( "Clone" ) ;
1176- }
1177-
1178- return (
1179- < >
1180- < Button variant = 'primary' id = "create-image-create-run-btn" onClick = { ( ) => this . onCreateClicked ( true ) } isDisabled = { ( ! image && selectedImage === "" ) } >
1181- { createRunText }
1182- </ Button >
1183- < Button variant = 'secondary' id = "create-image-create-btn" onClick = { ( ) => this . onCreateClicked ( false ) } isDisabled = { ( ! image && selectedImage === "" ) } >
1184- { createText }
1185- </ Button >
1186- < Button variant = 'link' className = 'btn-cancel' onClick = { Dialogs . close } >
1187- { _ ( "Cancel" ) }
1188- </ Button >
1189- </ >
1190- ) ;
1191- } ;
1192-
11931169 return (
11941170 < Modal isOpen
11951171 position = "top" variant = "medium"
@@ -1202,11 +1178,37 @@ export class ImageRunModal extends React.Component {
12021178 Dialogs . close ( ) ;
12031179 }
12041180 } }
1205- title = { this . props . pod ? cockpit . format ( _ ( "Create container in $0" ) , this . props . pod . Name ) : _ ( "Create container" ) }
1206- footer = { cardFooter ( ) }
1181+ title = { this . props . pod ? cockpit . format ( _ ( "Create container in $0" ) , this . props . pod . Name ) : ( this . props . prefill ? _ ( "Clone container" ) : _ ( "Create container" ) ) }
1182+ footer = {
1183+ < ImageRunModalFooter
1184+ image = { image }
1185+ selectedImage = { selectedImage }
1186+ close = { Dialogs . close }
1187+ prefill = { this . props . prefill }
1188+ onCreateClicked = { this . onCreateClicked } />
1189+ }
12071190 >
12081191 { defaultBody }
12091192 </ Modal >
12101193 ) ;
12111194 }
12121195}
1196+
1197+ const ImageRunModalFooter = ( { image, selectedImage, prefill, close, onCreateClicked } ) => {
1198+ const createRunText = prefill ? _ ( "Clone and run" ) : _ ( "Create and run" ) ;
1199+ const createText = prefill ? _ ( "Clone" ) : _ ( "Create" ) ;
1200+
1201+ return (
1202+ < >
1203+ < Button variant = 'primary' id = "create-image-create-run-btn" onClick = { ( ) => onCreateClicked ( true ) } isDisabled = { ( ! image && selectedImage === "" ) } >
1204+ { createRunText }
1205+ </ Button >
1206+ < Button variant = 'secondary' id = "create-image-create-btn" onClick = { ( ) => onCreateClicked ( false ) } isDisabled = { ( ! image && selectedImage === "" ) } >
1207+ { createText }
1208+ </ Button >
1209+ < Button variant = 'link' className = 'btn-cancel' onClick = { close } >
1210+ { _ ( "Cancel" ) }
1211+ </ Button >
1212+ </ >
1213+ ) ;
1214+ } ;
0 commit comments