diff --git a/src/components/Graph.vue b/src/components/Graph.vue index 619d71f0..b324cc83 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -21,11 +21,13 @@ import type { PropType } from "vue"; import { useECharts } from "@/hooks/useEcharts"; import { addResizeListener, removeResizeListener } from "@/utils/event"; -/*global Nullable, defineProps*/ +/*global Nullable, defineProps, defineEmits*/ +const emits = defineEmits(["select"]); const chartRef = ref>(null); -const { setOptions, resize } = useECharts(chartRef as Ref); +const { setOptions, resize, getInstance } = useECharts( + chartRef as Ref +); const props = defineProps({ - clickEvent: { type: Function as PropType<(param: unknown) => void> }, height: { type: String, default: "100%" }, width: { type: String, default: "100%" }, option: { @@ -35,6 +37,10 @@ const props = defineProps({ }); onMounted(() => { + const instance = getInstance(); + instance.on("click", (params: any) => { + emits("select", params); + }); setOptions(props.option); addResizeListener(unref(chartRef), resize); }); diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index b83f642d..f86cc771 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -129,6 +129,7 @@ export const topologyStore = defineStore({ }, setLinkServerMetrics(m: { id: string; value: unknown }[]) { this.linkServerMetrics = m; + console.log(m); }, setLinkClientMetrics(m: { id: string; value: unknown }[]) { this.linkClientMetrics = m; @@ -294,7 +295,6 @@ export const topologyStore = defineStore({ } }, async getEndpointTopology(endpointIds: string[]) { - // const endpointId = useSelectorStore().currentPod.id; const duration = useAppStoreWithOut().durationTime; const variables = ["$duration: Duration!"]; const fragment = endpointIds.map((id: string, index: number) => { diff --git a/src/types/topology.d.ts b/src/types/topology.d.ts index 6041a63f..10c7c165 100644 --- a/src/types/topology.d.ts +++ b/src/types/topology.d.ts @@ -30,4 +30,5 @@ export interface Node { type: string; isReal: boolean; layer?: string; + serviceName?: string; } diff --git a/src/views/dashboard/related/topology/components/PodTopology.vue b/src/views/dashboard/related/topology/components/PodTopology.vue index 46d64a02..149b5489 100644 --- a/src/views/dashboard/related/topology/components/PodTopology.vue +++ b/src/views/dashboard/related/topology/components/PodTopology.vue @@ -14,15 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. -->