public $verifyOptions = array('jobname' => 'Verify by Job Name', 'jobid' => 'Verify by JobId');
- public function configure($jobId) {
+ public function configure($jobId, $params = array()) {
$jobdata = $this->Application->getModule('api')->get(array('jobs', $jobId))->output;
$this->JobName->Text = $jobdata->job;
$this->JobID->Text = $jobdata->jobid;
$joblog = $this->Application->getModule('api')->get(array('joblog', $jobdata->jobid))->output;
+ $runningJobStates = $this->Application->getModule('misc')->getRunningJobStates();
+ if (in_array($jobdata->jobstatus, $runningJobStates)) {
+ $this->Estimation->CssClass = 'textbox-auto wheel-loader';
+ } else {
+ $this->Estimation->CssClass = 'textbox-auto';
+ }
$this->Estimation->Text = is_array($joblog) ? implode(PHP_EOL, $joblog) : Prado::localize("Output for selected job is not available yet or you do not have enabled logging job logs to catalog database. For watching job log there is need to add to the job Messages resource next directive: console = all, !skipped, !saved");
$this->Level->dataSource = $this->Application->getModule('misc')->getJobLevels();
foreach($filesetsAll as $director => $filesets) {
$filesetsList = array_merge($filesets, $filesetsList);
}
+ $selectedFileset = '';
if($jobdata->filesetid != 0) {
- $selectedFileset = $this->Application->getModule('api')->get(array('filesets', $jobdata->filesetid), true)->output;
+ $selectedFileset = $this->Application->getModule('api')->get(array('filesets', $jobdata->filesetid), true)->output->fileset;
}
$this->FileSet->dataSource = array_combine($filesetsList, $filesetsList);
- $this->FileSet->SelectedValue = @$selectedFileset->fileset;
+ $this->FileSet->SelectedValue = array_key_exists('fileset', $params) ? $params['fileset'] : $selectedFileset;
$this->FileSet->dataBind();
$pools = $this->Application->getModule('api')->get(array('pools'), true)->output;
$poolList[$pool->poolid] = $pool->name;
}
$this->Pool->dataSource = $poolList;
- $this->Pool->SelectedValue = $jobdata->poolid;
+ $this->Pool->SelectedValue = array_key_exists('poolid', $params) ? $params['poolid'] : $jobdata->poolid;
$this->Pool->dataBind();
$jobshow = $this->Application->getModule('api')->get(array('jobs', 'show', $jobdata->jobid), true)->output;
$this->Storage->dataBind();
$runningJobStates = $this->Application->getModule('misc')->getRunningJobStates();
+ $isJobRunning = in_array($jobdata->jobstatus, $runningJobStates);
$this->Priority->Text = ($jobdata->priorjobid == 0) ? self::DEFAULT_JOB_PRIORITY : $jobdata->priorjobid;
$this->DeleteButton->Visible = true;
- $this->CancelButton->Visible = $this->RefreshStart->Value = in_array($jobdata->jobstatus, $runningJobStates);
+ $this->CancelButton->Visible = $isJobRunning;
+ $this->RefreshStart->Value = $isJobRunning;
$this->Run->Display = 'Dynamic';
$this->EstimateLine->Display = 'Dynamic';
$this->Status->Visible = true;
}
public function status($sender, $param) {
- $refreshStart = false;
- for ($i = 0; $i < count($_SESSION['monitor_data']['running_jobs']); $i++) {
- if ($_SESSION['monitor_data']['running_jobs'][$i]->jobid == $this->JobID->Text) {
- $refreshStart = true;
- break;
- }
+ $jobdata = $this->Application->getModule('api')->get(array('jobs', $this->JobID->Text))->output;
+ $runningJobStates = $this->Application->getModule('misc')->getRunningJobStates();
+ if (in_array($jobdata->jobstatus, $runningJobStates)) {
+ $this->RefreshStart->Value = true;
+ } else {
+ $this->RefreshStart->Value = false;
+ $this->CancelButton->Visible = false;
+ $this->Estimation->CssClass = 'textbox-auto';
}
- $this->RefreshStart->Value = $refreshStart;
$joblog = $this->Application->getModule('api')->get(array('joblog', $this->JobID->Text))->output;
$this->Estimation->Text = is_array($joblog) ? implode(PHP_EOL, $joblog) : Prado::localize("Output for selected job is not available yet or you do not have enabled logging job logs to catalog database. For watching job log there is need to add to the job Messages resource next directive: console = all, !skipped, !saved");
$this->Run->Display = 'None';
$this->DeleteButton->Visible = false;
$this->EstimateLine->Display = 'None';
+ $this->Estimation->CssClass = 'textbox-auto';
}
public function cancel($sender, $param) {
$this->Application->getModule('api')->set(array('jobs', 'cancel', $this->JobID->Text), array('a' => 'b'));
$this->CancelButton->Visible = false;
$this->status(null, null);
+ $this->Estimation->CssClass = 'textbox-auto';
}
public function run_again($sender, $param) {
}
}
$result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
- if (!is_null($sender) || !is_numeric($param)) {
+ $startedJobId = $this->Application->getModule('misc')->findJobIdStartedJob($result);
+ if (is_numeric($startedJobId)) {
+ $params['jobid'] = $startedJobId;
+ $this->configure($startedJobId, $params);
+ } else {
$this->Estimation->Text = implode(PHP_EOL, $result);
}
}
<div class="text"><com:TLabel ForControl="Accurate" Text="<%[ Accurate: ]%>" /></div>
<div class="field"><com:TActiveCheckBox ID="Accurate" AutoPostBack="false" /></div>
</com:TPanel>
- <com:TCallback ID="ReloadRunJobs" OnCallback="Page.JobRunWindow.prepareData" ClientSide.OnComplete="RunSlideWindow.getObj('JobRunWindow').setLoadRequest();" />
+ <div class="line">
+ <div class="text"><com:TLabel ForControl="GoToStartedJob" Text="<%[ Go to started job after start: ]%>" /></div>
+ <div class="field"><com:TActiveCheckBox ID="GoToStartedJob" AutoPostBack="false" Checked="true" /></div>
+ </div>
+ <com:TCallback ID="ReloadRunJobs" OnCallback="Page.JobRunWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('JobRunWindow').setLoadRequest();" />
<script type="text/javascript">
var jobrun_callback_func = function() {
/* If Job Run list window is not open or if actually toolbar is used
<com:BActiveButton ID="Run" Text="<%[ Run job ]%>" ValidationGroup="JobRunGroup" CausesValidation="true" OnClick="run_job">
<prop:ClientSide.OnSuccess>
ConfigurationWindow.getObj('JobRunWindow').progress(false);
+ oMonitor();
jobrun_callback_func();
if (Prado.Validation.isValid(Prado.Validation.getForm(), 'JobRunGroup') === true) {
- ConfigurationWindow.getObj('JobRunWindow').switchTab('jobrun_console_tab');
+ if ($('<%=$this->GoToStartedJob->ClientID%>').checked === true) {
+ ConfigurationWindow.getObj('JobWindow').progress(false);
+ ConfigurationWindow.getObj('JobWindow').show();
+ ConfigurationWindow.getObj('JobWindow').switchTabByNo(2);
+ } else {
+ ConfigurationWindow.getObj('JobRunWindow').switchTab('jobrun_console_tab');
+ }
}
</prop:ClientSide.OnSuccess>
</com:BActiveButton>
<com:BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" OnClick="estimate">
<prop:ClientSide.OnSuccess>
ConfigurationWindow.getObj('JobRunWindow').progress(false);
- jobrun_callback_func();
- oMonitor();
if (Prado.Validation.isValid(Prado.Validation.getForm(), 'JobRunGroup') === true) {
ConfigurationWindow.getObj('JobRunWindow').switchTab('jobrun_console_tab');
}