Skip to content

Commit

Permalink
Health check: Show a message if everything is healthy
Browse files Browse the repository at this point in the history
Fixes #551
  • Loading branch information
wolframroesler committed Jan 7, 2020
1 parent d25ecd8 commit 4b37450
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/gui/reports/ReportsWidgetHealthcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,29 @@ void ReportsWidgetHealthcheck::showEvent(QShowEvent* event)

void ReportsWidgetHealthcheck::calculateHealth()
{
m_referencesModel->clear();

const QScopedPointer<Health> health(AsyncTask::runAndWaitForFuture([this] { return new Health(m_db); }));
if (health->items().empty()) {

m_referencesModel->clear();
m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("") << tr("Title") << tr("Path") << tr("Reason"));
// No findings
m_referencesModel->clear();
m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Title"));
auto row = QList<QStandardItem*>();
row << new QStandardItem(tr("Congratulations, everything is healthy!"));
m_referencesModel->appendRow(row);

m_row2entry.clear();
for (const auto& item : health->items()) {
addHealthRow(item.health, *item.group, *item.entry);
QBrush brush("green");
m_referencesModel->item(0, 0)->setForeground(brush);

} else {

// Show our findings
m_referencesModel->setHorizontalHeaderLabels(QStringList()
<< tr("") << tr("Title") << tr("Path") << tr("Reason"));
for (const auto& item : health->items()) {
addHealthRow(item.health, *item.group, *item.entry);
}
}

m_ui->healthcheckTableView->resizeRowsToContents();
Expand Down

0 comments on commit 4b37450

Please sign in to comment.