From 61f82c54dfc868f92186f93d954f4868d2e863c9 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Mon, 21 Mar 2022 15:36:56 +0800 Subject: [PATCH] feat: Add menus in side bar (#30) --- src/assets/icons/cloud_queue.svg | 17 +++ src/assets/icons/language.svg | 17 +++ src/assets/icons/linear_scale.svg | 17 +++ src/components/Selector.vue | 13 ++- src/hooks/useProcessor.ts | 2 +- src/layout/components/SideBar.vue | 39 +++++-- src/locales/lang/en.ts | 6 + src/locales/lang/zh.ts | 6 + src/router/browser.ts | 43 +++++++ src/router/database.ts | 2 +- src/router/functions.ts | 43 +++++++ src/router/index.ts | 8 +- src/router/infrastructure.ts | 34 ++++-- src/router/selfObservability.ts | 52 +++++++++ src/router/serviceMesh.ts | 2 +- src/views/Layer.vue | 20 ++++ src/views/dashboard/List.vue | 2 +- .../configuration/widget/MetricOptions.vue | 28 +---- .../related/topology/components/Graph.vue | 18 ++- .../topology/components/PodTopology.vue | 4 +- .../related/topology/components/Settings.vue | 108 ++++++++++++------ 21 files changed, 386 insertions(+), 95 deletions(-) create mode 100644 src/assets/icons/cloud_queue.svg create mode 100644 src/assets/icons/language.svg create mode 100644 src/assets/icons/linear_scale.svg create mode 100644 src/router/browser.ts create mode 100644 src/router/functions.ts create mode 100644 src/router/selfObservability.ts diff --git a/src/assets/icons/cloud_queue.svg b/src/assets/icons/cloud_queue.svg new file mode 100644 index 00000000..4b1da735 --- /dev/null +++ b/src/assets/icons/cloud_queue.svg @@ -0,0 +1,17 @@ + + + + diff --git a/src/assets/icons/language.svg b/src/assets/icons/language.svg new file mode 100644 index 00000000..eab0146d --- /dev/null +++ b/src/assets/icons/language.svg @@ -0,0 +1,17 @@ + + + + diff --git a/src/assets/icons/linear_scale.svg b/src/assets/icons/linear_scale.svg new file mode 100644 index 00000000..6b739747 --- /dev/null +++ b/src/assets/icons/linear_scale.svg @@ -0,0 +1,17 @@ + + + + diff --git a/src/components/Selector.vue b/src/components/Selector.vue index c40867e9..b6dd34c7 100644 --- a/src/components/Selector.vue +++ b/src/components/Selector.vue @@ -37,8 +37,8 @@ import { ref, watch } from "vue"; import type { PropType } from "vue"; interface Option { - label: string; - value: string; + label: string | number; + value: string | number; } /*global defineProps, defineEmits*/ @@ -49,11 +49,14 @@ const props = defineProps({ default: () => [], }, value: { - type: [Array, String, Number] as PropType, + type: [Array, String, Number, undefined] as PropType, default: () => [], }, size: { type: null, default: "default" }, - placeholder: { type: String, default: "Select a option" }, + placeholder: { + type: [String, Number] as PropType, + default: "Select a option", + }, borderRadius: { type: Number, default: 3 }, multiple: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, @@ -61,7 +64,7 @@ const props = defineProps({ const selected = ref(props.value); function changeSelected() { - const options = props.options.filter((d: Option) => + const options = props.options.filter((d: any) => props.multiple ? selected.value.includes(d.value) : selected.value === d.value diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts index 6d5560da..bd6632c2 100644 --- a/src/hooks/useProcessor.ts +++ b/src/hooks/useProcessor.ts @@ -57,7 +57,7 @@ export function useQueryProcessor(config: any) { variables.push(`$condition${index}: TopNCondition!`); conditions[`condition${index}`] = { name, - parentService: ["Service", "All"].includes(dashboardStore.entity) + parentService: ["All"].includes(dashboardStore.entity) ? null : selectorStore.currentService.value, normal: selectorStore.currentService.normal, diff --git a/src/layout/components/SideBar.vue b/src/layout/components/SideBar.vue index f5b49b01..31da52ca 100644 --- a/src/layout/components/SideBar.vue +++ b/src/layout/components/SideBar.vue @@ -33,13 +33,17 @@ limitations under the License. -->