]> git.ipfire.org Git - oddments/collecty.git/commitdiff
interface: Show the correct interface name in graph
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 May 2015 11:03:06 +0000 (11:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 May 2015 11:03:06 +0000 (11:03 +0000)
src/collecty/plugins/interface.py

index 3ad6e8b0137062afe1008be9471ec18ddbea629f..c373cf21fca6e82d28eac41e4955e705a62793be 100644 (file)
@@ -34,7 +34,13 @@ COLOUR_RX_AREA = "%sAA" % COLOUR_RX
 COLOUR_TX = "228B22"
 COLOUR_TX_AREA = "%sAA" % COLOUR_TX
 
-class GraphTemplateInterfaceBits(base.GraphTemplate):
+class GraphTemplateInterfaceBase(base.GraphTemplate):
+       @property
+       def interface(self):
+               return self.object.interface
+
+
+class GraphTemplateInterfaceBits(GraphTemplateInterfaceBase):
        name = "interface-bits"
 
        @property
@@ -83,14 +89,14 @@ class GraphTemplateInterfaceBits(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               return _("Bandwidth usage on %(interface)s")
+               return _("Bandwidth usage on %s") % self.interface
 
        @property
        def graph_vertical_label(self):
                return _("Bit/s")
 
 
-class GraphTemplateInterfacePackets(base.GraphTemplate):
+class GraphTemplateInterfacePackets(GraphTemplateInterfaceBase):
        name = "interface-packets"
 
        @property
@@ -124,14 +130,14 @@ class GraphTemplateInterfacePackets(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               return _("Transferred packets on %(interface)s")
+               return _("Transferred packets on %s") % self.interface
 
        @property
        def graph_vertical_label(self):
                return _("Packets/s")
 
 
-class GraphTemplateInterfaceErrors(base.GraphTemplate):
+class GraphTemplateInterfaceErrors(GraphTemplateInterfaceBase):
        name = "interface-errors"
 
        @property
@@ -193,7 +199,7 @@ class GraphTemplateInterfaceErrors(base.GraphTemplate):
 
        @property
        def graph_title(self):
-               return _("Errors/dropped packets on %(interface)s")
+               return _("Errors/dropped packets on %s") % self.interface
 
        @property
        def graph_vertical_label(self):