Adapated information of update-progress-status.
This commit is contained in:
parent
705424727b
commit
fef1d43d5f
86
worker.cpp
86
worker.cpp
@ -171,8 +171,7 @@ void Worker::privateUpdate() {
|
|||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
||||||
|
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(5);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
||||||
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
||||||
@ -182,7 +181,7 @@ void Worker::privateUpdate() {
|
|||||||
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
|
|
||||||
setProgress(progress + 10);
|
setProgress(10);
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
@ -196,9 +195,7 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = 0;
|
m_returnCode = 0;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
|
setProgress(0);
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
@ -211,11 +208,9 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = -3;
|
m_returnCode = -3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_ismasClient.setProgressInPercent(10);
|
if (updateTriggerSet(5)) {
|
||||||
if (updateTriggerSet()) {
|
if (customerEnvironment(30)) {
|
||||||
m_ismasClient.setProgressInPercent(20);
|
m_ismasClient.setProgressInPercent(50);
|
||||||
if (customerEnvironment()) {
|
|
||||||
m_ismasClient.setProgressInPercent(30);
|
|
||||||
if (filesToUpdate()) {
|
if (filesToUpdate()) {
|
||||||
// send message to ISMAS about files which have been
|
// send message to ISMAS about files which have been
|
||||||
// checked in into git repository
|
// checked in into git repository
|
||||||
@ -225,23 +220,19 @@ void Worker::privateUpdate() {
|
|||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAContinues("CHECK-FILES-TO-UPDATE",
|
m_ismasClient.updateOfPSAContinues("CHECK-FILES-TO-UPDATE",
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
m_ismasClient.setProgressInPercent(40);
|
if (updateFiles(60)) {
|
||||||
if (updateFiles(50)) {
|
m_ismasClient.setProgressInPercent(70);
|
||||||
m_ismasClient.setProgressInPercent(50);
|
|
||||||
if (syncCustomerRepositoryAndFS()) {
|
if (syncCustomerRepositoryAndFS()) {
|
||||||
m_ismasClient.setProgressInPercent(60);
|
m_ismasClient.setProgressInPercent(80);
|
||||||
if (sendIsmasLastVersionNotification()) {
|
if (sendIsmasLastVersionNotification()) {
|
||||||
m_ismasClient.setProgressInPercent(70);
|
m_ismasClient.setProgressInPercent(90);
|
||||||
sentIsmasLastVersionNotification = true;
|
sentIsmasLastVersionNotification = true;
|
||||||
if (saveLogFile()) {
|
if (saveLogFile()) {
|
||||||
m_ismasClient.setProgressInPercent(80);
|
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSASucceeded(""));
|
m_ismasClient.updateOfPSASucceeded(""));
|
||||||
|
|
||||||
// mark update as activated -> this resets the WAIT button
|
// mark update as activated -> this resets the WAIT button
|
||||||
m_ismasClient.setProgressInPercent(95);
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAActivated());
|
m_ismasClient.updateOfPSAActivated());
|
||||||
@ -416,7 +407,7 @@ std::optional<QString> Worker::getApismVersion() {
|
|||||||
|
|
||||||
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
||||||
|
|
||||||
bool Worker::updateTriggerSet() {
|
bool Worker::updateTriggerSet(int progress) {
|
||||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -452,8 +443,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
= IsmasClient::sendRequestReceiveResponse(
|
= IsmasClient::sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
QString msg = result.value();
|
QString msg = result.value();
|
||||||
|
|
||||||
@ -492,15 +482,13 @@ bool Worker::updateTriggerSet() {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
QJsonObject obj = document.object();
|
QJsonObject obj = document.object();
|
||||||
|
|
||||||
// always look for an 'error' first
|
// always look for an 'error' first
|
||||||
if (obj.contains("error")) {
|
if (obj.contains("error")) {
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
QString value = obj.value("error").toString();
|
QString value = obj.value("error").toString();
|
||||||
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
||||||
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
||||||
@ -585,8 +573,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
if (obj.contains("Fileupload")) {
|
if (obj.contains("Fileupload")) {
|
||||||
QJsonValue v = obj.value("Fileupload");
|
QJsonValue v = obj.value("Fileupload");
|
||||||
@ -604,11 +591,17 @@ bool Worker::updateTriggerSet() {
|
|||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
||||||
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
||||||
.arg(m_machineNr).arg(m_customerNr));
|
.arg(m_machineNr).arg(m_customerNr));
|
||||||
|
|
||||||
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
|
|
||||||
|
progress += 5;
|
||||||
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
||||||
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
@ -620,9 +613,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
progress += 1;
|
|
||||||
setProgress(progress);
|
|
||||||
emit showErrorMessage("check update trigger", "empty update-trigger");
|
emit showErrorMessage("check update trigger", "empty update-trigger");
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
@ -677,9 +668,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
progress += 1;
|
|
||||||
setProgress(progress);
|
|
||||||
emit showErrorMessage("check update trigger", "no ISMAS response");
|
emit showErrorMessage("check update trigger", "no ISMAS response");
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
}
|
}
|
||||||
@ -697,14 +686,14 @@ bool Worker::updateTriggerSet() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::customerEnvironment() {
|
bool Worker::customerEnvironment(int progress) {
|
||||||
emit appendText("\nPrepare customer environment ...");
|
emit appendText("\nPrepare customer environment ...");
|
||||||
if (QDir(m_customerRepository).exists()) {
|
if (QDir(m_customerRepository).exists()) {
|
||||||
startProgressLoop();
|
startProgressLoop();
|
||||||
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
if (m_gc.gitCheckoutBranch()) {
|
if (m_gc.gitCheckoutBranch()) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
||||||
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
||||||
@ -719,8 +708,8 @@ bool Worker::customerEnvironment() {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
m_ismasClient.setProgressInPercent(0);
|
||||||
setProgress(progress);
|
|
||||||
emit showErrorMessage("cust-env",
|
emit showErrorMessage("cust-env",
|
||||||
QString("Checkout ") + m_customerRepository + " failed");
|
QString("Checkout ") + m_customerRepository + " failed");
|
||||||
Utils::printCriticalErrorMsg(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
Utils::printCriticalErrorMsg(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
||||||
@ -756,17 +745,10 @@ bool Worker::filesToUpdate() {
|
|||||||
|
|
||||||
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
||||||
|
|
||||||
int const size = m_filesToUpdate.size();
|
stopProgressLoop();
|
||||||
if (size > 1) {
|
setProgress(100);
|
||||||
emit appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
|
||||||
for (int i = 0; i < size; ++i) {
|
return false;
|
||||||
emit appendText(QString("\n ") + m_filesToUpdate.at(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
emit appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
|
||||||
emit appendText(QString("\n ") + m_filesToUpdate.at(0));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
emit showErrorMessage("files to update", "pulling files failed");
|
emit showErrorMessage("files to update", "pulling files failed");
|
||||||
Utils::printCriticalErrorMsg("PULLING FILES FAILED");
|
Utils::printCriticalErrorMsg("PULLING FILES FAILED");
|
||||||
@ -785,9 +767,7 @@ bool Worker::filesToUpdate() {
|
|||||||
QString("no changes in ") + m_customerRepository +
|
QString("no changes in ") + m_customerRepository +
|
||||||
" (checked-in any files?)");
|
" (checked-in any files?)");
|
||||||
|
|
||||||
Utils::printCriticalErrorMsg("NO CHANGES IN "
|
setProgress(progress + 30);
|
||||||
+ m_customerRepository
|
|
||||||
+ " (CHECKED IN ANY FILES?)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
||||||
|
Loading…
Reference in New Issue
Block a user