Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(General): ♻️ Remove legacy address processes api #454

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/pages/Services/HttpRequests.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Server } from 'miragejs';
import HttpRequests from '@pages/Services/components/HttpRequests';

import flowPairsData from '../../../mocks/data/FLOW_PAIRS.json';
import processesData from '../../../mocks/data/SERVICE_PROCESSES.json';
import processesData from '../../../mocks/data/PROCESSES.json';
import servicesData from '../../../mocks/data/SERVICES.json';
import { loadMockServer } from '../../../mocks/server';
import { AvailableProtocols } from '../../../src/API/REST.enum';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/pages/Services/TcpConnections.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Server } from 'miragejs';
import TcpConnections from '@pages/Services/components/TcpConnections';

import flowPairsData from '../../../mocks/data/FLOW_PAIRS.json';
import processesData from '../../../mocks/data/SERVICE_PROCESSES.json';
import processesData from '../../../mocks/data/PROCESSES.json';
import servicesData from '../../../mocks/data/SERVICES.json';
import { loadMockServer } from '../../../mocks/server';
import { AvailableProtocols } from '../../../src/API/REST.enum';
Expand Down
42 changes: 0 additions & 42 deletions mocks/data/SERVICE_PROCESSES.json

This file was deleted.

2 changes: 0 additions & 2 deletions mocks/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const sitePairs: ResponseWrapper<SitePairsResponse[]> = require(`${path}/SITE_PA
const processPairs: ResponseWrapper<ProcessPairsResponse[]> = require(`${path}/PROCESS_PAIRS.json`);
const hosts = require(`${path}/HOSTS.json`);
const services = require(`${path}/SERVICES.json`);
const serviceProcesses = require(`${path}/SERVICE_PROCESSES.json`);
const flowPairs = require(`${path}/FLOW_PAIRS.json`);
const links: ResponseWrapper<LinkResponse[]> = require(`${path}/LINKS.json`);

Expand Down Expand Up @@ -456,7 +455,6 @@ export function loadMockServer() {
}));

this.get(`${prefix}/addresses`, () => services);
this.get(`${prefix}/addresses/:id/processes`, () => serviceProcesses);
this.get(`${prefix}/addresses/:id/processpairs`, () => processPairs);
}
});
Expand Down
12 changes: 0 additions & 12 deletions src/API/REST.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {

import { axiosFetch } from './apiMiddleware';
import {
getProcessesByServicePATH,
getSitePATH,
getLinksBySitePATH,
getHostsBySitePATH,
Expand Down Expand Up @@ -163,17 +162,6 @@ export const RESTApi = {
return data;
},

fetchServersByService: async (
id: string,
options?: RemoteFilterOptions
): Promise<ResponseWrapper<ProcessResponse[]>> => {
const data = await axiosFetch<ResponseWrapper<ProcessResponse[]>>(getProcessesByServicePATH(id), {
params: options ? mapOptionsToQueryParams(options) : null
});

return data;
},

fetchProcessPairsByService: async (
id: string,
options?: RemoteFilterOptions
Expand Down
1 change: 0 additions & 1 deletion src/API/REST.paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const getProcessGroupPATH = (id: string) => `${PROCESS_GROUPS_PATH}${id}`
// SERVICES
const SERVICE_PATH = `${COLLECTOR_URL}/addresses/`;
export const getServicesPath = () => SERVICE_PATH;
export const getProcessesByServicePATH = (id: string) => `${SERVICE_PATH}${id}/processes`;
export const getProcessPairsByServicePATH = (id: string) => `${SERVICE_PATH}${id}/processpairs`;

// CONNECTIONS & RESPONSES
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Services/components/ExposedServers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const ExposedServers: FC<ExposedServersProps> = function ({
pagination = BIG_PAGINATION_SIZE
}) {
const { data: exposedServersData } = useSuspenseQuery({
queryKey: [QueriesServices.GetProcessesByService, serviceId, initServersQueryParams],
queryFn: () => (serviceId ? RESTApi.fetchServersByService(serviceId, initServersQueryParams) : null),
queryKey: [QueriesServices.GetProcessesByService, { ...initServersQueryParams, addresses: [serviceId] }],
queryFn: () => RESTApi.fetchProcesses({ ...initServersQueryParams, addresses: [serviceId] }),

refetchInterval: UPDATE_INTERVAL
});
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Services/hooks/useServiceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const terminatedConnectionsQueryParams = {

const useServiceData = () => {
const { service } = useParams();
const serviceName = service?.split('@')[0];
const serviceName = service?.split('@')[0] as string;
const serviceId = service?.split('@')[1] as string;
const protocol = service?.split('@')[2] as AvailableProtocols | undefined;

const { data: serversData } = useQuery({
queryKey: [QueriesServices.GetProcessesByService, serviceId, initServersQueryParams],
queryFn: () => RESTApi.fetchServersByService(serviceId, initServersQueryParams),
queryKey: [QueriesServices.GetProcessesByService, { ...initServersQueryParams, addresses: [serviceId] }],
queryFn: () => RESTApi.fetchProcesses({ ...initServersQueryParams, addresses: [serviceId] }),
refetchInterval: UPDATE_INTERVAL
});

Expand Down
Loading