From e61e475092b38c012adf26e39c8e990cbd3f9ecf Mon Sep 17 00:00:00 2001 From: John Duprey Date: Mon, 22 Apr 2024 12:24:54 -0400 Subject: [PATCH] CippActionsOffcanvas updates - Add dismissable callout to code block - Add progress bar to cards - Update queue to include progress percentage --- src/components/layout/AppHeader.jsx | 5 +++- .../utilities/CippActionsOffcanvas.jsx | 25 ++++++++++++++++++- src/components/utilities/CippCodeBlock.jsx | 11 +++++++- src/components/utilities/CippOffcanvas.jsx | 6 ++--- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/components/layout/AppHeader.jsx b/src/components/layout/AppHeader.jsx index 43ec9c476d35..85fe747dd98f 100644 --- a/src/components/layout/AppHeader.jsx +++ b/src/components/layout/AppHeader.jsx @@ -94,11 +94,13 @@ const AppHeader = () => { value: job.Status, link: job.Link, timestamp: job.Timestamp, + percent: job.PercentComplete, + progressText: `${job.PercentComplete}%`, })), ) } else { setCippQueueExtendedInfo([ - { label: 'No jobs to display', value: '', timpestamp: Date(), link: '#' }, + { label: 'No jobs to display', value: '', timestamp: Date(), link: '#' }, ]) } }, [cippQueueList]) @@ -197,6 +199,7 @@ const AppHeader = () => { extendedInfo={[]} cards={cippQueueExtendedInfo} refreshFunction={refreshCippQueue} + isRefreshing={cippQueueList.isFetching || cippQueueList.isLoading} actions={[ { label: 'Clear History', diff --git a/src/components/utilities/CippActionsOffcanvas.jsx b/src/components/utilities/CippActionsOffcanvas.jsx index c2cab6d24539..dc9567479ab5 100644 --- a/src/components/utilities/CippActionsOffcanvas.jsx +++ b/src/components/utilities/CippActionsOffcanvas.jsx @@ -5,14 +5,20 @@ import { CCallout, CCard, CCardBody, + CCardFooter, CCardHeader, CCardText, CCardTitle, + CCol, CFormInput, CFormSelect, CListGroup, CListGroupItem, COffcanvasTitle, + CProgress, + CProgressBar, + CProgressStacked, + CRow, CSpinner, } from '@coreui/react' import { CippCodeBlock, CippOffcanvas, ModalService } from 'src/components/utilities' @@ -222,8 +228,23 @@ export default function CippActionsOffcanvas(props) { {action.value && Status: {action.value}} - {action.timestamp && } + + + {action.percent && ( + +
+ + {action?.progressText} + +
+
+ )} + + {action.timestamp && } + +
+
)) @@ -295,6 +316,7 @@ export default function CippActionsOffcanvas(props) { id={props.id} hideFunction={props.hideFunction} refreshFunction={props.refreshFunction} + isRefreshing={props.isRefreshing} > {getResults.isFetching && ( @@ -310,6 +332,7 @@ export default function CippActionsOffcanvas(props) { )} diff --git a/src/components/utilities/CippCodeBlock.jsx b/src/components/utilities/CippCodeBlock.jsx index aad81e02d78d..00ccd3c54f7c 100644 --- a/src/components/utilities/CippCodeBlock.jsx +++ b/src/components/utilities/CippCodeBlock.jsx @@ -16,6 +16,7 @@ function CippCodeBlock({ callout = false, calloutColour = 'info', calloutCopyValue = false, + dismissable = false, }) { const [codeCopied, setCodeCopied] = useState(false) @@ -36,7 +37,11 @@ function CippCodeBlock({ {codeCopied ? : } - {callout && {code}} + {callout && ( + + {code} + + )} {!callout && ( { - //console.log('refresh') props.refreshFunction() }} > - + {props.isRefreshing ? : } )} @@ -48,6 +47,7 @@ export const CippOffcanvasPropTypes = { id: PropTypes.string, hideFunction: PropTypes.func.isRequired, refreshFunction: PropTypes.func, + isRefreshing: PropTypes.bool, addedClass: PropTypes.string, }