mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
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:
parent
9e3f5f53cc
commit
a9bfa8a71d
@ -114,6 +114,7 @@ class ArgementsCollectionSchema extends BaseUISchema {
|
|||||||
},
|
},
|
||||||
editable: true,
|
editable: true,
|
||||||
align_center: true,
|
align_center: true,
|
||||||
|
disabled: (state) => state.use_default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'use_default',
|
id: 'use_default',
|
||||||
@ -121,7 +122,7 @@ class ArgementsCollectionSchema extends BaseUISchema {
|
|||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
cell: 'checkbox',
|
cell: 'checkbox',
|
||||||
width: 62,
|
width: 62,
|
||||||
disabled: (state) => {return state.disable_use_default;}
|
disabled: (state) => state.disable_use_default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'default_value',
|
id: 'default_value',
|
||||||
|
@ -342,13 +342,23 @@ export default function DebuggerArgumentComponent({ debuggerInfo, restartDebug,
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setDebuggerArgs(funcArgsData, funcObj, myObj) {
|
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
|
// Check if the arguments already available in the sqlite database
|
||||||
// then we should use the existing arguments
|
// then we should use the existing arguments
|
||||||
let initVal = { 'aregsCollection': [] };
|
let initVal = { 'aregsCollection': [] };
|
||||||
if (funcArgsData.length == 0) {
|
if (funcArgsData.length == 0) {
|
||||||
|
setBooleanDefaults(myObj);
|
||||||
initVal = { 'aregsCollection': myObj };
|
initVal = { 'aregsCollection': myObj };
|
||||||
debuggerArgsData.current = initVal;
|
debuggerArgsData.current = initVal;
|
||||||
} else {
|
} else {
|
||||||
|
setBooleanDefaults(funcObj);
|
||||||
initVal = { 'aregsCollection': funcObj };
|
initVal = { 'aregsCollection': funcObj };
|
||||||
debuggerArgsData.current = initVal;
|
debuggerArgsData.current = initVal;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user