-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce 8px padding to .menu-bar for better spacing. Add .menu-bar-…
…filename class to CSS.
- Loading branch information
Showing
4 changed files
with
81 additions
and
15 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
new-log-viewer/src/components/MenuBar/ExportLogsButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import {useContext} from "react"; | ||
|
||
import { | ||
CircularProgress, | ||
Typography, | ||
} from "@mui/joy"; | ||
|
||
import DownloadIcon from "@mui/icons-material/Download"; | ||
|
||
import {StateContext} from "../../contexts/StateContextProvider"; | ||
import { | ||
EXPORT_LOG_PROGRESS_COMPLETE, | ||
EXPORT_LOG_PROGRESS_INITIALIZATION, | ||
} from "../../services/LogExportManager"; | ||
import SmallIconButton from "./SmallIconButton"; | ||
|
||
|
||
/** | ||
* Represents a button for triggering log exports and displays the progress. | ||
* | ||
* @return | ||
*/ | ||
export const ExportLogsButton = () => { | ||
const {exportLogs, exportProgress} = useContext(StateContext); | ||
const handleExportLogsButtonClick = () => { | ||
exportLogs(); | ||
}; | ||
|
||
|
||
return ( | ||
<SmallIconButton | ||
disabled={null !== exportProgress && 1 !== exportProgress} | ||
onClick={handleExportLogsButtonClick} | ||
> | ||
{null === exportProgress || EXPORT_LOG_PROGRESS_INITIALIZATION === exportProgress ? | ||
<DownloadIcon/> : | ||
<CircularProgress | ||
determinate={true} | ||
thickness={3} | ||
value={exportProgress * 100} | ||
variant={"solid"} | ||
color={EXPORT_LOG_PROGRESS_COMPLETE === exportProgress ? | ||
"success" : | ||
"primary"} | ||
> | ||
{EXPORT_LOG_PROGRESS_COMPLETE === exportProgress ? | ||
<DownloadIcon | ||
color={"success"} | ||
sx={{fontSize: "14px"}}/> : | ||
<Typography level={"body-xs"}> | ||
{Math.ceil(exportProgress * 100)} | ||
</Typography>} | ||
</CircularProgress>} | ||
</SmallIconButton> | ||
); | ||
}; | ||
|
||
export default ExportLogsButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters