-
+
{{ t("sortOrder") }}
@change="changeConfigs(index, { sortOrder: $event })"
/>
+
+ {{ t("maxItemNum") }}
+
+
diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts
index 4e89cae9..9c579027 100644
--- a/src/views/dashboard/data.ts
+++ b/src/views/dashboard/data.ts
@@ -77,6 +77,7 @@ export const DefaultGraphConfig: { [key: string]: any } = {
},
TopList: {
type: "TopList",
+ color: "purple",
},
InstanceList: {
type: "InstanceList",
@@ -263,6 +264,7 @@ export const TextColors: { [key: string]: string } = {
white: "#fff",
black: "#000",
orange: "#E6A23C",
+ purple: "#bf99f8",
};
export const CalculationOpts = [
diff --git a/src/views/dashboard/graphs/TopList.vue b/src/views/dashboard/graphs/TopList.vue
index d22a5773..0b2fc18e 100644
--- a/src/views/dashboard/graphs/TopList.vue
+++ b/src/views/dashboard/graphs/TopList.vue
@@ -15,12 +15,12 @@ limitations under the License. -->
-
+
@@ -45,6 +45,7 @@ limitations under the License. -->
import type { PropType } from "vue";
import { computed } from "vue";
import copy from "@/utils/copy";
+import { TextColors } from "@/views/dashboard/data";
/*global defineProps */
const props = defineProps({
data: {
@@ -54,12 +55,12 @@ const props = defineProps({
default: () => ({}),
},
config: {
- type: Object as PropType<{ sortOrder: string }>,
- default: () => ({}),
+ type: Object as PropType<{ color: string }>,
+ default: () => ({ color: "purple" }),
},
intervalTime: { type: Array as PropType
, default: () => [] },
});
-const key = computed(() => Object.keys(props.data)[0]);
+const key = computed(() => Object.keys(props.data)[0] || "");
const maxValue = computed(() => {
if (!(props.data[key.value] && props.data[key.value].length)) {
return 0;
@@ -67,30 +68,6 @@ const maxValue = computed(() => {
const temp: number[] = props.data[key.value].map((i: any) => i.value);
return Math.max.apply(null, temp);
});
-const getTraceId = (i: { [key: string]: (number | string)[] }): string => {
- return i.traceIds && i.traceIds[0] ? ` - ${i.traceIds[0]}` : "";
-};
-const datas = computed(() => {
- if (!(props.data[key.value] && props.data[key.value].length)) {
- return [];
- }
- const { sortOrder } = props.config;
- const val: any = props.data[key.value];
-
- switch (sortOrder) {
- case "DES":
- val.sort((a: any, b: any) => b.value - a.value);
- break;
- case "ASC":
- val.sort((a: any, b: any) => a.value - b.value);
- break;
- default:
- val.sort((a: any, b: any) => b.value - a.value);
- break;
- }
-
- return val;
-});
function handleClick(i: string) {
copy(i);
}