if (!$this->IsPostBack && !$this->IsCallBack) {
$this->postInitActions();
$this->getModule('api')->initSessionCache(true);
- $this->setSessionUserVars();
+ if (!key_exists('user_vars', $_SESSION) || $_SESSION['user_vars'] === false) {
+ $this->setSessionUserVars();
+ }
}
}
// Set config main component names
$config = $this->getModule('api')->get(array('config'), null, false);
- $_SESSION['dir'] = $_SESSION['sd'] = $_SESSION['fd'] = $_SESSION['bcons'] = '';
if ($config->error === 0) {
for ($i = 0; $i < count($config->output); $i++) {
$component = (array)$config->output[$i];
}
}
}
+ $_SESSION['user_vars'] = true;
+ }
+
+ public function resetSessionUserVars() {
+ $_SESSION['user_vars'] = false;
+ $_SESSION['director'] = $_SESSION['dir'] = $_SESSION['sd'] = $_SESSION['fd'] = $_SESSION['bcons'] = '';
}
/**
$error = null;
$params = $this->Request->contains('params') ? $this->Request['params'] : [];
- if (is_array($params) && key_exists('jobs', $params)) {
+ if (key_exists('jobs', $params)) {
$job_params = ['jobs'];
$job_query = [];
if (is_array($params['jobs'])) {
$error = $result;
}
}
- if (!$error) {
- $result = $this->getModule('api')->get(['jobs', '?jobstatus=CR']);
- if ($result->error === 0) {
- $monitor_data['running_jobs'] = $result->output;
- } else {
- $error = $result;
- }
- }
if (!$error && key_exists('clients', $params)) {
$result = $this->getModule('api')->get(['clients']);
if ($result->error === 0) {
}
}
- $running_job_states = $this->Application->getModule('misc')->getRunningJobStates();
-
if (key_exists('jobs', $params)) {
+ $running_job_states = $this->Application->getModule('misc')->getRunningJobStates();
for ($i = 0; $i < count($monitor_data['jobs']); $i++) {
- if (!in_array($monitor_data['jobs'][$i]->jobstatus, $running_job_states)) {
+ if (in_array($monitor_data['jobs'][$i]->jobstatus, $running_job_states)) {
+ $monitor_data['running_jobs'][] = $monitor_data['jobs'][$i];
+ } else {
$monitor_data['terminated_jobs'][] = $monitor_data['jobs'][$i];
}
}
+ } elseif (!$error) {
+ $result = $this->getModule('api')->get(['jobs', '?jobstatus=CR']);
+ if ($result->error === 0) {
+ $monitor_data['running_jobs'] = $result->output;
+ } else {
+ $error = $result;
+ }
}
+
if (is_object($error)) {
$monitor_data['error'] = $error;
}