mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 13:15:24 +00:00
fix config
This commit is contained in:
parent
7ddd719205
commit
9f64086d51
@ -13,10 +13,23 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. -->
|
||||
<template>
|
||||
<div ref="chartRef" :style="`height:${height};width:${width};`"></div>
|
||||
<div
|
||||
v-if="isRight"
|
||||
ref="chartRef"
|
||||
:style="`height:${height};width:${width};`"
|
||||
></div>
|
||||
<div v-else>No Data</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { watch, ref, Ref, onMounted, onBeforeUnmount, unref } from "vue";
|
||||
import {
|
||||
watch,
|
||||
ref,
|
||||
Ref,
|
||||
onMounted,
|
||||
onBeforeUnmount,
|
||||
unref,
|
||||
computed,
|
||||
} from "vue";
|
||||
import type { PropType } from "vue";
|
||||
import { useECharts } from "@/hooks/useEcharts";
|
||||
import { addResizeListener, removeResizeListener } from "@/utils/event";
|
||||
@ -31,12 +44,16 @@ const props = defineProps({
|
||||
height: { type: String, default: "100%" },
|
||||
width: { type: String, default: "100%" },
|
||||
option: {
|
||||
type: Object as PropType<{ [key: string]: unknown }>,
|
||||
type: Object as PropType<{ [key: string]: any }>,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const isRight = computed(
|
||||
() =>
|
||||
props.option.series && props.option.series[0] && props.option.series[0].data
|
||||
);
|
||||
onMounted(async () => {
|
||||
console.log(props.option);
|
||||
await setOptions(props.option);
|
||||
chartRef.value && addResizeListener(unref(chartRef), resize);
|
||||
setTimeout(() => {
|
||||
|
@ -103,13 +103,10 @@ const currentMetric = ref<MetricConfigOpt>({
|
||||
...props.currentMetricConfig,
|
||||
topN: props.currentMetricConfig.topN || 10,
|
||||
});
|
||||
const metricType = ref<string>(
|
||||
dashboardStore.selectedGrid.metricTypes[props.index]
|
||||
);
|
||||
const metricTypes = dashboardStore.selectedGrid.metricTypes || [];
|
||||
const metricType = ref<string>(metricTypes[props.index]);
|
||||
const isTopn = computed(() =>
|
||||
["sortMetrics", "readSampledRecords"].includes(
|
||||
dashboardStore.selectedGrid.metricTypes[props.index]
|
||||
)
|
||||
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
|
||||
);
|
||||
function changeConfigs(
|
||||
index: number,
|
||||
|
@ -15,21 +15,17 @@ limitations under the License. -->
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="!isNaN(singleVal)"
|
||||
class="chart-card"
|
||||
:class="{ center: config.textAlign === 'center' }"
|
||||
:style="{ fontSize: `${config.fontSize}px`, textAlign: config.textAlign }"
|
||||
>
|
||||
{{
|
||||
typeof singleVal === "string"
|
||||
? singleVal
|
||||
: isNaN(singleVal)
|
||||
? null
|
||||
: singleVal.toFixed(2)
|
||||
}}
|
||||
{{ singleVal.toFixed(2) }}
|
||||
<span v-show="config.showUnit">
|
||||
{{ metricConfig[0]?.unit }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="center chart-card" v-else>No Data</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed, PropType } from "vue";
|
||||
@ -53,7 +49,7 @@ const props = defineProps({
|
||||
});
|
||||
const metricConfig = computed(() => props.config.metricConfig || []);
|
||||
const key = computed(() => Object.keys(props.data)[0]);
|
||||
const singleVal = computed(() => props.data[key.value]);
|
||||
const singleVal = computed(() => Number(props.data[key.value]));
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.chart-card {
|
||||
|
Loading…
Reference in New Issue
Block a user