浏览代码

FD3-790 vendors updated. Status filter added in Host and Subnet. Spanish translations added

Guillermo Espinoza 6 年之前
父节点
当前提交
f77d1b56ba

+ 10 - 10
composer.lock

@@ -1458,7 +1458,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/BaseAdmin.git",
-                "reference": "3a901b80d11841240048727b0353d9aa5975df49"
+                "reference": "767b0aad4bd83c5677f69a8bb860793942c90f10"
             },
             "type": "library",
             "autoload": {
@@ -1473,7 +1473,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2018-11-22T14:16:08+00:00"
+            "time": "2019-01-09T17:58:40+00:00"
         },
         {
             "name": "ik/device-bundle",
@@ -1504,7 +1504,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
-                "reference": "46b52cf971097fee846639ba0dc5d37863f0a283"
+                "reference": "c85d52d5e306faaa44f9d45353365d00f10adf2d"
             },
             "type": "library",
             "autoload": {
@@ -1519,7 +1519,7 @@
                 "bundle",
                 "extra-data"
             ],
-            "time": "2018-11-15T15:48:51+00:00"
+            "time": "2018-12-14T11:31:02+00:00"
         },
         {
             "name": "ik/migrations-bundle",
@@ -1600,7 +1600,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/TemplateBundle.git",
-                "reference": "09fbc9fdf0bff2fb9cf6d45b05ff0601996ebed4"
+                "reference": "97a0f5c1d73edf039cbf046ba7b2ee8e7ef14575"
             },
             "require": {
                 "ik/base-admin-bundle": "*"
@@ -1618,7 +1618,7 @@
                 "bundle",
                 "template"
             ],
-            "time": "2018-11-16T18:22:17+00:00"
+            "time": "2019-01-04T12:24:24+00:00"
         },
         {
             "name": "ik/webservice-bundle",
@@ -1626,7 +1626,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/Webservice.git",
-                "reference": "28366e01175fa5b598a10ed4c21966c31f8f144c"
+                "reference": "99d58259071e639cf59760e96a5063c98b5e7a43"
             },
             "require": {
                 "ext-curl": "*",
@@ -1639,7 +1639,7 @@
                 }
             },
             "description": "The Flowdat3 Webservice Rest",
-            "time": "2018-11-16T18:33:20+00:00"
+            "time": "2019-01-11T18:05:23+00:00"
         },
         {
             "name": "ik/workflow-bundle",
@@ -1647,7 +1647,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/WorkflowBundle.git",
-                "reference": "3b16291fcaf4d9aebca3a2a0914de310a28768b4"
+                "reference": "c56c95f3145caf7965392a711efaee0643329383"
             },
             "require": {
                 "php-amqplib/rabbitmq-bundle": "^1.12"
@@ -1677,7 +1677,7 @@
                 "bundle",
                 "workflow"
             ],
-            "time": "2018-12-10T15:23:26+00:00"
+            "time": "2019-01-11T18:20:57+00:00"
         },
         {
             "name": "incenteev/composer-parameter-handler",

+ 15 - 9
src/HostBundle/Admin/HostAdmin.php

@@ -25,6 +25,7 @@ class HostAdmin extends BaseAdmin
             ->add('hostType')
             ->add('state', 'doctrine_orm_choice', [], 'choice', [
                 'choices' => HostStatus::getChoices(),
+                'translation_domain' => 'WorkflowLabel',
             ])
             ->add('options', 'doctrine_orm_callback', [
                 'callback' => function($queryBuilder, $alias, $field, $value) {
@@ -50,7 +51,9 @@ class HostAdmin extends BaseAdmin
         $listMapper
             ->add('mac')
             ->add('hostType')
-            ->add('state')
+            ->add('state', null, [
+                'template' => 'HostBundle::translate_status.html.twig',
+            ])
             ->add('options.fixed_address')
             ->add('associatedHosts')
             ->add('_action', null, array(
@@ -81,7 +84,7 @@ class HostAdmin extends BaseAdmin
             ])
             ->add('state', ChoiceType::class, [
                 'choices' => HostStatus::getChoices(),
-                'translation_domain' => 'HostBundle',
+                'translation_domain' => 'WorkflowLabel',
             ])
             ->add('host', EntityType::class, [
                 'class' => Host::class,
@@ -90,12 +93,12 @@ class HostAdmin extends BaseAdmin
                     ->join('Host.hostType', 'HostType')
                     ->andWhere('HostType.name = \'Cablemodem\'')
                     ->orderBy('Host.mac', 'ASC');
-                    
+
                     $mac = $subject->getMac();
                     if ($mac) {
                         $qb->andWhere('Host.mac <> :mac')->setParameter('mac', $mac);
                     }
-                    
+
                     return $qb;
                 },
                 'required' => false,
@@ -116,7 +119,10 @@ class HostAdmin extends BaseAdmin
             ->with('Host')
             ->add('mac')
             ->add('hostType')
-            ->add('state')
+            ->add('state', null, [
+                'template' => 'HostBundle::translate_status.html.twig',
+                'data' => 'show',
+            ])
             ->add('associatedHosts')
             ->add('host')
         ->end()
@@ -124,7 +130,7 @@ class HostAdmin extends BaseAdmin
         ;
         $subject->getAssociatedHosts()->count() ?: $showMapper->remove('associatedHosts');
         $subject->getHost() ?: $showMapper->remove('host');
-        
+
 
         $this->addCablemodemTab($showMapper);
     }
@@ -159,7 +165,7 @@ class HostAdmin extends BaseAdmin
     {
         return $this->updateDHCPOptions($object);
     }
-    
+
     /**
      * @param $object
      *
@@ -169,7 +175,7 @@ class HostAdmin extends BaseAdmin
     {
         return $this->updateDHCPOptions($object);
     }
-    
+
     /**
      * @param Host $object
      *
@@ -184,7 +190,7 @@ class HostAdmin extends BaseAdmin
             $object->setFixedIP(false);
         }
         $object->setOptions(json_encode($object->getDHCPOption()));
-    
+
         return parent::preUpdate($object);
     }
 }

+ 5 - 5
src/HostBundle/Resources/translations/HostBundle.es.yml

@@ -42,7 +42,7 @@ form:
     label_log_servers: Log Servers
     label_time_servers: Time Servers
     label_status: Estado
-    label_fixed_address: Fixed Address
+    label_fixed_address: IP Fija
     label_host: Host
 
 list:
@@ -66,8 +66,8 @@ list:
     label_status: Estado
     label_host: Host
     label_associated_hosts: Hosts asociados ( ID - Tipo de host )
-    label_options_fixed_address: IP
-    
+    label_options_fixed_address: IP Fija
+
 show:
     label_mac: Mac
     label_options: Opciones
@@ -104,7 +104,7 @@ show:
     label_log_servers: Log Servers
     label_time_servers: Time Servers
     label_status: Estado
-    label_fixed_address: Fixed Address
+    label_fixed_address: IP Fija
     label_host: Host
     label_associated_hosts: Hosts asociados ( ID - Tipo de host )
 
@@ -123,7 +123,7 @@ filter:
     label_allowed_host_type: Tipo de Host permitido
     label_status: Estado
     label_host_type: Tipo de Host
-    label_options_fixed_address: IP
+    label_options_fixed_address: IP Fija
 
 breadcrumb:
     link_host_list: Listado Host

+ 8 - 0
src/HostBundle/Resources/views/translate_status.html.twig

@@ -0,0 +1,8 @@
+{% extends "SonataAdminBundle:CRUD:base_#{field_description.options.data | default('list')}_field.html.twig" %}
+
+{% block field %}
+
+{{ value | trans({}, 'WorkflowLabel') }}
+
+{% endblock %}
+

+ 8 - 1
src/HostBundle/Utils/HostStatus.php

@@ -4,13 +4,20 @@ namespace HostBundle\Utils;
 
 use DeviceBundle\Utils\ChoiceTrait;
 
+/**
+ * The statuses are used by Host and SubNet
+ * and are the same statuses of Client and Cablemodem
+ */
 class HostStatus
 {
 
     use ChoiceTrait;
 
     const STATE_ACTIVE = 'active';
-    const STATE_SUSPENDED = 'suspended';
+    const STATE_SUSPEND = 'suspend';
+    const STATE_PRE_NOTICE = 'pre_notice';
+    const STATE_CANCELLED = 'cancelled';
+    const STATE_NOT_PROVISIONED = 'not_provisioned';
     const STATE_NONE = 'none';
 
 }

+ 12 - 4
src/IPv4Bundle/Admin/SubNetAdmin.php

@@ -20,7 +20,10 @@ class SubNetAdmin extends BaseAdmin
         $datagridMapper
             ->add('address')
             ->add('allowedHostType')
-            ->add('status')
+            ->add('status', 'doctrine_orm_choice', [], 'choice', [
+                'choices' => HostStatus::getChoices(),
+                'translation_domain' => 'WorkflowLabel',
+            ])
         ;
     }
 
@@ -36,7 +39,9 @@ class SubNetAdmin extends BaseAdmin
                 'template' => 'HostBundle:CRUD:dhcp_options.html.twig',
             ])
             ->add('allowedHostType')
-            ->add('status')
+            ->add('status', null, [
+                'template' => 'HostBundle::translate_status.html.twig',
+            ])
             ->add('netGroup')
             ->add('ipPool')
             ->add('_action', null, array(
@@ -62,7 +67,7 @@ class SubNetAdmin extends BaseAdmin
                 ->add('status', ChoiceType::class, [
                     'required' => false,
                     'choices' => HostStatus::getChoices(),
-                    'translation_domain' => 'IPv4Bundle',
+                    'translation_domain' => 'WorkflowLabel',
                 ])
                 ->add('netGroup')
             ->end()
@@ -78,7 +83,10 @@ class SubNetAdmin extends BaseAdmin
         $showMapper
             ->add('address')
             ->add('allowedHostType')
-            ->add('status')
+            ->add('status', null, [
+                'template' => 'HostBundle::translate_status.html.twig',
+                'data' => 'show',
+            ])
             ->add('netGroup')
             ->add('ipPool')
         ;