]> git.sur5r.net Git - bacula/bacula/commitdiff
Add Fileset column. This is the commit that adds "LEFT OUTER JOIN" sql syntax.
authorDirk H Bartley <dbartley@schupan.com>
Sat, 19 May 2007 12:50:14 +0000 (12:50 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sat, 19 May 2007 12:50:14 +0000 (12:50 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4838 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/joblist/joblist.cpp
bacula/src/qt-console/joblist/joblist.ui

index 13d4b55c6f42025f4a821f32829471e979bb95c0..ec02dfdf0c6ebb5957168aa95d94fc553ca46a58 100644 (file)
@@ -111,6 +111,8 @@ void JobList::populateTable()
       purgedComboBox->addItem("Any");
       purgedComboBox->addItems( QStringList() << "0" << "1");
       statusComboBox->addItem("Any");
+      fileSetComboBox->addItem("Any");
+      fileSetComboBox->addItems(m_console->fileset_list);
       QString statusQuery("SELECT JobStatusLong FROM Status");
       QStringList statusResults, statusLongList;
       if (m_console->sql_cmd(statusQuery, statusResults)) {
@@ -135,43 +137,57 @@ void JobList::populateTable()
             " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
             " Job.JobBytes AS Bytes,"
             " Job.JobStatus AS Status, Status.JobStatusLong AS StatusLong,"
-            " Job.PurgedFiles AS Purged"
-            " FROM Job,Client,Status";
+            " Job.PurgedFiles AS Purged, FileSet.FileSet"
+            " FROM Job"
+            " LEFT OUTER JOIN Client ON (Client.ClientId=Job.ClientId)"
+            " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId)"
+            " LEFT OUTER JOIN Status ON (Job.JobStatus=Status.JobStatus)"
+            " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId)"
+            " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId)";
+   QStringList conditions;
    if (m_mediaName != "Any") {
-      query += ",JobMedia,Media";
-   }
-   query += " WHERE Client.ClientId=Job.ClientId AND Job.JobStatus=Status.JobStatus";
-   if (m_mediaName != "Any") {
-      query += " AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId"
-               " AND Media.VolumeName='" + m_mediaName + "'";
+      conditions.append("Media.VolumeName='" + m_mediaName + "'");
    }
    int clientIndex = clientsComboBox->currentIndex();
    if (clientIndex != -1)
       m_clientName = clientsComboBox->itemText(clientIndex);
    if (m_clientName != "Any") {
-      query += " AND Client.Name='" + m_clientName + "'";
+      conditions.append("Client.Name='" + m_clientName + "'");
    }
    int jobIndex = jobComboBox->currentIndex();
    if ((jobIndex != -1) && (jobComboBox->itemText(jobIndex) != "Any")) {
-      query += " AND Job.Name='" + jobComboBox->itemText(jobIndex) + "'";
+      conditions.append("Job.Name='" + jobComboBox->itemText(jobIndex) + "'");
    }
    int levelIndex = levelComboBox->currentIndex();
    if ((levelIndex != -1) && (levelComboBox->itemText(levelIndex) != "Any")) {
-      query += " AND Job.Level='" + levelComboBox->itemText(levelIndex) + "'";
+      conditions.append("Job.Level='" + levelComboBox->itemText(levelIndex) + "'");
    }
    int statusIndex = statusComboBox->currentIndex();
    if ((statusIndex != -1) && (statusComboBox->itemText(statusIndex) != "Any")) {
-      query += " AND Status.JobStatusLong='" + statusComboBox->itemText(statusIndex) + "'";
+      conditions.append("Status.JobStatusLong='" + statusComboBox->itemText(statusIndex) + "'");
    }
    int purgedIndex = purgedComboBox->currentIndex();
    if ((purgedIndex != -1) && (purgedComboBox->itemText(purgedIndex) != "Any")) {
-      query += " AND Job.PurgedFiles='" + purgedComboBox->itemText(purgedIndex) + "'";
+      conditions.append("Job.PurgedFiles='" + purgedComboBox->itemText(purgedIndex) + "'");
+   }
+   int fileSetIndex = fileSetComboBox->currentIndex();
+   if ((fileSetIndex != -1) && (fileSetComboBox->itemText(fileSetIndex) != "Any")) {
+      conditions.append("FileSet.FileSet='" + fileSetComboBox->itemText(fileSetIndex) + "'");
    }
    /* 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 + "'";
+      conditions.append("Job.Starttime>'" + since + "'");
+   }
+   bool first = true;
+   foreach (QString condition, conditions) {
+      if (first) {
+         query += " WHERE " + condition;
+         first = false;
+      } else {
+         query += " AND " + condition;
+      }
    }
    /* Descending */
    query += " ORDER BY Job.Starttime DESC, Job.JobId DESC";
@@ -185,7 +201,7 @@ void JobList::populateTable()
    /* Set up the Header for the table */
    QStringList headerlist = (QStringList()
       << "Job Id" << "Job Name" << "Client" << "Job Starttime" << "Job Type" 
-      << "Job Level" << "Job Files" << "Job Bytes" << "Job Status"  << "Purged" );
+      << "Job Level" << "Job Files" << "Job Bytes" << "Job Status"  << "Purged" << "File Set" );
    m_purgedIndex = headerlist.indexOf("Purged");
    m_typeIndex = headerlist.indexOf("Job Type");
    statusIndex = headerlist.indexOf("Job Status");
@@ -198,7 +214,7 @@ void JobList::populateTable()
    mp_tableWidget->setHorizontalHeaderLabels(headerlist);
 
    /*  This could be a user preference debug message?? */
-   //printf("Query cmd : %s\n",query.toUtf8().data());
+   printf("Query cmd : %s\n",query.toUtf8().data());
    if (m_console->sql_cmd(query, results)) {
       m_resultCount = results.count();
 
@@ -266,8 +282,8 @@ void JobList::setStatusColor(QTableWidgetItem *item, QString &field)
  */
 void JobList::PgSeltreeWidgetClicked()
 {
-   populateTable();
    if (!m_populated) {
+      populateTable();
       m_populated=true;
    }
 }
@@ -278,8 +294,8 @@ void JobList::PgSeltreeWidgetClicked()
  */
 void JobList::currentStackItem()
 {
+   populateTable();
    if (!m_populated) {
-      populateTable();
       m_contextActions.append(actionRefreshJobList);
       m_populated=true;
    }
index 25a1124ab8845d47c122eff38b9d1a823ea5490f..95abf3e00f006b49196ca96d7cbf43d0962cda7e 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>547</width>
-    <height>361</height>
+    <width>607</width>
+    <height>390</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="0" column="0" >
-    <widget class="QTableWidget" name="mp_tableWidget" />
-   </item>
    <item row="1" column="0" >
-    <layout class="QHBoxLayout" >
+    <layout class="QGridLayout" >
      <property name="margin" >
       <number>0</number>
      </property>
      <property name="spacing" >
-      <number>0</number>
+      <number>6</number>
      </property>
-     <item>
+     <item rowspan="2" row="0" column="1" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
           <number>6</number>
          </property>
          <item>
-          <widget class="QCheckBox" name="limitCheckBox" >
+          <widget class="QLabel" name="clientsLabel" >
            <property name="text" >
-            <string>Record Limit</string>
+            <string>Clients</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QSpinBox" name="limitSpinBox" >
-           <property name="maximum" >
-            <number>10000</number>
-           </property>
-           <property name="minimum" >
-            <number>1</number>
-           </property>
-           <property name="singleStep" >
-            <number>25</number>
-           </property>
-          </widget>
+          <widget class="QComboBox" name="clientsComboBox" />
          </item>
         </layout>
        </item>
           <number>6</number>
          </property>
          <item>
-          <widget class="QCheckBox" name="daysCheckBox" >
+          <widget class="QLabel" name="volumeLabel" >
            <property name="text" >
-            <string>Days Limit</string>
+            <string>Volume</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QSpinBox" name="daysSpinBox" >
-           <property name="singleStep" >
-            <number>10</number>
-           </property>
-          </widget>
+          <widget class="QComboBox" name="volumeComboBox" />
          </item>
         </layout>
        </item>
       </layout>
      </item>
-     <item>
+     <item rowspan="2" row="0" column="0" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
           <number>6</number>
          </property>
          <item>
-          <widget class="QLabel" name="clientsLabel" >
+          <widget class="QCheckBox" name="limitCheckBox" >
            <property name="text" >
-            <string>Clients</string>
+            <string>Record Limit</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="clientsComboBox" />
+          <widget class="QSpinBox" name="limitSpinBox" >
+           <property name="maximum" >
+            <number>10000</number>
+           </property>
+           <property name="minimum" >
+            <number>1</number>
+           </property>
+           <property name="singleStep" >
+            <number>25</number>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
           <number>6</number>
          </property>
          <item>
-          <widget class="QLabel" name="volumeLabel" >
+          <widget class="QCheckBox" name="daysCheckBox" >
            <property name="text" >
-            <string>Volume</string>
+            <string>Days Limit</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="volumeComboBox" />
+          <widget class="QSpinBox" name="daysSpinBox" >
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
       </layout>
      </item>
-     <item>
+     <item row="0" column="4" >
+      <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <widget class="QLabel" name="fileSetLabel" >
+         <property name="text" >
+          <string>FileSet</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="fileSetComboBox" />
+       </item>
+      </layout>
+     </item>
+     <item rowspan="2" row="0" column="3" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
           <number>6</number>
          </property>
          <item>
-          <widget class="QLabel" name="jobLabel" >
+          <widget class="QLabel" name="statusLabel" >
            <property name="text" >
-            <string>Job</string>
+            <string>Status</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="jobComboBox" />
+          <widget class="QComboBox" name="statusComboBox" />
          </item>
         </layout>
        </item>
           <number>6</number>
          </property>
          <item>
-          <widget class="QLabel" name="levelLabel" >
+          <widget class="QLabel" name="purgedLabel" >
            <property name="text" >
-            <string>Level</string>
+            <string>Purged</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="levelComboBox" />
+          <widget class="QComboBox" name="purgedComboBox" />
          </item>
         </layout>
        </item>
       </layout>
      </item>
-     <item>
+     <item rowspan="2" row="0" column="2" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
           <number>6</number>
          </property>
          <item>
-          <widget class="QLabel" name="statusLabel" >
+          <widget class="QLabel" name="jobLabel" >
            <property name="text" >
-            <string>Status</string>
+            <string>Job</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="statusComboBox" />
+          <widget class="QComboBox" name="jobComboBox" />
          </item>
         </layout>
        </item>
           <number>6</number>
          </property>
          <item>
-          <widget class="QLabel" name="purgedLabel" >
+          <widget class="QLabel" name="levelLabel" >
            <property name="text" >
-            <string>Purged</string>
+            <string>Level</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QComboBox" name="purgedComboBox" />
+          <widget class="QComboBox" name="levelComboBox" />
          </item>
         </layout>
        </item>
       </layout>
      </item>
-     <item>
-      <widget class="QPushButton" name="refreshButton" >
-       <property name="maximumSize" >
-        <size>
-         <width>65</width>
-         <height>16777215</height>
-        </size>
+     <item row="1" column="4" >
+      <layout class="QGridLayout" >
+       <property name="margin" >
+        <number>0</number>
        </property>
-       <property name="text" >
-        <string>Refresh</string>
+       <property name="spacing" >
+        <number>6</number>
        </property>
-      </widget>
+       <item row="0" column="0" >
+        <widget class="QPushButton" name="refreshButton" >
+         <property name="maximumSize" >
+          <size>
+           <width>65</width>
+           <height>16777215</height>
+          </size>
+         </property>
+         <property name="text" >
+          <string>Refresh</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1" >
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Ignored</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>16</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="0" >
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Ignored</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>16</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
      </item>
     </layout>
    </item>
+   <item row="0" column="0" >
+    <widget class="QTableWidget" name="mp_tableWidget" />
+   </item>
   </layout>
   <action name="actionRefreshJobList" >
    <property name="icon" >
-    <iconset>../images/run.png</iconset>
+    <iconset>:images/run.png</iconset>
    </property>
    <property name="text" >
     <string>Refresh Job List</string>
   </action>
   <action name="actionListJobid" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>ListJobid</string>
   </action>
   <action name="actionListFilesOnJob" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>List Files On Job</string>
   </action>
   <action name="actionListJobMedia" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>ListJobMedia</string>
   </action>
   <action name="actionListVolumes" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>ListVolumes</string>
   </action>
   <action name="actionLongListJob" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>LongListJob</string>
   </action>
   <action name="actionDeleteJob" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>DeleteJob</string>
   </action>
   <action name="actionPurgeFiles" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>PurgeFiles</string>
   </action>
   <action name="actionRestoreFromJob" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>Restore From Job</string>
   </action>
   <action name="actionRestoreFromTime" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>Restore From Time</string>
   </action>
   <action name="actionShowLogForJob" >
    <property name="icon" >
-    <iconset>../images/unmark.png</iconset>
+    <iconset>:images/unmark.png</iconset>
    </property>
    <property name="text" >
     <string>Show Log for Job</string>