Skip to content

Commit

Permalink
more standards rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Dec 7, 2023
1 parent 4e99b5b commit dc03cb0
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/views/tenant/standards/ListAppliedStandards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ import GDAPRoles from 'src/data/GDAPRoles'

const RefreshAction = () => {
const [execStandards, execStandardsResults] = useLazyGenericGetRequestQuery()

const showModal = () =>
const tenantDomain = useSelector((state) => state.app.currentTenant.defaultDomainName)
const showModal = (selectedTenant) =>
ModalService.confirm({
body: (
<div>
Are you sure you want to run the standards now? <br />
<i>Please note: this runs every three hours automatically.</i>
</div>
),
onConfirm: () => execStandards({ path: 'api/Standards_OrchestrationStarter' }),
onConfirm: () =>
execStandards({ path: `api/ExecStandardsRun?Tenantfilter=${selectedTenant}` }),
})

return (
Expand All @@ -57,14 +58,24 @@ const RefreshAction = () => {
'Already running. Please wait for the current instance to finish' && (
<div> {execStandardsResults.data?.Results}</div>
)}
<CButton onClick={showModal} size="sm" className="m-1">
{execStandardsResults.isLoading && <CSpinner size="sm" />}
{execStandardsResults.error && (
<FontAwesomeIcon icon={faExclamationTriangle} className="pe-1" />
)}
{execStandardsResults.isSuccess && <FontAwesomeIcon icon={faCheck} className="pe-1" />}
Run Standards Now
</CButton>
<p>
<CButton onClick={() => showModal('AllTenants')} size="sm" className="m-1">
{execStandardsResults.isLoading && <CSpinner size="sm" />}
{execStandardsResults.error && (
<FontAwesomeIcon icon={faExclamationTriangle} className="pe-1" />
)}
{execStandardsResults.isSuccess && <FontAwesomeIcon icon={faCheck} className="me-2" />}
Run Standards Now (All Tenants)
</CButton>
<CButton onClick={() => showModal(tenantDomain)} size="sm" className="m-1">
{execStandardsResults.isLoading && <CSpinner size="sm" />}
{execStandardsResults.error && (
<FontAwesomeIcon icon={faExclamationTriangle} className="pe-1" />
)}
{execStandardsResults.isSuccess && <FontAwesomeIcon icon={faCheck} className="me-2" />}
Run Standards Now (Selected Tenant)
</CButton>
</p>
</>
)
}
Expand Down

0 comments on commit dc03cb0

Please sign in to comment.