Skip to content

Commit 17c8a93

Browse files
Merge pull request #476 from CedricProfessionnel/TemplateWithTimeData
Set Default Template (Feature Aws Part)
2 parents 0c5ddb9 + 453599e commit 17c8a93

File tree

5 files changed

+55
-2
lines changed

5 files changed

+55
-2
lines changed

cypress/integration/udt-test.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import namedEntityRecognition from "./utils/interface-test/named-entity-recognit
66
import pasteImageUrlsWithCSV from "./utils/interface-test/paste-image-urls-with-csv"
77
import pasteImageUrls from "./utils/interface-test/paste-image-urls"
88
import textEntityClassification from "./utils/interface-test/text-entity-classification"
9+
import defaultTemplate from "./utils/interface-test/default-template"
10+
import templateNonVisible from "./utils/interface-test/template-non-visble"
911
import commandSetLanguage from "./utils/cypress-command/set-language"
1012

1113
commandSetLanguage()
@@ -16,6 +18,8 @@ describe("Udt test", () => {
1618
cy.visit(`http://localhost:6001`)
1719
cy.setLanguage("en")
1820
})
21+
templateNonVisible()
22+
defaultTemplate()
1923
createNewFile()
2024
imageClassification()
2125
imageSegmentation()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const command = () => {
2+
Cypress.Commands.add("setTemplate", (template) => {
3+
cy.log("Set template")
4+
var appConfig = localStorage.getItem("app_config")
5+
appConfig = JSON.parse(appConfig)
6+
appConfig.defaultTemplate = template
7+
localStorage.setItem("app_config", JSON.stringify(appConfig))
8+
})
9+
}
10+
export default command

src/components/BigInterfaceSelect/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const BigInterfaceSelect = ({ onChange, currentInterfaceType }) => {
4949
<Container className="emptyState">
5050
<div className="bigText">Choose an Interface:</div>
5151
{templates
52-
.filter((t) => t.name !== "Empty")
52+
.filter((t) => t.name !== "Empty" && t.name !== "Time Series 2")
5353
.map((template) => (
5454
<BigButton
5555
key={template.name}

src/components/StartingPage/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,20 @@ export default ({
248248
<ActionTitle>{t("start")}</ActionTitle>
249249
<Action
250250
onClick={() => {
251-
onOpenTemplate(templates.find((t) => t.name === "Empty"))
251+
var appConfig = JSON.parse(
252+
localStorage.getItem("app_config")
253+
)
254+
if (appConfig.defaultTemplate) {
255+
onOpenTemplate(
256+
templates.find(
257+
(t) => t.name === appConfig.defaultTemplate
258+
)
259+
)
260+
} else {
261+
onOpenTemplate(
262+
templates.find((t) => t.name === "Empty")
263+
)
264+
}
252265
}}
253266
>
254267
{t("new-file")}

src/components/StartingPage/templates.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,32 @@ export const templates = [
451451
],
452452
},
453453
},
454+
{
455+
name: "Time Series 2",
456+
Icon: TimelineIcon,
457+
dataset: {
458+
interface: {
459+
type: "time_series",
460+
timeFormat: "dates",
461+
enabledTools: ["create-durations", "label-durations"],
462+
durationLabels: ["@seveibar is speaking"],
463+
},
464+
samples: [
465+
{
466+
timeData: [
467+
{ time: 0, value: 0 },
468+
{ time: 500, value: 0.75 },
469+
{ time: 1000, value: 1 },
470+
],
471+
annotation: {
472+
durations: [
473+
{ start: 500, end: 2000, label: "@seveibar is speaking" },
474+
],
475+
},
476+
},
477+
],
478+
},
479+
},
454480
{
455481
name: "3D Bounding Box",
456482
Icon: ThreeDRotation,

0 commit comments

Comments
 (0)