Test results are presented in a more obvious manner now.

This commit is contained in:
Alexander Shaduri
2024-11-04 20:38:47 +04:00
parent c2277edb56
commit 3aa5ddfc32
3 changed files with 58 additions and 12 deletions
+1 -1
View File
@@ -316,7 +316,7 @@ struct NvmeSelfTestResultTypeExt
{
return {
{NvmeSelfTestResultType::Unknown, {"unknown", _("Unknown")}},
{NvmeSelfTestResultType::CompletedNoError, {"completedNoError", _("Completed with No Error")}},
{NvmeSelfTestResultType::CompletedNoError, {"completedNoError", _("Completed Without Errors")}},
{NvmeSelfTestResultType::AbortedSelfTestCommand, {"abortedSelfTestCommand", _("Aborted: Self-Test Command")}},
{NvmeSelfTestResultType::AbortedControllerReset, {"abortedControllerReset", _("Aborted: Controller Reset")}},
{NvmeSelfTestResultType::AbortedNamespaceRemoved, {"abortedNamespaceRemoved", _("Aborted: Namespace Removed")}},
+54 -9
View File
@@ -2264,7 +2264,7 @@ gboolean GscInfoWindow::test_idle_callback(void* data)
break;
}
const int8_t rem_percent = self->current_test_->get_remaining_percent();
const std::int8_t rem_percent = self->current_test_->get_remaining_percent();
const std::string rem_percent_str = (rem_percent == -1 ? C_("value", "Unknown") : hz::number_to_string_locale(100 - rem_percent));
auto poll_in = self->current_test_->get_poll_in_seconds(); // sec
@@ -2347,21 +2347,21 @@ gboolean GscInfoWindow::test_idle_callback(void* data)
bool aborted = false;
SelfTestStatusSeverity severity = SelfTestStatusSeverity::None;
std::string result_msg;
std::string result_details_msg;
if (!self->test_error_msg_.empty()) {
aborted = true;
severity = SelfTestStatusSeverity::Error;
result_msg = Glib::ustring::compose(_("<b>Test aborted:</b> %1"), Glib::Markup::escape_text(self->test_error_msg_));
result_details_msg = Glib::ustring::compose(_("<b>Test aborted: %1</b>"), Glib::Markup::escape_text(self->test_error_msg_));
} else {
severity = get_self_test_status_severity(status);
if (status == SelfTestStatus::ManuallyAborted) {
aborted = true;
result_msg = "<b>"s + _("Test was manually aborted.") + "</b>"; // it's a StatusSeverity::none message
result_details_msg = "<b>"s + _("Test was manually aborted.") + "</b>"; // it's a StatusSeverity::none message
} else {
result_msg = Glib::ustring::compose(_("<b>Test result:</b> %1."),
result_details_msg = Glib::ustring::compose(_("<b>Test result: %1</b>."),
Glib::Markup::escape_text(SelfTestStatusExt::get_displayable_name(status)));
// It may not reach 100% somehow, so do it manually.
@@ -2370,10 +2370,54 @@ gboolean GscInfoWindow::test_idle_callback(void* data)
}
}
if (severity != SelfTestStatusSeverity::None) {
result_msg += "\n"s + _("Check the Self-Test Log for more information.");
std::string result_main_msg;
if (aborted) {
result_main_msg = _("TEST ABORTED!");
} else {
switch (status) {
case SelfTestStatus::Unknown:
result_main_msg = _("TEST STATUS UNKNOWN.");
break;
case SelfTestStatus::InProgress:
result_main_msg = _("TEST IN PROGRESS.");
break;
case SelfTestStatus::ManuallyAborted:
result_main_msg = _("TEST ABORTED!");
break;
case SelfTestStatus::Interrupted:
result_main_msg = _("TEST INTERRUPTED!");
break;
case SelfTestStatus::CompletedNoError:
result_main_msg = _("TEST SUCCESSFUL.");
break;
case SelfTestStatus::CompletedWithError:
result_main_msg = _("TEST FAILED!");
break;
case SelfTestStatus::Reserved:
result_main_msg = _("TEST STATUS UNKNOWN.");
break;
}
}
switch (severity) {
case SelfTestStatusSeverity::None:
break;
case SelfTestStatusSeverity::Warning:
result_details_msg = "\n"s + _("Check the Self-Test Log for more information.");
break;
case SelfTestStatusSeverity::Error:
if (!result_main_msg.empty()) { // Highlight in red
result_main_msg = "<span color=\"#FF0000\">"s + result_main_msg + "</span>";
}
result_details_msg += "\n"s + _("Check the Self-Test Log for more information.");
break;
}
if (!result_main_msg.empty()) {
result_main_msg = "<b>"s + result_main_msg + "</b>\n";
}
std::string result_msg = result_main_msg + result_details_msg;
if (auto* test_type_combo = self->lookup_widget<Gtk::ComboBox*>("test_type_combo"))
test_type_combo->set_sensitive(true);
@@ -2381,8 +2425,9 @@ gboolean GscInfoWindow::test_idle_callback(void* data)
if (auto* test_execute_button = self->lookup_widget<Gtk::Button*>("test_execute_button"))
test_execute_button->set_sensitive(true);
if (test_completion_progressbar)
test_completion_progressbar->set_text(aborted ? _("Test aborted") : _("Test completed"));
if (test_completion_progressbar) {
test_completion_progressbar->set_text("");
}
if (auto* test_stop_button = self->lookup_widget<Gtk::Button*>("test_stop_button"))
test_stop_button->set_sensitive(false);
+3 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2
<!-- Generated with glade 3.40.0
Copyright (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
@@ -441,6 +441,7 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
<property name="can-focus">False</property>
<property name="label">[Test result text placeholder]</property>
<property name="use-markup">True</property>
<property name="justify">center</property>
<property name="width-chars">70</property>
</object>
<packing>
@@ -1227,8 +1228,8 @@ Note: The log is not preserved across power cycles or controller resets.</proper
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Re-read all the information</property>
<property name="use-stock">True</property>
<accelerator key="R" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="F5" signal="clicked"/>
<accelerator key="R" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">True</property>