mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Make request available to menu plugin hooks, closes #1371
This commit is contained in:
parent
a3faf37883
commit
d23a267138
8 changed files with 44 additions and 23 deletions
|
|
@ -833,7 +833,9 @@ class Datasette:
|
|||
async def menu_links():
|
||||
links = []
|
||||
for hook in pm.hook.menu_links(
|
||||
datasette=self, actor=request.actor if request else None
|
||||
datasette=self,
|
||||
actor=request.actor if request else None,
|
||||
request=request or None,
|
||||
):
|
||||
extra_links = await await_me_maybe(hook)
|
||||
if extra_links:
|
||||
|
|
|
|||
|
|
@ -100,15 +100,15 @@ def forbidden(datasette, request, message):
|
|||
|
||||
|
||||
@hookspec
|
||||
def menu_links(datasette, actor):
|
||||
def menu_links(datasette, actor, request):
|
||||
"""Links for the navigation menu"""
|
||||
|
||||
|
||||
@hookspec
|
||||
def table_actions(datasette, actor, database, table):
|
||||
def table_actions(datasette, actor, database, table, request):
|
||||
"""Links for the table actions menu"""
|
||||
|
||||
|
||||
@hookspec
|
||||
def database_actions(datasette, actor, database):
|
||||
def database_actions(datasette, actor, database, request):
|
||||
"""Links for the database actions menu"""
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ class DatabaseView(DataView):
|
|||
datasette=self.ds,
|
||||
database=database,
|
||||
actor=request.actor,
|
||||
request=request,
|
||||
):
|
||||
extra_links = await await_me_maybe(hook)
|
||||
if extra_links:
|
||||
|
|
|
|||
|
|
@ -894,6 +894,7 @@ class TableView(RowTableShared):
|
|||
table=table,
|
||||
database=database,
|
||||
actor=request.actor,
|
||||
request=request,
|
||||
):
|
||||
extra_links = await await_me_maybe(hook)
|
||||
if extra_links:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue