From 6681ff5c1809543232a91eb6a401ebe7a86d8c92 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 11 Oct 2024 14:22:37 +0200 Subject: [PATCH] Axivion: Partially redo handling project selection If we cannot find the preferred project inside the selected dashboard we just dropped out with an error message which could easily be missed. Anyhow we should fetch the first available project in that case to refill other filter controls if the dashboard contains any. Only if the dashboard has no configured projects drop out early. Change-Id: Iff72ccb79b9ec3e11620ae435c5322f40269c9ef Reviewed-by: hjk Reviewed-by: Mohammad Mehdi Salem Naraghi --- src/plugins/axivion/axivionplugin.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index 3f69cd5ee1e..39bc6167085 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -798,22 +798,12 @@ Group projectInfoRecipe(const QString &projectName) return SetupResult::StopWithError; } - const QString targetProjectName - = (projectName.isEmpty() && !dd->m_dashboardInfo->projects.isEmpty()) - ? dd->m_dashboardInfo->projects.first() : projectName; - - if (targetProjectName.isEmpty()) { + if (dd->m_dashboardInfo->projects.isEmpty()) { + updatePerspectiveToolbar(); updateDashboard(); return SetupResult::StopWithSuccess; } - const auto it = dd->m_dashboardInfo->projectUrls.constFind(targetProjectName); - if (it == dd->m_dashboardInfo->projectUrls.constEnd()) { - MessageManager::writeDisrupting(QString("Axivion: %1") - .arg(Tr::tr("The DashboardInfo doesn't contain project \"%1\".").arg(targetProjectName))); - return SetupResult::StopWithError; - } - const auto handler = [](const Dto::ProjectInfoDto &data) { dd->m_currentProjectInfo = data; if (!dd->m_currentProjectInfo->versions.empty()) @@ -822,6 +812,11 @@ Group projectInfoRecipe(const QString &projectName) updateDashboard(); }; + const QString targetProjectName = projectName.isEmpty() + ? dd->m_dashboardInfo->projects.first() : projectName; + auto it = dd->m_dashboardInfo->projectUrls.constFind(targetProjectName); + if (it == dd->m_dashboardInfo->projectUrls.constEnd()) + it = dd->m_dashboardInfo->projectUrls.constBegin(); taskTree.setRecipe( fetchDataRecipe(dd->m_dashboardInfo->source.resolved(*it), handler)); return SetupResult::Continue;