This commit is contained in:
Fine 2023-04-06 19:14:58 +08:00
parent b11e1331bc
commit 2c573d6a81
5 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ export function useQueryProcessor(config: Indexable) {
if (!selectorStore.currentService && dashboardStore.entity !== "All") { if (!selectorStore.currentService && dashboardStore.entity !== "All") {
return; return;
} }
const conditions: { [key: string]: unknown } = { const conditions: Recordable = {
duration: appStore.durationTime, duration: appStore.durationTime,
}; };
const variables: string[] = [`$duration: Duration!`]; const variables: string[] = [`$duration: Duration!`];
@ -424,14 +424,14 @@ export function aggregation(val: number, config: { calculation?: string }): numb
return data; return data;
} }
export async function useGetMetricEntity(metric: string, metricType: MetricQueryTypes) { export async function useGetMetricEntity(metric: string, metricType: string[]) {
if (!metric || !metricType) { if (!metric || !metricType) {
return; return;
} }
let catalog = ""; let catalog = "";
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
if ( if (
[MetricQueryTypes.ReadSampledRecords, MetricQueryTypes.SortMetrics, MetricQueryTypes.ReadRecords].includes( ([MetricQueryTypes.ReadSampledRecords, MetricQueryTypes.SortMetrics, MetricQueryTypes.ReadRecords] as any).includes(
metricType, metricType,
) )
) { ) {

View File

@ -113,7 +113,7 @@ limitations under the License. -->
} }
async function queryMetrics() { async function queryMetrics() {
const metricTypes = props.data.metricTypes || []; const metricTypes: string[] = props.data.metricTypes || [];
const metrics = props.data.metrics || []; const metrics = props.data.metrics || [];
const catalog = await useGetMetricEntity(metrics[0], metricTypes[0]); const catalog = await useGetMetricEntity(metrics[0], metricTypes[0]);
const params = await useQueryProcessor({ ...props.data, catalog }); const params = await useQueryProcessor({ ...props.data, catalog });

View File

@ -65,6 +65,7 @@ limitations under the License. -->
import { TextColors } from "@/views/dashboard/data"; import { TextColors } from "@/views/dashboard/data";
import Trace from "@/views/dashboard/related/trace/Index.vue"; import Trace from "@/views/dashboard/related/trace/Index.vue";
import { QueryOrders, Status, RefIdTypes, ProtocolTypes } from "../data"; import { QueryOrders, Status, RefIdTypes, ProtocolTypes } from "../data";
/*global defineProps */ /*global defineProps */
const props = defineProps({ const props = defineProps({
data: { data: {

View File

@ -85,7 +85,6 @@ limitations under the License. -->
import ConditionTags from "@/views/components/ConditionTags.vue"; import ConditionTags from "@/views/components/ConditionTags.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { EntityType, QueryOrders, Status } from "../../data"; import { EntityType, QueryOrders, Status } from "../../data";
import type { LayoutConfig } from "@/types/dashboard";
const FiltersKeys: { [key: string]: string } = { const FiltersKeys: { [key: string]: string } = {
status: "traceState", status: "traceState",
@ -98,7 +97,7 @@ limitations under the License. -->
const props = defineProps({ const props = defineProps({
needQuery: { type: Boolean, default: true }, needQuery: { type: Boolean, default: true },
data: { data: {
type: Object as PropType<LayoutConfig>, type: Object as PropType<Recordable>,
default: () => ({ graph: {} }), default: () => ({ graph: {} }),
}, },
}); });

View File

@ -30,10 +30,10 @@ limitations under the License. -->
import TraceList from "./TraceList.vue"; import TraceList from "./TraceList.vue";
import TraceDetail from "./Detail.vue"; import TraceDetail from "./Detail.vue";
import type { LayoutConfig } from "@/types/dashboard"; import type { LayoutConfig } from "@/types/dashboard";
/*global defineProps */ /*global defineProps, Recordable */
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object as PropType<LayoutConfig>, type: Object as PropType<LayoutConfig | Recordable>,
default: () => ({ graph: {} }), default: () => ({ graph: {} }),
}, },
}); });