Skip to content

Commit 5dae3fe

Browse files
committed
Do not use app and project name for components without context
This PR fixes redhat-developer#2191. Signed-off-by: Denis Golovin [email protected]
1 parent d55e6bb commit 5dae3fe

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/odo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ export class OdoImpl implements Odo {
949949
Command.deleteComponent(
950950
app.getParent().getName(),
951951
app.getName(), component.getName(),
952+
!!component.contextPath,
952953
component.kind === ComponentKind.S2I
953954
),
954955
component.contextPath ? component.contextPath.fsPath : Platform.getUserHomePath()

src/odo/command.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,18 @@ export class Command {
270270
);
271271
}
272272

273-
static deleteComponent(project: string, app: string, component: string, s2i = false): CommandText {
273+
static deleteComponent(project: string, app: string, component: string, context: boolean, s2i = false): CommandText {
274274
const ct = new CommandText('odo delete',
275-
component, [
275+
context ? undefined : component, [ // if there is not context name is required
276276
new CommandOption('-f'),
277-
new CommandOption('--app', app),
278-
new CommandOption('--project',project),
279-
new CommandOption('--all')
280277
]
281278
);
279+
if (!context) { // if there is no context state app and project name
280+
ct.addOption(new CommandOption('--app', app))
281+
.addOption(new CommandOption('--project',project))
282+
} else {
283+
ct.addOption(new CommandOption('--all'));
284+
}
282285
if (s2i) {
283286
ct.addOption(new CommandOption('--s2i'));
284287
}

0 commit comments

Comments
 (0)