mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed issues in the Preferences:
1) Show a single note in the binary path. 2) Resolved issue in the keyboard shortcut. refs #7149
This commit is contained in:
parent
02e799c917
commit
931a399890
@ -233,6 +233,7 @@ export default function PreferencesComponent({ ...props }) {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
function setPreferences(node, subNode, nodeData, preferencesValues, preferencesData) {
|
function setPreferences(node, subNode, nodeData, preferencesValues, preferencesData) {
|
||||||
|
let addBinaryPathNote = false;
|
||||||
subNode.preferences.forEach((element) => {
|
subNode.preferences.forEach((element) => {
|
||||||
let note = '';
|
let note = '';
|
||||||
let type = getControlMappedForType(element.type);
|
let type = getControlMappedForType(element.type);
|
||||||
@ -247,7 +248,10 @@ export default function PreferencesComponent({ ...props }) {
|
|||||||
element.editable = false;
|
element.editable = false;
|
||||||
element.disabled = true;
|
element.disabled = true;
|
||||||
preferencesValues[element.id] = JSON.parse(element.value);
|
preferencesValues[element.id] = JSON.parse(element.value);
|
||||||
addNote(node, subNode, nodeData, preferencesData, note);
|
if(addBinaryPathNote) {
|
||||||
|
addNote(node, subNode, nodeData, preferencesData, note);
|
||||||
|
}
|
||||||
|
addBinaryPathNote = true;
|
||||||
}
|
}
|
||||||
else if (type == 'select') {
|
else if (type == 'select') {
|
||||||
setControlProps(element);
|
setControlProps(element);
|
||||||
|
@ -60,7 +60,7 @@ export default function KeyboardShortcuts({ value, onChange, fields }) {
|
|||||||
|
|
||||||
const onCtrlChange = (e) => {
|
const onCtrlChange = (e) => {
|
||||||
let newVal = { ...value };
|
let newVal = { ...value };
|
||||||
newVal.ctrl = e.target.checked;
|
newVal.control = e.target.checked;
|
||||||
onChange(newVal);
|
onChange(newVal);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ export default function KeyboardShortcuts({ value, onChange, fields }) {
|
|||||||
} else if (element.name == 'control') {
|
} else if (element.name == 'control') {
|
||||||
return <Grid item lg={2} md={2} sm={2} xs={12} className={classes.inputLabel} key={_.uniqueId('c')}>
|
return <Grid item lg={2} md={2} sm={2} xs={12} className={classes.inputLabel} key={_.uniqueId('c')}>
|
||||||
<Box className={classes.inputCheckboxClass}>
|
<Box className={classes.inputCheckboxClass}>
|
||||||
<InputCheckbox id={ctrlCid} helpid={ctrlhelpid} value={value?.ctrl}
|
<InputCheckbox id={ctrlCid} helpid={ctrlhelpid} value={value?.control}
|
||||||
controlProps={ctrlProps}
|
controlProps={ctrlProps}
|
||||||
onChange={onCtrlChange}></InputCheckbox>
|
onChange={onCtrlChange}></InputCheckbox>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -22,7 +22,7 @@ import { InputCheckbox } from '../../../pgadmin/static/js/components/FormCompone
|
|||||||
describe('KeyboardShortcuts', () => {
|
describe('KeyboardShortcuts', () => {
|
||||||
let mount;
|
let mount;
|
||||||
let defult_value = {
|
let defult_value = {
|
||||||
'ctrl': true,
|
'control': true,
|
||||||
'alt': true,
|
'alt': true,
|
||||||
'key': {
|
'key': {
|
||||||
'char': 'a',
|
'char': 'a',
|
||||||
@ -85,26 +85,26 @@ describe('KeyboardShortcuts', () => {
|
|||||||
|
|
||||||
it('Key change', (done) => {
|
it('Key change', (done) => {
|
||||||
ctrl.find(OutlinedInput).at(0).find('input').simulate('keydown', { key: '', keyCode: 32});
|
ctrl.find(OutlinedInput).at(0).find('input').simulate('keydown', { key: '', keyCode: 32});
|
||||||
expect(onChange).toHaveBeenCalledWith({ ctrl: true, alt: true, key: { char: 'Space', key_code: 32 }, shift: false });
|
expect(onChange).toHaveBeenCalledWith({ control: true, alt: true, key: { char: 'Space', key_code: 32 }, shift: false });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Shift option', (done) => {
|
it('Shift option', (done) => {
|
||||||
ctrl.find(InputCheckbox).at(0).find('input').simulate('change', { target: { checked: true, name: 'shift' } });
|
ctrl.find(InputCheckbox).at(0).find('input').simulate('change', { target: { checked: true, name: 'shift' } });
|
||||||
expect(onChange).toHaveBeenCalledWith({ ctrl: true, alt: true, key: { char: 'a', key_code: 97 }, shift: true });
|
expect(onChange).toHaveBeenCalledWith({ control: true, alt: true, key: { char: 'a', key_code: 97 }, shift: true });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Ctrl option', (done) => {
|
it('Control option', (done) => {
|
||||||
ctrl.find(InputCheckbox).at(1).find('input').simulate('change', { target: { checked: false, name: 'ctrl' } });
|
ctrl.find(InputCheckbox).at(1).find('input').simulate('change', { target: { checked: false, name: 'ctrl' } });
|
||||||
expect(onChange).toHaveBeenCalledWith({ ctrl: false, alt: true, key: { char: 'a', key_code: 97 }, shift: false });
|
expect(onChange).toHaveBeenCalledWith({ control: false, alt: true, key: { char: 'a', key_code: 97 }, shift: false });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('Alt option', (done) => {
|
it('Alt option', (done) => {
|
||||||
ctrl.find(InputCheckbox).at(2).find('input').simulate('change', { target: { checked: false, name: 'alt' } });
|
ctrl.find(InputCheckbox).at(2).find('input').simulate('change', { target: { checked: false, name: 'alt' } });
|
||||||
expect(onChange).toHaveBeenCalledWith({ ctrl: true, alt: false, key: { char: 'a', key_code: 97 }, shift: false });
|
expect(onChange).toHaveBeenCalledWith({ control: true, alt: false, key: { char: 'a', key_code: 97 }, shift: false });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user