Skip to content

Commit

Permalink
feat: Dashbar global filter (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsToNlele authored Apr 22, 2022
1 parent b37591c commit 7e88854
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 611 deletions.
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@redhat-cloud-services/frontend-components-pdf-generator": "2.6.7",
"@redhat-cloud-services/frontend-components-translations": "3.2.3",
"@redhat-cloud-services/frontend-components-utilities": "3.2.8",
"@redhat-cloud-services/vulnerabilities-client": "1.0.106",
"@redhat-cloud-services/vulnerabilities-client": "1.0.107",
"axios": "^0.26.1",
"classnames": "^2.2.5",
"dot": "^1.1.3",
Expand Down
20 changes: 12 additions & 8 deletions src/Components/SmartComponents/Dashbar/Dashbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react';
import { Card, Grid, GridItem, StackItem, Stack, Alert, CardBody, Text } from '@patternfly/react-core';
import { Main } from '@redhat-cloud-services/frontend-components/Main';
import { SecurityIcon } from '@patternfly/react-icons';
import { CVES_ALLOWED_PARAMS, impactList, CVES_DEFAULT_FILTERS } from '../../../Helpers/constants';
import { constructFilterParameters, useUrlParams } from '../../../Helpers/MiscHelper';
import { impactList, CVES_DEFAULT_FILTERS } from '../../../Helpers/constants';
import { constructFilterParameters } from '../../../Helpers/MiscHelper';
import { useDispatch, useSelector } from 'react-redux';
import { changeCveListParameters } from '../../../Store/Actions/Actions';
import { FormattedMessage } from 'react-intl';
Expand Down Expand Up @@ -49,7 +49,7 @@ DashbarItem.propTypes = {
const Dashbar = () => {
const intl = useIntl();
const dispatch = useDispatch();
const [urlParameters] = useUrlParams([CVES_ALLOWED_PARAMS]);
const [isFirstLoad, setFirstLoad] = useState(true);
const [dashbar, setDashbar] = useState({});
const [announcement, setAnnouncement] = useState({});
const [isDashbarLoading, setDashbarLoading] = useState(true);
Expand All @@ -76,16 +76,20 @@ const Dashbar = () => {
};

const fetchDashbar = async () => {
let data = await getDashbar();
let data = await getDashbar(parameters);
setDashbar(data);
setDashbarLoading(false);
};

fetchAnnouncements();
fetchDashbar();
}, []);
if (isFirstLoad) {
setFirstLoad(false);
} else {
fetchAnnouncements();
fetchDashbar();
}
}, [parameters]);

return (urlParameters?.dashbar === 'true' &&
return (
<Main style={{ paddingBottom: 0 }}>
<Stack hasGutter>
<StackItem>
Expand Down
66 changes: 0 additions & 66 deletions src/Components/SmartComponents/Dashbar/Dashbar.test.js

This file was deleted.

Loading

0 comments on commit 7e88854

Please sign in to comment.