Skip to content

Commit 2f7a934

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 2f7a934

File tree

13 files changed

+1136
-53
lines changed

13 files changed

+1136
-53
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ export interface ForwardedPort {
1212
localAddress: string,
1313
localPort: number,
1414
containerPort: number,
15+
name?: string
1516
}
1617

1718
export interface ComponentDescription {
1819
devfilePath: string;
1920
devfileData: {
2021
devfile: Data;
22+
effectiveDevfile?: Data;
23+
commands: any[],
2124
supportedOdoFeatures: {
2225
debug: boolean;
2326
deploy: boolean;
@@ -26,7 +29,27 @@ export interface ComponentDescription {
2629
}
2730
devForwardedPorts: ForwardedPort[],
2831
runningIn: string[];
32+
runningOn: string[];
33+
devControlPlane?: {
34+
platform: string
35+
localPort?: number
36+
apiServerPath?: string
37+
webInterfacePath?: string
38+
}[];
2939
managedBy: string;
40+
warnings?: string[];
41+
}
42+
43+
export type DevControlPlaneInfo = NonNullable<ComponentDescription['devControlPlane']>;
44+
45+
export interface CommandInfo {
46+
name: string
47+
type: string
48+
group: string
49+
isDefault: boolean
50+
commandLine: string
51+
component: string
52+
componentType: string
3053
}
3154

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