Beispiel #1
0
 /**
  * @return \Grido\Grid
  */
 protected function createComponentTable()
 {
     $table = new Grid();
     $table->setModel(new ArraySource($this->workerManager->getWorkers()));
     $table->addColumnText('id', 'ID')->getCellPrototype()->width = '40%';
     $table->addColumnText('state', 'State')->setCustomRender(function ($data) {
         $lastCheck = \DateTime::createFromFormat('Y-m-d H:i:s', $data['lastCheck']);
         $lastCheck->modify('+' . ($this->workerManager->getInterval() + 7) . ' second');
         return $lastCheck < new \DateTime() ? 'break' : $data['state'];
     })->getCellPrototype()->width = '20%';
     $table->addColumnText('lastCheck', 'Last check')->getCellPrototype()->width = '30%';
     $table->addColumnText('lastJob', 'Last job')->getCellPrototype()->width = '30%';
     $table->addActionEvent('debug', 'Debug')->onClick[] = $this->tableDebugClick;
     $table->addActionEvent('restart', 'Restart')->onClick[] = $this->tableRestartClick;
     $table->addActionEvent('stop', 'Stop')->onClick[] = $this->tableStopClick;
     return $table;
 }