Skip to content

Commit ce0648b

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

File tree

13 files changed

+1064
-57
lines changed

13 files changed

+1064
-57
lines changed

src/componentsView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,16 @@ class ComponentInfoRoot extends ComponentInfo {
103103
`Context: ${this.contextPath}`,
104104
].join('\n');
105105

106-
return {
106+
const item = {
107107
label: Component.renderLabel(this),
108108
workspaceFolder: this,
109109
tooltip,
110110
contextValue: Component.generateContextValue(this),
111111
iconPath: vsc.Uri.file(imagePath('component/workspace.png')),
112112
collapsibleState: vsc.TreeItemCollapsibleState.Collapsed
113113
};
114+
115+
return item;
114116
}
115117
}
116118

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: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ 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+
effectiveDevfile?: Data;
26+
commands: any[],
2127
supportedOdoFeatures: {
2228
debug: boolean;
2329
deploy: boolean;
@@ -26,7 +32,27 @@ export interface ComponentDescription {
2632
}
2733
devForwardedPorts: ForwardedPort[],
2834
runningIn: string[];
35+
runningOn: string[];
36+
devControlPlane?: {
37+
platform: string
38+
localPort?: number
39+
apiServerPath?: string
40+
webInterfacePath?: string
41+
}[];
2942
managedBy: string;
43+
warnings?: string[];
44+
}
45+
46+
export type DevControlPlaneInfo = NonNullable<ComponentDescription['devControlPlane']>;
47+
48+
export interface CommandInfo {
49+
name: string
50+
type: string
51+
group: string
52+
isDefault: boolean
53+
commandLine: string
54+
component: string
55+
componentType: string
3056
}
3157

3258
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)