Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle boolean checkbox states and deactivate 'Use Default' when manual input detected on debugger. #7883 #8067

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading