const LICENCE_FILE = 'LICENSE';
- private $jobLevels = array('F' => 'Full', 'I' => 'Incremental', 'D'=> 'Differential', 'B' => 'Base', 'f' => 'VirtualFull');
+ private $jobTypes = array(
+ 'B' => 'Backup',
+ 'M' => 'Migrated',
+ 'V' => 'Verify',
+ 'R' => 'Restore',
+ 'I' => 'Internal',
+ 'D' => 'Admin',
+ 'A' => 'Archive',
+ 'C' => 'Copy',
+ 'g' => 'Migration'
+ );
+
+ private $jobLevels = array(
+ 'F' => 'Full',
+ 'I' => 'Incremental',
+ 'D' => 'Differential',
+ 'B' => 'Base',
+ 'f' => 'VirtualFull',
+ 'V' => 'InitCatalog',
+ 'C' => 'Catalog',
+ 'O' => 'VolumeToCatalog',
+ 'd' => 'DiskToCatalog'
+ );
+
+ private $jobStates = array(
+ 'C' => array('value' => 'Created', 'description' =>'Created but not yet running'),
+ 'R' => array('value' => 'Running', 'description' => 'Running'),
+ 'B' => array('value' => 'Blocked', 'description' => 'Blocked'),
+ 'T' => array('value' => 'Terminated', 'description' =>'Terminated normally'),
+ 'W' => array('value' => 'Terminated with warnings', 'description' =>'Terminated normally with warnings'),
+ 'E' => array('value' => 'Error', 'description' =>'Terminated in Error'),
+ 'e' => array('value' => 'Non-fatal error', 'description' =>'Non-fatal error'),
+ 'f' => array('value' => 'Fatal error', 'description' =>'Fatal error'),
+ 'D' => array('value' => 'Verify Diff.', 'description' =>'Verify Differences'),
+ 'A' => array('value' => 'Canceled by user', 'description' =>'Canceled by the user'),
+ 'I' => array('value' => 'Incomplete', 'description' =>'Incomplete Job'),
+ 'F' => array('value' => 'Waiting on FD', 'description' =>'Waiting on the File daemon'),
+ 'S' => array('value' => 'Waiting on SD', 'description' =>'Waiting on the Storage daemon'),
+ 'm' => array('value' => 'Waiting for new vol.', 'description' =>'Waiting for a new Volume to be mounted'),
+ 'M' => array('value' => 'Waiting for mount', 'description' =>'Waiting for a Mount'),
+ 's' => array('value' => 'Waiting for storage', 'description' =>'Waiting for Storage resource'),
+ 'j' => array('value' => 'Waiting for job', 'description' =>'Waiting for Job resource'),
+ 'c' => array('value' => 'Waiting for client', 'description' =>'Waiting for Client resource'),
+ 'd' => array('value' => 'Waiting for Max. jobs', 'description' =>'Wating for Maximum jobs'),
+ 't' => array('value' => 'Waiting for start', 'description' =>'Waiting for Start Time'),
+ 'p' => array('value' => 'Waiting for higher priority', 'description' =>'Waiting for higher priority job to finish'),
+ 'i' => array('value' => 'Batch insert', 'description' =>'Doing batch insert file records'),
+ 'a' => array('value' => 'Despooling attributes', 'description' =>'SD despooling attributes'),
+ 'l' => array('value' => 'Data despooling', 'description' =>'Doing data despooling'),
+ 'L' => array('value' => 'Commiting data', 'description' =>'Committing data (last despool)')
+ );
+
+ private $runningJobStates = array('C', 'R');
/**
* Getting the licence from file.
return $this->jobLevels;
}
+ public function getJobState($jobStateLetter = null) {
+ $state;
+ if(is_null($jobStateLetter)) {
+ $state = $this->jobStates;
+ } else {
+ $state = array_key_exists($jobStateLetter, $this->jobStates) ? $this->jobStates[$jobStateLetter] : null;
+ }
+ return $state;
+ }
+
+ public function getRunningJobStates() {
+ return $this->runningJobStates;
+ }
+
+
+ public function getJobType($jobTypeLetter = null) {
+ $type;
+ if(is_null($jobTypeLetter)) {
+ $type = $this->jobTypes;
+ } else {
+ $type = array_key_exists($jobTypeLetter, $this->jobTypes) ? $this->jobTypes[$jobTypeLetter] : null;
+ }
+ return $type;
+
+ }
+
public function isValidJobLevel($jobLevel) {
return array_key_exists($jobLevel, $this->getJobLevels());
}
return $elements;
}
}
-?>
\ No newline at end of file
+?>
msgid "Yes"
msgstr "Yes"
+msgid "JobId to Verify:"
+msgstr "JobId to Verify:"
+
+msgid "JobId to Verify value must be integer greather than 0."
+msgstr "JobId to Verify value must be integer greather than 0."
+
+msgid "Job to Verify:"
+msgstr "Job to Verify:"
+
+msgid "Verify by Job Name"
+msgstr "Verify by Job Name"
+
+msgid "Verify by JobId"
+msgstr "Verify by JobId"
+
+msgid "Verify option:"
+msgstr "Verify option:"
msgstr "Lokalizacja pliku DB (tylko SQLite):"
msgid "Delete job"
-msgstr "Usuń zadanie"
+msgstr "Usuń"
msgid "Cancel job"
-msgstr "Anuluj zadanie"
+msgstr "Przerwij"
msgid "select pool"
msgstr "wybierz pulę"
msgstr "Zadania do uruchomienia"
msgid "Job status"
-msgstr "Status zadania"
+msgstr "Status"
msgid "Run job again"
msgstr "Uruchom ponownie"
msgid "Step 7 - Finish"
msgstr "Krok 7 - Podsumowanie"
+msgid "JobId to Verify:"
+msgstr "JobId do weryfikacji:"
+
+msgid "JobId to Verify value must be integer greather than 0."
+msgstr "JobId do weryfikacji musi być liczbą całkowitą większą od 0."
+
+msgid "Job to Verify:"
+msgstr "Zadanie do weryfikacji:"
+
+msgid "Verify by Job Name"
+msgstr "Weryfikuj na podstawie nazwy zadania"
+
+msgid "Verify by JobId"
+msgstr "Weryfikuj na podstawie JobId"
+
+msgid "Verify option:"
+msgstr "Opcja weryfikacji:"
+
$poolid = property_exists($params, 'poolid') ? intval($params->poolid) : null;
$pool = $this->getModule('pool')->getPoolById($poolid);
$priority = property_exists($params, 'priority') ? intval($params->priority) : 10; // default priority is set to 10
+ $jobid = property_exists($params, 'jobid') ? 'jobid="' . intval($params->jobid) . '"' : '';
+ // @TODO: Move Job name pattern in more appropriate place
+ $verifyjob = property_exists($params, 'verifyjob') && preg_match('/^[\w\d\.\-\s]+$/', $params->verifyjob) === 1 ? 'verifyjob="' . ($params->verifyjob) . '"' : '';
if(!is_null($job)) {
$isValidLevel = $this->getModule('misc')->isValidJobLevel($params->level);
if(!is_null($storage)) {
if(!is_null($pool)) {
$joblevels = $this->getModule('misc')->getJobLevels();
- $run = $this->getModule('bconsole')->bconsoleCommand($this->director, array('run', 'job="' . $job . '"', 'level="' . $joblevels[$level] . '"', 'fileset="' . $fileset . '"', 'client="' . $client->name . '"', 'storage="' . $storage->name . '"', 'pool="' . $pool->name . '"' , 'priority="' . $priority . '"', 'yes'), $this->user);
+ $run = $this->getModule('bconsole')->bconsoleCommand($this->director, array('run', 'job="' . $job . '"', 'level="' . $joblevels[$level] . '"', 'fileset="' . $fileset . '"', 'client="' . $client->name . '"', 'storage="' . $storage->name . '"', 'pool="' . $pool->name . '"' , 'priority="' . $priority . '"', $jobid , $verifyjob, 'yes'), $this->user);
$this->output = $run->output;
$this->error = (integer)$run->exitcode;
} else {
}
}
-?>
\ No newline at end of file
+?>
* Bacula® is a registered trademark of Kern Sibbald.
*/
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
Prado::using('Application.Portlets.Portlets');
class JobConfiguration extends Portlets {
const DEFAULT_JOB_PRIORITY = 10;
- private $runningJobStates = array('C', 'R');
+
+ public $jobToVerify = array('C', 'O', 'd');
+
+ public $verifyOptions = array('jobname' => 'Verify by Job Name', 'jobid' => 'Verify by JobId');
public function configure($jobId) {
$jobdata = $this->Application->getModule('api')->get(array('jobs', $jobId))->output;
$this->Level->SelectedValue = $jobdata->level;
$this->Level->dataBind();
+ $isVerifyOption = in_array($jobdata->level, $this->jobToVerify);
+ $this->JobToVerifyOptionsLine->Display = ($isVerifyOption === true) ? 'Dynamic' : 'None';
+ $this->JobToVerifyJobNameLine->Display = ($isVerifyOption === true) ? 'Dynamic' : 'None';
+ $this->JobToVerifyJobIdLine->Display = 'None';
+ $this->AccurateLine->Display = ($isVerifyOption === true) ? 'None' : 'Dynamic';
+ $this->EstimateLine->Display = ($isVerifyOption === true) ? 'None' : 'Dynamic';
+
+ $verifyValues = array();
+
+ foreach($this->verifyOptions as $value => $text) {
+ $verifyValues[$value] = Prado::localize($text);
+ }
+
+ $this->JobToVerifyOptions->dataSource = $verifyValues;
+ $this->JobToVerifyOptions->dataBind();
+
+ $jobTasks = $this->Application->getModule('api')->get(array('jobs', 'tasks'))->output;
+
+ $jobsAllDirs = array();
+ foreach($jobTasks as $director => $tasks) {
+ $jobsAllDirs = array_merge($jobsAllDirs, $tasks);
+ }
+
+ $this->JobToVerifyJobName->dataSource = array_combine($jobsAllDirs, $jobsAllDirs);
+ $this->JobToVerifyJobName->dataBind();
+
$clients = $this->Application->getModule('api')->get(array('clients'))->output;
$clientsList = array();
foreach($clients as $client) {
$this->Storage->dataSource = $storagesList;
$this->Storage->dataBind();
+ $runningJobStates = $this->Application->getModule('misc')->getRunningJobStates();
+
$this->Priority->Text = ($jobdata->priorjobid == 0) ? self::DEFAULT_JOB_PRIORITY : $jobdata->priorjobid;
$this->DeleteButton->Visible = true;
- $this->CancelButton->Visible = in_array($jobdata->jobstatus, $this->runningJobStates);
+ $this->CancelButton->Visible = in_array($jobdata->jobstatus, $runningJobStates);
}
public function status($sender, $param) {
$params['storageid'] = $this->Storage->SelectedValue;
$params['poolid'] = $this->Pool->SelectedValue;
$params['priority'] = $this->Priority->Text;
+
+ if (in_array($this->Level->SelectedItem->Value, $this->jobToVerify)) {
+ $verifyVals = $this->getVerifyVals();
+ if ($this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobname']) {
+ $params['verifyjob'] = $this->JobToVerifyJobName->SelectedValue;
+ } elseif ($this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobid']) {
+ $params['jobid'] = $this->JobToVerifyJobId->Text;
+ }
+ }
+
$result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
$this->Estimation->Text = implode(PHP_EOL, $result);
}
$isValid = preg_match('/^[0-9]+$/',$this->Priority->Text) === 1 && $this->Priority->Text > 0;
$param->setIsValid($isValid);
}
+
+ public function jobIdToVerifyValidator($sender, $param) {
+ $verifyVals = $this->getVerifyVals();
+ if(in_array($this->Level->SelectedValue, $this->jobToVerify) && $this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobid']) {
+ $isValid = preg_match('/^[0-9]+$/',$this->JobToVerifyJobId->Text) === 1 && $this->JobToVerifyJobId->Text > 0;
+ } else {
+ $isValid = true;
+ }
+ $param->setIsValid($isValid);
+ return $isValid;
+ }
+
+ private function getVerifyVals() {
+ $verifyOpt = array_keys($this->verifyOptions);
+ $verifyVals = array_combine($verifyOpt, $verifyOpt);
+ return $verifyVals;
+ }
}
?>
<div class="line">
<div class="text"><com:TLabel ForControl="Level" Text="<%[ Level: ]%>" /></div>
<div class="field">
- <com:TActiveDropDownList ID="Level" AutoPostBack="false" CssClass="textbox-auto" />
+ <com:TActiveDropDownList ID="Level" AutoPostBack="false" CssClass="textbox-auto">
+ <prop:Attributes.onchange>
+ var job_to_verify = $('<%=$this->JobToVerifyOptionsLine->ClientID%>');
+ var verify_options = $('<%=$this->JobToVerifyOptionsLine->ClientID%>');
+ var verify_by_job_name = $('<%=$this->JobToVerifyJobNameLine->ClientID%>');
+ var verify_by_jobid = $('<%=$this->JobToVerifyJobIdLine->ClientID%>');
+ var accurate = $('<%=$this->AccurateLine->ClientID%>');
+ var estimate = $('<%=$this->EstimateLine->ClientID%>');
+ var verify_current_opt = $('<%=$this->JobToVerifyOptions->ClientID%>').value;
+ if(/^(<%=implode('|', $this->jobToVerify)%>)$/.test(this.value)) {
+ accurate.hide();
+ estimate.hide();
+ verify_options.show();
+ job_to_verify.show();
+ if (verify_current_opt == 'jobid') {
+ verify_by_job_name.hide();
+ verify_by_jobid.show();
+ } else if (verify_current_opt == 'jobname') {
+ verify_by_job_name.show();
+ verify_by_jobid.hide();
+ }
+ } else if (job_to_verify.visible()) {
+ job_to_verify.hide();
+ verify_options.hide();
+ verify_by_job_name.hide();
+ verify_by_jobid.hide();
+ accurate.show();
+ estimate.show();
+ }
+ </prop:Attributes.onchange>
+ </com:TActiveDropDownList>
</div>
</div>
+ <com:TActivePanel ID="JobToVerifyOptionsLine" CssClass="line">
+ <div class="text"><com:TLabel ForControl="JobToVerifyOptions" Text="<%[ Verify option: ]%>" /></div>
+ <div class="field">
+ <com:TActiveDropDownList ID="JobToVerifyOptions" AutoPostBack="false" CssClass="textbox-auto">
+ <prop:Attributes.onchange>
+ var verify_by_job_name = $('<%=$this->JobToVerifyJobNameLine->ClientID%>');
+ var verify_by_jobid = $('<%=$this->JobToVerifyJobIdLine->ClientID%>');
+ if (this.value == 'jobname') {
+ verify_by_jobid.hide();
+ verify_by_job_name.show();
+ } else if (this.value == 'jobid') {
+ verify_by_job_name.hide();
+ verify_by_jobid.show();
+ } else {
+ verify_by_job_name.hide();
+ verify_by_jobid.hide();
+ }
+ </prop:Attributes.onchange>
+ </com:TActiveDropDownList>
+ </div>
+ </com:TActivePanel>
+ <com:TActivePanel ID="JobToVerifyJobNameLine" CssClass="line">
+ <div class="text"><com:TLabel ForControl="JobToVerifyJobName" Text="<%[ Job to Verify: ]%>" /></div>
+ <div class="field">
+ <com:TActiveDropDownList ID="JobToVerifyJobName" AutoPostBack="false" CssClass="textbox-auto" />
+ </div>
+ </com:TActivePanel>
+ <com:TActivePanel ID="JobToVerifyJobIdLine" CssClass="line">
+ <div class="text"><com:TLabel ForControl="JobToVerifyJobId" Text="<%[ JobId to Verify: ]%>" /></div>
+ <div class="field">
+ <com:TActiveTextBox ID="JobToVerifyJobId" CssClass="textbox-auto" AutoPostBack="false" />
+ <com:TActiveCustomValidator ID="JobToVerifyJobIdValidator" ValidationGroup="JobGroup" ControlToValidate="JobToVerifyJobId" ErrorMessage="<%[ JobId to Verify value must be integer greather than 0. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="jobIdToVerifyValidator" />
+ </div>
+ </com:TActivePanel>
<div class="line">
<div class="text"><com:TLabel ForControl="Client" Text="<%[ Client: ]%>" /></div>
<div class="field">
<div class="field-full" style="min-height: 166px">
<com:TActiveTextBox ID="Estimation" TextMode="MultiLine" CssClass="textbox-auto" Style="height: 145px" ReadOnly="true" />
</div>
- <div class="line">
+ <com:TActivePanel ID="AccurateLine" CssClass="line">
<div class="text"><com:TLabel ForControl="Accurate" Text="<%[ Accurate: ]%>" /></div>
<div class="field"><com:TActiveCheckBox ID="Accurate" AutoPostBack="false" /></div>
- </div>
- <div class="button">
+ </com:TActivePanel>
+ <com:TActivePanel ID="EstimateLine" CssClass="button">
<com:BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" OnClick="estimate" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobWindow').progress(false);job_callback_func();" />
- </div>
+ </com:TActivePanel>
</com:TActivePanel>
</com:TContent>
public $buttonID;
public $windowTitle;
public $jobLevels;
- private $jobStates;
- private $jobTypes = array(
- 'B' => 'Backup',
- 'M' => 'Migrated',
- 'V' => 'Verify',
- 'R' => 'Restore',
- 'I' => 'Internal',
- 'D' => 'Admin',
- 'A' => 'Archive',
- 'C' => 'Copy',
- 'g' => 'Migration'
- );
+ public $jobStates;
+ public $jobTypes;
public function setID($id) {
$this->ID = $id;
public function onLoad($param) {
parent::onLoad($param);
$this->prepareData();
- $this->jobLevels = $this->Application->getModule('misc')->getJobLevels();
- }
-
- public function getJobType($jobLetter) {
- return array_key_exists($jobLetter, $this->jobTypes) ? $this->jobTypes[$jobLetter] : null;
- }
-
- public function getJobState($jobStateLetter) {
- $jobstates = array(
- 'C' => (object)array('value' => 'Created', 'description' =>'Created but not yet running'),
- 'R' => (object)array('value' => 'Running', 'description' => 'Running'),
- 'B' => (object)array('value' => 'Blocked', 'description' => 'Blocked'),
- 'T' => (object)array('value' => 'Terminated', 'description' =>'Terminated normally'),
- 'W' => (object)array('value' => 'Terminated with warnings', 'description' =>'Terminated normally with warnings'),
- 'E' => (object)array('value' => 'Error', 'description' =>'Terminated in Error'),
- 'e' => (object)array('value' => 'Non-fatal error', 'description' =>'Non-fatal error'),
- 'f' => (object)array('value' => 'Fatal error', 'description' =>'Fatal error'),
- 'D' => (object)array('value' => 'Verify', 'description' =>'Verify Differences'),
- 'A' => (object)array('value' => 'Canceled by user', 'description' =>'Canceled by the user'),
- 'I' => (object)array('value' => 'Incomplete', 'description' =>'Incomplete Job'),
- 'F' => (object)array('value' => 'Waiting on FD', 'description' =>'Waiting on the File daemon'),
- 'S' => (object)array('value' => 'Waiting on SD', 'description' =>'Waiting on the Storage daemon'),
- 'm' => (object)array('value' => 'Waiting for new vol.', 'description' =>'Waiting for a new Volume to be mounted'),
- 'M' => (object)array('value' => 'Waiting for mount', 'description' =>'Waiting for a Mount'),
- 's' => (object)array('value' => 'Waiting for storage', 'description' =>'Waiting for Storage resource'),
- 'j' => (object)array('value' => 'Waiting for job', 'description' =>'Waiting for Job resource'),
- 'c' => (object)array('value' => 'Waiting for client', 'description' =>'Waiting for Client resource'),
- 'd' => (object)array('value' => 'Waiting for Max. jobs', 'description' =>'Wating for Maximum jobs'),
- 't' => (object)array('value' => 'Waiting for start', 'description' =>'Waiting for Start Time'),
- 'p' => (object)array('value' => 'Waiting for higher priority', 'description' =>'Waiting for higher priority job to finish'),
- 'i' => (object)array('value' => 'Batch insert', 'description' =>'Doing batch insert file records'),
- 'a' => (object)array('value' => 'Despooling attributes', 'description' =>'SD despooling attributes'),
- 'l' => (object)array('value' => 'Data despooling', 'description' =>'Doing data despooling'),
- 'L' => (object)array('value' => 'Commiting data', 'description' =>'Committing data (last despool)')
- );
- return array_key_exists($jobStateLetter, $jobstates) ? $jobstates[$jobStateLetter] : null;
+ $misc = $this->Application->getModule('misc');
+ $this->jobLevels = $misc->getJobLevels();
+ $this->jobStates = $misc->getJobState();
+ $this->jobTypes = $misc->getJobType();
}
public function prepareData($forceReload = false) {
<input type="hidden" name="<%=$this->getParent()->ClientID%>" value="<%=$this->getParent()->Data['jobid']%>" />
</prop:ItemTemplate>
</com:TActiveTemplateColumn>
- <com:TActiveTemplateColumn ItemTemplate="<%=$this->getPage()->JobWindow->getJobType($this->getParent()->Data['type'])%>" SortExpression="type">
+ <com:TActiveTemplateColumn ItemTemplate="<%=isset($this->getPage()->JobWindow->jobTypes[$this->getParent()->Data['type']]) ? $this->getPage()->JobWindow->jobTypes[$this->getParent()->Data['type']] : ''%>" SortExpression="type">
<prop:HeaderText>
<span title="<%=Prado::localize('Type')%>" style="cursor: help">T</span>
</prop:HeaderText>
</com:TActiveTemplateColumn>
- <com:TActiveTemplateColumn ItemTemplate="<%=array_key_exists($this->getParent()->Data['level'], $this->getPage()->JobWindow->jobLevels) ? mb_substr($this->getPage()->JobWindow->jobLevels[$this->getParent()->Data['level']], 0, 4) : ''%>" SortExpression="level">
+ <com:TActiveTemplateColumn ItemTemplate="<%=array_key_exists($this->getParent()->Data['level'], $this->getPage()->JobWindow->jobLevels) ? $this->getPage()->JobWindow->jobLevels[$this->getParent()->Data['level']] : ''%>" SortExpression="level">
<prop:HeaderText>
<span title="<%=Prado::localize('Level')%>" style="cursor: help">L</span>
</prop:HeaderText>
</com:TActiveTemplateColumn>
<com:TActiveTemplateColumn HeaderText="<%[ Job status ]%>" SortExpression="jobstatus">
<prop:ItemTemplate>
- <div class="job-status-<%=$this->getParent()->Data['jobstatus']%>" title="<%=isset($this->getPage()->JobWindow->getJobState($this->getParent()->Data['jobstatus'])->description) ? $this->getPage()->JobWindow->getJobState($this->getParent()->Data['jobstatus'])->description : ''%>"><%=isset($this->getPage()->JobWindow->getJobState($this->getParent()->Data['jobstatus'])->value) ? $this->getPage()->JobWindow->getJobState($this->getParent()->Data['jobstatus'])->value : ''%></div>
+ <div class="job-status-<%=isset($this->getParent()->Data['jobstatus']) ? $this->getParent()->Data['jobstatus'] : ''%>" title="<%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['description']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['description'] : ''%>"><%=isset($this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value']) ? $this->getPage()->JobWindow->jobStates[$this->getParent()->Data['jobstatus']]['value'] : ''%></div>
</prop:ItemTemplate>
</com:TActiveTemplateColumn>
<com:TActiveBoundColumn
* Bacula® is a registered trademark of Kern Sibbald.
*/
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
Prado::using('Application.Portlets.Portlets');
class JobRunConfiguration extends Portlets {
const DEFAULT_JOB_PRIORITY = 10;
+ public $jobToVerify = array('C', 'O', 'd');
+
+ public $verifyOptions = array('jobname' => 'Verify by Job Name', 'jobid' => 'Verify by JobId');
+
public function configure($jobname) {
$this->JobName->Text = $jobname;
$this->Estimation->Text = '';
$this->Level->dataSource = $this->Application->getModule('misc')->getJobLevels();
$this->Level->dataBind();
+ $this->JobToVerifyOptionsLine->Display = 'None';
+ $this->JobToVerifyJobNameLine->Display = 'None';
+ $this->JobToVerifyJobIdLine->Display = 'None';
+ $this->AccurateLine->Display = 'Dynamic';
+ $this->EstimateLine->Display = 'Dynamic';
+
+ $verifyValues = array();
+
+ foreach($this->verifyOptions as $value => $text) {
+ $verifyValues[$value] = Prado::localize($text);
+ }
+
+ $this->JobToVerifyOptions->dataSource = $verifyValues;
+ $this->JobToVerifyOptions->dataBind();
+
+ $jobTasks = $this->Application->getModule('api')->get(array('jobs', 'tasks'))->output;
+
+ $jobsAllDirs = array();
+ foreach($jobTasks as $director => $tasks) {
+ $jobsAllDirs = array_merge($jobsAllDirs, $tasks);
+ }
+
+ $this->JobToVerifyJobName->dataSource = array_combine($jobsAllDirs, $jobsAllDirs);
+ $this->JobToVerifyJobName->dataBind();
+
$clients = $this->Application->getModule('api')->get(array('clients'))->output;
$clientsList = array();
foreach($clients as $client) {
$params['storageid'] = $this->Storage->SelectedValue;
$params['poolid'] = $this->Pool->SelectedValue;
$params['priority'] = $this->Priority->Text;
+
+ if (in_array($this->Level->SelectedItem->Value, $this->jobToVerify)) {
+ $verifyVals = $this->getVerifyVals();
+ if ($this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobname']) {
+ $params['verifyjob'] = $this->JobToVerifyJobName->SelectedValue;
+ } elseif ($this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobid']) {
+ $params['jobid'] = $this->JobToVerifyJobId->Text;
+ }
+ }
+
$result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
$this->Estimation->Text = implode(PHP_EOL, $result);
}
$isValid = preg_match('/^[0-9]+$/', $this->Priority->Text) === 1 && $this->Priority->Text > 0;
$param->setIsValid($isValid);
}
+
+ public function jobIdToVerifyValidator($sender, $param) {
+ $verifyVals = $this->getVerifyVals();
+ if(in_array($this->Level->SelectedValue, $this->jobToVerify) && $this->JobToVerifyOptions->SelectedItem->Value == $verifyVals['jobid']) {
+ $isValid = preg_match('/^[0-9]+$/',$this->JobToVerifyJobId->Text) === 1 && $this->JobToVerifyJobId->Text > 0;
+ } else {
+ $isValid = true;
+ }
+ $param->setIsValid($isValid);
+ return $isValid;
+ }
+
+ private function getVerifyVals() {
+ $verifyOpt = array_keys($this->verifyOptions);
+ $verifyVals = array_combine($verifyOpt, $verifyOpt);
+ return $verifyVals;
+ }
}
?>
<div class="line">
<div class="text"><com:TLabel ForControl="Level" Text="<%[ Level: ]%>" /></div>
<div class="field">
- <com:TActiveDropDownList ID="Level" AutoPostBack="false" CssClass="textbox-auto" />
+ <com:TActiveDropDownList ID="Level" AutoPostBack="false" CssClass="textbox-auto">
+ <prop:Attributes.onchange>
+ var job_to_verify = $('<%=$this->JobToVerifyOptionsLine->ClientID%>');
+ var verify_options = $('<%=$this->JobToVerifyOptionsLine->ClientID%>');
+ var verify_by_job_name = $('<%=$this->JobToVerifyJobNameLine->ClientID%>');
+ var verify_by_jobid = $('<%=$this->JobToVerifyJobIdLine->ClientID%>');
+ var accurate = $('<%=$this->AccurateLine->ClientID%>');
+ var estimate = $('<%=$this->EstimateLine->ClientID%>');
+ var verify_current_opt = $('<%=$this->JobToVerifyOptions->ClientID%>').value;
+ if(/^(<%=implode('|', $this->jobToVerify)%>)$/.test(this.value)) {
+ accurate.hide();
+ estimate.hide();
+ verify_options.show();
+ job_to_verify.show();
+ if (verify_current_opt == 'jobid') {
+ verify_by_job_name.hide();
+ verify_by_jobid.show();
+ } else if (verify_current_opt == 'jobname') {
+ verify_by_job_name.show();
+ verify_by_jobid.hide();
+ }
+ } else if (job_to_verify.visible()) {
+ job_to_verify.hide();
+ verify_options.hide();
+ verify_by_job_name.hide();
+ verify_by_jobid.hide();
+ accurate.show();
+ estimate.show();
+ }
+ </prop:Attributes.onchange>
+ </com:TActiveDropDownList>
</div>
</div>
+ <com:TActivePanel ID="JobToVerifyOptionsLine" CssClass="line">
+ <div class="text"><com:TLabel ForControl="JobToVerifyOptions" Text="<%[ Verify option: ]%>" /></div>
+ <div class="field">
+ <com:TActiveDropDownList ID="JobToVerifyOptions" AutoPostBack="false" CssClass="textbox-auto">
+ <prop:Attributes.onchange>
+ var verify_by_job_name = $('<%=$this->JobToVerifyJobNameLine->ClientID%>');
+ var verify_by_jobid = $('<%=$this->JobToVerifyJobIdLine->ClientID%>');
+ if (this.value == 'jobname') {
+ verify_by_jobid.hide();
+ verify_by_job_name.show();
+ } else if (this.value == 'jobid') {
+ verify_by_job_name.hide();
+ verify_by_jobid.show();
+ } else {
+ verify_by_job_name.hide();
+ verify_by_jobid.hide();
+ }
+ </prop:Attributes.onchange>
+ </com:TActiveDropDownList>
+ </div>
+ </com:TActivePanel>
+ <com:TActivePanel ID="JobToVerifyJobNameLine" CssClass="line">
+ <div class="text"><com:TLabel ForControl="JobToVerifyJobName" Text="<%[ Job to Verify: ]%>" /></div>
+ <div class="field">
+ <com:TActiveDropDownList ID="JobToVerifyJobName" AutoPostBack="false" CssClass="textbox-auto" />
+ </div>
+ </com:TActivePanel>
+ <com:TActivePanel ID="JobToVerifyJobIdLine" CssClass="line">
+ <div class="text"><com:TLabel ForControl="JobToVerifyJobId" Text="<%[ JobId to Verify: ]%>" /></div>
+ <div class="field">
+ <com:TActiveTextBox ID="JobToVerifyJobId" CssClass="textbox-auto" AutoPostBack="false" />
+ <com:TActiveCustomValidator ID="JobToVerifyJobIdValidator" ValidationGroup="JobRunGroup" ControlToValidate="JobToVerifyJobId" ErrorMessage="<%[ JobId to Verify value must be integer greather than 0. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="jobIdToVerifyValidator" />
+ </div>
+ </com:TActivePanel>
<div class="line">
<div class="text"><com:TLabel ForControl="Client" Text="<%[ Client: ]%>" /></div>
<div class="field">
<div class="field-full" style="min-height: 90px">
<com:TActiveTextBox ID="Estimation" TextMode="MultiLine" CssClass="textbox-auto" Style="height: 116px; font-size: 11px;" ReadOnly="true" />
</div>
- <div class="line">
+ <com:TPanel ID="AccurateLine" CssClass="line">
<div class="text"><com:TLabel ForControl="Accurate" Text="<%[ Accurate: ]%>" /></div>
<div class="field"><com:TActiveCheckBox ID="Accurate" AutoPostBack="false" /></div>
- </div>
- <div class="button">
+ </com:TPanel>
+ <com:TPanel ID="EstimateLine" CssClass="button">
<com:Application.Portlets.BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" OnClick="estimate" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobRunWindow').progress(false);jobrun_callback_func();" />
- </div>
+ </com:TPanel>
</com:TActivePanel>
</com:TContent>
table.window-section-detail, table.file-browser-detail {
background-color: rgba(0,0,0,0.5);
width: 100%;
- font-size: 11px;
+ font-size: 10px;
font-weight: normal;
}
}
div.job-status-D {
- background-color: blue;
+ background-color: #CB4A2C;
}
/*