Skip to content

Commit e9dfbd7

Browse files
committed
Replacement for 'odo describe component'
Fixes: #5747 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com> Assisted-by: OpenAI ChatGPT
1 parent 8a9b63d commit e9dfbd7

File tree

13 files changed

+1042
-69
lines changed

13 files changed

+1042
-69
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: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@ export interface Ctx {
88
}
99

1010
export interface ForwardedPort {
11-
containerName: string,
12-
localAddress: string,
13-
localPort: number,
14-
containerPort: number,
11+
containerName: string;
12+
localAddress: string;
13+
localPort: number;
14+
containerPort: number;
15+
name?: string;
16+
isDebug?: boolean;
17+
exposure?: string;
18+
platform?: string;
1519
}
1620

1721
export interface ComponentDescription {
1822
devfilePath: string;
1923
devfileData: {
2024
devfile: Data;
25+
commands: any[],
2126
supportedOdoFeatures: {
2227
debug: boolean;
2328
deploy: boolean;
@@ -26,7 +31,27 @@ export interface ComponentDescription {
2631
}
2732
devForwardedPorts: ForwardedPort[],
2833
runningIn: string[];
34+
runningOn: string[];
35+
devControlPlane?: {
36+
platform: string
37+
localPort?: number
38+
apiServerPath?: string
39+
webInterfacePath?: string
40+
}[];
2941
managedBy: string;
42+
warnings?: string[];
43+
}
44+
45+
export type DevControlPlaneInfo = NonNullable<ComponentDescription['devControlPlane']>;
46+
47+
export interface CommandInfo {
48+
name: string
49+
type: string
50+
group: string
51+
isDefault: boolean
52+
commandLine: string
53+
component: string
54+
componentType: string
3055
}
3156

3257
export interface ComponentItem {

src/odo/odoWrapper.ts

Lines changed: 4 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,20 +31,13 @@ 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+
return await getComponentDescription(contextPath, {})
4538
} catch {
4639
// ignore and return undefined
40+
return undefined;
4741
}
4842
}
4943

0 commit comments

Comments
 (0)