fix: optimize config UI for related trace and metrics (#195)

This commit is contained in:
Fine0830 2022-11-29 14:24:15 +08:00 committed by GitHub
parent 5be106fc4f
commit d4dde7e73b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 18 deletions

View File

@ -162,7 +162,8 @@ const msg = {
viewTrace: "View Related Traces", viewTrace: "View Related Traces",
relatedTraceOptions: "Related Trace Options", relatedTraceOptions: "Related Trace Options",
setLatencyDuration: "Latency Related Metrics", setLatencyDuration: "Latency Related Metrics",
queryOrder: "Query Order", queryOrder: "Query By Duration",
setOrder: "Query Order",
latency: "Latency", latency: "Latency",
metricValues: "Metric Values", metricValues: "Metric Values",
queryConditions: "Query Conditions", queryConditions: "Query Conditions",

View File

@ -159,7 +159,8 @@ const msg = {
postgreSQL: "PostgreSQL", postgreSQL: "PostgreSQL",
endpointTips: "Aquí, la tabla muestra hasta 20 punto final.", endpointTips: "Aquí, la tabla muestra hasta 20 punto final.",
apisix: "APISIX", apisix: "APISIX",
queryOrder: "Orden de consulta", queryOrder: "Consulta por duración",
setOrder: "Orden de consulta",
latency: "Retraso", latency: "Retraso",
metricValues: "Valor métrico", metricValues: "Valor métrico",
legendValues: "Valor de la leyenda", legendValues: "Valor de la leyenda",

View File

@ -159,7 +159,8 @@ const msg = {
viewTrace: "查看相关Trace", viewTrace: "查看相关Trace",
relatedTraceOptions: "相关的Trace选项", relatedTraceOptions: "相关的Trace选项",
setLatencyDuration: "延迟相关指标", setLatencyDuration: "延迟相关指标",
queryOrder: "查询顺序", queryOrder: "按持续时间查询",
setOrder: "查询顺序",
latency: "延迟", latency: "延迟",
metricValues: "指标值", metricValues: "指标值",
enableRelatedTrace: "启用相关Trace", enableRelatedTrace: "启用相关Trace",

View File

@ -46,7 +46,7 @@ limitations under the License. -->
/> />
</div> </div>
<div class="item"> <div class="item">
<span class="label">{{ t("queryOrder") }}</span> <span class="label">{{ t("setOrder") }}</span>
<Selector <Selector
size="small" size="small"
:value="queryOrder" :value="queryOrder"
@ -71,8 +71,17 @@ limitations under the License. -->
import { ref } from "vue"; import { ref } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { Status, QueryOrders, RefIdTypes } from "../../data"; import { RefIdTypes } from "../../data";
const QueryOrders = [
{ label: "None", value: "BY_START_TIME" },
{ label: "Duration", value: "BY_DURATION" },
];
const Status = [
{ label: "None", value: "ALL" },
{ label: "Success", value: "SUCCESS" },
{ label: "Error", value: "ERROR" },
];
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const { graph, relatedTrace } = dashboardStore.selectedGrid; const { graph, relatedTrace } = dashboardStore.selectedGrid;

View File

@ -60,7 +60,10 @@ limitations under the License. -->
/> />
</el-popover> </el-popover>
<span <span
v-show="states.isList || states.metricTypes[0] === 'readMetricsValues'" v-show="
states.isList ||
states.metricTypes[0] === ProtocolTypes.ReadMetricsValues
"
> >
<Icon <Icon
class="cp mr-5" class="cp mr-5"
@ -106,6 +109,7 @@ import {
ChartTypes, ChartTypes,
PodsChartTypes, PodsChartTypes,
MetricsType, MetricsType,
ProtocolTypes,
} from "../../../data"; } from "../../../data";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import Icon from "@/components/Icon.vue"; import Icon from "@/components/Icon.vue";
@ -425,13 +429,7 @@ function setMetricTypeList(type: string) {
return MetricTypes[type]; return MetricTypes[type];
} }
if (states.isList || graph.value.type === "Table") { if (states.isList || graph.value.type === "Table") {
return [ return [MetricTypes.REGULAR_VALUE[0], MetricTypes.REGULAR_VALUE[1]];
{ label: "read all values in the duration", value: "readMetricsValues" },
{
label: "read the single value in the duration",
value: "readMetricsValue",
},
];
} }
return MetricTypes[type]; return MetricTypes[type];
} }

View File

@ -97,7 +97,7 @@ import { useI18n } from "vue-i18n";
import { SortOrder, CalculationOpts } from "../../../data"; import { SortOrder, CalculationOpts } from "../../../data";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { MetricConfigOpt } from "@/types/dashboard"; import { MetricConfigOpt } from "@/types/dashboard";
import { ListChartTypes } from "../../../data"; import { ListChartTypes, ProtocolTypes } from "../../../data";
/*global defineEmits, defineProps */ /*global defineEmits, defineProps */
const props = defineProps({ const props = defineProps({
@ -122,11 +122,18 @@ const hasLabel = computed(() => {
const graph = dashboardStore.selectedGrid.graph || {}; const graph = dashboardStore.selectedGrid.graph || {};
return ( return (
ListChartTypes.includes(graph.type) || ListChartTypes.includes(graph.type) ||
["readLabeledMetricsValues", "readMetricsValues"].includes(metricType.value) [
ProtocolTypes.ReadLabeledMetricsValues,
ProtocolTypes.ReadMetricsValues,
].includes(metricType.value)
); );
}); });
const isTopn = computed(() => const isTopn = computed(() =>
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index]) [
ProtocolTypes.SortMetrics,
ProtocolTypes.ReadSampledRecords,
ProtocolTypes.ReadRecords,
].includes(metricTypes[props.index])
); );
function updateConfig(index: number, param: { [key: string]: string }) { function updateConfig(index: number, param: { [key: string]: string }) {
const key = Object.keys(param)[0]; const key = Object.keys(param)[0];

View File

@ -47,6 +47,15 @@ export const MetricChartType: any = {
readSampledRecords: [{ label: "Top List", value: "TopList" }], readSampledRecords: [{ label: "Top List", value: "TopList" }],
readRecords: [{ label: "Top List", value: "TopList" }], readRecords: [{ label: "Top List", value: "TopList" }],
}; };
export enum ProtocolTypes {
ReadRecords = "readRecords",
ReadSampledRecords = "readSampledRecords",
SortMetrics = "sortMetrics",
ReadLabeledMetricsValues = "readLabeledMetricsValues",
ReadHeatMap = "readHeatMap",
ReadMetricsValues = "readMetricsValues",
ReadMetricsValue = "readMetricsValue",
}
export const DefaultGraphConfig: { [key: string]: any } = { export const DefaultGraphConfig: { [key: string]: any } = {
Bar: { Bar: {
type: "Bar", type: "Bar",

View File

@ -138,8 +138,10 @@ init();
async function init() { async function init() {
for (const d of Object.keys(filters)) { for (const d of Object.keys(filters)) {
if ( if (
["queryOrder"].includes(d) || (d === "queryOrder" &&
(d === "status" && filters[d] && filters[d] !== "ALL") || filters[d] &&
filters[d] === QueryOrders[1].value) ||
(d === "status" && filters[d] && filters[d] !== Status[0].value) ||
(filters[d] && d === "latency") (filters[d] && d === "latency")
) { ) {
items.value.push({ label: d, value: FiltersKeys[d] }); items.value.push({ label: d, value: FiltersKeys[d] });