Fix multiple issues related to debugger params dialog input. #7883

- Handle multiple possible values for a boolean parameter.
- Disable value input when "Use default" is enabled.
This commit is contained in:
Rohit Bhati 2024-10-29 16:01:46 +05:30 committed by GitHub
parent 9e3f5f53cc
commit a9bfa8a71d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -114,6 +114,7 @@ class ArgementsCollectionSchema extends BaseUISchema {
},
editable: true,
align_center: true,
disabled: (state) => state.use_default
},
{
id: 'use_default',
@ -121,7 +122,7 @@ class ArgementsCollectionSchema extends BaseUISchema {
type: 'checkbox',
cell: 'checkbox',
width: 62,
disabled: (state) => {return state.disable_use_default;}
disabled: (state) => state.disable_use_default
},
{
id: 'default_value',

View File

@ -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;
}