|  |  |  | 
|---|
|  |  |  | useRedirect, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_WAVE_AUTO_EXCE } from '@/config/setting'; | 
|---|
|  |  |  | import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined'; | 
|---|
|  |  |  | import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | 
|---|
|  |  |  | const [detailDialog, setDetailDialog] = useState(false); | 
|---|
|  |  |  | const [select, setSelectIds] = useState({}); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | useEffect(() => { | 
|---|
|  |  |  | getConfig() | 
|---|
|  |  |  | }, []) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const getConfig = async () => { | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.get('/config/flag/' + DEFAULT_WAVE_AUTO_EXCE); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | setAutoExce(JSON.parse(data?.val)) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BulkStartButton = ({ autoExce, setAutoExce }) => { | 
|---|
|  |  |  | const { data, selectedIds, onUnselectItems } = useListContext(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const startClick = () => { | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const startClick = async () => { | 
|---|
|  |  |  | onUnselectItems() | 
|---|
|  |  |  | setAutoExce(true) | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: true, flag: 'WaveAutoExce' }); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | !autoExce ? <Button label="toolbar.start" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} /> : <></> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BulkPauseButton = ({ autoExce, setAutoExce }) => { | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const { data, selectedIds, onUnselectItems } = useListContext(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const pauseClick = () => { | 
|---|
|  |  |  | const pauseClick = async () => { | 
|---|
|  |  |  | onUnselectItems() | 
|---|
|  |  |  | setAutoExce(false) | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: false, flag: 'WaveAutoExce' }); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | setAutoExce(false) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | autoExce ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} /> : <></> | 
|---|