-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Custom log types] Show log types table, Log type creation workflow (o…
…pensearch-project#674) * log types table; details page with basic editing Signed-off-by: Amardeepsingh Siglani <[email protected]> * updated snapshots Signed-off-by: Amardeepsingh Siglani <[email protected]> * addressed PR comments Signed-off-by: Amardeepsingh Siglani <[email protected]> * updated cypress workflow Signed-off-by: Amardeepsingh Siglani <[email protected]> * updated detector cypress test Signed-off-by: Amardeepsingh Siglani <[email protected]> --------- Signed-off-by: Amardeepsingh Siglani <[email protected]>
- Loading branch information
Showing
34 changed files
with
957 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
EuiButton, | ||
EuiDescriptionList, | ||
EuiFormRow, | ||
EuiFieldText, | ||
EuiSpacer, | ||
EuiTextArea, | ||
EuiBottomBar, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiButtonEmpty, | ||
} from '@elastic/eui'; | ||
import { ContentPanel } from '../../../components/ContentPanel'; | ||
import React from 'react'; | ||
import { LogTypeItem } from '../../../../types'; | ||
import { DataStore } from '../../../store/DataStore'; | ||
|
||
export interface LogTypeDetailsTabProps { | ||
initialLogTypeDetails: LogTypeItem; | ||
logTypeDetails: LogTypeItem; | ||
isEditMode: boolean; | ||
setIsEditMode: (isEdit: boolean) => void; | ||
setLogTypeDetails: (logType: LogTypeItem) => void; | ||
} | ||
|
||
export const LogTypeDetailsTab: React.FC<LogTypeDetailsTabProps> = ({ | ||
initialLogTypeDetails, | ||
logTypeDetails, | ||
isEditMode, | ||
setIsEditMode, | ||
setLogTypeDetails, | ||
}) => { | ||
const onUpdateLogType = async () => { | ||
const success = await DataStore.logTypes.updateLogType(logTypeDetails); | ||
if (success) { | ||
setIsEditMode(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<ContentPanel | ||
title="Details" | ||
actions={!isEditMode && [<EuiButton onClick={() => setIsEditMode(true)}>Edit</EuiButton>]} | ||
> | ||
<EuiDescriptionList | ||
type="column" | ||
listItems={[ | ||
{ | ||
title: 'Log type', | ||
description: ( | ||
<> | ||
<EuiFormRow label="Name"> | ||
<EuiFieldText | ||
value={logTypeDetails?.name} | ||
onChange={(e) => | ||
setLogTypeDetails({ | ||
...logTypeDetails!, | ||
name: e.target.value, | ||
}) | ||
} | ||
placeholder="Enter name for log type" | ||
disabled={!isEditMode || !!logTypeDetails.detectionRules} | ||
/> | ||
</EuiFormRow> | ||
<EuiSpacer /> | ||
<EuiFormRow label="Description"> | ||
<EuiTextArea | ||
value={logTypeDetails?.description} | ||
onChange={(e) => | ||
setLogTypeDetails({ | ||
...logTypeDetails!, | ||
description: e.target.value, | ||
}) | ||
} | ||
placeholder="Description of the log type" | ||
disabled={!isEditMode} | ||
/> | ||
</EuiFormRow> | ||
{isEditMode ? ( | ||
<EuiBottomBar> | ||
<EuiFlexGroup gutterSize="s" justifyContent="flexEnd"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty | ||
color="ghost" | ||
size="s" | ||
iconType="cross" | ||
onClick={() => { | ||
setLogTypeDetails(initialLogTypeDetails); | ||
setIsEditMode(false); | ||
}} | ||
> | ||
Cancel | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton color="primary" fill size="s" onClick={onUpdateLogType}> | ||
Update | ||
</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiBottomBar> | ||
) : null} | ||
</> | ||
), | ||
}, | ||
]} | ||
/> | ||
</ContentPanel> | ||
); | ||
}; |
10 changes: 10 additions & 0 deletions
10
public/pages/LogTypes/components/LogTypeDetectionRules.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export interface LogTypeDetectionRulesProps { | ||
logTypeId: string; | ||
} | ||
|
||
export const LogTypeDetectionRules = () => {}; |
Oops, something went wrong.