Skip to content

Commit

Permalink
Merge pull request #30 from OlegZharkov/vueify_tool_form
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
guerler authored Jun 30, 2021
2 parents d66dec1 + 6b8bbf9 commit 41defdd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Form/Elements/FormBoolean.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ describe("FormBoolean", () => {
expect(input.element.checked).toBe(false);
input.trigger("click");
expect(input.element.checked).toBe(true);
expect(wrapper.emitted().onChange[0][0]).toBe(true);
expect(wrapper.emitted().input[0][0]).toBe(true);
});
});
4 changes: 2 additions & 2 deletions client/src/components/Form/Elements/FormInput.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("FormInput", () => {
expect(input.element.value).toBe("initial_value");
await input.setValue("new_value");
expect(input.element.value).toBe("new_value");
expect(wrapper.emitted().onChange[0][0]).toBe("new_value");
expect(wrapper.emitted().input[0][0]).toBe("new_value");
});

it("check switching to text area", async () => {
Expand All @@ -33,6 +33,6 @@ describe("FormInput", () => {
expect(input.element.value).toBe("initial_value");
await input.setValue("new_value");
expect(input.element.value).toBe("new_value");
expect(wrapper.emitted().onChange[0][0]).toBe("new_value");
expect(wrapper.emitted().input[0][0]).toBe("new_value");
});
});
2 changes: 1 addition & 1 deletion client/src/components/Form/FormDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
},
validation() {
this.onHighlight(this.validation, true);
this.$emit("onValidation", this.validation);
this.$emit("input", this.validation);
},
validationErrors() {
const matchedErrors = Object.entries(this.form.data.matchResponse(this.validationErrors));
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Form/FormElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
required: true,
},
value: {
type: String,
type: [String, Boolean],
default: "",
},
title: {
Expand Down
16 changes: 5 additions & 11 deletions client/src/components/Tool/ToolForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
:validation-scroll-to="validationScrollTo"
:form-config="formConfig"
@onChange="onChange"
@onValidation="onValidation"
v-model="validationInternal"
/>
<FormElement
v-if="emailAllowed(config, user)"
id="send_email_notification"
title="Email notification"
help="Send an email notification when the job completes."
type="boolean"
value="false"
:value="false"
v-model="email"
/>
<FormElement
Expand All @@ -57,7 +57,7 @@
:title="remapTitle"
:help="remapHelp"
type="boolean"
value="false"
:value="false"
@input="onChangeRemap"
/>
<FormElement
Expand All @@ -66,7 +66,7 @@
title="Attempt to re-use jobs with identical parameters?"
help="This may skip executing jobs that you have already run."
type="boolean"
value="false"
:value="false"
v-model="reuse"
/>
</template>
Expand Down Expand Up @@ -204,10 +204,7 @@ export default {
return config.server_mail_configured && !user.isAnonymous;
},
reuseAllowed(user) {
if (
user.preferences &&
"extra_user_preferences" in user.preferences
) {
if (user.preferences && "extra_user_preferences" in user.preferences) {
const extra_user_preferences = JSON.parse(user.preferences.extra_user_preferences);
const keyCached = "use_cached_job|use_cached_job_checkbox";
const hasCachedJobs = keyCached in extra_user_preferences;
Expand All @@ -216,9 +213,6 @@ export default {
return false;
}
},
onValidation(validationInternal) {
this.validationInternal = validationInternal;
},
onChange(newData) {
this.formData = newData;
this.onUpdate();
Expand Down

0 comments on commit 41defdd

Please sign in to comment.