Skip to content

Commit

Permalink
Merge pull request #36 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
kris6673 authored May 10, 2024
2 parents cb57570 + d214ad3 commit 720fe23
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 82 deletions.
51 changes: 49 additions & 2 deletions src/components/forms/RFFComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ export const RFFCFormSwitch = ({
>
<div className={className}>
<CFormSwitch
{...input}
onChange={input.onChange}
checked={input.checked}
value={input.value}
// @todo revisit this, only shows green when checked
valid={!meta.error && meta.touched && validate}
invalid={meta.error && meta.touched && validate}
Expand Down Expand Up @@ -265,7 +267,9 @@ export const RFFCFormRadio = ({
{({ meta, input }) => (
<div className={className}>
<CFormCheck
{...input}
onChange={input.onChange}
checked={input.checked}
value={input.value}
valid={!meta.error && meta.touched}
invalid={meta.error && meta.touched}
disabled={disabled}
Expand All @@ -285,6 +289,49 @@ RFFCFormRadio.propTypes = {
...sharedPropTypes,
}

export const RFFCFormRadioList = ({
name,
options,
className = 'mb-3',
disabled = false,
onClick,
inline = false,
}) => {
return (
<>
<div className={className}>
{options?.map((option, key) => {
return (
<Field name={name} type="radio" value={option.value} key={key}>
{({ input }) => {
return (
<>
<CFormCheck
name={input.name}
checked={input.checked}
onChange={input.onChange}
type="radio"
{...option}
disabled={disabled}
onClick={onClick}
inline={inline}
/>
</>
)
}}
</Field>
)
})}
</div>
</>
)
}

RFFCFormRadioList.propTypes = {
...sharedPropTypes,
inline: PropTypes.bool,
}

export const RFFCFormTextarea = ({
name,
label,
Expand Down
2 changes: 2 additions & 0 deletions src/components/forms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
RFFCFormSwitch,
RFFCFormInput,
RFFCFormRadio,
RFFCFormRadioList,
RFFCFormTextarea,
RFFCFormSelect,
RFFSelectSearch,
Expand All @@ -18,6 +19,7 @@ export {
RFFCFormSwitch,
RFFCFormInput,
RFFCFormRadio,
RFFCFormRadioList,
RFFCFormTextarea,
RFFCFormSelect,
RFFSelectSearch,
Expand Down
41 changes: 26 additions & 15 deletions src/views/tenant/administration/SecureScore.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,20 @@ const SecureScore = () => {
title="Compared Score (Similiar sized business)"
percentage={
//calculate percentage, round to 1 dec.
Math.round(
(translateData?.averageComparativeScores[1]?.averageScore /
translateData?.maxScore) *
100 *
10,
) / 10
translateData?.averageComparativeScores
? Math.round(
(translateData?.averageComparativeScores[1]?.averageScore /
translateData?.maxScore) *
100 *
10,
) / 10
: 0
}
topLabel={
translateData?.averageComparativeScores
? translateData?.averageComparativeScores[1]?.averageScore
: 0
}
topLabel={translateData?.averageComparativeScores[1]?.averageScore}
smallLabel={`of ${translateData?.maxScore} points`}
isFetching={isFetching}
/>
Expand All @@ -252,15 +258,20 @@ const SecureScore = () => {
<CippPrettyCard
title="Compared Score (Similiar sized business)"
percentage={
//calculate percentage, round to 1 dec.
Math.round(
(translateData?.averageComparativeScores[0]?.averageScore /
translateData?.maxScore) *
100 *
10,
) / 10
translateData?.averageComparativeScores
? Math.round(
(translateData?.averageComparativeScores[0]?.averageScore /
translateData?.maxScore) *
100 *
10,
) / 10
: 0
}
topLabel={
translateData?.averageComparativeScores
? translateData?.averageComparativeScores[0]?.averageScore
: 0
}
topLabel={translateData?.averageComparativeScores[0]?.averageScore}
smallLabel={`of ${translateData?.maxScore} points`}
isFetching={isFetching}
/>
Expand Down
127 changes: 62 additions & 65 deletions src/views/tenant/standards/ListAppliedStandards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const ApplyNewStandard = () => {
genericPostRequest({
path: '/api/AddStandardsDeploy',
values: { ...values.standards, tenant: tenantDomain },
})
}).then(() => refetchStandards())
}
const [intuneGetRequest, intuneTemplates] = useLazyGenericGetRequestQuery()
const [transportGetRequest, transportTemplates] = useLazyGenericGetRequestQuery()
Expand Down Expand Up @@ -368,6 +368,66 @@ const ApplyNewStandard = () => {
{getResults.error.message}
</CippCallout>
)}
<CRow>
<CCol md={4}>
<CWidgetStatsB
className="mb-3"
progress={{
color: 'info',
value:
totalAvailableStandards > 0
? Math.round((enabledWarningsCount / totalAvailableStandards) * 1000) / 10
: 0,
}}
text={
listStandardResults.length > 0 && listStandardResults[0].appliedBy
? `Created by ${listStandardResults[0].appliedBy}`
: 'None'
}
title={`${enabledWarningsCount} out of ${totalAvailableStandards}`}
value="Enabled Warnings"
/>
</CCol>
<CCol md={4}>
<CWidgetStatsB
className="mb-3"
progress={{
color: 'info',
value:
totalAvailableStandards > 0
? Math.round((enabledAlertsCount / totalAvailableStandards) * 1000) / 10
: 0,
}}
text={
listStandardResults.length > 0 && listStandardResults[0].appliedBy
? `Created by ${listStandardResults[0].appliedBy}`
: 'None'
}
title={`${enabledAlertsCount} out of ${totalAvailableStandards}`}
value="Enabled Alerts"
/>
</CCol>
<CCol md={4}>
<CWidgetStatsB
className="mb-3"
progress={{
color: 'info',
value:
totalAvailableStandards > 0
? Math.round((enabledRemediationsCount / totalAvailableStandards) * 1000) /
10
: 0,
}}
text={
listStandardResults.length > 0 && listStandardResults[0].appliedBy
? `Created by ${listStandardResults[0].appliedBy}`
: 'None'
}
title={`${enabledRemediationsCount} out of ${totalAvailableStandards}`}
value="Enabled Remediations"
/>
</CCol>
</CRow>
<CippContentCard
button={
<>
Expand All @@ -376,7 +436,7 @@ const ApplyNewStandard = () => {
}
title={`List and edit standard - ${tenantDomain}`}
>
{isFetching && <Skeleton count={20} />}
{isFetching && <Skeleton count={1} />}
{intuneTemplates.isUninitialized &&
intuneGetRequest({ path: 'api/ListIntuneTemplates' })}
{transportTemplates.isUninitialized &&
Expand All @@ -400,69 +460,6 @@ const ApplyNewStandard = () => {
return (
<CForm onSubmit={handleSubmit}>
<CRow className="mb-3">
<CCol md={4}>
<CWidgetStatsB
className="mb-3"
progress={{
color: 'info',
value:
totalAvailableStandards > 0
? Math.round(
(enabledWarningsCount / totalAvailableStandards) * 1000,
) / 10
: 0,
}}
text={
listStandardResults[0].appliedBy
? `Created by ${listStandardResults[0].appliedBy}`
: 'None'
}
title={`${enabledWarningsCount} out of ${totalAvailableStandards}`}
value="Enabled Warnings"
/>
</CCol>
<CCol md={4}>
<CWidgetStatsB
className="mb-3"
progress={{
color: 'info',
value:
totalAvailableStandards > 0
? Math.round(
(enabledAlertsCount / totalAvailableStandards) * 1000,
) / 10
: 0,
}}
text={
listStandardResults[0].appliedBy
? `Created by ${listStandardResults[0].appliedBy}`
: 'None'
}
title={`${enabledAlertsCount} out of ${totalAvailableStandards}`}
value="Enabled Alerts"
/>
</CCol>
<CCol md={4}>
<CWidgetStatsB
className="mb-3"
progress={{
color: 'info',
value:
totalAvailableStandards > 0
? Math.round(
(enabledRemediationsCount / totalAvailableStandards) * 1000,
) / 10
: 0,
}}
text={
listStandardResults[0].appliedBy
? `Created by ${listStandardResults[0].appliedBy}`
: 'None'
}
title={`${enabledRemediationsCount} out of ${totalAvailableStandards}`}
value="Enabled Remediations"
/>
</CCol>
<CAccordion
alwaysOpen
activeItemKey={
Expand Down

0 comments on commit 720fe23

Please sign in to comment.