diff --git a/__tests__/pages/Processes/ProcessPairs.spec.tsx b/__tests__/pages/Processes/ProcessPairs.spec.tsx index a3c66637..1cd4893f 100644 --- a/__tests__/pages/Processes/ProcessPairs.spec.tsx +++ b/__tests__/pages/Processes/ProcessPairs.spec.tsx @@ -4,6 +4,8 @@ import { fireEvent, render, screen, waitForElementToBeRemoved } from '@testing-l import { Server } from 'miragejs'; import * as router from 'react-router'; +import { ProcessesLabels } from '@pages/Processes/Processes.enum'; + import processPairsData from '../../../mocks/data/PROCESS_PAIRS.json'; import { loadMockServer } from '../../../mocks/server'; import { waitForElementToBeRemovedTimeout } from '../../../src/config/config'; @@ -93,7 +95,7 @@ describe('Begin testing the Processes component', () => { timeout: waitForElementToBeRemovedTimeout }); - fireEvent.click(getByText('Connection history (2)')); + fireEvent.click(getByText(ProcessesLabels.OldConnections)); expect(getByTestId('tcp-old-connections-table')).toBeInTheDocument(); }); diff --git a/src/core/components/SkFlowPairsTable/FlowPair.constants.ts b/src/core/components/SkFlowPairsTable/FlowPair.constants.ts index 55ed2c2e..5b0860f4 100644 --- a/src/core/components/SkFlowPairsTable/FlowPair.constants.ts +++ b/src/core/components/SkFlowPairsTable/FlowPair.constants.ts @@ -50,7 +50,7 @@ export const tcpFlowPairsColumns: SKTableColumn[] = [ name: FlowPairLabels.FlowPairClosed, prop: 'endTime' as keyof FlowPairsResponse, customCellName: 'TimestampCell', - width: 15 + modifier: 'fitContent' }, { name: FlowPairLabels.Client, diff --git a/src/pages/ProcessGroups/Components.constants.ts b/src/pages/ProcessGroups/Components.constants.ts index bcd68b73..7b55c52c 100644 --- a/src/pages/ProcessGroups/Components.constants.ts +++ b/src/pages/ProcessGroups/Components.constants.ts @@ -42,6 +42,7 @@ export const ComponentColumns: SKTableColumn[] = [ name: ComponentLabels.Created, prop: 'startTime' as keyof ComponentResponse, customCellName: 'TimestampCell', + modifier: 'fitContent', width: 15 } ]; diff --git a/src/pages/Processes/Processes.constants.ts b/src/pages/Processes/Processes.constants.ts index 87a90a45..87412039 100644 --- a/src/pages/Processes/Processes.constants.ts +++ b/src/pages/Processes/Processes.constants.ts @@ -85,6 +85,7 @@ export const processesTableColumns: SKTableColumn[] = [ name: ProcessesLabels.Created, prop: 'startTime' as keyof ProcessResponse, customCellName: 'TimestampCell', + modifier: 'fitContent', width: 15 } ]; diff --git a/src/pages/Processes/components/Details.tsx b/src/pages/Processes/components/Details.tsx index cc006de0..1c29e415 100644 --- a/src/pages/Processes/components/Details.tsx +++ b/src/pages/Processes/components/Details.tsx @@ -44,7 +44,6 @@ const Details: FC = function ({ process }) { addresses } = process; - return ( diff --git a/src/pages/Processes/components/FlowPairsList.tsx b/src/pages/Processes/components/FlowPairsList.tsx index 9c547ff4..d0773842 100644 --- a/src/pages/Processes/components/FlowPairsList.tsx +++ b/src/pages/Processes/components/FlowPairsList.tsx @@ -160,8 +160,6 @@ const FlowPairsList: FC = function ({ sourceProcessId, destP ? TAB_4_KEY : ''; - // {!activeConnectionsCount && !oldConnectionsCount && !http2RequestsCount && !httpRequestsCount && ( - return ( <> {!activeConnectionsCount && !oldConnectionsCount && ( @@ -197,7 +195,7 @@ const FlowPairsList: FC = function ({ sourceProcessId, destP {`${ProcessesLabels.OldConnections} (${oldConnectionsCount})`}} + title={{ProcessesLabels.OldConnections}} > [] = [ name: ProcessesLabels.Created, prop: 'startTime' as keyof ServiceResponse, customCellName: 'TimestampCell', + modifier: 'fitContent', width: 15 } ]; diff --git a/src/pages/Sites/Sites.constants.ts b/src/pages/Sites/Sites.constants.ts index 0cfc4384..9f5fb1cb 100644 --- a/src/pages/Sites/Sites.constants.ts +++ b/src/pages/Sites/Sites.constants.ts @@ -44,6 +44,7 @@ export const siteColumns: SKTableColumn[] = [ name: SiteLabels.Created, prop: 'startTime' as keyof SiteResponse, customCellName: 'TimestampCell', + modifier: 'fitContent', width: 15 } ]; diff --git a/src/pages/Sites/hooks/useSiteData.ts b/src/pages/Sites/hooks/useSiteData.ts index 11cac8a0..52dbbd0f 100644 --- a/src/pages/Sites/hooks/useSiteData.ts +++ b/src/pages/Sites/hooks/useSiteData.ts @@ -1,10 +1,16 @@ -import { useSuspenseQuery } from '@tanstack/react-query'; +import { useQuery, useSuspenseQuery } from '@tanstack/react-query'; import { RESTApi } from '@API/REST.api'; +import { Role } from '@API/REST.enum'; import { UPDATE_INTERVAL } from '@config/config'; import { QueriesSites } from '../Sites.enum'; +const processQueryParams = { + limit: 0, + processRole: [Role.Remote, Role.External] +}; + export const useSiteData = (id: string) => { const { data } = useSuspenseQuery({ queryKey: [QueriesSites.GetSite, id], @@ -12,5 +18,11 @@ export const useSiteData = (id: string) => { refetchInterval: UPDATE_INTERVAL }); - return { site: data.results }; + const { data: processes } = useQuery({ + queryKey: [QueriesSites.GetProcessesBySiteId, { ...processQueryParams, parent: id }], + queryFn: () => RESTApi.fetchProcesses({ ...processQueryParams, parent: id }), + refetchInterval: UPDATE_INTERVAL + }); + + return { site: data.results, summary: { processCount: processes?.timeRangeCount || 0 } }; }; diff --git a/src/pages/Sites/hooks/useSiteProcessListData.ts b/src/pages/Sites/hooks/useSiteProcessListData.ts index 9632457c..4cb7e690 100644 --- a/src/pages/Sites/hooks/useSiteProcessListData.ts +++ b/src/pages/Sites/hooks/useSiteProcessListData.ts @@ -6,7 +6,7 @@ import { UPDATE_INTERVAL } from '@config/config'; import { QueriesSites } from '../Sites.enum'; -const processQueryParams = { processRole: [Role.Remote, Role.External], endTime: 0 }; +const processQueryParams = { processRole: [Role.Remote, Role.External] }; export const useSiteProcessListData = (id: string) => { const { data: processes } = useSuspenseQuery({ diff --git a/src/pages/Sites/views/Site.tsx b/src/pages/Sites/views/Site.tsx index 8012cb70..6e4660b8 100644 --- a/src/pages/Sites/views/Site.tsx +++ b/src/pages/Sites/views/Site.tsx @@ -21,7 +21,10 @@ interface SiteProps { } const SiteContent: FC = function ({ id, defaultTab }) { - const { site } = useSiteData(id); + const { + site, + summary: { processCount } + } = useSiteData(id); const [tabSelected, setTabSelected] = useState(defaultTab); useUpdateQueryStringValueWithoutNavigation(TopologyURLQueyParams.Type, tabSelected, true); @@ -35,7 +38,11 @@ const SiteContent: FC = function ({ id, defaultTab }) { {SiteLabels.Overview}} /> {SiteLabels.Details}} /> - {SiteLabels.Processes}} /> + {SiteLabels.Processes}} + disabled={!processCount} + /> ); }; diff --git a/src/pages/Topology/services/topologySiteController.ts b/src/pages/Topology/services/topologySiteController.ts index e8996a24..5b91aa20 100644 --- a/src/pages/Topology/services/topologySiteController.ts +++ b/src/pages/Topology/services/topologySiteController.ts @@ -36,7 +36,7 @@ const convertRouterLinksToEdges = (sites: SiteResponse[], links: LinkResponse[]) id: `${sourceId}-to${targetId}`, source: sourceId, target: targetId, - label: linkCost !== undefined ? `${TopologyLabels.SiteLinkText} ${linkCost}` : '' + label: linkCost !== undefined && linkCost > 0 ? `${TopologyLabels.SiteLinkText} ${linkCost}` : '' } ]) );