2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2017 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 #include "dirstatus.h"
21 #include "../util/fmtwidgetitem.h"
24 void DIRStatus::doUpdate()
29 status.pushButton->setEnabled(false);
30 connect(t, SIGNAL(done(task *)), this, SLOT(taskDone(task *)), Qt::QueuedConnection);
31 t->init(res, TASK_STATUS);
33 status.statusBar->setText(QString("Trying to connect to Director..."));
34 Dmsg1(50, "doUpdate(%p)\n", res);
38 void DIRStatus::taskDone(task *t)
42 status.statusBar->setText(QString(t->errmsg));
45 status.statusBar->clear();
46 if (t->type == TASK_STATUS) {
48 struct s_last_job *ljob;
49 struct s_running_job *rjob;
51 status.labelName->setText(QString(res->name));
52 status.labelVersion->setText(QString(res->version));
53 status.labelStarted->setText(QString(res->started));
54 status.labelReloaded->setText(QString(res->reloaded));
55 status.labelPlugins->setText(QString(res->plugins));
56 /* Clear the table first */
57 Freeze(*status.tableRunning);
58 Freeze(*status.tableTerminated);
59 QStringList headerlistR = (QStringList() << tr("JobId")
60 << tr("Job") << tr("Level") << tr("Client")
61 << tr("Status") << tr("Storage")
62 << tr("Files") << tr("Bytes") << tr("Errors"));
63 status.tableRunning->clear();
64 status.tableRunning->setRowCount(0);
65 status.tableRunning->setColumnCount(headerlistR.count());
66 status.tableRunning->setHorizontalHeaderLabels(headerlistR);
67 status.tableRunning->setEditTriggers(QAbstractItemView::NoEditTriggers);
68 status.tableRunning->verticalHeader()->hide();
69 status.tableRunning->setSortingEnabled(true);
71 if (res->running_jobs) {
72 status.tableRunning->setRowCount(res->running_jobs->size());
74 foreach_alist(rjob, res->running_jobs) {
76 TableItemFormatter item(*status.tableRunning, row++);
77 item.setNumericFld(col++, QString(edit_uint64(rjob->JobId, ed1)));
78 item.setTextFld(col++, QString(rjob->Job));
79 item.setJobLevelFld(col++, QString(rjob->JobLevel));
80 item.setTextFld(col++, QString(rjob->Client));
81 item.setJobStatusFld(col++, QString(rjob->JobStatus));
82 item.setTextFld(col++, QString(rjob->Storage));
83 item.setNumericFld(col++, QString(edit_uint64(rjob->JobFiles, ed1)));
84 item.setBytesFld(col++, QString(edit_uint64(rjob->JobBytes, ed1)));
85 item.setNumericFld(col++, QString(edit_uint64(rjob->Errors, ed1)));
88 Dmsg0(0, "Strange, the list is NULL\n");
91 QStringList headerlistT = (QStringList() << tr("JobId")
92 << tr("Job") << tr("Level")
93 << tr("Status") << tr("Files") << tr("Bytes")
96 status.tableTerminated->clear();
97 status.tableTerminated->setRowCount(0);
98 status.tableTerminated->setColumnCount(headerlistT.count());
99 status.tableTerminated->setHorizontalHeaderLabels(headerlistT);
100 status.tableTerminated->setEditTriggers(QAbstractItemView::NoEditTriggers);
101 status.tableTerminated->verticalHeader()->hide();
102 status.tableTerminated->setSortingEnabled(true);
104 if (res->terminated_jobs) {
105 status.tableTerminated->setRowCount(res->terminated_jobs->size());
107 foreach_dlist(ljob, res->terminated_jobs) {
109 TableItemFormatter item(*status.tableTerminated, row++);
110 item.setNumericFld(col++, QString(edit_uint64(ljob->JobId, ed1)));
111 item.setTextFld(col++, QString(ljob->Job));
112 item.setJobLevelFld(col++, QString(ljob->JobLevel));
113 item.setJobStatusFld(col++, QString(ljob->JobStatus));
114 item.setNumericFld(col++, QString(edit_uint64(ljob->JobFiles, ed1)));
115 item.setBytesFld(col++, QString(edit_uint64(ljob->JobBytes, ed1)));
116 item.setNumericFld(col++, QString(edit_uint64(ljob->Errors, ed1)));
119 Dmsg0(0, "Strange, the list is NULL\n");
121 res->mutex->unlock();
123 Dmsg1(50, " Task %p OK\n", t);
126 status.pushButton->setEnabled(true);