m_dirPaths.clear();
directoryTree->clear();
fileTable->clear();
+ fileTable->setRowCount(0);
+ fileTable->setColumnCount(0);
versionTable->clear();
- QString cmd =
- "SELECT DISTINCT Path.Path FROM Path"
- " LEFT OUTER JOIN File ON (File.PathId=Path.PathId)"
- " LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)"
- " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)"
- " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId) WHERE";
+ versionTable->setRowCount(0);
+ versionTable->setColumnCount(0);
+ jobTable->clear();
+ jobTable->setRowCount(0);
+ jobTable->setColumnCount(0);
+
m_condition = " Job.name = '" + jobCombo->itemText(jobCombo->currentIndex()) + "'";
int clientIndex = clientCombo->currentIndex();
if ((clientIndex >= 0) && (clientCombo->itemText(clientIndex) != "Any")) {
if ((fileSetIndex >= 0) && (fileSetCombo->itemText(fileSetIndex) != "Any")) {
m_condition.append(" AND FileSet.FileSet='" + fileSetCombo->itemText(fileSetIndex) + "'");
}
- cmd += m_condition;
+ m_jobQueryPart =
+ " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)"
+ " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)"
+ " WHERE" + m_condition +
+ " AND Job.purgedfiles=0";
+ m_jobQuery =
+ "SELECT Job.Jobid"
+ " From Job" + m_jobQueryPart;
+ if (mainWin->m_sqlDebug) {
+ Pmsg1(000, "Query cmd : %s\n",m_jobQuery.toUtf8().data());
+ }
+ populateJobTable();
+
+ QString cmd =
+ "SELECT DISTINCT Path.Path"
+ " FROM Path"
+ " LEFT OUTER JOIN File ON (File.PathId=Path.PathId)"
+ " LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)"
+ " WHERE Job.Jobid IN (" + m_jobQuery + ")";
if (mainWin->m_sqlDebug) {
Pmsg1(000, "Query cmd : %s\n",cmd.toUtf8().data());
}
directoryLabel->setText("Present Working Directory : " + directory);
QString cmd =
"SELECT DISTINCT Filename.Name"
- " FROM File LEFT OUTER JOIN Filename on (Filename.FilenameId=File.FilenameId)"
+ " FROM File "
+ " LEFT OUTER JOIN Filename on (Filename.FilenameId=File.FilenameId)"
" LEFT OUTER JOIN Path ON (Path.PathId=File.PathId)"
" LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)"
- " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)"
- " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)";
- cmd += " WHERE Path.Path='" + directory + "' AND Filename.Name!='' AND " + m_condition;
+ " WHERE Path.Path='" + directory + "' AND Filename.Name!=''"
+ " AND Job.Jobid IN (" + m_jobQuery + ")";
+
QStringList headerlist = (QStringList() << "File Name");
fileTable->clear();
}
QStringList results;
if (m_console->sql_cmd(cmd, results)) {
- m_resultCount = results.count();
QTableWidgetItem* tableItem;
QString field;
" LEFT OUTER JOIN Filename on (Filename.FilenameId=File.FilenameId)"
" LEFT OUTER JOIN Path ON (Path.PathId=File.PathId)"
" LEFT OUTER JOIN Job ON (File.JobId=Job.JobId)"
- " LEFT OUTER JOIN Client ON (Job.ClientId=Client.ClientId)"
- " LEFT OUTER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)";
- cmd += " WHERE Filename.Name='" + file + "' AND Path.Path='" + directory + "' AND " + m_condition;
+ " WHERE Filename.Name='" + file + "' AND Path.Path='" + directory + "'"
+ " AND Job.Jobid IN (" + m_jobQuery + ")";
QStringList headerlist = (QStringList() << "File Id" << "Job Id" << "End Time" << "Md5");
versionTable->clear();
}
QStringList results;
if (m_console->sql_cmd(cmd, results)) {
- m_resultCount = results.count();
QTableWidgetItem* tableItem;
QString field;
child->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png")));
}
}
+
+void restoreTree::populateJobTable()
+{
+ QBrush blackBrush(Qt::black);
+ QStringList headerlist = (QStringList() << "Job Id" << "End Time" << "Type");
+ jobTable->clear();
+ jobTable->setColumnCount(headerlist.size());
+ jobTable->setHorizontalHeaderLabels(headerlist);
+ QString jobQuery =
+ "SELECT Job.Jobid AS Id, Job.Endtime AS EndTime, Job.Level AS Level"
+ " FROM Job" + m_jobQueryPart +
+ " ORDER BY Job.Endtime DESC";
+ if (mainWin->m_sqlDebug) {
+ Pmsg1(000, "Query cmd : %s\n",jobQuery.toUtf8().data());
+ }
+
+ QStringList results;
+ if (m_console->sql_cmd(jobQuery, results)) {
+
+ QTableWidgetItem* tableItem;
+ QString field;
+ QStringList fieldlist;
+ jobTable->setRowCount(results.size());
+
+ int row = 0;
+ /* Iterate through the record returned from the query */
+ foreach (QString resultline, results) {
+ fieldlist = resultline.split("\t");
+ int column = 0;
+ /* remove directory */
+ if (fieldlist[0].trimmed() != "") {
+ /* Iterate through fields in the record */
+ foreach (field, fieldlist) {
+ field = field.trimmed(); /* strip leading & trailing spaces */
+ tableItem = new QTableWidgetItem(field,1);
+ tableItem->setFlags(0);
+ tableItem->setForeground(blackBrush);
+ jobTable->setItem(row, column, tableItem);
+ column++;
+ }
+ row++;
+ }
+ }
+ }
+ jobTable->resizeColumnsToContents();
+ jobTable->resizeRowsToContents();
+ jobTable->verticalHeader()->hide();
+}
<rect>
<x>0</x>
<y>0</y>
- <width>515</width>
- <height>333</height>
+ <width>400</width>
+ <height>319</height>
</rect>
</property>
<property name="windowTitle" >
</property>
<item row="0" column="0" >
<widget class="QSplitter" name="splitter" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <widget class="QWidget" name="layoutWidget_2" >
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="0" >
+ <widget class="QTableWidget" name="jobTable" />
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="jobLabel" >
+ <property name="text" >
+ <string>Jobs</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
<widget class="QTreeWidget" name="directoryTree" />
- <widget class="QWidget" name="" >
+ <widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</item>
</layout>
</widget>
- <widget class="QWidget" name="" >
+ <widget class="QWidget" name="layoutWidget_3" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>