Skip to content

Conversation

@mofojed
Copy link
Member

@mofojed mofojed commented Feb 15, 2024

- Created an `elements` folder and put all elements in that
WIP hydrating data

- In the middle of breaking stuff and wiring stuff back up
- Had an idea for a scoped ID thing but nowhere to use it yet

Re-wire PortalPanel so that it emits an event when it is opened instead

- Doesn't throw when the onOpen/onClosed props are not provided anymore
- Uses a scoped ID so all panels will be scoped to a particular widget
- Does not re-open yet - widget is not saving the IDs of all the panels it's opened, or re-using them

WIP wire up ReactPanelManager to dish out IDs

- Now the IDs come from ReactPanelManager, so we just need to save those IDs with the widget data and presto

WIP Save widget data with the widget

- Seems to be trying to save it correctly, but it's never loading?
  - Maybe because it's the DEFAULT dashboard?

Rename ScopedIdWrapper

Fix merge conflicts

WIP it's rehydrating now, but in a new panel

- Need the panel IDs to match, currently it's adding the scope to it again somewhere

WIP refactor the PortalPanelManager

- Now there is one PortalPanelManager map that all ReactPanels pull the element from
  - Makes managing the portals easier, panels stay in the same spot upon reload
- Still need to clean up code

Get rid of debug logging lines

Clean up/refactor some code a bit

- Move panel stuff into /layout
- Move widget stuff into /widget

Clean up any opened panels when widget is closed

- Console emits the PanelEvent.CLOSE immediately on startup when "Close disconnected panels" is true. In that case, the Widget has not yet loaded so we just need to close any panels that were previously opened by the widget just in case

Fix existing tests

Add some tests for PortalPanelManager
- Isn't actually used in this PR yet. This is just for deephaven#162
- Fix loading dashboards from plugin data
- In case data formats change
- These were made in another branch
@mofojed mofojed self-assigned this Feb 15, 2024
- Don't pass `WidgetWrapper` directly to `WidgetHandler`, just pass in the individual props
- Add a `DashboardWidgetHandler` to handle mapping the `WidgetHandler` callbacks to the dashboard callbacks
  - It's the only thing that uses the `WidgetId` there, `WidgetHandler` doesn't actually need it
- In the future we should be able to get rid of passing through `fetch`, and just have a `useWidget` hook that automatically loads the widget/retries when necessary.
@mofojed mofojed requested a review from mattrunyon February 22, 2024 21:28
Comment on lines +109 to +113
export const {
listen: listenForPortalOpened,
emit: emitPortalOpened,
useListener: usePortalOpenedListener,
} = makeEventFunctions<PortalOpenedPayload>(PORTAL_OPENED);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I tried putting a comment inline with this (like you can for interfaces), but doesn't seem to work for a way to document the method. Kind of unfortunate

You can add a comment if you do this though, but defeats some of the point of this util

const portalOpenedEvents = makeEventFunctions<PortalOpenedPayload>(PORTAL_OPENED);

/**
 * This is a jsdoc
 */
export emitPortalOpened = portalOpenedEvents.emit;

Copy link
Member Author

Choose a reason for hiding this comment

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

That doesn't seem to work for me? I've tried inline comments as well as many other ways but can't seem to do it.

// On rehydration, yield known IDs first
// If there are no more known IDs, generate a new one.
// This can happen if the document hasn't been opened before, or if it's rehydrated and a new panel is added.
// Note that if the order of panels changes, the worst case scenario is that panels appear in the wrong location in the layout.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could the panel somehow end up with the wrong data? Like let's say you have t1 and t2 with some filters and then their order get flipped. Would t1 now have t2 filters trying to be applied?

Copy link
Member Author

Choose a reason for hiding this comment

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

The panel could end up in the wrong place. We should allow a key (or id) to be passed in to ui.panel to allow for being more explicit about the key of your panel. I don't think that should be part of this ticket though.

@mofojed mofojed requested a review from mattrunyon February 26, 2024 20:27
@mofojed mofojed merged commit 13bb5ea into deephaven:main Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants