diff --git a/common/constants.ts b/common/constants.ts index 5c933f68..d6ee0097 100644 --- a/common/constants.ts +++ b/common/constants.ts @@ -108,6 +108,8 @@ export const BEDROCK_DIMENSIONS = { * Various constants pertaining to Workflow configs */ +export const UI_METADATA_SCHEMA_VERSION = 1; + // frontend-specific workflow types, derived from the available preset templates export enum WORKFLOW_TYPE { SEMANTIC_SEARCH = 'Semantic search', diff --git a/common/interfaces.ts b/common/interfaces.ts index 37817c51..27712cdd 100644 --- a/common/interfaces.ts +++ b/common/interfaces.ts @@ -242,7 +242,7 @@ type ReactFlowViewport = { }; export type UIState = { - schema_version: 1; + schema_version: number; config: WorkflowConfig; type: WORKFLOW_TYPE; // Will be used in future when changing from form-based to flow-based configs via drag-and-drop diff --git a/public/pages/workflows/new_workflow/utils.ts b/public/pages/workflows/new_workflow/utils.ts index fc7e04ff..13f00c51 100644 --- a/public/pages/workflows/new_workflow/utils.ts +++ b/public/pages/workflows/new_workflow/utils.ts @@ -28,9 +28,9 @@ import { KNN_QUERY, HYBRID_SEARCH_QUERY_MATCH_KNN, WorkflowConfig, + UI_METADATA_SCHEMA_VERSION, } from '../../../../common'; import { generateId } from '../../../utils'; -import * as pluginManifest from '../../../../opensearch_dashboards.json'; // Fn to produce the complete preset template with all necessary UI metadata. export function enrichPresetWorkflowWithUiMetadata( @@ -75,7 +75,7 @@ export function enrichPresetWorkflowWithUiMetadata( export function fetchEmptyMetadata(): UIState { return { - version: pluginManifest.version, + schema_version: UI_METADATA_SCHEMA_VERSION, type: WORKFLOW_TYPE.CUSTOM, config: fetchEmptyUIConfig(), };