diff --git a/frontend/components/icons/FilterFunnel.tsx b/frontend/components/icons/FilterFunnel.tsx index f24d06c8c3..a1a273ea0c 100644 --- a/frontend/components/icons/FilterFunnel.tsx +++ b/frontend/components/icons/FilterFunnel.tsx @@ -11,7 +11,6 @@ const FilterFunnel = ({ size = "medium", color = "ui-fleet-black-33", }: IFilterFunnelProps) => { - console.log("color", color); return ( { + // Show count if there is no errors AND there are policy results or a search filter + const showCount = + count !== undefined && + !policiesErrors && + (policyResults || searchQuery !== ""); + return (
- {count !== undefined && ( + {showCount && ( {`${count} polic${count === 1 ? "y" : "ies"}`} )}
); }; - return !isRouteOk || (isPremiumTier && !userTeams) ? ( - - ) : ( + const renderMainTable = () => { + return !isRouteOk || (isPremiumTier && !userTeams) ? ( + + ) : ( +
+ {isAnyTeamSelected && teamPoliciesError && } + {isAnyTeamSelected && !teamPoliciesError && ( + + !isFetchingTeamCount && renderPoliciesCount(teamPoliciesCount) + } + isPremiumTier={isPremiumTier} + isSandboxMode={isSandboxMode} + searchQuery={searchQuery} + sortHeader={sortHeader} + sortDirection={sortDirection} + page={page} + onQueryChange={onQueryChange} + /> + )} + {!isAnyTeamSelected && globalPoliciesError && } + {!isAnyTeamSelected && !globalPoliciesError && ( + + !isFetchingGlobalCount && renderPoliciesCount(globalPoliciesCount) + } + searchQuery={searchQuery} + sortHeader={sortHeader} + sortDirection={sortDirection} + page={page} + onQueryChange={onQueryChange} + /> + )} +
+ ); + }; + + return (
@@ -647,30 +712,31 @@ const ManagePolicyPage = ({
{showCtaButtons && (
- {canManageAutomations && - automationsConfig && - !isFetchingGlobalPolicies && ( + {canManageAutomations && automationsConfig && ( + + )} + {canAddOrDeletePolicy && ( +
- )} - {canAddOrDeletePolicy && - ((isAnyTeamSelected && !isFetchingTeamPolicies) || - !isFetchingGlobalPolicies) && ( -
- -
- )} +
+ )}
)}
@@ -687,65 +753,7 @@ const ManagePolicyPage = ({

)} -
- {isAnyTeamSelected && teamPoliciesError && } - {isAnyTeamSelected && - !teamPoliciesError && - (isFetchingTeamPolicies ? ( - - ) : ( - - !isFetchingTeamCount && renderPoliciesCount(teamPoliciesCount) - } - isPremiumTier={isPremiumTier} - isSandboxMode={isSandboxMode} - searchQuery={searchQuery} - sortHeader={sortHeader} - sortDirection={sortDirection} - page={page} - onQueryChange={onQueryChange} - /> - ))} - {!isAnyTeamSelected && globalPoliciesError && } - {!isAnyTeamSelected && - !globalPoliciesError && - (isFetchingGlobalPolicies ? ( - - ) : ( - - !isFetchingGlobalCount && - renderPoliciesCount(globalPoliciesCount) - } - searchQuery={searchQuery} - sortHeader={sortHeader} - sortDirection={sortDirection} - page={page} - onQueryChange={onQueryChange} - /> - ))} -
+ {renderMainTable()} {showInheritedPoliciesButton && globalPoliciesCount && ( {globalPoliciesError && } - {!globalPoliciesError && - (isFetchingGlobalPolicies ? ( - - ) : ( - - renderPoliciesCount(teamPoliciesCount) - } - sortHeader={inheritedSortHeader} - sortDirection={inheritedSortDirection} - page={inheritedPage} - onQueryChange={onQueryChange} - /> - ))} + {!globalPoliciesError && ( + + renderPoliciesCount(teamPoliciesCount) + } + sortHeader={inheritedSortHeader} + sortDirection={inheritedSortDirection} + page={inheritedPage} + onQueryChange={onQueryChange} + /> + )} )} {config && automationsConfig && showManageAutomationsModal && ( diff --git a/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx b/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx index f6e850a577..83d1f30fda 100644 --- a/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx +++ b/frontend/pages/policies/ManagePoliciesPage/components/PoliciesTable/PoliciesTable.tsx @@ -137,60 +137,51 @@ const PoliciesTable = ({ canAddOrDeletePolicy ? "" : "hide-selection-column" }`} > - {isLoading ? ( - - ) : ( - - EmptyTable({ - iconName: emptyState().iconName, - header: emptyState().header, - info: emptyState().info, - additionalInfo: emptyState().additionalInfo, - primaryButton: emptyState().primaryButton, - }) - } - disableCount={tableType === "inheritedPolicies"} - renderCount={renderPoliciesCount} - // isClientSidePagination - // onClientSidePaginationChange={onClientSidePaginationChange} - // isClientSideFilter - // searchQueryColumn="name" - onQueryChange={onTableQueryChange} - inputPlaceHolder="Search by name" - searchable={searchable} - /> - )} + + EmptyTable({ + iconName: emptyState().iconName, + header: emptyState().header, + info: emptyState().info, + additionalInfo: emptyState().additionalInfo, + primaryButton: emptyState().primaryButton, + }) + } + disableCount={tableType === "inheritedPolicies"} + renderCount={renderPoliciesCount} + onQueryChange={onTableQueryChange} + inputPlaceHolder="Search by name" + searchable={searchable} + /> ); }; diff --git a/frontend/pages/software/ManageSoftwarePage/ManageSoftwarePage.tsx b/frontend/pages/software/ManageSoftwarePage/ManageSoftwarePage.tsx index 9cbe20a177..ee01fbf49f 100644 --- a/frontend/pages/software/ManageSoftwarePage/ManageSoftwarePage.tsx +++ b/frontend/pages/software/ManageSoftwarePage/ManageSoftwarePage.tsx @@ -615,14 +615,6 @@ const ManageSoftwarePage = ({ queryParams.vulnerable === "true"); const renderSoftwareTable = () => { - if ( - isFetchingCount || - isFetchingSoftware || - !globalConfig || - (!softwareConfig && !softwareConfigError) - ) { - return ; - } if ( (softwareError && !isFetchingSoftware) || (softwareConfigError && !isFetchingSoftwareConfig) @@ -633,7 +625,12 @@ const ManageSoftwarePage = ({ (