mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-07 07:35:59 +00:00
Show queue counts in side menu
This commit is contained in:
parent
07edaaaf5e
commit
64bacb665a
@ -18,6 +18,26 @@ import Util.Time exposing (formatDateTime, formatIsoDateTime)
|
|||||||
viewSidebar : Bool -> Flags -> UiSettings -> Model -> Html Msg
|
viewSidebar : Bool -> Flags -> UiSettings -> Model -> Html Msg
|
||||||
viewSidebar visible _ _ model =
|
viewSidebar visible _ _ model =
|
||||||
let
|
let
|
||||||
|
count v =
|
||||||
|
case v of
|
||||||
|
CurrentJobs ->
|
||||||
|
List.length model.state.progress
|
||||||
|
|
||||||
|
QueueAll ->
|
||||||
|
List.length model.state.queued
|
||||||
|
+ List.length model.state.completed
|
||||||
|
|
||||||
|
QueueWaiting ->
|
||||||
|
List.length model.state.queued
|
||||||
|
|
||||||
|
QueueSuccess ->
|
||||||
|
filterJobDetails model.state.completed "success"
|
||||||
|
|> List.length
|
||||||
|
|
||||||
|
QueueError ->
|
||||||
|
filterJobDetails model.state.completed "failed"
|
||||||
|
|> List.length
|
||||||
|
|
||||||
tabLink cls v icon label =
|
tabLink cls v icon label =
|
||||||
a
|
a
|
||||||
[ href "#"
|
[ href "#"
|
||||||
@ -28,9 +48,12 @@ viewSidebar visible _ _ model =
|
|||||||
]
|
]
|
||||||
[ i [ class icon ]
|
[ i [ class icon ]
|
||||||
[]
|
[]
|
||||||
, span
|
, div
|
||||||
[ class "ml-3" ]
|
[ class "ml-3" ]
|
||||||
[ text label ]
|
[ text label ]
|
||||||
|
, div [ class "ml-auto bg-gray-200 border rounded-full h-6 w-6 flex items-center justify-center text-xs dark:bg-bluegray-800 dark:text-bluegray-200 dark:border-bluegray-800 dark:bg-opacity-50" ]
|
||||||
|
[ count v |> String.fromInt |> text
|
||||||
|
]
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
div
|
div
|
||||||
@ -60,9 +83,6 @@ viewContent _ _ model =
|
|||||||
gridStyle =
|
gridStyle =
|
||||||
"grid gap-4 grid-cols-1 md:grid-cols-2"
|
"grid gap-4 grid-cols-1 md:grid-cols-2"
|
||||||
|
|
||||||
isState state job =
|
|
||||||
state == job.state
|
|
||||||
|
|
||||||
message str =
|
message str =
|
||||||
div [ class "h-28 flex flex-col items-center justify-center w-full" ]
|
div [ class "h-28 flex flex-col items-center justify-center w-full" ]
|
||||||
[ div [ class S.header2 ]
|
[ div [ class S.header2 ]
|
||||||
@ -110,7 +130,7 @@ viewContent _ _ model =
|
|||||||
QueueError ->
|
QueueError ->
|
||||||
let
|
let
|
||||||
items =
|
items =
|
||||||
List.filter (isState "failed") model.state.completed
|
filterJobDetails model.state.completed "failed"
|
||||||
in
|
in
|
||||||
if List.isEmpty items then
|
if List.isEmpty items then
|
||||||
message "No failed jobs to display."
|
message "No failed jobs to display."
|
||||||
@ -122,7 +142,7 @@ viewContent _ _ model =
|
|||||||
QueueSuccess ->
|
QueueSuccess ->
|
||||||
let
|
let
|
||||||
items =
|
items =
|
||||||
List.filter (isState "success") model.state.completed
|
filterJobDetails model.state.completed "success"
|
||||||
in
|
in
|
||||||
if List.isEmpty items then
|
if List.isEmpty items then
|
||||||
message "No succesfull jobs to display."
|
message "No succesfull jobs to display."
|
||||||
@ -133,6 +153,15 @@ viewContent _ _ model =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
filterJobDetails : List JobDetail -> String -> List JobDetail
|
||||||
|
filterJobDetails list state =
|
||||||
|
let
|
||||||
|
isState job =
|
||||||
|
state == job.state
|
||||||
|
in
|
||||||
|
List.filter isState list
|
||||||
|
|
||||||
|
|
||||||
renderJobLog : JobDetail -> Html Msg
|
renderJobLog : JobDetail -> Html Msg
|
||||||
renderJobLog job =
|
renderJobLog job =
|
||||||
div
|
div
|
||||||
|
Loading…
x
Reference in New Issue
Block a user