Skip to content

Commit

Permalink
[frontend/backend] Custom financial-data route
Browse files Browse the repository at this point in the history
  • Loading branch information
Bonsai8863 committed Jan 25, 2024
1 parent fc41666 commit c1a1e9d
Show file tree
Hide file tree
Showing 27 changed files with 2,209 additions and 1,059 deletions.
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,9 @@
"entity_Media-Content": "Inhalt der Medien",
"entity_Vocabulary": "Vokabeln",
"entity_Notification": "Benachrichtigung",
"entity_Financial-Account": "Bankkonto",
"entity_Financial-Asset": "Finanzielle Vermögenswerte",
"entity_Financial-Transaction": "FinanzielleTransaktion",
"relationship_All": "Alle Arten von Beziehungen",
"relationship_service-dll": "dienst dll",
"relationship_image": "bild",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,9 @@
"entity_Media-Content": "Media content",
"entity_Vocabulary": "Vocabulary",
"entity_Notification": "Notification",
"entity_Financial-Account": "Financial Account",
"entity_Financial-Asset": "Financial Asset",
"entity_Financial-Transaction": "Financial Transaction",
"relationship_All": "All types of relationship",
"relationship_service-dll": "service dll",
"relationship_image": "image",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,9 @@
"entity_Media-Content": "Contenido multimedia",
"entity_Vocabulary": "Vocabulario",
"entity_Notification": "Notificación",
"entity_Financial-Account": "Cuenta financiera",
"entity_Financial-Asset": "Activo financiero",
"entity_Financial-Transaction": "Transacción financiera",
"relationship_All": "Todos los tipos de relación",
"relationship_service-dll": "Dll Servicio",
"relationship_image": "imagen",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,9 @@
"entity_Media-Content": "Contenu média",
"entity_Vocabulary": "Vocabulaire",
"entity_Notification": "Notification",
"entity_Financial-Account": "Compte financier",
"entity_Financial-Asset": "Actif financier",
"entity_Financial-Transaction": "Transaction financière",
"relationship_All": "Tous les types de relation",
"relationship_service-dll": "service dll",
"relationship_image": "image",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,9 @@
"entity_Media-Content": "メディアコンテンツ",
"entity_Vocabulary": "語彙",
"entity_Notification": "通知",
"entity_Financial-Account": "金融口座",
"entity_Financial-Asset": "金融資産",
"entity_Financial-Transaction": "金融取引",
"relationship_All": "全てのタイプのリレーション",
"relationship_service-dll": "DLLサービス",
"relationship_image": "画像",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,9 @@
"entity_Media-Content": "媒体内容",
"entity_Vocabulary": "词汇",
"entity_Notification": "通知",
"entity_Financial-Account": "金融账户",
"entity_Financial-Asset": "金融资产",
"entity_Financial-Transaction": "金融交易",
"relationship_All": "所有关系",
"relationship_service-dll": "服務DLL",
"relationship_image": "圖片",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import React from 'react';
import { Link, useLocation } from 'react-router-dom';
import Button from '@mui/material/Button';
import {
ArchiveOutline,
HexagonOutline,
PiggyBank,
ServerNetwork,
ShieldSearch,
} from 'mdi-material-ui';
import { ArchiveOutline, HexagonOutline, PiggyBank, ServerNetwork, ShieldSearch } from 'mdi-material-ui';
import makeStyles from '@mui/styles/makeStyles';
import { Theme } from '@mui/material/styles/createTheme';
import { useFormatter } from '../../../components/i18n';
Expand Down Expand Up @@ -114,7 +108,7 @@ const TopMenuObservations = () => {
classes={{ root: classes.button }}
>
<PiggyBank className={classes.icon} fontSize="small" />
{t('Financial Data')}
{t_i18n('Financial Data')}
</Button>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React, { FunctionComponent } from 'react';
import ExportContextProvider from 'src/utils/ExportContextProvider';
import { usePaginationLocalStorage } from 'src/utils/hooks/useLocalStorage';
import { filtersWithEntityType, initialFilterGroup } from 'src/utils/filters/filtersUtils';
import { emptyFilterGroup, buildEntityTypeBasedFilterContext } from 'src/utils/filters/filtersUtils';
import ListLines from 'src/components/list_lines/ListLines';
import useEntityToggle from 'src/utils/hooks/useEntityToggle';
import useCopy from 'src/utils/hooks/useCopy';
import useAuth from 'src/utils/hooks/useAuth';
import useQueryLoading from 'src/utils/hooks/useQueryLoading';
import Security from 'src/utils/Security';
import { KNOWLEDGE_KNUPDATE } from 'src/utils/hooks/useGranted';
import { makeStyles } from '@mui/styles';
import { Theme } from 'src/components/Theme';
import FinancialDataLines, { financialDataLinesQuery, financialDataLinesSearchQuery } from './financial_data/FinancialDataLines';
import ToolBar from '../data/ToolBar';
import { FinancialDataLinesPaginationQuery, FinancialDataLinesPaginationQuery$variables } from './financial_data/__generated__/FinancialDataLinesPaginationQuery.graphql';
Expand All @@ -17,8 +19,6 @@ import { FinancialDataLinesSearchQuery$data } from './financial_data/__generated
import { FinancialDataLine_node$data } from './financial_data/__generated__/FinancialDataLine_node.graphql';
import FinancialDataRightBar from './financial_data/FinancialDataRightBar';
import FinancialDataCreation from './financial_data/FinancialDataCreation';
import { makeStyles } from '@mui/styles';
import { Theme } from 'src/components/Theme';

const LOCAL_STORAGE_KEY = 'financialData';

Expand All @@ -37,7 +37,7 @@ const FinancialData: FunctionComponent = () => {
const { viewStorage, paginationOptions, helpers } = usePaginationLocalStorage<FinancialDataLinesPaginationQuery$variables>(
LOCAL_STORAGE_KEY,
{
filters: initialFilterGroup,
filters: emptyFilterGroup,
searchTerm: '',
sortBy: 'created_at',
orderAsc: false,
Expand Down Expand Up @@ -148,78 +148,76 @@ const FinancialData: FunctionComponent = () => {
const finalType = (types && types.length > 0)
? types
: 'Stix-Cyber-Observable';
const toolBarFilters = filtersWithEntityType(filters, finalType);
const toolBarFilters = buildEntityTypeBasedFilterContext(finalType, filters);
return (
<>
<ListLines
sortBy={sortBy}
orderAsc={orderAsc}
dataColumns={buildColumns()}
handleSort={helpers.handleSort}
handleSearch={helpers.handleSearch}
handleAddFilter={helpers.handleAddFilter}
handleRemoveFilter={helpers.handleRemoveFilter}
handleSwitchGlobalMode={helpers.handleSwitchGlobalMode}
handleSwitchLocalMode={helpers.handleSwitchLocalMode}
handleToggleSelectAll={handleToggleSelectAll}
openExports={openExports}
selectAll={selectAll}
exportEntityType="Financial-Data"
exportContext={null}
keyword={searchTerm}
filters={filters}
iconExtension={true}
paginationOptions={paginationOptions}
numberOfElements={numberOfElements}
availableFilterKeys={[
'objectLabel',
'objectMarking',
'created_at',
'x_opencti_score',
'createdBy',
'sightedBy',
'creator_id',
]}
>
{queryRef && (
<React.Suspense
fallback={
<>
{Array(20)
.fill(0)
.map((_, idx) => (
<FinancialDataLineDummy key={idx} />
))
}
</>
}
>
<FinancialDataLines
queryRef={queryRef}
paginationOptions={paginationOptions}
dataColumns={buildColumns()}
onLabelClick={helpers.handleAddFilter}
selectedElements={selectedElements}
deSelectedElements={deSelectedElements}
onToggleEntity={onToggleEntity}
selectAll={selectAll}
setNumberOfElements={helpers.handleSetNumberOfElements}
/>
<ToolBar
selectedElements={selectedElements}
deSelectedElements={deSelectedElements}
numberOfSelectedElements={numberOfSelectedElements}
selectAll={selectAll}
filters={toolBarFilters}
search={searchTerm}
handleClearSelectedElements={handleClearSelectedElements}
variant="large"
handleCopy={handleCopy}
/>
</React.Suspense>
)}
</ListLines>
</>
<ListLines
sortBy={sortBy}
orderAsc={orderAsc}
dataColumns={buildColumns()}
handleSort={helpers.handleSort}
handleSearch={helpers.handleSearch}
handleAddFilter={helpers.handleAddFilter}
handleRemoveFilter={helpers.handleRemoveFilter}
handleSwitchGlobalMode={helpers.handleSwitchGlobalMode}
handleSwitchLocalMode={helpers.handleSwitchLocalMode}
handleToggleSelectAll={handleToggleSelectAll}
openExports={openExports}
selectAll={selectAll}
exportEntityType="Financial-Data"
exportContext={null}
keyword={searchTerm}
filters={filters}
iconExtension={true}
paginationOptions={paginationOptions}
numberOfElements={numberOfElements}
availableFilterKeys={[
'objectLabel',
'objectMarking',
'created_at',
'x_opencti_score',
'createdBy',
'sightedBy',
'creator_id',
]}
>
{queryRef && (
<React.Suspense
fallback={
<>
{Array(20)
.fill(0)
.map((_, idx) => (
<FinancialDataLineDummy key={idx} />
))
}
</>
}
>
<FinancialDataLines
queryRef={queryRef}
paginationOptions={paginationOptions}
dataColumns={buildColumns()}
onLabelClick={helpers.handleAddFilter}
selectedElements={selectedElements}
deSelectedElements={deSelectedElements}
onToggleEntity={onToggleEntity}
selectAll={selectAll}
setNumberOfElements={helpers.handleSetNumberOfElements}
/>
<ToolBar
selectedElements={selectedElements}
deSelectedElements={deSelectedElements}
numberOfSelectedElements={numberOfSelectedElements}
selectAll={selectAll}
filters={toolBarFilters}
search={searchTerm}
handleClearSelectedElements={handleClearSelectedElements}
variant="large"
handleCopy={handleCopy}
/>
</React.Suspense>
)}
</ListLines>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const RootIndicator = lazy(() => import('./indicators/Root'));
const Infrastructures = lazy(() => import('./Infrastructures'));
const RootInfrastructure = lazy(() => import('./infrastructures/Root'));
const FinancialData = lazy(() => import('./FinancialData'));
const RootFinancialData = lazy(() => import('./financial_data/Root'));

const Root = () => {
let redirect: string | null = null;
Expand Down Expand Up @@ -81,6 +82,10 @@ const Root = () => {
path="/dashboard/observations/financial-data"
component={FinancialData}
/>
<BoundaryRoute
path="/dashboard/observations/financial-data/:financialDataId"
component={RootFinancialData}
/>
</Switch>
</Suspense>
);
Expand Down
Loading

0 comments on commit c1a1e9d

Please sign in to comment.