Log Message:
-----------
Allow cancel/terminate from status and locks tabs.
Modified Files:
--------------
pgadmin3/src/include:
frmStatus.h (r1.12 -> r1.13)
pgadmin3/src/ui:
frmStatus.cpp (r1.29 -> r1.30)
pgadmin3/src/ui/common:
frmStatus.xrc (r1.9 -> r1.10)
Index: frmStatus.h
===================================================================
RCS file: /projects/pgadmin3/src/include/frmStatus.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -Lsrc/include/frmStatus.h -Lsrc/include/frmStatus.h -u -w -r1.12 -r1.13
--- src/include/frmStatus.h
+++ src/include/frmStatus.h
@@ -45,7 +45,7 @@
void OnTerminateBtn(wxCommandEvent &event);
void OnCancelBtn(wxCommandEvent &event);
void OnSelStatusItem(wxListEvent &event);
-
+ void OnSelLockItem(wxListEvent &event);
void addLog(const wxString &str);
Index: frmStatus.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmStatus.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -Lsrc/ui/frmStatus.cpp -Lsrc/ui/frmStatus.cpp -u -w -r1.29 -r1.30
--- src/ui/frmStatus.cpp
+++ src/ui/frmStatus.cpp
@@ -37,6 +37,8 @@
EVT_TIMER(TIMER_ID,
frmStatus::OnRefreshTimer)
EVT_LIST_ITEM_SELECTED(XRCID("lstStatus"),
frmStatus::OnSelStatusItem)
EVT_LIST_ITEM_DESELECTED(XRCID("lstStatus"), frmStatus::OnSelStatusItem)
+ EVT_LIST_ITEM_SELECTED(XRCID("lstLocks"),
frmStatus::OnSelLockItem)
+ EVT_LIST_ITEM_DESELECTED(XRCID("lstLocks"),
frmStatus::OnSelLockItem)
END_EVENT_TABLE();
@@ -170,6 +172,10 @@
if (!loaded) return;
wxCommandEvent nullEvent;
OnRefresh(nullEvent);
+
+ // Disable the buttons. They'll get re-enabled if a suitable item is selected.
+ btnCancel->Enable(false);
+ btnTerminate->Enable(false);
}
@@ -468,22 +474,36 @@
if (wxMessageBox(_("Are you sure you wish to cancel the selected query(s)?"),
_("Cancel query?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION) == wxNO)
return;
+ ctlListView *lv;
+
+ if (nbStatus->GetSelection() == 0)
+ lv = statusList;
+
+ else if (nbStatus->GetSelection() == 1)
+ lv = lockList;
+
+ else
+ {
+ wxLogError(_("Couldn't determine the source listview for a cancel
backend operation!"));
+ return;
+ }
+
long item = -1;
wxString pid;
for ( ;; )
{
- item = statusList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ item = lv->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if ( item == -1 )
break;
- pid = statusList->GetItemText(item);
+ pid = lv->GetItemText(item);
wxString sql = wxT("SELECT pg_cancel_backend(") + pid + wxT(");");
connection->ExecuteScalar(sql);
}
- OnRefresh(*(wxCommandEvent*)&event);
wxMessageBox(_("A cancel signal was sent to the selected server
process(es)."), _("Cancel query"), wxOK | wxICON_INFORMATION);
+ OnRefresh(*(wxCommandEvent*)&event);
}
void frmStatus::OnTerminateBtn(wxCommandEvent &event)
@@ -491,23 +511,37 @@
if (wxMessageBox(_("Are you sure you wish to terminate the selected server
process(es)?"), _("Terminate process?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION) ==
wxNO)
return;
+ ctlListView *lv;
+
+ if (nbStatus->GetSelection() == 0)
+ lv = statusList;
+
+ else if (nbStatus->GetSelection() == 1)
+ lv = lockList;
+
+ else
+ {
+ wxLogError(_("Couldn't determine the source listview for a terminate
backend operation!"));
+ return;
+ }
+
long item = -1;
wxString pid;
for ( ;; )
{
- item = statusList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ item = lv->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if ( item == -1 )
break;
- pid = statusList->GetItemText(item);
+ pid = lv->GetItemText(item);
wxString sql = wxT("SELECT pg_terminate_backend(") + pid + wxT(");");
connection->ExecuteScalar(sql);
}
- OnRefresh(*(wxCommandEvent*)&event);
wxMessageBox(_("A terminate signal was sent to the selected server
process(es)."), _("Terminate process"), wxOK | wxICON_INFORMATION);
+ OnRefresh(*(wxCommandEvent*)&event);
}
void frmStatus::OnSelStatusItem(wxListEvent &event)
@@ -526,3 +560,20 @@
}
}
}
+
+void frmStatus::OnSelLockItem(wxListEvent &event)
+{
+ if (connection->BackendMinimumVersion(7, 5))
+ {
+ if(lockList->GetSelectedItemCount() >= 0)
+ {
+ btnCancel->Enable(true);
+ btnTerminate->Enable(true);
+ }
+ else
+ {
+ btnCancel->Enable(false);
+ btnTerminate->Enable(false);
+ }
+ }
+}
Index: frmStatus.xrc
===================================================================
RCS file: /projects/pgadmin3/src/ui/common/frmStatus.xrc,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lsrc/ui/common/frmStatus.xrc -Lsrc/ui/common/frmStatus.xrc -u -w -r1.9 -r1.10
--- src/ui/common/frmStatus.xrc
+++ src/ui/common/frmStatus.xrc
@@ -6,7 +6,7 @@
<style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
<object class="wxFlexGridSizer">
<cols>1</cols>
- <rows>2</rows>
+ <rows>3</rows>
<growablerows>1</growablerows>
<object class="sizeritem">
<object class="wxFlexGridSizer">
@@ -65,44 +65,10 @@
<size>395,273d</size>
<object class="notebookpage">
<label>Status</label>
- <object class="wxPanel" name="pnlStatus">
- <object class="wxFlexGridSizer">
- <cols>1</cols>
- <rows>2</rows>
- <object class="sizeritem">
<object class="wxListCtrl" name="lstStatus">
<pos>5,24</pos>
<style>wxLC_REPORT|wxSUNKEN_BORDER</style>
</object>
- <flag>wxTOP|wxLEFT|wxEXPAND|wxGROW|wxALIGN_CENTRE</flag>
- </object>
- <object class="sizeritem">
- <object class="wxFlexGridSizer">
- <cols>2</cols>
- <rows>1</rows>
- <object class="sizeritem">
- <object class="wxButton" name="btnCancel">
- <label>Cancel</label>
- <size>53,15d</size>
- </object>
-
<flag>wxBOTTOM|wxLEFT|wxALIGN_CENTRE|wxALIGN_CENTRE_VERTICAL</flag>
- <border>2</border>
- </object>
- <object class="sizeritem">
- <object class="wxButton" name="btnTerminate">
- <label>Terminate</label>
- <size>53,15d</size>
- </object>
-
<flag>wxBOTTOM|wxLEFT|wxALIGN_CENTRE|wxALIGN_CENTRE_VERTICAL</flag>
- <border>2</border>
- </object>
- <hgap>8</hgap>
- </object>
- </object>
- <growablecols>0</growablecols>
- <growablerows>0</growablerows>
- </object>
- </object>
</object>
<object class="notebookpage">
<label>Locks</label>
@@ -123,6 +89,28 @@
<border>2</border>
</object>
<growablecols>0</growablecols>
+ <object class="sizeritem">
+ <object class="wxFlexGridSizer">
+ <cols>3</cols>
+ <rows>1</rows>
+ <object class="sizeritem">
+ <object class="wxButton" name="btnCancel">
+ <label>Cancel</label>
+ <size>53,15d</size>
+ </object>
+ <flag>wxBOTTOM|wxLEFT|wxALIGN_CENTRE|wxALIGN_CENTRE_VERTICAL</flag>
+ <border>5</border>
+ </object>
+ <object class="sizeritem">
+ <object class="wxButton" name="btnTerminate">
+ <label>Terminate</label>
+ <size>53,15d</size>
+ </object>
+ <flag>wxBOTTOM|wxLEFT|wxALIGN_CENTRE|wxALIGN_CENTRE_VERTICAL</flag>
+ <border>5</border>
+ </object>
+ </object>
+ </object>
</object>
</object>
</resource>
\ No newline at end of file
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])