Added the Self Serve Data Model (#367)

* added recursion and inition decorators

* working version

* added todo comment and removed console.log

* Added Recursive add

* removed type requirement

* proper resolution of promises

* added custom element and base class

* Made selfServe standalone page

* Added custom renderer as async type

* Added overall defaults

* added inital open from data explorer

* removed landingpage

* added feature for self serve type

* renamed sqlx->example and added invalid type

* Added comments for Example

* removed unnecessary changes

* Resolved PR comments

Added tests
Moved onSubmt and initialize inside base class
Moved testExplorer to separate folder
made fields of SelfServe Class non static

* fixed lint errors

* fixed compilation errors

* Removed reactbinding changes

* renamed dropdown -> choice

* Added SelfServeComponent

* Addressed PR comments

* merged master

* added selfservetype.none for emulator and hosted experience

* fixed formatting errors

* Removed "any" type

* undid package.json changes
This commit is contained in:
Srinath Narayanan
2021-01-19 22:42:45 -08:00
committed by GitHub
parent 2b2de7c645
commit c1937ca464
32 changed files with 4944 additions and 3322 deletions

View File

@@ -1,9 +1,9 @@
import { shallow } from "enzyme";
import React from "react";
import { Descriptor, SmartUiComponent } from "./SmartUiComponent";
import { shallow } from "enzyme";
import { SmartUiComponent, SmartUiDescriptor, UiType } from "./SmartUiComponent";
describe("SmartUiComponent", () => {
const exampleData: Descriptor = {
const exampleData: SmartUiDescriptor = {
root: {
id: "root",
info: {
@@ -24,7 +24,7 @@ describe("SmartUiComponent", () => {
max: 500,
step: 10,
defaultValue: 400,
inputType: "spin"
uiType: UiType.Spinner
}
},
{
@@ -37,7 +37,21 @@ describe("SmartUiComponent", () => {
max: 500,
step: 10,
defaultValue: 400,
inputType: "slider"
uiType: UiType.Slider
}
},
{
id: "throughput3",
input: {
label: "Throughput (invalid)",
dataFieldName: "throughput3",
type: "boolean",
min: 400,
max: 500,
step: 10,
defaultValue: 400,
uiType: UiType.Spinner,
errorMessage: "label, truelabel and falselabel are required for boolean input 'throughput3'"
}
},
{
@@ -64,11 +78,11 @@ describe("SmartUiComponent", () => {
input: {
label: "Database",
dataFieldName: "database",
type: "enum",
type: "object",
choices: [
{ label: "Database 1", key: "db1", value: "database1" },
{ label: "Database 2", key: "db2", value: "database2" },
{ label: "Database 3", key: "db3", value: "database3" }
{ label: "Database 1", key: "db1" },
{ label: "Database 2", key: "db2" },
{ label: "Database 3", key: "db3" }
],
defaultKey: "db2"
}
@@ -77,10 +91,11 @@ describe("SmartUiComponent", () => {
}
};
const exampleCallbacks = (): void => undefined;
it("should render", () => {
const wrapper = shallow(<SmartUiComponent descriptor={exampleData} onChange={exampleCallbacks} />);
it("should render", async () => {
const wrapper = shallow(
<SmartUiComponent descriptor={exampleData} currentValues={new Map()} onInputChange={undefined} />
);
await new Promise(resolve => setTimeout(resolve, 0));
expect(wrapper).toMatchSnapshot();
});
});