options: null,
configurationObj: null,
loadRequest : null,
+ actionsRequest: null,
repeaterEl: null,
gridEl: null,
checked: [],
},
elements : {
- containerSuffix : '-slide-window-container',
- configurationWindows : 'div.configuration',
+ content: 'div.slide-window-content',
+ containerSuffix: '-slide-window-container',
+ containerProgressSuffix: '-slide-window-progress',
+ configurationWindows: 'div.configuration',
configurationProgress: 'div.configuration-progress',
- contentItems : 'slide-window-element',
- contentAlternatingItems : 'slide-window-element-alternating',
- toolsButtonSuffix : '-slide-window-tools',
- optionsButtonSuffix : '-slide-window-options',
- actionsSuffix : '-slide-window-actions',
- toolbarSuffix : '-slide-window-toolbar',
- titleSuffix : '-slide-window-title'
+ contentItems: 'slide-window-element',
+ contentAlternatingItems: 'slide-window-element-alternating',
+ toolsButtonSuffix: '-slide-window-tools',
+ optionsButtonSuffix: '-slide-window-options',
+ actionsSuffix: '-slide-window-actions',
+ toolbarSuffix: '-slide-window-toolbar',
+ titleSuffix: '-slide-window-title',
+ actionsButton : 'actions_btn'
},
initialize: function(windowId, data) {
this.options.observe('click', function() {
this.toggleToolbar();
}.bind(this));
+
+ this.setActionsBtnEvents();
+ },
+
+ setActionsBtnEvents: function() {
+ var actions_btn_container = this.window.getElementsByClassName(this.elements.actionsButton);
+ if (actions_btn_container.length === 1) {
+ var actions_btn = actions_btn_container[0].getElementsByTagName('INPUT');
+ if (actions_btn.length === 1) {
+ actions_btn[0].addEventListener('mouseup', function(e) {
+ var row = this.getGridRowUnderCursor(e);
+ var el = $(row).down('input[type=hidden]');
+ if(el) {
+ var val = el.getValue();
+ this.actionsRequest.ActiveControl.CallbackParameter = val;
+ this.actionsRequest.dispatch();
+ }
+ }.bind(this));
+ }
+ }
},
-
+
openWindow : function() {
this.hideOtherWindows();
Effect.toggle(this.window, 'slide', { duration: 0.3, afterFinish : function() {
isWindowOpen: function() {
return !(this.window.style.display === 'none');
},
-
+
+ showProgress: function(show) {
+ var progress = $(this.windowId + this.elements.containerProgressSuffix);
+ if (show === true) {
+ progress.setStyle({display: 'block'});
+ } else if (show === false) {
+ progress.hide();
+ }
+ },
+
resetSize : function() {
if(this.isConfigurationOpen()) {
if(this.isFullSize()) {
this.configurationObj = obj;
},
- setWindowElementsEvent: function(repeaterEl, gridEl, requestObj) {
- this.repeaterEl = repeaterEl;
- this.gridEl = gridEl;
- this.loadRequest = requestObj;
+ setWindowElementsEvent: function(opts) {
+ this.repeaterEl = opts.repeater_id;
+ this.gridEl = opts.grid_id;
+ this.loadRequest = opts.request_obj;
+ if (opts.hasOwnProperty('actions_obj')) {
+ this.actionsRequest = opts.actions_obj;
+ }
+ this.showProgress(false);
this.markAllChecked(false);
this.setLoadRequest();
this.postWindowOpen();
dataList = $(this.repeaterEl + '_Container').select('div.slide-window-element');
}
+ var set_callback_parameter = function(element) {
+ var el = $(element).down('input[type=hidden]')
+ if(el) {
+ var val = el.getValue();
+ this.loadRequest.ActiveControl.CallbackParameter = val;
+ this.loadRequest.dispatch();
+ this.configurationObj.openConfigurationWindow(this);
+ }
+ }.bind(this);
dataList.each(function(tr) {
$(tr).observe('click', function(index, clickedEl) {
var target = clickedEl.target || clickedEl.srcElement;
if(clicked && clicked.hasAttribute('type') && clicked.readAttribute('type') == 'checkbox') {
return;
}
-
- var el = $(tr).down('input[type=hidden]')
- if(el) {
- var val = el.getValue();
- this.loadRequest.ActiveControl.CallbackParameter = val;
- this.loadRequest.dispatch();
- this.configurationObj.openConfigurationWindow(this);
- }
+ set_callback_parameter(tr);
}.bind(this, tr));
}.bind(this));
},
postWindowOpen: function() {
this.setActions();
this.setElementsCount();
+ this.setOptionsBtn();
+ },
+ setOptionsBtn: function() {
+ var options_btn = this.window.getElementsByClassName(this.elements.actionsButton);
+ var table_window = $(this.windowId + this.elements.containerSuffix).down(this.elements.content);
+ if (options_btn.length === 1) {
+ options_btn = options_btn[0];
+ table_window.stopObserving('mouseover');
+ table_window.observe('mouseover', function(e) {
+ var el = this.getGridRowUnderCursor(e);
+ if (el && (el.className == this.elements.contentItems || el.className == this.elements.contentAlternatingItems)) {
+ el.style.backgroundColor = '#aeb2b6';
+ options_btn.setStyle({display: ''});
+ var scroll_y = document.viewport.getScrollOffsets().top;
+ var y = (el.viewportOffset().top + scroll_y - 57).toString() + 'px';
+ options_btn.setStyle({top: y});
+ } else {
+ options_btn.setStyle({display: 'none'});
+ }
+ }.bind(this));
+ table_window.stopObserving('mouseout');
+ table_window.observe('mouseout', function(e) {
+ table_window.select('TR').forEach(function(el) {
+ el.style.backgroundColor = '';
+ });;
+ options_btn.setStyle({display: 'none'});
+ });
+ }
+ },
+ getGridRowUnderCursor: function(e) {
+ var x = e.clientX - 100;
+ var y = e.clientY;
+ var element_mouse_is_over = document.elementFromPoint(x, y);
+ var el;
+ var el_over = $(element_mouse_is_over);
+ if (el_over && el_over.nodeName != 'TR') {
+ el = el_over.down('tr');
+ if (!el) {
+ el = el_over.up('tr');
+ }
+ }
+ return el;
}
});
document.observe("dom:loaded", function() {
if(Prototype.Browser.IE || Prototype.Browser.Gecko || Prototype.Browser.WebKit) {
- $$('input[type=checkbox], input[type=submit], input[type=radio], a').each(function(el) {
+ $$('input[type=checkbox], input[type=submit], input[type=radio], input[type=image], a').each(function(el) {
el.observe('focus', function() {
el.blur();
}.bind(el));
}
}
}
-?>
\ No newline at end of file
+?>
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 . '"', $jobid , $verifyjob, 'yes'), $this->user);
+ $command = array(
+ 'run',
+ 'job="' . $job . '"',
+ 'level="' . $joblevels[$level] . '"',
+ 'fileset="' . $fileset . '"',
+ 'client="' . $client->name . '"',
+ 'storage="' . $storage->name . '"',
+ 'pool="' . $pool->name . '"' ,
+ 'priority="' . $priority . '"',
+ $jobid,
+ $verifyjob,
+ 'yes'
+ );
+ $run = $this->getModule('bconsole')->bconsoleCommand($this->director, $command, $this->user);
$this->output = $run->output;
$this->error = (integer)$run->exitcode;
} else {
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2015 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+class JobShow extends BaculumAPI {
+ public function get() {
+ $jobid = intval($this->Request['id']);
+ $job = $this->getModule('job')->getJobById($jobid);
+ if(!is_null($job)) {
+ $jobShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'job="' . $job->name . '"'), $this->user);
+ $this->output = $jobShow->output;
+ $this->error = (integer)$jobShow->exitcode;
+ } else {
+ $this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS;
+ }
+ }
+}
+
+?>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2015 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+class JobsShow extends BaculumAPI {
+
+ public function get() {
+ $jobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'jobs'), $this->user);
+ $this->output = $jobs->output;
+ $this->error = (integer)$jobs->exitcode;
+ }
+}
+
+?>
</div>
<div id="container">
<div id="menu-left">
- <com:TActiveButton ID="StorageBtn" CssClass="storage-btn" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Storage Daemons')%>', '<%=Prado::localize('Configuration of storage daemons.')%>');" ClientSide.OnLoading="$('StorageWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('StorageWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('StorageWindow').setWindowElementsEvent('<%=$this->StorageWindow->Repeater->ClientID%>', '<%=$this->StorageWindow->DataGrid->ClientID%>', <%=$this->StorageWindow->DataElementCall->ActiveControl->Javascript%>);" />
- <com:TActiveButton ID="ClientBtn" CssClass="client-btn" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Clients')%>', '<%=Prado::localize('Configuration of clients daemons.')%>');" ClientSide.OnLoading="$('ClientWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('ClientWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('ClientWindow').setWindowElementsEvent('<%=$this->ClientWindow->Repeater->ClientID%>', '<%=$this->ClientWindow->DataGrid->ClientID%>', <%=$this->ClientWindow->DataElementCall->ActiveControl->Javascript%>);" />
- <com:TActiveButton ID="MediaBtn" CssClass="media-btn" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Volumes')%>', '<%=Prado::localize('Management of volumes.')%>');" ClientSide.OnLoading="$('VolumeWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('VolumeWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('VolumeWindow').setWindowElementsEvent('<%=$this->VolumeWindow->Repeater->ClientID%>', '<%=$this->VolumeWindow->DataGrid->ClientID%>', <%=$this->VolumeWindow->DataElementCall->ActiveControl->Javascript%>);" />
-
- <com:TActiveButton ID="PoolBtn" CssClass="pool-btn" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Pools')%>', '<%=Prado::localize('Management of volumes pools.')%>');" ClientSide.OnLoading="$('PoolWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('PoolWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('PoolWindow').setWindowElementsEvent('<%=$this->PoolWindow->Repeater->ClientID%>', '<%=$this->PoolWindow->DataGrid->ClientID%>', <%=$this->PoolWindow->DataElementCall->ActiveControl->Javascript%>);" />
- <com:TActiveButton ID="JobBtn" CssClass="job-btn" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Jobs')%>', '<%=Prado::localize('Jobs settings.')%>');" ClientSide.OnLoading="$('JobWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('JobWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('JobWindow').setWindowElementsEvent('<%=$this->JobWindow->Repeater->ClientID%>', '<%=$this->JobWindow->DataGrid->ClientID%>', <%=$this->JobWindow->DataElementCall->ActiveControl->Javascript%>);" />
- <com:TActiveButton ID="JobRunBtn" CssClass="jobrun-btn" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Run job')%>', '<%=Prado::localize('Starting jobs.')%>');" ClientSide.OnLoading="$('JobRunWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('JobRunWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('JobRunWindow').setWindowElementsEvent('<%=$this->JobRunWindow->Repeater->ClientID%>', '<%=$this->JobRunWindow->DataGrid->ClientID%>', <%=$this->JobRunWindow->DataElementCall->ActiveControl->Javascript%>);" />
- <com:TActiveButton CssClass="restore-btn" OnClick="restore" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Restore')%>', '<%=Prado::localize('Restore wizard.')%>');" />
- <com:TActiveButton ID="SettingsWizardBtn" CssClass="setting-btn" OnClick="configuration" Attributes.onmouseover="javascript:showTip(this, '<%=Prado::localize('Settings')%>', '<%=Prado::localize('Management settings wizard.')%>');" />
+ <com:TActiveButton ID="StorageBtn" CssClass="storage-btn">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Storage Daemons')%>',
+ '<%=Prado::localize('Configuration of storage daemons.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ <prop:ClientSide.OnLoading>
+ SlideWindow.getObj('StorageWindow').showProgress(true);
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ SlideWindow.getObj('StorageWindow').setWindowElementsEvent({
+ repeater_id: '<%=$this->StorageWindow->Repeater->ClientID%>',
+ grid_id: '<%=$this->StorageWindow->DataGrid->ClientID%>',
+ request_obj: <%=$this->StorageWindow->DataElementCall->ActiveControl->Javascript%>
+ });
+ </prop:ClientSide.OnComplete>
+ </com:TActiveButton>
+ <com:TActiveButton ID="ClientBtn" CssClass="client-btn">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Clients')%>',
+ '<%=Prado::localize('Configuration of clients daemons.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ <prop:ClientSide.OnLoading>
+ SlideWindow.getObj('ClientWindow').showProgress(true);
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ SlideWindow.getObj('ClientWindow').setWindowElementsEvent({
+ repeater_id: '<%=$this->ClientWindow->Repeater->ClientID%>',
+ grid_id: '<%=$this->ClientWindow->DataGrid->ClientID%>',
+ request_obj: <%=$this->ClientWindow->DataElementCall->ActiveControl->Javascript%>
+ });
+ </prop:ClientSide.OnComplete>
+ </com:TActiveButton>
+ <com:TActiveButton ID="MediaBtn" CssClass="media-btn">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Volumes')%>',
+ '<%=Prado::localize('Management of volumes.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ <prop:ClientSide.OnLoading>
+ SlideWindow.getObj('VolumeWindow').showProgress(true);
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ SlideWindow.getObj('VolumeWindow').setWindowElementsEvent({
+ repeater_id: '<%=$this->VolumeWindow->Repeater->ClientID%>',
+ grid_id: '<%=$this->VolumeWindow->DataGrid->ClientID%>',
+ request_obj: <%=$this->VolumeWindow->DataElementCall->ActiveControl->Javascript%>
+ });
+ </prop:ClientSide.OnComplete>
+ </com:TActiveButton>
+ <com:TActiveButton ID="PoolBtn" CssClass="pool-btn">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Pools')%>',
+ '<%=Prado::localize('Management of volumes pools.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ <prop:ClientSide.OnLoading>
+ SlideWindow.getObj('PoolWindow').showProgress(true);
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ SlideWindow.getObj('PoolWindow').setWindowElementsEvent({
+ repeater_id: '<%=$this->PoolWindow->Repeater->ClientID%>',
+ grid_id: '<%=$this->PoolWindow->DataGrid->ClientID%>',
+ request_obj: <%=$this->PoolWindow->DataElementCall->ActiveControl->Javascript%>
+ });
+ </prop:ClientSide.OnComplete>
+ </com:TActiveButton>
+ <com:TActiveButton ID="JobBtn" CssClass="job-btn">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Jobs')%>',
+ '<%=Prado::localize('Jobs settings.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ <prop:ClientSide.OnLoading>
+ SlideWindow.getObj('JobWindow').showProgress(true);
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ SlideWindow.getObj('JobWindow').setWindowElementsEvent({
+ repeater_id: '<%=$this->JobWindow->Repeater->ClientID%>',
+ grid_id: '<%=$this->JobWindow->DataGrid->ClientID%>',
+ request_obj: <%=$this->JobWindow->DataElementCall->ActiveControl->Javascript%>,
+ actions_obj: <%=$this->JobWindow->RunJobCall->ActiveControl->Javascript%>
+ });
+ </prop:ClientSide.OnComplete>
+ </com:TActiveButton>
+ <com:TActiveButton ID="JobRunBtn" CssClass="jobrun-btn">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Run job')%>',
+ '<%=Prado::localize('Starting jobs.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ <prop:ClientSide.OnLoading>
+ SlideWindow.getObj('JobRunWindow').showProgress(true);
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ SlideWindow.getObj('JobRunWindow').setWindowElementsEvent({
+ repeater_id: '<%=$this->JobRunWindow->Repeater->ClientID%>',
+ grid_id: '<%=$this->JobRunWindow->DataGrid->ClientID%>',
+ request_obj: <%=$this->JobRunWindow->DataElementCall->ActiveControl->Javascript%>
+ });
+ </prop:ClientSide.OnComplete>
+ </com:TActiveButton>
+ <com:TActiveButton CssClass="restore-btn" OnClick="restore">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Restore')%>',
+ '<%=Prado::localize('Restore wizard.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ </com:TActiveButton>
+ <com:TActiveButton ID="SettingsWizardBtn" CssClass="setting-btn" OnClick="configuration">
+ <prop:Attributes.onmouseover>
+ showTip(
+ this,
+ '<%=Prado::localize('Settings')%>',
+ '<%=Prado::localize('Management settings wizard.')%>'
+ );
+ </prop:Attributes.onmouseover>
+ </com:TActiveButton>
</div>
<com:TActivePanel ID="Content">
<div id="content">
AllowSorting="false"
OnSortCommand="sortDataGrid"
CellPadding="5px"
- CssClass="window-section-detail"
+ CssClass="window-section-detail-smallrow"
ItemStyle.CssClass="slide-window-element"
AlternatingItemStyle.CssClass="slide-window-element-alternating"
>
const DEFAULT_JOB_PRIORITY = 10;
+ const RESOURCE_SHOW_PATTERN = '/^\s+--> %resource: name=(.+?(?=\s\S+\=.+)|.+$)/i';
public $jobToVerify = array('C', 'O', 'd');
$this->Pool->SelectedValue = $jobdata->poolid;
$this->Pool->dataBind();
- $storages = $this->Application->getModule('api')->get(array('storages'))->output;
+ $jobshow = $this->Application->getModule('api')->get(array('jobs', 'show', $jobdata->jobid))->output;
+ $storageShow = $this->getResourceName('storage', $jobshow);
$storagesList = array();
+ $selectedStorageId = null;
+ $storages = $this->Application->getModule('api')->get(array('storages'))->output;
foreach($storages as $storage) {
+ if ($storage->name == $storageShow) {
+ $selectedStorageId = $storage->storageid;
+ }
$storagesList[$storage->storageid] = $storage->name;
}
$this->Storage->dataSource = $storagesList;
+ if (!is_null($selectedStorageId)) {
+ $this->Storage->SelectedValue = $selectedStorageId;
+ }
$this->Storage->dataBind();
$runningJobStates = $this->Application->getModule('misc')->getRunningJobStates();
if($this->PriorityValidator->IsValid === false) {
return false;
}
+
$params = array();
- $params['id'] = $this->JobID->Text;
- $params['level'] = $this->Level->SelectedValue;
- $params['fileset'] = $this->FileSet->SelectedValue;
- $params['clientid'] = $this->Client->SelectedValue;
- $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;
+ if (is_null($sender) && is_numeric($param)) {
+ $jobdata = $this->Application->getModule('api')->get(array('jobs', $param))->output;
+ $jobshow = $this->Application->getModule('api')->get(array('jobs', 'show', $jobdata->jobid))->output;
+ $params['id'] = $jobdata->jobid;
+ $params['level'] = $jobdata->level;
+ $params['fileset'] = $this->getResourceName('fileset', $jobshow);
+ $params['clientid'] = $jobdata->clientid;
+ $storage = $this->getResourceName('storage', $jobshow);
+ $params['storageid'] = $this->getStorageByName($storage)->storageid;
+ $pool = $this->getResourceName('pool', $jobshow);
+ $params['poolid'] = $this->getPoolByName($pool)->poolid;
+ } else {
+ $params['id'] = $this->JobID->Text;
+ $params['level'] = $this->Level->SelectedValue;
+ $params['fileset'] = $this->FileSet->SelectedValue;
+ $params['clientid'] = $this->Client->SelectedValue;
+ $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);
+ if (!is_null($sender) || !is_numeric($param)) {
+ $this->Estimation->Text = implode(PHP_EOL, $result);
+ }
}
public function estimate($sender, $param) {
$verifyVals = array_combine($verifyOpt, $verifyOpt);
return $verifyVals;
}
+
+ private function getResourceName($resource, $jobshow) {
+ $resource_name = null;
+ $pattern = str_replace('%resource', $resource, self::RESOURCE_SHOW_PATTERN);
+ for ($i = 0; $i < count($jobshow); $i++) {
+ if (preg_match($pattern, $jobshow[$i], $match) === 1) {
+ $resource_name = $match[1];
+ break;
+ }
+ }
+ return $resource_name;
+ }
+
+ private function getPoolByName($name) {
+ $pool = null;
+ $pools = $this->Application->getModule('api')->get(array('pools'))->output;
+ for ($i = 0; $i < count($pools); $i++) {
+ if ($pools[$i]->name == $name) {
+ $pool = $pools[$i];
+ break;
+ }
+ }
+ return $pool;
+ }
+
+ private function getStorageByName($name) {
+ $storage = null;
+ $storages = $this->Application->getModule('api')->get(array('storages'))->output;
+ for ($i = 0; $i < count($storages); $i++) {
+ if ($storages[$i]->name == $name) {
+ $storage = $storages[$i];
+ break;
+ }
+ }
+ return $storage;
+ }
}
?>
Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
-Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
Prado::using('System.Web.UI.ActiveControls.TActivePanel');
Prado::using('System.Web.UI.ActiveControls.TCallback');
Prado::using('Application.Portlets.ISlideWindow');
public $windowTitle;
public $jobLevels;
public $jobStates;
+ public $runningJobStates;
public $jobTypes;
public function setID($id) {
public function onLoad($param) {
parent::onLoad($param);
- $this->prepareData();
+ $allowedButtons = array('JobBtn', 'ReloadJobs', 'Run', 'RunJobAgain');
+ if($this->Page->IsPostBack || $this->Page->IsCallBack) {
+ if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons)) {
+ $this->prepareData();
+ }
+ }
$misc = $this->Application->getModule('misc');
$this->jobLevels = $misc->getJobLevels();
$this->jobStates = $misc->getJobState();
$this->jobTypes = $misc->getJobType();
+ $this->runningJobStates = $misc->getRunningJobStates();
}
public function prepareData($forceReload = false) {
- $allowedButtons = array('JobBtn', 'ReloadJobs', 'Run');
+ $allowedButtons = array('JobBtn', 'ReloadJobs', 'Run', 'RunJobAgain');
if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
$params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);
}
}
+ public function run_again($sender, $param) {
+ if($this->Page->IsCallBack) {
+ $this->getPage()->JobConfiguration->run_again(null, $param->CallbackParameter);
+ }
+ }
+
public function executeAction($action) {
$params = explode(';', $this->CheckedValues->Value);
$commands = array();
<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
- SortExpression="endtime"
- HeaderText="<%[ End time ]%>"
- DataField="endtime"
- />
+ <com:TActiveTemplateColumn HeaderText="<%[ End time ]%>" SortExpression="endtime">
+ <prop:ItemTemplate>
+ <%=$this->getParent()->Data['endtime']%>
+ <%=in_array($this->getParent()->Data['jobstatus'], $this->getPage()->JobWindow->runningJobStates) ? '<img src="' . $this->getPage()->getTheme()->getBaseUrl() . '/loader-alter.gif" />' : ''%>
+ </prop:ItemTemplate>
+ </com:TActiveTemplateColumn>
</com:TActiveDataGrid>
<com:TActiveHiddenField ID="CheckedValues" />
</com:TActivePanel>
status_callback_func();
</prop:ClientSide.OnComplete>
</com:TCallback>
+ <com:TCallback ID="RunJobCall" OnCallback="Page.JobWindow.run_again">
+ <prop:ClientSide.OnLoading>
+ var img_btn = $('run_job_again_btn');
+ var img_src_path = img_btn.readAttribute('src').replace(/[^\/]+\S$/, '');
+ img_btn.writeAttribute('disabled', 'disabled');
+ img_btn.writeAttribute('src', img_src_path + 'loader.gif');
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ var img_btn = $('run_job_again_btn');
+ var img_src_path = img_btn.readAttribute('src').replace(/[^\/]+\S$/, '');
+ img_btn.writeAttribute('src', img_src_path + 'play.png');
+ img_btn.removeAttribute('disabled');
+ status_callback_func();
+ oMonitor();
+ </prop:ClientSide.OnComplete>
+ </com:TCallback>
+ <div class="actions_btn" style="display: none">
+ <input type="image" id="run_job_again_btn" title="<%[ Run job again ]%>" src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/play.png" onclick="return false" />
+ </div>
</com:TContent>
AllowSorting="false"
OnSortCommand="sortDataGrid"
CellPadding="5px"
- CssClass="window-section-detail"
+ CssClass="window-section-detail-smallrow"
ItemStyle.CssClass="slide-window-element"
AlternatingItemStyle.CssClass="slide-window-element-alternating"
>
AllowSorting="false"
OnSortCommand="sortDataGrid"
CellPadding="5px"
- CssClass="window-section-detail"
+ CssClass="window-section-detail-smallrow"
ItemStyle.CssClass="slide-window-element"
AlternatingItemStyle.CssClass="slide-window-element-alternating"
>
AllowSorting="false"
OnSortCommand="sortDataGrid"
CellPadding="5px"
- CssClass="window-section-detail"
+ CssClass="window-section-detail-smallrow"
ItemStyle.CssClass="slide-window-element"
AlternatingItemStyle.CssClass="slide-window-element-alternating"
>
<url ServiceParameter="API.JobEstimate" pattern="jobs/estimate/" />
<url ServiceParameter="API.JobRun" pattern="jobs/run/" />
<url ServiceParameter="API.JobCancel" pattern="jobs/cancel/{id}/" parameters.id="\d+"/>
+ <url ServiceParameter="API.JobsShow" pattern="jobs/show/" />
+ <url ServiceParameter="API.JobShow" pattern="jobs/show/{id}/" parameters.id="\d+" />
<url ServiceParameter="API.RestoreRun" pattern="jobs/restore/" />
<!-- END Jobs -->
<!-- START BVFS -->
display: none;
}
+div.actions_btn {
+ position: absolute;
+ width: 35px;
+ height: 35px;
+ right: 22px;
+ top: 0px;
+ margin: 3px 0;
+ text-align: right;
+}
+
#console {
clear: left;
min-width: 973px;
display: inline-block;
width: auto;
margin: 5px 8px;
- padding: 0 18px;
+ padding: 0 16px;
min-width: 65px;
border-radius: 4px;
border: 1px solid #8f2626;
}
input.bbutton:hover {
- padding: 0 18px;
+ padding: 0 16px;
box-shadow: inset 0 0 3px #faeded;
background: #ff7474;
border: 1px solid #8f2626;
tr.slide-window-element td, tr.slide-window-element-alternating td {
font-style: italic;
word-break: break-all;
+ line-height: 30px;
}
+
tr.slide-window-element:hover, tr.slide-window-element-alternating:hover {
float: none;
cursor: pointer;
}
-tr.slide-window-element:hover td, tr.slide-window-element-alternating:hover td{
+tr.slide-window-element:hover td, tr.slide-window-element-alternating:hover td {
background-color: #aeb2b6;
}
-table.window-section-detail, table.file-browser-detail {
+tr.slide-window-element img, tr.slide-window-element-alternating img {
+ float: right;
+}
+
+table.window-section-detail, table.window-section-detail-smallrow, table.file-browser-detail {
background-color: rgba(0,0,0,0.5);
width: 100%;
font-size: 10px;
font-weight: normal;
}
-table.window-section-detail th, table.file-browser-detail th {
+table.window-section-detail th, table.window-section-detail-smallrow th, table.file-browser-detail th {
background-color: black;
color: white;
}
+table.window-section-detail-smallrow td {
+ line-height: 15px;
+}
table.file-browser-detail {
border-spacing: 0;
div.job-status-C, div.job-status-R, div.job-status-B, div.job-status-T, div.job-status-W, div.job-status-E, div.job-status-e, div.job-status-f, div.job-status-D, div.job-status-A, div.job-status-I, div.job-status-F, div.job-status-S, div.job-status-m, div.job-status-M, div.job-status-s, div.job-status-j, div.job-status-c, div.job-status-d, div.job-status-t, div.job-status-p, div.job-status-i, div.job-status-a, div.job-status-l, div.job-status-L {
border: 1px solid black;
- min-width: 80px;
+ min-width: 52px;
height: 20px;
line-height: 20px;
font-size: 9px;