소스 검색

FD3-498 Se agrega campo state para Host

Guillermo Espinoza 7 년 전
부모
커밋
aef8785a65

+ 4 - 0
src/IPv4Bundle/Admin/HostAdmin.php

@@ -17,6 +17,7 @@ class HostAdmin extends BaseAdmin
     {
         $datagridMapper
             ->add('mac')
+            ->add('state')
         ;
     }
 
@@ -29,6 +30,7 @@ class HostAdmin extends BaseAdmin
             ->add('mac')
             ->add('options')
             ->add('hostType')
+            ->add('state')
             ->add('_action', null, array(
                 'actions' => array(
                     'show' => array(),
@@ -48,6 +50,7 @@ class HostAdmin extends BaseAdmin
             ->add('mac')
             ->add('options')
             ->add('hostType')
+            ->add('state')
         ;
     }
 
@@ -60,6 +63,7 @@ class HostAdmin extends BaseAdmin
             ->add('mac')
             ->add('options')
             ->add('hostType')
+            ->add('state')
         ;
     }
 }

+ 29 - 0
src/IPv4Bundle/Entity/Host.php

@@ -13,6 +13,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
 class Host
 {
 
+    const STATE_ACTIVE = 'active';
+
     /**
      * @var bigint $id
      *
@@ -44,6 +46,13 @@ class Host
      */
     protected $hostType;
 
+    /**
+     * @var string $state
+     *
+     * @ORM\Column(type="string")
+     */
+    protected $state = self::STATE_ACTIVE;
+
 
     /**
      * @return string
@@ -121,4 +130,24 @@ class Host
         return $this->hostType;
     }
 
+    /**
+     * @return string
+     */
+    public function getState()
+    {
+        return $this->state;
+    }
+
+    /**
+     * @param string $state
+     *
+     * @return Host
+     */
+    public function setState($state = self::STATE_ACTIVE)
+    {
+        $this->state = $state;
+
+        return $this;
+    }
+
 }

+ 3 - 1
src/IPv4Bundle/Form/HostType.php

@@ -18,7 +18,9 @@ class HostType extends AbstractType
             ->add('options')
             ->add('hostType', null, [
                 'required' => false
-            ]);
+            ])
+            ->add('state')
+            ;
     }
 
     /**

+ 4 - 0
src/IPv4Bundle/Resources/translations/IPv4Bundle.es.yml

@@ -22,6 +22,7 @@ form:
     label_allowed_host_type: Tipo de Host permitido
     label_net_group: Grupo de red
     label_ip_pool: IP Pool
+    label_state: Estado
 
 list:
     label_mac: Mac
@@ -40,6 +41,7 @@ list:
     label_allowed_host_type: Tipo de Host permitido
     label_net_group: Grupo de red
     label_ip_pool: IP Pool
+    label_state: Estado
 
 show:
     label_mac: Mac
@@ -57,6 +59,7 @@ show:
     label_allowed_host_type: Tipo de Host permitido
     label_net_group: Grupo de red
     label_ip_pool: IP Pool
+    label_state: Estado
 
 filter:
     label_mac: Mac
@@ -69,6 +72,7 @@ filter:
     label_is_static: Estático
     label_address: Dirección
     label_options: Opciones
+    label_state: Estado
 
 breadcrumb:
     link_host_list: Listado Host

+ 2 - 0
src/IPv4Bundle/tests/Controller/REST/HostRESTControllerTest.php

@@ -3,6 +3,7 @@
 namespace IPv4Bundle\tests\Controller\REST;
 
 use WebserviceBundle\tests\WebTestCaseBase;
+use IPv4Bundle\Entity\Host;
 
 /**
  * Class HostRESTControllerTest
@@ -77,6 +78,7 @@ class HostRESTControllerTest extends BaseRESTControllerTest
             'mac' => 'cafecafecafe',
             'options' => 'cafecafecafe',
             'hostType' => null,
+            'state' => Host::STATE_ACTIVE,
         ];
 
         if ($key == null) {