mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 22:04:30 +00:00
fix: update style and set labels (#50)
This commit is contained in:
parent
b51e423c2b
commit
63d21becde
@ -34,7 +34,8 @@ limitations under the License. -->
|
|||||||
<el-popover
|
<el-popover
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
width="250"
|
width="250"
|
||||||
placement="left-end"
|
placement="bottom"
|
||||||
|
effect="light"
|
||||||
:content="appStore.version"
|
:content="appStore.version"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
|
@ -37,8 +37,6 @@ limitations under the License. -->
|
|||||||
metricTypes: dashboardStore.selectedGrid.metricTypes,
|
metricTypes: dashboardStore.selectedGrid.metricTypes,
|
||||||
metricConfig: dashboardStore.selectedGrid.metricConfig,
|
metricConfig: dashboardStore.selectedGrid.metricConfig,
|
||||||
}"
|
}"
|
||||||
:isEdit="isEdit"
|
|
||||||
@changeOpt="setStatus"
|
|
||||||
/>
|
/>
|
||||||
<div v-show="!graph.type" class="no-data">
|
<div v-show="!graph.type" class="no-data">
|
||||||
{{ t("noData") }}
|
{{ t("noData") }}
|
||||||
@ -51,11 +49,7 @@ limitations under the License. -->
|
|||||||
:style="{ '--el-collapse-header-font-size': '15px' }"
|
:style="{ '--el-collapse-header-font-size': '15px' }"
|
||||||
>
|
>
|
||||||
<el-collapse-item :title="t('selectVisualization')" name="1">
|
<el-collapse-item :title="t('selectVisualization')" name="1">
|
||||||
<MetricOptions
|
<MetricOptions @update="getSource" @loading="setLoading" />
|
||||||
@update="getSource"
|
|
||||||
@changeOpt="setStatus"
|
|
||||||
@loading="setLoading"
|
|
||||||
/>
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="t('graphStyles')" name="2">
|
<el-collapse-item :title="t('graphStyles')" name="2">
|
||||||
<component :is="`${graph.type}Config`" />
|
<component :is="`${graph.type}Config`" />
|
||||||
@ -100,7 +94,6 @@ export default defineComponent({
|
|||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const appStoreWithOut = useAppStoreWithOut();
|
const appStoreWithOut = useAppStoreWithOut();
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const isEdit = ref<boolean>(false);
|
|
||||||
const states = reactive<{
|
const states = reactive<{
|
||||||
activeNames: string;
|
activeNames: string;
|
||||||
source: unknown;
|
source: unknown;
|
||||||
@ -128,14 +121,9 @@ export default defineComponent({
|
|||||||
|
|
||||||
function applyConfig() {
|
function applyConfig() {
|
||||||
dashboardStore.setConfigPanel(false);
|
dashboardStore.setConfigPanel(false);
|
||||||
setStatus();
|
|
||||||
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStatus() {
|
|
||||||
isEdit.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelConfig() {
|
function cancelConfig() {
|
||||||
dashboardStore.selectWidget(originConfig);
|
dashboardStore.selectWidget(originConfig);
|
||||||
dashboardStore.setConfigPanel(false);
|
dashboardStore.setConfigPanel(false);
|
||||||
@ -152,8 +140,6 @@ export default defineComponent({
|
|||||||
cancelConfig,
|
cancelConfig,
|
||||||
getSource,
|
getSource,
|
||||||
setLoading,
|
setLoading,
|
||||||
setStatus,
|
|
||||||
isEdit,
|
|
||||||
widget,
|
widget,
|
||||||
graph,
|
graph,
|
||||||
title,
|
title,
|
||||||
|
@ -120,7 +120,7 @@ import Standard from "./Standard.vue";
|
|||||||
|
|
||||||
/*global defineEmits */
|
/*global defineEmits */
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const emit = defineEmits(["update", "loading", "changeOpt"]);
|
const emit = defineEmits(["update", "loading"]);
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const metrics = computed(() => dashboardStore.selectedGrid.metrics || []);
|
const metrics = computed(() => dashboardStore.selectedGrid.metrics || []);
|
||||||
const graph = computed(() => dashboardStore.selectedGrid.graph || {});
|
const graph = computed(() => dashboardStore.selectedGrid.graph || {});
|
||||||
@ -308,7 +308,6 @@ function changeMetrics(
|
|||||||
...{ metricTypes: states.metricTypes, metrics: states.metrics },
|
...{ metricTypes: states.metricTypes, metrics: states.metrics },
|
||||||
});
|
});
|
||||||
if (states.isList) {
|
if (states.isList) {
|
||||||
emit("changeOpt");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
queryMetrics();
|
queryMetrics();
|
||||||
@ -339,7 +338,6 @@ function changeMetricType(index: number, opt: Option[] | any) {
|
|||||||
...{ metricTypes: states.metricTypes },
|
...{ metricTypes: states.metricTypes },
|
||||||
});
|
});
|
||||||
if (states.isList) {
|
if (states.isList) {
|
||||||
emit("changeOpt");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
queryMetrics();
|
queryMetrics();
|
||||||
|
@ -26,7 +26,7 @@ limitations under the License. -->
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item mb-10" v-show="metricType === 'readLabeledMetricsValues'">
|
<div class="item mb-10" v-if="hasLabel">
|
||||||
<span class="label">{{ t("labels") }}</span>
|
<span class="label">{{ t("labels") }}</span>
|
||||||
<el-input
|
<el-input
|
||||||
class="input"
|
class="input"
|
||||||
@ -40,7 +40,7 @@ limitations under the License. -->
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item mb-10" v-show="metricType === 'readLabeledMetricsValues'">
|
<div class="item mb-10" v-if="metricType === 'readLabeledMetricsValues'">
|
||||||
<span class="label">{{ t("labelsIndex") }}</span>
|
<span class="label">{{ t("labelsIndex") }}</span>
|
||||||
<el-input
|
<el-input
|
||||||
class="input"
|
class="input"
|
||||||
@ -95,6 +95,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";
|
||||||
|
|
||||||
/*global defineEmits, defineProps */
|
/*global defineEmits, defineProps */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -113,6 +114,13 @@ const currentMetric = ref<MetricConfigOpt>({
|
|||||||
});
|
});
|
||||||
const metricTypes = dashboardStore.selectedGrid.metricTypes || [];
|
const metricTypes = dashboardStore.selectedGrid.metricTypes || [];
|
||||||
const metricType = ref<string>(metricTypes[props.index]);
|
const metricType = ref<string>(metricTypes[props.index]);
|
||||||
|
const hasLabel = computed(() => {
|
||||||
|
const graph = dashboardStore.selectedGrid.graph || {};
|
||||||
|
return (
|
||||||
|
ListChartTypes.includes(graph.type) ||
|
||||||
|
metricType.value === "readLabeledMetricsValues"
|
||||||
|
);
|
||||||
|
});
|
||||||
const isTopn = computed(() =>
|
const isTopn = computed(() =>
|
||||||
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
|
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
|
||||||
);
|
);
|
||||||
@ -121,7 +129,7 @@ function updateConfig(index: number, param: { [key: string]: string }) {
|
|||||||
if (!key) {
|
if (!key) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeConfigs(index, { key: decodeURIComponent(param[key]) });
|
changeConfigs(index, { [key]: decodeURIComponent(param[key]) });
|
||||||
}
|
}
|
||||||
function changeConfigs(
|
function changeConfigs(
|
||||||
index: number,
|
index: number,
|
||||||
@ -130,7 +138,6 @@ function changeConfigs(
|
|||||||
const metricConfig = dashboardStore.selectedGrid.metricConfig || [];
|
const metricConfig = dashboardStore.selectedGrid.metricConfig || [];
|
||||||
|
|
||||||
metricConfig[index] = { ...metricConfig[index], ...param };
|
metricConfig[index] = { ...metricConfig[index], ...param };
|
||||||
currentMetric.value = metricConfig[index];
|
|
||||||
dashboardStore.selectWidget({
|
dashboardStore.selectWidget({
|
||||||
...dashboardStore.selectedGrid,
|
...dashboardStore.selectedGrid,
|
||||||
metricConfig,
|
metricConfig,
|
||||||
|
@ -44,7 +44,9 @@ limitations under the License. -->
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="(metric, index) in colMetrics"
|
v-for="(metric, index) in colMetrics"
|
||||||
:label="`${metric} ${decodeURIComponent(getUnit(index))}`"
|
:label="`${decodeURIComponent(
|
||||||
|
getLabel(metric, index)
|
||||||
|
)} ${decodeURIComponent(getUnit(index))}`"
|
||||||
:key="metric + index"
|
:key="metric + index"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -110,7 +112,6 @@ const props = defineProps({
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
|
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
|
||||||
isEdit: { type: Boolean, default: false },
|
|
||||||
});
|
});
|
||||||
// const emit = defineEmits(["changeOpt"]);
|
// const emit = defineEmits(["changeOpt"]);
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
@ -183,20 +184,28 @@ async function searchList() {
|
|||||||
}
|
}
|
||||||
function getUnit(index: number) {
|
function getUnit(index: number) {
|
||||||
const u =
|
const u =
|
||||||
(props.config.metricConfig &&
|
props.config.metricConfig &&
|
||||||
props.config.metricConfig[index] &&
|
props.config.metricConfig[index] &&
|
||||||
props.config.metricConfig[index].unit) ||
|
props.config.metricConfig[index].unit;
|
||||||
"";
|
|
||||||
if (u) {
|
if (u) {
|
||||||
return `(${encodeURIComponent(u)})`;
|
return `(${encodeURIComponent(u)})`;
|
||||||
}
|
}
|
||||||
return encodeURIComponent("");
|
return encodeURIComponent("");
|
||||||
}
|
}
|
||||||
|
function getLabel(metric: string, index: number) {
|
||||||
|
const label =
|
||||||
|
props.config.metricConfig &&
|
||||||
|
props.config.metricConfig[index] &&
|
||||||
|
props.config.metricConfig[index].label;
|
||||||
|
if (label) {
|
||||||
|
return encodeURIComponent(label);
|
||||||
|
}
|
||||||
|
return encodeURIComponent(metric);
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => [props.config.metricTypes, props.config.metrics],
|
() => [props.config.metricTypes, props.config.metrics],
|
||||||
async () => {
|
async () => {
|
||||||
queryEndpointMetrics(endpoints.value);
|
queryEndpointMetrics(endpoints.value);
|
||||||
// emit("changeOpt", false);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
watch(
|
watch(
|
||||||
|
@ -44,7 +44,9 @@ limitations under the License. -->
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="(metric, index) in colMetrics"
|
v-for="(metric, index) in colMetrics"
|
||||||
:label="`${metric} ${decodeURIComponent(getUnit(index))}`"
|
:label="`${decodeURIComponent(
|
||||||
|
getLabel(metric, index)
|
||||||
|
)} ${decodeURIComponent(getUnit(index))}`"
|
||||||
:key="metric + index"
|
:key="metric + index"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -234,16 +236,26 @@ function searchList() {
|
|||||||
|
|
||||||
function getUnit(index: number) {
|
function getUnit(index: number) {
|
||||||
const u =
|
const u =
|
||||||
(props.config.metricConfig &&
|
props.config.metricConfig &&
|
||||||
props.config.metricConfig[index] &&
|
props.config.metricConfig[index] &&
|
||||||
props.config.metricConfig[index].unit) ||
|
props.config.metricConfig[index].unit;
|
||||||
"";
|
|
||||||
if (u) {
|
if (u) {
|
||||||
return `(${encodeURIComponent(u)})`;
|
return `(${encodeURIComponent(u)})`;
|
||||||
}
|
}
|
||||||
return encodeURIComponent("");
|
return encodeURIComponent("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLabel(metric: string, index: number) {
|
||||||
|
const label =
|
||||||
|
props.config.metricConfig &&
|
||||||
|
props.config.metricConfig[index] &&
|
||||||
|
props.config.metricConfig[index].label;
|
||||||
|
if (label) {
|
||||||
|
return encodeURIComponent(label);
|
||||||
|
}
|
||||||
|
return encodeURIComponent(metric);
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.config.metricTypes, props.config.metrics],
|
() => [props.config.metricTypes, props.config.metrics],
|
||||||
() => {
|
() => {
|
||||||
|
@ -56,7 +56,9 @@ limitations under the License. -->
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="(metric, index) in colMetrics"
|
v-for="(metric, index) in colMetrics"
|
||||||
:label="`${metric} ${decodeURIComponent(getUnit(index))}`"
|
:label="`${decodeURIComponent(
|
||||||
|
getLabel(metric, index)
|
||||||
|
)} ${decodeURIComponent(getUnit(index))}`"
|
||||||
:key="metric + index"
|
:key="metric + index"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -276,15 +278,24 @@ function searchList() {
|
|||||||
}
|
}
|
||||||
function getUnit(index: number) {
|
function getUnit(index: number) {
|
||||||
const u =
|
const u =
|
||||||
(props.config.metricConfig &&
|
props.config.metricConfig &&
|
||||||
props.config.metricConfig[index] &&
|
props.config.metricConfig[index] &&
|
||||||
props.config.metricConfig[index].unit) ||
|
props.config.metricConfig[index].unit;
|
||||||
"";
|
|
||||||
if (u) {
|
if (u) {
|
||||||
return `(${encodeURIComponent(u)})`;
|
return `(${encodeURIComponent(u)})`;
|
||||||
}
|
}
|
||||||
return encodeURIComponent("");
|
return encodeURIComponent("");
|
||||||
}
|
}
|
||||||
|
function getLabel(metric: string, index: number) {
|
||||||
|
const label =
|
||||||
|
props.config.metricConfig &&
|
||||||
|
props.config.metricConfig[index] &&
|
||||||
|
props.config.metricConfig[index].label;
|
||||||
|
if (label) {
|
||||||
|
return encodeURIComponent(label);
|
||||||
|
}
|
||||||
|
return encodeURIComponent(metric);
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => [props.config.metricTypes, props.config.metrics],
|
() => [props.config.metricTypes, props.config.metrics],
|
||||||
() => {
|
() => {
|
||||||
|
@ -98,7 +98,7 @@ limitations under the License. -->
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-tooltip content="Apply" placement="bottom">
|
<el-tooltip content="Apply" placement="bottom" effect="light">
|
||||||
<i @click="applyDashboard">
|
<i @click="applyDashboard">
|
||||||
<Icon class="icon-btn" size="sm" iconName="save" />
|
<Icon class="icon-btn" size="sm" iconName="save" />
|
||||||
</i>
|
</i>
|
||||||
|
Loading…
Reference in New Issue
Block a user