Skip to content

Commit 1317713

Browse files
import assets
1 parent f9dfbdb commit 1317713

30 files changed

+591
-285
lines changed

add-preloaded-app-config.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ for (const key of Object.keys(process.env)) {
1414
}
1515

1616
if (Object.keys(envObject).length > 0) {
17-
console.log("Running the UDT with the following settings...")
1817
console.table(envObject)
1918
}
2019

cypress/integration/collaborative-session.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import clickOn100SamplesInACollaborativeSession from "../utils/test/click-on-100-samples-in-a-collaborative-session.spec"
2-
import createAndVisitCollaborativeSession from "../utils/test/create-and-visit-collaborative-session.spec"
1+
import clickOn100SamplesInACollaborativeSession from "../utils/interface-test/click-on-100-samples-in-a-collaborative-session.spec"
2+
import createAndVisitCollaborativeSession from "../utils/interface-test/create-and-visit-collaborative-session.spec"
33
Cypress.config("defaultCommandTimeout", 3000)
44
describe("Create and Visit Collaborative Session", () => {
55
beforeEach("Prepare test", () => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import getDataUrlTypeTest from "../utils/function-test/get-data-url-type.spec"
2+
describe("Function verification", () => {
3+
getDataUrlTypeTest()
4+
})

cypress/integration/udt-test.spec.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import createNewFile from "../utils/test/create-new-file.spec"
2-
import imageClassification from "../utils/test/image-classification.spec"
3-
import imageSegmentation from "../utils/test/image-segmentation.spec"
4-
import keyboardShortcuts from "../utils/test/keyboard-shortcuts.spec"
5-
import labelHelp from "../utils/test/label-help.spec"
6-
import namedEntityRecognition from "../utils/test/named-entity-recognition.spec"
7-
import pasteImageUrlsWithCSV from "../utils/test/paste-image-urls-with-csv.spec"
8-
import pasteImageUrls from "../utils/test/paste-image-urls.spec"
9-
import textEntityClassification from "../utils/test/text-entity-classification.spec"
1+
import createNewFile from "../utils/interface-test/create-new-file.spec"
2+
import imageClassification from "../utils/interface-test/image-classification.spec"
3+
import imageSegmentation from "../utils/interface-test/image-segmentation.spec"
4+
import keyboardShortcuts from "../utils/interface-test/keyboard-shortcuts.spec"
5+
import labelHelp from "../utils/interface-test/label-help.spec"
6+
import namedEntityRecognition from "../utils/interface-test/named-entity-recognition.spec"
7+
import pasteImageUrlsWithCSV from "../utils/interface-test/paste-image-urls-with-csv.spec"
8+
import pasteImageUrls from "../utils/interface-test/paste-image-urls.spec"
9+
import textEntityClassification from "../utils/interface-test/text-entity-classification.spec"
10+
1011
Cypress.config("defaultCommandTimeout", 3000)
1112
describe("Udt test", () => {
1213
beforeEach("Prepare test", () => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import getDataUrlType from "../../../src/utils/get-data-url-type"
2+
const getDataUrlTypeTest = () => {
3+
it("Check getDataUrlType", () => {
4+
expect(
5+
getDataUrlType(
6+
"https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image2.jpg"
7+
)
8+
).to.equal("Image")
9+
expect(
10+
getDataUrlType(
11+
"https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4"
12+
)
13+
).to.equal("Video")
14+
expect(
15+
getDataUrlType("https://html5tutorial.info/media/vincent.mp3")
16+
).to.equal("Audio")
17+
expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.pdf")).to.equal(
18+
"PDF"
19+
)
20+
expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.txt")).to.equal(
21+
"Texte"
22+
)
23+
expect(getDataUrlType("https://arxiv.org/pdf/1908.07069.js")).to.equal(
24+
"File"
25+
)
26+
})
27+
}
28+
export default getDataUrlTypeTest

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"in-browser-download": "^2.0.0",
103103
"jac-format": "^1.1.3",
104104
"js-md5": "^0.7.3",
105+
"mime-types": "^2.1.27",
105106
"moment": "^2.24.0",
106107
"nan": "^2.14.1",
107108
"posthog-js": "^1.0.4",

public/legal.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<body>
1111
<div
1212
id="header"
13-
style="display: inline-flex; justify-content: space-between; width: 100%"
13+
style="display: inline-flex; justify-content: space-between; width: 100%;"
1414
>
15-
<img src="./favicon.ico" style="height: 100%" />
16-
<div style="display: flex; width: 100%">
17-
<a style="margin: auto" href="https://universaldatatool.com">
15+
<img src="./favicon.ico" style="height: 100%;" />
16+
<div style="display: flex; width: 100%;">
17+
<a style="margin: auto;" href="https://universaldatatool.com">
1818
<h1>Universal Data Tool</h1>
1919
</a>
2020
</div>
21-
<img src="./favicon.ico" style="height: 100%" />
21+
<img src="./favicon.ico" style="height: 100%;" />
2222
</div>
2323
<div
2424
id="terms-and-conditions-wrapper"
25-
style="padding-right: 5vw; padding-left: 5vw; padding-top: 2vh"
25+
style="padding-right: 5vw; padding-left: 5vw; padding-top: 2vh;"
2626
>
2727
<h1>Terms and Conditions of Use</h1>
2828
<h3>1. Terms</h3>

src/components/ImportFromCognitoS3Dialog/check-interface-and-sample-type.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import isEmpty from "lodash/isEmpty"
22
export default (typeAuthorize, file) => {
3-
function interfaceFileType(type) {
3+
const interfaceFileType = (type) => {
44
if (
55
type === "image_classification" ||
66
type === "image_segmentation" ||
@@ -16,19 +16,20 @@ export default (typeAuthorize, file) => {
1616
return "File"
1717
}
1818

19-
function typesamplesSample(samples) {
20-
if (isEmpty(samples) || isEmpty(samples[0])) return "Empty"
21-
if (!isEmpty(samples[0].imageUrl)) return "Image"
22-
if (!isEmpty(samples[0].videoUrl)) return "Video"
23-
if (!isEmpty(samples[0].audioUrl)) return "Audio"
24-
if (!isEmpty(samples[0].pdfUrl)) return "PDF"
25-
if (!isEmpty(samples[0].document)) return "Texte"
19+
const typeAssetsFromSample = (assets) => {
20+
if (isEmpty(assets) || isEmpty(assets[0])) return "Empty"
21+
if (!isEmpty(assets[0].imageUrl)) return "Image"
22+
if (!isEmpty(assets[0].videoUrl)) return "Video"
23+
if (!isEmpty(assets[0].audioUrl)) return "Audio"
24+
if (!isEmpty(assets[0].pdfUrl)) return "PDF"
25+
if (!isEmpty(assets[0].document)) return "Texte"
2626
return "File"
2727
}
28+
2829
var result = [null, null]
2930
if (isEmpty(file)) return false
30-
result[0] = interfaceFileType(file.content.interface.type)
31-
result[1] = typesamplesSample(file.content.samples)
31+
result[0] = interfaceFileType(file.interface.type)
32+
result[1] = typeAssetsFromSample(file.samples)
3233
if (typeAuthorize.includes(result[0]) && typeAuthorize.includes(result[1]))
3334
return true
3435
return false

0 commit comments

Comments
 (0)