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
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,10 @@
"title": "Open Add CRC Cluster Wizard",
"category": "OpenShift"
},
{
"command": "openshift.component.revealContextInExplorer",
"title": "Reveal in Explorer"
},
{
"command": "openshift.component.test",
"title": "Test",
Expand Down Expand Up @@ -1054,6 +1058,10 @@
{
"command": "openshift.component.watch.showLog",
"when": "false"
},
{
"command": "openshift.component.revealContextInExplorer",
"when": "false"
}
],
"view/title": [
Expand Down Expand Up @@ -1320,19 +1328,24 @@
"group": "c4@6"
},
{
"command": "openshift.component.delete",
"when": "view == openshiftProjectExplorer && viewItem == componentNoContext",
"command": "openshift.component.revealContextInExplorer",
"when": "view == openshiftProjectExplorer && viewItem == component || viewItem == componentNotPushed",
"group": "c5@1"
},
{
"command": "openshift.component.delete",
"when": "view == openshiftProjectExplorer && viewItem == componentNoContext || ",
"group": "c6@1"
},
{
"command": "openshift.component.delete",
"when": "view == openshiftProjectExplorer && viewItem == component",
"group": "c5@1"
"group": "c6@1"
},
{
"command": "openshift.component.delete",
"when": "view == openshiftProjectExplorer && viewItem == componentNotPushed",
"group": "c5@1"
"group": "c6@1"
},
{
"command": "openshift.service.create",
Expand Down
2 changes: 1 addition & 1 deletion src/componentsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Command } from './odo/command';
import { EnvInfo } from './odo/env';
import { vsCommand } from './vscommand';


export interface WorkspaceEntry {
uri: vsc.Uri;
type: vsc.FileType;
Expand Down Expand Up @@ -133,6 +132,7 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
await vsc.commands.executeCommand('revealInExplorer', context.contextUri);
}
}

createTreeView(id: string): vsc.TreeView<Entry> {
if (!this.treeView) {
this.treeView = vsc.window.createTreeView(id, {
Expand Down
6 changes: 6 additions & 0 deletions src/openshift/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,12 @@ export class Component extends OpenShiftItem {
await Component.odo.executeInTerminal(Command.testComponent(), component.contextPath.fsPath, `OpenShift: Test '${component.getName()}' Component`);
}

@vsCommand('openshift.component.revealContextInExplorer')
public static async revealContextInExplorer(context: OpenShiftComponent): Promise<void> {
await commands.executeCommand('workbench.view.explorer');
await commands.executeCommand('revealInExplorer', context.contextPath);
}

@vsCommand('openshift.component.import')
// @clusterRequired() - not required because available only from context menu in application explorer
static async import(component: OpenShiftObject): Promise<string | null> {
Expand Down
11 changes: 10 additions & 1 deletion test/unit/openshift/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ suite('OpenShift/Component', () => {
getApps = sandbox.stub(OpenShiftItem, 'getApplicationNames').resolves([appItem]);
sandbox.stub(OpenShiftItem, 'getComponentNames').resolves([componentItem]);
sandbox.stub(OpenShiftItem, 'getServiceNames').resolves([serviceItem]);
commandStub = sandbox.stub(vscode.commands, 'executeCommand');
commandStub = sandbox.stub(vscode.commands, 'executeCommand').resolves();
sandbox.stub()
});

Expand All @@ -92,6 +92,15 @@ suite('OpenShift/Component', () => {
});
});

suite('reveal in explorer', () => {

test('called revealInExplorer with component\'s context', async () => {
await Component.revealContextInExplorer(componentItem);
expect(commandStub).calledWith('revealInExplorer', componentItem.contextPath);
});

});

suite('create', () => {
const componentType = new ComponentTypeAdapter(ComponentKind.S2I, 'nodejs', 'latest', 'builder,nodejs');
const version = 'latest';
Expand Down