Skip to content

Commit ef47c70

Browse files
authored
Merge pull request #279 from fractal-analytics-platform/278-task-argument-can-be-updated-once-but-not-twice
Fix bug "task argument can be updated once but not twice"
2 parents 43c9047 + 44c81c2 commit ef47c70

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

CHANGELOG.md

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

3+
# 0.5.5
4+
5+
* Fix bug in `JSchema.svelte` (\#279).
36

47
# 0.5.4
58

src/lib/components/common/jschema/JSchema.svelte

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,33 @@
9797
}
9898
}
9999
100-
if (saveChanges === null || saveChanges === undefined) {
101-
saveChanges = function() {
102-
const data = schemaManager.data;
103-
// The following is required to remove all null values from the data object
104-
// We suppose that null values are not valid, hence we remove them
105-
// Deep copy the data object
106-
const toStripData = JSON.parse(JSON.stringify(data));
107-
const strippedNullData = stripNullAndEmptyObjectsAndArrays(toStripData);
108-
const isDataValid = validator.isValid(strippedNullData);
109-
if (!isDataValid) {
110-
if (handleValidationErrors !== null && handleValidationErrors !== undefined) {
111-
handleValidationErrors(validator.getErrors());
112-
}
113-
console.error('Could not save changes. Data is invalid', validator.getErrors());
114-
return;
115-
}
116-
117-
if (handleSaveChanges !== null && handleSaveChanges !== undefined) {
118-
handleSaveChanges(strippedNullData)
119-
.then((updated_args) => {
120-
schemaManager.data = updated_args;
121-
schemaManager.changesSaved();
122-
})
123-
.catch((err) => {
124-
console.error(err);
125-
});
126-
}
127-
}
128-
}
100+
saveChanges = function() {
101+
const data = schemaManager.data;
102+
// The following is required to remove all null values from the data object
103+
// We suppose that null values are not valid, hence we remove them
104+
// Deep copy the data object
105+
const toStripData = JSON.parse(JSON.stringify(data));
106+
const strippedNullData = stripNullAndEmptyObjectsAndArrays(toStripData);
107+
const isDataValid = validator.isValid(strippedNullData);
108+
if (!isDataValid) {
109+
if (handleValidationErrors !== null && handleValidationErrors !== undefined) {
110+
handleValidationErrors(validator.getErrors());
111+
}
112+
console.error('Could not save changes. Data is invalid', validator.getErrors());
113+
return;
114+
}
115+
116+
if (handleSaveChanges !== null && handleSaveChanges !== undefined) {
117+
handleSaveChanges(strippedNullData)
118+
.then((updated_args) => {
119+
schemaManager.data = updated_args;
120+
schemaManager.changesSaved();
121+
})
122+
.catch((err) => {
123+
console.error(err);
124+
});
125+
}
126+
}
129127
130128
export function discardChanges(args) {
131129
// Set schemaData to incoming args value

src/lib/components/workflow/task_form_utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export async function updateFormEntry(
1010
const requestData = {};
1111
requestData[groupName] = updatingWorkflowTaskProperties;
1212

13+
console.log(`In updateFormEntry, requestData is ${JSON.stringify(requestData)}`);
14+
1315
// Should make a PATCH request to the server to update the workflow task properties
1416
const response = await fetch(
1517
`/projects/${projectId}/workflows/${workflowId}/tasks/${workflowTaskId}`,
@@ -26,6 +28,7 @@ export async function updateFormEntry(
2628
console.log('Update form entry response successful');
2729
// Should return the updated form entry
2830
const updatedFormEntry = await response.json();
31+
console.log(`In updateFormEntry, updatedFormEntry is ${JSON.stringify(updatedFormEntry)}`);
2932
return updatedFormEntry;
3033
}
3134

0 commit comments

Comments
 (0)