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:
@@ -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>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user