fix: Fix status updates, add color to status
This commit is contained in:
parent
05b909c76e
commit
b4df925f8e
21
lib/vuln.go
21
lib/vuln.go
@ -34,6 +34,25 @@ func ValidSeverity(s string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (v Vuln) StatusColor() string {
|
||||
switch v.Status {
|
||||
case "Waiting for review":
|
||||
return "blue"
|
||||
case "Ongoing review":
|
||||
return "blue"
|
||||
case "Working on a patch":
|
||||
return "blue"
|
||||
case "Won't patch":
|
||||
return "red"
|
||||
case "Patched":
|
||||
return "green"
|
||||
case "Not affected":
|
||||
return "red"
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetID() string {
|
||||
now := time.Now()
|
||||
mic := strconv.FormatInt(now.UnixMicro(), 10)
|
||||
@ -109,7 +128,7 @@ func UpdateVuln(v Vuln) error {
|
||||
}
|
||||
|
||||
_, err = smt.Exec(v.Status, v.Message,
|
||||
v.Author, v.Severity, v.ID, GetFTime())
|
||||
v.Author, v.Severity, GetFTime(), v.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td>
|
||||
<strong>{{.v.Status}}</strong>
|
||||
<strong style="color: var(--{{.v.StatusColor}})">{{.v.Status}}</strong>
|
||||
</br>{{.v.Message}}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -50,7 +50,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<div class="vuln-footer">
|
||||
<p><strong>Status:</strong> {{.Status}}</p>
|
||||
<p style="color: var(--{{.StatusColor}})"><strong>Status:</strong> {{.Status}}</p>
|
||||
<a href="/details/{{.ID}}">View details</a>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user