From be0c268ff56f453a702114d0d0eee00bb3a6ab7a Mon Sep 17 00:00:00 2001 From: AmyangXYZ Date: Mon, 29 Jan 2024 17:24:08 -0500 Subject: [PATCH] show path on flow panel --- src/components/FlowsPanel.vue | 33 ++++++++++++++++++++------------- src/core/network.ts | 8 +++----- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/components/FlowsPanel.vue b/src/components/FlowsPanel.vue index 2ecb0c8..833d6ea 100644 --- a/src/components/FlowsPanel.vue +++ b/src/components/FlowsPanel.vue @@ -7,43 +7,50 @@ const columns: any = [ key: 'flow_id', title: 'ID', dataKey: 'flow_id', - width: 60, + width: 40, align: 'center', cellRenderer: ({ rowIndex }: any) => rowIndex + 1 }, { key: 'src', - title: 'Source', + title: 'SRC', dataKey: 'e2e_src', width: 40, align: 'center' }, { key: 'dst', - title: 'Dest', + title: 'DST', dataKey: 'e2e_dst', width: 40, align: 'center' }, + // { + // key: 'deadline', + // title: 'Deadline', + // dataKey: 'deadline', + // width: 50, + // align: 'center' + // }, { - key: 'deadline', - title: 'Deadline', - dataKey: 'deadline', - width: 50, + key: 'period', + title: 'PERIOD', + dataKey: 'period', + width: 40, align: 'center' }, { - key: 'period', - title: 'Period', - dataKey: 'period', - width: 60, + key: 'path', + title: 'PATH', + dataKey: 'path', + width: 120, align: 'center' }, { key: 'workload', - title: 'Workload', + title: 'WORKLOAD', dataKey: 'workload', - width: 100, + width: 50, align: 'center', // cellRenderer: ({ cellData: payload_size }: any) => payload_size.toString() } diff --git a/src/core/network.ts b/src/core/network.ts index f808360..e3e19b0 100644 --- a/src/core/network.ts +++ b/src/core/network.ts @@ -355,7 +355,7 @@ export class NetworkHub { constructRoutingGraph() { const graph: RoutingGraph = {} - for (const link of this.Links.value) { + for (const link of Object.values(this.Links.value)) { if (link === undefined) continue @@ -428,8 +428,8 @@ export class NetworkHub { AddFlows(num_flows: number) { for (let i = 0; i < num_flows; i++) { - let src = Math.floor(this.Rand.next() * 7) + 11 - let dst = Math.floor(this.Rand.next() * 7) + 11 + const src = Math.floor(this.Rand.next() * 7) + 11 + const dst = Math.floor(this.Rand.next() * 7) + 11 const f = { id: this.Flows.value.length, @@ -440,12 +440,10 @@ export class NetworkHub { workload: Math.floor(this.Rand.next() * 10), // from 0 to 9 - change this later path: this.findPath(src, dst) } - this.Flows.value.push(f) this.Logs.value.unshift(`New flow: ID:${f.id}, source:${f.e2e_src}, dest:${f.e2e_dst}.`) } - console.log(this.Flows.value) } Run = () => {