Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+41
-42
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
#ifndef ELOG
|
||||
#define ELOG ERROR_LOG()
|
||||
#define ELOG ERROR_LOG(m_logger)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -44,17 +44,16 @@ namespace TakeHomePackageManager
|
||||
{
|
||||
|
||||
|
||||
HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
: QObject(parent)
|
||||
HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent) : QObject(parent)
|
||||
, m_esi(esi)
|
||||
, m_process(new ProcessOverlay)
|
||||
, m_nam(new QNetworkAccessManager(this))
|
||||
, m_timeout(new QTimer(this))
|
||||
{
|
||||
, m_timeout(new QTimer(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(m_process, &ProcessOverlay::signalCancel,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG() << "m_wasCanceled!!";
|
||||
DEBUG_LOG(m_logger) << "m_wasCanceled!!";
|
||||
m_wasCanceled = true;
|
||||
m_process->setCancelEnabled(false);
|
||||
});
|
||||
@@ -71,12 +70,12 @@ HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
bool k = false;
|
||||
int _timeout = timeoutVar.toInt(&k);
|
||||
|
||||
DEBUG_LOG() << "TPM.Timeout debug value set! k = " << k << "_timeout = " << _timeout;
|
||||
DEBUG_LOG(m_logger) << "TPM.Timeout debug value set! k = " << k << "_timeout = " << _timeout;
|
||||
|
||||
if (k)
|
||||
{
|
||||
timeout = _timeout;
|
||||
DEBUG_LOG() << "new timeout set to " << timeout;
|
||||
DEBUG_LOG(m_logger) << "new timeout set to " << timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +88,7 @@ HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
{
|
||||
stopTimeout();
|
||||
new LtsWidgets::LtsMessageDialogNew(qobject_cast<QWidget *>(this->parent()), tr("Timeout occured during the operation - aborted"));
|
||||
WARNING_LOG() << "Timeout occured during the operation - aborted";
|
||||
WARNING_LOG(m_logger) << "Timeout occured during the operation - aborted";
|
||||
m_isTimeout = true;
|
||||
|
||||
emit signalTimeout();
|
||||
@@ -99,7 +98,7 @@ HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent)
|
||||
|
||||
HttpProcess::~HttpProcess()
|
||||
{
|
||||
DEBUG_LOG() << "~HttpProcess";
|
||||
DEBUG_LOG(m_logger) << "~HttpProcess";
|
||||
delete m_process;
|
||||
|
||||
}
|
||||
@@ -175,7 +174,7 @@ QNetworkReply *HttpProcess::deleteResource(const QString &path, const QUrlQuery
|
||||
|
||||
void HttpProcess::slotSuccess()
|
||||
{
|
||||
DEBUG_LOG() << "success";
|
||||
DEBUG_LOG(m_logger) << "success";
|
||||
|
||||
stopTimeout();
|
||||
if (!m_isError && !m_wasCanceled && !m_isTimeout)
|
||||
@@ -185,7 +184,7 @@ void HttpProcess::slotSuccess()
|
||||
|
||||
void HttpProcess::slotError()
|
||||
{
|
||||
DEBUG_LOG() << "error";
|
||||
DEBUG_LOG(m_logger) << "error";
|
||||
|
||||
stopTimeout();
|
||||
|
||||
@@ -207,7 +206,7 @@ void HttpProcess::slotError()
|
||||
|
||||
void HttpProcess::slotReadyRead()
|
||||
{
|
||||
DEBUG_LOG() << "readyRead";
|
||||
DEBUG_LOG(m_logger) << "readyRead";
|
||||
resetTimeout();
|
||||
|
||||
QNetworkReply *r = qobject_cast<QNetworkReply *>(sender());
|
||||
@@ -354,23 +353,23 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
|
||||
|
||||
|
||||
DEBUG_LOG() << "TPM.TestBigFile? " << LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")).toString();
|
||||
DEBUG_LOG() << "TPM.TestBigFile check? "
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile? " << LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")).toString();
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile check? "
|
||||
<< (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true));
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true))
|
||||
#endif
|
||||
{
|
||||
DEBUG_LOG() << "TPM.TestBigFile!!";
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile!!";
|
||||
|
||||
if (QGuiApplication::queryKeyboardModifiers() == Qt::ControlModifier)
|
||||
{
|
||||
QFile test(QStringLiteral("%1/%2/big.file").arg(ExportedScriptsDialog::getContentFolder(m_rootDir, m_esi.exerciseId), dstDir));
|
||||
DEBUG_LOG() << ">>> BIG FILE ACTIVE ("<<test.fileName()<<")";
|
||||
DEBUG_LOG(m_logger) << ">>> BIG FILE ACTIVE ("<<test.fileName()<<")";
|
||||
|
||||
bool ret = test.open(QIODevice::ReadWrite);
|
||||
DEBUG_LOG() << "ret? " << ret;
|
||||
DEBUG_LOG(m_logger) << "ret? " << ret;
|
||||
Q_ASSERT(ret);
|
||||
|
||||
|
||||
@@ -380,7 +379,7 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
QFile rng(QStringLiteral("/dev/urandom"));
|
||||
|
||||
ret = rng.open(QIODevice::ReadOnly);
|
||||
DEBUG_LOG() << "ret? " << ret;
|
||||
DEBUG_LOG(m_logger) << "ret? " << ret;
|
||||
Q_ASSERT(ret);
|
||||
|
||||
int times = 1024 * 1024;
|
||||
@@ -391,15 +390,15 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
int _times = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(bigFileSize).toInt(&k);
|
||||
|
||||
if (!k)
|
||||
DEBUG_LOG() << "Invalid value for " << bigFileSize;
|
||||
DEBUG_LOG(m_logger) << "Invalid value for " << bigFileSize;
|
||||
else
|
||||
{
|
||||
times = _times;
|
||||
DEBUG_LOG() << "big file size was set to " << times;
|
||||
DEBUG_LOG(m_logger) << "big file size was set to " << times;
|
||||
}
|
||||
}
|
||||
else
|
||||
DEBUG_LOG() << "TPM.TestBigFile.Size not set - using default of " << times;
|
||||
DEBUG_LOG(m_logger) << "TPM.TestBigFile.Size not set - using default of " << times;
|
||||
|
||||
|
||||
for (int i = 0; i < times; i++)
|
||||
@@ -411,7 +410,7 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
test.flush();
|
||||
|
||||
m_tempFile->setAutoRemove(false);
|
||||
DEBUG_LOG() << "big compressed file: " << m_tempFile->fileName();
|
||||
DEBUG_LOG(m_logger) << "big compressed file: " << m_tempFile->fileName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,9 +418,9 @@ UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformatio
|
||||
connect(m_compress, &NGL::Compress::finished,
|
||||
this, &UploadProcess::compressionDone);
|
||||
|
||||
DEBUG_LOG() << "compress called...";
|
||||
DEBUG_LOG(m_logger) << "compress called...";
|
||||
m_compress->compress(m_tempFile, srcDir, dstDir);
|
||||
DEBUG_LOG() << "...!";
|
||||
DEBUG_LOG(m_logger) << "...!";
|
||||
}
|
||||
|
||||
|
||||
@@ -436,17 +435,17 @@ void UploadProcess::abortCompress()
|
||||
|
||||
void UploadProcess::compressionDone()
|
||||
{
|
||||
DEBUG_LOG() << "m_wasCanceled = " << m_wasCanceled << ", compress success = " << m_compress->success();
|
||||
DEBUG_LOG(m_logger) << "m_wasCanceled = " << m_wasCanceled << ", compress success = " << m_compress->success();
|
||||
stopTimeout();
|
||||
|
||||
if (!m_compress->success() || m_wasCanceled)
|
||||
{
|
||||
DEBUG_LOG() << "compression aborted";
|
||||
DEBUG_LOG(m_logger) << "compression aborted";
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "okay";
|
||||
DEBUG_LOG(m_logger) << "okay";
|
||||
|
||||
QUrlQuery q;
|
||||
q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId));
|
||||
@@ -455,7 +454,7 @@ void UploadProcess::compressionDone()
|
||||
q.addQueryItem(QStringLiteral("name"), m_esi.scriptName);
|
||||
|
||||
|
||||
DEBUG_LOG() << "posting file of size " << m_tempFile->size();
|
||||
DEBUG_LOG(m_logger) << "posting file of size " << m_tempFile->size();
|
||||
m_tempFile->seek(0);
|
||||
|
||||
QNetworkReply *rep = post(QStringLiteral("/thp"), m_tempFile, q);
|
||||
@@ -463,7 +462,7 @@ void UploadProcess::compressionDone()
|
||||
connect(this, &HttpProcess::signalSuccess,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG() << "Uploaded script successfully";
|
||||
DEBUG_LOG(m_logger) << "Uploaded script successfully";
|
||||
new LtsWidgets::LtsMessageDialogNew(qobject_cast<QWidget *>(parent()), tr("Uploaded script successfully"));
|
||||
deleteLater();
|
||||
});
|
||||
@@ -612,7 +611,7 @@ void DownloadProcess::downloadFinished()
|
||||
{
|
||||
stopTimeout();
|
||||
|
||||
DEBUG_LOG() << "m_compress->success()? " << m_compress->success() << ", m_wasCanceled? " << m_wasCanceled << ", m_isError? " << m_isError;
|
||||
DEBUG_LOG(m_logger) << "m_compress->success()? " << m_compress->success() << ", m_wasCanceled? " << m_wasCanceled << ", m_isError? " << m_isError;
|
||||
if (m_compress->success() && !m_wasCanceled && !m_isError)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(qobject_cast<QWidget *>(parent()), tr("Downloaded script successfully"));
|
||||
@@ -858,7 +857,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
if (!QDir().mkpath(getContentFolder(m_exerciseId)))
|
||||
{
|
||||
QString msg(tr("Cannot create script folder at %1").arg(getContentFolder(m_exerciseId)));
|
||||
ERROR_LOG() << msg;
|
||||
ERROR_LOG(m_logger) << msg;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -875,7 +874,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
#else
|
||||
NGL::Settings *s = new NGL::Settings(NGL::findProjectConfigFile());
|
||||
const QString hostname = s->getString(QStringLiteral("TabOC"), QStringLiteral("remoteServerHostname"), QStringLiteral("exctds01"));
|
||||
WARNING_LOG() << "Hostname used for THP: " << hostname;
|
||||
WARNING_LOG(m_logger) << "Hostname used for THP: " << hostname;
|
||||
sock->open(QUrl(QStringLiteral("ws://%1:%2/thp").arg(hostname).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER))));
|
||||
delete s;
|
||||
#endif
|
||||
@@ -904,7 +903,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
connect(sock, &QWebSocket::disconnected,
|
||||
this, [this, sock, openFn]()
|
||||
{
|
||||
WARNING_LOG() << "disconnected from ws... reconnecting in 3...";
|
||||
WARNING_LOG(m_logger) << "disconnected from ws... reconnecting in 3...";
|
||||
setWsConnectionStatus(WsConnectionStatus::Disconnected);
|
||||
|
||||
QTimer *t = new QTimer(sock);
|
||||
@@ -925,7 +924,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
connect(sock, &QWebSocket::textMessageReceived,
|
||||
this, [this](const QString &msg)
|
||||
{
|
||||
DEBUG_LOG() << "new msg: '" << msg << "'";
|
||||
DEBUG_LOG(m_logger) << "new msg: '" << msg << "'";
|
||||
m_lastServerContent = msg;
|
||||
m_model->setServerContent(msg);
|
||||
onSelectionChanged();
|
||||
@@ -938,7 +937,7 @@ bool ExportedScriptsDialog::init(LtsSession::LtsSession *session)
|
||||
|
||||
bool ExportedScriptsDialog::initModel()
|
||||
{
|
||||
DEBUG_LOG() << "(re)initModel !!";
|
||||
DEBUG_LOG(m_logger) << "(re)initModel !!";
|
||||
|
||||
QString rootDirectory(getRootFolder());
|
||||
|
||||
@@ -1017,7 +1016,7 @@ void ExportedScriptsDialog::downloadScript()
|
||||
|
||||
if (!mi.isValid())
|
||||
{
|
||||
ERROR_LOG() << "could not update model data after download! cover up..";
|
||||
ERROR_LOG(m_logger) << "could not update model data after download! cover up..";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1053,7 +1052,7 @@ void ExportedScriptsDialog::removeScriptFromServer()
|
||||
|
||||
if (!mi.isValid())
|
||||
{
|
||||
ERROR_LOG() << "could not update model data after deletion! cover up..";
|
||||
ERROR_LOG(m_logger) << "could not update model data after deletion! cover up..";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1089,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false);
|
||||
|
||||
QString currentDirectory = QStringLiteral("%1/%2").arg(getContentFolder(esi.exerciseId), QString::number(esi.scriptId));
|
||||
DEBUG_LOG() << "currentDirectory=" << currentDirectory;
|
||||
DEBUG_LOG(m_logger) << "currentDirectory=" << currentDirectory;
|
||||
|
||||
QDir d(currentDirectory);
|
||||
if (!d.removeRecursively())
|
||||
@@ -1118,7 +1117,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
if (err.error != QJsonParseError::NoError)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot read index file"), removingScriptFailedText);
|
||||
ERROR_LOG() << "Cannot read index file at offset" << err.offset << ": " << err.errorString();
|
||||
ERROR_LOG(m_logger) << "Cannot read index file at offset" << err.offset << ": " << err.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1145,7 +1144,7 @@ void ExportedScriptsDialog::removeScriptLocal()
|
||||
|
||||
if (scriptId == -1)
|
||||
{
|
||||
WARNING_LOG() << "cannot find scriptId in presentations array object from data.json";
|
||||
WARNING_LOG(m_logger) << "cannot find scriptId in presentations array object from data.json";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1192,7 +1191,7 @@ void ExportedScriptsDialog::openScript()
|
||||
args.append(QStringLiteral("-t"));
|
||||
args.append(pathToScript);
|
||||
|
||||
DEBUG_LOG() << "pathToScript: " << pathToScript;
|
||||
DEBUG_LOG(m_logger) << "pathToScript: " << pathToScript;
|
||||
|
||||
#ifndef WIN32
|
||||
QProcess().startDetached(QLatin1String("./thp_viewer"), args, QCoreApplication::applicationDirPath());
|
||||
|
||||
+3
@@ -67,6 +67,9 @@ protected slots:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void doConnections(QNetworkReply *r);
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user