-
Notifications
You must be signed in to change notification settings - Fork 930
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[front]add breadcrumb notes, external references & tsx(#8274)
- Loading branch information
1 parent
833baf4
commit 628330d
Showing
7 changed files
with
264 additions
and
302 deletions.
There are no files selected for viewing
87 changes: 0 additions & 87 deletions
87
opencti-platform/opencti-front/src/private/components/analyses/external_references/Root.jsx
This file was deleted.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
opencti-platform/opencti-front/src/private/components/analyses/external_references/Root.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,75 @@ | ||
import React, { useMemo } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { graphql, useSubscription } from 'react-relay'; | ||
import { useFormatter } from '../../../../components/i18n'; | ||
import { QueryRenderer } from '../../../../relay/environment'; | ||
import ExternalReference from './ExternalReference'; | ||
import Loader from '../../../../components/Loader'; | ||
import ErrorNotFound from '../../../../components/ErrorNotFound'; | ||
import Breadcrumbs from '../../../../components/Breadcrumbs'; | ||
|
||
const subscription = graphql` | ||
subscription RootExternalReferenceSubscription($id: ID!) { | ||
externalReference(id: $id) { | ||
...ExternalReference_externalReference | ||
} | ||
} | ||
`; | ||
|
||
const externalReferenceQuery = graphql` | ||
query RootExternalReferenceQuery($id: String!) { | ||
externalReference(id: $id) { | ||
standard_id | ||
...ExternalReference_externalReference | ||
} | ||
connectorsForImport { | ||
...ExternalReference_connectorsImport | ||
} | ||
} | ||
`; | ||
|
||
const RootExternalReference = () => { | ||
const { externalReferenceId } = useParams(); | ||
const subConfig = useMemo( | ||
() => ({ | ||
subscription, | ||
variables: { id: externalReferenceId }, | ||
}), | ||
[externalReferenceId], | ||
); | ||
|
||
const { t_i18n } = useFormatter(); | ||
useSubscription(subConfig); | ||
|
||
return ( | ||
<div> | ||
<QueryRenderer | ||
query={externalReferenceQuery} | ||
variables={{ id: externalReferenceId }} | ||
render={({ props }) => { | ||
if (props) { | ||
if (props.externalReference && props.connectorsForImport) { | ||
return ( | ||
<> | ||
<Breadcrumbs variant="object" elements={[ | ||
{ label: t_i18n('Analyses') }, | ||
{ label: t_i18n('External references'), link: '/dashboard/analyses/external_references' }, | ||
]} | ||
/> | ||
<ExternalReference | ||
externalReference={props.externalReference} | ||
connectorsImport={props.connectorsForImport} | ||
/> | ||
</> | ||
); | ||
} | ||
return <ErrorNotFound/>; | ||
} | ||
return <Loader/>; | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RootExternalReference; |
212 changes: 0 additions & 212 deletions
212
opencti-platform/opencti-front/src/private/components/analyses/notes/Root.jsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.