1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2026-10-18 00:54:25 +00:00

refactor: remove run page json type hack

this hack tried to avoid sending unnecessary data to the frontend,
but it was more trouble than it's worth
This commit is contained in:
Oliver Giles
2019-11-01 07:27:34 +02:00
parent 39ca7e86cf
commit ba472711be
5 changed files with 42 additions and 19 deletions

View File

@@ -574,7 +574,7 @@ std::shared_ptr<Run> Laminar::queueJob(std::string name, ParamMap params) {
.startObject("data")
.set("name", name)
.EndObject();
http->notifyEvent("job_queued", j.str(), name.c_str());
http->notifyEvent(j.str(), name.c_str());
assignNewJobs();
return run;
@@ -666,7 +666,7 @@ bool Laminar::tryStartRun(std::shared_ptr<Run> run, int queueIndex) {
}
j.EndArray();
j.EndObject();
http->notifyEvent("job_started", j.str(), run->name.c_str(), run->build);
http->notifyEvent(j.str(), run->name.c_str());
return true;
}
}
@@ -755,7 +755,7 @@ void Laminar::runFinished(Run * r) {
populateArtifacts(j, r->name, r->build);
j.EndArray();
j.EndObject();
http->notifyEvent("job_completed", j.str(), r->name, r->build);
http->notifyEvent(j.str(), r->name);
http->notifyLog(r->name, r->build, "", true);
// erase reference to run from activeJobs. Since runFinished is called in a
// lambda whose context contains a shared_ptr<Run>, the run won't be deleted
@@ -797,7 +797,7 @@ bool Laminar::handleBadgeRequest(std::string job, std::string &badge) {
db->stmt("SELECT result FROM builds WHERE name = ? ORDER BY number DESC LIMIT 1")
.bind(job)
.fetch<int>([&](int result){
rs = (RunState) result;
rs = RunState(result);
});
if(rs == RunState::UNKNOWN)
return false;