mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-10-15 04:09:14 +00:00
Fix Value Mappings (#423)
This commit is contained in:
@@ -34,6 +34,7 @@ limitations under the License. -->
|
||||
import type { PropType } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { CardConfig, MetricConfigOpt } from "@/types/dashboard";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
/*global defineProps */
|
||||
const props = defineProps({
|
||||
@@ -67,8 +68,13 @@ limitations under the License. -->
|
||||
}
|
||||
const list = Object.keys(valueMappings.value);
|
||||
for (const i of list) {
|
||||
if (new RegExp(i).test(String(singleVal.value))) {
|
||||
return valueMappings.value[i] || singleVal.value;
|
||||
try {
|
||||
if (new RegExp(i).test(String(singleVal.value))) {
|
||||
return valueMappings.value[i] || singleVal.value;
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage.error("invalid regex string");
|
||||
return singleVal.value;
|
||||
}
|
||||
}
|
||||
return singleVal.value;
|
||||
|
@@ -47,6 +47,8 @@ limitations under the License. -->
|
||||
import { computed } from "vue";
|
||||
import type { PropType } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
/*global defineProps */
|
||||
const props = defineProps({
|
||||
data: {
|
||||
@@ -83,8 +85,13 @@ limitations under the License. -->
|
||||
}
|
||||
const list = Object.keys(valueMappings.value);
|
||||
for (const i of list) {
|
||||
if (new RegExp(i).test(String(source))) {
|
||||
return valueMappings.value[i] || source;
|
||||
try {
|
||||
if (new RegExp(i).test(String(source))) {
|
||||
return valueMappings.value[i] || source;
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage.error("invalid regex string");
|
||||
return source;
|
||||
}
|
||||
}
|
||||
return source;
|
||||
|
Reference in New Issue
Block a user