Skip to content

Commit

Permalink
restructure service files
Browse files Browse the repository at this point in the history
  • Loading branch information
alonkeyval committed Jul 25, 2023
1 parent cab862a commit 22f9412
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 21 deletions.
2 changes: 1 addition & 1 deletion frontend/webapp/containers/overview/overview/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useCallback, useMemo, useState } from "react";
import { KeyvalDataFlow, KeyvalLoader } from "@/design.system";
import { QUERIES } from "@/utils/constants";
import { useQuery } from "react-query";
import { getDestinations, getSources } from "@/services/setup";
import { getDestinations, getSources } from "@/services";
import { getEdges, groupSourcesNamespace, getNodes } from "./utils";
import { OverviewDataFlowWrapper } from "./overview.styled";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
CreateConnectionContainer,
LoaderWrapper,
} from "./connection.section.styled";
import { getDestination, setDestination } from "@/services/setup";
import { getDestination, setDestination } from "@/services";
import { QUERIES, ROUTES, SETUP } from "@/utils/constants";
import { KeyvalLoader } from "@/design.system";
import { useNotification } from "@/hooks";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect, useState } from "react";
import { useQuery } from "react-query";
import { QUERIES, SETUP } from "@/utils/constants";
import { getDestinationsTypes } from "@/services/setup";
import { MONITORING_OPTIONS } from "@/components/setup/destination/utils";
import { DestinationList, DestinationOptionMenu } from "@/components/setup";
import Empty from "@/assets/images/empty-list.svg";
Expand All @@ -18,6 +17,7 @@ import {
} from "./utils";
import { KeyvalLoader } from "@/design.system";
import { useNotification } from "@/hooks";
import { getDestinationsTypes } from "@/services";

type DestinationSectionProps = {
sectionData: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { KeyvalText } from "@/design.system";
import { CONFIG, SETUP } from "@/utils/constants";
import { useSectionData, useNotification } from "@/hooks";
import { STEPS, Step } from "./utils";
import { setNamespaces } from "@/services/setup";
import { setNamespaces } from "@/services";
import { useSearchParams } from "next/navigation";
import { useMutation } from "react-query";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useMemo, useState } from "react";
import { SourcesList, SourcesOptionMenu } from "@/components/setup";
import { getApplication, getNamespaces } from "@/services/setup";
import { getApplication, getNamespaces } from "@/services";
import { LoaderWrapper } from "./sources.section.styled";
import { useQuery } from "react-query";
import { QUERIES } from "@/utils/constants";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import { API } from "@/utils/constants";
import { get, post } from "./api";

export async function getNamespaces() {
return await get(API.NAMESPACES);
}

export async function getApplication(id: string) {
return await get(`${API.APPLICATIONS}/${id}`);
}

export async function setNamespaces(body: any) {
return await post(API.NAMESPACES, body);
}

export async function getDestinationsTypes() {
return await get(API.DESTINATION_TYPE);
}
Expand All @@ -21,10 +9,6 @@ export async function getDestinations() {
return await get(API.DESTINATIONS);
}

export async function getSources() {
return await get(API.SOURCES);
}

export async function getDestination(type: string) {
return await get(`${API.DESTINATION_TYPE}/${type}`);
}
Expand Down
13 changes: 13 additions & 0 deletions frontend/webapp/services/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export {
getDestinationsTypes,
getDestinations,
getDestination,
setDestination,
} from "./destinations";

export {
getNamespaces,
getApplication,
setNamespaces,
getSources,
} from "./sources";
18 changes: 18 additions & 0 deletions frontend/webapp/services/sources.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { API } from "@/utils/constants";
import { get, post } from "./api";

export async function getNamespaces() {
return await get(API.NAMESPACES);
}

export async function getApplication(id: string) {
return await get(`${API.APPLICATIONS}/${id}`);
}

export async function setNamespaces(body: any) {
return await post(API.NAMESPACES, body);
}

export async function getSources() {
return await get(API.SOURCES);
}

0 comments on commit 22f9412

Please sign in to comment.