Skip to content

Commit

Permalink
Merge branch 'development' of github.com:hubmapconsortium/user_worksp…
Browse files Browse the repository at this point in the history
…aces_server into jpuerto/r-investigation

# Conflicts:
#	BUILD
#	src/user_workspaces_server/views/workspace_view.py
  • Loading branch information
Juan Puerto committed Feb 19, 2024
2 parents b65e8f3 + cd0f903 commit 6f1eda5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
db7da16
fe84871
23 changes: 21 additions & 2 deletions src/user_workspaces_server/views/workspace_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ def put(self, request, workspace_id, put_type=None):
f"{workspace.default_job_type} is not in the list of available job types."
)

workspace.save()

workspace_details = body.get("workspace_details", {})

if not isinstance(workspace_details, dict):
Expand All @@ -199,6 +197,27 @@ def put(self, request, workspace_id, put_type=None):
logger.exception("Failure when creating symlink/files or setting ownership.")
raise

workspace.workspace_details["current_workspace_details"]["files"] = [
{"name": file_name}
for file_name in {
(file["name"] if file["name"][0] == "/" else f"/{file['name']}")
for file in workspace_details.get("files", [])
+ workspace.workspace_details["current_workspace_details"]["files"]
}
]

workspace.workspace_details["current_workspace_details"]["symlinks"] = [
{"name": symlink_name}
for symlink_name in {
(symlink["name"] if symlink["name"][0] == "/" else f"/{symlink['name']}")
for symlink in workspace_details.get("symlinks", [])
+ workspace.workspace_details["current_workspace_details"]["symlinks"]
}
]

workspace.save()

logger.info(workspace.workspace_details)
async_task("user_workspaces_server.tasks.update_workspace", workspace.pk)

return JsonResponse({"message": "Update successful.", "success": True})
Expand Down

0 comments on commit 6f1eda5

Please sign in to comment.