You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/07/30 07:11:18 UTC

[incubator-streampipes] 03/08: [STREAMPIPES-402] Remove unused widget config builder

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch STREAMPIPES-319
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit b1c387d662da49db64b3924c1b94852e881dd9ee
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Wed Jul 28 22:23:13 2021 +0200

    [STREAMPIPES-402] Remove unused widget config builder
---
 .../registry/widget-config-builder.ts              | 124 ---------------------
 1 file changed, 124 deletions(-)

diff --git a/ui/src/app/data-explorer/registry/widget-config-builder.ts b/ui/src/app/data-explorer/registry/widget-config-builder.ts
deleted file mode 100644
index 1a03760..0000000
--- a/ui/src/app/data-explorer/registry/widget-config-builder.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import {CollectedSchemaRequirements} from '../sdk/collected-schema-requirements';
-import {Datatypes} from '../sdk/model/datatypes';
-import {
-    ColorPickerStaticProperty, DashboardWidgetSettings,
-    FreeTextStaticProperty
-} from "../../core-model/gen/streampipes-model";
-
-export class WidgetConfigBuilder {
-
-    static readonly BACKGROUND_COLOR_KEY: string = 'spi-background-color-key';
-    static readonly PRIMARY_TEXT_COLOR_KEY: string = 'spi-primary-text-color-key';
-    static readonly SECONDARY_TEXT_COLOR_KEY: string = 'spi-secondary-text-color-key';
-
-    static readonly TITLE_KEY: string = 'spi-title-key';
-
-    private widget: DashboardWidgetSettings;
-
-    private constructor(widgetName: string, widgetLabel: string, withColors?: boolean, withTitlePanel?: boolean) {
-        this.widget = new DashboardWidgetSettings();
-        this.widget.widgetLabel = widgetLabel;
-        this.widget.widgetName = widgetName;
-        this.widget.config = [];
-        if (withColors) {
-        this.requiredColorParameter(WidgetConfigBuilder.BACKGROUND_COLOR_KEY, 'Background color', 'The background' +
-            ' color', '#1B1464');
-        this.requiredColorParameter(WidgetConfigBuilder.PRIMARY_TEXT_COLOR_KEY, 'Primary text color', 'The' +
-                ' primary text color', '#FFFFFF');
-        this.requiredColorParameter(WidgetConfigBuilder.SECONDARY_TEXT_COLOR_KEY, 'Secondary text color', 'The' +
-            ' secondary text' +
-            ' color', '#bebebe');
-        }
-        if (withTitlePanel) {
-        this.requiredTextParameter(WidgetConfigBuilder.TITLE_KEY, 'Title', 'The title');
-        }
-    }
-
-    static create(widgetName: string, widgetLabel: string): WidgetConfigBuilder {
-        return new WidgetConfigBuilder(widgetName, widgetLabel);
-    }
-
-    static createWithSelectableColors(widgetName: string, widgetLabel: string): WidgetConfigBuilder {
-        return new WidgetConfigBuilder(widgetName, widgetLabel, true);
-    }
-
-    static createWithSelectableColorsAndTitlePanel(widgetName: string, widgetLabel: string): WidgetConfigBuilder {
-        return new WidgetConfigBuilder(widgetName, widgetLabel, true, true);
-    }
-
-    requiredTextParameter(id: string, label: string, description: string): WidgetConfigBuilder {
-        const fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.String.toUri());
-        this.widget.config.push(fst);
-        return this;
-    }
-
-    requiredColorParameter(id: string, label: string, description: string, defaultColor?: string): WidgetConfigBuilder {
-        const csp = new ColorPickerStaticProperty();
-        csp["@class"] = "org.apache.streampipes.model.staticproperty.ColorPickerStaticProperty";
-        csp.internalName = id;
-        csp.label = label;
-        csp.description = description;
-        if (defaultColor) {
-            csp.selectedColor = defaultColor;
-        }
-        this.widget.config.push(csp);
-        return this;
-    }
-
-
-    requiredIntegerParameter(id: string, label: string, description: string): WidgetConfigBuilder {
-        const fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Integer.toUri());
-        this.widget.config.push(fst);
-        return this;
-    }
-
-    requiredFloatParameter(id: string, label: string, description: string): WidgetConfigBuilder {
-        const fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Float.toUri());
-        this.widget.config.push(fst);
-        return this;
-    }
-
-    requiredSchema(collectedSchemaRequirements: CollectedSchemaRequirements): WidgetConfigBuilder {
-        this.widget.requiredSchema = collectedSchemaRequirements.getEventSchema();
-        this.widget.config = this.widget.config.concat(collectedSchemaRequirements.getRequiredMappingProperties());
-
-        return this;
-    }
-
-    prepareStaticProperty(id: string, label: string, description: string, datatype: string) {
-        const fst: FreeTextStaticProperty = new FreeTextStaticProperty();
-        fst.internalName = id;
-        fst.label = label;
-        fst.description = description;
-        fst.requiredDatatype = datatype;
-        fst["@class"] = "org.apache.streampipes.model.staticproperty.FreeTextStaticProperty";
-
-        return fst;
-    }
-
-    build(): DashboardWidgetSettings {
-        for (let i = 0; i < this.widget.config.length; i++) {
-            this.widget.config[i].index = i;
-        }
-        return this.widget;
-    }
-
-}