Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Rules UI/UX improvements #592

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cypress/integration/2_rules.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Rules', () => {

// Check that correct page is showing
cy.waitForPageLoad('rules', {
contains: 'Rules',
contains: 'Detection rules',
});
});

Expand Down Expand Up @@ -223,15 +223,15 @@ describe('Rules', () => {
cy.wait('@getRules');

cy.waitForPageLoad('rules', {
contains: 'Rules',
contains: 'Detection rules',
});

checkRulesFlyout();
});

it('...can be edited', () => {
cy.waitForPageLoad('rules', {
contains: 'Rules',
contains: 'Detection rules',
});

cy.get(`input[placeholder="Search rules"]`).ospSearch(SAMPLE_RULE.name);
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('Rules', () => {
});

cy.waitForPageLoad('rules', {
contains: 'Rules',
contains: 'Detection rules',
});

cy.wait('@getRules');
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"osd": "node ../../scripts/osd",
"opensearch": "node ../../scripts/opensearch",
"lint": "node ../../scripts/eslint .",
Expand Down
1 change: 1 addition & 0 deletions public/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $euiTextColor: $euiColorDarkestShade !default;
@import "./pages/Correlations/Correlations.scss";
@import "./pages/Correlations/components/FindingCard.scss";
@import "./pages/Findings/components/CorrelationsTable/CorrelationsTable.scss";
@import "./pages/Rules/components/RuleEditor/RuleEditorForm.scss";

.selected-radio-panel {
background-color: tintOrShade($euiColorPrimary, 90%, 70%);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { validateRule } from '../../utils/helpers';
import { DataStore } from '../../../../store/DataStore';

export interface RuleEditorProps {
title: string;
title: string | JSX.Element;
rule?: Rule;
history: RouteComponentProps['history'];
notifications?: NotificationsStart;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.rule-editor-form {
.euiFlexGroup--gutterLarge + hr {
height: 0;
margin-bottom: 25px;
}
}
4 changes: 2 additions & 2 deletions public/pages/Rules/components/RuleEditor/RuleEditorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface VisualRuleEditorProps {
submit: (values: RuleEditorFormModel) => void;
cancel: () => void;
mode: 'create' | 'edit';
title: string;
title: string | JSX.Element;
}

const editorTypes = [
Expand Down Expand Up @@ -119,7 +119,7 @@ export const RuleEditorForm: React.FC<VisualRuleEditorProps> = ({
>
{(props) => (
<Form>
<ContentPanel title={title}>
<ContentPanel title={title} className={'rule-editor-form'}>
<EuiButtonGroup
data-test-subj="change-editor-type"
legend="This is editor type selector"
Expand Down
18 changes: 17 additions & 1 deletion public/pages/Rules/containers/CreateRule/CreateRule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { BREADCRUMBS } from '../../../../utils/constants';
import { CoreServicesContext } from '../../../../components/core_services';
import { NotificationsStart } from 'opensearch-dashboards/public';
import { setBreadCrumb } from '../../utils/helpers';
import { EuiTitle, EuiText, EuiLink } from '@elastic/eui';

export interface CreateRuleProps {
services: BrowserServices;
Expand All @@ -24,7 +25,22 @@ export const CreateRule: React.FC<CreateRuleProps> = ({ history, services, notif

return (
<RuleEditorContainer
title="Create a rule"
title={
<>
<EuiTitle size={'m'}>
<h3>Create detection rule</h3>
</EuiTitle>
<EuiText size="s" color="subdued">
Create a rule for detectors to identify threat scenarios for different log sources.{' '}
<EuiLink
href="https://sigmahq.github.io/sigma-specification/Sigma_specification.html"
target="_blank"
>
Learn more in the Sigma rules specification
</EuiLink>
</EuiText>
</>
}
history={history}
notifications={notifications}
mode={'create'}
Expand Down
4 changes: 2 additions & 2 deletions public/pages/Rules/containers/Rules/Rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const Rules: React.FC<RulesProps> = (props) => {
Import rule
</EuiButton>,
<EuiButton onClick={openCreatePage} data-test-subj={'create_rule_button'} fill={true}>
Create new rule
Create detection rule
</EuiButton>,
],
[]
Expand Down Expand Up @@ -99,7 +99,7 @@ export const Rules: React.FC<RulesProps> = (props) => {
<EuiFlexGroup gutterSize={'s'} justifyContent={'spaceBetween'}>
<EuiFlexItem>
<EuiTitle size="m">
<h1>Rules</h1>
<h1>Detection rules</h1>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
4 changes: 2 additions & 2 deletions public/pages/Rules/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const getRulesTableSearchConfig = (): Search => {
{
type: 'field_value_selection',
field: 'category',
name: 'Rule Type',
name: 'Log type',
multiSelect: 'or',
options: ruleTypes.map(({ value, label }) => ({
value,
Expand All @@ -94,7 +94,7 @@ export const getRulesTableSearchConfig = (): Search => {
{
type: 'field_value_selection',
field: 'level',
name: 'Rule Severity',
name: 'Rule severity',
multiSelect: 'or',
options: ruleSeverity,
},
Expand Down
4 changes: 2 additions & 2 deletions public/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export const BREADCRUMBS = Object.freeze({
text: `${name}`,
href: `#${ROUTES.EDIT_DETECTOR_DETAILS}/${detectorId}`,
}),
RULES: { text: 'Rules', href: `#${ROUTES.RULES}` },
RULES: { text: 'Detection rules', href: `#${ROUTES.RULES}` },
ALERTS: { text: 'Alerts', href: `#${ROUTES.ALERTS}` },
RULES_CREATE: { text: 'Create rule', href: `#${ROUTES.RULES_CREATE}` },
RULES_CREATE: { text: 'Create detection rule', href: `#${ROUTES.RULES_CREATE}` },
RULES_EDIT: { text: 'Edit rule', href: `#${ROUTES.RULES_EDIT}` },
RULES_DUPLICATE: { text: 'Duplicate rule', href: `#${ROUTES.RULES_DUPLICATE}` },
RULES_IMPORT: { text: 'Import rule', href: `#${ROUTES.RULES_IMPORT}` },
Expand Down