From 4708722d1aabed071c8f863514696c570a0a7e2c Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Thu, 20 Mar 2025 12:56:00 -0400 Subject: [PATCH] explicitly set className instead of inferring from constructor --- src/SelfServe/Example/SelfServeExample.tsx | 5 +++++ src/SelfServe/GraphAPICompute/GraphAPICompute.tsx | 6 +++++- .../MaterializedViewsBuilder/MaterializedViewsBuilder.tsx | 6 +++++- src/SelfServe/SelfServeTypes.ts | 5 ++++- src/SelfServe/SqlX/SqlX.tsx | 6 +++++- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/SelfServe/Example/SelfServeExample.tsx b/src/SelfServe/Example/SelfServeExample.tsx index 11d641665..7b975cb40 100644 --- a/src/SelfServe/Example/SelfServeExample.tsx +++ b/src/SelfServe/Example/SelfServeExample.tsx @@ -1,3 +1,4 @@ +import { SelfServeType } from "SelfServe/SelfServeUtils"; import { IsDisplayable, OnChange, PropertyInfo, RefreshOptions, Values } from "../Decorators"; import { selfServeTraceStart, selfServeTraceSuccess } from "../SelfServeTelemetryProcessor"; import { @@ -168,6 +169,10 @@ export default class SelfServeExample extends SelfServeBaseClass { return defaults; }; + public getSelfServeType = (): SelfServeType => { + return SelfServeType.example; + } + @Values({ labelTKey: "DescriptionLabel", description: { diff --git a/src/SelfServe/GraphAPICompute/GraphAPICompute.tsx b/src/SelfServe/GraphAPICompute/GraphAPICompute.tsx index c116f8e30..5ac872cee 100644 --- a/src/SelfServe/GraphAPICompute/GraphAPICompute.tsx +++ b/src/SelfServe/GraphAPICompute/GraphAPICompute.tsx @@ -14,7 +14,7 @@ import { import type { ChoiceItem } from "../SelfServeTypes"; -import { BladeType, generateBladeLink } from "../SelfServeUtils"; +import { BladeType, generateBladeLink, SelfServeType } from "../SelfServeUtils"; import { deleteComputeResource, getCurrentProvisioningState, @@ -360,6 +360,10 @@ export default class GraphAPICompute extends SelfServeBaseClass { return defaults; }; + public getSelfServeType = (): SelfServeType => { + return SelfServeType.graphapicompute; + } + @Values({ isDynamicDescription: true, }) diff --git a/src/SelfServe/MaterializedViewsBuilder/MaterializedViewsBuilder.tsx b/src/SelfServe/MaterializedViewsBuilder/MaterializedViewsBuilder.tsx index 36a21bd5e..29cfd844e 100644 --- a/src/SelfServe/MaterializedViewsBuilder/MaterializedViewsBuilder.tsx +++ b/src/SelfServe/MaterializedViewsBuilder/MaterializedViewsBuilder.tsx @@ -19,7 +19,7 @@ import { import type { ChoiceItem } from "../SelfServeTypes"; -import { BladeType, generateBladeLink } from "../SelfServeUtils"; +import { BladeType, generateBladeLink, SelfServeType } from "../SelfServeUtils"; import { deleteMaterializedViewsBuilderResource, getCurrentProvisioningState, @@ -359,6 +359,10 @@ export default class MaterializedViewsBuilder extends SelfServeBaseClass { return defaults; }; + public getSelfServeType = (): SelfServeType => { + return SelfServeType.materializedviewsbuilder; + } + @Values({ isDynamicDescription: true, }) diff --git a/src/SelfServe/SelfServeTypes.ts b/src/SelfServe/SelfServeTypes.ts index e04c835e6..8ca97ab91 100644 --- a/src/SelfServe/SelfServeTypes.ts +++ b/src/SelfServe/SelfServeTypes.ts @@ -2,6 +2,7 @@ * @module SelfServe/SelfServeTypes */ +import { SelfServeType } from "SelfServe/SelfServeUtils"; import { TelemetryData } from "../Shared/Telemetry/TelemetryProcessor"; interface BaseInput { @@ -120,9 +121,11 @@ export abstract class SelfServeBaseClass { */ public abstract onRefresh: () => Promise; + public abstract getSelfServeType: () => SelfServeType; + test: string = "hello" /**@internal */ public toSelfServeDescriptor(): SelfServeDescriptor { - const className = this.constructor.name; + const className: string = this.getSelfServeType(); const selfServeDescriptor = Reflect.getMetadata(className, this) as SelfServeDescriptor; if (!this.initialize) { diff --git a/src/SelfServe/SqlX/SqlX.tsx b/src/SelfServe/SqlX/SqlX.tsx index cbac4ef04..d5b12fbaf 100644 --- a/src/SelfServe/SqlX/SqlX.tsx +++ b/src/SelfServe/SqlX/SqlX.tsx @@ -20,7 +20,7 @@ import { import type { ChoiceItem } from "../SelfServeTypes"; -import { BladeType, generateBladeLink } from "../SelfServeUtils"; +import { BladeType, generateBladeLink, SelfServeType } from "../SelfServeUtils"; import { deleteDedicatedGatewayResource, getCurrentProvisioningState, @@ -396,6 +396,10 @@ export default class SqlX extends SelfServeBaseClass { return defaults; }; + public getSelfServeType = (): SelfServeType => { + return SelfServeType.sqlx; + } + @Values({ isDynamicDescription: true, })