forked from qt-creator/qt-creator
Axivion: Remove AxivionQuery
Not needed anymore. Change-Id: Ieaf25e3ff3291a6d233ce4542c1ec55a0a97e7b3 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -7,7 +7,6 @@ add_qtc_plugin(Axivion
|
|||||||
axivionoutputpane.cpp axivionoutputpane.h
|
axivionoutputpane.cpp axivionoutputpane.h
|
||||||
axivionplugin.cpp axivionplugin.h
|
axivionplugin.cpp axivionplugin.h
|
||||||
axivionprojectsettings.h axivionprojectsettings.cpp
|
axivionprojectsettings.h axivionprojectsettings.cpp
|
||||||
axivionquery.h axivionquery.cpp
|
|
||||||
axivionresultparser.h axivionresultparser.cpp
|
axivionresultparser.h axivionresultparser.cpp
|
||||||
axivionsettings.cpp axivionsettings.h
|
axivionsettings.cpp axivionsettings.h
|
||||||
axiviontr.h
|
axiviontr.h
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ QtcPlugin {
|
|||||||
"axivionplugin.h",
|
"axivionplugin.h",
|
||||||
"axivionprojectsettings.h",
|
"axivionprojectsettings.h",
|
||||||
"axivionprojectsettings.cpp",
|
"axivionprojectsettings.cpp",
|
||||||
"axivionquery.h",
|
|
||||||
"axivionquery.cpp",
|
|
||||||
"axivionresultparser.h",
|
"axivionresultparser.h",
|
||||||
"axivionresultparser.cpp",
|
"axivionresultparser.cpp",
|
||||||
"axivionsettings.cpp",
|
"axivionsettings.cpp",
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
// Copyright (C) 2022 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "axivionquery.h"
|
|
||||||
|
|
||||||
#include "axivionplugin.h"
|
|
||||||
#include "axivionsettings.h"
|
|
||||||
|
|
||||||
#include <utils/processenums.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QUrl>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace Axivion::Internal {
|
|
||||||
|
|
||||||
AxivionQuery::AxivionQuery(QueryType type, const QStringList ¶meters)
|
|
||||||
: m_type(type)
|
|
||||||
, m_parameters(parameters)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AxivionQuery::toString() const
|
|
||||||
{
|
|
||||||
QString query = "/api"; // common for all except RuleInfo
|
|
||||||
switch (m_type) {
|
|
||||||
case NoQuery:
|
|
||||||
return {};
|
|
||||||
case DashboardInfo:
|
|
||||||
return query;
|
|
||||||
case ProjectInfo:
|
|
||||||
QTC_ASSERT(m_parameters.size() == 1, return {});
|
|
||||||
query += "/projects/" + QUrl::toPercentEncoding(m_parameters.first());
|
|
||||||
return query;
|
|
||||||
case IssuesForFileList:
|
|
||||||
QTC_ASSERT(m_parameters.size() == 3, return {});
|
|
||||||
// FIXME shall we validate the kind? (some kinds do not support path filter)
|
|
||||||
query += "/projects/" + QUrl::toPercentEncoding(m_parameters.first())
|
|
||||||
+ "/issues?kind=" + m_parameters.at(1) + "&filter_path="
|
|
||||||
+ QUrl::toPercentEncoding(m_parameters.at(2)) + "&format=csv";
|
|
||||||
return query;
|
|
||||||
case RuleInfo:
|
|
||||||
QTC_ASSERT(m_parameters.size() == 2, return {});
|
|
||||||
query = "/projects/" + QUrl::toPercentEncoding(m_parameters.first())
|
|
||||||
+ "/issues/" + m_parameters.at(1) + "/rule";
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
AxivionQueryRunner::AxivionQueryRunner(const AxivionQuery &query, QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
const AxivionServer server = settings().server;
|
|
||||||
|
|
||||||
QStringList args = server.curlArguments();
|
|
||||||
args << "-i";
|
|
||||||
args << "--header" << "Authorization: AxToken " + server.token;
|
|
||||||
|
|
||||||
QString url = server.dashboard;
|
|
||||||
while (url.endsWith('/')) url.chop(1);
|
|
||||||
url += query.toString();
|
|
||||||
args << url;
|
|
||||||
|
|
||||||
m_process.setCommand({settings().curl(), args});
|
|
||||||
connect(&m_process, &Process::done, this, [this]{
|
|
||||||
if (m_process.result() != ProcessResult::FinishedWithSuccess) {
|
|
||||||
const int exitCode = m_process.exitCode();
|
|
||||||
if (m_process.exitStatus() == QProcess::NormalExit
|
|
||||||
&& (exitCode == 35 || exitCode == 60)
|
|
||||||
&& handleCertificateIssue()) {
|
|
||||||
// prepend -k for re-requesting same query
|
|
||||||
CommandLine cmdline = m_process.commandLine();
|
|
||||||
cmdline.prependArgs({"-k"});
|
|
||||||
m_process.close();
|
|
||||||
m_process.setCommand(cmdline);
|
|
||||||
start();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emit resultRetrieved(m_process.rawStdErr());
|
|
||||||
} else {
|
|
||||||
emit resultRetrieved(m_process.rawStdOut());
|
|
||||||
}
|
|
||||||
emit finished();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void AxivionQueryRunner::start()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(!m_process.isRunning(), return);
|
|
||||||
m_process.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Axivion::Internal
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
// Copyright (C) 2022 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <utils/process.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace Axivion::Internal {
|
|
||||||
|
|
||||||
class AxivionQuery
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum QueryType {NoQuery, DashboardInfo, ProjectInfo, IssuesForFileList, RuleInfo};
|
|
||||||
explicit AxivionQuery(QueryType type, const QStringList ¶meters = {});
|
|
||||||
|
|
||||||
QString toString() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QueryType m_type = NoQuery;
|
|
||||||
QStringList m_parameters;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AxivionQueryRunner : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit AxivionQueryRunner(const AxivionQuery &query, QObject *parent = nullptr);
|
|
||||||
void start();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void finished();
|
|
||||||
void resultRetrieved(const QByteArray &json);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Utils::Process m_process;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // Axivion::Internal
|
|
||||||
Reference in New Issue
Block a user