From 5ca5ce92f543b90592ed548498f1511c88b7dc17 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 29 May 2024 17:57:37 +0300 Subject: [PATCH] UI: Refactoring ColorProcessor fromSettings function --- .../app/shared/models/widget-settings.models.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/ui-ngx/src/app/shared/models/widget-settings.models.ts b/ui-ngx/src/app/shared/models/widget-settings.models.ts index 45f7f9f1fc..9c3cb68a30 100644 --- a/ui-ngx/src/app/shared/models/widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/widget-settings.models.ts @@ -361,19 +361,10 @@ export interface ColorProcessorSettings { export abstract class ColorProcessor { static fromSettings(color: ColorSettings, ctx?: WidgetContext): ColorProcessor { - const settings = color || constantColor(null); - switch (settings.type) { - case ColorType.constant: - return new ConstantColorProcessor(settings); - case ColorType.range: - return new RangeColorProcessor(settings, ctx); - case ColorType.function: - return new FunctionColorProcessor(settings); - case ColorType.gradient: - return new GradientColorProcessor(settings, ctx); - default: - return new ConstantColorProcessor(settings); - } + return ColorProcessor.fromColorProcessingSettings({ + settings: color, + ctx + }); } static fromColorProcessingSettings(setting: ColorProcessorSettings): ColorProcessor {