@@ -12,12 +12,10 @@ import { Command } from '../odo/command';
1212import { CommandProvider } from '../odo/componentTypeDescription' ;
1313import { Odo } from '../odo/odoWrapper' ;
1414import { ComponentWorkspaceFolder } from '../odo/workspace' ;
15- import sendTelemetry from '../telemetry' ;
1615import { ChildProcessUtil , CliExitData } from '../util/childProcessUtil' ;
1716import { Progress } from '../util/progress' ;
1817import * as fs from '../util/utils' ;
1918import { vsCommand , VsCommandError } from '../vscommand' ;
20- import AddServiceBindingViewLoader , { ServiceBindingFormResponse } from '../webview/add-service-binding/addServiceBindingViewLoader' ;
2119import CreateComponentLoader from '../webview/create-component/createComponentLoader' ;
2220import { OpenShiftTerminalApi , OpenShiftTerminalManager } from '../webview/openshift-terminal/openShiftTerminal' ;
2321import OpenShiftItem , { clusterRequired , projectRequired } from './openshiftItem' ;
@@ -241,75 +239,6 @@ export class Component extends OpenShiftItem {
241239 return false ;
242240 }
243241
244- @vsCommand ( 'openshift.component.binding.add' )
245- static async addBinding ( component : ComponentWorkspaceFolder ) {
246-
247- const services = await Progress . execFunctionWithProgress ( 'Looking for bindable services' , ( progress ) => {
248- return Odo . Instance . getBindableServices ( ) ;
249- } ) ;
250-
251- if ( ! services || services . length === 0 ) {
252- void window . showErrorMessage ( 'No bindable services are available' , 'Open Service Catalog in OpenShift Console' )
253- . then ( ( result ) => {
254- if ( result === 'Open Service Catalog in OpenShift Console' ) {
255- void commands . executeCommand ( 'openshift.open.operatorBackedServiceCatalog' )
256- }
257- } ) ;
258- return ;
259- }
260-
261- void sendTelemetry ( 'startAddBindingWizard' ) ;
262-
263- let formResponse : ServiceBindingFormResponse = undefined ;
264- try {
265- formResponse = await new Promise < ServiceBindingFormResponse > (
266- ( resolve , reject ) => {
267- void AddServiceBindingViewLoader . loadView (
268- component . contextPath ,
269- services . map (
270- ( service ) => `${ service . metadata . namespace } /${ service . metadata . name } ` ,
271- ) ,
272- ( panel ) => {
273- panel . onDidDispose ( ( _e ) => {
274- reject ( new Error ( 'The \'Add Service Binding\' wizard was closed' ) ) ;
275- } ) ;
276- return async ( eventData ) => {
277- if ( eventData . action === 'addServiceBinding' ) {
278- resolve ( eventData . params ) ;
279- await panel . dispose ( ) ;
280- }
281- } ;
282- } ,
283- ) . then ( view => {
284- if ( ! view ) {
285- // the view was already created
286- reject ( undefined as Error ) ;
287- }
288- } ) ;
289- } ,
290- ) ;
291- } catch {
292- // The form was closed without submitting,
293- // or the form already exists for this component.
294- // stop the command.
295- return ;
296- }
297-
298- const selectedServiceObject = services . filter (
299- ( service ) =>
300- `${ service . metadata . namespace } /${ service . metadata . name } ` === formResponse . selectedService ,
301- ) [ 0 ] ;
302-
303- void sendTelemetry ( 'finishAddBindingWizard' ) ;
304-
305- await Odo . Instance . addBinding (
306- component . contextPath ,
307- selectedServiceObject . metadata . namespace ,
308- selectedServiceObject . metadata . name ,
309- formResponse . bindingName ,
310- ) ;
311- }
312-
313242 @vsCommand ( 'openshift.component.dev' )
314243 @clusterRequired ( )
315244 @projectRequired ( )
0 commit comments