diff --git a/src/MultiFlexi/Ui/CompanyDbStatus.php b/src/MultiFlexi/Ui/CompanyDbStatus.php index 0e0e958..770e1f3 100644 --- a/src/MultiFlexi/Ui/CompanyDbStatus.php +++ b/src/MultiFlexi/Ui/CompanyDbStatus.php @@ -45,17 +45,17 @@ public function __construct($company) [_('Jobs Total') . ' ', new \Ease\TWB4\PillBadge('info', $jobs)], ['class' => 'btn btn-default', 'type' => 'button'] )); - $this->addColumn(2, new \Ease\Html\ButtonTag( + $this->addColumn(2, new \Ease\TWB4\LinkButton('?showOnly=success&id='.$companyId, [_('Success Jobs') . ' ', new \Ease\TWB4\PillBadge('success', $jobsSuccess)], - ['class' => 'btn btn-default', 'type' => 'button'] + 'success' )); - $this->addColumn(2, new \Ease\TWB4\LinkButton('showOnly=failed&id='.$companyId, + $this->addColumn(2, new \Ease\TWB4\LinkButton('?showOnly=failed&id='.$companyId, [_('Failed Jobs') . ' ', new \Ease\TWB4\PillBadge('danger', $jobs - $jobsSuccess - $jobsUnfinished)], 'danger' )); - $this->addColumn(2, new \Ease\Html\ButtonTag( + $this->addColumn(2, new \Ease\TWB4\LinkButton('?showOnly=unfinished&id='.$companyId, [_('Unfinished Jobs') . ' ', new \Ease\TWB4\PillBadge('warning', $jobsUnfinished)], - ['class' => 'btn btn-default', 'type' => 'button'] + 'warning' )); // $this->addColumn(2, new \Ease\Html\ButtonTag( // [_('Customers') . ' ', new \Ease\TWB4\PillBadge('info', $customers)], diff --git a/src/company.php b/src/company.php index 94da88a..fbd1b2c 100644 --- a/src/company.php +++ b/src/company.php @@ -24,7 +24,25 @@ $companyEnver = new \MultiFlexi\CompanyEnv($companies->getMyKey()); $jobber = new \MultiFlexi\Job(); $jobber->setDataValue('company_id', $companies->getMyKey()); -$jobs = $jobber->listingQuery()->select(['apps.name AS appname', 'apps.image AS appimage', 'job.id', 'begin', 'exitcode', 'launched_by', 'job.executor', 'login', 'job.app_id AS app_id', 'runtemplate.id AS runtemplateid', 'schedule AS scheduled'], true)->leftJoin('apps ON apps.id = job.app_id')->leftJoin('user ON user.id = job.launched_by')->leftJoin('runtemplate ON runtemplate.company_id = job.company_id AND runtemplate.app_id = job.app_id')->where('job.company_id', $companies->getMyKey())->limit(20)->orderBy('job.id DESC')->fetchAll(); + + +$showOnly = WebPage::getRequestValue('showOnly'); +switch ($showOnly) { + case 'failed': + $condition['exitcode'] = [255,128,1]; + break; + case 'unfinished': + $condition['exitcode'] = -1; + break; + case 'success': + $condition['exitcode'] = 0; + break; + default: + $condition = []; + break; +} + +$jobs = $jobber->listingQuery()->select(['apps.name AS appname', 'apps.image AS appimage', 'job.id', 'begin', 'exitcode', 'launched_by', 'job.executor', 'login', 'job.app_id AS app_id', 'runtemplate.id AS runtemplateid', 'schedule AS scheduled'], true)->leftJoin('apps ON apps.id = job.app_id')->leftJoin('user ON user.id = job.launched_by')->leftJoin('runtemplate ON runtemplate.company_id = job.company_id AND runtemplate.app_id = job.app_id')->where('job.company_id', $companies->getMyKey())->limit(20)->orderBy('job.id DESC')->where($condition)->fetchAll(); $jobList = new \Ease\TWB4\Table(); $jobList->addRowHeaderColumns([_('Application'), _('Job ID'), _('Launch time'), _('Exit Code'), _('Launcher'), _('Launch now'), _('Launch in Background')]); foreach ($jobs as $job) {