fix query

This commit is contained in:
Fine 2022-10-26 15:26:25 +08:00
parent cfe74b0888
commit 3f20f6165e
3 changed files with 13 additions and 6 deletions

View File

@ -154,6 +154,7 @@ export function useQueryProcessor(config: any) {
}
});
const queryStr = `query queryData(${variables}) {${fragment}}`;
console.log(queryStr);
return {
queryStr,
conditions,
@ -257,10 +258,12 @@ export function useQueryPodsMetrics(
config: { metrics: string[]; metricTypes: string[] },
scope: string
) {
if (!(config.metrics && config.metrics[0])) {
const metricTypes = (config.metricTypes || []).filter((m: string) => m);
if (!metricTypes.length) {
return;
}
if (!(config.metricTypes && config.metricTypes[0])) {
const metrics = (config.metrics || []).filter((m: string) => m);
if (!metrics.length) {
return;
}
const appStore = useAppStoreWithOut();
@ -282,8 +285,8 @@ export function useQueryPodsMetrics(
endpointName: scope === "Endpoint" ? d.label : undefined,
normal: scope === "Service" ? d.normal : currentService.normal,
};
const f = config.metrics.map((name: string, idx: number) => {
const metricType = config.metricTypes[idx] || "";
const f = metrics.map((name: string, idx: number) => {
const metricType = metricTypes[idx] || "";
conditions[`condition${index}${idx}`] = {
name,
entity: param,

View File

@ -191,7 +191,10 @@ async function setMetricType(chart?: any) {
states.metricList = (arr || []).filter(
(d: { catalog: string; type: string }) => {
if (states.isList) {
if (d.type === MetricsType.REGULAR_VALUE) {
if (
d.type === MetricsType.REGULAR_VALUE ||
d.type === MetricsType.LABELED_VALUE
) {
return d;
}
} else if (g.type === "Table") {

View File

@ -194,6 +194,7 @@ function clickService(scope: any) {
router.push(path);
}
async function queryServiceMetrics(currentServices: Service[]) {
// console.log(services.value);
if (!currentServices.length) {
return;
}
@ -219,7 +220,7 @@ async function queryServiceMetrics(currentServices: Service[]) {
});
return;
}
console.log(services.value);
services.value = currentServices;
}
function objectSpanMethod(param: any): any {