This is an automated email from the ASF dual-hosted git repository. zehnder pushed a commit to branch STREAMPIPES-234 in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit e6bf2a42ba0badf56142637155ad5d76153806fa Author: Philipp Zehnder <[email protected]> AuthorDate: Fri Oct 2 09:36:48 2020 +0200 Add label model to ui --- .../streampipes/model/labeling/Category.java | 2 + .../apache/streampipes/model/labeling/Label.java | 2 + ui/src/app/core-model/gen/streampipes-model.ts | 68 +++++++++++++++------- .../configure-labels.component.html | 10 ++++ .../configure-labels/configure-labels.component.ts | 9 +++ 5 files changed, 70 insertions(+), 21 deletions(-) diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Category.java b/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Category.java index fe3b72a..38fdafb 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Category.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Category.java @@ -2,9 +2,11 @@ package org.apache.streampipes.model.labeling; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; +import org.apache.streampipes.model.shared.annotation.TsModel; import java.util.List; +@TsModel public class Category { private String name; private String internalName; diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Label.java b/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Label.java index 7017bfb..f11286a 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Label.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/labeling/Label.java @@ -3,7 +3,9 @@ package org.apache.streampipes.model.labeling; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; import io.fogsy.empire.annotations.RdfProperty; +import org.apache.streampipes.model.shared.annotation.TsModel; +@TsModel public class Label { private String name; private String color; diff --git a/ui/src/app/core-model/gen/streampipes-model.ts b/ui/src/app/core-model/gen/streampipes-model.ts index 67be548..4f93cb6 100644 --- a/ui/src/app/core-model/gen/streampipes-model.ts +++ b/ui/src/app/core-model/gen/streampipes-model.ts @@ -1,25 +1,7 @@ -/* - * 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. - * - */ - /* tslint:disable */ /* eslint-disable */ // @ts-nocheck -// Generated using typescript-generator version 2.24.612 on 2020-09-15 08:51:13. +// Generated using typescript-generator version 2.24.612 on 2020-10-02 09:31:34. export class AbstractStreamPipesEntity { "@class": "org.apache.streampipes.model.base.NamedStreamPipesEntity" | "org.apache.streampipes.model.connect.adapter.AdapterDescription" | "org.apache.streampipes.model.connect.adapter.AdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription" | "org.apache.streampipes.model.connect.adapter.AdapterStreamDescription" | "org.apache.streampipes.model.connect.adapter.G [...] @@ -600,6 +582,29 @@ export class ApplicationLink extends UnnamedStreamPipesEntity { } } +export class Category { + _id: string; + _rev: string; + internalName: string; + labels: Label[]; + name: string; + superLabel: Label; + + static fromData(data: Category, target?: Category): Category { + if (!data) { + return data; + } + const instance = target || new Category(); + instance.name = data.name; + instance.internalName = data.internalName; + instance.superLabel = Label.fromData(data.superLabel); + instance.labels = __getCopyArrayFn(Label.fromData)(data.labels); + instance._id = data._id; + instance._rev = data._rev; + return instance; + } +} + export class CodeInputStaticProperty extends StaticProperty { "@class": "org.apache.streampipes.model.staticproperty.CodeInputStaticProperty"; codeTemplate: string; @@ -1563,8 +1568,8 @@ export class GenericAdapterSetDescription extends AdapterSetDescription implemen } const instance = target || new GenericAdapterSetDescription(); super.fromData(data, instance); - instance.eventSchema = EventSchema.fromData(data.eventSchema); instance.formatDescription = FormatDescription.fromData(data.formatDescription); + instance.eventSchema = EventSchema.fromData(data.eventSchema); instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription); return instance; } @@ -1582,8 +1587,8 @@ export class GenericAdapterStreamDescription extends AdapterStreamDescription im } const instance = target || new GenericAdapterStreamDescription(); super.fromData(data, instance); - instance.eventSchema = EventSchema.fromData(data.eventSchema); instance.formatDescription = FormatDescription.fromData(data.formatDescription); + instance.eventSchema = EventSchema.fromData(data.eventSchema); instance.protocolDescription = ProtocolDescription.fromData(data.protocolDescription); return instance; } @@ -1702,6 +1707,27 @@ export class KeepOutputStrategy extends OutputStrategy { } } +export class Label { + _id: string; + _rev: string; + color: string; + internalName: string; + name: string; + + static fromData(data: Label, target?: Label): Label { + if (!data) { + return data; + } + const instance = target || new Label(); + instance.name = data.name; + instance.color = data.color; + instance.internalName = data.internalName; + instance._id = data._id; + instance._rev = data._rev; + return instance; + } +} + export class Latency extends EventStreamQualityDefinition { "@class": "org.apache.streampipes.model.quality.Latency"; quantityValue: number; diff --git a/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.html b/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.html index 3645ced..166c945 100644 --- a/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.html +++ b/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.html @@ -1,6 +1,11 @@ <div fxLayout="column" fxLayoutAlign="space-around center"> <h2>Labels</h2> + <div fxFlex> + <button mat-button mat-flat-button (click)="addCategory()"> + <mat-icon class="icon">add</mat-icon><span>Add new Category</span> + </button> + </div> <div style="padding-left: 5px; padding-right: 5px; border-radius: 50px; font-size: 20px;"> <mat-form-field style="margin-top: -15px; margin-bottom: -10px"> <mat-select [(value)]="selectedCategory"> @@ -19,4 +24,9 @@ <h4 style="margin-top: -3px;"> {{label}} <label *ngIf="i < 10"> #{{i+1}}</label> </h4> </mat-list-item> </mat-list> + <div fxFlex> + <button mat-button mat-flat-button (click)="addLabel()"> + <mat-icon class="icon">add</mat-icon><span>Add new Label</span> + </button> + </div> </div> diff --git a/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.ts b/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.ts index c013f15..170cedd 100644 --- a/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.ts +++ b/ui/src/app/core-ui/labels/components/configure-labels/configure-labels.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, HostListener, Input, OnInit, Output } from '@angular/core'; import { ColorService } from '../../../image/services/color.service'; import { LabelService } from '../../services/label.service'; +import { Label } from '../../../../core-model/gen/streampipes-model'; @Component({ selector: 'sp-configure-labels', @@ -36,4 +37,12 @@ export class ConfigureLabelsComponent implements OnInit { this.labelChange.emit(this._selectedLabel); } + addCategory() { + } + + addLabel() { + const label = new Label(); + label.name = 'test'; + + } }
