Skip to content

Commit 5140f1a

Browse files
committed
Add Describe command for 'not pushed' components
Fix #1464. Signed-off-by: Denis Golovin <dgolovin@redhat.com>
1 parent 04bb792 commit 5140f1a

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,11 @@
956956
"when": "view == openshiftProjectExplorer && viewItem == component",
957957
"group": "c2@1"
958958
},
959+
{
960+
"command": "openshift.component.describe",
961+
"when": "view == openshiftProjectExplorer && viewItem == componentNotPushed",
962+
"group": "c2@1"
963+
},
959964
{
960965
"command": "openshift.component.describe",
961966
"when": "view == openshiftProjectExplorer && viewItem == componentNoContext",

src/odo.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,14 @@ export class Command {
195195
return `odo delete ${component} -f --app ${app} --project ${project} --all`;
196196
}
197197

198-
static describeComponent(project: string, app: string, component: string): string {
198+
static describeComponentNoContext(project: string, app: string, component: string): string {
199199
return `odo describe ${component} --app ${app} --project ${project}`;
200200
}
201201

202+
static describeComponent(project: string, app: string, component: string): string {
203+
return `odo describe`;
204+
}
205+
202206
static describeComponentJson(project: string, app: string, component: string): string {
203207
return `${Command.describeComponent(project, app, component)} -o json`;
204208
}

src/openshift/component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,18 @@ export class Component extends OpenShiftItem {
134134
const component = await Component.getOpenShiftCmdData(context,
135135
"From which Project you want to describe Component",
136136
"From which Application you want to describe Component",
137-
"Select Component you want to describe",
138-
(value: OpenShiftObject) => value.contextValue === ContextType.COMPONENT_PUSHED || value.contextValue === ContextType.COMPONENT_NO_CONTEXT);
137+
"Select Component you want to describe");
139138
if (!component) return null;
140-
Component.odo.executeInTerminal(Command.describeComponent(component.getParent().getParent().getName(), component.getParent().getName(), component.getName()), component.contextPath ? component.contextPath.fsPath : Platform.getUserHomePath());
139+
let command: string;
140+
if (component.contextValue === ContextType.COMPONENT_NO_CONTEXT) {
141+
command = Command.describeComponentNoContext(component.getParent().getParent().getName(), component.getParent().getName(), component.getName());
142+
} else {
143+
command = Command.describeComponent(component.getParent().getParent().getName(), component.getParent().getName(), component.getName());
144+
}
145+
Component.odo.executeInTerminal(
146+
command,
147+
component.contextPath ? component.contextPath.fsPath : Platform.getUserHomePath()
148+
);
141149
}
142150

143151
static async log(context: OpenShiftObject): Promise<string> {

0 commit comments

Comments
 (0)