From: Dirk H Bartley Date: Tue, 29 May 2007 21:09:07 +0000 (+0000) Subject: Add the remainder of the editible fields to mediaedit. Also add those X-Git-Tag: Release-7.0.0~6211 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6843f334c06b15e8a9846f76624e7847ca9867cc;p=bacula%2Fbacula Add the remainder of the editible fields to mediaedit. Also add those fields to medialist. Querying for recycle pool took another sql trick. I'll test with mysql on return from vacation. Trick is alias of table. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4934 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp index e1afbed814..2cb9b3d2f0 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.cpp +++ b/bacula/src/qt-console/mediaedit/mediaedit.cpp @@ -61,6 +61,7 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) connect(useDurationRadio, SIGNAL(pressed()), this, SLOT(useDurationRadioPressed())); m_pool = ""; + m_recyclePool = ""; m_status = ""; m_slot = 0; @@ -77,10 +78,14 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) /* Set up the query for the default values */ QStringList FieldList = (QStringList() << "Media.VolumeName" << "Pool.Name" << "Media.VolStatus" << "Media.Slot" - << "Media.VolRetention" << "Media.VolUseDuration"); + << "Media.VolRetention" << "Media.VolUseDuration" << "Media.MaxVolJobs" + << "Media.MaxVolFiles" << "Media.MaxVolBytes" << "Media.Recycle" << "Media.Enabled" + << "Pol.Name"); QStringList AsList = (QStringList() << "VolumeName" << "PoolName" << "Status" << "Slot" - << "Retention" << "UseDuration"); + << "Retention" << "UseDuration" << "MaxJobs" + << "MaxFiles" << "MaxBytes" << "Recycle" << "Enabled" + << "RecyclePool"); int i = 0; QString query("SELECT "); foreach (QString field, FieldList) { @@ -90,9 +95,11 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) query += field + " AS " + AsList[i]; i += 1; } - query += " FROM Media, Pool WHERE Media.PoolId=Pool.PoolId"; - query += " AND Media.MediaId='" + mediaId + "'"; - query += " ORDER BY Pool.Name"; + query += " FROM Media" + " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)" + " LEFT OUTER JOIN Pool AS pol ON (Media.recyclepoolid=Pol.PoolId)" + " WHERE Media.MediaId='" + mediaId + "'" + " ORDER BY Pool.Name"; if (mainWin->m_sqlDebug) { Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data()); @@ -122,11 +129,28 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) m_slot = field.toInt(&ok, 10); if (!ok){ m_slot = 0; } } else if (i == 4) { - m_retention = field.toLong(&ok, 10); + m_retention = field.toInt(&ok, 10); if (!ok){ m_retention = 0; } } else if (i == 5) { - m_useDuration = field.toLong(&ok, 10); + m_useDuration = field.toInt(&ok, 10); if (!ok){ m_useDuration = 0; } + } else if (i == 6) { + m_maxVolJobs = field.toInt(&ok, 10); + if (!ok){ m_maxVolJobs = 0; } + } else if (i == 7) { + m_maxVolFiles = field.toInt(&ok, 10); + if (!ok){ m_maxVolFiles = 0; } + } else if (i == 8) { + m_maxVolBytes = field.toInt(&ok, 10); + if (!ok){ m_maxVolBytes = 0; } + } else if (i == 9) { + if (field == "1") m_recycle = true; + else m_recycle = false; + } else if (i == 10) { + if (field == "1") m_enabled = true; + else m_enabled = false; + } else if (i == 11) { + m_recyclePool = field; } i++; } /* foreach field */ @@ -149,8 +173,25 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) slotSpin->setValue(m_slot); retentionSpin->setValue(m_retention); useDurationSpin->setValue(m_useDuration); - - this->show(); + setSpins(retentionSpin->value()); + retentionRadio->setChecked(true); + maxJobsSpin->setValue(m_maxVolJobs); + maxFilesSpin->setValue(m_maxVolFiles); + maxBytesSpin->setValue(m_maxVolBytes); + if (m_recycle) recycleCheck->setCheckState(Qt::Checked); + else recycleCheck->setCheckState(Qt::Unchecked); + if (m_enabled) enabledCheck->setCheckState(Qt::Checked); + else enabledCheck->setCheckState(Qt::Unchecked); + /* default for recycle pool */ + recyclePoolCombo->addItems(m_console->pool_list); + index = recyclePoolCombo->findText(m_recyclePool, Qt::MatchExactly); + if (index == -1) { + recyclePoolCombo->insertItem(0, ""); + index = recyclePoolCombo->findText(m_recyclePool, Qt::MatchExactly); + } + if (index != -1) { + recyclePoolCombo->setCurrentIndex(index); + } } else { QMessageBox::warning(this, "No Volume name", "No Volume name given", QMessageBox::Ok, QMessageBox::Ok); @@ -163,33 +204,62 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) */ void MediaEdit::okButtonPushed() { -//update volume=xxx slots MaxVolJobs=nnn MaxVolBytes=nnn Recycle=yes|no -// enabled=n recyclepool=zzz -// done pool=yyy volstatus=xxx slot=nnn VolUse=ddd VolRetention=ddd QString scmd; this->hide(); bool docmd = false; scmd = QString("update volume=\"%1\"") .arg(m_mediaName); if (m_pool != poolCombo->currentText()) { - scmd += " pool=\"" + poolCombo->currentText() + "\""; - docmd = true; + scmd += " pool=\"" + poolCombo->currentText() + "\""; + docmd = true; } if (m_status != statusCombo->currentText()) { - scmd += " volstatus=\"" + statusCombo->currentText() + "\""; - docmd = true; + scmd += " volstatus=\"" + statusCombo->currentText() + "\""; + docmd = true; } if (m_slot != slotSpin->value()) { - scmd += " slot=" + QString().setNum(slotSpin->value()); - docmd = true; + scmd += " slot=" + QString().setNum(slotSpin->value()); + docmd = true; } if (m_retention != retentionSpin->value()) { - scmd += " VolRetention=" + QString().setNum(retentionSpin->value()); - docmd = true; + scmd += " VolRetention=" + QString().setNum(retentionSpin->value()); + docmd = true; } if (m_useDuration != useDurationSpin->value()) { - scmd += " VolUse=" + QString().setNum(useDurationSpin->value()); - docmd = true; + scmd += " VolUse=" + QString().setNum(useDurationSpin->value()); + docmd = true; + } + if (m_maxVolJobs != maxJobsSpin->value()) { + scmd += " MaxVolJobs=" + QString().setNum(maxJobsSpin->value()); + docmd = true; + } + if (m_maxVolFiles != maxFilesSpin->value()) { + scmd += " MaxVolFiles=" + QString().setNum(maxFilesSpin->value()); + docmd = true; + } + if (m_maxVolBytes != maxBytesSpin->value()) { + scmd += " MaxVolBytes=" + QString().setNum(maxBytesSpin->value()); + docmd = true; + } + if ((m_recycle) && (recycleCheck->checkState() == Qt::Unchecked)) { + scmd += " Recycle=no"; + docmd = true; + } + if ((!m_recycle) && (recycleCheck->checkState() == Qt::Checked)) { + scmd += " Recycle=yes"; + docmd = true; + } + if ((m_enabled) && (enabledCheck->checkState() == Qt::Unchecked)) { + scmd += " enabled=no"; + docmd = true; + } + if ((!m_enabled) && (enabledCheck->checkState() == Qt::Checked)) { + scmd += " enabled=yes"; + docmd = true; + } + if (m_recyclePool != recyclePoolCombo->currentText()) { + scmd += " recyclepool=\"" + recyclePoolCombo->currentText() + "\""; + docmd = true; } if (docmd) { if (mainWin->m_commandDebug) { diff --git a/bacula/src/qt-console/mediaedit/mediaedit.h b/bacula/src/qt-console/mediaedit/mediaedit.h index 74fc207f2a..63ae800e3e 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.h +++ b/bacula/src/qt-console/mediaedit/mediaedit.h @@ -64,6 +64,12 @@ private: int m_slot; int m_retention; int m_useDuration; + int m_maxVolJobs; + int m_maxVolFiles; + int m_maxVolBytes; + bool m_recycle; + bool m_enabled; + QString m_recyclePool; }; #endif /* _MEDIAEDIT_H_ */ diff --git a/bacula/src/qt-console/mediaedit/mediaedit.ui b/bacula/src/qt-console/mediaedit/mediaedit.ui index ae8973f936..269ae9ee28 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.ui +++ b/bacula/src/qt-console/mediaedit/mediaedit.ui @@ -5,8 +5,8 @@ 0 0 - 515 - 334 + 468 + 451 @@ -19,6 +19,32 @@ 6 + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -27,346 +53,489 @@ 6 - - - - Minutes + + + + 2147483647 - - - - 24 + + + + 0 - - -1 + + 6 - - 0 + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 16777215 + 48 + + + + Volume : + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 10000 - - - - 365 + + + + + + + Max Volume Files: - - -1 + + slotSpin - - + + 0 6 - - + + + + Qt::Horizontal + + + + 40 + 20 + + + - - - - 0 + + + + OK - - 6 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 16777215 - 48 - - - - Volume : - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - - - - 0 + + + + Cancel + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 71 + 21 + + + + + + + + + 16777215 + 30 + - - 6 - - - - - Qt::Horizontal - - - - 71 - 21 - - - - - - - - - 16777215 - 30 - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Edit a Volume</span></p></body></html> - - - - - - - Qt::Horizontal - - - - 81 - 20 - - - - - + + - - - - Slot: + + + + Qt::Horizontal + + + + 81 + 20 + - - slotSpin + + + + + + + + Volume Status: + + + + + + + 0 + + + 6 + + + + + Qt::RightToLeft + + + Enabled + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + 6 + - + - Use Duration: + Minutes + + + + + + + 24 - - slotSpin + + -1 + + + 0 - - + + - Retension: + Seconds - - slotSpin + + + + + + Retention - - - - 2147483647 + + + + Days + + + + Use Duration + + + + + + + Qt::Vertical + + + + 97 + 81 + + + + - + - Volume Status: + Years - + - 10000 + 365 + + + -1 - - - - 0 + + + + 60 + + + -1 - - 6 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - Cancel - - - - + - - - - Pool: + + + + 999 - - poolCombo + + -1 - - + + + + Hours + + - + - 2147483647 + 60 + + + -1 + + + + Qt::Vertical + + + + 97 + 71 + + + + - - - - Qt::Vertical - - - - 97 - 16 - - - + + + + 2147483647 + + - - - - Years + + + + 0 + + + 6 + + + + + Qt::RightToLeft + + + Recycle + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 2147483647 - - - - Hours + + + + 2147483647 - - + + - Use Duration + Use Duration: + + + slotSpin - - - - 999 + + + + Pool: - - -1 + + poolCombo - - + + + + + - Days + Max Volume Bytes: + + + slotSpin - - + + - Seconds + Retension: + + + slotSpin - - + + + + + - Retention + Slot: + + + slotSpin - - + + - 60 + 2147483647 + + + + + + + Recycle Pool: - - -1 + + slotSpin - - - - 60 + + + + Max Volume Jobs: - - -1 + + slotSpin - + Qt::Vertical @@ -379,7 +548,7 @@ p, li { white-space: pre-wrap; } - + Qt::Vertical @@ -392,32 +561,6 @@ p, li { white-space: pre-wrap; } - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 41bb944707..027d6cb023 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -77,9 +77,10 @@ void MediaList::populateTree() return; QStringList headerlist = (QStringList() - << "Volume Name" << "Id" << "Status" << "Enabled" - << "Bytes" << "Files" << "Jobs" << "Retention" - << "Media Type" << "Slot" << "Last Written"); + << "Volume Name" << "Id" << "Status" << "Enabled" << "Bytes" << "Files" + << "Jobs" << "Retention" << "Media Type" << "Slot" << "Use Duration" + << "Max Jobs" << "Max Files" << "Max Bytes" << "Recycle" << "Enabled" + << "RecyclePool" << "Last Written"); int statusIndex = headerlist.indexOf("Status"); m_checkcurwidget = false; @@ -106,10 +107,16 @@ void MediaList::populateTree() " Media.Enabled AS Enabled, Media.VolBytes AS Bytes," " Media.VolFiles AS FileCount, Media.VolJobs AS JobCount," " Media.VolRetention AS VolumeRetention, Media.MediaType AS MediaType," - " Media.Slot AS Slot, Media.LastWritten AS LastWritten" - " FROM Media, Pool" - " WHERE Media.PoolId=Pool.PoolId"; - query += " AND Pool.Name='" + pool_listItem + "'"; + " Media.Slot AS Slot, Media.VolUseDuration AS UseDuration," + " Media.MaxVolJobs AS MaxJobs, Media.MaxVolFiles AS MaxFiles," + " Media.MaxVolBytes AS MaxBytes, Media.Recycle AS Recycle," + " Media.Enabled AS enabled, Pol.Name AS RecyclePool," + " Media.LastWritten AS LastWritten" + " FROM Media" + " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)" + " LEFT OUTER JOIN Pool AS pol ON (Media.recyclepoolid=Pol.PoolId)" + " WHERE"; + query += " Pool.Name='" + pool_listItem + "'"; query += " ORDER BY Media"; if (mainWin->m_sqlDebug) {