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

feat (toolbar):Debug toolbar #686

Merged
merged 58 commits into from
Apr 30, 2024
Merged

feat (toolbar):Debug toolbar #686

merged 58 commits into from
Apr 30, 2024

Conversation

paulharter
Copy link
Contributor

@paulharter paulharter commented Nov 20, 2023

Checked out toolbar stuff into this new clean branch as many many messy changes of mind.

Copy link
Contributor

@kevin-dp kevin-dp left a comment

Choose a reason for hiding this comment

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

The toolbar looks good overall, I left some comments.
Seems that we're close to be able to merge this 👍

.github/workflows/toolbar_tests.yml Outdated Show resolved Hide resolved
clients/typescript/package.json Outdated Show resolved Hide resolved
clients/typescript/package.json Outdated Show resolved Hide resolved
pnpm-workspace.yaml Outdated Show resolved Hide resolved
toolbar/.gitignore Outdated Show resolved Hide resolved
toolbar/src/tabs/SQLTab.tsx Outdated Show resolved Hide resolved
toolbar/src/tabs/SQLTab.tsx Outdated Show resolved Hide resolved
toolbar/src/tabs/SQLTab.tsx Outdated Show resolved Hide resolved
toolbar/src/tabs/StatusTab.tsx Outdated Show resolved Hide resolved
.changeset/spicy-beans-build.md Outdated Show resolved Hide resolved
@kevin-dp
Copy link
Contributor

Also, it seems you had an example usage of the toolbar in web-wa-sqlite example but you removed it?
Would be good to have an example where the toolbar is being used such that users can see the usage.

@paulharter
Copy link
Contributor Author

@kevin-dp I've pretty done everything as you suggest. A few notes:

I had to add export { MockRegistry } from './mock' to satellite/index.ts to get the import to work without the addition export is the package

I couldn't refactor the tab components as you suggested, I had tried to do this before, its something to do with when react expands out the JSX, it generates react hook errors.

I have moved the whole thing for now - but we can do this later

I haven't added back the toolbar in an example as I want to do this an other step once there is a published toolbar package to refer to properly. But I have checked that this will works ok in the web example. I have also added a non compiled util.ts script to tidy away the code to add the toolbar.

toolbar/.gitignore Outdated Show resolved Hide resolved
*.md
.DS_Store
dist/
dev-app/dist/

This comment was marked as resolved.

toolbar/README.md Outdated Show resolved Hide resolved
toolbar/package.json Outdated Show resolved Hide resolved
toolbar/src/api/toolbar-interface.ts Outdated Show resolved Hide resolved

function ElectricToolbar({ api }: ToolbarProps) {
const [hidden, setHidden] = useState(true)
const [dbNames, setDbNames] = useState([''])

This comment was marked as resolved.

toolbar/src/tabs/SQLTab.tsx Outdated Show resolved Hide resolved
toolbar/src/tabs/SQLTab.tsx Outdated Show resolved Hide resolved
toolbar/src/index.tsx Outdated Show resolved Hide resolved
toolbar/util.ts Outdated Show resolved Hide resolved
toolbar/README.md Outdated Show resolved Hide resolved
toolbar/README.md Outdated Show resolved Hide resolved
@paulharter
Copy link
Contributor Author

paulharter commented Dec 13, 2023

@kevin-dp I think this might be ready now - I've made to readme changes you suggested

.github/workflows/toolbar_tests.yml Outdated Show resolved Hide resolved
clients/typescript/src/satellite/index.ts Outdated Show resolved Hide resolved
components/toolbar/.gitignore Outdated Show resolved Hide resolved
components/toolbar/.prettierignore Outdated Show resolved Hide resolved
components/toolbar/Makefile Show resolved Hide resolved
components/toolbar/src/tabs.tsx Outdated Show resolved Hide resolved
components/toolbar/src/tabs.tsx Outdated Show resolved Hide resolved
components/toolbar/src/tabs/SQLTab.tsx Outdated Show resolved Hide resolved
components/toolbar/test/api.test.ts Outdated Show resolved Hide resolved
components/toolbar/test/api.test.ts Outdated Show resolved Hide resolved
@balegas
Copy link
Contributor

balegas commented Jan 4, 2024

I see there is still activity here. Let's not leave it hanging.

@paulharter
Copy link
Contributor Author

@kevin-dp I have done all the changes you suggested except the additional tests, and I have tested it manually against 0.0.9 with the web example.

Can we merge this now as I'm not really coding now and don't have time to think about how to set up the extra tests and Valter wanted this in for next week?

Copy link
Contributor

@kevin-dp kevin-dp left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments!
I have two nitpicks that would be nice to fix:

  • components/toolbar/Makefile indentation is still off
  • clients/typescript/src/satellite/index.ts export is still on the block of imports

You tested the toolbar manually on 0.9 and it seems to work which is great. However, we don't have unit tests for some public methods and that would be a blocker for me as that means we will have to go and manually test the toolbar on every release. These are the untested public methods:

getSatelliteStatus(name: string): ConnectivityState | 'Not found'
resetDB(dbName: string): Promise<void>
queryDB(dbName: string, statement: Statement): Promise<Row[]>

I will let @balegas decide whether we merge without the tests or not.

components/toolbar/src/tabs.tsx Outdated Show resolved Hide resolved
@balegas
Copy link
Contributor

balegas commented Feb 1, 2024

Hi @paulharter,
It feels like the unit tests suggestion are important. I understand that this will probably not help a lot with browser implementation, but for the sake of completeness let's make those tests.

This PR is dragging for too long. It's very near.

Best,

@paulharter
Copy link
Contributor Author

@kevin-dp @balegas I've added the extra api tests now

@msfstef
Copy link
Contributor

msfstef commented Apr 24, 2024

I've modified the debug toolbar slightly, added a couple more APIs for the connection status (toggle on/off) and an experimental shapes tab for viewing active shapes.

The last one uses a private field from the satellite implementation so before developing further I'll open a PR to expose some shape subscription information from the Satellite client for the debug toolbar to use safely.

I've also done an ugly inlining of CSS into the debug toolbar to make the DX better (now only need to dynamically import and call addToolbar(electric)) - will improve that over time but I had already spent too much time on CSS bunding, postprocessing, and TS errors...

@kevin-dp can you have another look so we can potentially merge this?

Copy link
Contributor

@kevin-dp kevin-dp left a comment

Choose a reason for hiding this comment

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

Looks good to me!
Left some minor comments.

clients/typescript/src/satellite/mock.ts Outdated Show resolved Hide resolved
clients/typescript/src/satellite/mock.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,9 @@
deps:
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation is still very weird in this file

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you mean? it's tab indented (similar to the generator Makefile)

components/toolbar/README.md Outdated Show resolved Hide resolved
components/toolbar/package.json Outdated Show resolved Hide resolved
@msfstef msfstef merged commit abebbaa into main Apr 30, 2024
19 checks passed
@msfstef msfstef deleted the paul/debug-toolbar branch April 30, 2024 07:50
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.

4 participants