From: Dirk H Bartley Date: Sat, 5 May 2007 02:17:02 +0000 (+0000) Subject: Add check boxes and combo boxes to limit the joblist. Move setTitle X-Git-Tag: Release-7.0.0~6430 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2c3b3dca16d5ad065899106c59a51142af513abe;p=bacula%2Fbacula Add check boxes and combo boxes to limit the joblist. Move setTitle to pg_Initialize from constructors. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4701 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index 627eb8c5de..741a173786 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -6,12 +6,10 @@ Possilbe: Turn run and label into docked pages. (remove button bar buttons??) Resolve issue of connection during restore selection. Could go with preempt -Add option to LIMIT the number of jobs shown in all jobs page for users with -multiple hundreds to thousands of jobs. - Where and bootstrap are confused in runjobs of restore. User preferences. With log to stdout options. +Have settings for defaults of limits on joblist Test restore and get anything not working, working. partially done. @@ -21,9 +19,6 @@ Get restore into stack. Update README describe bat.conf.example to bat.conf -Create list of what does not work. -From what I can tell, just the restore window on the left. - Add numerous are you sure dialog boxes. Like are you sure you want to delete/purge that volume. Show a little of the documentation about what the consequences of delete or purging are. @@ -106,10 +101,15 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Create list of what does not work. +From what I can tell, just the restore window on the left. + +Add option to LIMIT the number of jobs shown in all jobs page for users with +multiple hundreds to thousands of jobs. + Play with includes to Make these compiles shorter. moved includes of of includes and into files only console.h should be long - relabel storage=DDS3 oldvolume=ddsvol003 volume=dds3vol003 slot=3 pool=dds3_hope in label slot spinner, limit the upper to the value of slots for that storage. diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 4f18299e14..8aa2ed5fe8 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -50,7 +50,6 @@ Clients::Clients() m_populated = false; m_checkcurwidget = true; m_closeable = false; - setTitle(); } Clients::~Clients() diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index b2c66674d5..6a92c31fa8 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -50,7 +50,6 @@ FileSet::FileSet() m_populated = false; m_checkcurwidget = true; m_closeable = false; - setTitle(); } FileSet::~FileSet() diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index fc3eabe327..a695964dcd 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -53,7 +53,12 @@ JobList::JobList(QString &mediaName, QString &clientname, m_closeable = false; m_checkCurrentWidget = true; createConnections(); - setTitle(); + + /* Set Defaults for check and spin for limits */ + limitCheckBox->setCheckState(Qt::Checked); + limitSpinBox->setValue(150); + daysCheckBox->setCheckState(Qt::Unchecked); + daysSpinBox->setValue(30); } /* @@ -68,6 +73,34 @@ void JobList::populateTable() QString resultline; QBrush blackBrush(Qt::black); + /* Can't do this in constructor because not neccesarily conected in constructor */ + if (!m_populated) { + clientsComboBox->addItem(""); + clientsComboBox->addItems(m_console->client_list); + int clientIndex = clientsComboBox->findText(m_clientName, Qt::MatchExactly); + if (clientIndex != -1) + clientsComboBox->setCurrentIndex(clientIndex); + + /* Not m_console->volume_list will query database */ + QString query("SELECT VolumeName AS Media FROM Media ORDER BY Media"); + QStringList results, volumeList; + if (m_console->sql_cmd(query, results)) { + QString field; + QStringList fieldlist; + /* Iterate through the lines of results. */ + foreach (QString resultline, results) { + fieldlist = resultline.split("\t"); + volumeList.append(fieldlist[0]); + } /* foreach resultline */ + } /* if results from query */ + volumeComboBox->addItem(""); + volumeComboBox->addItems(volumeList); + int volumeIndex = volumeComboBox->findText(m_mediaName, Qt::MatchExactly); + if (volumeIndex != -1) { + volumeComboBox->setCurrentIndex(volumeIndex); + } + } + /* Set up query QString and header QStringList */ QString query(""); query += "SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client," @@ -77,15 +110,34 @@ void JobList::populateTable() " FROM Job, JobMedia, Media, Client" " WHERE JobMedia.JobId=Job.JobId and JobMedia.MediaId=Media.MediaId" " and Client.ClientId=Job.ClientId"; + int volumeIndex = volumeComboBox->currentIndex(); + if (volumeIndex != -1) + m_mediaName = volumeComboBox->itemText(volumeIndex); if (m_mediaName != "") { - query += " and Media.VolumeName='" + m_mediaName + "'"; + query += " AND Media.VolumeName='" + m_mediaName + "'"; m_closeable=true; } + int clientIndex = clientsComboBox->currentIndex(); + if (clientIndex != -1) + m_clientName = clientsComboBox->itemText(clientIndex); if (m_clientName != "") { - query += " and Client.Name='" + m_clientName + "'"; + query += " AND Client.Name='" + m_clientName + "'"; m_closeable=true; } - query += " ORDER BY Job.Starttime"; + /* If Limit check box For limit by days is checked */ + if (daysCheckBox->checkState() == Qt::Checked) { + QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value()); + QString since = stamp.toString(Qt::ISODate); + query += " AND Job.Starttime>'" + since + "'"; + } + /* Descending */ + query += " ORDER BY Job.Starttime DESC"; + /* If Limit check box for limit records returned is checked */ + if (limitCheckBox->checkState() == Qt::Checked) { + QString limit; + limit.setNum(limitSpinBox->value()); + query += " LIMIT " + limit; + } QStringList headerlist = (QStringList() << "Job Id" << "Job Name" << "Client" << "Job Starttime" << "Job Type" << "Job Level" << "Job Files" << "Job Bytes" << "Job Status" ); @@ -203,6 +255,7 @@ void JobList::createConnections() * page selector tree */ connect(actionRefreshJobList, SIGNAL(triggered()), this, SLOT(populateTable())); + connect(refreshButton, SIGNAL(pressed()), this, SLOT(populateTable())); /* for the tableItemChanged to maintain m_currentJob */ connect(mp_tableWidget, SIGNAL( currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), diff --git a/bacula/src/qt-console/joblist/joblist.ui b/bacula/src/qt-console/joblist/joblist.ui index f9b94fd417..605f666e06 100644 --- a/bacula/src/qt-console/joblist/joblist.ui +++ b/bacula/src/qt-console/joblist/joblist.ui @@ -6,7 +6,7 @@ 0 0 621 - 460 + 500 @@ -19,13 +19,130 @@ 6 + + + + 0 + + + 6 + + + + + 0 + + + 6 + + + + + Record Limit + + + + + + + 10000 + + + 1 + + + 25 + + + + + + + + + 0 + + + 6 + + + + + Days Limit + + + + + + + 10 + + + + + + + + + 0 + + + 6 + + + + + Clients + + + + + + + + + + + + 0 + + + 6 + + + + + Volume + + + + + + + + + + + + + 65 + 16777215 + + + + Refresh + + + + + - :images/run.png + ../../../../../../../:images/run.png Refresh Job List @@ -36,7 +153,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png ListJobid @@ -44,7 +161,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png List Files On Job @@ -52,7 +169,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png ListJobMedia @@ -60,7 +177,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png ListVolumes @@ -68,7 +185,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png LongListJob @@ -76,7 +193,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png DeleteJob @@ -84,7 +201,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png PurgeFiles diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index aca288728e..44fc75e24b 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -53,7 +53,6 @@ MediaList::MediaList() m_populated = false; m_checkcurwidget = true; m_closeable = false; - setTitle(); } MediaList::~MediaList() diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index b6bd5d2f99..efee0781cf 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -195,6 +195,7 @@ void Pages::pgInitialize(QTreeWidgetItem *parentTreeWidgetItem) treeWidgetName(name); item->setText(0, name); mainWin->hashInsert(item, this); + setTitle(); } /* diff --git a/bacula/src/qt-console/storage/storage.cpp b/bacula/src/qt-console/storage/storage.cpp index b3eee6d8dc..2de0b05365 100644 --- a/bacula/src/qt-console/storage/storage.cpp +++ b/bacula/src/qt-console/storage/storage.cpp @@ -53,7 +53,6 @@ Storage::Storage() m_checkcurwidget = true; m_closeable = false; m_currentStorage = ""; - setTitle(); } Storage::~Storage()