Skip to content

Commit

Permalink
add filters and warning and action to add rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Llandy3d committed Sep 20, 2024
1 parent c8a024a commit ea0fa23
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/views/Generator/NewRuleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ export function NewRuleMenu() {
createRule('correlation')
}}
>
Correlation rule
Correlation
</DropdownMenu.Item>
<DropdownMenu.Item
onClick={() => {
createRule('customCode')
}}
>
Custom code rule
Custom code
</DropdownMenu.Item>
<DropdownMenu.Item
onClick={() => {
createRule('verification')
}}
>
Verification (limited)
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { CorrelationRule, CustomCodeRule, TestRule } from '@/types/rules'
import {
CorrelationRule,
CustomCodeRule,
TestRule,
VerificationRule,
} from '@/types/rules'
import { TestRuleFilter } from './TestRuleFilter'
import { Badge, Tooltip } from '@radix-ui/themes'
import { exhaustive } from '@/utils/typescript'
Expand All @@ -8,6 +13,7 @@ import {
BorderRightIcon,
EyeOpenIcon,
DiscIcon,
ExclamationTriangleIcon,
} from '@radix-ui/react-icons'

interface TestRuleInlineContentProps {
Expand All @@ -21,23 +27,32 @@ export function TestRuleInlineContent({ rule }: TestRuleInlineContentProps) {
case 'customCode':
return <CustomCodeContent rule={rule} />
case 'parameterization':
return null
case 'verification':
return <VerificationContent />
return <VerificationContent rule={rule} />
default:
return exhaustive(rule)
}
}

function VerificationContent() {
function VerificationContent({ rule }: { rule: VerificationRule }) {
return (
<>
<TestRuleFilter filter={rule.filter} />{' '}
<Tooltip
content={`Checks will be added for status to be the same as the recording.`}
>
<Badge color="gray">
<DiscIcon /> Recording
</Badge>
</Tooltip>
<Tooltip
content={`Only have a single Verification rule per generator, this is still a work in progress.`}
>
<Badge color="orange">
<ExclamationTriangleIcon />
</Badge>
</Tooltip>
</>
)
}
Expand Down

0 comments on commit ea0fa23

Please sign in to comment.