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

fix: Resolve minor issues for 5.4 #414

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions zt_backend/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ def base_path():
return settings.user_name + "/" + settings.project_name

@router.post("/api/wide_mode_update")
async def update_wide_mode(request: request.WideModelRequest):
notebook_state.zt_notebook.wideMode = request.wideMode
await save_notebook()
return {"status": "success"}
async def update_wide_mode(wideModeRequest: request.WideModelRequest):
if app_state.run_mode == "dev":
logger.debug("Hide cell request started")
app_state.save_queue.put_nowait({"wide_mode": wideModeRequest})
logger.debug("Hide cell request completed")

@router.websocket("/ws/run_code")
async def run_code(websocket: WebSocket):
Expand Down Expand Up @@ -382,7 +383,7 @@ async def load_notebook(websocket: WebSocket):
logger.debug("Get notebook request received")
notebook_start = get_notebook_request()
await websocket.send_json(
{"notebook_name": notebook_start.notebookName}
{"notebook_name": notebook_start.notebookName, "wide_mode": notebook_start.wideMode}
)
if app_state.run_mode == "app":
userId = str(uuid.uuid4())
Expand Down Expand Up @@ -528,20 +529,20 @@ def share_notebook(shareRequest: request.ShareRequest):
detail="Failed to get a signed URL",
)

python_warning = response_json.get("pythonWarning", None)
zt_warning = response_json.get("ztWarning", None)
python_warning = response_json.get("pythonWarning", "")
zt_warning = response_json.get("ztWarning", "")
project_warning = response_json.get("projectWarning", "")
warning_message = ""
if python_warning:
warning_message += python_warning
if zt_warning:
warning_message += "\n" + zt_warning
warning_message += "\nWe recommend upgrading your versions before continuing. If you would like to continue, select confirm."
upload_state.signed_url = signed_url
return {"warning": warning_message}
warning_message += f"\n{python_warning}"
if zt_warning:
warning_message += zt_warning
warning_message += f"\n{zt_warning}"
if project_warning:
warning_message += f"\n{project_warning}"
if warning_message:
warning_message += (
"\nWe recommend upgrading your versions before continuing"
"\nSelect confirm if you would like to proceed"
)
upload_state.signed_url = signed_url
return {"warning": warning_message}
Expand Down Expand Up @@ -989,8 +990,6 @@ def list_children(path: str = Query(...)):
dir_name = Path.cwd().name
else:
dir_name = dir_path.name

print(f"Directory name: {dir_name}, Path: {dir_path}")

if not dir_path.is_dir():
return {"error": "Path is not a directory"}
Expand Down
3 changes: 3 additions & 0 deletions zt_backend/utils/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def globalStateUpdate(
run_request: request.Request = None,
run_response: response.Response = None,
new_notebook_name: str = "",
wide_mode: request.WideModelRequest = None,
add_comment: request.AddCommentRequest = None,
delete_comment: request.DeleteCommentRequest = None,
edit_comment: request.EditCommentRequest = None,
Expand Down Expand Up @@ -260,6 +261,8 @@ def globalStateUpdate(
)
if new_notebook_name:
notebook_state.zt_notebook.notebookName = new_notebook_name
if wide_mode is not None:
notebook_state.zt_notebook.wideMode = wide_mode.wideMode
if add_comment is not None:
notebook_state.zt_notebook.cells[add_comment.cellId].comments[
add_comment.commentId
Expand Down
Loading
Loading