Skip to content

Commit 00cdfa0

Browse files
committed
Remove experimental warning, setting and fix log commands for podman
Signed-off-by: Denis Golovin dgolovin@redhat.com
1 parent a3bfbfd commit 00cdfa0

File tree

4 files changed

+24
-42
lines changed

4 files changed

+24
-42
lines changed

package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,12 +1562,6 @@
15621562
"description": "Show OpenShift Toolkit Experimental Features.",
15631563
"type": "boolean",
15641564
"default": true
1565-
},
1566-
"openshiftToolkit.devModeRunOnPodman": {
1567-
"order": 2,
1568-
"description": "Show warning about experimental feature",
1569-
"type": "boolean",
1570-
"default": true
15711565
}
15721566
}
15731567
}

src/odo/command.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,17 +288,23 @@ export class Command {
288288
new CommandOption('--details'),
289289
new CommandOption('--devfile', component),
290290
new CommandOption('--devfile-registry', registry),
291-
new CommandOption('-o', 'json', false)
291+
new CommandOption('-o', 'json', false),
292292
]
293293
);
294294
}
295295

296-
static showLog(): CommandText {
297-
return new CommandText('odo', 'logs', [new CommandOption('--dev')]);
296+
static showLog(platform?: string): CommandText {
297+
const result = new CommandText('odo', 'logs', [
298+
new CommandOption('--dev'),
299+
]);
300+
if (platform) {
301+
result.addOption(new CommandOption('--platform', platform));
302+
}
303+
return result;
298304
}
299305

300-
static showLogAndFollow(): CommandText {
301-
return Command.showLog().addOption(new CommandOption('--follow'));
306+
static showLogAndFollow(platform?: string): CommandText {
307+
return Command.showLog(platform).addOption(new CommandOption('--follow'));
302308
}
303309

304310
static listComponentPorts(project: string, app: string, component: string): CommandText {
@@ -307,8 +313,7 @@ export class Command {
307313
new CommandOption('--namespace', project),
308314
// see https://kubernetes.io/docs/reference/kubectl/jsonpath/ for examples
309315
new CommandOption('-o', 'jsonpath="{range .spec.ports[*]}{.port}{\',\'}{end}"', false)
310-
]
311-
);
316+
]);
312317
}
313318

314319
@verbose

src/openshift/component.ts

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -194,27 +194,6 @@ export class Component extends OpenShiftItem {
194194

195195
@vsCommand('openshift.component.dev.onPodman')
196196
static async devOnPodman(component: ComponentWorkspaceFolder) {
197-
if (workspace.getConfiguration('openshiftToolkit').get('devModeRunOnPodman')) {
198-
let choice = 'Cancel';
199-
do {
200-
const choices = ['About Podman', 'Continue', 'Continue and don\'t ask again'];
201-
choice = await window.showWarningMessage(
202-
'The command \'Start Dev on Podman\' is experimental. It requires Podman to be installed and configured. It isn\'t guaranteed to work.',
203-
...choices);
204-
switch (choice) {
205-
case choices[0]: // open link to external site with podman documentation
206-
await commands.executeCommand('vscode.open', Uri.parse('https://docs.podman.io/en/latest/index.html'));
207-
break;
208-
case choices[1]: // continue with execution
209-
break;
210-
case choices[2]: // save request to not show warning again
211-
await workspace.getConfiguration('openshiftToolkit').update('devModeRunOnPodman', false);
212-
break;
213-
default:
214-
return;
215-
}
216-
} while (choice === 'About Podman')
217-
}
218197
return Component.dev(component, 'podman');
219198
}
220199

@@ -390,10 +369,14 @@ export class Component extends OpenShiftItem {
390369
.get<boolean>('useWebviewInsteadOfTerminalView');
391370
}
392371

393-
static createExperimentalEnv(componentFolder) {
372+
static createExperimentalEnv(componentFolder: ComponentWorkspaceFolder) {
394373
return Component.getComponentDevState(componentFolder).runOn ? {ODO_EXPERIMENTAL_MODE: 'true'} : {};
395374
}
396375

376+
static getDevPlatform(componentFolder: ComponentWorkspaceFolder): string {
377+
return Component.getComponentDevState(componentFolder).runOn;
378+
}
379+
397380
@vsCommand('openshift.component.describe', true)
398381
static async describe(componentFolder: ComponentWorkspaceFolder): Promise<string> {
399382
const command = Command.describeComponent;
@@ -407,11 +390,12 @@ export class Component extends OpenShiftItem {
407390
@vsCommand('openshift.component.log', true)
408391
static log(componentFolder: ComponentWorkspaceFolder): Promise<string> {
409392
const componentName = componentFolder.component.devfileData.devfile.metadata.name;
393+
const showLogCmd = Command.showLog(Component.getDevPlatform(componentFolder));
410394
if (Component.isUsingWebviewEditor()) {
411-
LogViewLoader.loadView(`${componentName} Log`, Command.showLog, componentFolder, Component.createExperimentalEnv(componentFolder));
395+
LogViewLoader.loadView(`${componentName} Log`, showLogCmd, componentFolder);
412396
} else {
413397
void Component.odo.executeInTerminal(
414-
Command.showLog(),
398+
showLogCmd,
415399
componentFolder.contextPath,
416400
`OpenShift: Show '${componentName}' Component Log`);
417401
}
@@ -421,11 +405,12 @@ export class Component extends OpenShiftItem {
421405
@vsCommand('openshift.component.followLog', true)
422406
static followLog(componentFolder: ComponentWorkspaceFolder): Promise<string> {
423407
const componentName = componentFolder.component.devfileData.devfile.metadata.name;
408+
const showLogCmd = Command.showLogAndFollow(Component.getDevPlatform(componentFolder));
424409
if (Component.isUsingWebviewEditor()) {
425-
LogViewLoader.loadView(`${componentName} Follow Log`, Command.showLogAndFollow, componentFolder);
410+
LogViewLoader.loadView(`${componentName} Follow Log`, showLogCmd, componentFolder);
426411
} else {
427412
void Component.odo.executeInTerminal(
428-
Command.showLogAndFollow(),
413+
showLogCmd,
429414
componentFolder.contextPath,
430415
`OpenShift: Follow '${componentName}' Component Log`);
431416
}

src/webview/log/LogViewLoader.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class LogViewLoader {
1717
return extensions.getExtension(ExtensionID).extensionPath
1818
}
1919

20-
static async loadView(title: string, cmdFunction: () => CommandText, target: ComponentWorkspaceFolder, addEnv: any = {}): Promise<WebviewPanel> {
20+
static async loadView(title: string, cmd: CommandText, target: ComponentWorkspaceFolder, addEnv: any = {}): Promise<WebviewPanel> {
2121
const localResourceRoot = Uri.file(path.join(LogViewLoader.extensionPath, 'out', 'logViewer'));
2222

2323
const panel = window.createWebviewPanel('logView', title, ViewColumn.One, {
@@ -27,8 +27,6 @@ export default class LogViewLoader {
2727
});
2828
panel.iconPath = Uri.file(path.join(LogViewLoader.extensionPath, "images/context/cluster-node.png"));
2929

30-
const cmd = cmdFunction();
31-
3230
// TODO: When webview is going to be ready?
3331
panel.webview.html = LogViewLoader.getWebviewContent(LogViewLoader.extensionPath, `${cmd}`.replace(/\\/g, '\\\\'), panel);
3432

0 commit comments

Comments
 (0)