mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Change remove_associated_artifact format: query param -> body param
This commit is contained in:
@@ -180,9 +180,9 @@ def create_app(
|
||||
@app.delete("/api/studies/<study_id:int>")
|
||||
@json_api_view
|
||||
def delete_study(study_id: int) -> dict[str, Any]:
|
||||
remove_associated_artifacts = (
|
||||
True if request.params.get("remove_associated_artifacts") == "true" else False
|
||||
)
|
||||
data = request.json or {}
|
||||
remove_associated_artifacts = data.get("remove_associated_artifacts", True)
|
||||
|
||||
if artifact_store is not None and remove_associated_artifacts:
|
||||
delete_all_artifacts(artifact_store, storage, study_id)
|
||||
|
||||
|
||||
@@ -121,9 +121,11 @@ export class AxiosClient extends APIClient {
|
||||
removeAssociatedArtifacts: boolean
|
||||
): Promise<void> =>
|
||||
this.axiosInstance
|
||||
.delete(
|
||||
`/api/studies/${studyId}?remove_associated_artifacts=${removeAssociatedArtifacts}`
|
||||
)
|
||||
.delete(`/api/studies/${studyId}`, {
|
||||
data: {
|
||||
remove_associated_artifacts: removeAssociatedArtifacts,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
return
|
||||
})
|
||||
|
||||
@@ -550,7 +550,7 @@ class APITestCase(TestCase):
|
||||
app,
|
||||
f"/api/studies/{study._study_id}",
|
||||
"DELETE",
|
||||
queries={"remove_associated_artifacts": "true"},
|
||||
body=json.dumps({"remove_associated_artifacts": True}),
|
||||
content_type="application/json",
|
||||
)
|
||||
self.assertEqual(status, 204)
|
||||
@@ -586,7 +586,7 @@ class APITestCase(TestCase):
|
||||
app,
|
||||
f"/api/studies/{study._study_id}",
|
||||
"DELETE",
|
||||
queries={"remove_associated_artifacts": "false"},
|
||||
body=json.dumps({"remove_associated_artifacts": False}),
|
||||
content_type="application/json",
|
||||
)
|
||||
self.assertEqual(status, 204)
|
||||
|
||||
Reference in New Issue
Block a user