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 2020/08/21 10:04:34 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-203] Add more options to pipeline element installation view

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 043b6de  [STREAMPIPES-203] Add more options to pipeline element installation view
043b6de is described below

commit 043b6de1196004ade67bf4d79eb231cc53fff73b
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Aug 21 12:04:18 2020 +0200

    [STREAMPIPES-203] Add more options to pipeline element installation view
---
 ui/src/app/add/add.component.html                  | 71 +++++++++++++++++-----
 ui/src/app/add/add.component.scss                  | 11 ++++
 ui/src/app/add/add.component.ts                    | 30 ++++++++-
 ui/src/app/add/add.module.ts                       |  6 ++
 .../pipeline-element-installation-status.pipe.ts}  | 24 +++++---
 .../pipeline-element-name.pipe.ts}                 | 21 ++++---
 .../data-marketplace.component.html                |  2 +-
 7 files changed, 131 insertions(+), 34 deletions(-)

diff --git a/ui/src/app/add/add.component.html b/ui/src/app/add/add.component.html
index 58f07a9..bb37be7 100644
--- a/ui/src/app/add/add.component.html
+++ b/ui/src/app/add/add.component.html
@@ -20,9 +20,12 @@
     <div fxLayout="row" class="border" style="padding:0px;background-color:#f6f6f6;">
         <div fxFlex="100" style="line-height:24px;border-bottom:1px solid #ccc">
             <div fxFlex="100" fxLayout="row">
-                <button mat-button mat-flat-button color="primary" (click)="showManageRdfEndpointsDialog()">Manage Endpoints</button>
+                <button mat-button mat-flat-button color="primary" (click)="showManageRdfEndpointsDialog()">Manage
+                    Endpoints
+                </button>
                 <div fxFlex fxLayoutAlign="start center" [attr.id]="'peType'">
-                    <mat-tab-group [selectedIndex]="selectedCategoryIndex" (selectedIndexChange)="setSelectedTab($event)">
+                    <mat-tab-group [selectedIndex]="selectedCategoryIndex"
+                                   (selectedIndexChange)="setSelectedTab($event)">
                         <mat-tab label="All"></mat-tab>
                         <mat-tab label="Data Sources"></mat-tab>
                         <mat-tab label="Data Processors"></mat-tab>
@@ -32,18 +35,9 @@
             </div>
         </div>
     </div>
-
-    <div fxFlex="100" fxLayout="column" fxLayoutAlign="start start" class="page-container-padding-inner" *ngIf="endpointItemsLoadingComplete" >
-        <div fxLayoutAlign="start start" fxLayout="column">
-            <div fxFlex="100" fxLayout="row" style="margin-bottom:20px;">
-                <button mat-button mat-raised-button class="mat-basic mr-10" (click)="selectAll(true)">
-                    <i class="material-icons">done</i>
-                    &nbsp;Select all
-                </button>
-                <button mat-button mat-raised-button class="mat-basic mr-10" (click)="selectAll(false)">
-                    <i class="material-icons">clear</i>
-                    &nbsp;Select none
-                </button>
+    <div fxLayout="row" class="fixed-height add-options">
+        <div class="add-options-item" fxLayoutAlign="start center" fxLayout="row" style="padding-left:5px;">
+            <div fxFlex="100" fxLayout="row">
                 <button mat-button mat-raised-button color="primary"
                         [disabled]="selectedEndpointItems.length === 0"
                         (click)="installSelected()" class="mr-10">
@@ -52,18 +46,63 @@
                 </button>
                 <button mat-button mat-raised-button color="primary"
                         [disabled]="selectedEndpointItems.length === 0"
-                        (click)="uninstallSelected()">
+                        (click)="uninstallSelected()" class="mr-10">
                     <i class="material-icons">delete</i>
                     &nbsp;Uninstall selected
                 </button>
+                <button mat-button mat-icon-button color="primary" class="mr-10" (click)="selectAll(true)"
+                        matTooltip="Select all" matTooltipPosition="above">
+                    <i class="material-icons">queue</i>
+                </button>
+                <button mat-button mat-icon-button color="primary" class="mr-10" (click)="selectAll(false)"
+                        matTooltip="Select none" matTooltipPosition="above">
+                    <i class="material-icons">filter_none</i>
+                </button>
             </div>
         </div>
+        <span fxFlex></span>
+        <div class="add-options-item" fxLayoutAlign="start center" fxLayout="row" style="padding-left:5px;">
+            <mat-icon>search</mat-icon>
+
+            <mat-form-field class="form-style">
+                <input matInput placeholder="Find Element" value="" [(ngModel)]="filterTerm"
+                       name="something">
+            </mat-form-field>
+        </div>
+        <div class="add-options-item" fxLayoutAlign="start center" fxLayout="row">
+            <mat-form-field>
+                <mat-select [(value)]="selectedInstallationStatus">
+                    <mat-option [value]="'all'">
+                        Available & Installed
+                    </mat-option>
+                    <mat-option [value]="'installed'">
+                        Installed
+                    </mat-option>
+                    <mat-option [value]="'available'">
+                        Available
+                    </mat-option>
+                </mat-select>
+            </mat-form-field>
+        </div>
+        <div class="add-options-item" fxLayoutAlign="start center" fxLayout="row">
+            <button mat-button mat-icon-button color="primary" (click)="getEndpointItems()"
+                    matTooltip="Reload items" matTooltipPosition="above">
+                <mat-icon>refresh</mat-icon>
+            </button>
+        </div>
+    </div>
+
+    <div fxFlex="100" fxLayout="column" fxLayoutAlign="start start" class="page-container-padding-inner"
+         *ngIf="endpointItemsLoadingComplete">
+        <div fxLayoutAlign="start start" fxLayout="column">
+
+        </div>
         <div fxLayout="row wrap" style="width: 100%;">
             <endpoint-item fxFlex="33"
                            [itemSelected]="endpointItem.selected"
                            [item]="endpointItem"
                            (triggerInstallation)="triggerInstallation($event)"
-                           *ngFor="let endpointItem of endpointItems | pipelineElementTypeFilter: selectedTab | orderBy: 'asc':'name'"
+                           *ngFor="let endpointItem of endpointItems | pipelineElementTypeFilter: selectedTab | pipelineElementNameFilter: filterTerm | pipelineElementInstallationStatusFilter: selectedInstallationStatus | orderBy: 'asc':'name'"
                            class="p-15"
                            (click)="toggleSelected(endpointItem)"></endpoint-item>
         </div>
diff --git a/ui/src/app/add/add.component.scss b/ui/src/app/add/add.component.scss
index 0baeea4..327fd07 100644
--- a/ui/src/app/add/add.component.scss
+++ b/ui/src/app/add/add.component.scss
@@ -26,4 +26,15 @@
 
 .mr-10 {
   margin-right: 10px;
+}
+
+.add-options {
+  padding:0px;
+  background-color:#f6f6f6;
+  border-bottom: 1px solid #cccccc;
+}
+
+.add-options-item {
+  display: inline;
+  margin-right: 10px;
 }
\ No newline at end of file
diff --git a/ui/src/app/add/add.component.ts b/ui/src/app/add/add.component.ts
index 3e299bd..5214213 100644
--- a/ui/src/app/add/add.component.ts
+++ b/ui/src/app/add/add.component.ts
@@ -43,6 +43,9 @@ export class AddComponent implements OnInit {
 
     selectedEndpointItems: any[] = [];
 
+    _filterTerm: string = "";
+    _selectedInstallationStatus: string = "all";
+
     constructor(private RestApi: RestApi,
                 private AddService: AddService,
                 private DialogService: DialogService,
@@ -69,6 +72,7 @@ export class AddComponent implements OnInit {
 
     setSelectedTab(index: number) {
         this.selectedEndpointItems = [];
+        this.selectAll(false);
         this.selectedTab = this.availableTypes[index];
     }
 
@@ -77,8 +81,14 @@ export class AddComponent implements OnInit {
     }
 
     selectAll(selected) {
+        this.selectedEndpointItems = [];
         this.endpointItems.forEach(item => {
-            if (item.type === this.selectedTab || this.selectedTab == 'all') item.selected = selected;
+            if (item.type === this.selectedTab || this.selectedTab == 'all') {
+                item.selected = selected;
+                if (selected) {
+                    this.selectedEndpointItems.push(item.uri);
+                }
+            }
         });
         this.ChangeDetectorRef.detectChanges();
     }
@@ -164,4 +174,22 @@ export class AddComponent implements OnInit {
             }
         })
     }
+
+    set filterTerm(filterTerm: string) {
+        this._filterTerm = filterTerm;
+        this.selectAll(false);
+    }
+
+    get filterTerm(): string {
+        return this._filterTerm;
+    }
+
+    set selectedInstallationStatus(installationStatus: string) {
+        this._selectedInstallationStatus = installationStatus;
+        this.selectAll(false);
+    }
+
+    get selectedInstallationStatus(): string {
+        return this._selectedInstallationStatus;
+    }
 }
\ No newline at end of file
diff --git a/ui/src/app/add/add.module.ts b/ui/src/app/add/add.module.ts
index 7c6fcd8..7a39bdf 100644
--- a/ui/src/app/add/add.module.ts
+++ b/ui/src/app/add/add.module.ts
@@ -31,6 +31,8 @@ import {AddService} from "./services/add.service";
 import {AddEndpointComponent} from "./dialogs/add-endpoint/add-endpoint.component";
 import {OrderByPipe} from "./filter/order-by.pipe";
 import {EndpointInstallationComponent} from "./dialogs/endpoint-installation/endpoint-installation.component";
+import {PipelineElementNameFilter} from "./filter/pipeline-element-name.pipe";
+import {PipelineElementInstallationStatusFilter} from "./filter/pipeline-element-installation-status.pipe";
 
 @NgModule({
   imports: [
@@ -48,11 +50,15 @@ import {EndpointInstallationComponent} from "./dialogs/endpoint-installation/end
     EndpointInstallationComponent,
     EndpointItemComponent,
     OrderByPipe,
+    PipelineElementNameFilter,
+    PipelineElementInstallationStatusFilter,
     PipelineElementTypeFilter
   ],
   providers: [
     AddService,
     OrderByPipe,
+    PipelineElementInstallationStatusFilter,
+    PipelineElementNameFilter,
     PipelineElementTypeFilter
   ],
   exports: [
diff --git a/ui/src/app/add/add.component.scss b/ui/src/app/add/filter/pipeline-element-installation-status.pipe.ts
similarity index 61%
copy from ui/src/app/add/add.component.scss
copy to ui/src/app/add/filter/pipeline-element-installation-status.pipe.ts
index 0baeea4..25c4a06 100644
--- a/ui/src/app/add/add.component.scss
+++ b/ui/src/app/add/filter/pipeline-element-installation-status.pipe.ts
@@ -16,14 +16,22 @@
  *
  */
 
-.page-container-padding-inner {
-  margin: 20px;
-}
+import {Pipe, PipeTransform} from "@angular/core";
 
-.p-15 {
-  padding: 15px;
-}
+@Pipe({
+  name: 'pipelineElementInstallationStatusFilter',
+  pure: false
+})
+export class PipelineElementInstallationStatusFilter implements PipeTransform {
 
-.mr-10 {
-  margin-right: 10px;
+  transform(values: any[], filterTerm: string): any[] {
+    console.log(values);
+    console.log(filterTerm);
+    if (filterTerm === "all") {
+      return values;
+    } else {
+      let installed = filterTerm === "installed";
+      return values.filter(v => v.installed === installed);
+    }
+  }
 }
\ No newline at end of file
diff --git a/ui/src/app/add/add.component.scss b/ui/src/app/add/filter/pipeline-element-name.pipe.ts
similarity index 66%
copy from ui/src/app/add/add.component.scss
copy to ui/src/app/add/filter/pipeline-element-name.pipe.ts
index 0baeea4..9dd6118 100644
--- a/ui/src/app/add/add.component.scss
+++ b/ui/src/app/add/filter/pipeline-element-name.pipe.ts
@@ -16,14 +16,19 @@
  *
  */
 
-.page-container-padding-inner {
-  margin: 20px;
-}
+import {Pipe, PipeTransform} from "@angular/core";
 
-.p-15 {
-  padding: 15px;
-}
+@Pipe({
+  name: 'pipelineElementNameFilter',
+  pure: false
+})
+export class PipelineElementNameFilter implements PipeTransform {
 
-.mr-10 {
-  margin-right: 10px;
+  transform(values: any[], filterTerm: string): any[] {
+    if (filterTerm === "") {
+      return values;
+    } else {
+      return values.filter(v => v.name.toLowerCase().includes(filterTerm.toLowerCase()));
+    }
+  }
 }
\ No newline at end of file
diff --git a/ui/src/app/connect/data-marketplace/data-marketplace.component.html b/ui/src/app/connect/data-marketplace/data-marketplace.component.html
index ecc4fea..07ad979 100644
--- a/ui/src/app/connect/data-marketplace/data-marketplace.component.html
+++ b/ui/src/app/connect/data-marketplace/data-marketplace.component.html
@@ -38,7 +38,7 @@
         </div>
     </div>
 
-    <div class="fixed-height" fxLayout="row" class="data-marketplace-options">
+    <div fxLayout="row" class="fixed-height data-marketplace-options">
 
         <div class="data-marketplace-options-item" fxLayoutAlign="start center" fxLayout="row">
             <mat-icon>search</mat-icon>