*/
const JOB_RESULT_VIEW_BASIC = 'basic';
const JOB_RESULT_VIEW_FULL = 'full';
+ const JOB_RESULT_VIEW_ADVANCED = 'advanced';
/**
* Get job status groups.
$where = Database::getWhere($criteria);
$job_record = 'Job.*,';
+ $join = '';
if ($view == self::JOB_RESULT_VIEW_BASIC) {
$job_record = implode(',', $this->basic_mode_job_props) . ',';
+ } elseif ($view == self::JOB_RESULT_VIEW_ADVANCED) {
+ $job_record = 'Job.*, PriorJob.Name AS priorjobname,';
+ $join = ' LEFT JOIN Job AS PriorJob ON (Job.PriorJobId = PriorJob.JobId) ';
}
$sql = 'SELECT ' . $job_record . '
JOIN Client USING (ClientId)
LEFT JOIN Pool USING (PoolId)
LEFT JOIN FileSet USING (FilesetId)'
-. $where['where'] . $order . $limit . $offset;
+. $join . $where['where'] . $order . $limit . $offset;
$statement = Database::runQuery($sql, $where['params']);
$result = [];
$order_by = $this->Request->contains('order_by') && $misc->isValidColumn($this->Request['order_by']) ? $this->Request['order_by']: 'JobId';
$order_direction = $this->Request->contains('order_direction') && $misc->isValidOrderDirection($this->Request['order_direction']) ? $this->Request['order_direction']: 'DESC';
$mode = ($this->Request->contains('overview') && $misc->isValidBooleanTrue($this->Request['overview'])) ? JobManager::JOB_RESULT_MODE_OVERVIEW : JobManager::JOB_RESULT_MODE_NORMAL;
+ $view = ($this->Request->contains('view') && $misc->isValidResultView($this->Request['view'])) ? $this->Request['view'] : JobManager::JOB_RESULT_VIEW_FULL;
if (!empty($jobids)) {
/**
$offset,
$order_by,
$order_direction,
- $mode
+ $mode,
+ $view
);
$this->output = $result;
$this->error = JobError::ERROR_NO_ERRORS;
}
public function isValidResultView($view) {
- return (preg_match('/^(basic|full)$/', $view) === 1);
+ return (preg_match('/^(basic|full|advanced)$/', $view) === 1);
}
public function isValidVolType($voltype) {