Skip to content

Commit

Permalink
Open log patterns by default (opensearch-project#444)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <joshuali925@gmail.com>
  • Loading branch information
joshuali925 authored May 9, 2023
1 parent 7c127db commit 72970aa
Showing 1 changed file with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useState, useContext } from 'react';
import { useDispatch, connect } from 'react-redux';
import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiText, EuiHorizontalRule } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, EuiLink, EuiText } from '@elastic/eui';
import React, { useContext, useState } from 'react';
import { connect, useDispatch } from 'react-redux';
import {
FILTERED_PATTERN,
PATTERN_REGEX,
RAW_QUERY,
PPL_DEFAULT_PATTERN_REGEX_FILETER,
RAW_QUERY,
} from '../../../../../common/constants/explorer';
import { PatternsHeader } from './patterns_header';
import { PatternsTable } from './patterns_table';
import { selectPatterns } from '../../redux/slices/patterns_slice';
import { PatternTableData, Query as IQuery } from '../../../../../common/types/explorer';
import { TabContext, useFetchPatterns } from '../../hooks';
import { selectPatterns } from '../../redux/slices/patterns_slice';
import { changeQuery, selectQueries } from '../../redux/slices/query_slice';
import { formatError } from '../../utils';
import { Query as IQuery, PatternTableData } from '../../../../../common/types/explorer';
import { PatternsHeader } from './patterns_header';
import { PatternsTable } from './patterns_table';

export interface LogPatternProps {
selectedIntervalUnit: {
Expand All @@ -41,7 +41,7 @@ const EventPatterns = ({
const dispatch = useDispatch();
const { tabId, pplService, notifications } = useContext<any>(TabContext);
const patternsData = patterns[tabId];
const [viewLogPatterns, setViewLogPatterns] = useState(false);
const [viewLogPatterns, setViewLogPatterns] = useState(true);
const [isPatternConfigPopoverOpen, setIsPatternConfigPopoverOpen] = useState(false);
const [patternRegexInput, setPatternRegexInput] = useState(PPL_DEFAULT_PATTERN_REGEX_FILETER);
const { isEventsLoading: isPatternLoading, getPatterns } = useFetchPatterns({
Expand Down Expand Up @@ -99,16 +99,14 @@ const EventPatterns = ({
gutterSize="xs"
>
<EuiFlexItem grow={false}>
{viewLogPatterns && (
<PatternsHeader
patternsData={patternsData}
patternRegexInput={patternRegexInput}
setPatternRegexInput={setPatternRegexInput}
onPatternApply={handlePatternApply}
isPatternConfigPopoverOpen={isPatternConfigPopoverOpen}
setIsPatternConfigPopoverOpen={setIsPatternConfigPopoverOpen}
/>
)}
<PatternsHeader
patternsData={patternsData}
patternRegexInput={patternRegexInput}
setPatternRegexInput={setPatternRegexInput}
onPatternApply={handlePatternApply}
isPatternConfigPopoverOpen={isPatternConfigPopoverOpen}
setIsPatternConfigPopoverOpen={setIsPatternConfigPopoverOpen}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup>
Expand Down

0 comments on commit 72970aa

Please sign in to comment.