Skip to content

Commit

Permalink
fix: Merge pull request #433 from CedricProfessionnel/CognitoImportFr…
Browse files Browse the repository at this point in the history
…omAnnotationWithAssetsFilesFeature

Cognito Import from annotation
  • Loading branch information
seveibar authored Jan 22, 2021
2 parents e7a2fcb + 7e74253 commit 9665040
Show file tree
Hide file tree
Showing 13 changed files with 366 additions and 434 deletions.
13 changes: 4 additions & 9 deletions src/components/ExportToCognitoS3Dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import useActiveDatasetManager from "../../hooks/use-active-dataset-manager"
import isEmpty from "lodash/isEmpty"
import datasetManagerCognito from "udt-dataset-managers/dist/CognitoDatasetManager"
import useAuth from "../../utils/auth-handlers/use-auth"
import { TextField, Grid } from "@material-ui/core"

import { Grid, TextField } from "@material-ui/core"
const redText = { color: "orange" }

const expandedAnnotationsColumns = [
Expand Down Expand Up @@ -133,15 +132,11 @@ export default ({ open, onClose }) => {
}, [nameProjectToCreate, projects])

const handleCreateProject = async () => {
if (nameProjectExist) await dm.removeProject(nameProjectToCreate)
var dataset = currentDataset
var dataset = await activeDatasetManager.getDataset()
dataset = dataset.setIn(["name"], nameProjectToCreate)
await dm.createProject({
name: nameProjectToCreate,
interface: dataset.interface,
})
if (nameProjectExist) await dm.removeSamplesFolder(nameProjectToCreate)
await dm.setDataset(dataset)
await activeDatasetManager.setDatasetProperty("name", nameProjectToCreate)
await activeDatasetManager.setDataset(dataset)
await getProjects()
onClose()
}
Expand Down

This file was deleted.

77 changes: 0 additions & 77 deletions src/components/ImportFromCognitoS3Dialog/get-images-from-aws.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/components/ImportFromCognitoS3Dialog/get-sources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const getSources = (annotations) => {
return annotations
.map((obj) => obj.source)
.filter((source, index, self) => self.indexOf(source) === index)
}
export default getSources
61 changes: 61 additions & 0 deletions src/components/ImportFromCognitoS3Dialog/header-table-import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from "react"
import {
Settings as SettingsIcon,
Storage as StorageIcon,
} from "@material-ui/icons/"

import { Button, IconButton } from "@material-ui/core/"

const selectedStyle = { color: "DodgerBlue" }

const headerTable = ({ configImport, setConfigImport }) => {
const loadAssetsOrAnnotations = () => {
setConfigImport({
...configImport,
loadAssetsIsSelected: !configImport.loadAssetsIsSelected,
})
}
return (
<tr>
<th>
{configImport.loadAssetsIsSelected ? (
<Button
style={selectedStyle}
onClick={loadAssetsOrAnnotations}
disabled
>
Load Assets
</Button>
) : (
<Button onClick={loadAssetsOrAnnotations}>Load Assets</Button>
)}
{configImport.loadAssetsIsSelected ? (
<Button onClick={loadAssetsOrAnnotations}>Load Annotations</Button>
) : (
<Button
style={selectedStyle}
onClick={loadAssetsOrAnnotations}
disabled
>
Load Annotations
</Button>
)}
<IconButton
onClick={() => {
setConfigImport({
...configImport,
contentDialogBoxIsSetting: !configImport.contentDialogBoxIsSetting,
})
}}
>
{configImport.contentDialogBoxIsSetting ? (
<StorageIcon></StorageIcon>
) : (
<SettingsIcon></SettingsIcon>
)}
</IconButton>
</th>
</tr>
)
}
export default headerTable
Loading

0 comments on commit 9665040

Please sign in to comment.