Skip to content

Commit

Permalink
initiate /debug browser page
Browse files Browse the repository at this point in the history
  • Loading branch information
pjurewicz committed Mar 20, 2024
1 parent 4cf2995 commit 623c125
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ruby_event_store-browser/elm/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Page
= NotFound
| ShowEvent Page.ShowEvent.Model
| ShowStream Page.ShowStream.Model
| Debug


subscriptions : Model -> Sub Msg
Expand Down Expand Up @@ -213,6 +214,9 @@ navigate model location =
Nothing ->
( { model | page = NotFound }, Cmd.none )

Just (Route.Debug) ->
( { model | page = Debug }, Cmd.none )

Nothing ->
( { model | page = NotFound }, Cmd.none )

Expand Down Expand Up @@ -265,5 +269,8 @@ viewPage page selectedTime =
in
( Just title, Html.map GotShowEventMsg content )

Debug ->
( Just "Debug", text "to be filled with some helpful content" )

NotFound ->
( Nothing, Layout.viewNotFound )
2 changes: 2 additions & 0 deletions ruby_event_store-browser/elm/src/Route.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Url.Parser.Query as Query
type Route
= BrowseEvents String Pagination.Specification
| ShowEvent String
| Debug


decodeLocation : Url.Url -> Url.Url -> Maybe Route
Expand All @@ -25,6 +26,7 @@ routeParser =
[ Url.Parser.map (BrowseEvents "all" Pagination.empty) Url.Parser.top
, Url.Parser.map browseEvents (Url.Parser.s "streams" </> Url.Parser.string <?> Query.string "page[position]" <?> Query.string "page[direction]" <?> Query.string "page[count]")
, Url.Parser.map ShowEvent (Url.Parser.s "events" </> Url.Parser.string)
, Url.Parser.map Debug (Url.Parser.s "debug" </> Url.Parser.top)
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def call(env)
)
end

%w[/ /events/:event_id /streams/:stream_name].each do |starting_route|
%w[/ /events/:event_id /streams/:stream_name /debug].each do |starting_route|
router.add_route("GET", starting_route) do |_, urls|
erb bootstrap_html,
browser_js_src: urls.browser_js_url,
Expand Down

0 comments on commit 623c125

Please sign in to comment.