|
3 | 3 | * Licensed under the MIT License. See LICENSE file in the project root for license information. |
4 | 4 | *-----------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | | -import { EventEmitter, Terminal, Uri, commands, window } from 'vscode'; |
7 | | -import { ClusterVersion, FunctionContent, FunctionObject, InvokeFunction, RunResponse } from './types'; |
| 6 | +import { ChildProcess, SpawnOptions } from 'child_process'; |
8 | 7 | import validator from 'validator'; |
9 | | -import { ServerlessCommand, Utils } from './commands'; |
10 | | -import { Platform } from '../util/platform'; |
11 | | -import { OdoImpl } from '../odo'; |
| 8 | +import { commands, EventEmitter, Terminal, Uri, window } from 'vscode'; |
12 | 9 | import { CliChannel } from '../cli'; |
13 | | -import { ChildProcess, SpawnOptions } from 'child_process'; |
14 | | -import { ServerlessFunctionView } from './view'; |
15 | | -import { multiStep } from './multiStepInput'; |
| 10 | +import { OdoImpl } from '../odo'; |
| 11 | +import { Platform } from '../util/platform'; |
16 | 12 | import { Progress } from '../util/progress'; |
| 13 | +import { ServerlessCommand, Utils } from './commands'; |
| 14 | +import { multiStep } from './multiStepInput'; |
| 15 | +import { ClusterVersion, FunctionContent, FunctionObject, FunctionView, InvokeFunction, RunResponse } from './types'; |
17 | 16 |
|
18 | 17 | export class Functions { |
19 | 18 |
|
@@ -51,7 +50,7 @@ export class Functions { |
51 | 50 | } |
52 | 51 | } |
53 | 52 |
|
54 | | - public async build(context: FunctionObject): Promise<void> { |
| 53 | + public async build(context: FunctionObject, view: FunctionView): Promise<void> { |
55 | 54 | const exisitingTerminal = this.buildTerminalMap.get(`build-${context.folderURI.fsPath}`); |
56 | 55 | const outputEmitter = this.buildEmiterMap.get(`build-${context.folderURI.fsPath}`); |
57 | 56 | if (exisitingTerminal) { |
@@ -81,18 +80,18 @@ export class Functions { |
81 | 80 | }); |
82 | 81 | exisitingProcess.on('exit', () => { |
83 | 82 | context.hadBuilt = true; |
84 | | - ServerlessFunctionView.getInstance().refresh(context); |
| 83 | + view.refresh(context); |
85 | 84 | outputEmitter.fire('\r\nPress any key to close this terminal\r\n'); |
86 | 85 | }); |
87 | 86 | }); |
88 | 87 | } |
89 | 88 | }); |
90 | 89 | } else { |
91 | | - await this.buildProcess(context); |
| 90 | + await this.buildProcess(context, view); |
92 | 91 | } |
93 | 92 | } |
94 | 93 |
|
95 | | - private async buildProcess(context: FunctionObject) { |
| 94 | + private async buildProcess(context: FunctionObject, view: FunctionView) { |
96 | 95 | const clusterVersion: ClusterVersion | null = await this.checkOpenShiftCluster(); |
97 | 96 | const buildImage = await this.getImage(context.folderURI); |
98 | 97 | const outputEmitter = new EventEmitter<string>(); |
@@ -121,7 +120,7 @@ export class Functions { |
121 | 120 | }); |
122 | 121 | devProcess.on('exit', () => { |
123 | 122 | context.hadBuilt = true; |
124 | | - ServerlessFunctionView.getInstance().refresh(context); |
| 123 | + view.refresh(context); |
125 | 124 | outputEmitter.fire('\r\nPress any key to close this terminal\r\n'); |
126 | 125 | }); |
127 | 126 | }); |
@@ -231,7 +230,7 @@ export class Functions { |
231 | 230 | } |
232 | 231 |
|
233 | 232 | public async deploy(context: FunctionObject) { |
234 | | - const currentNamespace: string = ServerlessFunctionView.getInstance().getCurrentNameSpace(); |
| 233 | + const currentNamespace: string = await OdoImpl.Instance.getActiveProject(); |
235 | 234 | const yamlContent = await Utils.getFuncYamlContent(context.folderURI.fsPath); |
236 | 235 | if (yamlContent) { |
237 | 236 | const deployedNamespace = yamlContent.deploy?.namespace || undefined; |
|
0 commit comments