Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Show partitions count on subscription stats page #157

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions client/Pages/SubscriptionDetails/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Constants
import Helpers.AccessEditor as AccessEditor
import Helpers.Panel exposing (loadingStatus, warningMessage)
import Helpers.Store exposing (Id, Status(..), get)
import Helpers.String exposing (formatDateTime, periodToShortString)
import Helpers.String exposing (formatDateTime, periodToShortString, pluralCount)
import Helpers.UI
exposing
( PopupPosition(..)
Expand Down Expand Up @@ -232,12 +232,26 @@ statsPanel model =
list =
Helpers.Store.items statsStore

eventTypesCount =
List.length list

partitionsCount =
list
|> List.map countPartitions
|> List.sum

partitionsStatsString =
pluralCount partitionsCount "Partition" ++ "/ " ++ pluralCount eventTypesCount "Event type"

tableLayout =
grid [ "Partition ID", "State", "Unconsumed", "Stream ID", "Committed Offset", "" ]
(list
|> List.map (renderType model)
|> List.concat
)
div []
[ text partitionsStatsString
, grid [ "Partition ID", "State", "Unconsumed", "Stream ID", "Committed Offset", "" ]
(list
|> List.map (renderType model)
|> List.concat
)
]
in
div [ class "dc-card panel--expanded" ]
[ refreshButton Refresh
Expand All @@ -249,6 +263,11 @@ statsPanel model =
]


countPartitions : Stores.SubscriptionStats.SubscriptionStats -> Int
countPartitions stat =
List.length stat.partitions


renderType : Model -> Stores.SubscriptionStats.SubscriptionStats -> List (Html Msg)
renderType model stat =
tr [ class "dc-table__tr" ]
Expand Down