Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions src/odo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,15 +910,26 @@ export class OdoImpl implements Odo {

public async deleteComponent(component: OpenShiftObject): Promise<OpenShiftObject> {
const app = component.getParent();
await this.execute(
Command.deleteComponent(
app.getParent().getName(),
app.getName(), component.getName(),
!!component.contextPath
),
component.contextPath ? component.contextPath.fsPath : Platform.getUserHomePath()
);

if (component.contextValue === ContextType.COMPONENT_NO_CONTEXT) {
await this.execute(
Command.deleteComponentNoContext(
app.getParent().getName(),
app.getName(),
component.getName()
),
component.contextPath ? component.contextPath.fsPath : Platform.getUserHomePath()
);
} else {
await this.execute(
Command.deleteComponent(
app.getParent().getName(),
app.getName(),
component.getName(),
!!component.contextPath
),
component.contextPath ? component.contextPath.fsPath : Platform.getUserHomePath()
);
}
await this.deleteAndRefresh(component);
const children = await app.getChildren();
if (children.length === 0) {
Expand Down
10 changes: 10 additions & 0 deletions src/odo/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@ export class Command {
return ct;
}

static deleteComponentNoContext(project: string, app: string, component: string): CommandText {
return new CommandText('oc delete',
'deployment', [
new CommandOption('-n', project),
new CommandOption('-l', `component=${component},app=${app}`),
new CommandOption('--wait=true'),
]
);
}

static describeComponentNoContext(project: string, app: string, component: string): CommandText {
return new CommandText('odo describe',
component, [
Expand Down
2 changes: 1 addition & 1 deletion src/openshift/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class Component extends OpenShiftItem {

if (value === 'Yes') {
return Progress.execFunctionWithProgress(`Deleting the Component '${component.getName()} '`, async () => {
if (component.contextValue === ContextType.COMPONENT_NO_CONTEXT || component.contextValue === ContextType.COMPONENT_PUSHED || component.kind === ComponentKind.S2I) {
if (component.contextValue === ContextType.COMPONENT_PUSHED || component.kind === ComponentKind.S2I) {
await Component.unlinkAllComponents(component);
}
Component.stopDebugSession(component);
Expand Down