/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { EuiCallOut, EuiCheckableCard, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText, EuiTextColor } from "@elastic/eui"; import { FLOW_ENUM, SubDetailProps } from "../../interface"; import { ContentPanel } from "../../../../components/ContentPanel"; import CustomFormRow from "../../../../components/CustomFormRow"; import { AllBuiltInComponents } from "../../../../components/FormGenerator"; import RemoteSelect from "../../../../components/RemoteSelect"; import { TEMPLATE_NAMING_MESSAGE, TEMPLATE_NAMING_PATTERN } from "../../../../utils/constants"; import TemplateType from "../TemplateType"; import { getCommonFormRowProps } from "../../hooks"; import { filterByMinimatch } from "../../../../../utils/helper"; import { TemplateItem } from "../../../../../models/interfaces"; export default function DefineTemplate(props: SubDetailProps) { const { readonly, field, isEdit } = props; const values: TemplateItem = field.getValues(); const Component = isEdit ? AllBuiltInComponents.Text : AllBuiltInComponents.Input; const matchSystemIndex = filterByMinimatch(".kibana", values.index_patterns || []); const registeredFlowField = field.registerField({ name: ["_meta", "flow"], }); return readonly ? null : ( {isEdit ? null : ( <> Template name cannot be changed after the template is created.} > {TEMPLATE_NAMING_MESSAGE}}> <> )} Promise.resolve({ ok: true, response: [], }) } placeholder="Select index patterns or input wildcards" /> {matchSystemIndex ? ( <> This template may apply to new system indexes and may affect your ability to access OpenSearch. We recommend narrowing your index patterns. ) : null}
Simple template
Define an index template with index aliases, settings, and mappings. } id="checkboxForIndexTemplateFlowSimple" onChange={() => { registeredFlowField.onChange(FLOW_ENUM.SIMPLE); }} checked={registeredFlowField.value === FLOW_ENUM.SIMPLE} />
Component template
Define an index template by associating component templates containing index configurations. } id="checkboxForIndexTemplateFlowComponents" onChange={() => registeredFlowField.onChange(FLOW_ENUM.COMPONENTS)} checked={registeredFlowField.value === FLOW_ENUM.COMPONENTS} />
); }