Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mk/redesign event page #1726

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions ruby_event_store-browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
Event browser companion application for RubyEventStore. Inspect stream contents and event details. Explore correlation and causation connections.

Find out more at [https://railseventstore.org](https://railseventstore.org/)

## UI Dev mode

`make install clean dev` will auto-compile JS/CSS from ELM in the background and also serve standalone browser on http://localhost:9393
72 changes: 22 additions & 50 deletions ruby_event_store-browser/elm/src/Page/ShowEvent.elm
Original file line number Diff line number Diff line change
Expand Up @@ -201,51 +201,28 @@ view_ model =
showEvent : Url.Url -> Event -> Api.RemoteResource (List Api.Event) -> Html Msg
showEvent baseUrl event maybeCausedEvents =
div
[ class "py-12"
[ class "py-12 px-4 lg:px-8 space-y-10"
]
[ h1
[ class "font-bold px-8 text-2xl"
[ class "font-bold text-2xl"
]
[ text event.eventType ]
, div
[ class "px-8"
]
[ table
[ class "my-10 w-full text-left table-fixed border-collapse"
[]
[ div
[ class "w-full text-left grid md:grid-cols-3 gap-8 overflow-hidden"
]
[ thead
[ class "align-bottom leading-tight"
[ section [ class "space-y-4" ]
[ h2 [ class "border-gray-400 border-b text-gray-500 uppercase font-bold text-xs pb-2" ] [ text "Event ID"]
, div [ class "text-sm font-medium font-mono"] [ text event.eventId ]
]
[ tr []
[ th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs"
]
[ text "Event id" ]
, th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs"
]
[ text "Raw Data" ]
, th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs"
]
[ text "Raw Metadata" ]
]
, section [ class "space-y-4" ]
[ h2 [ class "border-gray-400 border-b text-gray-500 uppercase font-bold text-xs pb-2" ] [ text "Raw Data" ]
, div [ class "overflow-auto w-full" ] [ showJsonTree event.rawData event.dataTreeState (\s -> ChangeOpenedEventDataTreeState s) ]
]
, tbody [ class "align-top" ]
[ tr []
[ td
[ class "p-0 pt-2"
]
[ text event.eventId ]
, td
[ class "p-0 pt-2"
]
[ showJsonTree event.rawData event.dataTreeState (\s -> ChangeOpenedEventDataTreeState s) ]
, td
[ class "p-0 pt-2"
]
[ showJsonTree event.rawMetadata event.metadataTreeState (\s -> ChangeOpenedEventMetadataTreeState s) ]
]
, section [ class "space-y-4" ]
[ h2 [ class "border-gray-400 border-b text-gray-500 uppercase font-bold text-xs pb-2" ] [ text "Raw Metadata" ]
, div [ class "overflow-auto w-full" ] [ showJsonTree event.rawMetadata event.metadataTreeState (\s -> ChangeOpenedEventMetadataTreeState s) ]
]
]
]
Expand All @@ -254,8 +231,7 @@ showEvent baseUrl event maybeCausedEvents =
, case maybeCausedEvents of
Api.Loading ->
div
[ class "px-8 mt-8"
]
[]
[ h2
[ class "font-bold text-xl"
]
Expand All @@ -267,8 +243,7 @@ showEvent baseUrl event maybeCausedEvents =
case causedEvents of
[] ->
div
[ class "px-8 mt-8"
]
[]
[ h2
[ class "font-bold text-xl"
]
Expand All @@ -277,8 +252,7 @@ showEvent baseUrl event maybeCausedEvents =

_ ->
div
[ class "px-8 mt-8"
]
[ class "space-y-4" ]
[ h2
[ class "font-bold text-xl"
]
Expand All @@ -296,8 +270,7 @@ streamsOfEvent baseUrl event =
case event.streams of
Just streams ->
div
[ class "px-8 mt-8"
]
[]
[ h2
[ class "font-bold text-xl"
]
Expand All @@ -323,8 +296,7 @@ relatedStreams baseUrl event =

else
div
[ class "px-8 mt-8"
]
[]
[ h2
[ class "font-bold text-xl"
]
Expand Down Expand Up @@ -384,18 +356,18 @@ renderCausedEvents baseUrl causedEvents =

_ ->
table
[ class "my-10 w-full text-left table-fixed border-collapse"
[ class "w-full text-left table-fixed border-collapse"
]
[ thead
[ class "align-bottom leading-tight"
]
[ tr []
[ th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs"
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-2 text-xs"
]
[ text "Event name" ]
, th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs"
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-2 text-xs"
]
[ text "Event id" ]
]
Expand Down
16 changes: 8 additions & 8 deletions ruby_event_store-browser/elm/src/Page/ShowStream.elm
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,20 @@ renderResults baseUrl events =

_ ->
table
[ class "my-10 w-full text-left table-fixed border-collapse"
[ class "my-10 w-full text-left border-collapse"
]
[ thead
[ class "align-bottom leading-tight"
]
[ tr []
[ th
[ class "border-gray-400 border-b text-gray-500 uppercase pb-4 p-0 text-xs" ]
[ class "border-gray-400 border-b text-gray-500 uppercase pb-4 px-4 text-xs" ]
[ text "Event name" ]
, th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs" ]
[ class "border-gray-400 border-b text-gray-500 uppercase pb-4 pr-4 text-xs" ]
[ text "Event id" ]
, th
[ class "border-gray-400 border-b text-gray-500 uppercase p-0 pb-4 text-xs text-right" ]
[ class "border-gray-400 border-b text-gray-500 uppercase pb-4 pr-4 text-xs text-right" ]
[ text "Created at" ]
]
]
Expand All @@ -258,19 +258,19 @@ renderResults baseUrl events =

itemRow : Url.Url -> Api.Event -> Html Msg
itemRow baseUrl { eventType, createdAt, eventId } =
tr []
tr [ class "border-gray-50 border-b hover:bg-gray-100"]
[ td
[ class "p-0 pt-2" ]
[ class "py-2 px-4 align-middle" ]
[ a
[ class "text-red-700 no-underline"
, href (Route.eventUrl baseUrl eventId)
]
[ text eventType ]
]
, td
[ class "p-0 pt-2" ]
[ class "py-2 pr-4 font-mono text-sm leading-none font-medium align-middle" ]
[ text eventId ]
, td
[ class "p-0 pt-2 text-right" ]
[ class "py-2 pr-4 font-mono text-sm leading-none font-medium text-right align-middle" ]
[ text (formatTimestamp createdAt) ]
]