mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 16:54:52 +00:00
fix: optimize metrics association (#196)
This commit is contained in:
parent
d4dde7e73b
commit
221751f034
@ -16,13 +16,13 @@ limitations under the License. -->
|
|||||||
<div class="chart" ref="chartRef" :style="`height:${height};width:${width};`">
|
<div class="chart" ref="chartRef" :style="`height:${height};width:${width};`">
|
||||||
<div v-if="!available" class="no-data">No Data</div>
|
<div v-if="!available" class="no-data">No Data</div>
|
||||||
<div class="menus" v-show="visMenus" ref="menus">
|
<div class="menus" v-show="visMenus" ref="menus">
|
||||||
<div class="tools" @click="associateMetrics">
|
<div class="tools" @click="associateMetrics" v-if="associate.length">
|
||||||
{{ t("associateMetrics") }}
|
{{ t("associateMetrics") }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="tools"
|
class="tools"
|
||||||
@click="viewTrace"
|
@click="viewTrace"
|
||||||
v-if="props.relatedTrace && props.relatedTrace.enableRelate"
|
v-if="relatedTrace && relatedTrace.enableRelate"
|
||||||
>
|
>
|
||||||
{{ t("viewTrace") }}
|
{{ t("viewTrace") }}
|
||||||
</div>
|
</div>
|
||||||
@ -33,6 +33,7 @@ limitations under the License. -->
|
|||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
:before-close="() => (showTrace = false)"
|
:before-close="() => (showTrace = false)"
|
||||||
:append-to-body="true"
|
:append-to-body="true"
|
||||||
|
title="The Related Traces"
|
||||||
>
|
>
|
||||||
<Trace :data="traceOptions" />
|
<Trace :data="traceOptions" />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
@ -84,6 +85,10 @@ const props = defineProps({
|
|||||||
relatedTrace: {
|
relatedTrace: {
|
||||||
type: Object as PropType<RelatedTrace>,
|
type: Object as PropType<RelatedTrace>,
|
||||||
},
|
},
|
||||||
|
associate: {
|
||||||
|
type: Array as PropType<{ widgetId: string }[]>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const available = computed(
|
const available = computed(
|
||||||
() =>
|
() =>
|
||||||
@ -113,15 +118,15 @@ function instanceEvent() {
|
|||||||
visMenus.value = true;
|
visMenus.value = true;
|
||||||
const w = chartRef.value.getBoundingClientRect().width || 0;
|
const w = chartRef.value.getBoundingClientRect().width || 0;
|
||||||
const h = chartRef.value.getBoundingClientRect().height || 0;
|
const h = chartRef.value.getBoundingClientRect().height || 0;
|
||||||
if (w - params.event.offsetX > 125) {
|
if (w - params.event.offsetX > 120) {
|
||||||
menus.value.style.left = params.event.offsetX + "px";
|
menus.value.style.left = params.event.offsetX + "px";
|
||||||
} else {
|
} else {
|
||||||
menus.value.style.left = params.event.offsetX - 125 + "px";
|
menus.value.style.left = params.event.offsetX - 120 + "px";
|
||||||
}
|
}
|
||||||
if (h - params.event.offsetY < 60) {
|
if (h - params.event.offsetY < 50) {
|
||||||
menus.value.style.top = params.event.offsetY - 60 + "px";
|
menus.value.style.top = params.event.offsetY - 40 + "px";
|
||||||
} else {
|
} else {
|
||||||
menus.value.style.top = params.event.offsetY + 5 + "px";
|
menus.value.style.top = params.event.offsetY + 2 + "px";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
@ -143,11 +148,14 @@ function instanceEvent() {
|
|||||||
|
|
||||||
function associateMetrics() {
|
function associateMetrics() {
|
||||||
emits("select", currentParams.value);
|
emits("select", currentParams.value);
|
||||||
visMenus.value = true;
|
const { dataIndex, seriesIndex } = currentParams.value || {
|
||||||
updateOptions();
|
dataIndex: 0,
|
||||||
|
seriesIndex: 0,
|
||||||
|
};
|
||||||
|
updateOptions({ dataIndex, seriesIndex });
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateOptions() {
|
function updateOptions(params?: { dataIndex: number; seriesIndex: number }) {
|
||||||
const instance = getInstance();
|
const instance = getInstance();
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
return;
|
return;
|
||||||
@ -162,8 +170,14 @@ function updateOptions() {
|
|||||||
} else {
|
} else {
|
||||||
instance.dispatchAction({
|
instance.dispatchAction({
|
||||||
type: "updateAxisPointer",
|
type: "updateAxisPointer",
|
||||||
dataIndex: props.filters.dataIndex,
|
dataIndex: params ? params.dataIndex : props.filters.dataIndex,
|
||||||
seriesIndex: 0,
|
seriesIndex: params ? params.seriesIndex : 0,
|
||||||
|
});
|
||||||
|
const ids = props.option.series.map((_: unknown, index: number) => index);
|
||||||
|
instance.dispatchAction({
|
||||||
|
type: "highlight",
|
||||||
|
dataIndex: params ? params.dataIndex : props.filters.dataIndex,
|
||||||
|
seriesIndex: ids,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,8 @@ pre {
|
|||||||
|
|
||||||
.el-drawer__header {
|
.el-drawer__header {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
padding-left: 10px;
|
||||||
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-drawer__body {
|
.el-drawer__body {
|
||||||
|
@ -85,7 +85,7 @@ const Status = [
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const { graph, relatedTrace } = dashboardStore.selectedGrid;
|
const { graph, relatedTrace } = dashboardStore.selectedGrid;
|
||||||
const traceOpt = (relatedTrace && relatedTrace.traceOpt) || {};
|
const traceOpt = relatedTrace || {};
|
||||||
const status = ref<string>(traceOpt.status || Status[0].value);
|
const status = ref<string>(traceOpt.status || Status[0].value);
|
||||||
const queryOrder = ref<string>(traceOpt.queryOrder || QueryOrders[0].value);
|
const queryOrder = ref<string>(traceOpt.queryOrder || QueryOrders[0].value);
|
||||||
const latency = ref<boolean>(traceOpt.latency || false);
|
const latency = ref<boolean>(traceOpt.latency || false);
|
||||||
|
@ -65,6 +65,7 @@ limitations under the License. -->
|
|||||||
metricConfig: data.metricConfig || [],
|
metricConfig: data.metricConfig || [],
|
||||||
filters: data.filters || {},
|
filters: data.filters || {},
|
||||||
relatedTrace: data.relatedTrace || {},
|
relatedTrace: data.relatedTrace || {},
|
||||||
|
associate: data.associate || [],
|
||||||
}"
|
}"
|
||||||
:needQuery="needQuery"
|
:needQuery="needQuery"
|
||||||
@click="clickHandle"
|
@click="clickHandle"
|
||||||
|
@ -45,6 +45,7 @@ defineProps({
|
|||||||
filters: Filters;
|
filters: Filters;
|
||||||
relatedTrace: RelatedTrace;
|
relatedTrace: RelatedTrace;
|
||||||
id: string;
|
id: string;
|
||||||
|
associate: { widgetId: string }[];
|
||||||
}
|
}
|
||||||
>,
|
>,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
|
@ -14,7 +14,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="graph" :class="isRight ? 'flex-h' : 'flex-v'">
|
<div class="graph" :class="isRight ? 'flex-h' : 'flex-v'">
|
||||||
<Graph :option="option" @select="clickEvent" :filters="config.filters" />
|
<Graph
|
||||||
|
:option="option"
|
||||||
|
@select="clickEvent"
|
||||||
|
:filters="config.filters"
|
||||||
|
:associate="config.associate || []"
|
||||||
|
/>
|
||||||
<Legend :config="config.legend" :data="data" :intervalTime="intervalTime" />
|
<Legend :config="config.legend" :data="data" :intervalTime="intervalTime" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -44,6 +49,7 @@ const props = defineProps({
|
|||||||
filters: Filters;
|
filters: Filters;
|
||||||
relatedTrace: RelatedTrace;
|
relatedTrace: RelatedTrace;
|
||||||
id: string;
|
id: string;
|
||||||
|
associate: { widgetId: string }[];
|
||||||
}
|
}
|
||||||
>,
|
>,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
|
@ -19,6 +19,7 @@ limitations under the License. -->
|
|||||||
@select="clickEvent"
|
@select="clickEvent"
|
||||||
:filters="config.filters"
|
:filters="config.filters"
|
||||||
:relatedTrace="config.relatedTrace"
|
:relatedTrace="config.relatedTrace"
|
||||||
|
:associate="config.associate || []"
|
||||||
/>
|
/>
|
||||||
<Legend :config="config.legend" :data="data" :intervalTime="intervalTime" />
|
<Legend :config="config.legend" :data="data" :intervalTime="intervalTime" />
|
||||||
</div>
|
</div>
|
||||||
@ -50,6 +51,7 @@ const props = defineProps({
|
|||||||
filters?: Filters;
|
filters?: Filters;
|
||||||
relatedTrace?: RelatedTrace;
|
relatedTrace?: RelatedTrace;
|
||||||
id?: string;
|
id?: string;
|
||||||
|
associate: { widgetId: string }[];
|
||||||
}
|
}
|
||||||
>,
|
>,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
|
@ -58,6 +58,7 @@ limitations under the License. -->
|
|||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
:before-close="() => (showTrace = false)"
|
:before-close="() => (showTrace = false)"
|
||||||
:append-to-body="true"
|
:append-to-body="true"
|
||||||
|
title="The Related Traces"
|
||||||
>
|
>
|
||||||
<Trace :data="traceOptions" />
|
<Trace :data="traceOptions" />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License. -->
|
|||||||
<el-input size="small" v-model="traceId" class="trace-id" />
|
<el-input size="small" v-model="traceId" class="trace-id" />
|
||||||
</div>
|
</div>
|
||||||
<div class="conditions flex-h" v-else>
|
<div class="conditions flex-h" v-else>
|
||||||
<el-radio-group v-model="conditions" @change="changeCondition">
|
<el-radio-group v-model="conditions" @change="changeCondition" size="small">
|
||||||
<el-radio-button
|
<el-radio-button
|
||||||
v-for="(item, index) in items"
|
v-for="(item, index) in items"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
|
Loading…
Reference in New Issue
Block a user