diff --git a/optuna_dashboard/ts/action.ts b/optuna_dashboard/ts/action.ts index 091e7339..f3109f0a 100644 --- a/optuna_dashboard/ts/action.ts +++ b/optuna_dashboard/ts/action.ts @@ -284,9 +284,9 @@ export const actionCreator = () => { }) } - const deleteStudy = (studyId: number) => { + const deleteStudy = (studyId: number, removeAssociatedArtifacts: boolean) => { apiClient - .deleteStudy(studyId) + .deleteStudy(studyId, removeAssociatedArtifacts) .then(() => { setStudySummaries(studySummaries.filter((s) => s.study_id !== studyId)) enqueueSnackbar(`Success to delete a study (id=${studyId})`, { diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index 038ea9f7..f1a7ad8c 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -185,7 +185,10 @@ export abstract class APIClient { studyName: string, directions: Optuna.StudyDirection[] ): Promise - abstract deleteStudy(studyId: number): Promise + abstract deleteStudy( + studyId: number, + removeAssociatedArtifacts: boolean + ): Promise abstract renameStudy( studyId: number, studyName: string diff --git a/optuna_dashboard/ts/axiosClient.ts b/optuna_dashboard/ts/axiosClient.ts index 1c52c42f..7588ad80 100644 --- a/optuna_dashboard/ts/axiosClient.ts +++ b/optuna_dashboard/ts/axiosClient.ts @@ -116,10 +116,17 @@ export class AxiosClient extends APIClient { : undefined, } }) - deleteStudy = (studyId: number): Promise => - this.axiosInstance.delete(`/api/studies/${studyId}`).then(() => { - return - }) + deleteStudy = ( + studyId: number, + removeAssociatedArtifacts: boolean + ): Promise => + this.axiosInstance + .delete( + `/api/studies/${studyId}?remove_associated_artifacts=${removeAssociatedArtifacts}` + ) + .then(() => { + return + }) renameStudy = (studyId: number, studyName: string): Promise => this.axiosInstance .post(`/api/studies/${studyId}/rename`, {