Structure Dialog
This component contains the dialog that allows users to search for occurrences of a structure (i.e., pattern) in the opened log and navigate through the results of the search.
Relations to other components
- Parent: App
- Children:
Props
Name | Type | Description |
---|---|---|
logHeaderColumns |
Header [] |
An array containing the headers displayed in the StructureTable . |
logHeaderColumnsTypes |
StructureHeaderColumnType [] |
An array indicating containing the types for each headers in the StructureTable . |
logSelectedRows |
string[][] |
The selected rows from the LogView |
currentStructureMatchingIndex |
number \| null |
The index of the highlighted occurrence of a structure (i.e., the result of Structure Matching). |
numberOfMatches |
number |
The number of results from the Structure Matching. |
onClose |
function |
A function that indicates to the parent component that the dialog should be closed. |
onStructureUpdate |
function |
A function that clears the selection of rows from the LogView . |
onNavigateStructureMatches |
function |
A function that updates the currentStructureMatchingIndex |
onMatchStructure |
function |
A function passing a regular expression of the structure definition to be run over the log. |
State
Name | Type | Initial Value | Description |
---|---|---|---|
wildcards |
Wildcard [] |
[] |
Keeps track of all wildcards used in structure definition displayed in the Structure Table. |
structureEntries |
StructureEntry [] |
structureEntries |
Keeps track of all entries in the structure definition displayed in the StructureTable . |
isRemovingStructureEntries |
boolean |
false |
Is set to true while the user is removing entries from the structure definition. |
isStructureMatching |
boolean |
false |
Is set to true after the user searches for structure occurrences. It is then reset to false when the structure definition is modified. |
structureHeaderColumnsTypes |
StructureHeaderColumnType [] |
logHeaderColumnsTypes (prop) |
Keeps track of which columns are used during the structure matching (e.g., Timestamp is not used by default). |
Functions
Component lifecycle functions
-
constructor(...)
- Params:
props: Props
- Description: Is invoked the first time the dialog is opened. It constructs an array containing
StructureEntry
from thelogSelectedRows
props and updates the state accordingly. - Returns: -
- Params:
-
componentDidMount()
- Description: This function is invoked after the component is mounted (inserted into the DOM tree). It calls the
onStructureUpdate
function from the props because the first time the component is rendered thecomponentDidUpdate
function is not invoked. - Returns: -
- Description: This function is invoked after the component is mounted (inserted into the DOM tree). It calls the
-
shouldComponentUpdate(...)
- Params:
nextProps: Readonly<Props>
nextState: Readonly<State>
nextContext: any
- Description: This function returns a boolean value that indicates whether or not rendering should be skipped.
- Returns:
boolean
- Params:
-
componentDidUpdate(...)
- Params:
prevProps: Readonly<Props>
_prevState: Readonly<State>
- Description: This function is invoked immediately after updating occurs. Returns: -
- Params:
-
render()
- Description:
- Returns: Div of type
JSX.Element
containing theStructureTable
, ContextMenu and several labels and buttons.
Structure-related functions
-
updateStructure()
- Description: Updates the
structureEntries
in the component state after a user has modified the structure definition by adding new rows from theLogView
. - Returns: -
- Description: Updates the
-
removeStructureEntry(...)
- Params:
rowIndex: number
- Description: Removes a
StructureEntry
at the givenrowIndex
from thestructureEntries
array in the component state and calls theonStructureUpdate()
function from the props to update the state of the parent component accordingly. Returns: -
- Params:
-
toggleIsRemovingStructureEntries()
- Description: Toggles the
isRemovingStructureEntries
boolean
in the state. - Returns: -
- Description: Toggles the
-
toggleIsCellSelected(...)
- Params:
structureEntryIndex: number
cellIndex: number
isCtrlPressed: boolean
isShiftPressed: boolean
- Description: Modifies the
cellCelection
of aStructureEntry
based on thestructureEntryIndex
and thecellIndex
. The twoboolean
values are used to indicate whether one cell needs to be (un)selected (i.e., when Ctrl is pressed) or all other cells (i.e., when Ctrl + Shift is pressed). - Returns: -
- Params:
-
toggleStructureLink(...)
- Params:
structureEntryIndex: number
- Description: Toggles the
StructureLinkDistance
of aStructureEntry
at the given index. - Returns: -
- Params:
-
matchStructure()
- Description: Creates a regular expression based on the structure definition and passes it to the parent component so that the structure can be matched. Then in modifies the state by setting
isStructureMatching
totrue
. - Returns: -
- Description: Creates a regular expression based on the structure definition and passes it to the parent component so that the structure can be matched. Then in modifies the state by setting
-
createWildcard()
- Description: Creates a
Wildcard
based on the user selection and updates the state accordingly. - Returns: -
- Description: Creates a
-
useWildcard(...)
- Params:
wildcardIndex: number
- Description: Replaces part of a structure entry field with a wildcard, based on the text selection and
WildcardIndex
updates the state accordingly. - Returns: -
- Params:
-
removeWildcard(...)
- Params:
anchorDivId: string
- Description: Removes a wildcard from a single place in the structure definition based on the
anchorDivId
, and updates the state accordingly.
If that wildcard is used only in that place, all the other wildcards will be adjusted accordingly. For example, if wildcard ?1 is deleted and there is a wildcard ?2 it will change and become ?1.
- Returns: -
- Params: