123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <?php
- namespace FTTHBundle\Admin;
- use FTTHBundle\Form\AnchorType;
- use Sonata\AdminBundle\Datagrid\DatagridMapper;
- use Sonata\AdminBundle\Datagrid\ListMapper;
- use Sonata\AdminBundle\Form\FormMapper;
- use Sonata\AdminBundle\Form\Type\CollectionType;
- use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
- use Sonata\AdminBundle\Form\Type\ModelType;
- use Sonata\AdminBundle\Show\ShowMapper;
- use WorkflowBundle\Admin\WorkflowBaseAdmin;
- class OLTAdmin extends WorkflowBaseAdmin
- {
- public function configure()
- {
- $this->setTemplate('create', 'FTTHBundle:OLT:form.html.twig');
- $this->setTemplate('edit', 'FTTHBundle:OLT:form.html.twig');
- }
- /**
- * @param DatagridMapper $datagridMapper
- */
- protected function configureDatagridFilters(DatagridMapper $datagridMapper)
- {
- $datagridMapper
- ->add('name')
- ->add('model')
- ->add('ip')
- ->add('snmpCommunity')
- ->add('sshUser')
- ->add('sshPass')
- ->add('enablePass')
- ->add('sshConnect')
- ->add('sshPort')
- ->add('backups')
- ;
- }
- /**
- * @param ListMapper $listMapper
- */
- protected function configureListFields(ListMapper $listMapper)
- {
- $listMapper
- ->add('name')
- ->add('model')
- ->add('ip')
- ->add('snmpCommunity')
- ->add('sshUser')
- ->add('sshPass')
- ->add('enablePass')
- ->add('sshConnect')
- ->add('sshPort')
- ->add('enable')
- ->add('backups')
- ->add('currentState','string', array('template' => 'WorkflowBundle:Workflow:base_list_field_current_state.html.twig'))
- ->add('_action', 'with-workflow-action', array(
- 'actions' => array(
- 'show' => array(),
- 'edit' => array(),
- 'delete' => array(),
- 'state' => array('template' => 'WorkflowBundle:Workflow:show_transitions.html.twig')
- )
- ))
- ;
- }
- /**
- * @param FormMapper $formMapper
- */
- protected function configureFormFields(FormMapper $formMapper)
- {
- $formMapper
- ->tab('default')
- ->with('')
- ->add('name')
- ->add('model', null, [
- 'query_builder' => function($qb) {
- return $qb->createQueryBuilder('o')
- ->orderBy('o.name', 'ASC')
- ;
- },
- ])
- ->end()
- ->end()
- ->tab('configuration')
- ->with('OLT')
- ->add('ip')
- ->add('snmpCommunity')
- ->add('sshUser')
- ->add('sshPass')
- ->add('enablePass')
- ->add('sshConnect', null, [
- 'help' => 'form.help_ssh_connect',
- ])
- ->add('sshPort')
- ->end()
- ->end()
- ->tab('autodiscovery')
- ->with('olt_discovery_configuration')
- ->add('timeDiscovery', 'integer', array('attr' => array('min' => 0), 'help' => 'Set 0 to disable autodiscovery or set a x number to scan each x minutes the ONUs connected but without configuration'))
- ->add('clientId')
- ->add('discoveryProfile', null, array('help' => 'Profile to set the ONUs by autodiscovery'))
- ->end()
- ->end()
- ->tab('stats')
- ->with('olt_execute_time')
- ->add('executeSnmp')
- ->add('timeScan', 'integer', array('attr' => array('min' => 0)))
- ->add('timeOnuStats', 'integer', array('attr' => array('min' => 0)))
- ->add('timePonStats', 'integer', array('attr' => array('min' => 0)))
- ->add('timeOltOctets', 'integer', array('attr' => array('min' => 0)))
- ->end()
- ->end()
- ->tab('Backups')
- ->with('Backup OLT')
- ->add('backups')
- ->add('files', AnchorType::class, array(
- 'required' => false,
- 'data' => $this->getSubject()->obtainFiles($this->getParameter('backups'))
- ))
- ->end()
- ->end()
- ;
- }
- /**
- * @param ShowMapper $showMapper
- */
- protected function configureShowFields(ShowMapper $showMapper)
- {
- $showMapper
- ->tab('default')
- ->with('')
- ->add('name')
- ->add('model')
- ->add('ip')
- ->add('snmpCommunity')
- ->add('sshUser')
- ->add('sshPass')
- ->add('enablePass')
- ->add('sshConnect')
- ->add('sshPort')
- ->add('enable')
- ->end()
- ->end()
- ->tab('Log')
- ->with('Log')
- ->add('deviceLog','string', array(
- 'template' => 'DeviceBundle::show_device_log.html.twig',
- 'translation_domain' => 'DeviceBundle',
- ))
- ->end()
- ->end()
- ->tab('Backups')
- ->with('Backup OLT')
- ->add('backups')
- ->add('files', 'string', array(
- 'template' => 'FTTHBundle::show_backup_log.html.twig',
- 'translation_domain' => 'FTTHBundle'
- ))
- ->end()
- ->end()
- ;
- }
- }
|