diff --git a/jupyterlab/src/apiClient.ts b/jupyterlab/src/apiClient.ts index 10fe5d39..eeae643e 100644 --- a/jupyterlab/src/apiClient.ts +++ b/jupyterlab/src/apiClient.ts @@ -64,8 +64,8 @@ export class JupyterlabAPIClient extends APIClient { preference_history: res.preference_history?.map( this.convertPreferenceHistory ), - plotly_graph_objects: res.plotly_graph_objects, // TODO: Support this - artifacts: res.artifacts, // TODO: Support this + plotly_graph_objects: res.plotly_graph_objects, + artifacts: res.artifacts, skipped_trial_numbers: res.skipped_trial_numbers ?? [], } }) @@ -127,7 +127,7 @@ export class JupyterlabAPIClient extends APIClient { study_name: res.study_name, directions: res.directions, user_attrs: res.user_attrs, - is_preferential: res.is_prefential, // TODO: Fix typo + is_preferential: res.is_prefential, datetime_start: res.datetime_start ? new Date(res.datetime_start) : undefined, @@ -161,7 +161,7 @@ export class JupyterlabAPIClient extends APIClient { dataUrl: string ): Promise => requestAPI( - `/api/artifacts/${studyId}/${trialId}`, // TODO: Make API + `/api/artifacts/${studyId}/${trialId}`, { body: JSON.stringify({ file: dataUrl, @@ -178,7 +178,7 @@ export class JupyterlabAPIClient extends APIClient { dataUrl: string ): Promise => requestAPI( - `/api/artifacts/${studyId}`, // TODO: Make API + `/api/artifacts/${studyId}`, { body: JSON.stringify({ file: dataUrl, @@ -195,7 +195,7 @@ export class JupyterlabAPIClient extends APIClient { artifactId: string ): Promise => requestAPI( - `/api/artifacts/${studyId}/${trialId}/${artifactId}`, // TODO: Make API + `/api/artifacts/${studyId}/${trialId}/${artifactId}`, { method: "DELETE", } @@ -204,7 +204,7 @@ export class JupyterlabAPIClient extends APIClient { }) deleteStudyArtifact = (studyId: number, artifactId: string): Promise => requestAPI( - `/api/artifacts/${studyId}/${artifactId}`, // TODO: Make API + `/api/artifacts/${studyId}/${artifactId}`, { method: "DELETE", } @@ -293,13 +293,17 @@ export class JupyterlabAPIClient extends APIClient { }).then(() => { return }) - getPlot = (studyId: number, plotType: PlotType): Promise => { - throw new Error("Method not implemented.") // TODO: Implement - } + getPlot = (studyId: number, plotType: PlotType): Promise => + requestAPI(`/api/studies/${studyId}/plot/${plotType}`) + .then((res) => (res)) getCompareStudiesPlot = ( studyIds: number[], plotType: CompareStudiesPlotType ): Promise => { - throw new Error("Method not implemented.") // TODO: Implement + return requestAPI( + `/api/compare-studies/plot/${plotType}`, { + body: JSON.stringify({ study_ids: studyIds }), + } + ).then((res) => (res)) } } diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index 023dd1ff..90f6b22c 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -103,7 +103,7 @@ export type RenameStudyResponse = { study_name: string directions: Optuna.StudyDirection[] user_attrs: Optuna.Attribute[] - is_prefential: boolean // TODO: Fix typo + is_prefential: boolean // TODO(porink0424): Fix typo datetime_start?: string }