Skip to content

Commit 2502721

Browse files
removed ODO log command (#4566)
* removed odo log command Signed-off-by: msivasubramaniaan <msivasub@redhat.com> * removed odo log command from test files Signed-off-by: msivasubramaniaan <msivasub@redhat.com> * removed odo log command Signed-off-by: msivasubramaniaan <msivasub@redhat.com> --------- Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
1 parent b6bbf2f commit 2502721

File tree

7 files changed

+2
-192
lines changed

7 files changed

+2
-192
lines changed

package.json

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,6 @@
230230
"onCommand:openshift.component.describe",
231231
"onCommand:openshift.component.openInBrowser",
232232
"onCommand:openshift.component.describe.palette",
233-
"onCommand:openshift.component.log",
234-
"onCommand:openshift.component.log.palette",
235-
"onCommand:openshift.component.followLog",
236-
"onCommand:openshift.component.followLog.palette",
237233
"onCommand:openshift.componentTypesView.registry.closeView",
238234
"onCommand:openshift.component.debug",
239235
"onCommand:openshift.component.debug.palette",
@@ -563,26 +559,6 @@
563559
"title": "Describe Component",
564560
"category": "OpenShift"
565561
},
566-
{
567-
"command": "openshift.component.log",
568-
"title": "Show Log",
569-
"category": "OpenShift"
570-
},
571-
{
572-
"command": "openshift.component.log.palette",
573-
"title": "Show Component Log",
574-
"category": "OpenShift"
575-
},
576-
{
577-
"command": "openshift.component.followLog",
578-
"title": "Follow Log",
579-
"category": "OpenShift"
580-
},
581-
{
582-
"command": "openshift.component.followLog.palette",
583-
"title": "Follow Component Log",
584-
"category": "OpenShift"
585-
},
586562
{
587563
"command": "openshift.component.openInBrowser",
588564
"title": "Open in Browser",
@@ -1181,14 +1157,6 @@
11811157
"command": "openshift.component.describe",
11821158
"when": "view == openshiftComponentsView"
11831159
},
1184-
{
1185-
"command": "openshift.component.log",
1186-
"when": "view == openshiftProjectExplorer"
1187-
},
1188-
{
1189-
"command": "openshift.component.followLog",
1190-
"when": "view == openshiftProjectExplorer"
1191-
},
11921160
{
11931161
"command": "openshift.component.commands.command.run",
11941162
"when": "view == openshiftComponentsView"
@@ -1285,14 +1253,6 @@
12851253
"command": "openshift.component.describe.palette",
12861254
"when": "false"
12871255
},
1288-
{
1289-
"command": "openshift.component.followLog.palette",
1290-
"when": "false"
1291-
},
1292-
{
1293-
"command": "openshift.component.log.palette",
1294-
"when": "false"
1295-
},
12961256
{
12971257
"command": "openshift.component.revealContextInExplorer",
12981258
"when": "false"
@@ -1813,16 +1773,6 @@
18131773
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*/",
18141774
"group": "c3@1"
18151775
},
1816-
{
1817-
"command": "openshift.component.log",
1818-
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*\\.dev-run.*/",
1819-
"group": "c3@2"
1820-
},
1821-
{
1822-
"command": "openshift.component.followLog",
1823-
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*\\.dev-run.*/",
1824-
"group": "c3@3"
1825-
},
18261776
{
18271777
"command": "openshift.component.deleteConfigurationFiles",
18281778
"when": "view == openshiftComponentsView && viewItem =~ /openshift\\.component.*\\.dev-nrn.*/",
@@ -1959,7 +1909,7 @@
19591909
},
19601910
{
19611911
"command": "openshift.resource.watchLogs",
1962-
"when": "view == openshiftProjectExplorer && viewItem =~ /^openshift\\.k8sObject\\.(?!helm|pod)/"
1912+
"when": "view == openshiftProjectExplorer && viewItem =~ /^openshift\\.k8sObject\\.(?!helm)/"
19631913
},
19641914
{
19651915
"command": "openshift.deployment.shell",

src/explorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
773773
let intervalId: ReturnType<typeof setInterval> | undefined = undefined;
774774

775775
function checkForPod() {
776-
void Oc.Instance.getLogs('Deployment', component.metadata.name, namespace).then((logs) => {
776+
void Oc.Instance.getLogs(`${component.kind}`, component.metadata.name, namespace).then((logs) => {
777777
clearInterval(intervalId);
778778
resolve();
779779
}).catch(_e => { });

src/odo/command.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@ export class Command {
4646
return Command.describeComponent().addOption(new CommandOption('-o', 'json', false));
4747
}
4848

49-
static showLog(platform?: string): CommandText {
50-
const result = new CommandText('odo', 'logs', [
51-
new CommandOption('--dev'),
52-
]);
53-
if (platform) {
54-
result.addOption(new CommandOption('--platform', platform));
55-
}
56-
return result;
57-
}
58-
59-
static showLogAndFollow(platform?: string): CommandText {
60-
return Command.showLog(platform).addOption(new CommandOption('--follow'));
61-
}
62-
6349
@verbose
6450
static createLocalComponent(
6551
devfileType = '', // will use empty string in case of undefined devfileType passed in

src/openshift/component.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -430,26 +430,6 @@ export class Component extends OpenShiftItem {
430430
`Describe '${componentFolder.component.devfileData.devfile.metadata.name}' Component`);
431431
}
432432

433-
@vsCommand('openshift.component.log', true)
434-
static async log(componentFolder: ComponentWorkspaceFolder): Promise<void> {
435-
const componentName = componentFolder.component.devfileData.devfile.metadata.name;
436-
const showLogCmd = Command.showLog(Component.getDevPlatform(componentFolder));
437-
await OpenShiftTerminalManager.getInstance().executeInTerminal(
438-
showLogCmd,
439-
componentFolder.contextPath,
440-
`Show '${componentName}' Component Log`);
441-
}
442-
443-
@vsCommand('openshift.component.followLog', true)
444-
static async followLog(componentFolder: ComponentWorkspaceFolder): Promise<void> {
445-
const componentName = componentFolder.component.devfileData.devfile.metadata.name;
446-
const showLogCmd = Command.showLogAndFollow(Component.getDevPlatform(componentFolder));
447-
await OpenShiftTerminalManager.getInstance().executeInTerminal(
448-
showLogCmd,
449-
componentFolder.contextPath,
450-
`Follow '${componentName}' Component Log`);
451-
}
452-
453433
@vsCommand('openshift.component.openCreateComponent')
454434
static async createComponent(): Promise<void> {
455435
await CreateComponentLoader.loadView('Create Component');

test/integration/command.test.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -165,48 +165,6 @@ suite('odo commands integration', function () {
165165
term.dispose();
166166
});
167167

168-
test('showLog()', async function () {
169-
await ODO.execute(Command.showLog(), componentLocation);
170-
});
171-
172-
test('showLogAndFollow()', async function() {
173-
const outputEmitter = new EventEmitter<string>();
174-
let devProcess: ChildProcess;
175-
function failListener(_error) {
176-
assert.fail('showLogAndFollow() errored before it was closed');
177-
}
178-
const term = window.createTerminal({
179-
name: 'test terminal',
180-
pty: {
181-
open: () => {
182-
void CliChannel.getInstance().spawnTool(Command.showLogAndFollow()) //
183-
.then(childProcess => {
184-
devProcess = childProcess
185-
devProcess.on('error', failListener);
186-
});
187-
},
188-
close: () => {
189-
if (devProcess) {
190-
devProcess.removeListener('error', failListener);
191-
devProcess.kill('SIGINT');
192-
}
193-
},
194-
handleInput: (data: string) => {
195-
if (data.length) {
196-
if (devProcess) {
197-
devProcess.removeListener('error', failListener);
198-
devProcess.kill('SIGINT');
199-
}
200-
}
201-
},
202-
onDidWrite: outputEmitter.event
203-
}
204-
});
205-
await new Promise<void>(resolve => setTimeout(resolve, 1000));
206-
// we instruct the pseudo terminal to close the dev session when any text is sent
207-
term.sendText('a');
208-
term.dispose();
209-
});
210168
});
211169

212170
suite('component dev', function() {

test/ui/suite/componentContextMenu.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -191,36 +191,6 @@ export function testComponentContextMenu() {
191191
expect(tabName).to.contain(expectedTabName);
192192
});
193193

194-
it('Show log works', async () => {
195-
//open menu and select show log
196-
const contextMenu = await component.openContextMenu();
197-
await contextMenu.select(MENUS.showLog);
198-
199-
//check for active tab name
200-
const tabName = await openshiftTerminal.getActiveTabName();
201-
expect(tabName).to.contain(`Show '${componentName}' Component Log`);
202-
203-
//check for terminal content
204-
const terminalText = await openshiftTerminal.getTerminalText();
205-
expect(terminalText).to.contain('runtime: App started on PORT');
206-
expect(terminalText).to.contain('Press any key to close this terminal');
207-
});
208-
209-
it('Follow log works', async () => {
210-
//open menu and select follow log
211-
const contextMenu = await component.openContextMenu();
212-
await contextMenu.select(MENUS.followLog);
213-
214-
//check for active tab name
215-
const tabName = await openshiftTerminal.getActiveTabName();
216-
expect(tabName).to.contain(`Follow '${componentName}' Component Log`);
217-
218-
//check for terminal text
219-
const terminalText = await openshiftTerminal.getTerminalText();
220-
expect(terminalText).to.contain('runtime: App started on PORT');
221-
expect(terminalText).not.to.contain('Press any key to close this terminal');
222-
});
223-
224194
it('Debug works', async () => {
225195
this.timeout(80_000);
226196

test/unit/openshift/component.test.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const { expect } = chai;
3030
chai.use(sinonChai);
3131

3232
suite('OpenShift/Component', function () {
33-
let quickPickStub: sinon.SinonStub;
3433
let sandbox: sinon.SinonSandbox;
3534
let termStub: sinon.SinonStub; let execStub: sinon.SinonStub;
3635
const fixtureFolder = path.join(__dirname, '..', '..', '..', 'test', 'fixtures').normalize();
@@ -302,39 +301,6 @@ suite('OpenShift/Component', function () {
302301
});
303302
});
304303

305-
suite.skip('log', function () {
306-
307-
test('log calls the correct odo command', async function () {
308-
await Component.log(componentItem1);
309-
expect(termStub).calledOnceWith(Command.showLog());
310-
});
311-
312-
test('works with no context', async () => {
313-
await Component.log(null);
314-
expect(termStub).calledOnceWith(Command.showLog());
315-
});
316-
});
317-
318-
suite.skip('followLog', function() {
319-
320-
test('returns null when cancelled', async function () {
321-
quickPickStub.onFirstCall().resolves();
322-
const result = await Component.followLog(null);
323-
324-
expect(result).null;
325-
});
326-
327-
test('followLog calls the correct odo command', async function () {
328-
await Component.followLog(componentItem1);
329-
expect(termStub).calledOnceWith(Command.showLogAndFollow());
330-
});
331-
332-
test('works with no context', async function () {
333-
await Component.followLog(null);
334-
expect(termStub).calledOnceWith(Command.showLogAndFollow());
335-
});
336-
});
337-
338304
suite.skip('debug', () => {
339305
test('without context exits if no component selected', async () => {
340306
const result = await Component.debug(undefined);

0 commit comments

Comments
 (0)