mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix naming of input match helper to avoid confusion
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
import FormInputs from "./FormInputs";
|
||||
import { visitInputs, validateInputs, matchErrors } from "./utilities";
|
||||
import { visitInputs, validateInputs, matchInputs } from "./utilities";
|
||||
export default {
|
||||
components: {
|
||||
FormInputs,
|
||||
@@ -185,7 +185,7 @@ export default {
|
||||
onErrors() {
|
||||
this.resetErrors();
|
||||
if (this.errors) {
|
||||
const errorMessages = matchErrors(this.formIndex, this.errors);
|
||||
const errorMessages = matchInputs(this.formIndex, this.errors);
|
||||
for (const inputId in errorMessages) {
|
||||
this.setError(inputId, errorMessages[inputId]);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export default {
|
||||
},
|
||||
onWarnings() {
|
||||
if (this.warnings) {
|
||||
const warningMessages = matchErrors(this.formIndex, this.warnings);
|
||||
const warningMessages = matchInputs(this.formIndex, this.warnings);
|
||||
for (const inputId in warningMessages) {
|
||||
this.setWarning(inputId, warningMessages[inputId]);
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ export function matchCase(input, value) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Match server validation response to highlight errors
|
||||
/** Match server validation response to highlight inputs
|
||||
* @param{dict} index - Index of input elements
|
||||
* @param{dict} response - Nested dictionary with error messages
|
||||
* @param{dict} response - Nested dictionary with error/warning messages
|
||||
*/
|
||||
export function matchErrors(index, response) {
|
||||
export function matchInputs(index, response) {
|
||||
var result = {};
|
||||
function search(id, head) {
|
||||
if (typeof head === "string") {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { visitInputs, validateInputs, matchCase, matchErrors } from "./utilities";
|
||||
import { visitInputs, validateInputs, matchCase, matchInputs } from "./utilities";
|
||||
import toolModel from "./test-data/tool";
|
||||
|
||||
function visitInputsString(inputs) {
|
||||
@@ -129,7 +129,7 @@ describe("form component utilities", () => {
|
||||
input_b: ["error_b"],
|
||||
input_c: { input_d: "error_d" },
|
||||
};
|
||||
const result = matchErrors(index, values);
|
||||
const result = matchInputs(index, values);
|
||||
expect(result["input_a"]).toEqual("error_a");
|
||||
expect(result["input_b_0"]).toEqual("error_b");
|
||||
expect(result["input_c|input_d"]).toEqual("error_d");
|
||||
|
||||
Reference in New Issue
Block a user