diff --git a/public/version_latest.txt b/public/version_latest.txt index 0c89fc927e32..cc868b62c301 100644 --- a/public/version_latest.txt +++ b/public/version_latest.txt @@ -1 +1 @@ -4.0.0 \ No newline at end of file +4.0.1 \ No newline at end of file diff --git a/src/views/tenant/standards/BestPracticeAnalyser.js b/src/views/tenant/standards/BestPracticeAnalyser.js index f12b3b9d1e90..68356121e425 100644 --- a/src/views/tenant/standards/BestPracticeAnalyser.js +++ b/src/views/tenant/standards/BestPracticeAnalyser.js @@ -14,6 +14,7 @@ import { CSpinner, } from '@coreui/react' import useQuery from 'src/hooks/useQuery' +import PropTypes from 'prop-types' import { Field, Form, FormSpy } from 'react-final-form' import { RFFCFormInput, RFFCFormSelect } from 'src/components/forms' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' @@ -25,6 +26,7 @@ import { faCheck, faCross, faTimes, + faSync, faExclamation, } from '@fortawesome/free-solid-svg-icons' import { CippTable, cellBooleanFormatter } from 'src/components/tables' @@ -38,10 +40,15 @@ import { CellTip, cellGenericFormatter } from 'src/components/tables/CellGeneric import { useExecBestPracticeAnalyserMutation } from 'src/store/api/reports' import { ModalService } from 'src/components/utilities' import { cellTableFormatter } from 'src/components/tables/CellTable' -const RefreshAction = () => { - const [execBestPracticeAnalyser, { isLoading, isSuccess, error }] = - useExecBestPracticeAnalyserMutation() +const RefreshAction = ({ singleTenant = false, refreshFunction = null }) => { + const tenantDomain = useSelector((state) => state.app.currentTenant.defaultDomainName) + const [execBestPracticeAnalyser, { isLoading, isSuccess, error }] = + useLazyGenericGetRequestQuery() + var params = {} + if (singleTenant) { + params['TenantFilter'] = tenantDomain + } const showModal = () => ModalService.confirm({ body: ( @@ -51,18 +58,39 @@ const RefreshAction = () => { Please note: this runs at 3:00 AM UTC automatically every day. ), - onConfirm: () => execBestPracticeAnalyser(), + onConfirm: () => + execBestPracticeAnalyser({ + path: 'api/BestPracticeAnalyser_OrchestrationStarter', + params: params, + }), }) return ( - - {isLoading && } - {error && } - {isSuccess && } - Force Refresh All Data - + <> + + {isLoading && } + {error && } + {isSuccess && } + {(singleTenant && 'Refresh Tenant Data') || 'Force Refresh All Data'} + + {refreshFunction !== null && ( + { + refreshFunction((Math.random() + 1).toString(36).substring(7)) + }} + className="m-1" + size="sm" + > + + + )} + ) } +RefreshAction.propTypes = { + singleTenant: PropTypes.bool, + refreshFunction: PropTypes.func, +} const getsubcolumns = (data) => { const flatObj = data && data.length > 0 ? data : [{ data: 'No Data Found' }] @@ -96,6 +124,7 @@ const getNestedValue = (obj, path) => { } const BestPracticeAnalyser = () => { const [reportTemplate, setReportTemplate] = useState('CIPP Best Practices v1.0 - Table view') + const [refreshValue, setRefreshValue] = useState('') const { data: templates = [], isLoading: templatesfetch } = useGenericGetRequestQuery({ path: 'api/listBPATemplates', }) @@ -184,9 +213,10 @@ const BestPracticeAnalyser = () => { tenantFilter: tenant.customerId, Report: reportTemplate, SearchNow: SearchNow, + refresh: refreshValue, }, }) - }, [Report, execGraphRequest, tenant.defaultDomainName, query]) + }, [Report, execGraphRequest, tenant.defaultDomainName, query, refreshValue, reportTemplate]) return ( <> @@ -264,7 +294,12 @@ const BestPracticeAnalyser = () => { data={graphrequest.data.Data} isFetching={graphrequest.isFetching} tableProps={{ - actions: [], + actions: [ + , + ], }} /> @@ -273,6 +308,13 @@ const BestPracticeAnalyser = () => { {graphrequest.isSuccess && QueryColumns.set && graphrequest.data.Style == 'Tenant' && ( <> +
+ +
{graphrequest.data.Columns.map((info, idx) => ( diff --git a/version_latest.txt b/version_latest.txt index 0c89fc927e32..cc868b62c301 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.0.0 \ No newline at end of file +4.0.1 \ No newline at end of file