You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/10/25 15:29:35 UTC
[incubator-streampipes] 02/02: Finish first version that persists
labels and categories
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 c4635da113980b6d9467337ce94e735880af0234
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Sun Oct 25 16:29:08 2020 +0100
Finish first version that persists labels and categories
---
.../configure-labels/configure-labels.component.ts | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
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 694dd7c..7029a27 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
@@ -2,6 +2,10 @@ import { Component, EventEmitter, HostListener, Input, OnInit, Output } from '@a
import { ColorService } from '../../../image/services/color.service';
import { LabelService } from '../../services/label.service';
import { Category, Label } from '../../../../core-model/gen/streampipes-model';
+import { fromEvent, interval, timer } from 'rxjs';
+import { debounce, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
+import { ajax } from 'rxjs/ajax';
+import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
@Component({
selector: 'sp-configure-labels',
@@ -10,14 +14,14 @@ import { Category, Label } from '../../../../core-model/gen/streampipes-model';
})
export class ConfigureLabelsComponent implements OnInit {
+ constructor(private formBuilder: FormBuilder, public colorService: ColorService, public labelService: LabelService) { }
+
public categories: Category[];
public selectedCategory: Category;
public categoryLabels: Label[];
public editCategory: boolean;
- constructor(public colorService: ColorService, public labelService: LabelService) { }
-
ngOnInit(): void {
this.editCategory = false;
this.labelService.getCategories().subscribe(res => {
@@ -25,6 +29,7 @@ export class ConfigureLabelsComponent implements OnInit {
});
}
+
startEditCategory(value) {
if ('internal_placeholder' !== value.value) {
this.editCategory = true;
@@ -56,7 +61,10 @@ export class ConfigureLabelsComponent implements OnInit {
updateCategory(newCategoryName) {
this.selectedCategory.name = newCategoryName;
- this.labelService.updateCategory(this.selectedCategory).subscribe((res: Category) => {
+ this.labelService.updateCategory(this.selectedCategory)
+ .subscribe((res: Category) => {
+ this.categories = this.categories.filter(obj => obj !== this.selectedCategory);
+ this.categories.push(res);
this.selectedCategory = res;
});
}