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 <hjk@qt.io>
Reviewed-by: Mohammad Mehdi Salem Naraghi <mehdi.salem@qt.io>
This commit is contained in:
Christian Stenger
2024-10-11 14:22:37 +02:00
parent cd131f1006
commit 6681ff5c18

View File

@@ -798,22 +798,12 @@ Group projectInfoRecipe(const QString &projectName)
return SetupResult::StopWithError; return SetupResult::StopWithError;
} }
const QString targetProjectName if (dd->m_dashboardInfo->projects.isEmpty()) {
= (projectName.isEmpty() && !dd->m_dashboardInfo->projects.isEmpty()) updatePerspectiveToolbar();
? dd->m_dashboardInfo->projects.first() : projectName;
if (targetProjectName.isEmpty()) {
updateDashboard(); updateDashboard();
return SetupResult::StopWithSuccess; 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) { const auto handler = [](const Dto::ProjectInfoDto &data) {
dd->m_currentProjectInfo = data; dd->m_currentProjectInfo = data;
if (!dd->m_currentProjectInfo->versions.empty()) if (!dd->m_currentProjectInfo->versions.empty())
@@ -822,6 +812,11 @@ Group projectInfoRecipe(const QString &projectName)
updateDashboard(); 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( taskTree.setRecipe(
fetchDataRecipe<Dto::ProjectInfoDto>(dd->m_dashboardInfo->source.resolved(*it), handler)); fetchDataRecipe<Dto::ProjectInfoDto>(dd->m_dashboardInfo->source.resolved(*it), handler));
return SetupResult::Continue; return SetupResult::Continue;