@@ -14,6 +14,7 @@ import { V1ServicePort, V1Service } from '@kubernetes/client-node';
1414import { isURL } from 'validator' ;
1515import { Refs , Ref , Type } from '../util/refs' ;
1616import { Delayer } from '../util/async' ;
17+ import { contextGlobalState } from '../extension' ;
1718
1819export class Component extends OpenShiftItem {
1920
@@ -148,13 +149,31 @@ export class Component extends OpenShiftItem {
148149 ) ;
149150 }
150151
152+ static getPushCmd ( ) : Thenable < string | undefined > {
153+ return contextGlobalState . globalState . get ( 'PUSH' ) ;
154+ }
155+
156+ static setPushCmd ( component : string , application : string , project : string ) : Thenable < void > {
157+ return contextGlobalState . globalState . update ( 'PUSH' , Command . pushComponent ( project , application , component ) ) ;
158+ }
159+
151160 static async push ( context : OpenShiftObject ) : Promise < string > {
152161 const component = await Component . getOpenShiftCmdData ( context ,
153162 "In which Project you want to push the changes" ,
154163 "In which Application you want to push the changes" ,
155164 "For which Component you want to push the changes" ) ;
156165 if ( ! component ) return null ;
157- Component . odo . executeInTerminal ( Command . pushComponent ( component . getParent ( ) . getParent ( ) . getName ( ) , component . getParent ( ) . getName ( ) , component . getName ( ) ) ) ;
166+ Component . setPushCmd ( component . getName ( ) , component . getParent ( ) . getName ( ) , component . getParent ( ) . getParent ( ) . getName ( ) ) ;
167+ Component . odo . executeInTerminal ( Command . pushComponent ( component . getParent ( ) . getParent ( ) . getName ( ) , component . getParent ( ) . getName ( ) , component . getName ( ) ) )
168+ }
169+
170+ static async lastPush ( ) {
171+ const getPushCmd = await Component . getPushCmd ( ) ;
172+ if ( getPushCmd ) {
173+ Component . odo . executeInTerminal ( getPushCmd ) ;
174+ } else {
175+ throw Error ( 'No existing push command found' ) ;
176+ }
158177 }
159178
160179 static async watch ( context : OpenShiftObject ) : Promise < void > {
0 commit comments