From 47a5e78e970015600e4b0853c4288a35bf71fc5d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 22 Oct 2024 23:04:27 +0000 Subject: [PATCH] =?UTF-8?q?[MDS][Bug]added=20changes=20for=20de=20register?= =?UTF-8?q?ing=20plugins=20not=20in=20MDS=20and=20changed=20other=E2=80=A6?= =?UTF-8?q?=20(#2222)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added changes for de registering plugins not in Neo and changed other apis to 400 Signed-off-by: sumukhswamy * added changes for de registering plugins not in Neo and changed other apis to 400 Signed-off-by: sumukhswamy * added changes for de registering plugins not in Neo and changed other apis to 400 Signed-off-by: sumukhswamy --------- Signed-off-by: sumukhswamy (cherry picked from commit a55310bef78212a4e4e322e012f1862d9f6d10e8) Signed-off-by: github-actions[bot] --- .../app_analytics_router.ts | 12 ++++---- server/routes/custom_panels/panels_router.ts | 30 +++++++++---------- .../event_analytics/event_analytics_router.ts | 20 ++++++------- server/routes/metrics/metrics_rounter.ts | 2 +- server/routes/ppl.ts | 2 +- server/routes/trace_analytics_dsl_router.ts | 6 ++-- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/server/routes/application_analytics/app_analytics_router.ts b/server/routes/application_analytics/app_analytics_router.ts index d6f5ffd116..898a837748 100644 --- a/server/routes/application_analytics/app_analytics_router.ts +++ b/server/routes/application_analytics/app_analytics_router.ts @@ -42,7 +42,7 @@ export function registerAppAnalyticsRouter(router: IRouter) { } catch (err: any) { console.error('Error occurred while fetching applications', err); return response.custom({ - statusCode: err.statusCode || 500, + statusCode: err.statusCode || 400, body: err.message, }); } @@ -78,7 +78,7 @@ export function registerAppAnalyticsRouter(router: IRouter) { } catch (err: any) { console.error('Error occurred while fetching application', err); return response.custom({ - statusCode: err.statusCode || 500, + statusCode: err.statusCode || 400, body: err.message, }); } @@ -120,7 +120,7 @@ export function registerAppAnalyticsRouter(router: IRouter) { } catch (err: any) { console.error('Error occurred while creating a new application', err); return response.custom({ - statusCode: err.statusCode || 500, + statusCode: err.statusCode || 400, body: err.message, }); } @@ -161,7 +161,7 @@ export function registerAppAnalyticsRouter(router: IRouter) { } catch (err: any) { console.error('Error occurred while renaming an existing application', err); return response.custom({ - statusCode: err.statusCode || 500, + statusCode: err.statusCode || 400, body: err.message, }); } @@ -210,7 +210,7 @@ export function registerAppAnalyticsRouter(router: IRouter) { } catch (err: any) { console.error('Error occurred while updating an existing application', err); return response.custom({ - statusCode: err.statusCode || 500, + statusCode: err.statusCode || 400, body: err.message, }); } @@ -245,7 +245,7 @@ export function registerAppAnalyticsRouter(router: IRouter) { }); } catch (err: any) { return response.custom({ - statusCode: err.statusCode || 500, + statusCode: err.statusCode || 400, body: err.message, }); } diff --git a/server/routes/custom_panels/panels_router.ts b/server/routes/custom_panels/panels_router.ts index 070f73b266..154ae3d5d8 100644 --- a/server/routes/custom_panels/panels_router.ts +++ b/server/routes/custom_panels/panels_router.ts @@ -40,7 +40,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in fetching panel list:', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -77,7 +77,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in fetching panel:', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -118,7 +118,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in creating new panel', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -146,7 +146,7 @@ export function PanelsRouter(router: IRouter) { ); try { - const responseBody = await customPanelBackend.updatePanel( + const _responseBody = await customPanelBackend.updatePanel( opensearchNotebooksClient, request.body.panelId, request.body.panel @@ -159,7 +159,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in updating panel', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -187,7 +187,7 @@ export function PanelsRouter(router: IRouter) { ); try { - const responseBody = await customPanelBackend.renamePanel( + const _responseBody = await customPanelBackend.renamePanel( opensearchNotebooksClient, request.body.panelId, request.body.panelName @@ -200,7 +200,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in renaming panel', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -245,7 +245,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in cloning panel', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -272,7 +272,7 @@ export function PanelsRouter(router: IRouter) { ); try { - const deleteResponse = await customPanelBackend.deletePanel( + const _deleteResponse = await customPanelBackend.deletePanel( opensearchNotebooksClient, request.params.panelId ); @@ -284,7 +284,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in deleting panel', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -311,7 +311,7 @@ export function PanelsRouter(router: IRouter) { ); try { - const deleteResponse = await customPanelBackend.deletePanelList( + const _deleteResponse = await customPanelBackend.deletePanelList( opensearchNotebooksClient, request.params.panelIdList ); @@ -323,7 +323,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in deleting panel', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -354,7 +354,7 @@ export function PanelsRouter(router: IRouter) { ); try { - const panelFilterResponse = await customPanelBackend.addPanelFilter( + const _panelFilterResponse = await customPanelBackend.addPanelFilter( opensearchNotebooksClient, request.body.panelId, request.body.query, @@ -370,7 +370,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in adding query filter', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -409,7 +409,7 @@ export function PanelsRouter(router: IRouter) { } catch (error: any) { console.error('Issue in fetching panel list:', error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } diff --git a/server/routes/event_analytics/event_analytics_router.ts b/server/routes/event_analytics/event_analytics_router.ts index 57ed898dd0..818678e0a2 100644 --- a/server/routes/event_analytics/event_analytics_router.ts +++ b/server/routes/event_analytics/event_analytics_router.ts @@ -40,7 +40,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success || savedRes?.data?.statusCode === 404) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -65,7 +65,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success || savedRes?.data?.statusCode === 404) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -107,7 +107,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -160,7 +160,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -201,7 +201,7 @@ export const registerEventAnalyticsRouter = ({ }, }; if (savedRes.success) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -253,7 +253,7 @@ export const registerEventAnalyticsRouter = ({ }, }; if (updateRes.success) return res.ok(result); - result.statusCode = updateRes?.data?.statusCode || 500; + result.statusCode = updateRes?.data?.statusCode || 400; result.message = updateRes?.data || ''; return res.custom(result); } @@ -281,7 +281,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -312,7 +312,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } @@ -335,7 +335,7 @@ export const registerEventAnalyticsRouter = ({ }, }; if (deleteResponse.success) return res.ok(result); - result.statusCode = deleteResponse?.data?.statusCode || 500; + result.statusCode = deleteResponse?.data?.statusCode || 400; result.message = deleteResponse?.data || ''; return res.custom(result); } @@ -360,7 +360,7 @@ export const registerEventAnalyticsRouter = ({ if (savedRes.success) return res.ok(result); - result.statusCode = savedRes?.data?.statusCode || 500; + result.statusCode = savedRes?.data?.statusCode || 400; result.message = savedRes?.data || ''; return res.custom(result); } diff --git a/server/routes/metrics/metrics_rounter.ts b/server/routes/metrics/metrics_rounter.ts index 595cd06363..f4ee9427d3 100644 --- a/server/routes/metrics/metrics_rounter.ts +++ b/server/routes/metrics/metrics_rounter.ts @@ -99,7 +99,7 @@ export function registerMetricsRoute(router: IRouter, dataSourceEnabled: boolean } catch (error) { if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } diff --git a/server/routes/ppl.ts b/server/routes/ppl.ts index d9943aca69..2aa2a0324a 100644 --- a/server/routes/ppl.ts +++ b/server/routes/ppl.ts @@ -33,7 +33,7 @@ export function registerPplRoute({ router, facet }: { router: IRouter; facet: PP return res.ok(result); } return res.custom({ - statusCode: queryRes.data.statusCode || queryRes.data.status || 500, + statusCode: queryRes.data.statusCode || queryRes.data.status || 400, body: queryRes.data.body || queryRes.data.message || '', }); } diff --git a/server/routes/trace_analytics_dsl_router.ts b/server/routes/trace_analytics_dsl_router.ts index 4d99ea401a..4637ee9830 100644 --- a/server/routes/trace_analytics_dsl_router.ts +++ b/server/routes/trace_analytics_dsl_router.ts @@ -51,7 +51,7 @@ export function registerTraceAnalyticsDslRouter(router: IRouter, dataSourceEnabl } catch (error) { console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -90,7 +90,7 @@ export function registerTraceAnalyticsDslRouter(router: IRouter, dataSourceEnabl } catch (error) { console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); } @@ -157,7 +157,7 @@ export function registerTraceAnalyticsDslRouter(router: IRouter, dataSourceEnabl addRequestToMetric('trace_analytics', 'get', error); if (error.statusCode !== 404) console.error(error); return response.custom({ - statusCode: error.statusCode || 500, + statusCode: error.statusCode || 400, body: error.message, }); }