diff --git a/XenAdmin/Controls/FilterLocationToolStripDropDownButton.cs b/XenAdmin/Controls/FilterLocationToolStripDropDownButton.cs index 355e26c20..31285d535 100644 --- a/XenAdmin/Controls/FilterLocationToolStripDropDownButton.cs +++ b/XenAdmin/Controls/FilterLocationToolStripDropDownButton.cs @@ -154,8 +154,7 @@ namespace XenAdmin.Controls }); } - if (DropDownItems.Count <= 0) - Enabled = false; + Enabled = DropDownItems.Count > 0; } finally { diff --git a/XenAdmin/TabPages/AlertSummaryPage.cs b/XenAdmin/TabPages/AlertSummaryPage.cs index ad07fdb8f..17edf8a3f 100644 --- a/XenAdmin/TabPages/AlertSummaryPage.cs +++ b/XenAdmin/TabPages/AlertSummaryPage.cs @@ -578,10 +578,7 @@ namespace XenAdmin.TabPages private void UpdateActionEnablement() { - toolStripDropDownSeveritiesFilter.Enabled = - toolStripDropDownButtonServerFilter.Enabled = - toolStripDropDownButtonDateFilter.Enabled = - toolStripButtonExportAll.Enabled = Alert.NonDismissingAlertCount > 0; + toolStripButtonExportAll.Enabled = Alert.NonDismissingAlertCount > 0; tsmiDismissAll.Enabled = AllowedToDismiss(Alert.Alerts); tsmiDismissAll.AutoToolTip = !tsmiDismissAll.Enabled; diff --git a/XenAdmin/TabPages/HistoryPage.cs b/XenAdmin/TabPages/HistoryPage.cs index 4a7ec4959..8332b408b 100644 --- a/XenAdmin/TabPages/HistoryPage.cs +++ b/XenAdmin/TabPages/HistoryPage.cs @@ -133,15 +133,21 @@ namespace XenAdmin.TabPages private void SetFilterLabel() { - bool filterIsOn = toolStripDdbFilterDates.FilterIsOn - || toolStripDdbFilterLocation.FilterIsOn - || toolStripDdbFilterStatus.FilterIsOn; - - toolStripLabelFiltersOnOff.Text = filterIsOn + toolStripLabelFiltersOnOff.Text = FilterIsOn ? Messages.FILTERS_ON : Messages.FILTERS_OFF; } + private bool FilterIsOn + { + get + { + return toolStripDdbFilterDates.FilterIsOn + || toolStripDdbFilterLocation.FilterIsOn + || toolStripDdbFilterStatus.FilterIsOn; + } + } + private void BuildRowList() { if (!Visible) @@ -172,6 +178,7 @@ namespace XenAdmin.TabPages finally { dataGridView.ResumeLayout(); + UpdateButtons(); } } @@ -278,11 +285,7 @@ namespace XenAdmin.TabPages private void UpdateButtons() { - toolStripDdbFilterStatus.Enabled = - toolStripDdbFilterLocation.Enabled = - toolStripDdbFilterDates.Enabled = ConnectionsManager.History.Count > 0; - - tsmiDismissAll.Enabled = dataGridView.Rows.Cast().Any(row => row.Action.IsCompleted); + tsmiDismissAll.Enabled = ConnectionsManager.History.Any(a => a.IsCompleted); tsmiDismissSelected.Enabled = dataGridView.SelectedRows.Cast().Any(row => row.Action.IsCompleted); toolStripSplitButtonDismiss.Enabled = tsmiDismissAll.Enabled || tsmiDismissSelected.Enabled; @@ -307,7 +310,7 @@ namespace XenAdmin.TabPages if (ConnectionsManager.History.Count > 0 && (Program.RunInAutomatedTestMode || new ThreeButtonDialog( - new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOG_DELETE, Messages.MESSAGEBOX_LOG_DELETE_TITLE), + new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOG_DELETE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog(this) == DialogResult.Yes)) { @@ -351,21 +354,49 @@ namespace XenAdmin.TabPages private void tsmiDismissAll_Click(object sender, EventArgs e) { - if (ConnectionsManager.History.Count > 0 && - (Program.RunInAutomatedTestMode || - new ThreeButtonDialog( - new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOGS_DELETE, Messages.MESSAGEBOX_LOGS_DELETE_TITLE), - ThreeButtonDialog.ButtonYes, - ThreeButtonDialog.ButtonNo).ShowDialog(this) == DialogResult.Yes)) + if (ConnectionsManager.History.Count == 0) + return; + + DialogResult result = DialogResult.Yes; + if (!Program.RunInAutomatedTestMode) { - ConnectionsManager.History.RemoveAll(a => a.IsCompleted); + if (!FilterIsOn) + { + using (var dlog = new ThreeButtonDialog( + new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOGS_DELETE_NO_FILTER), + new ThreeButtonDialog.TBDButton(Messages.DISMISS_ALL_YES_CONFIRM_BUTTON, DialogResult.Yes), + ThreeButtonDialog.ButtonCancel)) + { + result = dlog.ShowDialog(this); + } + } + else + { + using (var dlog = new ThreeButtonDialog( + new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOGS_DELETE), + new ThreeButtonDialog.TBDButton(Messages.DISMISS_ALL_CONFIRM_BUTTON, DialogResult.Yes), + new ThreeButtonDialog.TBDButton(Messages.DISMISS_FILTERED_CONFIRM_BUTTON, DialogResult.No, ThreeButtonDialog.ButtonType.NONE), + ThreeButtonDialog.ButtonCancel)) + { + result = dlog.ShowDialog(this); + } + } + + if (result == DialogResult.Cancel) + return; } + + var actions = result == DialogResult.No + ? (from DataGridViewActionRow row in dataGridView.Rows where row.Action != null && row.Action.IsCompleted select row.Action) + : ConnectionsManager.History; + + ConnectionsManager.History.RemoveAll(actions.Contains); } private void tsmiDismissSelected_Click(object sender, EventArgs e) { using (var dlog = new ThreeButtonDialog( - new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOGS_DELETE_SELECTED, Messages.MESSAGEBOX_LOGS_DELETE_TITLE), + new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOGS_DELETE_SELECTED), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)) { diff --git a/XenAdmin/TabPages/ManageUpdatesPage.cs b/XenAdmin/TabPages/ManageUpdatesPage.cs index 8a75dd926..1a44ce429 100644 --- a/XenAdmin/TabPages/ManageUpdatesPage.cs +++ b/XenAdmin/TabPages/ManageUpdatesPage.cs @@ -272,9 +272,7 @@ namespace XenAdmin.TabPages private void UpdateButtonEnablement() { - toolStripDropDownButtonServerFilter.Enabled = - toolStripDropDownButtonDateFilter.Enabled = - toolStripButtonExportAll.Enabled = Updates.UpdateAlertsCount > 0; + toolStripButtonExportAll.Enabled = Updates.UpdateAlertsCount > 0; } private void ShowInformationHelper(string reason) diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 625811fcd..926031c86 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -19831,7 +19831,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Are you sure you want to delete this entry?. + /// Looks up a localized string similar to Are you sure you want to dismiss this event?. /// public static string MESSAGEBOX_LOG_DELETE { get { @@ -19839,15 +19839,6 @@ namespace XenAdmin { } } - /// - /// Looks up a localized string similar to Clear entry. - /// - public static string MESSAGEBOX_LOG_DELETE_TITLE { - get { - return ResourceManager.GetString("MESSAGEBOX_LOG_DELETE_TITLE", resourceCulture); - } - } - /// /// Looks up a localized string similar to Log file is missing.. /// @@ -19858,7 +19849,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to This will clear all non-active entries in the current view. Do you wish to continue?. + /// Looks up a localized string similar to You have applied filters to the list of events. Do you wish to dismiss all events or only the events you have chosen to view? In both cases only the non-active events will be removed.. /// public static string MESSAGEBOX_LOGS_DELETE { get { @@ -19867,20 +19858,20 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Do you wish to delete the selected entries?. + /// Looks up a localized string similar to This operation will remove all non-active events. Do you wish to continue?. /// - public static string MESSAGEBOX_LOGS_DELETE_SELECTED { + public static string MESSAGEBOX_LOGS_DELETE_NO_FILTER { get { - return ResourceManager.GetString("MESSAGEBOX_LOGS_DELETE_SELECTED", resourceCulture); + return ResourceManager.GetString("MESSAGEBOX_LOGS_DELETE_NO_FILTER", resourceCulture); } } /// - /// Looks up a localized string similar to Clear entries. + /// Looks up a localized string similar to This operation will remove all selected non-active events. Do you wish to continue?. /// - public static string MESSAGEBOX_LOGS_DELETE_TITLE { + public static string MESSAGEBOX_LOGS_DELETE_SELECTED { get { - return ResourceManager.GetString("MESSAGEBOX_LOGS_DELETE_TITLE", resourceCulture); + return ResourceManager.GetString("MESSAGEBOX_LOGS_DELETE_SELECTED", resourceCulture); } } diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index a5be644f0..fd949f55d 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -6914,19 +6914,16 @@ This action is final and unrecoverable. Log file is missing. - This will clear all non-active entries in the current view. Do you wish to continue? + You have applied filters to the list of events. Do you wish to dismiss all events or only the events you have chosen to view? In both cases only the non-active events will be removed. + + + This operation will remove all non-active events. Do you wish to continue? - Do you wish to delete the selected entries? - - - Clear entries + This operation will remove all selected non-active events. Do you wish to continue? - Are you sure you want to delete this entry? - - - Clear entry + Are you sure you want to dismiss this event? Moving Virtual Disk