mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 07:05:25 +00:00
rename
This commit is contained in:
parent
d2a17bbfae
commit
18fdd6306c
2
src/types/dashboard.d.ts
vendored
2
src/types/dashboard.d.ts
vendored
@ -123,7 +123,7 @@ export interface CardConfig {
|
||||
fontSize?: number;
|
||||
showUnit?: boolean;
|
||||
textAlign?: "center" | "right" | "left";
|
||||
decorations?: { [key: string]: string };
|
||||
valueMappings?: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface TextConfig {
|
||||
|
@ -32,7 +32,7 @@ limitations under the License. -->
|
||||
:config="{
|
||||
i: 0,
|
||||
...graph,
|
||||
decorations: graph?.decorations,
|
||||
valueMappings: graph?.valueMappings,
|
||||
metricConfig: config.metricConfig,
|
||||
expressions: config.expressions || [],
|
||||
typesOfMQE: typesOfMQE || [],
|
||||
|
@ -39,22 +39,22 @@ limitations under the License. -->
|
||||
|
||||
const dashboardStore = useDashboardStore();
|
||||
const graph = dashboardStore.selectedGrid.graph;
|
||||
const decorations = ref<{ [key: string]: string }>(graph?.valueMappings || {});
|
||||
const keys = ref<string[]>(graph.valueMappings ? Object.keys(decorations.value) : [""]);
|
||||
const valueMappings = ref<{ [key: string]: string }>(graph?.valueMappings || {});
|
||||
const keys = ref<string[]>(graph.valueMappings ? Object.keys(valueMappings.value) : [""]);
|
||||
|
||||
function changeKeys(event: any, index: number) {
|
||||
const params = event.target.textContent || "";
|
||||
const list = Object.keys(decorations.value);
|
||||
const list = Object.keys(valueMappings.value);
|
||||
if (params) {
|
||||
decorations.value[params] = decorations.value[list[index]];
|
||||
valueMappings.value[params] = valueMappings.value[list[index]];
|
||||
}
|
||||
delete decorations.value[list[index]];
|
||||
keys.value = Object.keys(decorations.value);
|
||||
delete valueMappings.value[list[index]];
|
||||
keys.value = Object.keys(valueMappings.value);
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
function changeValues(event: any, key: string) {
|
||||
decorations.value[key] = event.target.textContent || "";
|
||||
valueMappings.value[key] = event.target.textContent || "";
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ limitations under the License. -->
|
||||
if (!keys.value.length) {
|
||||
return;
|
||||
}
|
||||
delete decorations.value[keys.value[index]];
|
||||
delete valueMappings.value[keys.value[index]];
|
||||
keys.value.splice(index, 1);
|
||||
updateConfig();
|
||||
}
|
||||
@ -74,7 +74,7 @@ limitations under the License. -->
|
||||
function updateConfig() {
|
||||
const graph = {
|
||||
...dashboardStore.selectedGrid.graph,
|
||||
valueMappings: decorations.value,
|
||||
valueMappings: valueMappings.value,
|
||||
};
|
||||
dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, graph });
|
||||
}
|
||||
|
@ -48,13 +48,13 @@ limitations under the License. -->
|
||||
showUnit: true,
|
||||
textAlign: "center",
|
||||
metricConfig: [],
|
||||
decorations: {},
|
||||
valueMappings: {},
|
||||
}),
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
const metricConfig = computed(() => props.config.metricConfig || []);
|
||||
const decorations = computed(() => props.config.decorations || {});
|
||||
const valueMappings = computed(() => props.config.valueMappings || {});
|
||||
const key = computed(() => Object.keys(props.data)[0]);
|
||||
const singleVal = computed(() =>
|
||||
Array.isArray(props.data[key.value]) ? props.data[key.value][0] : props.data[key.value],
|
||||
@ -62,11 +62,11 @@ limitations under the License. -->
|
||||
const unit = computed(() => metricConfig.value[0] && encodeURIComponent(metricConfig.value[0].unit || ""));
|
||||
|
||||
function getValue() {
|
||||
if (decorations.value[singleVal.value]) {
|
||||
return decorations.value[singleVal.value];
|
||||
if (valueMappings.value[singleVal.value]) {
|
||||
return valueMappings.value[singleVal.value];
|
||||
}
|
||||
const regex = /-?\d+(\.\d+)?/g;
|
||||
const list = Object.keys(decorations.value);
|
||||
const list = Object.keys(valueMappings.value);
|
||||
for (const i of list) {
|
||||
const k = i.replace(/\s+/g, "");
|
||||
let withinRange = false;
|
||||
@ -81,9 +81,8 @@ limitations under the License. -->
|
||||
} else {
|
||||
withinRange = withinRange && (k.endsWith("+∞)") || Number(singleVal.value) < (ranges[1] || ranges[0]));
|
||||
}
|
||||
console.log(withinRange);
|
||||
if (withinRange) {
|
||||
return decorations.value[i] || singleVal.value;
|
||||
return valueMappings.value[i] || singleVal.value;
|
||||
}
|
||||
}
|
||||
return singleVal.value;
|
||||
|
@ -58,14 +58,14 @@ limitations under the License. -->
|
||||
showTableValues: boolean;
|
||||
tableHeaderCol2: string;
|
||||
typesOfMQE: string[];
|
||||
decorations: {};
|
||||
valueMappings: {};
|
||||
}>,
|
||||
default: () => ({ showTableValues: true }),
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const decorations = computed<{ [key: string]: string }>(() => props.config.decorations || {});
|
||||
const valueMappings = computed<{ [key: string]: string }>(() => props.config.valueMappings || {});
|
||||
const nameWidth = computed(() => (props.config.showTableValues ? 80 : 100));
|
||||
const dataKeys = computed(() => {
|
||||
const keys = Object.keys(props.data || {}).filter(
|
||||
@ -78,11 +78,11 @@ limitations under the License. -->
|
||||
|
||||
function getColValue(keys: string[]) {
|
||||
const source = props.data[(keys as string[]).join(",")][props.data[(keys as string[]).join(",")].length - 1 || 0];
|
||||
if (decorations.value[source]) {
|
||||
return decorations.value[source];
|
||||
if (valueMappings.value[source]) {
|
||||
return valueMappings.value[source];
|
||||
}
|
||||
const regex = /-?\d+(\.\d+)?/g;
|
||||
const list = Object.keys(decorations.value);
|
||||
const list = Object.keys(valueMappings.value);
|
||||
for (const i of list) {
|
||||
const k = i.replace(/\s+/g, "");
|
||||
let withinRange = false;
|
||||
@ -98,7 +98,7 @@ limitations under the License. -->
|
||||
withinRange = withinRange && (k.endsWith("+∞)") || Number(source) < (ranges[1] || ranges[0]));
|
||||
}
|
||||
if (withinRange) {
|
||||
return decorations.value[i];
|
||||
return valueMappings.value[i];
|
||||
}
|
||||
}
|
||||
return source;
|
||||
|
Loading…
Reference in New Issue
Block a user