Save name of trigger in problem
This commit is contained in:
parent
09241e73a5
commit
4d7f0d557e
11
problem.go
11
problem.go
@ -39,13 +39,13 @@ func ProblemsRetrieve(showCurrent bool, from, to time.Time) (problems []Problem,
|
|||||||
p.acknowledged,
|
p.acknowledged,
|
||||||
p.datapoints,
|
p.datapoints,
|
||||||
t.id AS trigger_id,
|
t.id AS trigger_id,
|
||||||
t.name AS trigger_name,
|
p.trigger_name AS trigger_name,
|
||||||
a.name AS area_name,
|
a.name AS area_name,
|
||||||
s.name AS section_name
|
s.name AS section_name
|
||||||
FROM problem p
|
FROM problem p
|
||||||
INNER JOIN "trigger" t ON p.trigger_id = t.id
|
LEFT JOIN "trigger" t ON p.trigger_id = t.id
|
||||||
INNER JOIN section s ON t.section_id = s.id
|
LEFT JOIN section s ON t.section_id = s.id
|
||||||
INNER JOIN area a ON s.area_id = a.id
|
LEFT JOIN area a ON s.area_id = a.id
|
||||||
WHERE
|
WHERE
|
||||||
CASE
|
CASE
|
||||||
WHEN NOT $1 THEN p.end IS NULL
|
WHEN NOT $1 THEN p.end IS NULL
|
||||||
@ -125,8 +125,9 @@ func ProblemStart(trigger Trigger) (problemID int, err error) { // {{{
|
|||||||
if openProblems == 0 {
|
if openProblems == 0 {
|
||||||
datapointValuesJson, _ := json.Marshal(trigger.DatapointValues)
|
datapointValuesJson, _ := json.Marshal(trigger.DatapointValues)
|
||||||
row = service.Db.Conn.QueryRow(
|
row = service.Db.Conn.QueryRow(
|
||||||
`INSERT INTO problem(trigger_id, datapoints, trigger_expression) VALUES($1, $2, $3) RETURNING id`,
|
`INSERT INTO problem(trigger_id, trigger_name, datapoints, trigger_expression) VALUES($1, $2, $3, $4) RETURNING id`,
|
||||||
trigger.ID,
|
trigger.ID,
|
||||||
|
trigger.Name,
|
||||||
datapointValuesJson,
|
datapointValuesJson,
|
||||||
trigger.Expression,
|
trigger.Expression,
|
||||||
)
|
)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<div class="display-list hidden">
|
<div class="display-list hidden">
|
||||||
<div id="problems-list">
|
<div id="problems-list">
|
||||||
<div style="grid-column: 1/-1;"><h2>Current</h2></div>
|
<div style="grid-column: 1/-1;"><h2>Unacknowledged</h2></div>
|
||||||
|
|
||||||
<div class="header">Trigger</div>
|
<div class="header">Trigger</div>
|
||||||
<div class="header">Area</div>
|
<div class="header">Area</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user