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

Enhance note status #487

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

ticruz38
Copy link
Collaborator

@ticruz38 ticruz38 commented Nov 22, 2024

Related to #371

  • Adding 3 tabs to the Publishes view
  • Connections have 6 stats boxes that display the connection quality (connected, logged out, failed etc) clicking one of the stat box filter out the connections that fit in that category.
  • Each connection or Relay has a badge if some event where posted via them (success is also used)
  • Notices tab will list all event posted via this relay and the status attached

Notices are kind of unclear what should be displayed, I have the event, the status of the request and the relay url, not sure how to display this.

This is a draft, just look at the screenshot and give me some general feedback

Stats box are likely too big, you can see a timeout attached to some relay
Screenshot 2024-11-22 at 16 00 30

Here the relay display how many successful events where posted to it
Screenshot 2024-11-22 at 16 37 31

Screenshot 2024-11-22 at 16 01 31 Screenshot 2024-11-22 at 16 38 48

@staab staab changed the base branch from master to dev November 22, 2024 17:55
@staab
Copy link
Collaborator

staab commented Nov 22, 2024

Nice, a few comments:

  • Instead of icons, use text. In this case, the icon is the main piece of information so it shouldn't be hidden behind something the user has to guess at or hover over. Something similar to the current status dot would be good — maybe in the top right, across from the relay name, show a dot + a status name with a tooltip that explains what the status means.
  • I agree the tiles are too big. Maybe use SelectButton multiple=true instead to control which connections are visible
  • On notices, I was thinking less about showing event publishes than NOTICE or OK=false messages from a given relay. If it's an ok related to an event, you can show some event details, but the main thing to surface is the message that goes along with the notice or ok.

@ticruz38
Copy link
Collaborator Author

ticruz38 commented Nov 25, 2024

Show connection status, there is no popover on the status as the name is quite descriptive already.
Screenshot 2024-11-25 at 14 33 57

With a status selected using SelectButton
Screenshot 2024-11-25 at 14 47 42

The notice looks like coloured logs in a terminal, since Notice are de-facto a nerdish info, it make sense to have this more technical oriented display.
Screenshot 2024-11-25 at 14 24 49

I rarely get any message from the endpoint along with the status, I have here the default message being hardcoded as "Published", I can use something more technical such as 200 OK
When clicking on the line it pops a modal with the event.

@staab
Copy link
Collaborator

staab commented Nov 25, 2024

Cool, I like all of this. Maybe left-align the select buttons though. Otherwise, let me know when it's ready for review and I'll take a closer look.

@ticruz38
Copy link
Collaborator Author

It should be fine to review now

Have created 2 new components, in the view folder, PublishesNotices and PublishesConnections, the plan was to have them link to the router but it proved more challenging than expected with the tabs. So these 2 views are just 2 child components for Publishes.

I can move them to another folder if it makes more sense

}
}
connectionsStatus = newConnectionStatus
}, 800)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in a flash of zeroes on first load. Instead, put this in a throttled function and call it on mount and in an interval.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not updated inside the loop, the connectionStatus is updated once every 800 ms, there is no flashing on each connection state

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On first page load there is, because the interval doesn't run at first:
https://github.com/user-attachments/assets/2b47224e-536d-4af5-a663-510c9bab2546

src/app/views/PublishesConnections.svelte Outdated Show resolved Hide resolved
src/app/views/PublishesConnections.svelte Outdated Show resolved Hide resolved
src/app/views/PublishesConnections.svelte Show resolved Hide resolved
src/app/views/PublishesConnections.svelte Outdated Show resolved Hide resolved
src/app/views/PublishesNotices.svelte Outdated Show resolved Hide resolved
src/app/views/PublishesNotices.svelte Outdated Show resolved Hide resolved
@ticruz38 ticruz38 added this to the 0.5.0 milestone Nov 28, 2024
@ticruz38
Copy link
Collaborator Author

ticruz38 commented Dec 3, 2024

  • Tracking all Notice events when bootstrapping the app.
  • Connection barely triggers any ConnectionEvent.Notice events, so I catch all verbs except EVENT. This includes Negentropy messages, EOSE, CLOSE, OK, etc.
  • The notice console is more compact now and holds a lot more information.
  • As for the colors, EOSE uses a neutral color—it is usually synonymous with success, but it can also indicate failure. OK is in green, despite sometimes being synonymous with an auth error.
Screenshot 2024-12-03 at 15 25 39 Screenshot 2024-12-03 at 15 24 42 Screenshot 2024-12-03 at 15 23 11

Copy link
Collaborator

@staab staab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, a few things:

  • Enhance note status #487 (comment) still needs to be resolved
  • On the notices page, let's replace the relay selector with a generic "search" box. This should match against relay url, verb (ok/notice), and message.
  • The animation on the notices page is janky, use in rather than transition.
  • While I like the granularity on the notices page, I agree with your point that storing all this is going to be pretty heavy, for not very much benefit. Let's slim it down to OK and NOTICE.
  • Let's factor the thunks page out into its own component as well.


export let selected: string[] = []

$: subNotices = selected.flatMap(s => $subscriptionNotices.get(s)?.map(n => ({...n, url: s})))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe derive this in engine/state alongside subscriptionNotices

Comment on lines +59 to +63
$: notices = ([...pubNotices, ...subNotices] as (Thunk & (SubscriptionNotice & {url: string}))[])
.sort((a, b) => {
return a.created_at - b.created_at
})
.filter(Boolean)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sortBy(x => -x.created_at, ...) is a more succinct way to do this. Also, the filter(Boolean) shouldn't be necessary here, something is wrong upstream if it's needed. (Thunk & (SubscriptionNotice & {url: string})) is pretty ugly too, SubscriptionNotice should probably include url in its type, and a | would be more appropriate instead (although it would require type assertions, so & is fine here if it works).

Comment on lines +47 to +55
export enum ConnectionType {
Connected = "Connected",
Logging = "Logging in",
LoginFailed = "Failed to log in",
ConnectFailed = "Failed to connect",
WaitReconnect = "Wainting to reconnect",
NotConnected = "Not connected",
UnstableConnection = "Unstable connection",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to decouple constants and display logic by adding an additional displayConnectionType function.

connection.on(ConnectionEvent.Receive, function (cxn, [verb, ...args]) {
if (verb == "EVENT") return
subscriptionNotices.update($notices => {
pushToMapKey($notices, connection.url, {created_at: now(), notice: [verb, ...args]})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add url to the object just to make the types easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants