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

SQL Logs #207

Merged
merged 13 commits into from
Mar 6, 2024
Merged

SQL Logs #207

merged 13 commits into from
Mar 6, 2024

Conversation

asutula
Copy link
Contributor

@asutula asutula commented Mar 2, 2024

Adds a tabbed UI to the table page where you can switch between viewing table data and SQL logs for the table. When viewing logs, you can click any log entry and view a dedicated page for that txn hash.

Screenshot 2024-03-04 at 4 09 47 PM

Screenshot 2024-03-04 at 4 03 31 PM

Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
@asutula asutula self-assigned this Mar 2, 2024
Copy link

railway-app bot commented Mar 2, 2024

This PR is being deployed to Railway 🚅

web: ◻️ REMOVED

@asutula asutula changed the base branch from main to staging March 2, 2024 03:26
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Experimenting with my own Card component on the txn page just to have more control over how it looks. Still don't love using cards like this everywhere, but it's just a go-to for the time being.

Copy link
Contributor

Choose a reason for hiding this comment

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

You, @dtbuchholz, and I all independently opened PRs to fix/change the ShadCN Card. Maybe we combine them into a single component and start using that everywhere on the site?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the react server component page that renders to view a single transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made this address display component a little more flexible so we can use it to display txn hashes as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the ability to disable the buttons in the Paginator component. You'd want to disable them while data is loading, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Client component that renders SQL logs for a table.

Comment on lines +180 to +191
<Tabs defaultValue="data" className="py-4">
<TabsList>
<TabsTrigger value="data">Table Data</TabsTrigger>
<TabsTrigger value="logs">SQL Logs</TabsTrigger>
</TabsList>
<TabsContent value="data">
<DataTable columns={columns} data={data.results} />
</TabsContent>
<TabsContent value="logs">
<SQLLogs chain={chainId} tableId={tokenId} />
</TabsContent>
</Tabs>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added tabbed navigation to switch between viewing table data and SQL logs. Planning on adding a tab to view the table schema as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shadcn tabs component. This is not code I wrote, just installed it from his tool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added new functions for querying for SQL logs.

@asutula asutula marked this pull request as ready for review March 4, 2024 22:38
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Copy link
Contributor

@joewagner joewagner left a comment

Choose a reason for hiding this comment

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

Looks really good!! I'm gonna use this regularly when I'm debugging etc...
The only potential blocker here is that the log list is using transaction hash the key, which isn't unique if someone batched statements into the same transaction.

packages/web/app/sql-log/_components/card.tsx Outdated Show resolved Hide resolved
packages/web/components/sql-logs.tsx Outdated Show resolved Hide resolved
packages/web/components/sql-logs.tsx Show resolved Hide resolved
asutula added 2 commits March 6, 2024 13:22
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Signed-off-by: Aaron Sutula <asutula@users.noreply.github.com>
Copy link
Contributor Author

@asutula asutula left a comment

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joewagner here is a new component that wraps the shadcn card with what I'm calling MetricCard. The shadcn card is quite flexible and general use. I made the MetricCard more opinionated about the way it displays information which lends itself more to the display of "metrics" tiles. This is how we've mostly been using the card throughout Studio. It also handles the overflow issue by using hyphens: auto and a tooltip.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use this component on the sql log page in this PR, and we can apply it elsewhere in the site in an upcoming PR.

@asutula asutula requested a review from joewagner March 6, 2024 19:45
@asutula asutula merged commit f0d1b29 into staging Mar 6, 2024
4 checks passed
@asutula asutula deleted the asutula/sql-logs branch March 6, 2024 21:54
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