-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Visual status for jobs * Bulk actions for toggle and run * Flexible jobs datagrid layout * Fix clock style * Fix date rendering on non finished executions
- Loading branch information
Victor Castell
authored
Jan 17, 2021
1 parent
b4e3aab
commit a4dcb94
Showing
20 changed files
with
272 additions
and
136 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'query-string'; |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ code { | |
max-height: 300px; | ||
overflow: auto; | ||
} | ||
|
||
.clock { | ||
width: 100px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as React from 'react'; | ||
import { useState } from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import { | ||
useNotify, | ||
fetchStart, | ||
fetchEnd, | ||
Button, | ||
useUnselectAll, | ||
useRefresh, | ||
} from 'react-admin'; | ||
import { apiUrl } from '../dataProvider'; | ||
import RunIcon from '@material-ui/icons/PlayArrow'; | ||
|
||
const BulkRunButton = ({selectedIds}: any) => { | ||
const dispatch = useDispatch(); | ||
const notify = useNotify(); | ||
const refresh = useRefresh(); | ||
const unselectAll = useUnselectAll(); | ||
const [loading, setLoading] = useState(false); | ||
const runMany = () => { | ||
for(let id of selectedIds) { | ||
setLoading(true); | ||
dispatch(fetchStart()); // start the global loading indicator | ||
fetch(`${apiUrl}/jobs/${id}`, { method: 'POST' }) | ||
.then(() => { | ||
notify('Success running job'); | ||
}) | ||
.catch((e) => { | ||
notify('Error on running job', 'warning') | ||
}) | ||
.finally(() => { | ||
setLoading(false); | ||
refresh(); | ||
dispatch(fetchEnd()); // stop the global loading indicator | ||
}); | ||
} | ||
unselectAll('jobs'); | ||
}; | ||
return ( | ||
<Button | ||
label="Run" | ||
onClick={runMany} | ||
disabled={loading} | ||
> | ||
<RunIcon/> | ||
</Button> | ||
); | ||
}; | ||
|
||
export default BulkRunButton; |
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,51 @@ | ||
import * as React from 'react'; | ||
import { useState } from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import { | ||
useNotify, | ||
fetchStart, | ||
fetchEnd, | ||
Button, | ||
useUnselectAll, | ||
useRefresh, | ||
} from 'react-admin'; | ||
import { apiUrl } from '../dataProvider'; | ||
import RunIcon from '@material-ui/icons/PlayArrow'; | ||
|
||
const BulkToggleButton = ({selectedIds}: any) => { | ||
const dispatch = useDispatch(); | ||
const notify = useNotify(); | ||
const refresh = useRefresh(); | ||
const unselectAll = useUnselectAll(); | ||
const [loading, setLoading] = useState(false); | ||
const toggleMany = () => { | ||
for(let id of selectedIds) { | ||
setLoading(true); | ||
dispatch(fetchStart()); // start the global loading indicator | ||
fetch(`${apiUrl}/jobs/${id}/toggle`, { method: 'POST' }) | ||
.then(() => { | ||
notify('Job toggled'); | ||
}) | ||
.catch((e) => { | ||
notify('Error on job toggle', 'warning') | ||
}) | ||
.finally(() => { | ||
setLoading(false); | ||
refresh(); | ||
dispatch(fetchEnd()); // stop the global loading indicator | ||
}); | ||
} | ||
unselectAll('jobs'); | ||
}; | ||
return ( | ||
<Button | ||
label="Toggle" | ||
onClick={toggleMany} | ||
disabled={loading} | ||
> | ||
<RunIcon/> | ||
</Button> | ||
); | ||
}; | ||
|
||
export default BulkToggleButton; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as React from "react"; | ||
import SuccessIcon from '@material-ui/icons/CheckCircle'; | ||
import FailedIcon from '@material-ui/icons/Cancel'; | ||
|
||
const StatusField = (props: any) => { | ||
return (props.record[props.source] === 'success' ? <SuccessIcon htmlColor="green" /> : <FailedIcon htmlColor="red" />); | ||
}; | ||
|
||
export default StatusField; |
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,13 @@ | ||
import * as React from "react"; | ||
import { DateField, DateFieldProps } from 'react-admin'; | ||
|
||
export const ZeroDateField: React.FC<DateFieldProps> = (props) => { | ||
if (props.record !== undefined && props.source !== undefined) { | ||
if (props.record[props.source] === "0001-01-01T00:00:00Z") { | ||
props.record[props.source] = null; | ||
} | ||
} | ||
return (<DateField {...props}/>); | ||
} | ||
|
||
export default ZeroDateField; |
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
Oops, something went wrong.