From: Dirk H Bartley Date: Sun, 27 May 2007 19:23:35 +0000 (+0000) Subject: Add context sensitive from page selector's console widget for: status dir, X-Git-Tag: Release-7.0.0~6225 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3fb21dd05948a66797056c684934cf1aa58aea23;p=bacula%2Fbacula Add context sensitive from page selector's console widget for: status dir, messages and help. Add purge jobs client= from clients Add buttons to set automount on or off in the label dialog. Add estimate dialog. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4920 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/COMMANDS b/bacula/src/qt-console/COMMANDS index 0d2c16065e..f2ffca09db 100644 --- a/bacula/src/qt-console/COMMANDS +++ b/bacula/src/qt-console/COMMANDS @@ -1,41 +1,26 @@ -autodisplay on/off -could be done in the context of the console - -automount on/off -could be done in the context of the console, because is for after a label -command as opposed to a property of a storage device - cancel [jobid= job= ujobid=] To be done in the context of a status dir graphical window. +Also in a "job resources window for job-name". delete pool= + should ask if this would have bad effects if say media existed in the pool + the pool existed in the configuration file. disable job and enable job -Could be done in the context of a jobs window which is not yet created +Could be done in the context of a jobs resource window which is not yet created estimate Could be a dialog in the context of a jobs window. -help -could be in the console window - list many are done or are reproduced by having windows llist same as list -python -not needed from bat?? - prune files|jobs|volume client= volume= Should add as a dialog box from both client and medialist -purge files jobid=|job=|client= -purge jobs client= (of all jobs) -purge volume|volume= (of all jobs) - this one is done from media - release storage= Would need to explain what this does in bat with a dialog @@ -86,14 +71,32 @@ These are done from config files create [pool=] Done in a config file +CHOOSE NOT TO (for now at least) +=========================== +autodisplay on/off +could be done in the context of the console + This may interfere with our connection issues + Also, there is a configurable qt timer to automatically ask for messages + +python +not needed from bat?? DONE =========================== +automount on/off +Added buttons to the label dialog box to execute automount command + +delete [volume= job jobid=] + +help +could be in the console window label Done by kern before I started -delete [volume= job jobid=] +purge files jobid=|job=|client= +purge volume|volume= (of all jobs) +purge jobs client= (of all jobs) relabel done diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index 7b0edb3e1d..587cb9d6ae 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -35,7 +35,7 @@ FORMS += relabel/relabel.ui FORMS += mount/mount.ui FORMS += console/console.ui FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui -FORMS += run/run.ui run/runcmd.ui +FORMS += run/run.ui run/runcmd.ui run/estimate.ui FORMS += select/select.ui FORMS += medialist/medialist.ui mediaedit/mediaedit.ui joblist/joblist.ui FORMS += clients/clients.ui storage/storage.ui fileset/fileset.ui @@ -67,7 +67,7 @@ SOURCES += mount/mount.cpp # Run dialog HEADERS += run/run.h -SOURCES += run/run.cpp run/runcmd.cpp +SOURCES += run/run.cpp run/runcmd.cpp run/estimate.cpp # Select dialog HEADERS += select/select.h diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 362400e894..3e7b588911 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -158,6 +158,7 @@ void Clients::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetIte if (treedepth == 1){ mp_treeWidget->removeAction(actionListJobsofClient); mp_treeWidget->removeAction(actionStatusClientInConsole); + mp_treeWidget->removeAction(actionPurgeJobs); } } @@ -168,6 +169,7 @@ void Clients::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetIte m_currentlyselected=currentwidgetitem->text(0); mp_treeWidget->addAction(actionListJobsofClient); mp_treeWidget->addAction(actionStatusClientInConsole); + mp_treeWidget->addAction(actionPurgeJobs); } } } @@ -191,6 +193,8 @@ void Clients::createContextMenu() SLOT(showJobs())); connect(actionStatusClientInConsole, SIGNAL(triggered()), this, SLOT(consoleStatusClient())); + connect(actionPurgeJobs, SIGNAL(triggered()), this, + SLOT(consolePurgeJobs())); } /* @@ -231,3 +235,28 @@ void Clients::currentStackItem() m_populated=true; } } + +/* + * Function responding to actionPurgeJobs + */ +void Clients::consolePurgeJobs() +{ + if (QMessageBox::warning(this, tr("Bat"), + tr("Are you sure you want to purge ?? !!!.\n" +"The Purge command will delete associated Catalog database records from Jobs and" +" Volumes without considering the retention period. Purge works only on the" +" Catalog database and does not affect data written to Volumes. This command can" +" be dangerous because you can delete catalog records associated with current" +" backups of files, and we recommend that you do not use it unless you know what" +" you are doing.\n\n" +" Is there any way I can get you to Click cancel here. You really don't want to do" +" this\n\n" + "Press OK to proceed with the purge operation?"), + QMessageBox::Ok | QMessageBox::Cancel) + == QMessageBox::Cancel) { return; } + + QString cmd("purge jobs client="); + cmd += m_currentlyselected; + consoleCommand(cmd); +} + diff --git a/bacula/src/qt-console/clients/clients.h b/bacula/src/qt-console/clients/clients.h index 5f00445491..ea07fb03d8 100644 --- a/bacula/src/qt-console/clients/clients.h +++ b/bacula/src/qt-console/clients/clients.h @@ -56,6 +56,7 @@ private slots: void populateTree(); void showJobs(); void consoleStatusClient(); + void consolePurgeJobs(); private: void createContextMenu(); diff --git a/bacula/src/qt-console/clients/clients.ui b/bacula/src/qt-console/clients/clients.ui index d8bb76a20f..8311bc3953 100644 --- a/bacula/src/qt-console/clients/clients.ui +++ b/bacula/src/qt-console/clients/clients.ui @@ -5,8 +5,8 @@ 0 0 - 763 - 650 + 413 + 258 @@ -25,7 +25,7 @@ - :images/run.png + ../../../../../../../:images/run.png Refresh Client List @@ -36,7 +36,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png List Jobs of Client @@ -44,12 +44,17 @@ - :images/status.png + ../../../../../../../:images/status.png Status Client In Console + + + Purge Jobs + + diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 5895c25f21..f9f96a7cf4 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -60,6 +60,12 @@ Console::Console(QStackedWidget *parent) mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png")); m_timer = NULL; + m_contextActions.append(actionStatusDir); + m_contextActions.append(actionConsoleHelp); + m_contextActions.append(actionRequestMessages); + connect(actionStatusDir, SIGNAL(triggered()), this, SLOT(status_dir())); + connect(actionConsoleHelp, SIGNAL(triggered()), this, SLOT(consoleHelp())); + connect(actionRequestMessages, SIGNAL(triggered()), this, SLOT(messages())); } Console::~Console() @@ -816,3 +822,10 @@ static int tls_pem_callback(char *buf, int size, const void *userdata) return 0; #endif } + +/* Slot for responding to page selectors status help command */ +void Console::consoleHelp() +{ + QString cmd("help"); + consoleCommand(cmd); +} diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 3744bc1ec3..295ebfeabb 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -123,6 +123,7 @@ public slots: void messages(void); void set_font(void); void poll_messages(void); + void consoleHelp(); public: DIRRES *m_dir; /* so various pages can reference it */ diff --git a/bacula/src/qt-console/console/console.ui b/bacula/src/qt-console/console/console.ui index ea346108b2..d4b9c4bc1a 100644 --- a/bacula/src/qt-console/console/console.ui +++ b/bacula/src/qt-console/console/console.ui @@ -77,6 +77,24 @@ + + + ../images/status.png + + + StatusDir + + + + + ConsoleHelp + + + + + Request Messages + + diff --git a/bacula/src/qt-console/label/label.cpp b/bacula/src/qt-console/label/label.cpp index b4c0ad8365..3f4384c7e7 100644 --- a/bacula/src/qt-console/label/label.cpp +++ b/bacula/src/qt-console/label/label.cpp @@ -72,6 +72,8 @@ void labelPage::showPage(QString &defString) poolCombo->addItems(m_console->pool_list); connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed())); connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed())); + connect(automountOnButton, SIGNAL(pressed()), this, SLOT(automountOnButtonPushed())); + connect(automountOffButton, SIGNAL(pressed()), this, SLOT(automountOffButtonPushed())); dockPage(); setCurrent(); this->show(); @@ -109,3 +111,17 @@ void labelPage::cancelButtonPushed() closeStackPage(); mainWin->resetFocus(); } + +/* turn automount on */ +void labelPage::automountOnButtonPushed() +{ + QString cmd("automount on"); + consoleCommand(cmd); +} + +/* turn automount off */ +void labelPage::automountOffButtonPushed() +{ + QString cmd("automount off"); + consoleCommand(cmd); +} diff --git a/bacula/src/qt-console/label/label.h b/bacula/src/qt-console/label/label.h index ac97c8f7fd..2828fd5ec0 100644 --- a/bacula/src/qt-console/label/label.h +++ b/bacula/src/qt-console/label/label.h @@ -49,6 +49,8 @@ public: private slots: void okButtonPushed(); void cancelButtonPushed(); + void automountOnButtonPushed(); + void automountOffButtonPushed(); private: }; diff --git a/bacula/src/qt-console/label/label.ui b/bacula/src/qt-console/label/label.ui index ed81225c89..c0fe5741ce 100644 --- a/bacula/src/qt-console/label/label.ui +++ b/bacula/src/qt-console/label/label.ui @@ -5,8 +5,8 @@ 0 0 - 498 - 308 + 560 + 357 @@ -29,21 +29,24 @@ - 351 - 20 + 421 + 48 - + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Expanding - 40 - 131 + 431 + 48 @@ -56,13 +59,6 @@ 6 - - - - 10000 - - - @@ -100,6 +96,113 @@ + + + + Volume Name: + + + volumeName + + + + + + + + + + Storage: + + + storageCombo + + + + + + + + 200 + 0 + + + + + + + + 10000 + + + + + + + Slot: + + + slotSpin + + + + + + + 0 + + + 6 + + + + + Execute Automount + + + + + + + On + + + + + + + Off + + + + + + + Qt::Vertical + + + + 20 + 61 + + + + + + + + + + + + + Pool: + + + poolCombo + + + @@ -152,65 +255,9 @@ p, li { white-space: pre-wrap; } - - - - - - - Storage: - - - storageCombo - - - - - - - Slot: - - - slotSpin - - - - - - - - 200 - 0 - - - - - - - - - - - Pool: - - - poolCombo - - - - - - - Volume Name: - - - volumeName - - - - + Qt::Horizontal @@ -218,23 +265,20 @@ p, li { white-space: pre-wrap; } 40 - 121 + 131 - + - Qt::Vertical - - - QSizePolicy::Expanding + Qt::Horizontal - 331 - 20 + 40 + 121 diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index 813686036b..9bc9687b5c 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -140,6 +140,7 @@ + @@ -430,6 +431,26 @@ Run a Job + + + false + + + :images/run.png + + + Estimate Job + + + Estimate Job + + + Estimate Job + + + Estimate a Job + + :images/status.png diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index a56c8c68c1..4ba65496d0 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -282,6 +282,7 @@ void MainWin::createConnections() connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows())); connect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked())); connect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked())); + connect(actionEstimate, SIGNAL(triggered()), this, SLOT(estimateButtonClicked())); connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked())); connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton())); connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow())); @@ -459,6 +460,11 @@ void MainWin::runButtonClicked() new runPage(); } +void MainWin::estimateButtonClicked() +{ + new estimatePage(); +} + void MainWin::restoreButtonClicked() { new prerestorePage(); diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index f724536b98..a134210c5f 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -90,6 +90,7 @@ public slots: void treeItemClicked(QTreeWidgetItem *item, int column); void labelButtonClicked(); void runButtonClicked(); + void estimateButtonClicked(); void restoreButtonClicked(); void undockWindowButton(); void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/run/estimate.cpp b/bacula/src/qt-console/run/estimate.cpp new file mode 100644 index 0000000000..d3295d741b --- /dev/null +++ b/bacula/src/qt-console/run/estimate.cpp @@ -0,0 +1,116 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +/* + * Run Dialog class + * + * Kern Sibbald, February MMVII + * + * $Id: estimate.cpp 4856 2007-05-20 15:28:43Z bartleyd2 $ + */ + +#include "bat.h" +#include "run.h" + +/* + * Setup all the combo boxes and display the dialog + */ +estimatePage::estimatePage() +{ + QDateTime dt; + + m_name = "Estimate"; + pgInitialize(); + setupUi(this); + m_console->notify(false); + + m_console->beginNewCommand(); + jobCombo->addItems(m_console->job_list); + filesetCombo->addItems(m_console->fileset_list); + levelCombo->addItems(m_console->level_list); + clientCombo->addItems(m_console->client_list); + job_name_change(0); + connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int))); + connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed())); + connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed())); + + dockPage(); + setCurrent(); + this->show(); +} + +void estimatePage::okButtonPushed() +{ + this->hide(); + QString cmd; + QTextStream(&cmd) << "estimate" << + " job=\"" << jobCombo->currentText() << "\"" << + " fileset=\"" << filesetCombo->currentText() << "\"" << + " level=\"" << levelCombo->currentText() << "\"" << + " client=\"" << clientCombo->currentText() << "\""; + if (listingCheckBox->checkState() == Qt::Checked) { + cmd += " listing"; + } + + if (mainWin->m_commandDebug) { + Pmsg1(000, "command : %s\n", cmd.toUtf8().data()); + } + + consoleCommand(cmd); + m_console->notify(true); + closeStackPage(); + mainWin->resetFocus(); +} + + +void estimatePage::cancelButtonPushed() +{ + mainWin->set_status(" Canceled"); + this->hide(); + m_console->notify(true); + closeStackPage(); + mainWin->resetFocus(); +} + +/* + * Called here when the jobname combo box is changed. + * We load the default values for the new job in the + * other combo boxes. + */ +void estimatePage::job_name_change(int index) +{ + job_defaults job_defs; + + (void)index; + job_defs.job_name = jobCombo->currentText(); + if (m_console->get_job_defaults(job_defs)) { + filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly)); + levelCombo->setCurrentIndex(levelCombo->findText(job_defs.level, Qt::MatchExactly)); + clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly)); + } +} diff --git a/bacula/src/qt-console/run/estimate.ui b/bacula/src/qt-console/run/estimate.ui new file mode 100644 index 0000000000..bc5e63823d --- /dev/null +++ b/bacula/src/qt-console/run/estimate.ui @@ -0,0 +1,281 @@ + + estimateForm + + + + 0 + 0 + 562 + 308 + + + + Form + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + + + 0 + + + 6 + + + + + Qt::RightToLeft + + + List Files + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + 6 + + + + + + + + Level: + + + levelCombo + + + + + + + + + + + + + Client: + + + clientCombo + + + + + + + + + + + 65 + 16777215 + + + + Job: + + + jobCombo + + + + + + + FileSet: + + + filesetCombo + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 71 + 21 + + + + + + + + + 16777215 + 30 + + + + <h3>Estimate a backup Job</h3> + + + + + + + Qt::Horizontal + + + + 81 + 20 + + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 351 + 16 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 351 + 16 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + diff --git a/bacula/src/qt-console/run/run.h b/bacula/src/qt-console/run/run.h index 9a8796aba8..f077d4e4f6 100644 --- a/bacula/src/qt-console/run/run.h +++ b/bacula/src/qt-console/run/run.h @@ -5,6 +5,7 @@ #include #include "ui_run.h" #include "ui_runcmd.h" +#include "ui_estimate.h" #include "console.h" class runPage : public Pages, public Ui::runForm @@ -37,5 +38,19 @@ private: void fill(); }; +class estimatePage : public Pages, public Ui::estimateForm +{ + Q_OBJECT + +public: + estimatePage(); + +public slots: + void okButtonPushed(); + void cancelButtonPushed(); + void job_name_change(int index); + +private: +}; #endif /* _RUN_H_ */