From 593762d689b63a9625368d97a7db7cd8882b3d9e Mon Sep 17 00:00:00 2001 From: qingwang Date: Fri, 4 May 2018 00:36:04 -0400 Subject: [PATCH] Fix Floodligut WebGUI switchDetail.html throwing error on OpenFlow 1.4 --- .DS_Store | Bin 0 -> 6148 bytes pages/switchDetail.html | 88 ++++++++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..51707bc4eafe75f6d920425142e71d07f06b518f GIT binary patch literal 6148 zcmeH~J&pn~427RrkdU^a+%gRZ;06(5PrwD(1w@0yN@)8WooB}l12r0r2wyw<3^dk@$ KG>E`U3ETkUhZBha literal 0 HcmV?d00001 diff --git a/pages/switchDetail.html b/pages/switchDetail.html index a2c4006..d1213d9 100644 --- a/pages/switchDetail.html +++ b/pages/switchDetail.html @@ -553,33 +553,67 @@ success: function (dat) { console.log(dat["port_reply"][0].port); // - $('#portTable').DataTable({ - aaData: dat["port_reply"], - "columnDefs": [ - { - // The `data` parameter refers to the data for the cell (defined by the - // `data` option, which defaults to the column being worked with, in - // this case `data: 0`. - "render": function (data, type, row) { - return "" + data + ""; - }, - "targets": 0 - } - - ], - - "aoColumns": [ - {"mData": 'port.0.port_number'}, - {"mData": 'port.0.receive_packets'}, - {"mData": 'port.0.transmit_packets'}, - {"mData": 'port.0.receive_bytes'}, - {"mData": 'port.0.transmit_bytes'}, - {"mData": 'port.0.receive_dropped'}, - {"mData": 'port.0.transmit_dropped'}, - {"mData": 'port.0.collisions'}, - {"mData": 'port.0.duration_sec'} - ] - }); + + if (dat["port_reply"][0].version == "OF_14") { + $('#portTable').DataTable({ + aaData: dat["port_reply"], + "columnDefs": [ + { + // The `data` parameter refers to the data for the cell (defined by the + // `data` option, which defaults to the column being worked with, in + // this case `data: 0`. + "render": function (data, type, row) { + return "" + data + ""; + }, + "targets": 0 + } + + ], + + "aoColumns": [ + {"mData": 'port.0.port_number'}, + {"mData": 'port.0.receive_packets'}, + {"mData": 'port.0.transmit_packets'}, + {"mData": 'port.0.receive_bytes'}, + {"mData": 'port.0.transmit_bytes'}, + {"mData": 'port.0.receive_dropped'}, + {"mData": 'port.0.transmit_dropped'}, + {"mData": 'port.0.properties.collisions'}, + {"mData": 'port.0.duration_sec'} + ] + }); + } + else { + $('#portTable').DataTable({ + aaData: dat["port_reply"], + "columnDefs": [ + { + // The `data` parameter refers to the data for the cell (defined by the + // `data` option, which defaults to the column being worked with, in + // this case `data: 0`. + "render": function (data, type, row) { + return "" + data + ""; + }, + "targets": 0 + } + + ], + + "aoColumns": [ + {"mData": 'port.0.port_number'}, + {"mData": 'port.0.receive_packets'}, + {"mData": 'port.0.transmit_packets'}, + {"mData": 'port.0.receive_bytes'}, + {"mData": 'port.0.transmit_bytes'}, + {"mData": 'port.0.receive_dropped'}, + {"mData": 'port.0.transmit_dropped'}, + {"mData": 'port.0.collisions'}, + {"mData": 'port.0.duration_sec'} + ] + }); + } + + console.log("DATATABLE"); console.log($("#portTable").DataTable().rows().data());