1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-11 03:34:35 +00:00

fix(web): disable launch icon button when file content is not saved

This commit is contained in:
2022-07-27 01:42:46 +05:00
parent 468d1a929d
commit c574b42235

View File

@@ -357,6 +357,8 @@ const SASjsEditor = ({
> >
<Box sx={{ display: 'flex', justifyContent: 'center' }}> <Box sx={{ display: 'flex', justifyContent: 'center' }}>
<RunMenu <RunMenu
fileContent={fileContent}
prevFileContent={prevFileContent}
selectedFilePath={selectedFilePath} selectedFilePath={selectedFilePath}
selectedRunTime={selectedRunTime} selectedRunTime={selectedRunTime}
runTimes={runTimes} runTimes={runTimes}
@@ -456,6 +458,8 @@ export default SASjsEditor
type RunMenuProps = { type RunMenuProps = {
selectedFilePath: string selectedFilePath: string
fileContent: string
prevFileContent: string
selectedRunTime: string selectedRunTime: string
runTimes: string[] runTimes: string[]
handleChangeRunTime: (event: SelectChangeEvent) => void handleChangeRunTime: (event: SelectChangeEvent) => void
@@ -464,6 +468,8 @@ type RunMenuProps = {
const RunMenu = ({ const RunMenu = ({
selectedFilePath, selectedFilePath,
fileContent,
prevFileContent,
selectedRunTime, selectedRunTime,
runTimes, runTimes,
handleChangeRunTime, handleChangeRunTime,
@@ -496,10 +502,21 @@ const RunMenu = ({
</Tooltip> </Tooltip>
{selectedFilePath ? ( {selectedFilePath ? (
<Box sx={{ marginLeft: '10px' }}> <Box sx={{ marginLeft: '10px' }}>
<Tooltip title="Launch program in new window"> <Tooltip
<IconButton onClick={launchProgram}> title={
<RocketLaunch /> fileContent !== prevFileContent
</IconButton> ? 'Save file before launching program'
: 'Launch program in new window'
}
>
<span>
<IconButton
disabled={fileContent !== prevFileContent}
onClick={launchProgram}
>
<RocketLaunch />
</IconButton>
</span>
</Tooltip> </Tooltip>
</Box> </Box>
) : ( ) : (