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

row_actions() plugin hook #2299

Closed
simonw opened this issue Mar 12, 2024 · 2 comments
Closed

row_actions() plugin hook #2299

simonw opened this issue Mar 12, 2024 · 2 comments

Comments

@simonw
Copy link
Owner Author

simonw commented Mar 12, 2024

There's a slight complication here. Displaying it on the row page is easy - it can look exactly like table/query/etc actions:

CleanShot 2024-03-12 at 15 30 59@2x

But the other natural place to display row actions would be on the table page itself - similar to how we have column actions there (which are actually a JavaScript plugin thing, not a Python plugin thing):

CleanShot 2024-03-12 at 15 31 52@2x

Cog icons next to the primary key cells could make sense. In fact, the https://github.com/datasette/datasette-write-ui plugin already adds something like that:

CleanShot 2024-03-12 at 15 32 45@2x

There's one big catch: a table page could show 100 rows at a time. Executing the row_actions() plugin hook 100 times could be a very nasty performance hit, depending on what plugins are installed.

Instead, I'm inclined to say that this plugin affects the row page but NOT the table page... but we add a separate JavaScript hook mechanism (similar to makeColumnActions()) at a later date to handle the inline action items on the row page.

We could even have a cog icon that does a dynamic fetch() when clicked to fetch operations for the selected row - though we would still ideally have some kind of mechanism to decide whether or not to show the icon at all (an icon that has no menu options isn't very pleasant).

At any rate, I'm OK bumping the mechanics of the row-level cog icon on the table page to a later date. I think it's still worth having a row_actions() hook that affects the row page without solving that first.

@simonw simonw closed this as completed in b871198 Mar 12, 2024
simonw added a commit that referenced this issue Mar 12, 2024
@simonw
Copy link
Owner Author

simonw commented Mar 12, 2024

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

No branches or pull requests

1 participant