@@ -42,8 +42,6 @@ import * as ClusterViewStyles from './clusterView.style';
4242const useStyles = makeStyles ( ClusterViewStyles . useStyles ) ;
4343const StyledBadge = withStyles ( ClusterViewStyles . badgeStyles ) ( Badge ) ;
4444
45- const vscode = window . acquireVsCodeApi ( ) ;
46-
4745const crcDefaults = {
4846 DefaultCPUs : 4 ,
4947 DefaultMemory : 9216 ,
@@ -59,7 +57,7 @@ function getSteps() {
5957}
6058
6159// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
62- export default function addClusterView ( ) {
60+ export default function addClusterView ( props ) {
6361 const classes = useStyles ( ) ;
6462 const crcLatest = '1.22.0' ;
6563 const crcOpenShift = '4.6.15' ;
@@ -80,7 +78,7 @@ export default function addClusterView() {
8078 const [ statusError , setStatusError ] = React . useState ( false ) ;
8179
8280 React . useEffect ( ( ) => {
83- vscode . postMessage ( { action : 'checksetting' } ) ;
81+ props . vscode . postMessage ( { action : 'checksetting' } ) ;
8482 } , [ ] ) ;
8583
8684 const steps = getSteps ( ) ;
@@ -184,12 +182,12 @@ export default function addClusterView() {
184182 setProgress ( true ) ;
185183 setCrcStartError ( false ) ;
186184 if ( settingPresent ) {
187- vscode . postMessage ( { action : 'start' , isSetting : true } ) ;
185+ props . vscode . postMessage ( { action : 'start' , isSetting : true } ) ;
188186 } else {
189187 const crcStartCommand = ( crcNameserver === '' ) ? `${ fileName } start -p ${ pullSecretPath } -c ${ cpuSize } -m ${ memory } -ojson` :
190188 `${ fileName } start -p ${ pullSecretPath } -c ${ cpuSize } -m ${ memory } -n ${ crcNameserver } -ojson` ;
191189
192- vscode . postMessage ( { action : 'start' ,
190+ props . vscode . postMessage ( { action : 'start' ,
193191 data : crcStartCommand ,
194192 pullSecret : pullSecretPath ,
195193 crcLoc : fileName ,
@@ -203,23 +201,23 @@ export default function addClusterView() {
203201 const handleStopProcess = ( ) => {
204202 setStopProgress ( true ) ;
205203 setCrcStopError ( false ) ;
206- vscode . postMessage ( { action : 'stop' , data : `${ fileName } ` } ) ;
204+ props . vscode . postMessage ( { action : 'stop' , data : `${ fileName } ` } ) ;
207205 }
208206
209207 const handleCrcSetup = ( ) => {
210- vscode . postMessage ( { action : 'run' , data : `${ fileName } ` } )
208+ props . vscode . postMessage ( { action : 'run' , data : `${ fileName } ` } )
211209 }
212210
213211 const handleCrcLogin = ( loginDetails , clusterUrl ) => {
214- vscode . postMessage ( { action : 'crclogin' , data : loginDetails , url : clusterUrl } )
212+ props . vscode . postMessage ( { action : 'crclogin' , data : loginDetails , url : clusterUrl } )
215213 }
216214
217215 const handleRefresh = ( ) => {
218216 setStatusSkeleton ( true ) ;
219217 if ( settingPresent ) {
220- vscode . postMessage ( { action : 'checksetting' } ) ;
218+ props . scode . postMessage ( { action : 'checksetting' } ) ;
221219 } else {
222- vscode . postMessage ( { action : 'checkcrcstatus' , data : `${ fileName } ` } ) ;
220+ props . vscode . postMessage ( { action : 'checkcrcstatus' , data : `${ fileName } ` } ) ;
223221 }
224222 }
225223
0 commit comments