Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #18417: Improve freeSpace check messages #3304

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -114,18 +114,20 @@ final object CheckFreeSpace extends Check {
val pcSpaceLeft = paritionSpaceInfos.map(x => (x.path, x.percent)).sortBy(-_._2)
pcSpaceLeft match {
case h :: _ =>
val listMsgSpace = pcSpaceLeft.map(s => s"- ${s._1} -> ${s._2}%\n")
val listMsgSpace = pcSpaceLeft.map(s => s"- ${s._1} -> ${s._2}%").mkString("\n")
h._2 match {
case pr if pr < 5L =>
val msg = s"Some space is under : \n- ${listMsgSpace}"
val msg = s"Some space is under :\n${listMsgSpace} available"
Critical(name, msg)
case pr if pr < 10L =>
val msg = s"Some space partition is under a warning level: \n- ${listMsgSpace}"
val msg = s"Some space partition is under a warning level:\n${listMsgSpace} available"
Warning(name, msg)
case _ =>
val msg = s"Space available is ok: \n- ${listMsgSpace}"
val msg = s"Space available is ok: \n${listMsgSpace} available"
Ok(name, msg)
}
case Nil =>
Critical(name, "No partition found on the system")
}
}
}
Expand Down
@@ -1,12 +1,12 @@
module View exposing (..)

import DataTypes exposing (Check, Model, Msg(..), SeverityLevel(..))
import Html exposing (Html, button, div, i, span, text)
import Html exposing (Html, br, button, div, i, span, text)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
import List exposing (any, map, sortWith)
import List exposing (any, intersperse, map, sortWith)
import List.Extra exposing (minimumWith)
import String
import String exposing (lines)

compareSeverityLevel: SeverityLevel -> SeverityLevel -> Order
compareSeverityLevel a b =
Expand Down Expand Up @@ -102,9 +102,10 @@ checksDisplay model h =
\c ->
let
classNameCircle = (severityLevelToString c.level) ++ "-light circle "
msgCheck = intersperse (br [][]) (map text (lines c.msg))
in
div [class "check"]
[ text c.msg, span [class classNameCircle][] ]
(msgCheck ++ [span [class classNameCircle][]])

) sortedChecks
in
Expand Down