Skip to content

Commit 544dbd7

Browse files
committed
fix: remove saved tab from account pages
1 parent 3a4436a commit 544dbd7

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

routers/account.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,22 @@
33
from enum import Enum
44

55
import gooey_gui as gui
6-
from django.db.models import Q
76
from fastapi.requests import Request
87
from furl import furl
98
from loguru import logger
109
from requests.models import HTTPError
1110
from starlette.exceptions import HTTPException
1211

13-
from bots.models import PublishedRun, WorkflowAccessLevel, Workflow
1412
from daras_ai_v2 import icons, paypal
1513
from daras_ai_v2.billing import billing_page
1614
from daras_ai_v2.fastapi_tricks import get_app_route_url, get_route_path
17-
from daras_ai_v2.grid_layout_widget import grid_layout
1815
from daras_ai_v2.manage_api_keys_widget import manage_api_keys
1916
from daras_ai_v2.meta_content import raw_build_meta_tags
2017
from daras_ai_v2.profiles import edit_user_profile_page
21-
from daras_ai_v2.urls import paginate_queryset, paginate_button
2218
from managed_secrets.widgets import manage_secrets_table
2319
from payments.webhooks import PaypalWebhookHandler
2420
from routers.custom_api_router import CustomAPIRouter
2521
from routers.root import explore_page, page_wrapper, get_og_url_path
26-
from widgets.saved_workflow import render_saved_workflow_preview
2722
from workspaces.models import Workspace, WorkspaceInvite
2823
from workspaces.views import invitation_page, workspaces_page
2924
from workspaces.widgets import get_current_workspace, SWITCH_WORKSPACE_KEY
@@ -137,10 +132,6 @@ def profile_route(request: Request):
137132

138133

139134
@gui.route(app, "/saved")
140-
def old_saved_route(request: Request):
141-
raise gui.RedirectException(get_route_path(saved_route))
142-
143-
144135
@gui.route(app, "/account/saved")
145136
def saved_route(request: Request):
146137
from widgets.workflow_search import SearchFilters, get_filter_value_from_workspace
@@ -240,7 +231,6 @@ class TabData(typing.NamedTuple):
240231
class AccountTabs(TabData, Enum):
241232
profile = TabData(title=f"{icons.profile} Profile", route=profile_route)
242233
members = TabData(title=f"{icons.company} Members", route=members_route)
243-
saved = TabData(title=f"{icons.save} Saved", route=saved_route)
244234
api_keys = TabData(title=f"{icons.api} API Keys", route=api_keys_route)
245235
billing = TabData(title=f"{icons.billing} Billing", route=account_route)
246236

@@ -274,84 +264,6 @@ def profile_tab(request: Request, workspace: Workspace):
274264
return edit_user_profile_page(workspace=workspace)
275265

276266

277-
def all_saved_runs_tab(request: Request):
278-
workspace = get_current_workspace(request.user, request.session)
279-
pr_filter = Q(workspace=workspace)
280-
if workspace.is_personal:
281-
pr_filter |= Q(created_by=request.user, workspace__isnull=True)
282-
else:
283-
pr_filter &= (
284-
~Q(workspace_access=WorkflowAccessLevel.VIEW_ONLY)
285-
| Q(created_by=request.user)
286-
| ~Q(public_access=WorkflowAccessLevel.VIEW_ONLY)
287-
)
288-
289-
qs = PublishedRun.objects.select_related(
290-
"workspace", "created_by", "saved_run"
291-
).filter(pr_filter)
292-
293-
prs, cursor = paginate_queryset(
294-
qs=qs, ordering=["-updated_at"], cursor=request.query_params
295-
)
296-
297-
gui.write("# Saved Workflows")
298-
explore_path = get_route_path(explore_page)
299-
300-
if not prs:
301-
# empty state
302-
if workspace.is_personal:
303-
gui.caption(
304-
f"""
305-
You haven't saved any workflows yet. To get started, \
306-
[Explore our workflows]({explore_path}) and tap **Save** \
307-
to make one your own.
308-
"""
309-
)
310-
else:
311-
gui.caption(
312-
f"""
313-
Your team hasn't shared any saved workflows yet. To get started, \
314-
[Explore our workflows]({explore_path}) and tap **Save** to \
315-
collaborate together.
316-
"""
317-
)
318-
return
319-
320-
if workspace.is_personal:
321-
if handle := workspace.handle:
322-
gui.caption(
323-
f"""
324-
All your Saved workflows are here, with public ones listed on your \
325-
profile page at {handle.get_app_url()}.
326-
"""
327-
)
328-
else:
329-
edit_profile_url = AccountTabs.profile.url_path
330-
gui.caption(
331-
f"""
332-
All your Saved workflows are here. Public ones will be listed on \
333-
your profile page if you [create a username]({edit_profile_url}).
334-
"""
335-
)
336-
else:
337-
workspace_name = workspace.display_name(request.user)
338-
gui.caption(
339-
f"Saved workflows of **{workspace_name}** are here and visible & editable by other workspace members."
340-
)
341-
342-
def _render_run(pr: PublishedRun):
343-
workflow = Workflow(pr.workflow)
344-
render_saved_workflow_preview(
345-
workflow.page_cls,
346-
pr,
347-
workflow_pill=f"{workflow.emoji} {workflow.short_title}",
348-
)
349-
350-
grid_layout(1, prs, _render_run)
351-
352-
paginate_button(url=request.url, cursor=cursor)
353-
354-
355267
def api_keys_tab(request: Request):
356268
workspace = get_current_workspace(request.user, request.session)
357269

0 commit comments

Comments
 (0)