mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-21 03:28:46 +00:00
refactor: Replace if-else chain with switch statement in showAlerts severity styling
- Replace if-else chain with switch statement for severity level styling - Maintain existing logic: High maps to ERROR style, Medium maps to WARNING style - Improve code readability and maintainability
This commit is contained in:
@@ -104,9 +104,10 @@ func showAlerts(u *uiContext) error {
|
|||||||
}
|
}
|
||||||
for _, r := range rows {
|
for _, r := range rows {
|
||||||
style := statusStyle(strings.ToUpper(r[0]))
|
style := statusStyle(strings.ToUpper(r[0]))
|
||||||
if r[0] == "High" {
|
switch r[0] {
|
||||||
|
case "High":
|
||||||
style = statusStyle("ERROR")
|
style = statusStyle("ERROR")
|
||||||
} else if r[0] == "Medium" {
|
case "Medium":
|
||||||
style = statusStyle("WARNING")
|
style = statusStyle("WARNING")
|
||||||
}
|
}
|
||||||
t.AddStyledRow(style.Style, r[0], r[1], r[2], r[3])
|
t.AddStyledRow(style.Style, r[0], r[1], r[2], r[3])
|
||||||
|
|||||||
Reference in New Issue
Block a user