Added localization for the Self Serve Model (#406)

* added localization for selfserve model

* added comment

* addressed PR comments

* fixed format errors

* Addressed PR comments
This commit is contained in:
Srinath Narayanan
2021-01-28 11:17:02 -08:00
committed by GitHub
parent f8ede0cc1e
commit 6aaddd9c60
16 changed files with 367 additions and 1042 deletions

View File

@@ -58,7 +58,7 @@ describe("SelfServeUtils", () => {
id: "dbThroughput",
dataFieldName: "dbThroughput",
type: "number",
label: "Database Throughput",
labelTKey: "Database Throughput",
min: 1,
max: 5,
step: 1,
@@ -71,7 +71,7 @@ describe("SelfServeUtils", () => {
id: "collThroughput",
dataFieldName: "collThroughput",
type: "number",
label: "Coll Throughput",
labelTKey: "Coll Throughput",
min: 1,
max: 5,
step: 1,
@@ -84,7 +84,7 @@ describe("SelfServeUtils", () => {
id: "invalidThroughput",
dataFieldName: "invalidThroughput",
type: "boolean",
label: "Invalid Coll Throughput",
labelTKey: "Invalid Coll Throughput",
min: 1,
max: 5,
step: 1,
@@ -98,8 +98,8 @@ describe("SelfServeUtils", () => {
id: "collName",
dataFieldName: "collName",
type: "string",
label: "Coll Name",
placeholder: "placeholder text",
labelTKey: "Coll Name",
placeholderTKey: "placeholder text",
},
],
[
@@ -108,9 +108,9 @@ describe("SelfServeUtils", () => {
id: "enableLogging",
dataFieldName: "enableLogging",
type: "boolean",
label: "Enable Logging",
trueLabel: "Enable",
falseLabel: "Disable",
labelTKey: "Enable Logging",
trueLabelTKey: "Enable",
falseLabelTKey: "Disable",
},
],
[
@@ -119,8 +119,8 @@ describe("SelfServeUtils", () => {
id: "invalidEnableLogging",
dataFieldName: "invalidEnableLogging",
type: "boolean",
label: "Invalid Enable Logging",
placeholder: "placeholder text",
labelTKey: "Invalid Enable Logging",
placeholderTKey: "placeholder text",
},
],
[
@@ -129,7 +129,7 @@ describe("SelfServeUtils", () => {
id: "regions",
dataFieldName: "regions",
type: "object",
label: "Regions",
labelTKey: "Regions",
choices: [
{ label: "South West US", key: "SWUS" },
{ label: "North Central US", key: "NCUS" },
@@ -143,14 +143,14 @@ describe("SelfServeUtils", () => {
id: "invalidRegions",
dataFieldName: "invalidRegions",
type: "object",
label: "Invalid Regions",
placeholder: "placeholder text",
labelTKey: "Invalid Regions",
placeholderTKey: "placeholder text",
},
],
]);
const expectedDescriptor = {
root: {
id: "root",
id: "TestClass",
children: [
{
id: "dbThroughput",
@@ -158,7 +158,7 @@ describe("SelfServeUtils", () => {
id: "dbThroughput",
dataFieldName: "dbThroughput",
type: "number",
label: "Database Throughput",
labelTKey: "Database Throughput",
min: 1,
max: 5,
step: 1,
@@ -172,7 +172,7 @@ describe("SelfServeUtils", () => {
id: "collThroughput",
dataFieldName: "collThroughput",
type: "number",
label: "Coll Throughput",
labelTKey: "Coll Throughput",
min: 1,
max: 5,
step: 1,
@@ -186,7 +186,7 @@ describe("SelfServeUtils", () => {
id: "invalidThroughput",
dataFieldName: "invalidThroughput",
type: "boolean",
label: "Invalid Coll Throughput",
labelTKey: "Invalid Coll Throughput",
min: 1,
max: 5,
step: 1,
@@ -201,8 +201,8 @@ describe("SelfServeUtils", () => {
id: "collName",
dataFieldName: "collName",
type: "string",
label: "Coll Name",
placeholder: "placeholder text",
labelTKey: "Coll Name",
placeholderTKey: "placeholder text",
},
children: [] as Node[],
},
@@ -212,9 +212,9 @@ describe("SelfServeUtils", () => {
id: "enableLogging",
dataFieldName: "enableLogging",
type: "boolean",
label: "Enable Logging",
trueLabel: "Enable",
falseLabel: "Disable",
labelTKey: "Enable Logging",
trueLabelTKey: "Enable",
falseLabelTKey: "Disable",
},
children: [] as Node[],
},
@@ -224,8 +224,8 @@ describe("SelfServeUtils", () => {
id: "invalidEnableLogging",
dataFieldName: "invalidEnableLogging",
type: "boolean",
label: "Invalid Enable Logging",
placeholder: "placeholder text",
labelTKey: "Invalid Enable Logging",
placeholderTKey: "placeholder text",
errorMessage: "label, truelabel and falselabel are required for boolean input 'invalidEnableLogging'.",
},
children: [] as Node[],
@@ -236,7 +236,7 @@ describe("SelfServeUtils", () => {
id: "regions",
dataFieldName: "regions",
type: "object",
label: "Regions",
labelTKey: "Regions",
choices: [
{ label: "South West US", key: "SWUS" },
{ label: "North Central US", key: "NCUS" },
@@ -251,8 +251,8 @@ describe("SelfServeUtils", () => {
id: "invalidRegions",
dataFieldName: "invalidRegions",
type: "object",
label: "Invalid Regions",
placeholder: "placeholder text",
labelTKey: "Invalid Regions",
placeholderTKey: "placeholder text",
errorMessage: "label and choices are required for Choice input 'invalidRegions'.",
},
children: [] as Node[],
@@ -270,7 +270,7 @@ describe("SelfServeUtils", () => {
"invalidRegions",
],
};
const descriptor = mapToSmartUiDescriptor(context);
const descriptor = mapToSmartUiDescriptor("TestClass", context);
expect(descriptor).toEqual(expectedDescriptor);
});
});