Skip to content

Commit 62ca23f

Browse files
committed
webapp/form: default non-empty labels
1 parent 84e685a commit 62ca23f

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

webapp/cypress/e2e/task-creation.cy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ it("submits with tabular task", () => {
3232
cy.get("input[name='trainingInformation.validationSplit']").type("0");
3333
cy.get("input[name='trainingInformation.minNbOfParticipants']").type("2");
3434
cy.contains("Input columns names").within(() => {
35-
cy.contains("add column").click();
3635
cy.get("input[name='trainingInformation.inputColumns[0]']").type("input");
3736
});
3837
cy.get("input[name='trainingInformation.outputColumn']").type("output");

webapp/src/components/task_creation_form/TaskCreationForm.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ import * as immutable from "immutable";
543543
import { storeToRefs } from "pinia";
544544
import { FieldArray, Form } from "vee-validate";
545545
import { toTypedSchema } from "@vee-validate/zod";
546-
import { ref, useTemplateRef } from "vue";
546+
import { ref, useTemplateRef, watch } from "vue";
547547
import * as z from "zod";
548548
549549
import * as tf from "@tensorflow/tfjs";
@@ -554,6 +554,8 @@ import {
554554
Task,
555555
Tokenizer,
556556
TrainingInformation,
557+
type DataType,
558+
type Network,
557559
} from "@epfml/discojs";
558560
559561
import { useToaster } from "@/composables/toaster";
@@ -572,13 +574,27 @@ const debug = createDebug("webapp:TaskForm");
572574
const toaster = useToaster();
573575
const { tasks } = storeToRefs(useTasksStore());
574576
575-
const dataType = ref("image");
576-
const scheme = ref("federated");
577+
const dataType = ref<DataType>("image");
578+
const scheme = ref<Network>("federated");
577579
const aggregationStrategy = ref("mean");
578580
const differentialPrivacy = ref(false);
579581
const weightClipping = ref(false);
580582
581583
const form = useTemplateRef("form");
584+
585+
watch([dataType, form], ([dataType, form]) => {
586+
if (form === null) return;
587+
588+
switch (dataType) {
589+
case "image":
590+
form.setFieldValue("trainingInformation.LABEL_LIST", [""]);
591+
break;
592+
case "tabular":
593+
form.setFieldValue("trainingInformation.inputColumns", [""]);
594+
break;
595+
}
596+
});
597+
582598
// warn user on page content loss
583599
window.onbeforeunload = (event) => {
584600
if (form.value === null || form.value.meta.dirty === false) return;

0 commit comments

Comments
 (0)