Skip to content

Commit

Permalink
Add prev and next job buttons to job view page
Browse files Browse the repository at this point in the history
  • Loading branch information
ganiuszka committed Dec 14, 2023
1 parent 0955122 commit bca98e4
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 0 deletions.
Binary file modified Web/Lang/en/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5122,3 +5122,9 @@ msgstr "Prepare resources for a new backup job."

msgid "Quick edit"
msgstr "Quick edit"

msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
Binary file modified Web/Lang/fr/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5133,3 +5133,9 @@ msgstr "Prepare resources for a new backup job."

msgid "Quick edit"
msgstr "Quick edit"

msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
Binary file modified Web/Lang/ja/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/ja/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5196,3 +5196,9 @@ msgstr "Prepare resources for a new backup job."

msgid "Quick edit"
msgstr "Quick edit"

msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
Binary file modified Web/Lang/ko/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/ko/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5138,3 +5138,9 @@ msgstr "Prepare resources for a new backup job."

msgid "Quick edit"
msgstr "Quick edit"

msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
Binary file modified Web/Lang/pl/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/pl/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5133,3 +5133,9 @@ msgstr "Przygotuj zasoby dla nowego zadania backupu."
msgid "Quick edit"
msgstr "Szybka edycja"


msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
Binary file modified Web/Lang/pt/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/pt/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5133,3 +5133,9 @@ msgstr "Prepare resources for a new backup job."

msgid "Quick edit"
msgstr "Quick edit"

msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
Binary file modified Web/Lang/ru/messages.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions Web/Lang/ru/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -5132,3 +5132,9 @@ msgstr "Prepare resources for a new backup job."

msgid "Quick edit"
msgstr "Quick edit"

msgid "Prev job"
msgstr "Prev job"

msgid "Next job"
msgstr "Next job"
14 changes: 14 additions & 0 deletions Web/Pages/JobView.page
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
</com:TActiveLinkButton>
<com:Bacularis.Web.Portlets.GoToResource ResourceType="Job" Director="<%=$_SESSION['director']%>" />
<com:Bacularis.Web.Portlets.RunJob ID="RunJobModal" />
<com:TLinkButton
CssClass="w3-button w3-green w3-margin-left"
Visible="<%=($this->getPrevJobId() > 0)%>"
Attributes.onclick="window.location.href='/web/job/history/<%=$this->getPrevJobId()%>/'; return false;"
>
<i class="fa fa-angle-left"></i> &nbsp;<%[ Prev job ]%>
</com:TLinkButton>
<com:TLinkButton
CssClass="w3-button w3-green"
Visible="<%=($this->getNextJobId() > 0)%>"
Attributes.onclick="window.location.href='/web/job/history/<%=$this->getNextJobId()%>/'; return false;"
>
<%[ Next job ]%> &nbsp;<i class="fa fa-angle-right"></i>
</com:TLinkButton>
<div class="w3-bar w3-green w3-margin-bottom">
<a class="w3-bar-item w3-button tab_btn" href="<%=$this->Service->constructUrl('JobList')%>#<%=$this->getJobId() > 0 ? 'job_history' : 'job_details'%>"><i class="fa fa-angle-left"></i></a>
<button id="btn_job_log" type="button" class="w3-bar-item w3-button tab_btn <%=$this->getJobId() > 0 ? 'w3-grey' : 'hide'%>" onclick="W3Tabs.open(this.id, 'job_log'); job_callback_func(); oRunningJobStatus.init_refresh();"><%[ Job log ]%></button>
Expand Down
50 changes: 50 additions & 0 deletions Web/Pages/JobView.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class JobView extends BaculumWebPage
public const JOB_UNAME = 'JobUname';
public const JOB_LEVEL = 'JobLevel';
public const JOB_TYPE = 'JobType';
public const PREV_JOBID = 'PrevJobId';
public const NEXT_JOBID = 'NextJobId';
public const CLIENTID = 'ClientId';
public const JOB_INFO = 'JobInfo';
public const STORAGE_INFO = 'StorageInfo';
Expand Down Expand Up @@ -80,6 +82,12 @@ public function onPreInit($param)
$this->setJobId($jobdata->jobid);
$this->setJobUname($jobdata->job);
$this->setJobType($jobdata->type);
if (property_exists($jobdata, 'prev_jobid')) {
$this->setPrevJobId($jobdata->prev_jobid);
}
if (property_exists($jobdata, 'next_jobid')) {
$this->setNextJobId($jobdata->next_jobid);
}
$this->setJobLevel($jobdata->level);
$this->setClientId($jobdata->clientid);
$this->is_running = $this->getModule('misc')->isJobRunning($jobdata->jobstatus);
Expand Down Expand Up @@ -207,6 +215,48 @@ public function getJobId()
return $this->getViewState(self::JOBID, 0);
}

/**
* Set previous jobid.
*
* @param mixed $jobid
*/
public function setPrevJobId($jobid)
{
$jobid = (int) $jobid;
$this->setViewState(self::PREV_JOBID, $jobid, 0);
}

/**
* Get previous jobid.
*
* @return int jobid
*/
public function getPrevJobId()
{
return $this->getViewState(self::PREV_JOBID, 0);
}

/**
* Set next jobid.
*
* @param mixed $jobid
*/
public function setNextJobId($jobid)
{
$jobid = (int) $jobid;
$this->setViewState(self::NEXT_JOBID, $jobid, 0);
}

/**
* Get next jobid.
*
* @return int jobid
*/
public function getNextJobId()
{
return $this->getViewState(self::NEXT_JOBID, 0);
}

/**
* Set job clientid
*
Expand Down

0 comments on commit bca98e4

Please sign in to comment.