Skip to content

Commit

Permalink
Handle boolean checkbox states and deactivate 'Use Default' when manu…
Browse files Browse the repository at this point in the history
…al input detected on debugger. #7883
  • Loading branch information
Rohit Bhati committed Oct 29, 2024
1 parent 8b354ae commit 63e8921
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ class ArgementsCollectionSchema extends BaseUISchema {
},
editable: true,
align_center: true,
disabled: (state) => state.use_default
},
{
id: 'use_default',
label: gettext('Use Default?'),
type: 'checkbox',
cell: 'checkbox',
width: 62,
disabled: (state) => {return state.disable_use_default;}
disabled: (state) => state.disable_use_default
},
{
id: 'default_value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,23 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
}

function setDebuggerArgs(funcArgsData, funcObj, myObj) {
// Ensure unchecked boolean checkboxes are set to false.
const setBooleanDefaults = (dataArray) => {
dataArray.forEach(data => {
if (data.type === 'boolean' && (data.value === undefined || data.value === '' || data.value === '0' )) {
data.value = false;
}
});
};
// Check if the arguments already available in the sqlite database
// then we should use the existing arguments
let initVal = { 'aregsCollection': [] };
if (funcArgsData.length == 0) {
setBooleanDefaults(myObj);
initVal = { 'aregsCollection': myObj };
debuggerArgsData.current = initVal;
} else {
setBooleanDefaults(funcObj);
initVal = { 'aregsCollection': funcObj };
debuggerArgsData.current = initVal;
}
Expand Down

0 comments on commit 63e8921

Please sign in to comment.