Skip to content

Commit 04900ff

Browse files
committed
Replacement for 'odo describe component'
Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com> Assisted-by: OpenAI ChatGPT
1 parent 58122b5 commit 04900ff

File tree

10 files changed

+804
-48
lines changed

10 files changed

+804
-48
lines changed

src/odo/command.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ export class Command {
3838
return new CommandText('odo', 'version');
3939
}
4040

41-
static describeComponent(): CommandText {
42-
return new CommandText('odo', 'describe component');
43-
}
44-
45-
static describeComponentJson(): CommandText {
46-
return Command.describeComponent().addOption(new CommandOption('-o', 'json', false));
47-
}
48-
4941
@verbose
5042
static createLocalComponent(
5143
devfileType = '', // will use empty string in case of undefined devfileType passed in

src/odo/componentTypeDescription.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface ForwardedPort {
1212
localAddress: string,
1313
localPort: number,
1414
containerPort: number,
15+
name?: string
1516
}
1617

1718
export interface ComponentDescription {
@@ -26,7 +27,27 @@ export interface ComponentDescription {
2627
}
2728
devForwardedPorts: ForwardedPort[],
2829
runningIn: string[];
30+
runningOn: string[];
31+
devControlPlane?: {
32+
platform: string
33+
localPort?: number
34+
apiServerPath?: string
35+
webInterfacePath?: string
36+
}[];
2937
managedBy: string;
38+
warnings?: string[];
39+
}
40+
41+
export type DevControlPlaneInfo = NonNullable<ComponentDescription["devControlPlane"]>;
42+
43+
export interface CommandInfo {
44+
name: string
45+
type: string
46+
group: string
47+
isDefault: boolean
48+
commandLine: string
49+
component: string
50+
componentType: string
3051
}
3152

3253
export interface ComponentItem {

src/odo/odoWrapper.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { Uri, WorkspaceFolder, workspace } from 'vscode';
77
import { CommandOption, CommandText } from '../base/command';
88
import * as cliInstance from '../cli';
9+
import { getComponentDescription } from '../odo/util/describe';
910
import { ToolsConfig } from '../tools';
1011
import { ChildProcessUtil, CliExitData } from '../util/childProcessUtil';
1112
import { VsCommandError } from '../vscommand';
@@ -30,18 +31,14 @@ export class Odo {
3031
}
3132

3233
public async describeComponent(
33-
contextPath: string,
34-
experimental = false,
34+
contextPath: string
3535
): Promise<ComponentDescription | undefined> {
36-
const expEnv = experimental ? { ODO_EXPERIMENTAL_MODE: 'true' } : {};
3736
try {
38-
const describeCmdResult: CliExitData = await this.execute(
39-
Command.describeComponentJson(),
40-
contextPath,
41-
false,
42-
expEnv,
43-
);
44-
return JSON.parse(describeCmdResult.stdout) as ComponentDescription;
37+
const options = {}
38+
const devfilePath = contextPath
39+
40+
const componentInfo = await getComponentDescription(devfilePath, options)
41+
return componentInfo;
4542
} catch {
4643
// ignore and return undefined
4744
}

0 commit comments

Comments
 (0)