mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-06-23 20:05:24 +00:00
refactor
This commit is contained in:
parent
a28972bc5c
commit
3113c67112
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
import { httpQuery } from "./base";
|
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({
|
const response = await httpQuery({
|
||||||
method: "post",
|
method: "post",
|
||||||
json: { query: param.queryStr, variables: { ...param.conditions } },
|
json: { query: param.queryStr, variables: { ...param.conditions } },
|
||||||
@ -28,4 +28,4 @@ async function fetchQuery(param: { queryStr: string; conditions: { [key: string]
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default fetchQuery;
|
export default customQuery;
|
@ -18,7 +18,7 @@ import { defineStore } from "pinia";
|
|||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import type { LayoutConfig } from "@/types/dashboard";
|
import type { LayoutConfig } from "@/types/dashboard";
|
||||||
import graphql from "@/graphql";
|
import graphql from "@/graphql";
|
||||||
import fetchQuery from "@/graphql/fetch";
|
import customQuery from "@/graphql/custom-query";
|
||||||
import type { DashboardItem } from "@/types/dashboard";
|
import type { DashboardItem } from "@/types/dashboard";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { NewControl, TextConfig, TimeRangeConfig, ControlsTypes } from "../data";
|
import { NewControl, TextConfig, TimeRangeConfig, ControlsTypes } from "../data";
|
||||||
@ -299,7 +299,7 @@ export const dashboardStore = defineStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async fetchMetricValue(param: { queryStr: string; conditions: { [key: string]: unknown } }) {
|
async fetchMetricValue(param: { queryStr: string; conditions: { [key: string]: unknown } }) {
|
||||||
return await fetchQuery(param);
|
return await customQuery(param);
|
||||||
},
|
},
|
||||||
async fetchTemplates() {
|
async fetchTemplates() {
|
||||||
const res = await graphql.query("getTemplates").params({});
|
const res = await graphql.query("getTemplates").params({});
|
||||||
|
@ -21,7 +21,7 @@ import graphql from "@/graphql";
|
|||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
import fetchQuery from "@/graphql/fetch";
|
import customQuery from "@/graphql/custom-query";
|
||||||
import { useQueryTopologyExpressionsProcessor } from "@/hooks/useExpressionsProcessor";
|
import { useQueryTopologyExpressionsProcessor } from "@/hooks/useExpressionsProcessor";
|
||||||
|
|
||||||
interface MetricVal {
|
interface MetricVal {
|
||||||
@ -431,7 +431,7 @@ export const topologyStore = defineStore({
|
|||||||
});
|
});
|
||||||
const queryStr = `query queryData(${variables}) {${fragment}}`;
|
const queryStr = `query queryData(${variables}) {${fragment}}`;
|
||||||
const conditions = { duration };
|
const conditions = { duration };
|
||||||
const res = await fetchQuery({ queryStr, conditions });
|
const res = await customQuery({ queryStr, conditions });
|
||||||
|
|
||||||
if (res.errors) {
|
if (res.errors) {
|
||||||
return res;
|
return res;
|
||||||
@ -448,7 +448,7 @@ export const topologyStore = defineStore({
|
|||||||
return { calls, nodes };
|
return { calls, nodes };
|
||||||
},
|
},
|
||||||
async getTopologyExpressionValue(param: { queryStr: string; conditions: { [key: string]: unknown } }) {
|
async getTopologyExpressionValue(param: { queryStr: string; conditions: { [key: string]: unknown } }) {
|
||||||
const res = await fetchQuery(param);
|
const res = await customQuery(param);
|
||||||
|
|
||||||
if (res.errors) {
|
if (res.errors) {
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user