-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic dataset module and specific s3_datasets module - part 6 (Fron…
…tend) (#1292) ### Feature or Bugfix - Feature ### Detail As explained in the design for #1123 we are trying to implement a generic `datasets_base` module that can be used by any type of datasets in a generic way. In this PR we: - Create DatasetsBase module in frontend. Depends on S3_Datasets module - Move DatasetsList view and DatasetListItem component to DatasetsBase - Add CreateDataset modal that allows multiple types of datasets creation - Fix routes and redirects to point at /datasets/ or any other /X-dataset/ - Move dataset_base services. In backend/datasets_base/api we define the following queries that are good candidates to become part of the DatasetsBase module - listDatasets - only used in DatasetsBase/DatasetList view - it should be in DatasetsBase/services - listOwnedDatasets - only used in Shares/SharesBoxList view - it should be in Shares/services - listDatasetsCreatedInEnvironment - only used in Environments/EnvDataset tab - it should be in Environment/services If we want to keep everything clean we could rename all "datasets" as "s3_datasets" or equivalent in the S3_Datasets module. Because it is a cosmetic change that would pollute the PR a lot I have decided not to include it.⚠️ UPDATE: Next steps The Data Shared With You table in Environments>Datasets tab needs a remake. It contains references to each type of item and it is very coupled with s3-dataset-shares. For the moment I just made it work for the changes of s3-datasets, but when completing the work in #1283 we should fix this. Maybe in favor of DataGrid ### Relates - #1123 - #955 ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
30 changed files
with
229 additions
and
79 deletions.
There are no files selected for viewing
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
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
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
107 changes: 107 additions & 0 deletions
107
frontend/src/modules/DatasetsBase/components/DatasetCreateWindow.js
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,107 @@ | ||
import { CloudDownloadOutlined } from '@mui/icons-material'; | ||
import { | ||
Box, | ||
Button, | ||
Card, | ||
CardContent, | ||
CardHeader, | ||
Dialog, | ||
Grid, | ||
Typography | ||
} from '@mui/material'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
import { PlusIcon } from '../../../design'; | ||
import { isModuleEnabled, ModuleNames } from 'utils'; | ||
|
||
export const DatasetCreateWindow = (props) => { | ||
const { onClose, open, ...other } = props; | ||
const number_grid_items = isModuleEnabled(ModuleNames.S3_DATASETS) ? 2 : 0; | ||
const width_grid_item = number_grid_items > 0 ? 12 / number_grid_items : 1; | ||
|
||
return ( | ||
<Dialog maxWidth="md" fullWidth onClose={onClose} open={open} {...other}> | ||
<Box sx={{ m: 4 }}> | ||
<Grid | ||
container | ||
spacing={2} | ||
alignItems="flex-start" | ||
justifyContent="center" | ||
> | ||
{isModuleEnabled(ModuleNames.S3_DATASETS) && ( | ||
<Grid | ||
item | ||
justifyContent="center" | ||
md={width_grid_item} | ||
lg={width_grid_item} | ||
xl={width_grid_item} | ||
> | ||
<Card> | ||
<CardHeader title="Create S3-Glue Dataset" /> | ||
<CardContent> | ||
<Typography | ||
color="textSecondary" | ||
gutterBottom | ||
variant="subtitle2" | ||
> | ||
Data.all will create an S3 Bucket encrypted with KMS key and | ||
a Glue database. | ||
</Typography> | ||
<Button | ||
color="primary" | ||
component={RouterLink} | ||
startIcon={<PlusIcon fontSize="small" />} | ||
sx={{ m: 1 }} | ||
to="/console/s3-datasets/new" | ||
variant="contained" | ||
> | ||
Create | ||
</Button> | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
)} | ||
{isModuleEnabled(ModuleNames.S3_DATASETS) && ( | ||
<Grid | ||
item | ||
justifyContent="center" | ||
md={width_grid_item} | ||
lg={width_grid_item} | ||
xl={width_grid_item} | ||
> | ||
<Card> | ||
<CardHeader title="Import S3-Glue Dataset" /> | ||
<CardContent> | ||
<Typography | ||
color="textSecondary" | ||
gutterBottom | ||
variant="subtitle2" | ||
> | ||
Data.all will use the S3 Bucket as it is encrypted and will | ||
create a Glue database if you do not provide one. | ||
</Typography> | ||
<Button | ||
color="primary" | ||
component={RouterLink} | ||
startIcon={<CloudDownloadOutlined fontSize="small" />} | ||
sx={{ m: 1 }} | ||
to="/console/s3-datasets/import" | ||
variant="outlined" | ||
> | ||
Import | ||
</Button> | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
)} | ||
</Grid> | ||
</Box> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
DatasetCreateWindow.propTypes = { | ||
onClose: PropTypes.func, | ||
open: PropTypes.bool.isRequired | ||
}; |
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
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,2 @@ | ||
export * from './DatasetCreateWindow'; | ||
export * from './DatasetListItem'; |
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,10 @@ | ||
import { ModuleNames, getModuleActiveStatus } from 'utils'; | ||
|
||
export const DatasetsBaseModule = { | ||
moduleDefinition: true, | ||
name: 'datasets_base', | ||
isEnvironmentModule: false, | ||
resolve_dependency: () => { | ||
return getModuleActiveStatus(ModuleNames.S3_DATASETS); // Add other dataset types when needed | ||
} | ||
}; |
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 @@ | ||
export * from './listDatasets'; |
File renamed without changes.
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
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
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
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
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
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
Oops, something went wrong.