Skip to content

Commit bde3ad6

Browse files
authored
Merge pull request #473 from fractal-analytics-platform/fixed-meta-properties-update
Fixed issue in meta properties update
2 parents 4f09658 + a7de34d commit bde3ad6

File tree

5 files changed

+60
-27
lines changed

5 files changed

+60
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*Note: Numbers like (\#123) point to closed Pull Requests on the fractal-web repository.*
22

3+
# Unreleased
4+
5+
* used payload containing all fields in meta properties PATCH endpoint (\#473).
6+
37
# 1.0.0
48

59
* Supported fractal-server API V2:

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default defineConfig({
4747

4848
webServer: [
4949
{
50-
command: './tests/start-test-server.sh 2.0.0a10',
50+
command: './tests/start-test-server.sh 2.0.0',
5151
port: 8000,
5252
waitForPort: true,
5353
stdout: 'pipe',

src/lib/components/v2/workflow/MetaPropertiesForm.svelte

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,28 @@
88
// The form should be structured in multiple levels of depth, and support complex structure.
99
import { page } from '$app/stores';
1010
import FormBuilder from '$lib/components/v2/workflow/FormBuilder.svelte';
11-
import { getOnlyModifiedProperties } from '$lib/common/component_utilities';
1211
import { displayStandardErrorAlert } from '$lib/common/errors';
1312
1413
/** @type {import('$lib/types-v2').WorkflowTaskV2} */
1514
export let workflowTask;
1615
1716
let metaPropertiesNonParallel = {};
18-
let originalMetaPropertiesNonParallel = {};
19-
2017
let metaPropertiesParallel = {};
21-
let originalMetaPropertiesParallel = {};
2218
2319
$: {
2420
metaPropertiesNonParallel = workflowTask.meta_non_parallel || {};
2521
metaPropertiesParallel = workflowTask.meta_parallel || {};
26-
updateOriginalMetaProperties();
2722
}
2823
2924
async function updateMetaNonParallel() {
30-
const modifiedProperties = getOnlyModifiedProperties(
31-
originalMetaPropertiesNonParallel,
32-
metaPropertiesNonParallel
33-
);
3425
await handleEntryUpdate({
35-
meta_non_parallel: modifiedProperties
26+
meta_non_parallel: metaPropertiesNonParallel
3627
});
3728
}
3829
3930
async function updateMetaParallel() {
40-
const modifiedProperties = getOnlyModifiedProperties(
41-
originalMetaPropertiesParallel,
42-
metaPropertiesParallel
43-
);
4431
await handleEntryUpdate({
45-
meta_parallel: modifiedProperties
32+
meta_parallel: metaPropertiesParallel
4633
});
4734
}
4835
@@ -71,21 +58,10 @@
7158
workflowTask.meta_parallel = result.meta_parallel;
7259
metaPropertiesNonParallel = result.meta_non_parallel || {};
7360
metaPropertiesParallel = result.meta_parallel || {};
74-
// Updating original properties again
75-
updateOriginalMetaProperties();
7661
} else {
7762
displayStandardErrorAlert(result, 'metaPropertiesFormError');
7863
}
7964
}
80-
81-
function updateOriginalMetaProperties() {
82-
for (let key in metaPropertiesNonParallel) {
83-
originalMetaPropertiesNonParallel[key] = metaPropertiesNonParallel[key];
84-
}
85-
for (let key in metaPropertiesParallel) {
86-
originalMetaPropertiesParallel[key] = metaPropertiesParallel[key];
87-
}
88-
}
8965
</script>
9066

9167
<div>

tests/v1/collect_core_tasks.setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ test('Collect core tasks', async ({ page }) => {
1717

1818
await test.step('Start task collection', async () => {
1919
await page.getByLabel('Package', { exact: true }).fill('fractal-tasks-core');
20+
await page.getByRole('textbox', { name: 'Package Version' }).fill('0.14.3');
2021

2122
const collectBtn = page.getByRole('button', { name: /^Collect$/ });
2223
await collectBtn.click();
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { test } from './workflow_fixture.js';
2+
import { waitPageLoading } from '../utils.js';
3+
import { createFakeTask, deleteTask } from './task_utils.js';
4+
5+
test('Workflow task meta properties [v2]', async ({ page, workflow }) => {
6+
await page.waitForURL(workflow.url);
7+
await waitPageLoading(page);
8+
9+
let taskName;
10+
await test.step('Create test tasks', async () => {
11+
taskName = await createFakeTask(page, { type: 'non_parallel' });
12+
});
13+
14+
await test.step('Open workflow page', async () => {
15+
await workflow.openWorkflowPage();
16+
});
17+
18+
await test.step('Add tasks to workflow', async () => {
19+
await workflow.addUserTask(taskName);
20+
await workflow.selectTask(taskName);
21+
});
22+
23+
await test.step('Open Meta tab', async () => {
24+
await page.getByText('Meta', { exact: true }).click();
25+
});
26+
27+
await test.step('Add first property', async () => {
28+
await page.getByRole('button', { name: 'Add property' }).click();
29+
await page.getByPlaceholder('Arg name').fill('k1');
30+
await page.getByPlaceholder('Argument default value').fill('v1');
31+
await page.getByLabel('Save argument').click();
32+
});
33+
34+
await test.step('Add second property', async () => {
35+
await page.getByRole('button', { name: 'Add property' }).click();
36+
await page.getByPlaceholder('Arg name').fill('k2');
37+
await page.getByPlaceholder('Argument default value').fill('v2');
38+
await page.getByLabel('Save argument').click();
39+
});
40+
41+
await test.step('Verify that meta contains the 2 properties', async () => {
42+
await page.getByText('k1').waitFor();
43+
await page.getByText('k2').waitFor();
44+
await page.getByText('v1').waitFor();
45+
await page.getByText('v2').waitFor();
46+
});
47+
48+
await test.step('Cleanup', async () => {
49+
await workflow.removeCurrentTask();
50+
await deleteTask(page, taskName);
51+
});
52+
});

0 commit comments

Comments
 (0)