mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 02:41:39 +00:00
Addressed PR comments
This commit is contained in:
@@ -24,11 +24,6 @@ export const regionDropdownInfo: Info = {
|
||||
message: "More regions can be added in the future."
|
||||
};
|
||||
|
||||
export const delay = (ms: number): Promise<void> => {
|
||||
console.log("delay called");
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
};
|
||||
|
||||
const onDbThroughputChange = (currentState: Map<string, InputType>, newValue: InputType): Map<string, InputType> => {
|
||||
currentState.set("dbThroughput", newValue);
|
||||
currentState.set("collectionThroughput", newValue);
|
||||
@@ -36,7 +31,6 @@ const onDbThroughputChange = (currentState: Map<string, InputType>, newValue: In
|
||||
};
|
||||
|
||||
const initializeMaxThroughput = async (): Promise<number> => {
|
||||
await delay(2000);
|
||||
return 10000;
|
||||
};
|
||||
|
||||
@@ -76,7 +70,6 @@ export default class SelfServeExample extends SelfServeBaseClass {
|
||||
in the SessionStorage.
|
||||
*/
|
||||
public onSubmit = async (currentValues: Map<string, InputType>): Promise<void> => {
|
||||
await delay(1000);
|
||||
SessionStorageUtility.setEntry("regions", currentValues.get("regions")?.toString());
|
||||
SessionStorageUtility.setEntry("enableLogging", currentValues.get("enableLogging")?.toString());
|
||||
SessionStorageUtility.setEntry("accountName", currentValues.get("accountName")?.toString());
|
||||
@@ -100,7 +93,6 @@ export default class SelfServeExample extends SelfServeBaseClass {
|
||||
for these fields. These are then set when the changes are submitted.
|
||||
*/
|
||||
public initialize = async (): Promise<Map<string, InputType>> => {
|
||||
await delay(1000);
|
||||
const defaults = new Map<string, InputType>();
|
||||
defaults.set("regions", SessionStorageUtility.getEntry("regions"));
|
||||
defaults.set("enableLogging", SessionStorageUtility.getEntry("enableLogging") === "true");
|
||||
|
||||
@@ -33,17 +33,17 @@ export interface ChoiceInputOptions extends InputOptionsBase {
|
||||
|
||||
type InputOptions = NumberInputOptions | StringInputOptions | BooleanInputOptions | ChoiceInputOptions;
|
||||
|
||||
function isNumberInputOptions(inputOptions: InputOptions): inputOptions is NumberInputOptions {
|
||||
const isNumberInputOptions = (inputOptions: InputOptions): inputOptions is NumberInputOptions => {
|
||||
return "min" in inputOptions;
|
||||
}
|
||||
};
|
||||
|
||||
function isBooleanInputOptions(inputOptions: InputOptions): inputOptions is BooleanInputOptions {
|
||||
const isBooleanInputOptions = (inputOptions: InputOptions): inputOptions is BooleanInputOptions => {
|
||||
return "trueLabel" in inputOptions;
|
||||
}
|
||||
};
|
||||
|
||||
function isChoiceInputOptions(inputOptions: InputOptions): inputOptions is ChoiceInputOptions {
|
||||
const isChoiceInputOptions = (inputOptions: InputOptions): inputOptions is ChoiceInputOptions => {
|
||||
return "choices" in inputOptions;
|
||||
}
|
||||
};
|
||||
|
||||
const addToMap = (...decorators: Decorator[]): PropertyDecorator => {
|
||||
return (target, property) => {
|
||||
|
||||
@@ -105,17 +105,16 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
|
||||
currentValues = currentValues.set(key, initialValues.get(key));
|
||||
baselineValues = baselineValues.set(key, initialValues.get(key));
|
||||
}
|
||||
this.setState({ currentValues: currentValues, baselineValues: baselineValues, isRefreshing: false });
|
||||
this.setState({ currentValues, baselineValues, isRefreshing: false });
|
||||
};
|
||||
|
||||
public discard = (): void => {
|
||||
console.log("discarding");
|
||||
let { currentValues } = this.state;
|
||||
const { baselineValues } = this.state;
|
||||
for (const key of baselineValues.keys()) {
|
||||
currentValues = currentValues.set(key, baselineValues.get(key));
|
||||
}
|
||||
this.setState({ currentValues: currentValues });
|
||||
this.setState({ currentValues });
|
||||
};
|
||||
|
||||
private initializeSmartUiNode = async (currentNode: Node): Promise<void> => {
|
||||
|
||||
@@ -20,6 +20,6 @@ export class SelfServeLoadingComponentAdapter implements ReactAdapter {
|
||||
}
|
||||
|
||||
private triggerRender() {
|
||||
window.requestAnimationFrame(() => this.parameters(Date.now()));
|
||||
window.requestAnimationFrame(() => this.renderComponent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +82,8 @@ export const addPropertyToMap = <T extends keyof CommonInputTypes, K extends Com
|
||||
descriptorName: string,
|
||||
descriptorValue: K
|
||||
): void => {
|
||||
let context = Reflect.getMetadata(className, target) as Map<string, CommonInputTypes>;
|
||||
if (!context) {
|
||||
context = new Map<string, CommonInputTypes>();
|
||||
}
|
||||
const context =
|
||||
(Reflect.getMetadata(className, target) as Map<string, CommonInputTypes>) ?? new Map<string, CommonInputTypes>();
|
||||
updateContextWithDecorator(context, propertyName, className, descriptorName, descriptorValue);
|
||||
Reflect.defineMetadata(className, context, target);
|
||||
};
|
||||
@@ -104,10 +102,7 @@ export const updateContextWithDecorator = <T extends keyof CommonInputTypes, K e
|
||||
throw new Error(`@SmartUi should be the first decorator for the class '${className}'.`);
|
||||
}
|
||||
|
||||
let propertyObject = context.get(propertyName);
|
||||
if (!propertyObject) {
|
||||
propertyObject = { id: propertyName };
|
||||
}
|
||||
const propertyObject = context.get(propertyName) ?? { id: propertyName };
|
||||
|
||||
if (getValue(descriptorKey, propertyObject) && descriptorKey !== "type" && descriptorKey !== "dataFieldName") {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user