Skip to content

Commit 47c2296

Browse files
committed
Add warning about experimental feature to run dev on podman command
This PR fixes #2690. Signed-off-by: Denis Golovin [email protected]
1 parent 57d794c commit 47c2296

File tree

3 files changed

+53
-13
lines changed

3 files changed

+53
-13
lines changed

package.json

+23-9
Original file line numberDiff line numberDiff line change
@@ -1104,11 +1104,11 @@
11041104
},
11051105
{
11061106
"command": "openshift.experimental.mode.enable",
1107-
"when": "view == openshiftComponentsView && !config.openshiftToolkit.enableExperimentialMode"
1107+
"when": "view == openshiftComponentsView && !config.openshiftToolkit.experimentalFeatures"
11081108
},
11091109
{
11101110
"command": "openshift.experimental.mode.disable",
1111-
"when": "view == openshiftComponentsView && config.openshiftToolkit.enableExperimentialMode"
1111+
"when": "view == openshiftComponentsView && config.openshiftToolkit.experimentalFeatures"
11121112
}
11131113
],
11141114
"view/item/context": [
@@ -1244,7 +1244,7 @@
12441244
},
12451245
{
12461246
"command": "openshift.component.dev.onPodman",
1247-
"when": "view == openshiftComponentsView && config.openshiftToolkit.enableExperimentialMode && viewItem =~ /openshift\\.component.*\\.dev-nrn.*/",
1247+
"when": "view == openshiftComponentsView && config.openshiftToolkit.experimentalFeatures && viewItem =~ /openshift\\.component.*\\.dev-nrn.*/",
12481248
"group": "c1@2"
12491249
},
12501250
{
@@ -1446,11 +1446,6 @@
14461446
"default": true,
14471447
"description": "Show Welcome Page when using OpenShift Toolkit Extension."
14481448
},
1449-
"openshiftToolkit.enableExperimentialMode": {
1450-
"type": "boolean",
1451-
"default": false,
1452-
"description": "Show OpenShift Toolkit Experimental Features."
1453-
},
14541449
"openshiftToolkit.showChannelOnOutput": {
14551450
"type": "boolean",
14561451
"default": false,
@@ -1525,7 +1520,26 @@
15251520
"default": 100000
15261521
}
15271522
}
1528-
}
1523+
},
1524+
{
1525+
"type": "object",
1526+
"order": 4,
1527+
"title": "Experimental Features",
1528+
"properties": {
1529+
"openshiftToolkit.experimentalFeatures": {
1530+
"order": 1,
1531+
"description": "Show OpenShift Toolkit Experimental Features.",
1532+
"type": "boolean",
1533+
"default": true
1534+
},
1535+
"openshiftToolkit.devModeRunOnPodman": {
1536+
"order": 2,
1537+
"description": "Show warning about experimental feature",
1538+
"type": "boolean",
1539+
"default": true
1540+
}
1541+
}
1542+
}
15291543
]
15301544
},
15311545
"extensionDependencies": [

src/experimental.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
import { workspace } from 'vscode';
77
import { vsCommand } from './vscommand';
88

9+
async function setShowExperimentalFeatures(set: boolean): Promise<void> {
10+
await workspace.getConfiguration('openshiftToolkit').update('experimentalFeatures', set);
11+
}
12+
913
export class ExperimentalMode {
1014

1115
@vsCommand('openshift.experimental.mode.enable')
12-
public static enable() {
13-
workspace.getConfiguration('openshiftToolkit').update('enableExperimentialMode', true);
16+
public static async enable() {
17+
await setShowExperimentalFeatures(true);
1418
}
1519

1620
@vsCommand('openshift.experimental.mode.disable')
17-
public static disable() {
18-
workspace.getConfiguration('openshiftToolkit').update('enableExperimentialMode', false);
21+
public static async disable() {
22+
await setShowExperimentalFeatures(false);
1923
}
24+
2025
}

src/openshift/component.ts

+21
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,27 @@ 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+
}
197218
return Component.dev(component, 'podman');
198219
}
199220

0 commit comments

Comments
 (0)