mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1. Stop process of Process details dialog not working.
2. When a server of an in progress cloud deployment is expanded, it is throwing a failed error. 3. Close the process notification on clicking View Processes. Fixes #3709
This commit is contained in:
committed by
Akshay Joshi
parent
ef91207669
commit
b12c1f8740
@@ -140,7 +140,7 @@ export default class BgProcessManager {
|
||||
stopProcess(jobId) {
|
||||
this.procList.find((p)=>p.id == jobId).process_state = BgProcessManagerProcessState.PROCESS_TERMINATING;
|
||||
this._eventManager.fireEvent(BgProcessManagerEvents.LIST_UPDATED);
|
||||
this.api.put(url_for('bgprocess.stop_process', {
|
||||
return this.api.put(url_for('bgprocess.stop_process', {
|
||||
pid: jobId,
|
||||
}))
|
||||
.then(()=>{
|
||||
|
||||
@@ -56,7 +56,10 @@ function ProcessNotifyMessage({title, desc, onClose, onViewProcess, success=true
|
||||
<Box className={classes.containerBody}>
|
||||
<Box>{desc}</Box>
|
||||
<Box marginTop={'1rem'} display="flex">
|
||||
<DefaultButton startIcon={<DescriptionOutlinedIcon />} onClick={onViewProcess}>View Processes</DefaultButton>
|
||||
<DefaultButton startIcon={<DescriptionOutlinedIcon />} onClick={()=>{
|
||||
onViewProcess();
|
||||
onClose();
|
||||
}}>View Processes</DefaultButton>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -86,15 +86,23 @@ export default function ProcessDetails({data}) {
|
||||
const [[outPos, errPos], setOutErrPos] = useState([0, 0]);
|
||||
const [exitCode, setExitCode] = useState(data.exit_code);
|
||||
const [timeTaken, setTimeTaken] = useState(data.execution_time);
|
||||
const [stopping, setStopping] = useState(false);
|
||||
|
||||
let notifyType = MESSAGE_TYPE.INFO;
|
||||
let notifyText = gettext('Not started');
|
||||
|
||||
const process_state = pgAdmin.Browser.BgProcessManager.evaluateProcessState({
|
||||
let process_state = pgAdmin.Browser.BgProcessManager.evaluateProcessState({
|
||||
...data,
|
||||
exit_code: exitCode,
|
||||
});
|
||||
|
||||
if(process_state == BgProcessManagerProcessState.PROCESS_STARTED && stopping) {
|
||||
process_state = BgProcessManagerProcessState.PROCESS_TERMINATING;
|
||||
}
|
||||
if(process_state == BgProcessManagerProcessState.PROCESS_FAILED && stopping) {
|
||||
process_state = BgProcessManagerProcessState.PROCESS_TERMINATED;
|
||||
}
|
||||
|
||||
if(process_state == BgProcessManagerProcessState.PROCESS_STARTED) {
|
||||
notifyText = gettext('Running...');
|
||||
} else if(process_state == BgProcessManagerProcessState.PROCESS_FINISHED) {
|
||||
@@ -133,6 +141,11 @@ export default function ProcessDetails({data}) {
|
||||
|
||||
}, completed ? -1 : 1000);
|
||||
|
||||
const onStopProcess = ()=>{
|
||||
setStopping(true);
|
||||
pgAdmin.Browser.BgProcessManager.stopProcess(data.id);
|
||||
};
|
||||
|
||||
const errRe = new RegExp(': (' + gettext('error') + '|' + gettext('fatal') + '):', 'i');
|
||||
return (
|
||||
<Box display="flex" flexDirection="column" className={classes.container} data-test="process-details">
|
||||
@@ -153,7 +166,10 @@ export default function ProcessDetails({data}) {
|
||||
pgAdmin.Tools.FileManager.openStorageManager(data.current_storage_dir);
|
||||
}} style={{marginRight: '4px'}} />}
|
||||
<DefaultButton disabled={process_state != BgProcessManagerProcessState.PROCESS_STARTED || data.server_id != null}
|
||||
startIcon={<HighlightOffRoundedIcon />} className={classes.terminateBtn}>Stop Process</DefaultButton></Box>
|
||||
startIcon={<HighlightOffRoundedIcon />} className={classes.terminateBtn} onClick={onStopProcess}>
|
||||
Stop Process
|
||||
</DefaultButton>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box flexGrow={1} className={classes.logs}>
|
||||
{logs == null && <span data-test="loading-logs">{gettext('Loading process logs...')}</span>}
|
||||
|
||||
@@ -218,7 +218,7 @@ export default function Processes() {
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: gettext('Time Taken'),
|
||||
Header: gettext('Time Taken (sec)'),
|
||||
accessor: 'execution_time',
|
||||
sortable: true,
|
||||
resizable: true,
|
||||
|
||||
Reference in New Issue
Block a user