From e0a49d91bd89d79ce02adc560e80b4575b40b1f5 Mon Sep 17 00:00:00 2001 From: Thiago Dallacqua Date: Mon, 14 Oct 2024 16:20:36 -0300 Subject: [PATCH] refactor: Simplify interface structure and formatting in services/types.ts, F_ExperimentList.tsx, and api.ts. --- .../src/components/FilterForm/components/FilterField.tsx | 2 +- webui/react/src/pages/F_ExpList/F_ExperimentList.tsx | 6 +----- webui/react/src/services/api.ts | 6 +++++- webui/react/src/services/apiConfig.ts | 6 +----- webui/react/src/services/types.ts | 5 ++++- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterField.tsx b/webui/react/src/components/FilterForm/components/FilterField.tsx index aecd050d4483..e5461c1ba204 100644 --- a/webui/react/src/components/FilterForm/components/FilterField.tsx +++ b/webui/react/src/components/FilterForm/components/FilterField.tsx @@ -244,7 +244,7 @@ const FilterField = ({ ); } - return col.displayName || col.column; + return col.displayName || col.column; }; return ( diff --git a/webui/react/src/pages/F_ExpList/F_ExperimentList.tsx b/webui/react/src/pages/F_ExpList/F_ExperimentList.tsx index 98713a14edaf..33b6c887932f 100644 --- a/webui/react/src/pages/F_ExpList/F_ExperimentList.tsx +++ b/webui/react/src/pages/F_ExpList/F_ExperimentList.tsx @@ -419,11 +419,7 @@ const F_ExperimentList: React.FC = ({ project }) => { ); if (mounted) { - setProjectColumns( - Loaded( - columns, - ), - ); + setProjectColumns(Loaded(columns)); } } catch (e) { handleError(e, { publicSubject: 'Unable to fetch project columns' }); diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 15e3bfdf4cfd..4aae0a004c3d 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -1031,4 +1031,8 @@ export const deleteGlobalConfigPolicies = generateDetApi< Api.V1DeleteGlobalConfigPoliciesResponse >(Config.deleteGlobalConfigPolicies); -export const postRunMetadata = generateDetApi(Config.postRunMetadata); +export const postRunMetadata = generateDetApi< + Service.PostRunMetadata, + Api.V1PostRunMetadataResponse, + Api.V1PostRunMetadataResponse +>(Config.postRunMetadata); diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b54ea7662d74..887e956a1825 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -2271,9 +2271,5 @@ export const postRunMetadata: DetApi< name: 'postRunMetadata', postProcess: identity, request: (params: Service.PostRunMetadata, options) => - detApi.Internal.postRunMetadata( - params.runId, - params.body, - options, - ), + detApi.Internal.postRunMetadata(params.runId, params.body, options), }; diff --git a/webui/react/src/services/types.ts b/webui/react/src/services/types.ts index c4b7627ed9b9..71e79fa94776 100644 --- a/webui/react/src/services/types.ts +++ b/webui/react/src/services/types.ts @@ -593,4 +593,7 @@ export interface DeleteGlobalConfigPolicies { workloadType: 'NTSC' | 'EXPERIMENT'; } -export interface PostRunMetadata { runId: number, body: Api.V1PostRunMetadataRequest }; +export interface PostRunMetadata { + runId: number; + body: Api.V1PostRunMetadataRequest; +}