diff --git a/src/graphql/fetch.ts b/src/graphql/custom-query.ts similarity index 90% rename from src/graphql/fetch.ts rename to src/graphql/custom-query.ts index f475c6a4..c53badf2 100644 --- a/src/graphql/fetch.ts +++ b/src/graphql/custom-query.ts @@ -16,7 +16,7 @@ */ import { httpQuery } from "./base"; -async function fetchQuery(param: { queryStr: string; conditions: { [key: string]: unknown } }) { +async function customQuery(param: { queryStr: string; conditions: { [key: string]: unknown } }) { const response = await httpQuery({ method: "post", json: { query: param.queryStr, variables: { ...param.conditions } }, @@ -28,4 +28,4 @@ async function fetchQuery(param: { queryStr: string; conditions: { [key: string] return response; } -export default fetchQuery; +export default customQuery; diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 1eb35f71..57ee704d 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -18,7 +18,7 @@ import { defineStore } from "pinia"; import { store } from "@/store"; import type { LayoutConfig } from "@/types/dashboard"; import graphql from "@/graphql"; -import fetchQuery from "@/graphql/fetch"; +import customQuery from "@/graphql/custom-query"; import type { DashboardItem } from "@/types/dashboard"; import { useSelectorStore } from "@/store/modules/selectors"; import { NewControl, TextConfig, TimeRangeConfig, ControlsTypes } from "../data"; @@ -299,7 +299,7 @@ export const dashboardStore = defineStore({ } }, async fetchMetricValue(param: { queryStr: string; conditions: { [key: string]: unknown } }) { - return await fetchQuery(param); + return await customQuery(param); }, async fetchTemplates() { const res = await graphql.query("getTemplates").params({}); diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index b16d7611..081aa4be 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -21,7 +21,7 @@ import graphql from "@/graphql"; import { useSelectorStore } from "@/store/modules/selectors"; import { useDashboardStore } from "@/store/modules/dashboard"; import { useAppStoreWithOut } from "@/store/modules/app"; -import fetchQuery from "@/graphql/fetch"; +import customQuery from "@/graphql/custom-query"; import { useQueryTopologyExpressionsProcessor } from "@/hooks/useExpressionsProcessor"; interface MetricVal { @@ -431,7 +431,7 @@ export const topologyStore = defineStore({ }); const queryStr = `query queryData(${variables}) {${fragment}}`; const conditions = { duration }; - const res = await fetchQuery({ queryStr, conditions }); + const res = await customQuery({ queryStr, conditions }); if (res.errors) { return res; @@ -448,7 +448,7 @@ export const topologyStore = defineStore({ return { calls, nodes }; }, async getTopologyExpressionValue(param: { queryStr: string; conditions: { [key: string]: unknown } }) { - const res = await fetchQuery(param); + const res = await customQuery(param); if (res.errors) { return res;