Commit 563f2a2d authored by Ivan Mazhukin's avatar Ivan Mazhukin

allow presets for parallel runs

parent e2b69b04
...@@ -36,7 +36,7 @@ The same VSIX can be installed from the VS Code command `Extensions: Install fro ...@@ -36,7 +36,7 @@ The same VSIX can be installed from the VS Code command `Extensions: Install fro
## Actions ## Actions
- `Run app on systems`: asks for an app and target systems. - `Run app on systems`: asks for an app and target systems.
- `Run app on systems parallel`: asks for an app and target systems, then passes `--parallel`. - `Run app on systems parallel`: asks for an app, then lets you choose a preset or type target systems manually, and passes `--parallel`.
- `Run app preset`: asks for an app and `main`, `russian`, or `all`. - `Run app preset`: asks for an app and `main`, `russian`, or `all`.
- `Run exec command`: asks for a shell command and target systems or preset. - `Run exec command`: asks for a shell command and target systems or preset.
- `./bin/epm play <app>`: runs a local play command outside Docker. - `./bin/epm play <app>`: runs a local play command outside Docker.
......
...@@ -141,8 +141,25 @@ async function runApp(parallel) { ...@@ -141,8 +141,25 @@ async function runApp(parallel) {
return; return;
} }
if (parallel) {
const target = await pickParallelTarget();
if (!target) {
return;
}
await setWorkspaceState('lastApp', app);
if (target.preset) {
await executeTest({ app, preset: target.preset, parallel });
return;
}
await setWorkspaceState('lastSystems', target.systems);
await executeTest({ app, systems: splitArgs(target.systems), parallel });
return;
}
const systems = await promptForSystems({ const systems = await promptForSystems({
title: parallel ? 'EPM Docker Test Parallel' : 'EPM Docker Test', title: 'EPM Docker Test',
prompt: 'Target systems separated by spaces', prompt: 'Target systems separated by spaces',
fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora')) fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora'))
}); });
...@@ -155,6 +172,50 @@ async function runApp(parallel) { ...@@ -155,6 +172,50 @@ async function runApp(parallel) {
await executeTest({ app, systems: splitArgs(systems), parallel }); await executeTest({ app, systems: splitArgs(systems), parallel });
} }
async function pickParallelTarget() {
const defaultPreset = getConfig().get('defaultPreset', 'main');
const presetItems = ['main', 'russian', 'all']
.filter((preset) => preset !== defaultPreset)
.map((preset) => ({
label: `$(list-selection) Preset: ${preset}`,
preset
}));
const choice = await vscode.window.showQuickPick([
{
label: `$(list-selection) Preset: ${defaultPreset}`,
description: 'Default preset',
preset: defaultPreset
},
...presetItems,
{
label: '$(edit) Custom systems...',
description: 'Type target systems manually',
custom: true
},
{
label: '$(close) Отмена',
cancel: true
}
], {
title: 'EPM Docker Test Parallel',
placeHolder: 'Choose preset or custom target systems'
});
if (!choice || choice.cancel) {
return undefined;
}
if (choice.preset) {
return { preset: choice.preset };
}
const systems = await promptForSystems({
title: 'EPM Docker Test Parallel',
prompt: 'Target systems separated by spaces',
fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora'))
});
return systems ? { systems } : undefined;
}
async function runPreset() { async function runPreset() {
const app = await promptForApp({ const app = await promptForApp({
title: 'EPM Docker Test', title: 'EPM Docker Test',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment