Skip to content

Commit 91e8a28

Browse files
committed
Added converter non parallel and converter compound to task creation form
1 parent 2a08612 commit 91e8a28

File tree

4 files changed

+36
-44
lines changed

4 files changed

+36
-44
lines changed

__tests__/v2/AddSingleTask.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('AddSingleTask', () => {
4747
expect.objectContaining({
4848
body: JSON.stringify({
4949
name: 'test-task',
50+
type: 'non_parallel',
5051
command_non_parallel: 'command',
5152
input_types: {},
5253
output_types: {}
@@ -81,6 +82,7 @@ describe('AddSingleTask', () => {
8182
expect.objectContaining({
8283
body: JSON.stringify({
8384
name: 'test-task',
85+
type: 'non_parallel',
8486
command_non_parallel: 'command',
8587
input_types: {},
8688
output_types: {}

src/lib/components/v2/tasks/AddSingleTask.svelte

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
import StandardDismissableAlert from '../../common/StandardDismissableAlert.svelte';
55
import TaskGroupSelector from './TaskGroupSelector.svelte';
66
import TypesEditor from './TypesEditor.svelte';
7-
import { detectSchemaVersion, SchemaValidator } from 'fractal-components';
7+
import {
8+
detectSchemaVersion,
9+
isCompoundType,
10+
isNonParallelType,
11+
isParallelType,
12+
SchemaValidator
13+
} from 'fractal-components';
814
915
/**
1016
* @typedef {Object} Props
@@ -36,6 +42,7 @@
3642
3743
const formErrorHandler = new FormErrorHandler('errorAlert-createTask', [
3844
'name',
45+
'type',
3946
'command_non_parallel',
4047
'command_parallel',
4148
'version',
@@ -94,6 +101,7 @@
94101
95102
const bodyData = {
96103
name,
104+
type: taskType,
97105
command_non_parallel,
98106
command_parallel,
99107
version,
@@ -350,40 +358,22 @@
350358
}}
351359
>
352360
<div class="row mb-1">
353-
<div class="col-xl-1 col-lg-2 col-3">Task type</div>
354-
<div class="col-xl-11 col-lg-8 col-9">
355-
<div class="form-check form-check-inline">
356-
<input
357-
class="form-check-input"
358-
type="radio"
359-
name="taskType"
360-
id="non_parallel"
361-
value="non_parallel"
362-
bind:group={taskType}
363-
/>
364-
<label class="form-check-label" for="non_parallel"> Non parallel </label>
365-
</div>
366-
<div class="form-check form-check-inline">
367-
<input
368-
class="form-check-input"
369-
type="radio"
370-
name="taskType"
371-
id="parallel"
372-
value="parallel"
373-
bind:group={taskType}
374-
/>
375-
<label class="form-check-label" for="parallel">Parallel</label>
376-
</div>
377-
<div class="form-check form-check-inline">
378-
<input
379-
class="form-check-input"
380-
type="radio"
381-
name="taskType"
382-
id="compound"
383-
value="compound"
384-
bind:group={taskType}
385-
/>
386-
<label class="form-check-label" for="compound">Compound</label>
361+
<div class="col-md-6 mb-2">
362+
<div class="input-group has-validation">
363+
<label for="task_type" class="input-group-text">Task type</label>
364+
<select
365+
class="form-select"
366+
bind:value={taskType}
367+
class:is-invalid={$validationErrors['type']}
368+
id="task_type"
369+
>
370+
<option value="non_parallel">Non parallel</option>
371+
<option value="parallel">Parallel</option>
372+
<option value="compound">Compound</option>
373+
<option value="converter_non_parallel">Converter Non Parallel</option>
374+
<option value="converter_compound">Converter Compound</option>
375+
</select>
376+
<span class="invalid-feedback">{$validationErrors['type']}</span>
387377
</div>
388378
</div>
389379
</div>
@@ -404,7 +394,7 @@
404394
</div>
405395
</div>
406396
</div>
407-
{#if taskType === 'non_parallel' || taskType === 'compound'}
397+
{#if isNonParallelType(taskType) || isCompoundType(taskType)}
408398
<div class="row">
409399
<div class="col-12 mb-2">
410400
<div class="input-group has-validation">
@@ -423,7 +413,7 @@
423413
</div>
424414
</div>
425415
{/if}
426-
{#if taskType === 'parallel' || taskType === 'compound'}
416+
{#if isParallelType(taskType) || isCompoundType(taskType)}
427417
<div class="row">
428418
<div class="col-12 mb-2">
429419
<div class="input-group has-validation">
@@ -468,7 +458,7 @@
468458
</div>
469459
</div>
470460
</div>
471-
{#if taskType === 'non_parallel' || taskType === 'compound'}
461+
{#if isNonParallelType(taskType) || isCompoundType(taskType)}
472462
<div class="row">
473463
<div class="col-lg-6 mb-2">
474464
<div class="input-group has-validation">
@@ -526,7 +516,7 @@
526516
</div>
527517
</div>
528518
{/if}
529-
{#if taskType === 'parallel' || taskType === 'compound'}
519+
{#if isParallelType(taskType) || isCompoundType(taskType)}
530520
<div class="row">
531521
<div class="col-lg-6 mb-2">
532522
<div class="input-group has-validation">

tests/v2/add_single_task.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test('Add single tasks [v2]', async ({ page }) => {
5858
const randomTaskName2 = Math.random().toString(36).substring(7);
5959

6060
await test.step('Create parallel task', async () => {
61-
await page.getByText('Parallel', { exact: true }).click();
61+
await page.getByRole('combobox', { name: 'Task type' }).selectOption('Parallel');
6262

6363
await page.getByRole('textbox', { name: 'Task name' }).fill(randomTaskName2);
6464
await page.getByRole('textbox', { name: 'Command parallel' }).fill('/tmp/test');
@@ -89,7 +89,7 @@ test('Add single tasks [v2]', async ({ page }) => {
8989
const randomTaskName3 = Math.random().toString(36).substring(7);
9090

9191
await test.step('Create compound task', async () => {
92-
await page.getByText('Compound', { exact: true }).click();
92+
await page.getByRole('combobox', { name: 'Task type' }).selectOption('Compound');
9393

9494
await page.getByRole('textbox', { name: 'Task name' }).fill(randomTaskName3);
9595
await page.getByRole('textbox', { name: 'Command non parallel' }).fill('/tmp/test-np');
@@ -208,7 +208,7 @@ test('Add single tasks [v2]', async ({ page }) => {
208208
});
209209

210210
await test.step('Create different version of parallel task', async () => {
211-
await page.getByText('Parallel', { exact: true }).click();
211+
await page.getByRole('combobox', { name: 'Task type' }).selectOption('Parallel');
212212
await page.getByRole('textbox', { name: 'Task name' }).fill(randomTaskName2);
213213
await page.getByRole('textbox', { name: 'Command parallel' }).fill('/tmp/test2');
214214
await page.getByRole('textbox', { name: 'Version' }).fill('0.0.2');

tests/v2/task_utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export async function createFakeTask(page, task) {
2323
await page.getByText('Single task').click();
2424

2525
if (task.type === 'parallel') {
26-
await page.getByText('Parallel', { exact: true }).click();
26+
await page.getByRole('combobox', { name: 'Task type' }).selectOption('Parallel');
2727
} else if (task.type === 'compound') {
28-
await page.getByText('Compound', { exact: true }).click();
28+
await page.getByRole('combobox', { name: 'Task type' }).selectOption('Compound');
2929
}
3030

3131
await page.getByRole('textbox', { name: 'Task name' }).fill(taskName);

0 commit comments

Comments
 (0)