diff --git a/src/Explorer/Controls/Settings/SettingsComponent.tsx b/src/Explorer/Controls/Settings/SettingsComponent.tsx index 33c2db8a0..365666be9 100644 --- a/src/Explorer/Controls/Settings/SettingsComponent.tsx +++ b/src/Explorer/Controls/Settings/SettingsComponent.tsx @@ -45,7 +45,6 @@ import { readMongoDBCollectionThroughRP } from "../../../Common/dataAccess/readM import { getIndexTransformationProgress } from "../../../Common/dataAccess/getIndexTransformationProgress"; import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils"; import { isEmpty } from "underscore"; -import { SelfServeComponent } from "./SettingsSubComponents/SelfServe/SelfServeComponent"; interface SettingsV2TabInfo { tab: SettingsV2TabTypes; @@ -901,11 +900,6 @@ export class SettingsComponent extends React.Component - }); - if (!hasDatabaseSharedThroughput(this.collection) && this.collection.offer()) { tabs.push({ tab: SettingsV2TabTypes.ScaleTab, diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SelfServeComponent.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SelfServeComponent.tsx deleted file mode 100644 index 7d624d075..000000000 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SelfServeComponent.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from "react"; -import { Descriptor, InputType, SmartUiComponent } from "../../../SmartUi/SmartUiComponent"; -import { SqlX } from "./SqlX"; - -export class SelfServeComponent extends React.Component { - private onSubmit = async (currentValues: Map): Promise => { - console.log(currentValues.get("instanceCount"), currentValues.get("instanceSize")); - }; - - private selfServeData: Descriptor = { - onSubmit: this.onSubmit, - root: { - id: "root", - info: { - message: "Start at $24/mo per database", - link: { - href: "https://aka.ms/azure-cosmos-db-pricing", - text: "More Details" - } - }, - children: [ - { - id: "instanceCount", - input: { - label: "Instance Count", - dataFieldName: "instanceCount", - type: "number", - min: 1, - max: 5, - step: 1, - defaultValue: 1, - inputType: "slider", - onChange: (currentState: Map, newValue: InputType): Map => { - currentState.set("instanceCount", newValue); - if ((newValue as number) === 1) { - currentState.set("instanceSize", "1Core4Gb"); - } - return currentState; - } - } - }, - { - id: "instanceSize", - input: { - label: "Instance Size", - dataFieldName: "instanceSize", - type: "object", - choices: [ - { label: "1Core4Gb", key: "1Core4Gb", value: "1Core4Gb" }, - { label: "2Core8Gb", key: "2Core8Gb", value: "2Core8Gb" }, - { label: "4Core16Gb", key: "4Core16Gb", value: "4Core16Gb" } - ], - defaultKey: "1Core4Gb", - onChange: (currentState: Map, newValue: InputType): Map => { - currentState.set("instanceSize", newValue); - return currentState; - } - } - } - ] - } - }; - - public render(): JSX.Element { - //return - return ; - } -} diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/ClassDescriptors.tsx b/src/SelfServe/ClassDescriptors.tsx similarity index 88% rename from src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/ClassDescriptors.tsx rename to src/SelfServe/ClassDescriptors.tsx index 3bf9e466d..9cd45315b 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/ClassDescriptors.tsx +++ b/src/SelfServe/ClassDescriptors.tsx @@ -1,4 +1,4 @@ -import { Info, InputType } from "../../../SmartUi/SmartUiComponent"; +import { Info, InputType } from "../Explorer/Controls/SmartUi/SmartUiComponent"; import { addPropertyToMap, toSmartUiDescriptor } from "./SelfServeUtils"; export const SmartUi = (): ClassDecorator => { diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/PropertyDescriptors.tsx b/src/SelfServe/PropertyDescriptors.tsx similarity index 97% rename from src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/PropertyDescriptors.tsx rename to src/SelfServe/PropertyDescriptors.tsx index a2919355c..5eae84af7 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/PropertyDescriptors.tsx +++ b/src/SelfServe/PropertyDescriptors.tsx @@ -1,4 +1,4 @@ -import { ChoiceItem, Info, InputType } from "../../../SmartUi/SmartUiComponent"; +import { ChoiceItem, Info, InputType } from "../Explorer/Controls/SmartUi/SmartUiComponent"; import { addPropertyToMap } from "./SelfServeUtils"; const addToMap = (descriptorName: string, descriptorValue: any): PropertyDecorator => { diff --git a/src/SelfServe/SelfServe.less b/src/SelfServe/SelfServe.less new file mode 100644 index 000000000..8e54eb074 --- /dev/null +++ b/src/SelfServe/SelfServe.less @@ -0,0 +1,3 @@ +.selfServeComponentContainer { + margin: 10; +} \ No newline at end of file diff --git a/src/SelfServe/SelfServe.tsx b/src/SelfServe/SelfServe.tsx new file mode 100644 index 000000000..d40da2cb1 --- /dev/null +++ b/src/SelfServe/SelfServe.tsx @@ -0,0 +1,21 @@ +import "bootstrap/dist/css/bootstrap.css"; +import { initializeIcons } from "office-ui-fabric-react/lib/Icons"; +import React from "react"; +import * as ReactDOM from "react-dom"; +import { initializeConfiguration } from "../ConfigContext"; +import { SmartUiComponent } from "../Explorer/Controls/SmartUi/SmartUiComponent"; +import { SqlX } from "./SqlX/SqlX"; + +const render = async () => { + initializeIcons(); + await initializeConfiguration(); + + const element = ( + + ); + + ReactDOM.render(element, document.getElementById("selfServeContent")); +}; + +// Entry point +window.addEventListener("load", render); diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SelfServeUtils.tsx b/src/SelfServe/SelfServeUtils.tsx similarity index 98% rename from src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SelfServeUtils.tsx rename to src/SelfServe/SelfServeUtils.tsx index 3068810c0..40f3234bb 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SelfServeUtils.tsx +++ b/src/SelfServe/SelfServeUtils.tsx @@ -11,7 +11,7 @@ import { BooleanInput, ChoiceInput, InputType -} from "../../../SmartUi/SmartUiComponent"; +} from "../Explorer/Controls/SmartUi/SmartUiComponent"; export class SelfServeBase { public static toSmartUiDescriptor(): Descriptor { diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SqlX.tsx b/src/SelfServe/SqlX/SqlX.tsx similarity index 83% rename from src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SqlX.tsx rename to src/SelfServe/SqlX/SqlX.tsx index 0c6593bac..d84b16cb0 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SqlX.tsx +++ b/src/SelfServe/SqlX/SqlX.tsx @@ -14,11 +14,9 @@ import { Placeholder, DefaultNumberValue, DefaultBooleanValue, - DefaultStringValue, CustomElement -} from "./PropertyDescriptors"; -import { SmartUi, ClassInfo, OnSubmit } from "./ClassDescriptors"; -import { ChoiceItem } from "../../../SmartUi/SmartUiComponent"; +} from "../PropertyDescriptors"; +import { SmartUi, ClassInfo, OnSubmit } from "../ClassDescriptors"; import { getPromise, instanceSizeInfo, @@ -29,7 +27,8 @@ import { Sizes, sqlXInfo } from "./SqlXApis"; -import { SelfServeBase } from "./SelfServeUtils"; +import { SelfServeBase } from "../SelfServeUtils"; +import { ChoiceItem } from "../../Explorer/Controls/SmartUi/SmartUiComponent"; @SmartUi() @ClassInfo(getPromise(sqlXInfo)) @@ -42,7 +41,6 @@ export class SqlX extends SelfServeBase { @PropertyInfo(getPromise(instanceSizeInfo)) @Label(getPromise("Instance Size")) @Choices(getPromise(instanceSizeOptions)) - //@Choices(instanceSizeOptions) @DefaultKey(getPromise(Sizes.OneCore4Gb)) static instanceSize: ChoiceItem; diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SqlXApis.tsx b/src/SelfServe/SqlX/SqlXApis.tsx similarity index 92% rename from src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SqlXApis.tsx rename to src/SelfServe/SqlX/SqlXApis.tsx index 5d1977f24..f2c625e7d 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/SelfServe/SqlXApis.tsx +++ b/src/SelfServe/SqlX/SqlXApis.tsx @@ -1,6 +1,6 @@ import { Text } from "office-ui-fabric-react"; import React from "react"; -import { ChoiceItem, Info, InputType } from "../../../SmartUi/SmartUiComponent"; +import { ChoiceItem, Info, InputType } from "../../Explorer/Controls/SmartUi/SmartUiComponent"; export enum Sizes { OneCore4Gb = "OneCore4Gb", @@ -61,5 +61,5 @@ export const getPromise = => { - return SqlX is a new feature of Cosmos DB; + return SqlX is a new feature of Cosmos DB.; }; diff --git a/src/SelfServe/selfServe.html b/src/SelfServe/selfServe.html new file mode 100644 index 000000000..e62fdee26 --- /dev/null +++ b/src/SelfServe/selfServe.html @@ -0,0 +1,12 @@ + + + + + + + + + +
+ + diff --git a/webpack.config.js b/webpack.config.js index a90e8896c..a896cb072 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -165,6 +165,11 @@ module.exports = function(env = {}, argv = {}) { template: "src/connectToGitHub.html", chunks: ["connectToGitHub"] }), + new HtmlWebpackPlugin({ + filename: "selfServe.html", + template: "src/SelfServe/selfServe.html", + chunks: ["selfServe"] + }), new MonacoWebpackPlugin(), new CopyWebpackPlugin({ patterns: [{ from: "DataExplorer.nuspec" }, { from: "web.config" }, { from: "quickstart/*.zip" }] @@ -188,7 +193,8 @@ module.exports = function(env = {}, argv = {}) { terminal: "./src/Terminal/index.ts", notebookViewer: "./src/NotebookViewer/NotebookViewer.tsx", galleryViewer: "./src/GalleryViewer/GalleryViewer.tsx", - connectToGitHub: "./src/GitHub/GitHubConnector.ts" + connectToGitHub: "./src/GitHub/GitHubConnector.ts", + selfServe: "./src/SelfServe/SelfServe.tsx" }, node: { util: true,