/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import { ContentPanel } from '../../../components/ContentPanel'; import React, { useContext, useState } from 'react'; import { LogTypeForm } from '../components/LogTypeForm'; import { LogTypeBase } from '../../../../types'; import { defaultLogType } from '../utils/constants'; import { RouteComponentProps } from 'react-router-dom'; import { BREADCRUMBS, ROUTES } from '../../../utils/constants'; import { CoreServicesContext } from '../../../components/core_services'; import { useEffect } from 'react'; import { DataStore } from '../../../store/DataStore'; import { successNotificationToast } from '../../../utils/helpers'; import { NotificationsStart } from 'opensearch-dashboards/public'; export interface CreateLogTypeProps extends RouteComponentProps { notifications: NotificationsStart; } export const CreateLogType: React.FC = ({ history, notifications }) => { const [logTypeDetails, setLogTypeDetails] = useState({ ...defaultLogType }); const context = useContext(CoreServicesContext); useEffect(() => { context?.chrome.setBreadcrumbs([ BREADCRUMBS.SECURITY_ANALYTICS, BREADCRUMBS.DETECTORS, BREADCRUMBS.LOG_TYPES, BREADCRUMBS.LOG_TYPE_CREATE, ]); }, []); return ( Create log type to categorize and identify detection rules for your data sources.

} hideHeaderBorder={true} > history.push(ROUTES.LOG_TYPES)} onConfirm={async () => { const success = await DataStore.logTypes.createLogType(logTypeDetails); if (success) { successNotificationToast(notifications, 'created', `log type ${logTypeDetails.name}`); history.push(ROUTES.LOG_TYPES); } }} />
); };