]> git.sur5r.net Git - bacula/bacula/commitdiff
- general : status text is more often used
authorNicolas Boichat <nicolas@boichat.ch>
Sun, 25 Apr 2004 18:31:37 +0000 (18:31 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Sun, 25 Apr 2004 18:31:37 +0000 (18:31 +0000)
 - wxbRestorePanel : restore aborted if there's no client or no fileset
 - wxbRestorePanel : corrected problem if one double clicks on a directory X in the left "tree" window when the directory is not yet open, instead of selecting the directory and everything below, it opens the directory and nothing is selected.
 - wxbRestorePanel : first client is selected when restore mode starts.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1305 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/wx-console/CHANGELOG
bacula/src/wx-console/TODO
bacula/src/wx-console/main.cpp
bacula/src/wx-console/wxbmainframe.cpp
bacula/src/wx-console/wxbrestorepanel.cpp
bacula/src/wx-console/wxbrestorepanel.h

index 6bc40253031948606140ced21db9a3b59792f450..dc3c35c7eff8bf34baf95aecfaa80d90d4dc20a6 100644 (file)
@@ -1,4 +1,12 @@
 25-04-2003 :
+ - general : status text is more often used
+ - wxbRestorePanel : restore aborted if there's no client or no fileset
+ - wxbRestorePanel : corrected problem if one double clicks on a
+     directory X in the left "tree" window when the directory is 
+     not yet open, instead of selecting the directory and everything 
+     below, it opens the directory and nothing is selected.
+ - wxbRestorePanel : first client is selected when restore
+     mode starts.
  - wxbRestorePanel : when the director is building tree, 
      changes are made to the status in the gauge.
  - wxbRestorePanel : Cursor set to hourglass when working
index 878344c7da07beaeb9b9546dab6ba2ed66e0fe10..d56fd381594dbffde0774190924bfe2a26b9be20 100644 (file)
@@ -5,32 +5,30 @@ GTK : Fix 100% CPU usage when waiting for results
 
 wxbMainFrame : Add some text in front of the command window such as 
    "Command: " so that the user knows he can type into the 
-   command window (or command line)
+   command line
    
-wxbRestorePanel : Select the first client when clicked on start button.
-
 wxbRestorePanel : Reconsider start button's labels.
 
 general : Show nice messages when errors occurs.
 
-wxbMainFrame : use more often status text
+wxbMainFrame : set focus to type control when clicking on console
 
 wxbRestorePanel : Add a Cancel Restore button
    (may need to implement BNET_BREAK to break current command)
 
-wxbRestorePanel : However, if one double clicks on a directory X in the left 
-     "tree" window when the directory is not yet open, instead of 
-     selecting the directory and everything below, it opens the 
-     directory and nothing is selected.
-     
-wxbRestorePanel : abort restore if there's no client.
-
 general : Allow the user to quit however the state is (kill thread if necessary)
 
 VC++ : crashing when there's no configuration file, or server is unreachable
+       (on every error ?)
 
 [postponed to July:]
 
+wxbMainFrame : use more often status text
+
+wxbRestorePanel : Ask Kern for a dot command which gives restore
+  dates for a client (with an interval, last 20 for example, or last
+  40 excluding last 20).
+
 wxbRestorePanel : Add buttons to mark/unmark directories/files.
 
 wxbRestorePanel : Add a button to force to refresh the whole tree
@@ -55,6 +53,9 @@ wxbRestorePanel : Use ".default job=RestoreFiles" to get defaults parameters
 
 console_thread : Allow the user to choose his config file.
 
+console_thread : Allow the user to choose his director when there's multiple
+    directors.
+
 wxbDataParser : Add a boolean in the constructor to avoid storing data is 
     will not be used.
 
index 56aac33f6d49023e0755a223b34b1e6ce2338b90..af6d299a0658ec7d77502980eada15e9f4f7d0a9 100644 (file)
@@ -75,9 +75,9 @@ bool MyApp::OnInit()
 
    frame->Show(TRUE);
 
-   frame->StartConsoleThread();
+   frame->Print(wxString("Welcome to bacula wx-console ") << VERSION << " (" << BDATE << ")!\n", CS_DEBUG);
 
-   csprint("Bacula wx-console started !\n");
+   frame->StartConsoleThread();
    
    return TRUE;
 }
index d3f25bd8e9e473a10db3e7476824db408d95d489..d557cc709f3a40edb4c03beaebf39305bc23822e 100644 (file)
@@ -200,9 +200,8 @@ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSi
 #endif // wxUSE_MENUS
 
 #if wxUSE_STATUSBAR
-   // create a status bar just for fun (by default with 1 pane only)
-   CreateStatusBar(2);
-   SetStatusText(_T("Welcome to Bacula wx-console!"));
+   CreateStatusBar(1);
+   SetStatusText(wxString("Welcome to bacula wx-console ") << VERSION << " (" << BDATE << ")!\n");
 #endif // wxUSE_STATUSBAR
 
    wxPanel* global = new wxPanel(this, -1);
@@ -271,6 +270,7 @@ void wxbMainFrame::StartConsoleThread()
    ct = new console_thread();
    ct->Create();
    ct->Run();
+   SetStatusText("Connecting to the director...");
 }
 
 /* Register a new wxbDataParser */
@@ -326,10 +326,12 @@ void wxbMainFrame::OnPrint(wxbThreadEvent& event) {
 void wxbMainFrame::Print(wxString str, int status)
 {
    if (status == CS_CONNECTED) {
+      SetStatusText("Connected to the director.");
       EnablePanels();
       return;
    }
    if (status == CS_DISCONNECTED) {
+      SetStatusText("Disconnected of the director.");
       DisablePanels();
       return;
    }
index a16455a80a2f7334e848db5c70175de638af1290..39ae756b66bfbde5bea93f2ff4d1728866c47016 100644 (file)
@@ -365,6 +365,8 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) {
 
    working = false;
    SetCursor(*wxSTANDARD_CURSOR);
+
+   markWhenListingDone = false;
 }
 
 /*
@@ -401,11 +403,18 @@ void wxbRestorePanel::EnablePanel(bool enable) {
 void wxbRestorePanel::CmdStart() {
    unsigned int i;
    if (status == activable) {
+      wxbMainFrame::GetInstance()->SetStatusText("Getting clients and filesets list.");
       wxbDataTokenizer* dt = WaitForEnd(".clients\n", true, false);
       wxString str;
 
       clientChoice->Clear();
       cfgClient->Clear();
+      
+      if (dt->GetCount() == 0) {
+         wxbMainFrame::GetInstance()->SetStatusText("Error : no clients returned by the director.");
+         return;
+      }
+      
       for (i = 0; i < dt->GetCount(); i++) {
          str = (*dt)[i];
          str.RemoveLast();
@@ -418,6 +427,12 @@ void wxbRestorePanel::CmdStart() {
       dt = WaitForEnd(".filesets\n", true, false);
 
       cfgFileset->Clear();
+      
+      if (dt->GetCount() == 0) {
+         wxbMainFrame::GetInstance()->SetStatusText("Error : no filesets returned by the director.");
+         return;
+      }
+      
       for (i = 0; i < dt->GetCount(); i++) {
          str = (*dt)[i];
          str.RemoveLast();
@@ -427,12 +442,27 @@ void wxbRestorePanel::CmdStart() {
       delete dt;
 
       SetStatus(entered);
+      
+      clientChoice->Enable(false);
+      jobChoice->Enable(false);      
+      clientChoice->SetSelection(0);
+      CmdListJobs();
+      jobChoice->Enable(true);
+      clientChoice->Enable(true);
+      
+      wxbMainFrame::GetInstance()->SetStatusText("Please select a client and a date at which the files you'll select were backed up.");
    }
    else if (status == entered) {
-      if (jobChoice->GetStringSelection().Length() < 1) {
+      if (clientChoice->GetStringSelection().Length() < 1) {
          wxbMainFrame::GetInstance()->SetStatusText("Please select a client.");
          return;
       }
+      if (jobChoice->GetStringSelection().Length() < 1) {
+         wxbMainFrame::GetInstance()->SetStatusText("Please select a restore date.");
+         return;
+      }
+      wxbMainFrame::GetInstance()->SetStatusText("Building restore tree...");
+      
       WaitForPrompt("restore\n");
       WaitForPrompt("6\n");
       wxbPromptParser *pp = WaitForPrompt(wxString() << jobChoice->GetStringSelection() << "\n", true);
@@ -449,7 +479,6 @@ void wxbRestorePanel::CmdStart() {
       long l;
       wxString str;
       
-      unsigned int i;
       for (i = 0; i < tableparser->size(); i++) {
          str = (*tableparser)[i][2];
          str.Replace(",", "");
@@ -481,7 +510,7 @@ void wxbRestorePanel::CmdStart() {
                if (((*dt)[lastindex].Find("Building directory tree for JobId ") == 0) && 
                      ((i = (*dt)[lastindex].Find(" ...")) > 0)) {
                   str = (*dt)[lastindex].Mid(34, i-34);
-                  for (unsigned int i = 0; i < tableparser->size(); i++) {
+                  for (i = 0; i < tableparser->size(); i++) {
                      if (str == (*tableparser)[i][0]) {
                         str = (*tableparser)[i][2];
                         str.Replace(",", "");
@@ -515,7 +544,9 @@ void wxbRestorePanel::CmdStart() {
          }
          wxTheApp->Yield(true);
       }
-      
+
+      gauge->SetValue(tot);
+      wxTheApp->Yield();
       gauge->SetValue(0);
       
       delete dt;
@@ -530,9 +561,7 @@ void wxbRestorePanel::CmdStart() {
    }
    else if (status == choosing) {
       SetStatus(configuring);
-      
-      wxbMainFrame::GetInstance()->SetStatusText("Please configure your restore...");
-      
+           
       EnableConfig(false);
       
       totfilemessages = 0;
@@ -543,7 +572,7 @@ void wxbRestorePanel::CmdStart() {
       dt = new wxbDataTokenizer(true);
       WaitForPrompt("done\n");
 
-      for (unsigned int i = 0; i < dt->GetCount(); i++) {
+      for (i = 0; i < dt->GetCount(); i++) {
          if ((j = (*dt)[i].Find(" files selected to be restored.")) > -1) {
             (*dt)[i].Mid(0, j).ToLong(&totfilemessages);
             break;
@@ -555,6 +584,10 @@ void wxbRestorePanel::CmdStart() {
          }
       }
       
+      wxbMainFrame::GetInstance()->SetStatusText(
+         wxString("Please configure your restore (") 
+            << totfilemessages <<  " files selected to be restored)...");
+      
       UpdateConfig(dt);
       
       delete dt;
@@ -677,6 +710,8 @@ void wxbRestorePanel::CmdStart() {
 void wxbRestorePanel::CmdConfigApply() {
    if (cfgUpdated == 0) return;
    
+   wxbMainFrame::GetInstance()->SetStatusText("Applying restore configuration changes...");
+   
    EnableConfig(false);
    
    wxbDataTokenizer* dt = NULL;
@@ -763,7 +798,9 @@ void wxbRestorePanel::CmdConfigApply() {
    UpdateConfig(dt); /* TODO: Check result */
    
    EnableConfig(true);
-   
+
+   wxbMainFrame::GetInstance()->SetStatusText("Restore configuration changes were applied.");
+
    delete dt;
 }
 
@@ -1496,15 +1533,22 @@ void wxbRestorePanel::OnTreeChanged(wxTreeEvent& event) {
       return;
    }
    SetCursor(*wxHOURGLASS_CURSOR);
+   markWhenListingDone = false;
    working = true;
    CmdList(event.GetItem());
+   if (markWhenListingDone) {
+      CmdMark(event.GetItem(), -1);
+      tree->Refresh();
+   }
    working = false;
    SetCursor(*wxSTANDARD_CURSOR);
 }
 
 void wxbRestorePanel::OnTreeMarked(wxbTreeMarkedEvent& event) {
    if (working) {
-      //event.Skip();
+      if (tree->GetSelection() == event.GetItem()) {
+         markWhenListingDone = !markWhenListingDone;
+      }
       return;
    }
    SetCursor(*wxHOURGLASS_CURSOR);
index 509db0b4059ff31edb5adc25dd832b3c717bd942..c6aa33e70d0f9b300e58e46e069ddc8fcbb80005 100644 (file)
@@ -134,6 +134,7 @@ class wxbRestorePanel : public wxbPanel
 
 /* UI related */
       bool working; // A command is running, discard GUI events
+      bool markWhenListingDone;
       wxTreeItemId currentTreeItem; // Currently selected tree item
 
       /* Enable or disable config controls status */