Skip to content

Commit

Permalink
Apply Filter button and dashboard pending request count fix.
Browse files Browse the repository at this point in the history
Signed-off-by: sudeep <[email protected]>
  • Loading branch information
Sudeep7353 committed Dec 11, 2024
1 parent 795df17 commit 906e631
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function AdminApiKeysList () {
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
Expand Down Expand Up @@ -117,13 +116,16 @@ function AdminApiKeysList () {
}

useEffect(() => {
fetchApiKeysListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

if (isApplyFilterClicked || initialRender) {
useEffect(() => {

if (isApplyFilterClicked) {
fetchApiKeysListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (updatedfilters) => {
onClickApplyFilter(updatedfilters, setApplyFilter, setResetPageNo, setFetchData, setFilterAttributes, setIsApplyFilterClicked);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function AdminOidcClientsList () {
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showClientIdPopup, setShowClientIdPopup] = useState(false);
const [currentClient, setCurrentClient] = useState(null);
Expand Down Expand Up @@ -126,13 +125,16 @@ function AdminOidcClientsList () {
}

useEffect(() => {
fetchOidcClientsListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

if (isApplyFilterClicked || initialRender) {
useEffect(() => {

if (isApplyFilterClicked) {
fetchOidcClientsListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (updatedfilters) => {
onClickApplyFilter(updatedfilters, setApplyFilter, setResetPageNo, setFetchData, setFilterAttributes, setIsApplyFilterClicked);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function AdminDevicesList() {
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showDeviceDetailApproveRejectPopup, setShowDeviceDetailApproveRejectPopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
Expand Down Expand Up @@ -130,13 +129,16 @@ function AdminDevicesList() {
}

useEffect(() => {

if (isApplyFilterClicked || initialRender) {
fetchDeviceDetails();
}, [sortFieldName, sortType, pageNo, pageSize]);

useEffect(() => {

if (isApplyFilterClicked) {
fetchDeviceDetails();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (filters) => {
onClickApplyFilter(filters, setApplyFilter, setResetPageNo, setFetchData, setFilterAttributes, setIsApplyFilterClicked);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function AdminSbiList() {
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
Expand Down Expand Up @@ -120,13 +119,16 @@ function AdminSbiList() {
}

useEffect(() => {

if (isApplyFilterClicked || initialRender) {
fetchSbiListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

useEffect(() => {

if (isApplyFilterClicked) {
fetchSbiListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (updatedfilters) => {
onClickApplyFilter(updatedfilters, setApplyFilter, setResetPageNo, setFetchData, setFilterAttributes, setIsApplyFilterClicked);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function AdminFtmList() {
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showFtmApproveRejectPopup, setShowFtmApproveRejectPopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
Expand Down Expand Up @@ -115,13 +114,16 @@ function AdminFtmList() {
}

useEffect(() => {
fetchFtmListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

if (isApplyFilterClicked || initialRender) {
useEffect(() => {

if (isApplyFilterClicked) {
fetchFtmListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (filters) => {
onClickApplyFilter(filters, setApplyFilter, setResetPageNo, setFetchData, setFilterAttributes, setIsApplyFilterClicked);
Expand Down
16 changes: 9 additions & 7 deletions pmp-revamp-ui/src/pages/admin/partners/PartnersList.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function PartnersList() {
const [tableDataLoaded, setTableDataLoaded] = useState(true);
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [isFilterApplied, setIsFilterApplied ] = useState(false);
const [resetPageNo, setResetPageNo] = useState(false);
Expand Down Expand Up @@ -128,13 +127,16 @@ function PartnersList() {
}

useEffect(() => {

if (isApplyFilterClicked || initialRender) {
fetchPartnersData();
setInitialRender(false);
setIsApplyFilterClicked(false);
fetchPartnersData();
}, [sortFieldName, sortType, pageNo, pageSize]);

useEffect(() => {

if (isApplyFilterClicked) {
fetchPartnersData();
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (filters) => {
onClickApplyFilter(filters, setIsFilterApplied, setResetPageNo, setTriggerServerMethod, setFilters, setIsApplyFilterClicked);
Expand Down
10 changes: 6 additions & 4 deletions pmp-revamp-ui/src/pages/admin/policyManager/PoliciesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [deactivatePolicyHeader, setDeactivatePolicyHeader] = useState();
Expand Down Expand Up @@ -133,13 +132,16 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
}

useEffect(() => {
fetchPoliciesListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

if (isApplyFilterClicked || initialRender) {
useEffect(() => {

if (isApplyFilterClicked) {
fetchPoliciesListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (updatedfilters) => {
onClickApplyFilter(updatedfilters, setApplyFilter, setResetPageNo, setFetchData, setFilterAttributes, setIsApplyFilterClicked);
Expand Down
10 changes: 6 additions & 4 deletions pmp-revamp-ui/src/pages/admin/policyManager/PolicyGroupList.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function PolicyGroupList() {
const [totalRecords, setTotalRecords] = useState(0);
const [resetPageNo, setResetPageNo] = useState(false);
const [applyFilter, setApplyFilter] = useState(false);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [filterAttributes, setFilterAttributes] = useState({
id: null,
Expand Down Expand Up @@ -116,13 +115,16 @@ function PolicyGroupList() {
}

useEffect(() => {
fetchPolicyGroupListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

if (isApplyFilterClicked || initialRender) {
useEffect(() => {

if (isApplyFilterClicked) {
fetchPolicyGroupListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const getFiltersRequest = () => {
let filtersArr = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function PolicyRequestsList() {
const [triggerServerMethod, setTriggerServerMethod] = useState(false);
const [totalRecords, setTotalRecords] = useState(0);
const [tableDataLoaded, setTableDataLoaded] = useState(true);
const [initialRender, setInitialRender] = useState(true);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [isFilterApplied, setIsFilterApplied] = useState(false);
const [showPopup, setShowPopup] = useState(false);
Expand Down Expand Up @@ -128,13 +127,16 @@ function PolicyRequestsList() {
}

useEffect(() => {
fetchPolicyRequestsListData();
}, [sortFieldName, sortType, pageNo, pageSize]);

if (isApplyFilterClicked || initialRender) {
useEffect(() => {

if (isApplyFilterClicked) {
fetchPolicyRequestsListData();
setInitialRender(false);
setIsApplyFilterClicked(false);
}
}, [sortFieldName, sortType, pageNo, pageSize, isApplyFilterClicked]);
}, [isApplyFilterClicked]);

const onApplyFilter = (filters) => {
onClickApplyFilter(filters, setIsFilterApplied, setResetPageNo, setTriggerServerMethod, setFilters, setIsApplyFilterClicked);
Expand Down
4 changes: 2 additions & 2 deletions pmp-revamp-ui/src/pages/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ function Dashboard() {
<div className="absolute flex items-center -top-3 -right-3 min-w-fit w-10 h-8 bg-[#FEF1C6] rounded-md text-[#6D1C00] text-sm shadow-md">
<div className="relative group flex items-center justify-center w-full">
<span className="font-medium p-2 rounded">
{count ? count : <LoadingCount />}
{count ?? <LoadingCount />}
</span>

{count && (
{count !== null && count !== undefined && (
<div className="absolute hidden group-hover:block bg-[#FEF1C6] text-xs font-semibold p-2 w-40 mt-1 z-10 top-9 right-0 rounded-md shadow-md">
{t(descriptionKey, descriptionParams)}
</div>
Expand Down

0 comments on commit 906e631

Please sign in to comment.