mirror of
https://github.com/ohwgiles/laminar.git
synced 2026-03-02 03:40:21 +00:00
allow setting a job description
adding DESCRIPTION=foo to $JOBNAME.conf will display "foo" in the job overview page on the frontend Resolves #97
This commit is contained in:
@@ -317,7 +317,8 @@ std::string Laminar::getStatus(MonitorScope scope) {
|
||||
j.set("number", build).set("started", started);
|
||||
j.EndObject();
|
||||
});
|
||||
|
||||
auto desc = jobDescriptions.find(scope.job);
|
||||
j.set("description", desc == jobDescriptions.end() ? "" : desc->second);
|
||||
} else if(scope.type == MonitorScope::ALL) {
|
||||
j.startArray("jobs");
|
||||
db->stmt("SELECT name,number,startedAt,completedAt,result FROM builds b JOIN (SELECT name n,MAX(number) l FROM builds GROUP BY n) q ON b.name = q.n AND b.number = q.l")
|
||||
@@ -543,6 +544,10 @@ bool Laminar::loadConfiguration() {
|
||||
ctxPtnList.insert(ctx);
|
||||
jobContexts[jobName].swap(ctxPtnList);
|
||||
}
|
||||
std::string desc = conf.get<std::string>("DESCRIPTION");
|
||||
if(!desc.empty()) {
|
||||
jobDescriptions[jobName] = desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ private:
|
||||
|
||||
std::unordered_map<std::string, std::set<std::string>> jobContexts;
|
||||
|
||||
std::unordered_map<std::string, std::string> jobDescriptions;
|
||||
|
||||
std::unordered_map<std::string, std::string> jobGroups;
|
||||
|
||||
Settings settings;
|
||||
|
||||
@@ -228,6 +228,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-5 col-md-6 col-lg-7">
|
||||
<h3>{{$route.params.name}}</h3>
|
||||
<div v-html="description"></div>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Last Successful Run</dt>
|
||||
<dd><router-link v-if="lastSuccess" :to="'/jobs/'+$route.params.name+'/'+lastSuccess.number">#{{lastSuccess.number}}</router-link> {{lastSuccess?' - at '+formatDate(lastSuccess.started):'never'}}</dd>
|
||||
|
||||
@@ -507,6 +507,7 @@ const Jobs = function() {
|
||||
|
||||
var Job = function() {
|
||||
var state = {
|
||||
description: '',
|
||||
jobsRunning: [],
|
||||
jobsRecent: [],
|
||||
lastSuccess: null,
|
||||
@@ -524,6 +525,7 @@ var Job = function() {
|
||||
},
|
||||
methods: {
|
||||
status: function(msg) {
|
||||
state.description = msg.description;
|
||||
state.jobsRunning = msg.running;
|
||||
state.jobsRecent = msg.recent;
|
||||
state.lastSuccess = msg.lastSuccess;
|
||||
|
||||
Reference in New Issue
Block a user