/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
- The main author of Bacula is Kern Sibbald, with contributions from
- many others, a complete list can be found in the file AUTHORS.
- This program is Free Software; you can redistribute it and/or
- modify it under the terms of version three of the GNU Affero General Public
- License as published by the Free Software Foundation and included
- in the file LICENSE.
+ The main author of Bacula is Kern Sibbald, with contributions from many
+ others, a complete list can be found in the file AUTHORS.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ 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.
Bacula® is a registered trademark of Kern Sibbald.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
*/
-
+
#include "bat.h"
#include "job.h"
#include "util/fmtwidgetitem.h"
if (mainWin->m_sqlDebug) {
Pmsg1(000, "Log query cmd : %s\n", query.toUtf8().data());
}
-
+
QStringList results;
if (m_console->sql_cmd(query, results)) {
"It is possible you may need to add \"catalog = all\" "
"to the Messages resource for this job.\n"), QMessageBox::Ok);
return;
- }
+ }
QString jobstr("JobId "); /* FIXME: should this be translated ? */
jobstr += m_jobId;
QString htmlbuf("<html><body><pre>");
-
+
/* Iterate through the lines of results. */
QString field;
QStringList fieldlist;
QString lastSvc;
foreach (QString resultline, results) {
fieldlist = resultline.split("\t");
-
+
if (fieldlist.size() < 2)
continue;
field = fieldlist[1].trimmed();
int colon = field.indexOf(":");
if (colon > 0) {
- /* string is like <service> <jobId xxxx>: ..."
- * we split at ':' then remove the jobId xxxx string (always the same) */
+ /* string is like <service> <jobId xxxx>: ..."
+ * we split at ':' then remove the jobId xxxx string (always the same) */
QString curSvc(field.left(colon).replace(jobstr,"").trimmed());
if (curSvc == lastSvc && curTime == lastTime) {
curTime.clear();
- curSvc.clear();
+ curSvc.clear();
} else {
lastTime = curTime;
lastSvc = curSvc;
// htmlbuf += "<td>" + curTime + "</td>";
htmlbuf += "\n" + field ;
}
-
+
} /* foreach resultline */
htmlbuf += "</pre></body></html>";
/* full text ready. Here a custom sheet is used to align columns */
QString logSheet(".err {color:#FF0000;}");
textJobLog->document()->setDefaultStyleSheet(logSheet);
- textJobLog->document()->setHtml(htmlbuf);
+ textJobLog->document()->setHtml(htmlbuf);
textJobLog->moveCursor(QTextCursor::Start);
} /* if results from query */
-
+
}
QRegExp oldline("Files=([\\d,]+) Bytes=([\\d,]+) Bytes/sec=([\\d,]+) Errors=([\\d,]+)");
QString com(",");
QString empty("");
-
+
if (m_console->dir_cmd(cmd, results)) {
foreach (QString mline, results) {
- foreach (QString line, mline.split("\n")) {
+ foreach (QString line, mline.split("\n")) {
line = line.trimmed();
if (oldline.indexIn(line) >= 0) {
if (parseit) {
lst.removeFirst();
} else {
- if (mainWin->m_miscDebug)
+ if (mainWin->m_miscDebug)
Pmsg1(0, "bad line=%s\n", line.toUtf8().data());
continue;
}
if (lst.count() < 2) {
- if (mainWin->m_miscDebug)
+ if (mainWin->m_miscDebug)
Pmsg2(0, "bad line=%s count=%d\n", line.toUtf8().data(), lst.count());
}
if (lst[0] == "JobId") {
if (!parseit) {
continue;
}
-
+
// } else if (lst[0] == "Job") {
// grpRun->setTitle(lst[1]);
-
-//
+
+//
// } else if (lst[0] == "VSS") {
// } else if (lst[0] == "Level") {
if (lst[0] == "Errors") {
label_JobErrors->setText(lst[1]);
-
+
} else if (lst[0] == "Bytes/sec") {
label_Speed->setText(convertBytesSI(lst[1].toULongLong())+"/s");
-
+
} else if (lst[0] == "Files") {
label_JobFiles->setText(lst[1]);
-
+
} else if (lst[0] == "Bytes") {
label_JobBytes->setText(convertBytesSI(lst[1].toULongLong()));
-
+
} else if (lst[0] == "Files Examined") {
label_FilesExamined->setText(lst[1]);
-
+
} else if (lst[0] == "Processing file") {
label_CurrentFile->setText(lst[1]);
}
{
QString stat, err;
char buf[256];
- QString query =
+ QString query =
"SELECT JobId, Job.Name, Level, Client.Name, Pool.Name, FileSet,"
"SchedTime, StartTime, EndTime, EndTime-StartTime AS Duration, "
"JobBytes, JobFiles, JobErrors, JobStatus, PurgedFiles "
"FROM Job JOIN Client USING (ClientId) "
"LEFT JOIN Pool ON (Job.PoolId = Pool.PoolId) "
"LEFT JOIN FileSet ON (Job.FileSetId = FileSet.FileSetId)"
- "WHERE JobId=" + m_jobId;
+ "WHERE JobId=" + m_jobId;
QStringList results;
if (m_console->sql_cmd(query, results)) {
QString resultline, duration;
QStringListIterator fld(fieldlist);
label_JobId->setText(fld.next());
label_Name->setText(fld.next());
-
+
label_Level->setText(job_level_to_str(fld.next()[0].toAscii()));
m_client = fld.next();
label_StartTime->setText(fld.next());
label_EndTime->setText(fld.next());
duration = fld.next();
- /*
+ /*
* Note: if we have a negative duration, it is because the EndTime
- * is zero (i.e. the Job is still running). We should use
+ * is zero (i.e. the Job is still running). We should use
* duration = StartTime - current_time
*/
if (duration.left(1) == "-") {
}
}
}
-
+
void Job::populateVolumes()
{
- QString query =
+ QString query =
"SELECT DISTINCT VolumeName, InChanger, Slot "
"FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
- "WHERE JobId=" + m_jobId + " ORDER BY VolumeName ";
+ "WHERE JobId=" + m_jobId + " ORDER BY VolumeName ";
if (mainWin->m_sqlDebug) Pmsg1(0, "Query cmd : %s\n",query.toUtf8().data());
-
+
QStringList results;
if (m_console->sql_cmd(query, results)) {
foreach (resultline, results) { // should have only one result
fieldlist = resultline.split("\t");
QStringListIterator fld(fieldlist);
-// QListWidgetItem(QIcon(":/images/inchanger" + fld.next() + ".png"),
+// QListWidgetItem(QIcon(":/images/inchanger" + fld.next() + ".png"),
// fld.next(), list_Volume);
list_Volume->addItem(fld.next());
}