Changeset 7547

Show
Ignore:
Timestamp:
09/24/11 04:14:48 (20 months ago)
Author:
jow
Message:

modules/admin-full: remove redundant code

Location:
luci/trunk/modules/admin-full/luasrc/view/admin_network
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/modules/admin-full/luasrc/view/admin_network/iface_overview.htm

    r7545 r7547  
    7878                    { 
    7979                        var ifc = ifcs[i]; 
    80                         var rxb = ifc.rx_bytes || 0; 
    81                         var txb = ifc.tx_bytes || 0; 
    82                         var rxp = ifc.rx_packets || 0; 
    83                         var txp = ifc.tx_packets || 0; 
    84                         var mac = ifc.macaddr; 
    85                         var upt = null; 
    86  
    8780                        var html = ''; 
    88  
    89                         var icon; 
    90                         if (ifc.is_up) 
    91                         { 
    92                             if (ifc.uptime) 
    93                                 upt = String.format('%t', ifc.uptime); 
    94  
    95                             icon = "<%=resource%>/icons/%s.png"; 
    96                         } 
    97                         else 
    98                         { 
    99                             icon = "<%=resource%>/icons/%s_disabled.png"; 
    100                         } 
    10181 
    10282                        var s = document.getElementById(ifc.id + '-ifc-devices'); 
     
    139119                        if (d && ifc.ifname) 
    140120                        { 
    141                             if (upt) 
    142                             { 
    143                                 html += String.format('<strong><%:Uptime%>:</strong> %s<br />', upt); 
     121                            if (ifc.is_up) 
     122                            { 
     123                                html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime); 
    144124                            } 
    145125 
    146126                            if (ifc.type != 'tunnel') 
    147127                            { 
    148                                 html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', mac); 
     128                                html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', ifc.macaddr); 
    149129                            } 
    150130 
     
    152132                                '<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' + 
    153133                                '<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />', 
    154                                     rxb, rxp, txb, txp 
     134                                    ifc.rx_bytes, ifc.rx_packets, 
     135                                    ifc.tx_bytes, ifc.tx_packets 
    155136                            ); 
    156137 
  • luci/trunk/modules/admin-full/luasrc/view/admin_network/iface_status.htm

    r7545 r7547  
    55 
    66    function iface_shutdown(id, reconnect) { 
    7         if (!reconnect && !confirm(String.format('<%_Really shutdown network ?\nYou might loose access to this router if you are connected via this interface.%>', id))) 
     7        if (!reconnect && !confirm(String.format('<%_Really shutdown network ?\nYou might lose access to this router if you are connected via this interface.%>', id))) 
    88            return; 
    99 
     
    5050                if (ifc && (ifc = ifc[0])) 
    5151                { 
    52                     var rxb = ifc.rx_bytes || 0; 
    53                     var txb = ifc.tx_bytes || 0; 
    54                     var rxp = ifc.rx_packets || 0; 
    55                     var txp = ifc.tx_packets || 0; 
    56                     var mac = ifc.macaddr; 
    57  
    5852                    var html = ''; 
    59                     var upt, icon; 
    60  
    61                     if (ifc.is_up) 
    62                     { 
    63                         if (ifc.uptime) 
    64                             upt = String.format('%t', ifc.uptime); 
    65  
    66                         icon = "<%=resource%>/icons/%s.png"; 
    67                     } 
    68                     else 
    69                     { 
    70                         icon = "<%=resource%>/icons/%s_disabled.png"; 
    71                     } 
    7253 
    7354                    var s = document.getElementById('<%=self.option%>-ifc-signal'); 
     
    8162 
    8263                    var d = document.getElementById('<%=self.option%>-ifc-description'); 
    83                     if (d && ifc.ifname && mac != '00:00:00:00:00:00') 
     64                    if (d && ifc.ifname && ifc.macaddr != '00:00:00:00:00:00') 
    8465                    { 
    85                         if (upt) 
     66                        if (ifc.is_up) 
    8667                        { 
    87                             html += String.format('<strong><%:Uptime%>:</strong> %s<br />', upt); 
     68                            html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime); 
    8869                        } 
    8970 
    9071                        if (ifc.type != 'tunnel') 
    9172                        { 
    92                             html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', mac); 
     73                            html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', ifc.macaddr); 
    9374                        } 
    9475 
     
    9677                            '<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' + 
    9778                            '<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />', 
    98                                 rxb, rxp, txb, txp 
     79                                ifc.rx_bytes, ifc.rx_packets, 
     80                                ifc.tx_bytes, ifc.tx_packets 
    9981                        ); 
    10082