Skip to content

Commit

Permalink
[frontend] case incident RTFS and RTIS
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkha committed Mar 12, 2024
1 parent e3e9a72 commit 523632d
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 464 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import StixCoreObjectFilesAndHistory from '../../common/stix_core_objects/StixCo
import StixDomainObjectContent from '../../common/stix_domain_objects/StixDomainObjectContent';
import inject18n from '../../../../components/i18n';
import withRouter from '../../../../utils/compat-router/withRouter';
import Breadcrumbs from '../../../../components/Breadcrumps';
import Breadcrumbs from '../../../../components/Breadcrumbs';

const subscription = graphql`
subscription RootReportSubscription($id: ID!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ const Root = () => {
Component={boundaryWrapper(CaseRfis)}
/>
<Route
path="/rfis/:caseId"
path="/rfis/:caseId/*"
Component={boundaryWrapper(RootCaseRfi)}
/>
<Route
path="/rfts"
Component={boundaryWrapper(CaseRfts)}
/>
<Route
path="/rfts/:caseId"
path="/rfts/:caseId/*"
Component={boundaryWrapper(RootCaseRft)}
/>
<Route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as R from 'ramda';
import { propOr } from 'ramda';
import { createFragmentContainer, graphql } from 'react-relay';
import withStyles from '@mui/styles/withStyles';
import { Route } from 'react-router-dom';
import { Route, Routes } from 'react-router-dom';
import { QueryRenderer } from '../../../../relay/environment';
import ContainerHeader from '../../common/containers/ContainerHeader';
import Loader, { LoaderVariant } from '../../../../components/Loader';
Expand Down Expand Up @@ -219,9 +219,7 @@ class CaseRfiKnowledgeComponent extends Component {
classes,
caseData,
location,
match: {
params: { mode },
},
params: { '*': mode },
} = this.props;
const {
currentModeOnlyActive,
Expand Down Expand Up @@ -269,89 +267,19 @@ class CaseRfiKnowledgeComponent extends Component {
investigationAddFromContainer={investigationAddFromContainer}
/>
)}
<Route
exact
path="/dashboard/cases/rfis/:caseId/knowledge/graph"
render={() => (
<QueryRenderer
query={caseRfiKnowledgeGraphQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.caseRfi) {
return (
<CaseRfiKnowledgeGraph
caseData={props.caseRfi}
mode={mode}
/>
);
}
return (
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}}
/>
)}
/>
<Route
exact
path="/dashboard/cases/rfis/:caseId/knowledge/content"
render={() => (
<QueryRenderer
query={containerContentQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.container) {
return <ContainerContent containerData={props.container} />;
}
return (
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}}
/>
)}
/>
<Route
exact
path="/dashboard/cases/rfis/:caseId/knowledge/timeline"
render={() => (
<>
<ContentKnowledgeTimeLineBar
handleTimeLineSearch={this.handleTimeLineSearch.bind(this)}
timeLineSearchTerm={timeLineSearchTerm}
timeLineDisplayRelationships={timeLineDisplayRelationships}
handleToggleTimeLineDisplayRelationships={this.handleToggleTimeLineDisplayRelationships.bind(
this,
)}
timeLineFunctionalDate={timeLineFunctionalDate}
handleToggleTimeLineFunctionalDate={this.handleToggleTimeLineFunctionalDate.bind(
this,
)}
timeLineFilters={timeLineFilters}
handleAddTimeLineFilter={this.handleAddTimeLineFilter.bind(
this,
)}
handleRemoveTimeLineFilter={this.handleRemoveTimeLineFilter.bind(
this,
)}
handleSwitchFilterLocalMode={this.handleSwitchFilterLocalMode.bind(this)}
handleSwitchFilterGlobalMode={this.handleSwitchFilterGlobalMode.bind(this)}
/>
<Routes>
<Route
path="/graph"
element={
<QueryRenderer
query={caseRfiKnowledgeTimeLineQuery}
variables={{ id: caseData.id, ...timeLinePaginationOptions }}
query={caseRfiKnowledgeGraphQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.caseRfi) {
return (
<CaseRfiKnowledgeTimeLine
<CaseRfiKnowledgeGraph
caseData={props.caseRfi}
dateAttribute={orderBy}
displayRelationships={timeLineDisplayRelationships}
mode={mode}
/>
);
}
Expand All @@ -363,75 +291,142 @@ class CaseRfiKnowledgeComponent extends Component {
);
}}
/>
</>
)}
/>
<Route
exact
path="/dashboard/cases/rfis/:caseId/knowledge/correlation"
render={() => (
<QueryRenderer
query={caseRfiKnowledgeCorrelationQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.caseRfi) {
}
/>
<Route
path="/content"
element={
<QueryRenderer
query={containerContentQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.container) {
return <ContainerContent containerData={props.container} />;
}
return (
<CaseRfiKnowledgeCorrelation caseData={props.caseRfi} />
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}
return (
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}}
/>
)}
/>
<Route
exact
path="/dashboard/cases/rfis/:caseId/knowledge/matrix"
render={() => (
<QueryRenderer
query={caseRfiKnowledgeAttackPatternsGraphQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.caseRfi) {
const attackPatterns = R.pipe(
R.map((n) => n.node),
R.filter((n) => n.entity_type === 'Attack-Pattern'),
)(props.caseRfi.objects.edges);
}}
/>
}
/>
<Route
path="/timeline"
element={
<>
<ContentKnowledgeTimeLineBar
handleTimeLineSearch={this.handleTimeLineSearch.bind(this)}
timeLineSearchTerm={timeLineSearchTerm}
timeLineDisplayRelationships={timeLineDisplayRelationships}
handleToggleTimeLineDisplayRelationships={this.handleToggleTimeLineDisplayRelationships.bind(
this,
)}
timeLineFunctionalDate={timeLineFunctionalDate}
handleToggleTimeLineFunctionalDate={this.handleToggleTimeLineFunctionalDate.bind(
this,
)}
timeLineFilters={timeLineFilters}
handleAddTimeLineFilter={this.handleAddTimeLineFilter.bind(
this,
)}
handleRemoveTimeLineFilter={this.handleRemoveTimeLineFilter.bind(
this,
)}
handleSwitchFilterLocalMode={this.handleSwitchFilterLocalMode.bind(this)}
handleSwitchFilterGlobalMode={this.handleSwitchFilterGlobalMode.bind(this)}
/>
<QueryRenderer
query={caseRfiKnowledgeTimeLineQuery}
variables={{ id: caseData.id, ...timeLinePaginationOptions }}
render={({ props }) => {
if (props && props.caseRfi) {
return (
<CaseRfiKnowledgeTimeLine
caseData={props.caseRfi}
dateAttribute={orderBy}
displayRelationships={timeLineDisplayRelationships}
/>
);
}
return (
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}}
/>
</>
}
/>
<Route
path="/correlation"
element={
<QueryRenderer
query={caseRfiKnowledgeCorrelationQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.caseRfi) {
return (
<CaseRfiKnowledgeCorrelation caseData={props.caseRfi} />
);
}
return (
<AttackPatternsMatrix
entity={caseData}
attackPatterns={attackPatterns}
searchTerm=""
currentKillChain={currentKillChain}
currentModeOnlyActive={currentModeOnlyActive}
currentColorsReversed={currentColorsReversed}
handleChangeKillChain={this.handleChangeKillChain.bind(
this,
)}
handleToggleColorsReversed={this.handleToggleColorsReversed.bind(
this,
)}
handleToggleModeOnlyActive={this.handleToggleModeOnlyActive.bind(
this,
)}
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}
return (
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}}
/>
)}
/>
}}
/>
}
/>
<Route
path="/matrix"
element={
<QueryRenderer
query={caseRfiKnowledgeAttackPatternsGraphQuery}
variables={{ id: caseData.id }}
render={({ props }) => {
if (props && props.caseRfi) {
const attackPatterns = R.pipe(
R.map((n) => n.node),
R.filter((n) => n.entity_type === 'Attack-Pattern'),
)(props.caseRfi.objects.edges);
return (
<AttackPatternsMatrix
entity={caseData}
attackPatterns={attackPatterns}
searchTerm=""
currentKillChain={currentKillChain}
currentModeOnlyActive={currentModeOnlyActive}
currentColorsReversed={currentColorsReversed}
handleChangeKillChain={this.handleChangeKillChain.bind(
this,
)}
handleToggleColorsReversed={this.handleToggleColorsReversed.bind(
this,
)}
handleToggleModeOnlyActive={this.handleToggleModeOnlyActive.bind(
this,
)}
/>
);
}
return (
<Loader
variant={LoaderVariant.inElement}
withTopMargin={true}
/>
);
}}
/>
}
/>
</Routes>
</div>
);
}
Expand Down
Loading

0 comments on commit 523632d

Please sign in to comment.