/** * @param Bot $bot * @param Job $job * @return array */ private function _getBotData($bot, $job) { $botData = array(); $botData['id'] = $bot->id; $botData['name'] = $bot->getName(); $botData['status'] = $bot->getStatus(); $botData['status_class'] = BotStatus::getStatusHTMLClass($bot); $botData['url'] = $bot->getUrl(); $botData['last_seen'] = BotLastSeen::getHTML($bot); $webcam = $bot->getWebCamImage(); if ($webcam->isHydrated()) { $botData['webcam_url'] = $webcam->getDownloadURL(); } else { $botData['webcam_url'] = "/img/colorbars.gif"; } $buttons = $this->_getStatusButtons($bot); $menu = array(); $status = $bot->getStatus(); if ($status == BotState::Working) { $menu[] = $buttons['pause']; $menu[] = $buttons['dropjob']; $menu[] = $buttons['edit']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Paused) { $menu[] = $buttons['play']; $menu[] = $buttons['dropjob']; $menu[] = $buttons['edit']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Slicing) { $menu[] = $buttons['dropjob']; $menu[] = $buttons['edit']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Waiting) { $menu[] = $buttons['qa']; $menu[] = $buttons['edit']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Idle) { $menu[] = $buttons['offline']; $menu[] = $buttons['edit']; $menu[] = $buttons['error']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Offline) { $menu[] = $buttons['online']; $menu[] = $buttons['edit']; $menu[] = $buttons['error']; $menu[] = $buttons['delete']; $menu[] = $buttons['retire']; } else { if ($status == BotState::Maintenance) { $menu[] = $buttons['online']; $menu[] = $buttons['offline']; $menu[] = $buttons['edit']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Error) { $menu[] = $buttons['online']; $menu[] = $buttons['offline']; $menu[] = $buttons['edit']; $menu[] = $buttons['delete']; } else { if ($status == BotState::Retired) { $menu[] = $buttons['delete']; } } } } } } } } } $botData['menu'] = $menu; if ($job->isHydrated()) { $jobData = array(); $jobData['id'] = $job->id; $jobData['name'] = $job->getName(); $jobData['url'] = $job->getUrl(); $jobData['status'] = $job->get('status'); $jobData['status_class'] = JobStatus::getStatusHTMLClass($job->get('status')); $jobData['elapsed'] = $job->getElapsedText(); $jobData['estimated'] = $job->getEstimatedText(); if ($job->get('status') == 'taken' || $job->get('status') == 'slicing') { $jobData['progress'] = round($job->get('progress'), 2); $jobData['bar_class'] = ""; } $temps = JSON::decode($bot->get('temperature_data')); if ($bot->get('status') == BotState::Working && $temps !== NULL) { if (isset($temps->extruder)) { $botData['temp_extruder'] = $temps->extruder; } if (isset($temps->bed)) { $botData['temp_bed'] = $temps->bed; } } if ($job->get('status') == 'qa') { $jobData['qa_url'] = $job->getUrl() . "/qa"; } $sliceJob = $job->getSliceJob(); if ($job->get('status') == 'slicing' && $sliceJob->get('status') == 'pending') { $jobData['qa_url'] = $sliceJob->getUrl(); $jobData['bar_class'] = "bar-warning"; // Set it to 100% so it actually displays $jobData['progress'] = 100.0; } $botData['job'] = $jobData; } if ($bot->get('status') == 'error') { $botData['error_text'] = $bot->get('error_text'); return $botData; } return $botData; }
echo $size; ?> bot_thumbnail bot_thumbnail_<?php echo $size; ?> "> <div class="bot_thumbnail_content"> <div class="bot_thumbnail_stretcher"></div> <div class="real_bot_thumbnail_content"> <div class="bot_header"> <h3> <?php echo $b->getLink(); ?> <span class="muted">- <?php echo BotLastSeen::getHTML($b); ?> <?php if ($j->isHydrated() && $j->get('status') == 'taken' && $size > 3) { ?> - Runtime: <?php echo $j->getElapsedText(); ?> <?php } ?> </span> </h3> <?php echo BotStatus::getStatusHTML($b); ?>