Skip to content

Commit

Permalink
[frontend] New import screens under feature flag (#3016)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Sep 10, 2024
1 parent c7e2938 commit 2452184
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import useHelper from '../../../utils/hooks/useHelper';

const ImportMenu = () => {
const { isFeatureEnable } = useHelper();
const isDataTableEnabled = isFeatureEnable('DATA_TABLES');
if (!isDataTableEnabled) {
const isNewImportScreensEnabled = isFeatureEnable('NEW_IMPORT_SCREENS');
if (!isNewImportScreensEnabled) {
return (
<NavToolbarMenu
entries={[{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import ImportContent, { importContentQuery } from './ImportContent';
import Loader from '../../../../components/Loader';
import { ImportContentQuery } from './__generated__/ImportContentQuery.graphql';
import useQueryLoading from '../../../../utils/hooks/useQueryLoading';
import useHelper from '../../../../utils/hooks/useHelper';

interface ImportContentContainerProps {
queryRef: PreloadedQuery<ImportContentQuery>;
}

const ImportContentContainer: FunctionComponent<ImportContentContainerProps> = ({ queryRef }) => {
const data = usePreloadedQuery(importContentQuery, queryRef);
const { isFeatureEnable } = useHelper();
const isNewImportScreensEnabled = isFeatureEnable('NEW_IMPORT_SCREENS');
return (
<ImportContent
connectorsImport={data.connectorsForImport}
importFiles={data.importFiles}
pendingFiles={data.pendingFiles}
isNewImportScreensEnabled={isNewImportScreensEnabled}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ const styles = (theme) => ({
createButton: {
position: 'fixed',
bottom: 30,
right: 230,
},
});

Expand Down Expand Up @@ -335,6 +334,7 @@ class ImportContentComponent extends Component {
nsdt,
connectorsImport,
relay,
isNewImportScreensEnabled,
} = this.props;
const { edges: importFilesEdges } = importFiles;
const { edges: pendingFilesEdges } = pendingFiles;
Expand All @@ -348,9 +348,9 @@ class ImportContentComponent extends Component {
const invalidCsvMapper = this.state.selectedConnector?.name === 'ImportCsv'
&& this.state.selectedConnector?.configurations?.length === 0;
return (
<div style={{ paddingRight: 200 }}>
<div style={{ paddingRight: isNewImportScreensEnabled ? 200 : 0 }}>
<Breadcrumbs variant="list" elements={[{ label: t('Data') }, { label: t('Import'), current: true }]} />
<ImportMenu />
{isNewImportScreensEnabled && <ImportMenu/>}
<Grid
container={true}
spacing={3}
Expand Down Expand Up @@ -705,6 +705,7 @@ class ImportContentComponent extends Component {
color="primary"
aria-label="Add"
className={classes.createButton}
style={{ right: isNewImportScreensEnabled ? 230 : 30 }}
>
<Add />
</Fab>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import useHelper from '../../../../utils/hooks/useHelper';

const Root = () => {
const { isFeatureEnable } = useHelper();
const isDataTableEnabled = isFeatureEnable('DATA_TABLES');
const isNewImportScreensEnables = isFeatureEnable('NEW_IMPORT_SCREENS');
return (
<Routes>
<Route path="/" Component={Import} />
<Route
path="/pending/:fileId"
element={<WorkbenchFile />}
/>
{isDataTableEnabled && (
{isNewImportScreensEnables && (
<Route
path="/file"
element={<ImportFilesContent />}
/>
)}
{isDataTableEnabled && (
{isNewImportScreensEnables && (
<Route
path="/workbench"
element={<ImportWorkbenchesContent />}
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-graphql/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"disabled_dev_features": [
"FAB_REPLACEMENT",
"4352_BULK_RELATIONS",
"NEW_IMPORT_SCREENS",
"FILIGRAN_LOADER",
"BULK_ENTITIES",
"CONTAINERS_AUTHORIZED_MEMBERS",
Expand Down

0 comments on commit 2452184

Please sign in to comment.