mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-12 15:52:57 +00:00
update
This commit is contained in:
parent
f152520d4e
commit
46e9e850c8
@ -17,7 +17,7 @@
|
|||||||
import type { MetricsResults } from "@/types/dashboard";
|
import type { MetricsResults } from "@/types/dashboard";
|
||||||
import { TestJson } from "./data";
|
import { TestJson } from "./data";
|
||||||
|
|
||||||
export function useSnapshot(params: { name: string; results: MetricsResults[] }[]) {
|
export function useSnapshot(p: { name: string; results: MetricsResults[] }[]) {
|
||||||
const { metrics } = TestJson.snapshot as any;
|
const { metrics } = TestJson.snapshot as any;
|
||||||
function processResults() {
|
function processResults() {
|
||||||
const sources = metrics.map((metric: { name: string; results: MetricsResults[] }) => {
|
const sources = metrics.map((metric: { name: string; results: MetricsResults[] }) => {
|
||||||
@ -48,8 +48,10 @@ export function useSnapshot(params: { name: string; results: MetricsResults[] }[
|
|||||||
if (!item.metric.labels.length) {
|
if (!item.metric.labels.length) {
|
||||||
metricsMap[metric.name] = arr;
|
metricsMap[metric.name] = arr;
|
||||||
} else {
|
} else {
|
||||||
const label = item.metric.labels[0];
|
const name = item.metric.labels
|
||||||
metricsMap[`${label.key}=${label.value}`] = arr;
|
.map((label: { key: string; value: string }) => `${label.key}=${label.value}`)
|
||||||
|
.join(",");
|
||||||
|
metricsMap[name] = arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
src/types/dashboard.d.ts
vendored
1
src/types/dashboard.d.ts
vendored
@ -112,6 +112,7 @@ export interface LineConfig extends AreaConfig {
|
|||||||
smallTips?: boolean;
|
smallTips?: boolean;
|
||||||
showlabels?: boolean;
|
showlabels?: boolean;
|
||||||
noTooltips?: boolean;
|
noTooltips?: boolean;
|
||||||
|
showLegend?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AreaConfig {
|
export interface AreaConfig {
|
||||||
|
@ -43,6 +43,7 @@ limitations under the License. -->
|
|||||||
smallTips: false,
|
smallTips: false,
|
||||||
showlabels: false,
|
showlabels: false,
|
||||||
noTooltips: true,
|
noTooltips: true,
|
||||||
|
showLegend: false,
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -167,8 +168,10 @@ limitations under the License. -->
|
|||||||
|
|
||||||
function handleMetrics(snapshot: { metrics: { name: string; results: MetricsResults[] }[] }) {
|
function handleMetrics(snapshot: { metrics: { name: string; results: MetricsResults[] }[] }) {
|
||||||
const { getMetricsMap } = useSnapshot(snapshot.metrics);
|
const { getMetricsMap } = useSnapshot(snapshot.metrics);
|
||||||
|
const metrics = getMetricsMap();
|
||||||
|
const keys = Object.keys(metrics);
|
||||||
|
|
||||||
return getMetricsMap();
|
return { [keys[0]]: metrics[keys[0]] };
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -253,9 +256,6 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
.alarm-detail {
|
.alarm-detail {
|
||||||
max-height: 600px;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -45,12 +45,12 @@ limitations under the License. -->
|
|||||||
const yAxis = [];
|
const yAxis = [];
|
||||||
for (const [index, metric] of props.data.entries()) {
|
for (const [index, metric] of props.data.entries()) {
|
||||||
grid.push({
|
grid.push({
|
||||||
top: index ? (600 / props.data.length) * index + 30 : 40,
|
top: 300 * index + 30,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 5,
|
bottom: 5,
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
height: 600 / props.data.length - 30,
|
height: 260,
|
||||||
});
|
});
|
||||||
xAxis.push({
|
xAxis.push({
|
||||||
type: "category",
|
type: "category",
|
||||||
|
@ -14,10 +14,15 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="snapshot flex-v">
|
<div class="snapshot flex-v">
|
||||||
<LineChart :intervalTime="appStore.intervalTime" :data="processResults()" />
|
<LineChart
|
||||||
|
:intervalTime="appStore.intervalTime"
|
||||||
|
:data="metrics"
|
||||||
|
:style="{ width: `800px`, height: `${metrics.length * 300}px` }"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { computed } from "vue";
|
||||||
import { useSnapshot } from "@/hooks/useSnapshot";
|
import { useSnapshot } from "@/hooks/useSnapshot";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
import LineChart from "./Line.vue";
|
import LineChart from "./Line.vue";
|
||||||
@ -27,11 +32,6 @@ limitations under the License. -->
|
|||||||
snapshot: { type: Object, default: () => {} },
|
snapshot: { type: Object, default: () => {} },
|
||||||
});
|
});
|
||||||
const { processResults } = useSnapshot(props.snapshot.metrics);
|
const { processResults } = useSnapshot(props.snapshot.metrics);
|
||||||
|
const metrics = computed(() => processResults());
|
||||||
const appStore = useAppStoreWithOut();
|
const appStore = useAppStoreWithOut();
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
|
||||||
.snapshot {
|
|
||||||
width: 800px;
|
|
||||||
height: 600px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -61,6 +61,7 @@ limitations under the License. -->
|
|||||||
smallTips: false,
|
smallTips: false,
|
||||||
showlabels: true,
|
showlabels: true,
|
||||||
noTooltips: false,
|
noTooltips: false,
|
||||||
|
showLegend: true,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -129,7 +130,7 @@ limitations under the License. -->
|
|||||||
tooltip: props.config.smallTips ? tips : tooltip,
|
tooltip: props.config.smallTips ? tips : tooltip,
|
||||||
legend: {
|
legend: {
|
||||||
type: "scroll",
|
type: "scroll",
|
||||||
show: showEchartsLegend(keys),
|
show: props.config.showLegend ? showEchartsLegend(keys) : false,
|
||||||
icon: "circle",
|
icon: "circle",
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user