From 52084d878b330d9bb5a463d38912bc6e5e851450 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 1 Aug 2009 12:02:36 +0000 Subject: [PATCH] Add new form to see job details git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9149 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/bat.pro.in | 6 +- bacula/src/qt-console/images/A.png | Bin 0 -> 1379 bytes bacula/src/qt-console/images/R.png | Bin 0 -> 1094 bytes bacula/src/qt-console/images/T.png | Bin 0 -> 672 bytes bacula/src/qt-console/images/f.png | Bin 0 -> 1379 bytes bacula/src/qt-console/images/inflag0.png | Bin 0 -> 847 bytes bacula/src/qt-console/images/inflag1.png | Bin 0 -> 806 bytes bacula/src/qt-console/images/inflag2.png | Bin 0 -> 859 bytes bacula/src/qt-console/images/purge.png | Bin 0 -> 1308 bytes bacula/src/qt-console/images/zoom.png | Bin 0 -> 1099 bytes bacula/src/qt-console/job/job.cpp | 287 +++++++++++ bacula/src/qt-console/job/job.h | 56 ++ bacula/src/qt-console/job/job.ui | 600 ++++++++++++++++++++++ bacula/src/qt-console/joblist/joblist.cpp | 13 + bacula/src/qt-console/joblist/joblist.h | 1 + bacula/src/qt-console/joblist/joblist.ui | 9 + bacula/src/qt-console/main.qrc | 109 ++-- 17 files changed, 1030 insertions(+), 51 deletions(-) create mode 100644 bacula/src/qt-console/images/A.png create mode 100644 bacula/src/qt-console/images/R.png create mode 100644 bacula/src/qt-console/images/T.png create mode 100644 bacula/src/qt-console/images/f.png create mode 100644 bacula/src/qt-console/images/inflag0.png create mode 100644 bacula/src/qt-console/images/inflag1.png create mode 100644 bacula/src/qt-console/images/inflag2.png create mode 100644 bacula/src/qt-console/images/purge.png create mode 100644 bacula/src/qt-console/images/zoom.png create mode 100644 bacula/src/qt-console/job/job.cpp create mode 100644 bacula/src/qt-console/job/job.h create mode 100644 bacula/src/qt-console/job/job.ui diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index 6fc22b7ff0..ba9d773fed 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -50,7 +50,7 @@ FORMS += run/run.ui run/runcmd.ui run/estimate.ui run/prune.ui FORMS += select/select.ui select/textinput.ui FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui -FORMS += joblog/joblog.ui jobs/jobs.ui +FORMS += joblog/joblog.ui jobs/jobs.ui job/job.ui FORMS += help/help.ui FORMS += status/dirstat.ui FORMS += status/clientstat.ui @@ -123,6 +123,10 @@ SOURCES += fileset/fileset.cpp HEADERS += joblog/joblog.h SOURCES += joblog/joblog.cpp +## Job +HEADERS += job/job.h +SOURCES += job/job.cpp + ## Jobs HEADERS += jobs/jobs.h SOURCES += jobs/jobs.cpp diff --git a/bacula/src/qt-console/images/A.png b/bacula/src/qt-console/images/A.png new file mode 100644 index 0000000000000000000000000000000000000000..89c212493e4c6b7f4a3621b4722e9b8b887bb7c2 GIT binary patch literal 1379 zcmV-p1)TbcP)vdGml&%H!h?@2Owfe#af?;xPLBDSQo{2BknLg$Rf!9D)Mc+k{oVS#$ zpcM=S&~-}(@kd_dT(WgSqVH+(X-lbhBA{pwr~x`&Y;S(@_64^Pc72bh6`q3rg`KQ> zeJjg5){<&!;kScdVnlJ~&SzM@eiKVqt)aQDmO@`I<&g{6C|wBtPb0PqI39}vYG@1h)4tgp+2T) z@M#+f@id^C;$Drj7UKkC1!EyF!pvI5f}cO&^EWnK!O-*jwv#!uhr+;VM!JtqKvc;( z>U|vpRBW`cI0wc8I0TI+3eSP^6kalQWi6>|BHMd{Qsz9)O@!=l;0Rrn%rQVRWm^dy z3FD$Xio+A=$_vR=FL2jW8?Ok^yka%PQyhKkdCC_Cu@0;goCvu<$Qubqd0=vet~2NQ z2pnVVJax$;w?9h9ORq6y%9OF35A5CccaS9y(e}hfVvVhs2ppM;qwFAS=mBgjqV$$y zmE`VaRuHYQ0vF0cV{-DCv;Hr((YJdmVLp#>!iqDbiX&YTfLDP) zMP;Jy+Jx%;ptHRp>_3H8pcV9nNp4!bo>t#-@$doiXS?v5TCpfvmail}bvoU<-zO}W z$PEsVE?NdFjvZ%$++e`z)FR17?)u8mRRZ+h1Fddi=H#m(P4JVqQT*3;~ zM|4%Ov93BcB6MdBr*aMp>`I3}mK~iyA(GSyGADoygk1-R!kI2NJpVc`Kq7Rw(I6ri zfwKk6@euu?EPGI{zoh^rA|5cXJIp?!Ts{u`Q)&_7z1dq)QHkqGE;N zQ26$u85s(A8aNP1ru{z+fCl0~1Mo0#IH4)F#FcA_E0@refFr=lXiXy8^Pi%BwYDV| liAU_Rw#7soGXK`L{008Ut+%NB!kPd8002ovPDHLkV1fvjh8_R_ literal 0 HcmV?d00001 diff --git a/bacula/src/qt-console/images/R.png b/bacula/src/qt-console/images/R.png new file mode 100644 index 0000000000000000000000000000000000000000..166c2201cf90f6628cbf3332bcff05c26acb6805 GIT binary patch literal 1094 zcmV-M1iAZ(P)}dc11H(x~K~#9!rIuZ6Q)L*(f2Up7t*e_9CQ~ztBql}^ofjxUA{1p7 z5)ER&D~ZHAV`h-4(P$zXk)Ss&>J1@&#G56~0V8H9aiut*gKf;JTflA7?t^aZv+K?| zUDqCOp0gaAZfoM3yvg}`pa1`Pp8xxQ59A*Y0tW!YGM@)_0dBy~{}_rj@b&Ji*&LvK zKzX4cN}gv$Ksp+|W&CokSxF=kI2=XHC+GO^qvHT|KnoBDQUbc{u;&5H0F;&585|r` z!X4L86a}ZVn2Wz%0oVu;++i)r?%$1v|EHP3Hut12zkQIV+`Pb^%pZ zYy3UHmYl%v02-hIuK=mxp{M~Y0Ed7iFel)yJpKJo79|4m5b(4pM~%f|sg{;A2B7+D zea5$^zA^l@J_AsXe|FT6zRUxg1Vm9*0I>m1*||=j?{srhnXV_%)cK_kXJ=<{I!hRf zj}q?aqBRiIfMEyLb!X&6%XbN*VN3m_B5Fa>PHQCzMvdjE{j)fuLL0lEBydsyW|n$TfWavbKl13!pPSEc z=(X1u!W~_xnnonj%ZV?()+Z*XXbl7hEIrkMv|^FvY6kZ<@UdJU0}k)>ZS%AR+oypB z;9YrF4|JRRz%;u;4DJT-ti|BoY74d}q<=ktUx=oGG1<|EnSo0l0I*~G*2N2<%T}j- z0|*1RMZSvYyh_xPw488RiKPQs#bR)4#Y3)G0v{9un*gG~9bu@*Zgm00VtA^&v!3Bg zwrVme2RveQF0qPnU`l{=31F^Ka(@z5I?-|s&LNDF!Z1_Ffs#A^1!i`zBtp`W;Q#;t M07*qoM6N<$f}>LGyZ`_I literal 0 HcmV?d00001 diff --git a/bacula/src/qt-console/images/T.png b/bacula/src/qt-console/images/T.png new file mode 100644 index 0000000000000000000000000000000000000000..d92d88d8a472498e358027c560cd0d750f0ffd9c GIT binary patch literal 672 zcmV;R0$=@!P)04*G{O1l660v$<2K~#9!?Uk`>6hRcme>;0IiKnvfB!Sw74N7Kme-7a7$JeZe-_7~9S_)K(4H;{?vd)%f z#|gp;-Ei%bfdPOZtl*ae7G@R!9*N2% z!KMOt3j!B-zc90S;nc;GbRFs>j^qBXpZx6T&9lAj*;c0V^CtQ?zz^W3C`nbI<nFd};v=hLZJWKQT zoBD8!k`|dt5^BJ!_RDGHM^jc;HMLR~{7=73yHn~kaDd;39kYAmwGUtb0000vdGml&%H!h?@2Owfe#af?;xPLBDSQo{2BknLg$Rf!9D)Mc+k{oVS#$ zpcM=S&~-}(@kd_dT(WgSqVH+(X-lbhBA{pwr~x`&Y;S(@_64^Pc72bh6`q3rg`KQ> zeJjg5){<&!;kScdVnlJ~&SzM@eiKVqt)aQDmO@`I<&g{6C|wBtPb0PqI39}vYG@1h)4tgp+2T) z@M#+f@id^C;$Drj7UKkC1!EyF!pvI5f}cO&^EWnK!O-*jwv#!uhr+;VM!JtqKvc;( z>U|vpRBW`cI0wc8I0TI+3eSP^6kalQWi6>|BHMd{Qsz9)O@!=l;0Rrn%rQVRWm^dy z3FD$Xio+A=$_vR=FL2jW8?Ok^yka%PQyhKkdCC_Cu@0;goCvu<$Qubqd0=vet~2NQ z2pnVVJax$;w?9h9ORq6y%9OF35A5CccaS9y(e}hfVvVhs2ppM;qwFAS=mBgjqV$$y zmE`VaRuHYQ0vF0cV{-DCv;Hr((YJdmVLp#>!iqDbiX&YTfLDP) zMP;Jy+Jx%;ptHRp>_3H8pcV9nNp4!bo>t#-@$doiXS?v5TCpfvmail}bvoU<-zO}W z$PEsVE?NdFjvZ%$++e`z)FR17?)u8mRRZ+h1Fddi=H#m(P4JVqQT*3;~ zM|4%Ov93BcB6MdBr*aMp>`I3}mK~iyA(GSyGADoygk1-R!kI2NJpVc`Kq7Rw(I6ri zfwKk6@euu?EPGI{zoh^rA|5cXJIp?!Ts{u`Q)&_7z1dq)QHkqGE;N zQ26$u85s(A8aNP1ru{z+fCl0~1Mo0#IH4)F#FcA_E0@refFr=lXiXy8^Pi%BwYDV| liAU_Rw#7soGXK`L{008Ut+%NB!kPd8002ovPDHLkV1fvjh8_R_ literal 0 HcmV?d00001 diff --git a/bacula/src/qt-console/images/inflag0.png b/bacula/src/qt-console/images/inflag0.png new file mode 100644 index 0000000000000000000000000000000000000000..6478554f620d324d4fe829189b0a0d761aaef745 GIT binary patch literal 847 zcmV-V1F-ywP)PRHmIs7LTRc%R9aFycI=Po}ze9YI6_K45OJ@sge5xHDW zzrXf0A6$8rT-GItBK%I9QGcJXe?Tt^X>ILrt9vjOYCjp|^Z6e>S$~~t>u=&#W-vM> z?DkM;N*V?LIGGF^iw%mF;H&n)oP-_$ZQC~QK6{aCZ?98YS;Z+#k_G`Pig9utD2YH} zD~W~TrI|9lFyco)J_gMkUM5|akKedLq23@jJwvh4BwH?HdmdE60Ibp2_i`$kz|y_Rfd;~SpahgJ}UWz z#RY_Ik&Z@$oi@p!PuSffc=V8XFhq?;7^TogB7_31F%uR~RVKMLj7U!cYlR%q!2y}h zE}3oy9Vf)Y0pad0VXsXR`ba6!S|d|U#`P#o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Yu()3++E;9AU;aTBuT#5+}w04D=QCyiIe)}Y2Zeq@pf63tgWqG2d)AKM=9HCwH8-b zS6fMvRIAnM`DX&xhKBs~uuIzQwt(zE>HCj5ojX~cV~jb`XMGx2Ke|`DcV~-OWM^K2 zvr{7@#tRTduWSG8SfjcRf`{!U5yjBn|5>*hymtAM`nBnI-#_oXVbZjdYwI!xl&;^P z6d+aL`GHFJ?v@J+-+X)Vr=5=?ng*W5RZrr@|75=M~y#th1$E$<{A;3AXC7hjN z`}+m^*36ghbl~QxR!GmQ&@0Gxe!$t15)e2L0;x1YX%Mam1_ zzv;DqMYs|n1X4<;pmKxG+^xkc-AdLrJh|nRz3;QBA z16Sbk6o$tTZVc3M^b=sMA-})PgFl)mqtQWx@I!P^LHZ$DD}?bu`9OfO5-10+n*@y8 zr|K67Paz_S3KRqe8AOP17#UPS`+c9|QAAdv27(p1?jhY=AdQD~9?FFXLbR+PRfJP9 z=n$kq=?HBOQ3^r+6mTca_eE7RJmTYggRTU~AcQD}cnB(^5T1dc23`#3-e74*e+b l`q4ygz(-LY0e5(z<6lrk0T#WVAs_$%002ovPDHLkV1hN}lO_NF literal 0 HcmV?d00001 diff --git a/bacula/src/qt-console/images/purge.png b/bacula/src/qt-console/images/purge.png new file mode 100644 index 0000000000000000000000000000000000000000..9ba7c5325d82e78c5da1ae5a1000b34e3c86560c GIT binary patch literal 1308 zcmV+%1>^dOP)1zY_s+K4d&{k*7R$yU7ZXH^2?=P> z2NR6}sxdwo5}xFN@NCi;TjM41#UKwxg8^dVV<}MsjR6!%0J$j?YInQcYqz`I*`3+h znZFNi>lRvxc#@Md4>RBQKi_xe{Ndl@H9#zrukt_Q6<~P#_U&S5Xh`U~F5>aHxPAM! zICJKVIB?*=JjrnN-DSgB^ZYEZ6Bq>8xA$e=O7EqiO)~s%(qfN!_GAI=j zxZSS9UmQC%|NZB{*TDH&0;yVG08XFy<`bHmLpU5Vk;pW^T)IY3Rk?EY7KTwq2thd9 z!~T8y$;?C;85v{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~5J02ti3n2}&uHQh1){!#9vmD5V19lc$8k_fVVWkkZBr-|*xlVlDRp>l4?NFXSz21c zG))SH0+wY_C=`6%bzNN7^=+nUVi*RNWnozsi;Ii6uDfzAKuVd(WHMy4Sq#GRMv$L~knue4TP1F272qFCb6j#Q@ z#RZd-lWc8mEd#wbP4aJ2%B`cLqpv=G{3zSo+x_Mh%VijbU!HtE&)L}-Gcz-+uC6-3 z*Fg5hRpGj>CWKht-Q6A8+}xD)_4SmMmHEMo^*%p8XM1~_>FH@+zkclidEiUn6!`hJ zb)5iWLWpNl%ASW0AJWy;MPp+l00##Lyn6MDmoHxeECWx07rQWzN|_ygF>@YIfg RUN-;$002ovPDHLkV1jl}0RjL3 literal 0 HcmV?d00001 diff --git a/bacula/src/qt-console/job/job.cpp b/bacula/src/qt-console/job/job.cpp new file mode 100644 index 0000000000..aa4ff3be8c --- /dev/null +++ b/bacula/src/qt-console/job/job.cpp @@ -0,0 +1,287 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2009 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 two of the GNU General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + 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 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. + + 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. +*/ + +/* + * Version $Id$ + * + * Job Class + * + * Dirk Bartley, March 2007 + * + */ + +#include "bat.h" +#include "job.h" +#include "util/fmtwidgetitem.h" + +Job::Job(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem) +{ + setupUi(this); + m_closeable = true; + pgInitialize(tr("Job"), parentTreeWidgetItem); + QTreeWidgetItem* thisitem = mainWin->getFromHash(this); + thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/joblog.png"))); + m_cursor = new QTextCursor(textJobLog->document()); + + m_jobId = jobId; + getFont(); + populateText(); + populateForm(); + populateVolumes(); + dockPage(); + setCurrent(); +} + +void Job::getFont() +{ + QFont font = textJobLog->font(); + + QString dirname; + m_console->getDirResName(dirname); + QSettings settings(dirname, "bat"); + settings.beginGroup("Console"); + font.setFamily(settings.value("consoleFont", "Courier").value()); + font.setPointSize(settings.value("consolePointSize", 10).toInt()); + font.setFixedPitch(settings.value("consoleFixedPitch", true).toBool()); + settings.endGroup(); + textJobLog->setFont(font); +} + +/* + * Populate the text in the window + */ +void Job::populateText() +{ + QString query; + query = "SELECT Time, LogText FROM Log WHERE JobId='" + m_jobId + "' order by Time"; + + /* This could be a log item */ + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Log query cmd : %s\n", query.toUtf8().data()); + } + + QStringList results; + if (m_console->sql_cmd(query, results)) { + + if (!results.size()) { + QMessageBox::warning(this, tr("Bat"), + tr("There were no results!\n" + "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("
");
+  
+      /* Iterate through the lines of results. */
+      QString field;
+      QStringList fieldlist;
+      QString lastTime;
+      QString lastSvc;
+      foreach (QString resultline, results) {
+         fieldlist = resultline.split("\t");
+	 
+	 if (fieldlist.size() < 2)
+	    continue;
+
+	 QString curTime = fieldlist[0].trimmed();
+
+	 field = fieldlist[1].trimmed();
+	 int colon = field.indexOf(":");
+	 if (colon > 0) {
+ 	    /* string is like  : ..." 
+	     * 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(); 
+	    } else {
+	       lastTime = curTime;
+	       lastSvc = curSvc;
+	    }
+//	    htmlbuf += "" + curTime + "";
+	    htmlbuf += "\n" + curSvc + " ";
+
+	    /* rest of string is marked as pre-formatted (here trimming should
+	     * be avoided, to preserve original formatting) */
+	    QString msg(field.mid(colon+2));
+	    if (msg.startsWith( tr("Error:")) ) { /* FIXME: should really be translated ? */
+ 	       /* error msg, use a specific class */
+	       htmlbuf += "
" + msg + "
";
+	    } else {
+	       htmlbuf += msg ;
+	    }
+	 } else {
+ 	    /* non standard string, place as-is */
+	    if (curTime == lastTime) {
+	       curTime.clear();
+	    } else {
+	       lastTime = curTime;
+	    }
+//	    htmlbuf += "" + curTime + "";
+	    htmlbuf += "\n" + field ;
+	 }
+  
+      } /* foreach resultline */
+
+      htmlbuf += "
"; + + /* 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->moveCursor(QTextCursor::Start); + + } /* if results from query */ + +} + +// Need to use the fmtwidgetitem helper instead +QString convertBytesSI(qint64 qfld) +{ + static const qint64 KB = Q_INT64_C(1000); + static const qint64 MB = (KB * KB); + static const qint64 GB = (MB * KB); + static const qint64 TB = (GB * KB); + static const qint64 PB = (TB * KB); + static const qint64 EB = (PB * KB); + + /* note: division is integer, so to have some decimals we divide for a + smaller unit (e.g. GB for a TB number and so on) */ + char suffix; + if (qfld >= EB) { + qfld /= PB; + suffix = 'E'; + } + else if (qfld >= PB) { + qfld /= TB; + suffix = 'P'; + } + else if (qfld >= TB) { + qfld /= GB; + suffix = 'T'; + } + else if (qfld >= GB) { + qfld /= MB; + suffix = 'G'; + } + else if (qfld >= MB) { + qfld /= KB; + suffix = 'M'; + } + else if (qfld >= KB) { + suffix = 'k'; /* SI uses lowercase k */ + } + else { + /* plain bytes, no need to reformat */ + return QString("%1 B").arg(qfld); + } + + /* having divided for a smaller unit, now we can safely convert to double and + use the extra room for decimals */ + return QString("%1 %2B").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix); +} + +/* + * Populate the text in the window + */ +void Job::populateForm() +{ + QString stat; + char buf[256]; + 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 USING (PoolId) " + "LEFT JOIN FileSet USING (FileSetId)" + "WHERE JobId=" + m_jobId; + QStringList results; + if (m_console->sql_cmd(query, results)) { + QString resultline; + QStringList fieldlist; + + foreach (resultline, results) { // should have only one result + fieldlist = resultline.split("\t"); + QStringListIterator fld(fieldlist); + label_JobId->setText(fld.next()); + label_Name->setText(fld.next()); + + label_Level->setText(job_level_to_str(fld.next()[0].toAscii())); + + label_Client->setText(fld.next()); + label_Pool->setText(fld.next()); + label_FileSet->setText(fld.next()); + label_SchedTime->setText(fld.next()); + label_StartTime->setText(fld.next()); + label_EndTime->setText(fld.next()); + label_Duration->setText(fld.next()); + + label_JobBytes->setText(convertBytesSI(fld.next().toULongLong())); + label_JobFiles->setText(fld.next()); + label_JobErrors->setText(fld.next()); + + stat=fld.next(); + label_JobStatus->setPixmap(QPixmap(":/images/" + stat + ".png")); + jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf)); + stat = buf; + label_JobStatus->setToolTip(stat); + + chkbox_PurgedFiles->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked); + } + } +} + +void Job::populateVolumes() +{ + + QString query = + "SELECT DISTINCT VolumeName, InChanger, Slot " + "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) " + "WHERE JobId=" + m_jobId + " ORDER BY VolumeName "; + Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); + + + QStringList results; + if (m_console->sql_cmd(query, results)) { + QString resultline; + QStringList fieldlist; + list_Volume->clear(); + foreach (resultline, results) { // should have only one result + fieldlist = resultline.split("\t"); + QStringListIterator fld(fieldlist); +// QListWidgetItem(QIcon(":/images/inchanger" + fld.next() + ".png"), +// fld.next(), list_Volume); + list_Volume->addItem(fld.next()); + } + } +} + +//QListWidgetItem ( const QIcon & icon, const QString & text, QListWidget * parent = 0, int type = Type ) diff --git a/bacula/src/qt-console/job/job.h b/bacula/src/qt-console/job/job.h new file mode 100644 index 0000000000..2597ab36f8 --- /dev/null +++ b/bacula/src/qt-console/job/job.h @@ -0,0 +1,56 @@ +#ifndef _JOB_H_ +#define _JOB_H_ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 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 two of the GNU General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + 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 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. + + 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 +#include "ui_job.h" +#include "console.h" + +class Job : public Pages, public Ui::JobForm +{ + Q_OBJECT + +public: + Job(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem); + +public slots: + +private slots: + +private: + void populateText(); + void populateForm(); + void populateVolumes(); + + void getFont(); + QTextCursor *m_cursor; + QString m_jobId; +}; + +#endif /* _JOB_H_ */ diff --git a/bacula/src/qt-console/job/job.ui b/bacula/src/qt-console/job/job.ui new file mode 100644 index 0000000000..b20fc09dba --- /dev/null +++ b/bacula/src/qt-console/job/job.ui @@ -0,0 +1,600 @@ + + JobForm + + + + 0 + 0 + 855 + 757 + + + + Form + + + + + 10 + 40 + 231 + 181 + + + + + 0 + 0 + + + + Basic Information + + + + + 10 + 20 + 211 + 152 + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + JobId: + + + + + + + 2 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Job Name: + + + + + + + Test + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Level: + + + + + + + VirtualFull + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Client: + + + + + + + client-fd + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + FileSet: + + + + + + + TheFileSet + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Pool: + + + + + + + ThePool + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + 680 + 40 + 171 + 181 + + + + + 0 + 0 + + + + Volume Used + + + + + + + Vol0001 + + + + :/images/inflag1.png:/images/inflag1.png + + + + + + + + + + 420 + 40 + 251 + 181 + + + + + 0 + 0 + + + + Times + + + + + 10 + 20 + 231 + 151 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + Sched Time: + + + + + + + 2009-07-31 00:10:00 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Start Time: + + + + + + + 2009-07-31 00:10:00 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + End Time: + + + + + + + 2009-07-31 00:20:00 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Duration: + + + + + + + 00:10:00 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + 250 + 40 + 161 + 181 + + + + + 0 + 0 + + + + + 160 + 0 + + + + Status + + + + + 10 + 20 + 141 + 151 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + Files: + + + + + + + 1,924 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Bytes: + + + + + + + Errors: + + + + + + + 0 + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Status: + + + + + + + + + + :/images/T.png + + + false + + + + + + + Purged: + + + + + + + false + + + + + + true + + + + + + + 109 MB + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + + 10 + 220 + 841 + 531 + + + + + 0 + 0 + + + + Logs + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> + + + + + textJobLog + + + + + 10 + 10 + 661 + 31 + + + + + + + Delete + + + + :/images/purge.png:/images/purge.png + + + true + + + + + + + View errors for this Job + + + Errors + + + + :/images/zoom.png:/images/zoom.png + + + true + + + + + + + Media + + + + :/images/zoom.png:/images/zoom.png + + + true + + + + + + + History + + + + :/images/zoom.png:/images/zoom.png + + + true + + + + + + + + 0 + 0 + + + + Run again + + + + :/images/R.png:/images/R.png + + + true + + + + + + + Read doc + + + true + + + + + + + FileSet + + + + :/images/zoom.png:/images/zoom.png + + + true + + + + + + + Stats + + + + :/images/zoom.png:/images/zoom.png + + + true + + + + + + + + + + + diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index a1f9b9a4cf..a52119d3f5 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -36,6 +36,7 @@ #include #include "joblist.h" #include "restore.h" +#include "job/job.h" #include "joblog/joblog.h" #ifdef HAVE_QWT #include "jobgraphs/jobplot.h" @@ -408,6 +409,7 @@ void JobList::createConnections() #endif /* for the selectionChanged to maintain m_currentJob and a delete selection */ connect(mp_tableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); + connect(mp_tableWidget, SIGNAL(itemDoubleClicked()), this, SLOT(showInfoForJob())); /* Do what is required for the local context sensitive menu */ @@ -423,6 +425,7 @@ void JobList::createConnections() connect(actionRestoreFromJob, SIGNAL(triggered()), this, SLOT(preRestoreFromJob())); connect(actionRestoreFromTime, SIGNAL(triggered()), this, SLOT(preRestoreFromTime())); connect(actionShowLogForJob, SIGNAL(triggered()), this, SLOT(showLogForJob())); + connect(actionShowInfoForJob, SIGNAL(triggered()), this, SLOT(showInfoForJob())); connect(actionCancelJob, SIGNAL(triggered()), this, SLOT(consoleCancelJob())); connect(actionListJobTotals, SIGNAL(triggered()), this, SLOT(consoleListJobTotals())); connect(m_splitter, SIGNAL(splitterMoved(int, int)), this, SLOT(splitterMoved(int, int))); @@ -530,6 +533,15 @@ void JobList::showLogForJob() new JobLog(m_currentJob, pageSelectorTreeWidgetItem); } +/* + * Subroutine to call class to show the log in the database from that job + */ +void JobList::showInfoForJob() +{ + QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this); + new Job(m_currentJob, pageSelectorTreeWidgetItem); +} + /* * Cancel a running job */ @@ -643,6 +655,7 @@ void JobList::selectionChanged() mp_tableWidget->addAction(actionRestoreFromJob); mp_tableWidget->addAction(actionRestoreFromTime); mp_tableWidget->addAction(actionShowLogForJob); + mp_tableWidget->addAction(actionShowInfoForJob); } if (m_selectedJobsCount >= 1) { mp_tableWidget->addAction(actionDeleteJob); diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index db9d0b437c..44ee63e45d 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -65,6 +65,7 @@ private slots: void preRestoreFromJob(); void preRestoreFromTime(); void showLogForJob(); + void showInfoForJob(); void consoleCancelJob(); void graphTable(); void splitterMoved(int pos, int index); diff --git a/bacula/src/qt-console/joblist/joblist.ui b/bacula/src/qt-console/joblist/joblist.ui index 99adbadab0..dd40d2c52f 100644 --- a/bacula/src/qt-console/joblist/joblist.ui +++ b/bacula/src/qt-console/joblist/joblist.ui @@ -442,6 +442,15 @@ Show Log for Job + + + + :/images/joblog.png:/images/joblog.png + + + Show Info for Job + + diff --git a/bacula/src/qt-console/main.qrc b/bacula/src/qt-console/main.qrc index 18e2c7b534..dddeb1a4c2 100644 --- a/bacula/src/qt-console/main.qrc +++ b/bacula/src/qt-console/main.qrc @@ -1,52 +1,61 @@ - - images/applications-graphics.png - images/bat.png - images/bat_icon.png - images/browse.png - images/cartridge-edit.png - images/cartridge.png - images/check.png - images/connected.png - images/copy.png - images/cut.png - images/disconnected.png - images/edit-cut.png - images/edit-delete.png - images/emblem-system.png - images/estimate-job.png - images/folder.png - images/folderbothchecked.png - images/folderchecked.png - images/folderunchecked.png - images/go-down.png - images/go-up.png - images/graph1.png - images/help-browser.png - images/joblog.png - images/label.png - images/mail-message-new.png - images/mail-message-pending.png - images/mark.png - images/network-server.png - images/new.png - images/open.png - images/package-x-generic.png - images/paste.png - images/print.png - images/restore.png - images/run.png - images/save.png - images/status-console.png - images/status.png - images/system-file-manager.png - images/unchecked.png - images/undo.png - images/unmark.png - images/up.png - images/utilities-terminal.png - images/view-refresh.png - images/weather-severe-alert.png - images/go-jump.png - + + images/R.png + images/T.png + images/f.png + images/A.png + images/inflag2.png + images/inflag0.png + images/inflag1.png + images/purge.png + images/zoom.png + images/applications-graphics.png + images/bat.png + images/bat_icon.png + images/browse.png + images/cartridge-edit.png + images/cartridge.png + images/check.png + images/connected.png + images/copy.png + images/cut.png + images/disconnected.png + images/edit-cut.png + images/edit-delete.png + images/emblem-system.png + images/estimate-job.png + images/folder.png + images/folderbothchecked.png + images/folderchecked.png + images/folderunchecked.png + images/go-down.png + images/go-up.png + images/graph1.png + images/help-browser.png + images/joblog.png + images/label.png + images/mail-message-new.png + images/mail-message-pending.png + images/mark.png + images/network-server.png + images/new.png + images/open.png + images/package-x-generic.png + images/paste.png + images/print.png + images/restore.png + images/run.png + images/save.png + images/status-console.png + images/status.png + images/system-file-manager.png + images/unchecked.png + images/undo.png + images/unmark.png + images/up.png + images/utilities-terminal.png + images/view-refresh.png + images/weather-severe-alert.png + images/go-jump.png + -- 2.39.5