/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2010 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.
*
* Kern Sibbald, December MMI
*
- * Version $Id$
*/
#include "bacula.h"
char ec1[30];
char dt[MAX_TIME_LENGTH];
case JT_ADMIN:
- if (ua->api) ua->signal(BNET_RUN_CMD);
- ua->send_msg(_("Run %s job\n"
+ if (ua->api) {
+ ua->signal(BNET_RUN_CMD);
+ ua->send_msg("Type: Admin\n"
+ "Title: Run Admin Job\n"
+ "JobName: %s\n"
+ "FileSet: %s\n"
+ "Client: %s\n"
+ "Storage: %s\n"
+ "When: %s\n"
+ "Priority: %d\n",
+ job->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->client->name()),
+ jcr->wstore?jcr->wstore->name():"*None*",
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority);
+ } else {
+ ua->send_msg(_("Run %s job\n"
"JobName: %s\n"
"FileSet: %s\n"
"Client: %s\n"
jcr->wstore?jcr->wstore->name():"*None*",
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->JobPriority);
+ }
jcr->set_JobLevel(L_FULL);
break;
case JT_BACKUP:
case JT_VERIFY:
if (jcr->getJobType() == JT_BACKUP) {
- if (ua->api) ua->signal(BNET_RUN_CMD);
- ua->send_msg(_("Run %s job\n"
+ if (ua->api) {
+ ua->signal(BNET_RUN_CMD);
+ ua->send_msg("Type: Backup\n"
+ "Title: Run Backup Job\n"
+ "JobName: %s\n"
+ "Level: %s\n"
+ "Client: %s\n"
+ "FileSet: %s\n"
+ "Pool: %s\n"
+ "Storage: %s\n"
+ "When: %s\n"
+ "Priority: %d\n"
+ "%s%s%s",
+ job->name(),
+ level_to_str(jcr->getJobLevel()),
+ jcr->client->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->pool->name()),
+ jcr->wstore?jcr->wstore->name():"*None*",
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority,
+ jcr->plugin_options?"Plugin Options: ":"",
+ jcr->plugin_options?jcr->plugin_options:"",
+ jcr->plugin_options?"\n":"");
+ } else {
+ ua->send_msg(_("Run %s job\n"
"JobName: %s\n"
"Level: %s\n"
"Client: %s\n"
"When: %s\n"
"Priority: %d\n"
"%s%s%s"),
- _("Backup"),
job->name(),
level_to_str(jcr->getJobLevel()),
jcr->client->name(),
jcr->plugin_options?"Plugin Options: ":"",
jcr->plugin_options?jcr->plugin_options:"",
jcr->plugin_options?"\n":"");
+ }
} else { /* JT_VERIFY */
const char *Name;
if (jcr->verify_job) {
if (!verify_list) {
verify_list = "";
}
- if (ua->api) ua->signal(BNET_RUN_CMD);
- ua->send_msg(_("Run %s job\n"
+ if (ua->api) {
+ ua->signal(BNET_RUN_CMD);
+ ua->send_msg("Type: Verify\n"
+ "Title: Run Verify Job\n"
+ "JobName: %s\n"
+ "Level: %s\n"
+ "Client: %s\n"
+ "FileSet: %s\n"
+ "Pool: %s (From %s)\n"
+ "Storage: %s (From %s)\n"
+ "Verify Job: %s\n"
+ "Verify List: %s\n"
+ "When: %s\n"
+ "Priority: %d\n",
+ job->name(),
+ level_to_str(jcr->getJobLevel()),
+ jcr->client->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->pool->name()), jcr->pool_source,
+ jcr->rstore->name(), jcr->rstore_source,
+ Name,
+ verify_list,
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority);
+ } else {
+ ua->send_msg(_("Run %s job\n"
"JobName: %s\n"
"Level: %s\n"
"Client: %s\n"
verify_list,
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->JobPriority);
+ }
}
break;
case JT_RESTORE:
jcr->set_JobLevel(L_FULL); /* default level */
Dmsg1(800, "JobId to restore=%d\n", jcr->RestoreJobId);
if (jcr->RestoreJobId == 0) {
- if (ua->api) ua->signal(BNET_RUN_CMD);
/* RegexWhere is take before RestoreWhere */
if (jcr->RegexWhere || (job->RegexWhere && !jcr->where)) {
- ua->send_msg(_("Run Restore job\n"
+ if (ua->api) {
+ ua->signal(BNET_RUN_CMD);
+ ua->send_msg("Type: Restore\n"
+ "Title: Run Restore Job\n"
+ "JobName: %s\n"
+ "Bootstrap: %s\n"
+ "RegexWhere: %s\n"
+ "Replace: %s\n"
+ "FileSet: %s\n"
+ "Backup Client: %s\n"
+ "Restore Client: %s\n"
+ "Storage: %s\n"
+ "When: %s\n"
+ "Catalog: %s\n"
+ "Priority: %d\n"
+ "Plugin Options: %s\n",
+ job->name(),
+ NPRT(jcr->RestoreBootstrap),
+ jcr->RegexWhere?jcr->RegexWhere:job->RegexWhere,
+ replace,
+ jcr->fileset->name(),
+ client_name,
+ jcr->client->name(),
+ jcr->rstore->name(),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->catalog->name(),
+ jcr->JobPriority,
+ NPRT(jcr->plugin_options));
+ } else {
+ ua->send_msg(_("Run Restore job\n"
"JobName: %s\n"
"Bootstrap: %s\n"
"RegexWhere: %s\n"
jcr->catalog->name(),
jcr->JobPriority,
NPRT(jcr->plugin_options));
-
+ }
} else {
- ua->send_msg(_("Run Restore job\n"
+ if (ua->api) {
+ ua->signal(BNET_RUN_CMD);
+ ua->send_msg("Type: Restore\n"
+ "Title: Run Restore job\n"
+ "JobName: %s\n"
+ "Bootstrap: %s\n"
+ "Where: %s\n"
+ "Replace: %s\n"
+ "FileSet: %s\n"
+ "Backup Client: %s\n"
+ "Restore Client: %s\n"
+ "Storage: %s\n"
+ "When: %s\n"
+ "Catalog: %s\n"
+ "Priority: %d\n"
+ "Plugin Options: %s\n",
+ job->name(),
+ NPRT(jcr->RestoreBootstrap),
+ jcr->where?jcr->where:NPRT(job->RestoreWhere),
+ replace,
+ jcr->fileset->name(),
+ client_name,
+ jcr->client->name(),
+ jcr->rstore->name(),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->catalog->name(),
+ jcr->JobPriority,
+ NPRT(jcr->plugin_options));
+ } else {
+ ua->send_msg(_("Run Restore job\n"
"JobName: %s\n"
"Bootstrap: %s\n"
"Where: %s\n"
jcr->catalog->name(),
jcr->JobPriority,
NPRT(jcr->plugin_options));
+ }
}
} else {
+ /* ***FIXME*** This needs to be fixed for bat */
if (ua->api) ua->signal(BNET_RUN_CMD);
ua->send_msg(_("Run Restore job\n"
"JobName: %s\n"
break;
case JT_COPY:
case JT_MIGRATE:
- const char *prt_type;
- if (jcr->getJobType() == JT_COPY) {
- prt_type = _("Run Copy job\n");
- } else {
- prt_type = _("Run Migration job\n");
- }
+ char *prt_type;
jcr->set_JobLevel(L_FULL); /* default level */
- if (ua->api) ua->signal(BNET_RUN_CMD);
- ua->send_msg("%s"
+ if (ua->api) {
+ ua->signal(BNET_RUN_CMD);
+ if (jcr->getJobType() == JT_COPY) {
+ prt_type = (char *)"Type: Copy\nTitle: Run Copy Job\n";
+ } else {
+ prt_type = (char *)"Type: Migration\nTitle: Run Migration Job\n";
+ }
+ ua->send_msg("%s"
+ "JobName: %s\n"
+ "Bootstrap: %s\n"
+ "Client: %s\n"
+ "FileSet: %s\n"
+ "Pool: %s\n"
+ "Read Storage: %s\n"
+ "Write Storage: %s\n"
+ "JobId: %s\n"
+ "When: %s\n"
+ "Catalog: %s\n"
+ "Priority: %d\n",
+ prt_type,
+ job->name(),
+ NPRT(jcr->RestoreBootstrap),
+ jcr->client->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->pool->name()),
+ jcr->rstore->name(),
+ jcr->wstore?jcr->wstore->name():"*None*",
+ jcr->MigrateJobId==0?"*None*":edit_uint64(jcr->MigrateJobId, ec1),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->catalog->name(),
+ jcr->JobPriority);
+ } else {
+ if (jcr->getJobType() == JT_COPY) {
+ prt_type = _("Run Copy job\n");
+ } else {
+ prt_type = _("Run Migration job\n");
+ }
+ ua->send_msg("%s"
"JobName: %s\n"
"Bootstrap: %s\n"
"Client: %s\n"
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->catalog->name(),
jcr->JobPriority);
+ }
break;
default:
ua->error_msg(_("Unknown Job Type=%d\n"), jcr->getJobType());
m_clientName = clientName;
m_jobName = jobName;
m_filesetName = filesetName;
- m_filesetName = filesetName;
pgInitialize("", parentTreeWidgetItem);
QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/emblem-system.png")));
m_startIndex = headerlist.indexOf(tr("Job Starttime"));
m_filesIndex = headerlist.indexOf(tr("Job Files"));
m_bytesIndex = headerlist.indexOf(tr("Job Bytes"));
+ m_levelIndex = headerlist.indexOf(tr("Job Level"));
+ m_nameIndex = headerlist.indexOf(tr("Job Name"));
+ m_filesetIndex = headerlist.indexOf(tr("File Set"));
+ m_clientIndex = headerlist.indexOf(tr("Client"));
/* Initialize the QTableWidget */
m_checkCurrentWidget = false;
connect(actionListFilesOnJob, SIGNAL(triggered()), this, SLOT(consoleListFilesOnJob()));
connect(actionListJobMedia, SIGNAL(triggered()), this, SLOT(consoleListJobMedia()));
connect(actionDeleteJob, SIGNAL(triggered()), this, SLOT(consoleDeleteJob()));
+ connect(actionRestartJob, SIGNAL(triggered()), this, SLOT(consoleRestartJob()));
connect(actionPurgeFiles, SIGNAL(triggered()), this, SLOT(consolePurgeFiles()));
connect(actionRestoreFromJob, SIGNAL(triggered()), this, SLOT(preRestoreFromJob()));
connect(actionRestoreFromTime, SIGNAL(triggered()), this, SLOT(preRestoreFromTime()));
if (mainWin->m_longList) { cmd.prepend("l"); }
consoleCommand(cmd);
}
+
void JobList::consoleDeleteJob()
{
if (QMessageBox::warning(this, "Bat",
consoleCommand(cmd, false);
populateTable();
}
+
+void JobList::consoleRestartJob()
+{
+ QString cmd;
+
+ cmd = tr("run job=\"%1\" client=\"%2\" level=%3").arg(m_jobName).arg(m_clientName).arg(m_levelName);
+ if (m_filesetName != "" && m_filesetName != "*None*") {
+ cmd += tr(" fileset=\"%1\"").arg(m_filesetName);
+ }
+
+ if (mainWin->m_commandDebug) Pmsg1(000, "Run cmd : %s\n",cmd.toUtf8().data());
+ consoleCommand(cmd, false);
+ populateTable();
+}
+
+
+
void JobList::consolePurgeFiles()
{
if (QMessageBox::warning(this, "Bat",
if (m_selectedJobsCount == 1) {
mp_tableWidget->addAction(actionListFilesOnJob);
mp_tableWidget->addAction(actionListJobMedia);
+ mp_tableWidget->addAction(actionRestartJob);
mp_tableWidget->addAction(actionRestoreFromJob);
mp_tableWidget->addAction(actionRestoreFromTime);
mp_tableWidget->addAction(actionShowLogForJob);
if (m_checkCurrentWidget) {
int row = mp_tableWidget->currentRow();
QTableWidgetItem* jobitem = mp_tableWidget->item(row, 0);
- m_currentJob = jobitem->text();
+ m_currentJob = jobitem->text(); /* get JobId */
+ jobitem = mp_tableWidget->item(row, m_clientIndex);
+ m_clientName = jobitem->text(); /* get Client Name */
+ jobitem = mp_tableWidget->item(row, m_nameIndex);
+ m_jobName = jobitem->text(); /* get Job Name */
+ jobitem = mp_tableWidget->item(row, m_levelIndex);
+ m_levelName = jobitem->text(); /* get level */
+ jobitem = mp_tableWidget->item(row, m_filesetIndex);
+ if (jobitem) {
+ m_filesetName = jobitem->text(); /* get FileSet Name */
+ } else {
+ m_filesetName = "";
+ }
/* include purged action or not */
jobitem = mp_tableWidget->item(row, m_purgedIndex);
if (purged == tr("No") ) {
mp_tableWidget->addAction(actionPurgeFiles);
}*/
+
/* include restore from time and job action or not */
jobitem = mp_tableWidget->item(row, m_typeIndex);
QString type = jobitem->text();
mp_tableWidget->addAction(actionRestoreFromTime);
}
}
+
/* include cancel action or not */
jobitem = mp_tableWidget->item(row, m_statusIndex);
QString status = jobitem->text();
void consoleListJobMedia();
void consoleListJobTotals();
void consoleDeleteJob();
+ void consoleRestartJob();
void consolePurgeFiles();
void preRestoreFromJob();
void preRestoreFromTime();
void prepareFilterWidgets();
void fillQueryString(QString &query);
QSplitter *m_splitter;
+
QString m_groupText;
QString m_splitText;
QString m_mediaName;
QString m_jobName;
QString m_filesetName;
QString m_currentJob;
+ QString m_levelName;
+
bool m_populated;
bool m_checkCurrentWidget;
int m_jobIdIndex;
int m_purgedIndex;
int m_typeIndex;
+ int m_levelIndex;
+ int m_clientIndex;
+ int m_nameIndex;
+ int m_filesetIndex;
int m_statusIndex;
int m_startIndex;
int m_bytesIndex;
<normaloff>:/images/utilities-terminal.png</normaloff>:/images/utilities-terminal.png</iconset>
</property>
<property name="text">
- <string>ListJobMedia</string>
+ <string>List Job Volumes</string>
</property>
</action>
<action name="actionListVolumes">
<normaloff>:/images/utilities-terminal.png</normaloff>:/images/utilities-terminal.png</iconset>
</property>
<property name="text">
- <string>ListVolumes</string>
+ <string>List Volumes</string>
</property>
</action>
<action name="actionDeleteJob">
<normaloff>:/images/weather-severe-alert.png</normaloff>:/images/weather-severe-alert.png</iconset>
</property>
<property name="text">
- <string>DeleteJob</string>
+ <string>Delete Job</string>
</property>
</action>
<action name="actionPurgeFiles">
<normaloff>:/images/weather-severe-alert.png</normaloff>:/images/weather-severe-alert.png</iconset>
</property>
<property name="text">
- <string>PurgeFiles</string>
+ <string>Purge Files</string>
+ </property>
+ </action>
+ <action name="actionRestartJob">
+ <property name="icon">
+ <iconset resource="../main.qrc">
+ <normaloff>:/images/weather-severe-alert.png</normaloff>:/images/weather-severe-alert.png</iconset>
+ </property>
+ <property name="text">
+ <string>Restart Job</string>
</property>
</action>
<action name="actionRestoreFromJob">
<normaloff>:/images/joblog.png</normaloff>:/images/joblog.png</iconset>
</property>
<property name="text">
- <string>Show Log for Job</string>
+ <string>Show Job Log</string>
</property>
</action>
<action name="actionShowInfoForJob">
<normaloff>:/images/joblog.png</normaloff>:/images/joblog.png</iconset>
</property>
<property name="text">
- <string>Show Info for Job</string>
+ <string>Show Job Info</string>
</property>
</action>
<action name="actionCancelJob">
<normaloff>:/images/utilities-terminal.png</normaloff>:/images/utilities-terminal.png</iconset>
</property>
<property name="text">
- <string>List Job Totals in Console</string>
+ <string>List Job Totals on Console</string>
</property>
</action>
</widget>
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2010 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.
/* First get the tree widget item and destroy it */
QTreeWidgetItem *item=mainWin->getFromHash(this);
/* remove the QTreeWidgetItem <-> page from the hash */
- mainWin->hashRemove(item, this);
- /* remove the item from the page selector by destroying it */
- delete item;
+ if (item) {
+ mainWin->hashRemove(item, this);
+ /* remove the item from the page selector by destroying it */
+ delete item;
+ }
/* remove this */
delete this;
}
{
consoleCommand(command, true);
}
+
void Pages::consoleCommand(QString &command, bool setCurrent)
{
int conn;
if (donotify) { m_console->notify(conn, true); }
}
}
+
void Pages::consoleCommand(QString &command, int conn)
{
consoleCommand(command, conn, true);
}
+
void Pages::consoleCommand(QString &command, int conn, bool setCurrent)
{
/* Bring this director's console to the front of the stack */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2010 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.
*
* Kern Sibbald, February MMVII
*
- * $Id$
*/
#include "bat.h"
connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
// find a way to place the new window at the cursor position
- // or in the midle of the page
+ // or in the middle of the page
// dockPage();
setCurrent();
}
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2010 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.
*
* Kern Sibbald, March MMVII
*
- * $Id$
*/
#include "bat.h"
m_console->read(m_conn);
item = m_console->msg(m_conn);
items = item.split("\n");
- label->setText(items[0]);
- Dmsg1(200, "Title=%s\n", items[0].toUtf8().data());
- items.removeFirst(); /* remove title */
foreach(item, items) {
rx.indexIn(item);
val = rx.cap(1);
- Dmsg1(200, "Item=%s\n", item.toUtf8().data());
- Dmsg1(200, "Value=%s\n", val.toUtf8().data());
+ Dmsg1(000, "Item=%s\n", item.toUtf8().data());
+ Dmsg1(000, "Value=%s\n", val.toUtf8().data());
+ if (item.startsWith("Title:")) {
+ run->setText(val);
+ }
if (item.startsWith("JobName:")) {
jobCombo->addItem(val);
continue;