Device User UI: Update policy banners (#6825)

This commit is contained in:
RachelElysia 2022-07-22 12:15:23 -04:00 committed by GitHub
parent 406004894a
commit acdf46314e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View file

@ -0,0 +1 @@
* Update failing policy banner to include CTA for device user, hide no response banner from device user

View file

@ -560,7 +560,14 @@ const HostDetailsPage = ({
<Tab>Details</Tab>
<Tab>Software</Tab>
<Tab>Schedule</Tab>
<Tab>Policies</Tab>
<Tab>
{titleData.issues.failing_policies_count > 0 && (
<span className="count">
{titleData.issues.failing_policies_count}
</span>
)}
Policies
</Tab>
</TabList>
<TabPanel>
<AboutCard

View file

@ -234,6 +234,7 @@
.react-tabs__tab {
padding: 6px 0px 16px 0px;
margin-right: $pad-xxlarge;
display: inline-block;
}
.react-tabs__tab--selected {

View file

@ -5,11 +5,14 @@ import IssueIcon from "../../../../../../../../assets/images/icon-issue-fleet-bl
const baseClass = "policy-failing-count";
const PolicyFailingCount = (policyProps: {
interface IPolicyFailingCountProps {
policyList: IHostPolicy[];
}): JSX.Element | null => {
const { policyList } = policyProps;
deviceUser?: boolean;
}
const PolicyFailingCount = ({
policyList,
deviceUser,
}: IPolicyFailingCountProps): JSX.Element | null => {
const failCount = policyList.reduce((sum, policy) => {
return policy.response === "fail" ? sum + 1 : sum;
}, 0);
@ -24,7 +27,8 @@ const PolicyFailingCount = (policyProps: {
<p>
Click a policy below to see if there are steps you can take to resolve
the issue
{failCount > 1 ? "s" : ""}.
{failCount > 1 ? "s" : ""}.{" "}
{deviceUser && " Once resolved, click “Refetch” above to confirm."}
</p>
</div>
) : null;

View file

@ -61,9 +61,9 @@ const Policies = ({
{policies.length > 0 && (
<>
{failingResponses?.length > 0 && (
<PolicyFailingCount policyList={policies} />
<PolicyFailingCount policyList={policies} deviceUser={deviceUser} />
)}
{noResponses?.length > 0 && (
{noResponses?.length > 0 && !deviceUser && (
<InfoBanner>
<p>
This host is not updating the response for some policies. Check