Skip to content

Commit

Permalink
ui: display AlgorithmicDetection component if method_type is code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Kurz authored and regit committed Jun 12, 2024
1 parent b2a3204 commit dc805b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 9 additions & 4 deletions ui/app/RulePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import styled from 'styled-components';

import * as config from 'config/Api';
import { buildQFilter } from 'ui/buildQFilter';
import { AlgorithmicDetection } from 'ui/components/AlgorithmicDetection';
import EventValue from 'ui/components/EventValue';
import { MethodTitle } from 'ui/components/Flow/MethodTitle';
import RuleEditKebab from 'ui/components/RuleEditKebab';
Expand Down Expand Up @@ -198,10 +199,14 @@ class RulePage extends React.Component {
{!isEmpty(this.state.rule.method) && <MethodTitle method={this.state.rule.method} />}

<div>
<div style={{ display: 'grid', gridTemplateColumns: '1fr max-content', gridGap: '10px', marginBottom: '10px' }}>
{this.state.rule?.versions?.length === 1 && <Signature rule={this.state.rule.versions[0]} />}
{this.state.rule?.versions?.length > 1 && <Tabs defaultActiveKey="1" items={items} />}
</div>
{this.state.rule?.method?.method_type === 'code' ? (
<AlgorithmicDetection rule={this.state.rule} />
) : (
<div style={{ display: 'grid', gridTemplateColumns: '1fr max-content', gridGap: '10px', marginBottom: '10px' }}>
{this.state.rule?.versions?.length === 1 && <Signature rule={this.state.rule.versions[0]} />}
{this.state.rule?.versions?.length > 1 && <Tabs defaultActiveKey="1" items={items} />}
</div>
)}

{this.state.rule.timeline && <SignatureTimeline sid={this.state.sid} />}

Expand Down
11 changes: 9 additions & 2 deletions ui/app/components/ExpandedSignature/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Empty, Tabs } from 'antd';
import PropTypes from 'prop-types';
import styled from 'styled-components';

import { AlgorithmicDetection } from 'ui/components/AlgorithmicDetection';
import EventValue from 'ui/components/EventValue';
import { Signature } from 'ui/components/Signature';
import UICard from 'ui/components/UIElements/UICard';
Expand Down Expand Up @@ -97,8 +98,14 @@ export const ExpandedSignature = ({ rule, Flow, MethodTitle, additionalCards = [
return (
<div style={{ width: 'calc(100vw - 271px)' }}>
{MethodTitle}
{rule.versions?.length === 1 && <Signature rule={rule.versions[0]} key={rule.versions[0].id} />}
{rule.versions?.length > 1 && <Tabs defaultActiveKey="1" items={items} />}
{rule.method?.method_type === 'code' ? (
<AlgorithmicDetection rule={rule} />
) : (
<>
{rule.versions?.length === 1 && <Signature rule={rule.versions[0]} key={rule.versions[0].id} />}
{rule.versions?.length > 1 && <Tabs defaultActiveKey="1" items={items} />}
</>
)}
<SignatureTimeline sid={rule.sid} />
<Row>
{cards.map(card => (
Expand Down

0 comments on commit dc805b2

Please sign in to comment.