mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Enable the start debugging button once execution is completed. Fixes #7517
This commit is contained in:
committed by
Akshay Joshi
parent
7d0ed90796
commit
9c745db413
@@ -25,7 +25,7 @@ import url_for from 'sources/url_for';
|
||||
|
||||
import { PgButtonGroup, PgIconButton } from '../../../../../static/js/components/Buttons';
|
||||
import { DebuggerContext, DebuggerEventsContext } from './DebuggerComponent';
|
||||
import { DEBUGGER_EVENTS } from '../DebuggerConstants';
|
||||
import { DEBUGGER_EVENTS, MENUS } from '../DebuggerConstants';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -45,6 +45,8 @@ export function ToolBar() {
|
||||
const eventBus = useContext(DebuggerEventsContext);
|
||||
let preferences = debuggerCtx.preferences.debugger;
|
||||
|
||||
// JS not allowing to use constants as key hence unable to use MENUS constants,
|
||||
// If required any changes in key update MENUS constans as well form DebuggerConstans file.
|
||||
const [buttonsDisabled, setButtonsDisabled] = useState({
|
||||
'stop': true,
|
||||
'clear-all-breakpoints': true,
|
||||
@@ -94,21 +96,21 @@ export function ToolBar() {
|
||||
|
||||
useEffect(() => {
|
||||
eventBus.registerListener(DEBUGGER_EVENTS.DISABLE_MENU, () => {
|
||||
setDisableButton('start', true);
|
||||
setDisableButton('step-into', true);
|
||||
setDisableButton('step-over', true);
|
||||
setDisableButton('clear-all-breakpoints', true);
|
||||
setDisableButton('toggle-breakpoint', true);
|
||||
setDisableButton('stop', true);
|
||||
setDisableButton(MENUS.START, true);
|
||||
setDisableButton(MENUS.STEPINTO, true);
|
||||
setDisableButton(MENUS.STEPOVER, true);
|
||||
setDisableButton(MENUS.CLEAR_ALL_BREAKPOINT, true);
|
||||
setDisableButton(MENUS.TOGGLE_BREAKPOINT, true);
|
||||
setDisableButton(MENUS.STOP, true);
|
||||
});
|
||||
|
||||
eventBus.registerListener(DEBUGGER_EVENTS.ENABLE_MENU, () => {
|
||||
setDisableButton('start', false);
|
||||
setDisableButton('step-into', false);
|
||||
setDisableButton('step-over', false);
|
||||
setDisableButton('clear-all-breakpoints', false);
|
||||
setDisableButton('toggle-breakpoint', false);
|
||||
setDisableButton('stop', false);
|
||||
setDisableButton(MENUS.START, false);
|
||||
setDisableButton(MENUS.STEPINTO, false);
|
||||
setDisableButton(MENUS.STEPOVER, false);
|
||||
setDisableButton(MENUS.CLEAR_ALL_BREAKPOINT, false);
|
||||
setDisableButton(MENUS.TOGGLE_BREAKPOINT, false);
|
||||
setDisableButton(MENUS.STOP, false);
|
||||
});
|
||||
|
||||
eventBus.registerListener(DEBUGGER_EVENTS.ENABLE_SPECIFIC_MENU, (key) => {
|
||||
@@ -120,21 +122,21 @@ export function ToolBar() {
|
||||
return (
|
||||
<Box className={classes.root}>
|
||||
<PgButtonGroup size="small">
|
||||
<PgIconButton data-test='step-in' title={gettext('Step into')} disabled={buttonsDisabled['step-into']} icon={<FormatIndentIncreaseIcon />} onClick={() => { stepInTODebugger(); }}
|
||||
<PgIconButton data-test='step-in' title={gettext('Step into')} disabled={buttonsDisabled[MENUS.STEPINTO]} icon={<FormatIndentIncreaseIcon />} onClick={() => { stepInTODebugger(); }}
|
||||
accesskey={shortcut_key(preferences?.btn_step_into)} />
|
||||
<PgIconButton data-test='step-over' title={gettext('Step over')} disabled={buttonsDisabled['step-over']} icon={<FormatIndentDecreaseIcon />} onClick={() => { stepOverDebugger(); }}
|
||||
<PgIconButton data-test='step-over' title={gettext('Step over')} disabled={buttonsDisabled[MENUS.STEPOVER]} icon={<FormatIndentDecreaseIcon />} onClick={() => { stepOverDebugger(); }}
|
||||
accesskey={shortcut_key(preferences?.btn_step_over)} />
|
||||
<PgIconButton data-test='debugger-contiue' title={gettext('Continue/Start')} disabled={buttonsDisabled['start']} icon={<PlayCircleFilledWhiteIcon />} onClick={() => { continueDebugger(); }}
|
||||
<PgIconButton data-test='debugger-contiue' title={gettext('Continue/Start')} disabled={buttonsDisabled[MENUS.START]} icon={<PlayCircleFilledWhiteIcon />} onClick={() => { continueDebugger(); }}
|
||||
accesskey={shortcut_key(preferences?.btn_start)} />
|
||||
</PgButtonGroup>
|
||||
<PgButtonGroup size="small">
|
||||
<PgIconButton data-test='toggle-breakpoint' title={gettext('Toggle breakpoint')} disabled={buttonsDisabled['toggle-breakpoint']} icon={<FiberManualRecordIcon style={{height: '2rem'}} />}
|
||||
<PgIconButton data-test='toggle-breakpoint' title={gettext('Toggle breakpoint')} disabled={buttonsDisabled[MENUS.TOGGLE_BREAKPOINT]} icon={<FiberManualRecordIcon style={{height: '2rem'}} />}
|
||||
accesskey={shortcut_key(preferences?.btn_toggle_breakpoint)} onClick={() => { toggleBreakpoint(); }} />
|
||||
<PgIconButton data-test='clear-breakpoint' title={gettext('Clear all breakpoints')} disabled={buttonsDisabled['clear-all-breakpoints']} icon={<NotInterestedIcon />}
|
||||
<PgIconButton data-test='clear-breakpoint' title={gettext('Clear all breakpoints')} disabled={buttonsDisabled[MENUS.CLEAR_ALL_BREAKPOINT]} icon={<NotInterestedIcon />}
|
||||
accesskey={shortcut_key(preferences?.btn_clear_breakpoints)} onClick={() => { clearAllBreakpoint(); }} />
|
||||
</PgButtonGroup>
|
||||
<PgButtonGroup size="small">
|
||||
<PgIconButton data-test='stop-debugger' title={gettext('Stop')} icon={<StopIcon style={{height: '2rem'}} />} disabled={buttonsDisabled['stop']} onClick={() => { stop(); }}
|
||||
<PgIconButton data-test='stop-debugger' title={gettext('Stop')} icon={<StopIcon style={{height: '2rem'}} />} disabled={buttonsDisabled[MENUS.STOP]} onClick={() => { stop(); }}
|
||||
accesskey={shortcut_key(preferences?.btn_stop)} />
|
||||
</PgButtonGroup>
|
||||
<PgButtonGroup size="small">
|
||||
|
||||
Reference in New Issue
Block a user