/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import React from "react"; import { useSelector, useDispatch } from "react-redux"; import CloseIcon from "@material-ui/icons/Close"; import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"; import { ActionType, AppStateProps, InfoBarTitleMap, InfoBarTypes, } from "reducer/appReducer"; import Alarms from "help/Alarms"; import AccessProxy from "help/AccessProxy"; import CreationMethodNetwork from "help/CreationMethodNetwork"; import LogProcessing from "help/LogProcessing"; import LogProcessingNetwork from "help/LogProcessingNetwork"; import IngestionCreationMethod from "help/IngestionCreationMethod"; import SampleDashboard from "help/SampleDashboard"; import LogLifeCycle from "help/LogLifecycle"; import NginxLogFormat from "help/NginxLogFormat"; import NginxSampleLogParsing from "help/NginxSampleLogParsing"; import LogConfigPath from "help/LogConfigPath"; import LogConfigPathEKS from "help/LogConfigPathEKS"; import ApacheLogFormat from "help/ApacheLogFormat"; import ApacheSampleLogParsing from "help/ApacheSampleLogParsing"; import RegExLogFormat from "help/RegExLogFormat"; import InstanceGroupCreationMethod from "help/InstanceGroupCreationMethod"; import { useTranslation } from "react-i18next"; import S3FileType from "help/S3FileType"; import EKSPattern from "help/EKSPattern"; import EKSIAMRole from "help/EKSIAMRole"; import ConfigTimeFormat from "help/ConfigTimeFormat"; import ConfigFilter from "help/ConfigFilter"; import ProxyInstance from "help/ProxyInstance"; interface HelpPanelProps { className?: string; } export const HelpPanel: React.FC = (props: HelpPanelProps) => { const { className } = props; const { showInfoBar, infoBarType } = useSelector( (state: AppStateProps) => state ); const dispatch = useDispatch(); const { t } = useTranslation(); return (
{!showInfoBar && (
)} {showInfoBar && (
{ dispatch({ type: ActionType.CLOSE_INFO_BAR }); }} className="close-icon" />
{t(InfoBarTitleMap[infoBarType || ""])}
)}
{showInfoBar && (
{infoBarType === InfoBarTypes.ALARMS && } {infoBarType === InfoBarTypes.ACCESS_PROXY && } {infoBarType === InfoBarTypes.LOG_PROCESSING && } {infoBarType === InfoBarTypes.CREATION_METHOD_NETWORK && ( )} {infoBarType === InfoBarTypes.LOG_PROCESSING_NETWORK && ( )} {infoBarType === InfoBarTypes.INGESTION_CREATION_METHOD && ( )} {infoBarType === InfoBarTypes.INSTANCE_GROUP_CREATION_METHOD && ( )} {infoBarType === InfoBarTypes.SAMPLE_DASHBAORD && } {infoBarType === InfoBarTypes.LOG_LIFECYCLE && } {infoBarType === InfoBarTypes.NGINX_LOG_FORMAT && } {infoBarType === InfoBarTypes.APACHE_LOG_FORMAT && ( )} {infoBarType === InfoBarTypes.REGEX_LOG_FORMAT && } {infoBarType === InfoBarTypes.NGINX_SAMPLE_LOG_PARSING && ( )} {infoBarType === InfoBarTypes.APACHE_SAMPLE_LOG_PARSING && ( )} {infoBarType === InfoBarTypes.LOG_CONFIG_PATH && } {infoBarType === InfoBarTypes.LOG_CONFIG_PATH_EKS && ( )} {infoBarType === InfoBarTypes.S3_FILE_TYPE && } {infoBarType === InfoBarTypes.EKS_PATTERN && } {infoBarType === InfoBarTypes.EKS_IAM_ROLE && } {infoBarType === InfoBarTypes.CONFIG_TIME_FORMAT && ( )} {infoBarType === InfoBarTypes.CONFIG_FILTER && } {infoBarType === InfoBarTypes.PROXY_INSTANCE && }
)}
); }; HelpPanel.defaultProps = { className: "", }; export default HelpPanel;