module Web.View.HubRegistry.Index where import Web.Types import Web.Types (HubRegistryRow(..), GaafStatus(..), gaafStatus) import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Web.Routes () import Data.Aeson (Value(..)) import qualified Data.Vector as V data IndexView = IndexView { registryRows :: ![HubRegistryRow] } instance View IndexView where html IndexView { .. } = [hsx|
All registered hubs with capability manifests and health status.
No hubs registered yet.
|] renderRow :: HubRegistryRow -> Html renderRow row@HubRegistryRow { hub, mManifest, mLatestSnapshot } = let gs = gaafStatus mManifest wCount = maybe 0 (jsonArrayLen . (.declaredWidgetTypes)) mManifest eCount = maybe 0 (jsonArrayLen . (.declaredEventTypes)) mManifest cCount = maybe 0 (jsonArrayLen . (.declaredAnnotationCategories)) mManifest score = fmap (.healthScore) mLatestSnapshot in [hsx|{hub.domain}