Skip to content

Commit d0e01fd

Browse files
committed
Add 'OpenShift: Describe URL' command for URLs
1 parent 3fe4f09 commit d0e01fd

File tree

4 files changed

+1
-68
lines changed

4 files changed

+1
-68
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ To debug a Java Component, Java Language Support and Java Debugger Extensions ar
137137
#### Actions available for a Storage in a Component
138138

139139
* `Storage -> Delete` - Delete a Storage from a Component.
140-
* `Storage -> Describe` - Describe the given Storage for the component in terminal window.
141140

142141

143142
#### Actions available for a Service in an Application

package.json

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@
206206
"onCommand:openshift.component.debug",
207207
"onCommand:openshift.component.debug.palette",
208208
"onCommand:openshift.storage.create",
209-
"onCommand:openshift.storage.describe",
210-
"onCommand:openshift.storage.describe.palette",
211209
"onCommand:openshift.storage.delete",
212210
"onCommand:openshift.service.create",
213211
"onCommand:openshift.service.delete",
@@ -565,16 +563,6 @@
565563
"title": "Delete",
566564
"category": "OpenShift"
567565
},
568-
{
569-
"command": "openshift.storage.describe",
570-
"title": "Describe",
571-
"category": "OpenShift"
572-
},
573-
{
574-
"command": "openshift.storage.describe.palette",
575-
"title": "Describe Storage",
576-
"category": "OpenShift"
577-
},
578566
{
579567
"command": "openshift.service.create",
580568
"title": "New Service",
@@ -811,10 +799,6 @@
811799
"command": "openshift.component.push",
812800
"when": "view == openshiftProjectExplorer"
813801
},
814-
{
815-
"command": "openshift.storage.describe",
816-
"when": "view == openshiftProjectExplorer"
817-
},
818802
{
819803
"command": "openshift.storage.delete",
820804
"when": "view == openshiftProjectExplorer"
@@ -1117,11 +1101,6 @@
11171101
"when": "view == openshiftProjectExplorer && viewItem == service",
11181102
"group": "s2"
11191103
},
1120-
{
1121-
"command": "openshift.storage.describe",
1122-
"when": "view == openshiftProjectExplorer && viewItem == storage",
1123-
"group": "s3"
1124-
},
11251104
{
11261105
"command": "openshift.storage.delete",
11271106
"when": "view == openshiftProjectExplorer && viewItem == storage",

src/openshift/storage.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { window } from 'vscode';
77
import { isEmpty } from "validator";
88
import OpenShiftItem from "./openshiftItem";
9-
import { OpenShiftObject, ContextType, Command } from "../odo";
9+
import { OpenShiftObject, ContextType } from "../odo";
1010
import { Progress } from "../util/progress";
1111
import { vsCommand, VsCommandError } from '../vscommand';
1212

@@ -60,15 +60,4 @@ export class Storage extends OpenShiftItem {
6060
}
6161
return null;
6262
}
63-
64-
@vsCommand('openshift.storage.describe', true)
65-
static async describe(treeItem: OpenShiftObject): Promise<void> {
66-
let storage = treeItem;
67-
const component = await Storage.getOpenShiftCmdData(storage,
68-
"From which Project you want to describe Storage",
69-
"From which Application you want to describe Storage",
70-
"From which Component you want to describe Storage");
71-
if (!storage && component) storage = await window.showQuickPick(Storage.getStorageNames(component), {placeHolder: "Select Storage to describe", ignoreFocusOut: true});
72-
if (storage) Storage.odo.executeInTerminal(Command.describeStorage(storage.getName()));
73-
}
7463
}

test/unit/openshift/storage.test.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ suite('OpenShift/Storage', () => {
2020
let execStub: sinon.SinonStub;
2121
let quickPickStub: sinon.SinonStub;
2222
let inputStub: sinon.SinonStub;
23-
let termStub: sinon.SinonStub;
2423
let getProjectNamesStub: sinon.SinonStub;
2524
let getStorageNamesStub: sinon.SinonStub;
2625
const projectItem = new TestItem(null, 'project', ContextType.PROJECT);
@@ -34,7 +33,6 @@ suite('OpenShift/Storage', () => {
3433
setup(() => {
3534
sandbox = sinon.createSandbox();
3635
getStorageNamesStub = sandbox.stub(OdoImpl.prototype, 'getStorageNames').resolves([storageItem]);
37-
termStub = sandbox.stub(OdoImpl.prototype, 'executeInTerminal');
3836
execStub = sandbox.stub(OdoImpl.prototype, 'execute').resolves({error: '', stdout: '', stderr: ''});
3937
quickPickStub = sandbox.stub(vscode.window, 'showQuickPick');
4038
});
@@ -342,36 +340,4 @@ suite('OpenShift/Storage', () => {
342340
}
343341
});
344342
});
345-
346-
suite('describe', () => {
347-
348-
setup(() => {
349-
sandbox.stub(OdoImpl.prototype, 'getProjects').resolves([]);
350-
sandbox.stub(OdoImpl.prototype, 'getApplications').resolves([]);
351-
sandbox.stub(OdoImpl.prototype, 'getComponents').resolves([]);
352-
getStorageNamesStub.resolves([]);
353-
quickPickStub.onFirstCall().resolves(projectItem);
354-
quickPickStub.onSecondCall().resolves(appItem);
355-
quickPickStub.onThirdCall().resolves(componentItem);
356-
quickPickStub.onCall(3).resolves(storageItem);
357-
});
358-
359-
test('calls the correct odo command w/ context', async () => {
360-
await Storage.describe(storageItem);
361-
362-
expect(termStub).calledOnceWith(Command.describeUrl(storageItem.getName()));
363-
});
364-
365-
test('calls the correct odo command w/o context', async () => {
366-
await Storage.describe(null);
367-
368-
expect(termStub).calledOnceWith(Command.describeUrl(storageItem.getName()));
369-
});
370-
371-
test('does not call the odo command if canceled', async () => {
372-
sandbox.stub(Storage, 'getOpenShiftCmdData').resolves(null);
373-
await Storage.describe(null);
374-
expect(termStub).not.called;
375-
});
376-
});
377343
});

0 commit comments

Comments
 (0)