Fixes for selfserve (#796)

* fixes

* more edits

* fixed test errors
This commit is contained in:
Srinath Narayanan 2021-05-19 09:32:29 +05:30 committed by GitHub
parent 6e9144b068
commit dce52f848c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -190,7 +190,8 @@ describe("SelfServeUtils", () => {
max: 5,
step: 1,
uiType: "Spinner",
errorMessage: "label, truelabel and falselabel are required for boolean input 'invalidThroughput'.",
errorMessage:
"labelTkey, trueLabelTKey and falseLabelTKey are required for boolean input 'invalidThroughput'.",
},
children: [] as Node[],
},
@ -225,7 +226,8 @@ describe("SelfServeUtils", () => {
type: "boolean",
labelTKey: "Invalid Enable Logging",
placeholderTKey: "placeholder text",
errorMessage: "label, truelabel and falselabel are required for boolean input 'invalidEnableLogging'.",
errorMessage:
"labelTkey, trueLabelTKey and falseLabelTKey are required for boolean input 'invalidEnableLogging'.",
},
children: [] as Node[],
},
@ -252,7 +254,7 @@ describe("SelfServeUtils", () => {
type: "object",
labelTKey: "Invalid Regions",
placeholderTKey: "placeholder text",
errorMessage: "label and choices are required for Choice input 'invalidRegions'.",
errorMessage: "labelTKey and choices are required for Choice input 'invalidRegions'.",
},
children: [] as Node[],
},

View File

@ -206,8 +206,8 @@ const addToDescriptor = (
const getInput = (value: DecoratorProperties): AnyDisplay => {
switch (value.type) {
case "number":
if (!value.labelTKey || !value.step || !value.uiType || !value.min || !value.max) {
value.errorMessage = `label, step, min, max and uiType are required for number input '${value.id}'.`;
if (!value.labelTKey || !value.uiType || !value.step || !value.max || value.min === undefined) {
value.errorMessage = `labelTkey, step, min, max and uiType are required for number input '${value.id}'.`;
}
return value as NumberInput;
case "string":
@ -218,17 +218,17 @@ const getInput = (value: DecoratorProperties): AnyDisplay => {
return value as DescriptionDisplay;
}
if (!value.labelTKey) {
value.errorMessage = `label is required for string input '${value.id}'.`;
value.errorMessage = `labelTKey is required for string input '${value.id}'.`;
}
return value as StringInput;
case "boolean":
if (!value.labelTKey || !value.trueLabelTKey || !value.falseLabelTKey) {
value.errorMessage = `label, truelabel and falselabel are required for boolean input '${value.id}'.`;
value.errorMessage = `labelTkey, trueLabelTKey and falseLabelTKey are required for boolean input '${value.id}'.`;
}
return value as BooleanInput;
default:
if (!value.labelTKey || !value.choices) {
value.errorMessage = `label and choices are required for Choice input '${value.id}'.`;
value.errorMessage = `labelTKey and choices are required for Choice input '${value.id}'.`;
}
return value as ChoiceInput;
}

View File

@ -8,8 +8,7 @@ i18n
.init({
fallbackLng: "en",
detection: { order: ["navigator", "cookie", "localStorage", "sessionStorage", "querystring", "htmlTag"] },
// temporarily setting debug to true to investigate loading issues in prod
debug: true,
debug: process.env.NODE_ENV === "development",
keySeparator: ".",
interpolation: {
formatSeparator: ",",