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

Commit

Permalink
Merge pull request #94 from zalando-nakadi/ARUHA-2651
Browse files Browse the repository at this point in the history
Adding list of consuming queries to consumers tab
  • Loading branch information
thomasabraham authored Dec 20, 2019
2 parents a66b919 + 56c3894 commit 6488228
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
7 changes: 6 additions & 1 deletion client/Pages/EventTypeDetails/Help.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Pages.EventTypeDetails.Help exposing (audience, authorization, category, cleanupPolicy, cleanupPolicyCompact, compatibilityMode, consumers, createdAt, defaultStatistic, enrichmentStrategies, envelope, eventType, options, orderingKeyFields, owningApplication, partitionCompactionKeyField, partitionKeyFields, partitionStrategy, partitions, publishers, schema, subscription, updatedAt)
module Pages.EventTypeDetails.Help exposing (audience, authorization, category, cleanupPolicy, cleanupPolicyCompact, compatibilityMode, consumers, consumingQueries, createdAt, defaultStatistic, enrichmentStrategies, envelope, eventType, options, orderingKeyFields, owningApplication, partitionCompactionKeyField, partitionKeyFields, partitionStrategy, partitions, publishers, schema, subscription, updatedAt)

import Config exposing (appPreffix)
import Helpers.UI exposing (..)
Expand Down Expand Up @@ -354,6 +354,11 @@ publishers =
]


consumingQueries : List (Html msg)
consumingQueries =
[ text "The list of nakadi-sql queries consuming this Event Type." ]


consumers : List (Html msg)
consumers =
[ text "The list of low-level consumers for this Event Type."
Expand Down
5 changes: 4 additions & 1 deletion client/Pages/EventTypeDetails/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ update settings message model =
dispatch LoadPublishers

ConsumerTab ->
dispatch LoadConsumers
Cmd.batch
[ dispatch LoadConsumers
, dispatch LoadConsumingQueries
]

PublishTab ->
Cmd.none
Expand Down
49 changes: 45 additions & 4 deletions client/Pages/EventTypeDetails/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ detailsLayout typeName eventType model =
eventType
pageState.consumersStore
model.subscriptionStore
pageState.consumingQueriesStore
appsInfoUrl
usersInfoUrl
)
Expand Down Expand Up @@ -619,11 +620,19 @@ renderPublishers name appsInfoUrl usersInfoUrl item =
]


consumersTab : EventType -> Stores.Consumer.Model -> Stores.Subscription.Model -> String -> String -> Html Msg
consumersTab eventType consumersStore subscriptionsStore appsInfoUrl usersInfoUrl =
consumersTab :
EventType
-> Stores.Consumer.Model
-> Stores.Subscription.Model
-> Stores.ConsumingQuery.Model
-> String
-> String
-> Html Msg
consumersTab eventType consumersStore subscriptionsStore queryStore appsInfoUrl usersInfoUrl =
div [ class "dc-card" ]
[ consumersPanel eventType consumersStore appsInfoUrl usersInfoUrl
, subscriptionsPanel eventType subscriptionsStore appsInfoUrl
[ subscriptionsPanel eventType subscriptionsStore appsInfoUrl
, consumingQueriesPanel queryStore
, consumersPanel eventType consumersStore appsInfoUrl usersInfoUrl
]


Expand Down Expand Up @@ -715,6 +724,38 @@ renderSubscription name appsInfoUrl item =
]


consumingQueriesPanel : Stores.ConsumingQuery.Model -> Html Msg
consumingQueriesPanel queryStore =
let
sqlQueriesList =
Store.items queryStore

count =
List.length sqlQueriesList

countStr =
if count == 1 then
String.fromInt count
++ " consuming nakadi-sql query"

else
String.fromInt count
++ " consuming nakadi-sql queries"
in
div []
[ span []
[ text countStr
, helpIcon "Consuming queries" Help.consumingQueries BottomRight
, refreshButton LoadConsumingQueries
]
, div [ class "consumer-tab__list" ]
[ Helpers.Panel.loadingStatus queryStore <|
grid [ "Consuming nakadi-sql queries" ]
(sqlQueriesList |> List.map renderSqlQueries)
]
]


renderSqlQueries : ConsumingQuery -> Html Msg
renderSqlQueries query =
tr [ class "dc-table__tr" ]
Expand Down

0 comments on commit 6488228

Please sign in to comment.