-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add components for
name
, description
and tags
- Loading branch information
1 parent
f029f80
commit 6483996
Showing
8 changed files
with
226 additions
and
1 deletion.
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
39 changes: 39 additions & 0 deletions
39
...nts/rule_details/three_way_diff/final_readonly/fields/description/description.stories.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,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Story } from '@storybook/react'; | ||
import { DescriptionReadOnly } from './description'; | ||
import { FieldReadOnly } from '../../field_readonly'; | ||
import type { DiffableAllFields } from '../../../../../../../../../common/api/detection_engine'; | ||
|
||
export default { | ||
component: DescriptionReadOnly, | ||
title: 'Rule Management/Prebuilt Rules/Upgrade Flyout/ThreeWayDiff/FieldReadOnly/description', | ||
}; | ||
|
||
interface TemplateProps { | ||
finalDiffableRule: Partial<DiffableAllFields>; | ||
} | ||
|
||
const Template: Story<TemplateProps> = (args) => { | ||
return ( | ||
<FieldReadOnly | ||
fieldName="description" | ||
finalDiffableRule={args.finalDiffableRule as DiffableAllFields} | ||
/> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind({}); | ||
|
||
Default.args = { | ||
finalDiffableRule: { | ||
description: | ||
"Identifies the occurrence of a security alert from the Google Workspace alerts center. Google Workspace's security alert center provides an overview of actionable alerts that may be affecting an organization's domain. An alert is a warning of a potential security issue that Google has detected.", | ||
}, | ||
}; |
36 changes: 36 additions & 0 deletions
36
.../components/rule_details/three_way_diff/final_readonly/fields/description/description.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,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiDescriptionList } from '@elastic/eui'; | ||
import * as ruleDetailsI18n from '../../../../translations'; | ||
import type { DiffableAllFields } from '../../../../../../../../../common/api/detection_engine'; | ||
|
||
interface RuleDescriptionProps { | ||
description: DiffableAllFields['name']; | ||
} | ||
|
||
function RuleDescription({ description }: RuleDescriptionProps) { | ||
return <>{description}</>; | ||
} | ||
|
||
interface DescriptionReadOnlyProps { | ||
description: DiffableAllFields['description']; | ||
} | ||
|
||
export function DescriptionReadOnly({ description }: DescriptionReadOnlyProps) { | ||
return ( | ||
<EuiDescriptionList | ||
listItems={[ | ||
{ | ||
title: ruleDetailsI18n.DESCRIPTION_FIELD_LABEL, | ||
description: <RuleDescription description={description} />, | ||
}, | ||
]} | ||
/> | ||
); | ||
} |
38 changes: 38 additions & 0 deletions
38
...gement/components/rule_details/three_way_diff/final_readonly/fields/name/name.stories.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,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Story } from '@storybook/react'; | ||
import { NameReadOnly } from './name'; | ||
import { FieldReadOnly } from '../../field_readonly'; | ||
import type { DiffableAllFields } from '../../../../../../../../../common/api/detection_engine'; | ||
|
||
export default { | ||
component: NameReadOnly, | ||
title: 'Rule Management/Prebuilt Rules/Upgrade Flyout/ThreeWayDiff/FieldReadOnly/name', | ||
}; | ||
|
||
interface TemplateProps { | ||
finalDiffableRule: Partial<DiffableAllFields>; | ||
} | ||
|
||
const Template: Story<TemplateProps> = (args) => { | ||
return ( | ||
<FieldReadOnly | ||
fieldName="name" | ||
finalDiffableRule={args.finalDiffableRule as DiffableAllFields} | ||
/> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind({}); | ||
|
||
Default.args = { | ||
finalDiffableRule: { | ||
name: 'Forwarded Google Workspace Security Alert', | ||
}, | ||
}; |
36 changes: 36 additions & 0 deletions
36
...ule_management/components/rule_details/three_way_diff/final_readonly/fields/name/name.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,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiDescriptionList } from '@elastic/eui'; | ||
import * as ruleDetailsI18n from '../../../../translations'; | ||
import type { DiffableAllFields } from '../../../../../../../../../common/api/detection_engine'; | ||
|
||
interface RuleNameProps { | ||
name: DiffableAllFields['name']; | ||
} | ||
|
||
function RuleName({ name }: RuleNameProps) { | ||
return <>{name}</>; | ||
} | ||
|
||
interface NameReadOnlyProps { | ||
name: DiffableAllFields['name']; | ||
} | ||
|
||
export function NameReadOnly({ name }: NameReadOnlyProps) { | ||
return ( | ||
<EuiDescriptionList | ||
listItems={[ | ||
{ | ||
title: ruleDetailsI18n.NAME_FIELD_LABEL, | ||
description: <RuleName name={name} />, | ||
}, | ||
]} | ||
/> | ||
); | ||
} |
38 changes: 38 additions & 0 deletions
38
...gement/components/rule_details/three_way_diff/final_readonly/fields/tags/tags.stories.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,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Story } from '@storybook/react'; | ||
import { TagsReadOnly } from './tags'; | ||
import { FieldReadOnly } from '../../field_readonly'; | ||
import type { DiffableAllFields } from '../../../../../../../../../common/api/detection_engine'; | ||
|
||
export default { | ||
component: TagsReadOnly, | ||
title: 'Rule Management/Prebuilt Rules/Upgrade Flyout/ThreeWayDiff/FieldReadOnly/tags', | ||
}; | ||
|
||
interface TemplateProps { | ||
finalDiffableRule: Partial<DiffableAllFields>; | ||
} | ||
|
||
const Template: Story<TemplateProps> = (args) => { | ||
return ( | ||
<FieldReadOnly | ||
fieldName="tags" | ||
finalDiffableRule={args.finalDiffableRule as DiffableAllFields} | ||
/> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind({}); | ||
|
||
Default.args = { | ||
finalDiffableRule: { | ||
tags: ['Elastic', 'Cloud', 'Google Workspace', 'Log Auditing', 'Threat Detection'], | ||
}, | ||
}; |
29 changes: 29 additions & 0 deletions
29
...ule_management/components/rule_details/three_way_diff/final_readonly/fields/tags/tags.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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiDescriptionList } from '@elastic/eui'; | ||
import * as ruleDetailsI18n from '../../../../translations'; | ||
import type { DiffableAllFields } from '../../../../../../../../../common/api/detection_engine'; | ||
import { Tags } from '../../../../rule_about_section'; | ||
|
||
interface TagsReadOnlyProps { | ||
tags: DiffableAllFields['tags']; | ||
} | ||
|
||
export function TagsReadOnly({ tags }: TagsReadOnlyProps) { | ||
return ( | ||
<EuiDescriptionList | ||
listItems={[ | ||
{ | ||
title: ruleDetailsI18n.TAGS_FIELD_LABEL, | ||
description: <Tags tags={tags} />, | ||
}, | ||
]} | ||
/> | ||
); | ||
} |