Skip to content

Commit 9665040

Browse files
authored
fix: Merge pull request #433 from CedricProfessionnel/CognitoImportFromAnnotationWithAssetsFilesFeature
Cognito Import from annotation
2 parents e7a2fcb + 7e74253 commit 9665040

File tree

13 files changed

+366
-434
lines changed

13 files changed

+366
-434
lines changed

src/components/ExportToCognitoS3Dialog/index.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import useActiveDatasetManager from "../../hooks/use-active-dataset-manager"
55
import isEmpty from "lodash/isEmpty"
66
import datasetManagerCognito from "udt-dataset-managers/dist/CognitoDatasetManager"
77
import useAuth from "../../utils/auth-handlers/use-auth"
8-
import { TextField, Grid } from "@material-ui/core"
9-
8+
import { Grid, TextField } from "@material-ui/core"
109
const redText = { color: "orange" }
1110

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

135134
const handleCreateProject = async () => {
136-
if (nameProjectExist) await dm.removeProject(nameProjectToCreate)
137-
var dataset = currentDataset
135+
var dataset = await activeDatasetManager.getDataset()
138136
dataset = dataset.setIn(["name"], nameProjectToCreate)
139-
await dm.createProject({
140-
name: nameProjectToCreate,
141-
interface: dataset.interface,
142-
})
137+
if (nameProjectExist) await dm.removeSamplesFolder(nameProjectToCreate)
143138
await dm.setDataset(dataset)
144-
await activeDatasetManager.setDatasetProperty("name", nameProjectToCreate)
139+
await activeDatasetManager.setDataset(dataset)
145140
await getProjects()
146141
onClose()
147142
}

src/components/ImportFromCognitoS3Dialog/get-annotation-from-aws.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/components/ImportFromCognitoS3Dialog/get-images-from-aws.js

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const getSources = (annotations) => {
2+
return annotations
3+
.map((obj) => obj.source)
4+
.filter((source, index, self) => self.indexOf(source) === index)
5+
}
6+
export default getSources
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import React from "react"
2+
import {
3+
Settings as SettingsIcon,
4+
Storage as StorageIcon,
5+
} from "@material-ui/icons/"
6+
7+
import { Button, IconButton } from "@material-ui/core/"
8+
9+
const selectedStyle = { color: "DodgerBlue" }
10+
11+
const headerTable = ({ configImport, setConfigImport }) => {
12+
const loadAssetsOrAnnotations = () => {
13+
setConfigImport({
14+
...configImport,
15+
loadAssetsIsSelected: !configImport.loadAssetsIsSelected,
16+
})
17+
}
18+
return (
19+
<tr>
20+
<th>
21+
{configImport.loadAssetsIsSelected ? (
22+
<Button
23+
style={selectedStyle}
24+
onClick={loadAssetsOrAnnotations}
25+
disabled
26+
>
27+
Load Assets
28+
</Button>
29+
) : (
30+
<Button onClick={loadAssetsOrAnnotations}>Load Assets</Button>
31+
)}
32+
{configImport.loadAssetsIsSelected ? (
33+
<Button onClick={loadAssetsOrAnnotations}>Load Annotations</Button>
34+
) : (
35+
<Button
36+
style={selectedStyle}
37+
onClick={loadAssetsOrAnnotations}
38+
disabled
39+
>
40+
Load Annotations
41+
</Button>
42+
)}
43+
<IconButton
44+
onClick={() => {
45+
setConfigImport({
46+
...configImport,
47+
contentDialogBoxIsSetting: !configImport.contentDialogBoxIsSetting,
48+
})
49+
}}
50+
>
51+
{configImport.contentDialogBoxIsSetting ? (
52+
<StorageIcon></StorageIcon>
53+
) : (
54+
<SettingsIcon></SettingsIcon>
55+
)}
56+
</IconButton>
57+
</th>
58+
</tr>
59+
)
60+
}
61+
export default headerTable

0 commit comments

Comments
 (0)