add topN selector for endpoint list

This commit is contained in:
Fine 2025-02-28 15:52:16 +08:00
parent 65607a5540
commit ce7f99ca67
12 changed files with 29 additions and 10 deletions

View File

@ -73,9 +73,9 @@ export const Processes = {
}; };
export const Endpoints = { export const Endpoints = {
variable: "$serviceId: ID!, $keyword: String!, $duration: Duration", variable: "$serviceId: ID!, $keyword: String!, $duration: Duration, $limit: Int!",
query: ` query: `
pods: findEndpoint(serviceId: $serviceId, keyword: $keyword, limit: 20, duration: $duration) { pods: findEndpoint(serviceId: $serviceId, keyword: $keyword, limit: $limit, duration: $duration) {
id id
value: name value: name
label: name label: name

View File

@ -139,7 +139,6 @@ const msg = {
enableAssociate: "Enable association", enableAssociate: "Enable association",
text: "Text", text: "Text",
query: "Query", query: "Query",
endpointTips: "The table shows up to 20 pieces of endpoints.",
viewTrace: "View Related Traces", viewTrace: "View Related Traces",
relatedTraceOptions: "Related Trace Options", relatedTraceOptions: "Related Trace Options",
setLatencyDuration: "Latency Related Metrics", setLatencyDuration: "Latency Related Metrics",

View File

@ -138,7 +138,6 @@ const msg = {
"El nombre sólo admite chino e inglés, líneas horizontales y subrayado, y la longitud del nombre no excederá de 300 caracteres", "El nombre sólo admite chino e inglés, líneas horizontales y subrayado, y la longitud del nombre no excederá de 300 caracteres",
enableAssociate: "Activar asociación", enableAssociate: "Activar asociación",
query: "Consulta", query: "Consulta",
endpointTips: "Aquí, la tabla muestra hasta 20 punto final.",
queryOrder: "Consulta por duración", queryOrder: "Consulta por duración",
setOrder: "Orden de consulta", setOrder: "Orden de consulta",
latency: "Retraso", latency: "Retraso",

View File

@ -137,7 +137,6 @@ const msg = {
duplicateName: "重复的名称", duplicateName: "重复的名称",
text: "文本", text: "文本",
query: "查询", query: "查询",
endpointTips: "这里最多展示20条endpoints。",
viewTrace: "查看相关Trace", viewTrace: "查看相关Trace",
relatedTraceOptions: "相关的Trace选项", relatedTraceOptions: "相关的Trace选项",
setLatencyDuration: "延迟相关指标", setLatencyDuration: "延迟相关指标",

View File

@ -1,3 +1,4 @@
import { Endpoint } from "@/types/selector";
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -56,3 +57,5 @@ export enum EBPFProfilingTriggerType {
FIXED_TIME = "FIXED_TIME", FIXED_TIME = "FIXED_TIME",
CONTINUOUS_PROFILING = "CONTINUOUS_PROFILING", CONTINUOUS_PROFILING = "CONTINUOUS_PROFILING",
} }
export const EndpointsTopNDefault = 20;

View File

@ -22,6 +22,7 @@ import type { Event, QueryEventCondition } from "@/types/events";
import type { Instance, Endpoint } from "@/types/selector"; import type { Instance, Endpoint } from "@/types/selector";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import { EndpointsTopNDefault } from "../data";
interface eventState { interface eventState {
loading: boolean; loading: boolean;
@ -66,6 +67,7 @@ export const eventStore = defineStore({
serviceId, serviceId,
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
keyword: keyword || "", keyword: keyword || "",
limit: EndpointsTopNDefault,
}); });
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;

View File

@ -22,6 +22,7 @@ import type { AxiosResponse } from "axios";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
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 { EndpointsTopNDefault } from "../data";
interface LogState { interface LogState {
services: Service[]; services: Service[];
@ -89,6 +90,7 @@ export const logStore = defineStore({
serviceId, serviceId,
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
keyword: keyword || "", keyword: keyword || "",
limit: EndpointsTopNDefault,
}); });
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;

View File

@ -28,6 +28,7 @@ import { store } from "@/store";
import graphql from "@/graphql"; import graphql from "@/graphql";
import type { AxiosResponse } from "axios"; import type { AxiosResponse } from "axios";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { EndpointsTopNDefault } from "../data";
interface ProfileState { interface ProfileState {
endpoints: Endpoint[]; endpoints: Endpoint[];
@ -97,6 +98,7 @@ export const profileStore = defineStore({
serviceId, serviceId,
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
keyword: keyword || "", keyword: keyword || "",
limit: EndpointsTopNDefault,
}); });
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;
@ -109,6 +111,7 @@ export const profileStore = defineStore({
serviceId, serviceId,
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
keyword: keyword || "", keyword: keyword || "",
limit: EndpointsTopNDefault,
}); });
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;

View File

@ -20,6 +20,7 @@ import { store } from "@/store";
import graphql from "@/graphql"; import graphql from "@/graphql";
import type { AxiosResponse } from "axios"; import type { AxiosResponse } from "axios";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { EndpointsTopNDefault } from "../data";
interface SelectorState { interface SelectorState {
services: Service[]; services: Service[];
destServices: Service[]; destServices: Service[];
@ -143,7 +144,7 @@ export const selectorStore = defineStore({
serviceId, serviceId,
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
keyword: params.keyword || "", keyword: params.keyword || "",
limit: params.limit, limit: params.limit || EndpointsTopNDefault,
}); });
if (!res.data.errors) { if (!res.data.errors) {
if (params.isRelation) { if (params.isRelation) {

View File

@ -23,6 +23,7 @@ import type { AxiosResponse } from "axios";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import { QueryOrders } from "@/views/dashboard/data"; import { QueryOrders } from "@/views/dashboard/data";
import { EndpointsTopNDefault } from "../data";
interface TraceState { interface TraceState {
services: Service[]; services: Service[];
instances: Instance[]; instances: Instance[];
@ -133,6 +134,7 @@ export const traceStore = defineStore({
serviceId, serviceId,
duration: useAppStoreWithOut().durationTime, duration: useAppStoreWithOut().durationTime,
keyword: keyword || "", keyword: keyword || "",
limit: EndpointsTopNDefault,
}); });
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;

View File

@ -16,13 +16,15 @@ limitations under the License. -->
<div class="table"> <div class="table">
<div class="search"> <div class="search">
<el-input v-model="searchText" placeholder="Search for more endpoints" @change="searchList" class="inputs"> <el-input v-model="searchText" placeholder="Search for more endpoints" @change="searchList" class="inputs">
<template #prepend>
<Selector style="width: 120px" v-model="topN" :options="topNList" placeholder="Select" />
</template>
<template #append> <template #append>
<el-button @click="searchList"> <el-button @click="searchList">
<Icon size="middle" iconName="search" /> <Icon size="middle" iconName="search" />
</el-button> </el-button>
</template> </template>
</el-input> </el-input>
<span class="ml-5 tips">{{ t("endpointTips") }}</span>
</div> </div>
<div class="list"> <div class="list">
<el-table v-loading="chartLoading" :data="endpoints" style="width: 100%"> <el-table v-loading="chartLoading" :data="endpoints" style="width: 100%">
@ -52,7 +54,6 @@ limitations under the License. -->
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useI18n } from "vue-i18n";
import type { PropType } from "vue"; import type { PropType } from "vue";
import type { EndpointListConfig } from "@/types/dashboard"; import type { EndpointListConfig } from "@/types/dashboard";
import type { Endpoint } from "@/types/selector"; import type { Endpoint } from "@/types/selector";
@ -90,7 +91,6 @@ limitations under the License. -->
}); });
const emit = defineEmits(["expressionTips"]); const emit = defineEmits(["expressionTips"]);
const { t } = useI18n();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const chartLoading = ref<boolean>(false); const chartLoading = ref<boolean>(false);
@ -100,6 +100,14 @@ limitations under the License. -->
const colSubMetrics = ref<string[]>([]); const colSubMetrics = ref<string[]>([]);
const metricConfig = ref<MetricConfigOpt[]>(props.config.metricConfig || []); const metricConfig = ref<MetricConfigOpt[]>(props.config.metricConfig || []);
const typesOfMQE = ref<string[]>(props.config.typesOfMQE || []); const typesOfMQE = ref<string[]>(props.config.typesOfMQE || []);
const topN = ref<number>(20);
const topNList = [
{ label: "TopN20", value: 20 },
{ label: "TopN50", value: 50 },
{ label: "TopN100", value: 100 },
{ label: "TopN150", value: 150 },
{ label: "TopN200", value: 200 },
];
if (props.needQuery) { if (props.needQuery) {
queryEndpoints(); queryEndpoints();
@ -108,6 +116,7 @@ limitations under the License. -->
chartLoading.value = true; chartLoading.value = true;
const resp = await selectorStore.getEndpoints({ const resp = await selectorStore.getEndpoints({
keyword: searchText.value, keyword: searchText.value,
limit: topN.value,
}); });
chartLoading.value = false; chartLoading.value = false;

View File

@ -53,5 +53,5 @@
} }
.inputs { .inputs {
width: 300px; width: 400px;
} }