1 Star 0 Fork 6

twtlpl/drbd

forked from src-openEuler/drbd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-DRBDmon-Busy-indicator-debug-log-updates.patch 13.76 KB
一键复制 编辑 原始数据 按行查看 历史
twtlpl 提交于 2024-10-31 19:43 . DRBDmon: Fix CfgEntryStore UUID
From 4f71713b706a75fae6b3835aa92e4280165ed67e Mon Sep 17 00:00:00 2001
From: Robert Altnoeder <robert.altnoeder@linbit.com>
Date: Tue, 19 Mar 2024 09:25:56 +0100
Subject: [PATCH 080/100] DRBDmon: Busy indicator, debug log updates
- Debug log: Enable select-all/deselect-all
- Busy indicator:
- Indicate busy on multiple item operations
- Indicate busy when queueing multiple commands
---
user/drbdmon/terminal/DrbdCommandsImpl.cpp | 10 +++++++
user/drbdmon/terminal/GlobalCommandsImpl.cpp | 31 ++++++++++++++------
user/drbdmon/terminal/MDspBase.cpp | 5 ++++
user/drbdmon/terminal/MDspConnections.cpp | 9 ++++++
user/drbdmon/terminal/MDspPeerVolumes.cpp | 7 +++++
user/drbdmon/terminal/MDspResources.cpp | 10 ++++++-
user/drbdmon/terminal/MDspStdListBase.cpp | 1 +
user/drbdmon/terminal/MDspVolumes.cpp | 7 +++++
8 files changed, 70 insertions(+), 10 deletions(-)
diff --git a/user/drbdmon/terminal/DrbdCommandsImpl.cpp b/user/drbdmon/terminal/DrbdCommandsImpl.cpp
index 23f79db5..78ef870c 100644
--- a/user/drbdmon/terminal/DrbdCommandsImpl.cpp
+++ b/user/drbdmon/terminal/DrbdCommandsImpl.cpp
@@ -144,6 +144,8 @@ bool DrbdCommandsImpl::exec_for_resources(
active_page == DisplayId::display_page::RSC_ACTIONS) &&
dsp_comp_hub.dsp_shared->have_resources_selection())
{
+ dsp_comp_hub.dsp_common->application_working();
+
cmd_valid = true;
ResourcesMap& selection_map = dsp_comp_hub.dsp_shared->get_selected_resources_map();
@@ -199,6 +201,8 @@ bool DrbdCommandsImpl::exec_for_connections(
// On resource list or resource actions with a selection of multiple resources,
// operates on all connections or all selected resources, overrides any connection selection
+ dsp_comp_hub.dsp_common->application_working();
+
cmd_valid = true;
ResourcesMap& selection_map = dsp_comp_hub.dsp_shared->get_selected_resources_map();
@@ -227,6 +231,8 @@ bool DrbdCommandsImpl::exec_for_connections(
{
// On connection list or connection details with a selection of multiple connections
+ dsp_comp_hub.dsp_common->application_working();
+
ConnectionsMap& selection_map = dsp_comp_hub.dsp_shared->get_selected_connections_map();
ConnectionsMap::KeysIterator con_iter(selection_map);
@@ -299,6 +305,8 @@ bool DrbdCommandsImpl::exec_for_volumes(
active_page == DisplayId::display_page::VLM_ACTIONS) &&
dsp_comp_hub.dsp_shared->have_volumes_selection())
{
+ dsp_comp_hub.dsp_common->application_working();
+
cmd_valid = true;
VolumesMap& selection_map = dsp_comp_hub.dsp_shared->get_selected_volumes_map();
@@ -368,6 +376,8 @@ bool DrbdCommandsImpl::exec_for_peer_volumes(
active_page == DisplayId::display_page::PEER_VLM_ACTIONS) &&
dsp_comp_hub.dsp_shared->have_peer_volumes_selection())
{
+ dsp_comp_hub.dsp_common->application_working();
+
cmd_valid = true;
VolumesMap& selection_map = dsp_comp_hub.dsp_shared->get_selected_peer_volumes_map();
diff --git a/user/drbdmon/terminal/GlobalCommandsImpl.cpp b/user/drbdmon/terminal/GlobalCommandsImpl.cpp
index 6d772b07..675d5eb0 100644
--- a/user/drbdmon/terminal/GlobalCommandsImpl.cpp
+++ b/user/drbdmon/terminal/GlobalCommandsImpl.cpp
@@ -174,14 +174,22 @@ bool GlobalCommandsImpl::cmd_select_all(const std::string& command, StringTokeni
DisplayId::display_page active_page = dsp_comp_hub.dsp_selector->get_active_page();
if (active_page == DisplayId::display_page::LOG_VIEWER)
{
- std::unique_lock<std::recursive_mutex> lock(dsp_comp_hub.log->queue_lock);
-
- MessageLog::Queue::ValuesIterator entry_iter = dsp_comp_hub.log->iterator();
- while (entry_iter.has_next())
+ MessageLog* const log = active_page == DisplayId::display_page::LOG_VIEWER ?
+ dsp_comp_hub.log : dsp_comp_hub.debug_log;
+ MessageMap& selection = active_page == DisplayId::display_page::LOG_VIEWER ?
+ *(dsp_comp_hub.dsp_shared->selected_log_entries) :
+ *(dsp_comp_hub.dsp_shared->selected_debug_log_entries);
+ dsp_comp_hub.dsp_common->application_working();
{
- MessageLog::Entry* const entry = entry_iter.next();
- const uint64_t entry_id = entry->get_id();
- dsp_comp_hub.dsp_shared->select_log_entry(*(dsp_comp_hub.dsp_shared->selected_log_entries), entry_id);
+ std::unique_lock<std::recursive_mutex> lock(log->queue_lock);
+
+ MessageLog::Queue::ValuesIterator entry_iter = log->iterator();
+ while (entry_iter.has_next())
+ {
+ MessageLog::Entry* const entry = entry_iter.next();
+ const uint64_t entry_id = entry->get_id();
+ dsp_comp_hub.dsp_shared->select_log_entry(selection, entry_id);
+ }
}
dsp_comp_hub.dsp_selector->refresh_display();
accepted = true;
@@ -193,9 +201,14 @@ bool GlobalCommandsImpl::cmd_deselect_all(const std::string& command, StringToke
{
bool accepted = false;
DisplayId::display_page active_page = dsp_comp_hub.dsp_selector->get_active_page();
- if (active_page == DisplayId::display_page::LOG_VIEWER)
+ if (active_page == DisplayId::display_page::LOG_VIEWER ||
+ active_page == DisplayId::display_page::DEBUG_LOG_VIEWER)
{
- dsp_comp_hub.dsp_shared->clear_log_entry_selection(*(dsp_comp_hub.dsp_shared->selected_log_entries));
+ MessageMap& selection = active_page == DisplayId::display_page::LOG_VIEWER ?
+ *(dsp_comp_hub.dsp_shared->selected_log_entries) :
+ *(dsp_comp_hub.dsp_shared->selected_debug_log_entries);
+ dsp_comp_hub.dsp_common->application_working();
+ dsp_comp_hub.dsp_shared->clear_log_entry_selection(selection);
dsp_comp_hub.dsp_selector->refresh_display();
accepted = true;
}
diff --git a/user/drbdmon/terminal/MDspBase.cpp b/user/drbdmon/terminal/MDspBase.cpp
index 601bee63..77bc86af 100644
--- a/user/drbdmon/terminal/MDspBase.cpp
+++ b/user/drbdmon/terminal/MDspBase.cpp
@@ -206,6 +206,11 @@ bool MDspBase::key_pressed(const uint32_t key)
dsp_comp_hub.dsp_common->display_command_line();
leave_command_line_mode();
}
+ else
+ {
+ dsp_comp_hub.dsp_common->application_idle();
+ reposition_text_cursor();
+ }
intercepted = true;
}
diff --git a/user/drbdmon/terminal/MDspConnections.cpp b/user/drbdmon/terminal/MDspConnections.cpp
index 581ad168..36454792 100644
--- a/user/drbdmon/terminal/MDspConnections.cpp
+++ b/user/drbdmon/terminal/MDspConnections.cpp
@@ -678,6 +678,7 @@ bool MDspConnections::execute_command(const std::string& command, StringTokenize
{
if (string_matching::is_pattern(cmd_arg))
{
+ dsp_comp_hub.dsp_common->application_working();
try
{
std::unique_ptr<string_matching::PatternItem> pattern;
@@ -744,6 +745,7 @@ bool MDspConnections::execute_command(const std::string& command, StringTokenize
std::string cmd_arg = tokenizer.next();
if (string_matching::is_pattern(cmd_arg))
{
+ dsp_comp_hub.dsp_common->application_working();
try
{
accepted = change_selection(cmd_arg, command == cmd_names::KEY_CMD_SELECT);
@@ -776,6 +778,7 @@ bool MDspConnections::execute_command(const std::string& command, StringTokenize
DrbdResource* const rsc = dsp_comp_hub.get_monitor_resource();
if (rsc != nullptr)
{
+ dsp_comp_hub.dsp_common->application_working();
const bool prb_mode = is_problem_mode(rsc);
DrbdResource::ConnectionsIterator con_iter = rsc->connections_iterator();
while (con_iter.has_next())
@@ -793,6 +796,7 @@ bool MDspConnections::execute_command(const std::string& command, StringTokenize
else
if (command == cmd_names::KEY_CMD_DESELECT_ALL || command == cmd_names::KEY_CMD_CLEAR_SELECTION)
{
+ dsp_comp_hub.dsp_common->application_working();
clear_selection();
accepted = true;
}
@@ -800,6 +804,11 @@ bool MDspConnections::execute_command(const std::string& command, StringTokenize
{
dsp_comp_hub.dsp_selector->refresh_display();
}
+ else
+ {
+ dsp_comp_hub.dsp_common->application_idle();
+ reposition_text_cursor();
+ }
return accepted;
}
diff --git a/user/drbdmon/terminal/MDspPeerVolumes.cpp b/user/drbdmon/terminal/MDspPeerVolumes.cpp
index e2e64cc8..d9d82bd7 100644
--- a/user/drbdmon/terminal/MDspPeerVolumes.cpp
+++ b/user/drbdmon/terminal/MDspPeerVolumes.cpp
@@ -185,6 +185,7 @@ bool MDspPeerVolumes::execute_command(const std::string& command, StringTokenize
DrbdConnection* const con = dsp_comp_hub.get_monitor_connection();
if (rsc != nullptr && con != nullptr)
{
+ dsp_comp_hub.dsp_common->application_working();
DrbdConnection::VolumesIterator vlm_iter(*con);
if (is_problem_mode(rsc, con))
{
@@ -213,6 +214,7 @@ bool MDspPeerVolumes::execute_command(const std::string& command, StringTokenize
else
if (command == cmd_names::KEY_CMD_DESELECT_ALL || command == cmd_names::KEY_CMD_CLEAR_SELECTION)
{
+ dsp_comp_hub.dsp_common->application_working();
clear_selection();
accepted = true;
}
@@ -220,6 +222,11 @@ bool MDspPeerVolumes::execute_command(const std::string& command, StringTokenize
{
dsp_comp_hub.dsp_selector->refresh_display();
}
+ else
+ {
+ dsp_comp_hub.dsp_common->application_idle();
+ reposition_text_cursor();
+ }
return accepted;
}
diff --git a/user/drbdmon/terminal/MDspResources.cpp b/user/drbdmon/terminal/MDspResources.cpp
index 3a66e264..524569d7 100644
--- a/user/drbdmon/terminal/MDspResources.cpp
+++ b/user/drbdmon/terminal/MDspResources.cpp
@@ -596,6 +596,7 @@ bool MDspResources::execute_command(const std::string& command, StringTokenizer&
{
if (string_matching::is_pattern(cmd_arg))
{
+ dsp_comp_hub.dsp_common->application_working();
try
{
std::unique_ptr<string_matching::PatternItem> pattern;
@@ -638,6 +639,7 @@ bool MDspResources::execute_command(const std::string& command, StringTokenizer&
std::string cmd_arg = tokenizer.next();
if (string_matching::is_pattern(cmd_arg))
{
+ dsp_comp_hub.dsp_common->application_working();
try
{
accepted = change_selection(cmd_arg, command == cmd_names::KEY_CMD_SELECT);
@@ -667,6 +669,7 @@ bool MDspResources::execute_command(const std::string& command, StringTokenizer&
else
if (command == cmd_names::KEY_CMD_SELECT_ALL)
{
+ dsp_comp_hub.dsp_common->application_working();
ResourcesMap& selected_map = select_resources_map();
ResourcesMap::KeysIterator rsc_iter(selected_map);
while (rsc_iter.has_next())
@@ -679,14 +682,19 @@ bool MDspResources::execute_command(const std::string& command, StringTokenizer&
else
if (command == cmd_names::KEY_CMD_DESELECT_ALL || command == cmd_names::KEY_CMD_CLEAR_SELECTION)
{
+ dsp_comp_hub.dsp_common->application_working();
clear_selection();
-
accepted = true;
}
if (accepted)
{
dsp_comp_hub.dsp_selector->refresh_display();
}
+ else
+ {
+ dsp_comp_hub.dsp_common->application_idle();
+ reposition_text_cursor();
+ }
return accepted;
}
diff --git a/user/drbdmon/terminal/MDspStdListBase.cpp b/user/drbdmon/terminal/MDspStdListBase.cpp
index ff370eaa..d5d38b3e 100644
--- a/user/drbdmon/terminal/MDspStdListBase.cpp
+++ b/user/drbdmon/terminal/MDspStdListBase.cpp
@@ -61,6 +61,7 @@ bool MDspStdListBase::key_pressed(const uint32_t key)
else
if (key == KeyCodes::FUNC_04)
{
+ dsp_comp_hub.dsp_common->application_working();
clear_selection();
dsp_comp_hub.dsp_selector->refresh_display();
intercepted = true;
diff --git a/user/drbdmon/terminal/MDspVolumes.cpp b/user/drbdmon/terminal/MDspVolumes.cpp
index f1c6fdb7..9625a58b 100644
--- a/user/drbdmon/terminal/MDspVolumes.cpp
+++ b/user/drbdmon/terminal/MDspVolumes.cpp
@@ -405,6 +405,7 @@ bool MDspVolumes::execute_command(const std::string& command, StringTokenizer& t
DrbdResource* const rsc = dsp_comp_hub.get_monitor_resource();
if (rsc != nullptr)
{
+ dsp_comp_hub.dsp_common->application_working();
const bool prb_mode = is_problem_mode(rsc);
DrbdResource::VolumesIterator vlm_iter = rsc->volumes_iterator();
while (vlm_iter.has_next())
@@ -422,6 +423,7 @@ bool MDspVolumes::execute_command(const std::string& command, StringTokenizer& t
else
if (command == cmd_names::KEY_CMD_DESELECT_ALL || command == cmd_names::KEY_CMD_CLEAR_SELECTION)
{
+ dsp_comp_hub.dsp_common->application_working();
clear_selection();
accepted = true;
}
@@ -429,6 +431,11 @@ bool MDspVolumes::execute_command(const std::string& command, StringTokenizer& t
{
dsp_comp_hub.dsp_selector->refresh_display();
}
+ else
+ {
+ dsp_comp_hub.dsp_common->application_idle();
+ reposition_text_cursor();
+ }
return accepted;
}
--
2.33.1.windows.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/twtlpl/drbd.git
git@gitee.com:twtlpl/drbd.git
twtlpl
drbd
drbd
master

搜索帮助