From c000459c066fd7259b3162011acc35b26577d15f Mon Sep 17 00:00:00 2001 From: Huy Nguyen <73027756+huyaboo@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:24:12 +0000 Subject: [PATCH] Add comments for spacing Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com> --- src/core/server/saved_objects/import/utils.ts | 7 +++++++ .../home/server/services/sample_data/data_sets/util.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/core/server/saved_objects/import/utils.ts b/src/core/server/saved_objects/import/utils.ts index c9c3fc2e6927..5ef955ab8ad0 100644 --- a/src/core/server/saved_objects/import/utils.ts +++ b/src/core/server/saved_objects/import/utils.ts @@ -6,6 +6,13 @@ import { parse, stringify } from 'hjson'; import { SavedObject, SavedObjectsClientContract } from '../types'; +/** + * Given a Vega spec, the new datasource (by name), and spacing, + * + * @param {string} spec - the stringified Vega spec (HJSON or JSON) + * @param {string} newDataSourceName - the datasource name to append + * @param {number} [spacing=2] - how large the indenting should be after updating the spec (should be set to > 0 for a readable spec) + */ export interface UpdateDataSourceNameInVegaSpecProps { spec: string; newDataSourceName: string; diff --git a/src/plugins/home/server/services/sample_data/data_sets/util.ts b/src/plugins/home/server/services/sample_data/data_sets/util.ts index d84a4d0b2f20..c58cb2302f00 100644 --- a/src/plugins/home/server/services/sample_data/data_sets/util.ts +++ b/src/plugins/home/server/services/sample_data/data_sets/util.ts @@ -86,6 +86,7 @@ export const getSavedObjectsWithDataSource = ( const updatedVegaSpec = updateDataSourceNameInVegaSpec({ spec: vegaSpec, newDataSourceName: dataSourceTitle, + // Spacing of 1 prevents the Sankey visualization in logs data from exceeding the default url length and breaking spacing: 1, });