forked from qt-creator/qt-creator
Axivion: Reuse resolveDashboardInfoUrl()
Change-Id: Ic8627be0353e7a789cd569030da91bb46751c885 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1074,18 +1074,17 @@ void AxivionPerspective::resetDashboard()
|
||||
|
||||
bool AxivionPerspective::handleContextMenu(const QString &issue, const ItemViewEvent &e)
|
||||
{
|
||||
std::optional<Dto::TableInfoDto> tableInfoOpt = m_issuesWidget->currentTableInfo();
|
||||
if (!currentDashboardInfo())
|
||||
return false;
|
||||
const std::optional<Dto::TableInfoDto> tableInfoOpt = m_issuesWidget->currentTableInfo();
|
||||
if (!tableInfoOpt)
|
||||
return false;
|
||||
const QString baseUri = tableInfoOpt->issueBaseViewUri.value_or(QString());
|
||||
if (baseUri.isEmpty())
|
||||
return false;
|
||||
auto info = currentDashboardInfo();
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
QUrl issueBaseUrl = info->source.resolved(baseUri).resolved(issue);
|
||||
QUrl dashboardUrl = info->source.resolved(baseUri);
|
||||
QUrl dashboardUrl = resolveDashboardInfoUrl(baseUri);
|
||||
QUrl issueBaseUrl = dashboardUrl.resolved(issue);
|
||||
const IssueListSearch search = m_issuesWidget->searchFromUi();
|
||||
issueBaseUrl.setQuery(search.toUrlQuery(QueryMode::SimpleQuery));
|
||||
dashboardUrl.setQuery(search.toUrlQuery(QueryMode::FilterQuery));
|
||||
@@ -1147,11 +1146,9 @@ void AxivionPerspective::updateToolbarButtons()
|
||||
|
||||
void AxivionPerspective::openFilterHelp()
|
||||
{
|
||||
std::optional<DashboardInfo> dashboardInfo = currentDashboardInfo();
|
||||
QTC_ASSERT(dashboardInfo, return);
|
||||
std::optional<Dto::ProjectInfoDto> projInfo = projectInfo();
|
||||
const std::optional<Dto::ProjectInfoDto> projInfo = projectInfo();
|
||||
if (projInfo && projInfo->issueFilterHelp)
|
||||
QDesktopServices::openUrl(dashboardInfo->source.resolved(*projInfo->issueFilterHelp));
|
||||
QDesktopServices::openUrl(resolveDashboardInfoUrl(*projInfo->issueFilterHelp));
|
||||
}
|
||||
|
||||
static QPointer<AxivionPerspective> theAxivionPerspective;
|
||||
|
@@ -364,7 +364,7 @@ static QUrl constructUrl(const QString &projectName, const QString &subPath, con
|
||||
return {};
|
||||
const QByteArray encodedProjectName = QUrl::toPercentEncoding(projectName);
|
||||
const QUrl path(QString{"api/projects/" + QString::fromUtf8(encodedProjectName) + '/'});
|
||||
QUrl url = dd->m_dashboardInfo->source.resolved(path);
|
||||
QUrl url = resolveDashboardInfoUrl(path);
|
||||
if (!subPath.isEmpty() && QTC_GUARD(!subPath.startsWith('/')))
|
||||
url = url.resolved(subPath);
|
||||
if (!query.isEmpty())
|
||||
@@ -396,6 +396,8 @@ static QByteArray contentTypeData(ContentType contentType)
|
||||
|
||||
QUrl resolveDashboardInfoUrl(const QUrl &resource)
|
||||
{
|
||||
QTC_ASSERT(dd, return {});
|
||||
QTC_ASSERT(dd->m_dashboardInfo, return {});
|
||||
return dd->m_dashboardInfo->source.resolved(resource);
|
||||
}
|
||||
|
||||
@@ -649,8 +651,7 @@ static Group authorizationRecipe()
|
||||
return SetupResult::StopWithError;
|
||||
|
||||
apiTokenStorage->credential = dashboardStorage->credential;
|
||||
apiTokenStorage->url
|
||||
= dd->m_dashboardInfo->source.resolved(*dashboardDto.userApiTokenUrl);
|
||||
apiTokenStorage->url = resolveDashboardInfoUrl(*dashboardDto.userApiTokenUrl);
|
||||
apiTokenStorage->csrfToken = dashboardDto.csrfToken.toUtf8();
|
||||
const Dto::ApiTokenCreationRequestDto requestDto{*passwordStorage, "IdePlugin",
|
||||
apiTokenDescription(), 0};
|
||||
@@ -832,8 +833,8 @@ Group projectInfoRecipe(const QString &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<Dto::ProjectInfoDto>(dd->m_dashboardInfo->source.resolved(*it), handler));
|
||||
taskTree.setRecipe(fetchDataRecipe<Dto::ProjectInfoDto>(resolveDashboardInfoUrl(*it),
|
||||
handler));
|
||||
return SetupResult::Continue;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user