From d2423f28dcb59a88424392327f68c23555629ba9 Mon Sep 17 00:00:00 2001 From: Srinath Narayanan Date: Wed, 7 Apr 2021 11:17:15 -0700 Subject: [PATCH] Added className to SelfServeBaseClass (#627) * Added className to SelfServeBaseClass * addressed PR comments * addressed PR comments * fixed lint errors --- src/SelfServe/SelfServe.tsx | 10 ++++++---- src/SelfServe/SelfServeTypes.ts | 2 ++ src/SelfServe/SelfServeUtils.test.tsx | 3 +-- src/SelfServe/SelfServeUtils.tsx | 9 +++------ src/SelfServe/SqlX/SqlX.tsx | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/SelfServe/SelfServe.tsx b/src/SelfServe/SelfServe.tsx index 2550f465c..946305540 100644 --- a/src/SelfServe/SelfServe.tsx +++ b/src/SelfServe/SelfServe.tsx @@ -41,13 +41,15 @@ const getDescriptor = async (selfServeType: SelfServeType): Promise { ]); const expectedDescriptor = { root: { - id: "TestClass", children: [ { id: "dbThroughput", @@ -270,7 +269,7 @@ describe("SelfServeUtils", () => { "invalidRegions", ], }; - const descriptor = mapToSmartUiDescriptor("TestClass", context); + const descriptor = mapToSmartUiDescriptor(context); expect(descriptor).toEqual(expectedDescriptor); }); }); diff --git a/src/SelfServe/SelfServeUtils.tsx b/src/SelfServe/SelfServeUtils.tsx index 8106153a2..bec436597 100644 --- a/src/SelfServe/SelfServeUtils.tsx +++ b/src/SelfServe/SelfServeUtils.tsx @@ -112,21 +112,18 @@ export const updateContextWithDecorator = { const context = Reflect.getMetadata(className, target) as Map; - const smartUiDescriptor = mapToSmartUiDescriptor(className, context); + const smartUiDescriptor = mapToSmartUiDescriptor(context); Reflect.defineMetadata(className, smartUiDescriptor, target); }; -export const mapToSmartUiDescriptor = ( - className: string, - context: Map -): SelfServeDescriptor => { +export const mapToSmartUiDescriptor = (context: Map): SelfServeDescriptor => { const inputNames: string[] = []; const root = context.get("root"); context.delete("root"); const smartUiDescriptor: SelfServeDescriptor = { root: { - id: className, + id: undefined, info: undefined, children: [], }, diff --git a/src/SelfServe/SqlX/SqlX.tsx b/src/SelfServe/SqlX/SqlX.tsx index b27f69e69..fe08a5c62 100644 --- a/src/SelfServe/SqlX/SqlX.tsx +++ b/src/SelfServe/SqlX/SqlX.tsx @@ -177,7 +177,7 @@ export default class SqlX extends SelfServeBaseClass { currentValues: Map, baselineValues: Map ): Promise => { - selfServeTrace({ selfServeClassName: "SqlX" }); + selfServeTrace({ selfServeClassName: this.constructor.name }); const dedicatedGatewayCurrentlyEnabled = currentValues.get("enableDedicatedGateway")?.value as boolean; const dedicatedGatewayOriginallyEnabled = baselineValues.get("enableDedicatedGateway")?.value as boolean;