mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 16:15:25 +00:00
encode text
This commit is contained in:
parent
d5cdbd94d9
commit
94549c2aaa
@ -16,10 +16,12 @@ limitations under the License. -->
|
|||||||
<div class="widget-config flex-v">
|
<div class="widget-config flex-v">
|
||||||
<div class="graph" v-loading="loading">
|
<div class="graph" v-loading="loading">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<span>{{ widget.title || "" }}</span>
|
<span>{{ decodeURIComponent(title) }}</span>
|
||||||
<div class="tips" v-show="widget.tips">
|
<div class="tips" v-show="widget.tips">
|
||||||
<el-tooltip :content="widget.tips || ''">
|
<el-tooltip :content="decodeURIComponent(tips) || ''">
|
||||||
<Icon iconName="info_outline" size="sm" />
|
<span>
|
||||||
|
<Icon iconName="info_outline" size="sm" />
|
||||||
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -113,6 +115,8 @@ export default defineComponent({
|
|||||||
const originConfig = dashboardStore.selectedGrid;
|
const originConfig = dashboardStore.selectedGrid;
|
||||||
const widget = computed(() => dashboardStore.selectedGrid.widget || {});
|
const widget = computed(() => dashboardStore.selectedGrid.widget || {});
|
||||||
const graph = computed(() => dashboardStore.selectedGrid.graph || {});
|
const graph = computed(() => dashboardStore.selectedGrid.graph || {});
|
||||||
|
const title = computed(() => encodeURIComponent(widget.value.title || ""));
|
||||||
|
const tips = computed(() => encodeURIComponent(widget.value.tips || ""));
|
||||||
|
|
||||||
function getSource(source: unknown) {
|
function getSource(source: unknown) {
|
||||||
states.source = source;
|
states.source = source;
|
||||||
@ -152,6 +156,8 @@ export default defineComponent({
|
|||||||
isEdit,
|
isEdit,
|
||||||
widget,
|
widget,
|
||||||
graph,
|
graph,
|
||||||
|
title,
|
||||||
|
tips,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,7 @@ limitations under the License. -->
|
|||||||
v-model="title"
|
v-model="title"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Please input title"
|
placeholder="Please input title"
|
||||||
@change="updateWidgetConfig({ title })"
|
@change="updateWidgetConfig({ title: encodeURIComponent(title) })"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
@ -30,7 +30,7 @@ limitations under the License. -->
|
|||||||
v-model="tips"
|
v-model="tips"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Please input tips"
|
placeholder="Please input tips"
|
||||||
@change="updateWidgetConfig({ tips })"
|
@change="updateWidgetConfig({ tips: encodeURIComponent(tips) })"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -46,10 +46,14 @@ const widget = dashboardStore.selectedGrid.widget || {};
|
|||||||
const title = ref<string>(widget.title || "");
|
const title = ref<string>(widget.title || "");
|
||||||
const tips = ref<string>(widget.tips || "");
|
const tips = ref<string>(widget.tips || "");
|
||||||
|
|
||||||
function updateWidgetConfig(param: { [key: string]: unknown }) {
|
function updateWidgetConfig(param: { [key: string]: string }) {
|
||||||
|
const key = Object.keys(param)[0];
|
||||||
|
if (!key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const widget = {
|
const widget = {
|
||||||
...dashboardStore.selectedGrid.widget,
|
...dashboardStore.selectedGrid.widget,
|
||||||
...param,
|
[key]: decodeURIComponent(param[key]),
|
||||||
};
|
};
|
||||||
dashboardStore.selectWidget({ ...selectedGrid, widget });
|
dashboardStore.selectWidget({ ...selectedGrid, widget });
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ limitations under the License. -->
|
|||||||
v-model="currentMetric.unit"
|
v-model="currentMetric.unit"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Please input unit"
|
placeholder="Please input unit"
|
||||||
@change="changeConfigs(index, { unit: currentMetric.unit })"
|
@change="
|
||||||
|
updateConfig(index, { unit: encodeURIComponent(currentMetric.unit) })
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item mb-10" v-show="metricType === 'readLabeledMetricsValues'">
|
<div class="item mb-10" v-show="metricType === 'readLabeledMetricsValues'">
|
||||||
@ -31,7 +33,11 @@ limitations under the License. -->
|
|||||||
v-model="currentMetric.label"
|
v-model="currentMetric.label"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Please input a name"
|
placeholder="Please input a name"
|
||||||
@change="changeConfigs(index, { label: currentMetric.label })"
|
@change="
|
||||||
|
updateConfig(index, {
|
||||||
|
label: encodeURIComponent(currentMetric.label),
|
||||||
|
})
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item mb-10" v-show="metricType === 'readLabeledMetricsValues'">
|
<div class="item mb-10" v-show="metricType === 'readLabeledMetricsValues'">
|
||||||
@ -42,7 +48,9 @@ limitations under the License. -->
|
|||||||
size="small"
|
size="small"
|
||||||
placeholder="auto"
|
placeholder="auto"
|
||||||
@change="
|
@change="
|
||||||
changeConfigs(index, { labelsIndex: currentMetric.labelsIndex })
|
updateConfig(index, {
|
||||||
|
labelsIndex: encodeURIComponent(currentMetric.labelsIndex),
|
||||||
|
})
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -108,13 +116,21 @@ const metricType = ref<string>(metricTypes[props.index]);
|
|||||||
const isTopn = computed(() =>
|
const isTopn = computed(() =>
|
||||||
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
|
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
|
||||||
);
|
);
|
||||||
|
function updateConfig(index: number, param: { [key: string]: string }) {
|
||||||
|
const key = Object.keys(param)[0];
|
||||||
|
if (!key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
changeConfigs(index, { key: decodeURIComponent(param[key]) });
|
||||||
|
}
|
||||||
function changeConfigs(
|
function changeConfigs(
|
||||||
index: number,
|
index: number,
|
||||||
param: { [key: string]: string | number }
|
param: { [key: string]: string | number }
|
||||||
) {
|
) {
|
||||||
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,
|
||||||
|
@ -22,13 +22,14 @@ limitations under the License. -->
|
|||||||
>
|
>
|
||||||
{{ singleVal.toFixed(2) }}
|
{{ singleVal.toFixed(2) }}
|
||||||
<span v-show="config.showUnit">
|
<span v-show="config.showUnit">
|
||||||
{{ metricConfig[0]?.unit }}
|
{{ decodeURIComponent(unit) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="center no-data" v-else>No Data</div>
|
<div class="center no-data" v-else>{{ t("noData") }}</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, PropType } from "vue";
|
import { computed, PropType } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
import { CardConfig, MetricConfigOpt } from "@/types/dashboard";
|
import { CardConfig, MetricConfigOpt } from "@/types/dashboard";
|
||||||
|
|
||||||
/*global defineProps */
|
/*global defineProps */
|
||||||
@ -47,9 +48,13 @@ const props = defineProps({
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const { t } = useI18n();
|
||||||
const metricConfig = computed(() => props.config.metricConfig || []);
|
const metricConfig = computed(() => props.config.metricConfig || []);
|
||||||
const key = computed(() => Object.keys(props.data)[0]);
|
const key = computed(() => Object.keys(props.data)[0]);
|
||||||
const singleVal = computed(() => Number(props.data[key.value]));
|
const singleVal = computed(() => Number(props.data[key.value]));
|
||||||
|
const unit = computed(
|
||||||
|
() => metricConfig.value[0] && encodeURIComponent(metricConfig.value[0].unit)
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.chart-card {
|
.chart-card {
|
||||||
|
Loading…
Reference in New Issue
Block a user