From 5adc2fc3bbe85cb6a840892a7423c10f220ab904 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Wed, 17 Nov 2021 10:47:18 -0800 Subject: [PATCH] Fix reporting validation for observability (#231) * Update reporting validation for observability Signed-off-by: Joshua Li * update tests Signed-off-by: Joshua Li --- .../server/utils/__tests__/validationHelper.test.ts | 2 +- dashboards-reports/server/utils/validationHelper.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dashboards-reports/server/utils/__tests__/validationHelper.test.ts b/dashboards-reports/server/utils/__tests__/validationHelper.test.ts index 5537dada..bc3ca73d 100644 --- a/dashboards-reports/server/utils/__tests__/validationHelper.test.ts +++ b/dashboards-reports/server/utils/__tests__/validationHelper.test.ts @@ -76,7 +76,7 @@ const createReportDefinitionNotebookInput: ReportDefinitionSchemaType = { report_source: REPORT_TYPE.notebook, description: 'Hi this is your Notebook on demand', core_params: { - base_url: `/app/observability#/notebooks/${SAMPLE_SAVED_OBJECT_ID}`, + base_url: `/app/observability-dashboards#/notebooks/${SAMPLE_SAVED_OBJECT_ID}`, window_width: 1300, window_height: 900, report_format: FORMAT.pdf, diff --git a/dashboards-reports/server/utils/validationHelper.ts b/dashboards-reports/server/utils/validationHelper.ts index 65b64750..aff53d41 100644 --- a/dashboards-reports/server/utils/validationHelper.ts +++ b/dashboards-reports/server/utils/validationHelper.ts @@ -37,7 +37,7 @@ export const isValidRelativeUrl = (relativeUrl: string) => { export const regexDuration = /^(-?)P(?=\d|T\d)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)([DW]))?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/; export const regexEmailAddress = /\S+@\S+\.\S+/; export const regexReportName = /^[\w\-\s\(\)\[\]\,\_\-+]+$/; -export const regexRelativeUrl = /^\/(_plugin\/kibana\/|_dashboards\/)?app\/(dashboards|visualize|discover|observability|notebooks-dashboards\?view=output_only)([?&]security_tenant=.+|)#\/(notebooks\/|view\/|edit\/)?[^\/]+$/; +export const regexRelativeUrl = /^\/(_plugin\/kibana\/|_dashboards\/)?app\/(dashboards|visualize|discover|observability-dashboards|notebooks-dashboards\?view=output_only)([?&]security_tenant=.+|)#\/(notebooks\/|view\/|edit\/)?[^\/]+$/; export const validateReport = async ( client: ILegacyScopedClusterClient,