瀏覽代碼

Modifico algunos templates para reutilizarlos.

Maxi Schvindt 7 年之前
父節點
當前提交
3f2133e802

+ 4 - 1
src/StatsBundle/Admin/CablemodemAdmin.php

@@ -87,11 +87,14 @@ class CablemodemAdmin extends BaseAdmin
             ->add('index')
             ->add('upIf',null, array('template' => 'StatsBundle:Cablemodem:field_interface_index.html.twig','typeIf' => 'upstream'))
             ->add('downIf',null, array('template' => 'StatsBundle:Cablemodem:field_interface_index.html.twig','typeIf' => 'downstream'))
-            ->add('status',null, array('template' => 'StatsBundle:Cablemodem:field_status.html.twig'))
+            ->add('status',null, array('template' => 'StatsBundle:Templates:field_status.html.twig'))
             ->add('txPower',null, array('template' => 'StatsBundle:Cablemodem:field_tx_power_in_cm.html.twig'))
             ->add('rxPower',null, array('template' => 'StatsBundle:Cablemodem:field_rx_power_in_cm.html.twig'))
             ->add('signal',null, array('template' => 'StatsBundle:Cablemodem:field_snr_power_in_cm.html.twig'))
             ->add('microreflection',null, array('template' => 'StatsBundle:Cablemodem:field_microreflection_power_in_cm.html.twig'))
+            ->add('rxPowerCmts',null, array('template' => 'StatsBundle:Cablemodem:field_rx_power_in_cm.html.twig'))
+            ->add('signalCmts',null, array('template' => 'StatsBundle:Cablemodem:field_snr_power_in_cm.html.twig'))
+            /* ->add('microreflectionCmts',null, array('template' => 'StatsBundle:Cablemodem:field_microreflection_power_in_cm.html.twig')) */
             ->add('uptime',null, array('template' => 'StatsBundle:Cablemodem:field_uptime.html.twig'))
             
         ;

+ 12 - 11
src/StatsBundle/Admin/OnuAdmin.php

@@ -69,12 +69,12 @@ class OnuAdmin extends BaseAdmin
             ->add('oltDeviceId', 'string', array('template' => 'StatsBundle:Onu:base_list_field_olt.html.twig'))
             ->add('ponSerialNumber', 'string', array('template' => 'StatsBundle:Onu:show_link.html.twig'))
             ->add('ponPort')
-            ->add('status')
-            ->add('txPower', 'string', array('template' => 'StatsBundle:Onu:base_list_field_tx.html.twig'))
-            ->add('rxPower', 'string', array('template' => 'StatsBundle:Onu:base_list_field_rx.html.twig'))
-            ->add('voltage', 'string', array('template' => 'StatsBundle:Onu:base_list_field_voltage.html.twig'))
-            ->add('temperature', 'string', array('template' => 'StatsBundle:Onu:base_list_field_temperature.html.twig'))
-            ->add('uptime', 'string', array('template' => 'StatsBundle:Onu:base_list_field_uptime.html.twig'))
+            ->add('status',null, array('template' => 'StatsBundle:Templates:field_status.html.twig'))
+            ->add('txPower', 'string', array('template' => 'StatsBundle:Onu:field_tx.html.twig'))
+            ->add('rxPower', 'string', array('template' => 'StatsBundle:Onu:field_rx.html.twig'))
+            ->add('voltage', 'string', array('template' => 'StatsBundle:Onu:field_voltage.html.twig'))
+            ->add('temperature', 'string', array('template' => 'StatsBundle:Onu:field_temperature.html.twig'))
+            ->add('uptime', 'string', array('template' => 'StatsBundle:Onu:field_uptime.html.twig'))
             ->add('updated')
         ;
     }
@@ -105,11 +105,12 @@ class OnuAdmin extends BaseAdmin
             ->add('oltDeviceId', 'string', array('template' => 'StatsBundle:Onu:base_show_field_olt.html.twig','oltName' => $oltName))
             ->add('ponSerialNumber')
             ->add('ponPort')
-            ->add('status')
-            ->add('txPower', 'string', array('template' => 'StatsBundle:Onu:base_show_field_tx.html.twig'))
-            ->add('rxPower', 'string', array('template' => 'StatsBundle:Onu:base_show_field_rx.html.twig'))
-            ->add('voltage', 'string', array('template' => 'StatsBundle:Onu:base_show_field_voltage.html.twig'))
-            ->add('temperature', 'string', array('template' => 'StatsBundle:Onu:base_show_field_temperature.html.twig'))
+            ->add('status',null, array('template' => 'StatsBundle:Templates:field_status.html.twig', 'extend' => 'base_show_field.html.twig'))
+            ->add('txPower', 'string', array('template' => 'StatsBundle:Onu:field_tx.html.twig', 'extend' => 'base_show_field.html.twig'))
+            ->add('rxPower', 'string', array('template' => 'StatsBundle:Onu:field_rx.html.twig', 'extend' => 'base_show_field.html.twig'))
+            ->add('voltage', 'string', array('template' => 'StatsBundle:Onu:field_voltage.html.twig', 'extend' => 'base_show_field.html.twig'))
+            ->add('temperature', 'string', array('template' => 'StatsBundle:Onu:field_temperature.html.twig', 'extend' => 'base_show_field.html.twig'))
+            ->add('uptime', 'string', array('template' => 'StatsBundle:Onu:field_uptime.html.twig', 'extend' => 'base_show_field.html.twig'))
             ->add('updated', 'string', array('template' => 'StatsBundle:Onu:base_show_field_uptime.html.twig'))
         ;
     }

+ 6 - 2
src/StatsBundle/Command/StatsCmCommand.php

@@ -109,8 +109,12 @@ class StatsCmCommand extends BaseCommand
             $row['lng'] = ($lng)? :$lng = "NULL";
             
             $row['tenancyId'] = $tenancyId;
-
+            
             $row['extraData'] = "'".str_replace('"','\"',json_encode($stats))."'"; 
+
+            (isset($info['rxPower']))? $row['rxPowerCmts'] = $info['rxPower'] : $row['rxPowerCmts'] = "NULL";
+            (isset($info['signal']))? $row['signalCmts'] = $info['signal'] : $row['signalCmts'] = "NULL";
+            (isset($info['microreflection']))? $row['microreflectionCmts'] = $info['microreflection'] : $row['microreflectionCmts'] = "NULL";
             
             $data[] = "(".implode(",",$row).")".PHP_EOL;
         }
@@ -122,7 +126,7 @@ class StatsCmCommand extends BaseCommand
             $conn->close();
             
             $conn = $doctrine->getConnection();
-            $sql = "INSERT LOW_PRIORITY IGNORE INTO `cablemodem` (`id`, `device_server_id`, `cmts_device_id`, `device_id`, `ip`, `mac`, `index`, `up_if`, `down_if`, `status`, `tx_power`, `rx_power`, `signal`, `microreflection`, `correcteds`, `unerroreds`, `uncorrectables`, `uptime`, `updated`, `lat`, `lng`, `tenancy_id`, `extra_data`) VALUES ".  implode(",", $data).";";
+            $sql = "INSERT LOW_PRIORITY IGNORE INTO `cablemodem` (`id`, `device_server_id`, `cmts_device_id`, `device_id`, `ip`, `mac`, `index`, `up_if`, `down_if`, `status`, `tx_power`, `rx_power`, `signal`, `microreflection`, `correcteds`, `unerroreds`, `uncorrectables`, `uptime`, `updated`, `lat`, `lng`, `tenancy_id`, `extra_data`, `rx_power_cmts`, `signal_cmts`, `microreflection_cmts`) VALUES ".  implode(",", $data).";";
             
             $conn->query($sql);
             $conn->close();

+ 85 - 0
src/StatsBundle/Entity/Cablemodem.php

@@ -144,6 +144,21 @@ class Cablemodem implements TenancyIdTraitInterface
      */
     public $lng;
 
+    /**
+     * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
+     */
+    public $rxPowerCmts;
+
+    /**
+     * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
+     */
+    public $signalCmts;
+
+    /**
+     * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
+     */
+    public $microreflectionCmts;
+
     /**
      * Get id
      *
@@ -630,4 +645,74 @@ class Cablemodem implements TenancyIdTraitInterface
     {
         return $this->deviceServer;
     }
+
+    /**
+     * Set rxPowerCmts
+     *
+     * @param string $rxPowerCmts
+     *
+     * @return Cablemodem
+     */
+    public function setRxPowerCmts($rxPowerCmts)
+    {
+        $this->rxPowerCmts = $rxPowerCmts;
+
+        return $this;
+    }
+
+    /**
+     * Get rxPowerCmts
+     *
+     * @return string
+     */
+    public function getRxPowerCmts()
+    {
+        return  $this->rxPowerCmts;
+    }
+
+    /**
+     * Set signalCmts
+     *
+     * @param string $signalCmts
+     *
+     * @return Cablemodem
+     */
+    public function setSignalCmts($signalCmts)
+    {
+        $this->signalCmts = $signalCmts;
+
+        return $this;
+    }
+
+    /**
+     * Get signalCmts
+     *
+     */
+    public function getSignalCmts()
+    {
+        return  $this->signalCmts;
+    }
+
+    /**
+     * Set microreflectionCmts
+     *
+     * @param string $microreflectionCmts
+     *
+     * @return Cablemodem
+     */
+    public function setMicroreflectionCmts($microreflectionCmts)
+    {
+        $this->microreflectionCmts = $microreflectionCmts;
+
+        return $this;
+    }
+
+    /**
+     * Get microreflectionCmts
+     *
+     */
+    public function getMicroreflectionCmts()
+    {
+        return $this->microreflectionCmts;
+    }
 }

+ 1 - 0
src/StatsBundle/Resources/config/services.yml

@@ -29,6 +29,7 @@ services:
         calls:    
             - [setTranslationDomain, [StatsBundle]]
             - [setTemplate, ['show','StatsBundle:Onu:base_show.html.twig']]
+            - [setTemplate, ['outer_list_rows_list','StatsBundle:Templates:list_outer_rows_list.html.twig']]
     
     stats.admin.pon_port:
         class: StatsBundle\Admin\PonPortAdmin

+ 12 - 0
src/StatsBundle/Resources/translations/StatsBundle.es.yml

@@ -44,6 +44,9 @@ filter:
     label_mac: MAC
     label_up_if: Upstream
     label_down_if: Downstream
+    label_rx_power_cmts: Rx Power Ups
+    label_signal_cmts: SNR Ups
+    label_microreflection_cmts: Microreflection Ups
 
 form:
     label_name: Nombre
@@ -71,6 +74,9 @@ form:
     label_mac: MAC
     label_up_if: Upstream
     label_down_if: Downstream
+    label_rx_power_cmts: Rx Power Ups
+    label_signal_cmts: SNR Ups
+    label_microreflection_cmts: Microreflection Ups
 
 show:
     label_name: Nombre
@@ -111,6 +117,9 @@ show:
     label_mac: MAC
     label_up_if: Upstream
     label_down_if: Downstream
+    label_rx_power_cmts: Rx Power Ups
+    label_signal_cmts: SNR Ups
+    label_microreflection_cmts: Microreflection Ups
 
 list:
     label_name: Nombre
@@ -155,6 +164,9 @@ list:
     label_mac: MAC
     label_up_if: Upstream
     label_down_if: Downstream
+    label_rx_power_cmts: Rx Power Ups
+    label_signal_cmts: SNR Ups
+    label_microreflection_cmts: Microreflecciones Ups
     
 help:
     url: Url a consultar dispositivos

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_interface_index.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% set interfaces = admin.parameters.interfaces %}

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_microreflection_power_in_cm.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if value is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_rx_power_in_cm.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if value is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_snr_power_in_cm.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if value is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_tx_power_in_cm.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if value is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_uptime.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if value is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Onu/base_list_field_rx.html.twig

@@ -1,4 +1,4 @@
-{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     

+ 1 - 1
src/StatsBundle/Resources/views/Onu/base_list_field_temperature.html.twig

@@ -1,4 +1,4 @@
-{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if object.getTemperature() is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Onu/base_list_field_tx.html.twig

@@ -1,4 +1,4 @@
-{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
 

+ 1 - 1
src/StatsBundle/Resources/views/Onu/base_list_field_uptime.html.twig

@@ -1,4 +1,4 @@
-{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if object.getUptime() is null %}

+ 1 - 1
src/StatsBundle/Resources/views/Onu/base_list_field_voltage.html.twig

@@ -1,4 +1,4 @@
-{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}
     {% if object.getVoltage() is null %}

+ 0 - 1
src/StatsBundle/Resources/views/Cablemodem/base_field.html.twig

@@ -6,5 +6,4 @@
 {% extends extend %}
 
 {% block field %}
-
 {% endblock %}

+ 1 - 1
src/StatsBundle/Resources/views/Cablemodem/field_status.html.twig

@@ -1,4 +1,4 @@
-{% extends 'StatsBundle:Cablemodem:base_field.html.twig' %}
+{% extends 'StatsBundle:Templates:base_field.html.twig' %}
 
 {% block field %}