fix: metrics

This commit is contained in:
Fine 2024-04-11 15:21:03 +08:00
parent 27133a1080
commit 3b3df49722
4 changed files with 8 additions and 11 deletions

View File

@ -183,7 +183,7 @@ limitations under the License. -->
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
text-align: center; text-align: center;
background-color: aliceblue; background-color: var(--sw-config-header);
font-size: $font-size-smaller; font-size: $font-size-smaller;
position: relative; position: relative;
} }

View File

@ -25,9 +25,9 @@ limitations under the License. -->
:clearable="true" :clearable="true"
/> />
</div> </div>
<div>{{ t("metrics") }}</div>
<div class="flex-h"> <div class="flex-h">
<div class="ml-5 link"> <div>{{ t("metrics") }}</div>
<div class="link">
<a target="_blank" href="https://skywalking.apache.org/docs/main/next/en/api/metrics-query-expression/"> <a target="_blank" href="https://skywalking.apache.org/docs/main/next/en/api/metrics-query-expression/">
<Icon iconName="info_outline" size="middle" /> <Icon iconName="info_outline" size="middle" />
</a> </a>
@ -289,8 +289,7 @@ limitations under the License. -->
states.metrics = [""]; states.metrics = [""];
states.metricTypes = [""]; states.metricTypes = [""];
states.tips = [""]; states.tips = [""];
let v = {}; let v: any = { typesOfMQE: states.metricTypes, expressions: states.metrics };
v = { typesOfMQE: states.metricTypes, expressions: states.metrics };
if (states.isList) { if (states.isList) {
states.subMetrics = [""]; states.subMetrics = [""];
states.subMetricTypes = [""]; states.subMetricTypes = [""];
@ -331,6 +330,7 @@ limitations under the License. -->
...p, ...p,
metricConfig, metricConfig,
}); });
queryMetrics();
} }
function setMetricConfig(index: number) { function setMetricConfig(index: number) {
@ -434,5 +434,6 @@ limitations under the License. -->
.link { .link {
cursor: pointer; cursor: pointer;
color: $active-color; color: $active-color;
padding-left: 2px;
} }
</style> </style>

View File

@ -28,7 +28,7 @@ limitations under the License. -->
" "
/> />
</div> </div>
<div class="item mb-10" v-if="hasLabel"> <div class="item mb-10">
<span class="label">{{ t("labels") }}</span> <span class="label">{{ t("labels") }}</span>
<el-input <el-input
class="input" class="input"
@ -104,10 +104,6 @@ limitations under the License. -->
topN: props.currentMetricConfig.topN || 10, topN: props.currentMetricConfig.topN || 10,
}); });
const metricTypes = computed(() => dashboardStore.selectedGrid.typesOfMQE || []); const metricTypes = computed(() => dashboardStore.selectedGrid.typesOfMQE || []);
const hasLabel = computed(() => {
const graph = dashboardStore.selectedGrid.graph || {};
return ListChartTypes.includes(graph.type);
});
const isList = computed(() => { const isList = computed(() => {
const graph = dashboardStore.selectedGrid.graph || {}; const graph = dashboardStore.selectedGrid.graph || {};
return ListChartTypes.includes(graph.type); return ListChartTypes.includes(graph.type);

View File

@ -160,7 +160,7 @@ limitations under the License. -->
dashboardStore.selectWidget(props.data); dashboardStore.selectWidget(props.data);
} }
watch( watch(
() => [props.data.metricTypes, props.data.metrics, props.data.expressions], () => props.data.expressions,
() => { () => {
if (!dashboardStore.selectedGrid) { if (!dashboardStore.selectedGrid) {
return; return;