forked from qt-creator/qt-creator
Axivion: Handle owner parameter for issues
Beside this extracted recurring pattern into helper function. Change-Id: I48c34cac80bcc43ac7b0c6f7250bf8a8943869a9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -224,6 +224,7 @@ private:
|
|||||||
void onSearchParameterChanged();
|
void onSearchParameterChanged();
|
||||||
void updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> info);
|
void updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> info);
|
||||||
void updateTableView();
|
void updateTableView();
|
||||||
|
IssueListSearch searchFromUi() const;
|
||||||
void fetchIssues(const IssueListSearch &search);
|
void fetchIssues(const IssueListSearch &search);
|
||||||
void fetchMoreIssues();
|
void fetchMoreIssues();
|
||||||
|
|
||||||
@@ -282,6 +283,7 @@ IssuesWidget::IssuesWidget(QWidget *parent)
|
|||||||
m_ownerFilter = new QComboBox(this);
|
m_ownerFilter = new QComboBox(this);
|
||||||
m_ownerFilter->setToolTip(Tr::tr("Owner"));
|
m_ownerFilter->setToolTip(Tr::tr("Owner"));
|
||||||
m_ownerFilter->setMinimumContentsLength(25);
|
m_ownerFilter->setMinimumContentsLength(25);
|
||||||
|
connect(m_ownerFilter, &QComboBox::activated, this, &IssuesWidget::onSearchParameterChanged);
|
||||||
m_filtersLayout->addWidget(m_ownerFilter);
|
m_filtersLayout->addWidget(m_ownerFilter);
|
||||||
m_pathGlobFilter = new QLineEdit(this);
|
m_pathGlobFilter = new QLineEdit(this);
|
||||||
m_pathGlobFilter->setPlaceholderText(Tr::tr("Path globbing"));
|
m_pathGlobFilter->setPlaceholderText(Tr::tr("Path globbing"));
|
||||||
@@ -430,12 +432,8 @@ void IssuesWidget::onSearchParameterChanged()
|
|||||||
// new "first" time lookup
|
// new "first" time lookup
|
||||||
m_totalRowCount = 0;
|
m_totalRowCount = 0;
|
||||||
m_lastRequestedOffset = 0;
|
m_lastRequestedOffset = 0;
|
||||||
IssueListSearch search;
|
IssueListSearch search = searchFromUi();
|
||||||
search.kind = m_currentPrefix;
|
|
||||||
search.versionStart = m_versionStart->currentData().toString();
|
|
||||||
search.versionEnd = m_versionEnd->currentData().toString();
|
|
||||||
search.computeTotalRowCount = true;
|
search.computeTotalRowCount = true;
|
||||||
|
|
||||||
fetchIssues(search);
|
fetchIssues(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,16 +504,23 @@ void IssuesWidget::updateTableView()
|
|||||||
// first time lookup... should we cache and maybe represent old data?
|
// first time lookup... should we cache and maybe represent old data?
|
||||||
m_totalRowCount = 0;
|
m_totalRowCount = 0;
|
||||||
m_lastRequestedOffset = 0;
|
m_lastRequestedOffset = 0;
|
||||||
IssueListSearch search;
|
IssueListSearch search = searchFromUi();
|
||||||
search.kind = m_currentPrefix;
|
|
||||||
search.computeTotalRowCount = true;
|
search.computeTotalRowCount = true;
|
||||||
search.versionStart = m_versionStart->currentData().toString();
|
|
||||||
search.versionEnd = m_versionEnd->currentData().toString();
|
|
||||||
fetchIssues(search);
|
fetchIssues(search);
|
||||||
};
|
};
|
||||||
m_taskTreeRunner.start(tableInfoRecipe(m_currentPrefix, tableHandler), setupHandler, doneHandler);
|
m_taskTreeRunner.start(tableInfoRecipe(m_currentPrefix, tableHandler), setupHandler, doneHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IssueListSearch IssuesWidget::searchFromUi() const
|
||||||
|
{
|
||||||
|
IssueListSearch search;
|
||||||
|
search.kind = m_currentPrefix; // not really ui.. but anyhow
|
||||||
|
search.owner = m_ownerFilter->currentText();
|
||||||
|
search.versionStart = m_versionStart->currentData().toString();
|
||||||
|
search.versionEnd = m_versionEnd->currentData().toString();
|
||||||
|
return search;
|
||||||
|
}
|
||||||
|
|
||||||
void IssuesWidget::fetchIssues(const IssueListSearch &search)
|
void IssuesWidget::fetchIssues(const IssueListSearch &search)
|
||||||
{
|
{
|
||||||
const auto issuesHandler = [this](const Dto::IssueTableDto &dto) { addIssues(dto); };
|
const auto issuesHandler = [this](const Dto::IssueTableDto &dto) { addIssues(dto); };
|
||||||
@@ -529,12 +534,9 @@ void IssuesWidget::fetchMoreIssues()
|
|||||||
if (m_lastRequestedOffset == m_issuesModel->rowCount())
|
if (m_lastRequestedOffset == m_issuesModel->rowCount())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IssueListSearch search;
|
IssueListSearch search = searchFromUi();
|
||||||
search.kind = m_currentPrefix;
|
|
||||||
m_lastRequestedOffset = m_issuesModel->rowCount();
|
m_lastRequestedOffset = m_issuesModel->rowCount();
|
||||||
search.offset = m_lastRequestedOffset;
|
search.offset = m_lastRequestedOffset;
|
||||||
search.versionStart = m_versionStart->currentData().toString();
|
|
||||||
search.versionEnd = m_versionEnd->currentData().toString();
|
|
||||||
fetchIssues(search);
|
fetchIssues(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -114,6 +114,10 @@ QString IssueListSearch::toQuery() const
|
|||||||
result.append(QString("&end=%1").arg(
|
result.append(QString("&end=%1").arg(
|
||||||
QString::fromUtf8(QUrl::toPercentEncoding(versionEnd))));
|
QString::fromUtf8(QUrl::toPercentEncoding(versionEnd))));
|
||||||
}
|
}
|
||||||
|
if (!owner.isEmpty()) {
|
||||||
|
result.append(QString("&user=%1").arg(
|
||||||
|
QString::fromUtf8((QUrl::toPercentEncoding(owner)))));
|
||||||
|
}
|
||||||
if (!filter_path.isEmpty()) {
|
if (!filter_path.isEmpty()) {
|
||||||
result.append(QString("&filter_path=%1").arg(
|
result.append(QString("&filter_path=%1").arg(
|
||||||
QString::fromUtf8(QUrl::toPercentEncoding(filter_path))));
|
QString::fromUtf8(QUrl::toPercentEncoding(filter_path))));
|
||||||
|
Reference in New Issue
Block a user