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/15 21:54:15 UTC

[incubator-streampipes] 08/11: [STREAMPIPES-193] Fix appearance of feedback component

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

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

commit d393e0565f66ea8a692cd5d6061e4ffdcb1a12a0
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Aug 14 19:35:37 2020 +0200

    [STREAMPIPES-193] Fix appearance of feedback component
---
 .../app-asset-monitoring.module.ts                 |  5 --
 ui/src/app/app-overview/app-overview.module.ts     |  5 --
 ui/src/app/app-routing.module.ts                   |  2 +
 .../app-transport-monitoring.module.ts             |  5 --
 ui/src/app/connect/connect.module.ts               |  1 -
 .../components/feedback/feedback.component.html    | 13 ++---
 .../components/feedback/feedback.component.ts      |  4 +-
 .../components/toolbar/toolbar.component.html      | 40 +++++++++------
 .../components/toolbar/toolbar.component.scss}     | 25 ++-------
 .../components/toolbar/toolbar.component.ts        | 60 +++-------------------
 ui/src/app/data-explorer/data-explorer.module.ts   |  5 --
 ui/src/app/home/home.component.ts                  |  7 ++-
 ui/src/app/home/home.module.ts                     | 18 +------
 ui/src/app/info/about/about.component.css          |  4 ++
 ui/src/app/info/about/about.component.html         |  6 +--
 ui/src/app/notifications/notifications.module.ts   |  5 --
 ui/src/scss/sp/feedback.ng1.scss                   |  2 -
 17 files changed, 60 insertions(+), 147 deletions(-)

diff --git a/ui/src/app/app-asset-monitoring/app-asset-monitoring.module.ts b/ui/src/app/app-asset-monitoring/app-asset-monitoring.module.ts
index ec8ff58..a1260a8 100644
--- a/ui/src/app/app-asset-monitoring/app-asset-monitoring.module.ts
+++ b/ui/src/app/app-asset-monitoring/app-asset-monitoring.module.ts
@@ -65,11 +65,6 @@ import {streamPipesStompConfig} from "../dashboard/services/websocket.config";
         RestService,
         ShapeService,
         {
-            provide: 'RestApi',
-            useFactory: ($injector: any) => $injector.get('RestApi'),
-            deps: ['$injector'],
-        },
-        {
             provide: InjectableRxStompConfig,
             useValue: streamPipesStompConfig
         },
diff --git a/ui/src/app/app-overview/app-overview.module.ts b/ui/src/app/app-overview/app-overview.module.ts
index 03dc7f7..7976491 100644
--- a/ui/src/app/app-overview/app-overview.module.ts
+++ b/ui/src/app/app-overview/app-overview.module.ts
@@ -47,11 +47,6 @@ import { AppOverviewComponent } from './app-overview.component';
         AppOverviewComponent,
     ],
     providers: [
-        {
-            provide: 'RestApi',
-            useFactory: ($injector: any) => $injector.get('RestApi'),
-            deps: ['$injector'],
-        }
     ],
     entryComponents: [
         AppOverviewComponent
diff --git a/ui/src/app/app-routing.module.ts b/ui/src/app/app-routing.module.ts
index 03bb8d0..cc9df99 100644
--- a/ui/src/app/app-routing.module.ts
+++ b/ui/src/app/app-routing.module.ts
@@ -37,6 +37,7 @@ import {ConfiguredCanActivateGuard} from "./_guards/configured.can-activate.guar
 import {StartupComponent} from "./login/components/startup/startup.component";
 import {AlreadyConfiguredCanActivateGuard} from "./_guards/already-configured.can-activate.guard";
 import {LoggedInCanActivateGuard} from "./_guards/logged-in.can-activate.guard";
+import {InfoComponent} from "./info/info.component";
 
 const routes: Routes = [
   { path: 'login', component: LoginComponent, canActivate: [ConfiguredCanActivateGuard, LoggedInCanActivateGuard]},
@@ -53,6 +54,7 @@ const routes: Routes = [
       { path: 'dataexplorer', component: DataExplorerComponent },
       { path: 'editor', component: EditorComponent },
       { path: 'pipelines', component: PipelinesComponent },
+      { path: 'info', component: InfoComponent },
       { path: 'pipeline-details', component: PipelineDetailsComponent }
     ], canActivateChild: [AuthCanActivateChildrenGuard] }
 ];
diff --git a/ui/src/app/app-transport-monitoring/app-transport-monitoring.module.ts b/ui/src/app/app-transport-monitoring/app-transport-monitoring.module.ts
index 828727f..143336a 100644
--- a/ui/src/app/app-transport-monitoring/app-transport-monitoring.module.ts
+++ b/ui/src/app/app-transport-monitoring/app-transport-monitoring.module.ts
@@ -69,11 +69,6 @@ import {NgxChartsModule} from '@swimlane/ngx-charts';
     providers: [
         AppTransportMonitoringRestService,
         TimestampConverterService,
-        {
-            provide: 'RestApi',
-            useFactory: ($injector: any) => $injector.get('RestApi'),
-            deps: ['$injector'],
-        }
     ],
     entryComponents: [
         AppTransportMonitoringComponent
diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts
index 998027c..a6c6efd 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -174,7 +174,6 @@ import {TourProviderService} from "../services/tour/tour-provider.service";
         StaticPropertyUtilService,
         DataMarketplaceService,
         IconService,
-        ShepherdService,
         UnitProviderService,
         DisplayRecommendedPipe,
         TimestampPipe,
diff --git a/ui/src/app/core-v2/components/feedback/feedback.component.html b/ui/src/app/core-v2/components/feedback/feedback.component.html
index 974706a..0c6acb2 100644
--- a/ui/src/app/core-v2/components/feedback/feedback.component.html
+++ b/ui/src/app/core-v2/components/feedback/feedback.component.html
@@ -16,25 +16,26 @@
   ~
   -->
 
-<div class="feedback-container md-whiteframe-z1">
+<div class="feedback-container" (click) = "$event.stopPropagation()">
     <div fxLayout="column" fxFlex="100" *ngIf="!sendingFeedback">
         <div fxLayout="column" fxFlex="50" fxLayoutAlign="start center">
             <div class="feedback-title">We welcome your feedback!</div>
         </div>
         <div fxLayout="column" fxFlex="40" fxLayoutAlign="start center" style="margin-bottom:20px;">
-            <div class="feedback-explainer">Your feedback helps us to improve StreamPipes.<br/>
-                Features you'd like to see, bugs you've found or things you like - tell us what you think!
+            <div fxFlex="100" class="feedback-explainer">
+                <span>Your feedback helps us to improve StreamPipes.</span>
+                <span>Features you'd like to see, bugs you've found or things you like - tell us what you think!</span>
             </div>
         </div>
         <div fxLayout="column" fxFlex="40" fxLayoutAlign="start center" style="margin-bottom:20px;">
-            <mat-form-field class="md-block feedback-width-100 feedback-font-size-small">
+            <mat-form-field class="feedback-width-100 feedback-font-size-small">
                 <label>Your feedback</label>
                 <textarea matInput [(ngModel)]="feedback.feedbackText" maxlength="500" rows="5"></textarea>
             </mat-form-field>
         </div>
         <div fxLayout="column" fxFlex="40" fxLayoutAlign="end center">
             <div fxLayout="row" fxLayoutAlign="end end">
-                <button mat-button mat-raised-button class="mat-basic" (click)="closeDialog()">
+                <button mat-button mat-raised-button class="mat-basic" (click)="closeDialog()" style="margin-right:10px;">
                     Close
                 </button>
                 <button mat-button mat-raised-button color="primary" type="submit"
@@ -44,7 +45,7 @@
             </div>
         </div>
     </div>
-    <div fxLayout="column" *ngIf="sendingFeedback" class="feedback-height-100">
+    <div fxFlex="100" fxLayout="column" *ngIf="sendingFeedback" class="feedback-height-100">
         <div *ngIf="!sendingFeedbackFinished" class="feedback-height-100">
             <div fxLayout="column" fxLayoutAlign="center center" fxFlex="100" fxLayoutFill>
                 <mat-spinner [mode]="'indeterminate'" [diameter]="96"></mat-spinner>
diff --git a/ui/src/app/core-v2/components/feedback/feedback.component.ts b/ui/src/app/core-v2/components/feedback/feedback.component.ts
index 6ce1e40..11ebd11 100644
--- a/ui/src/app/core-v2/components/feedback/feedback.component.ts
+++ b/ui/src/app/core-v2/components/feedback/feedback.component.ts
@@ -36,7 +36,7 @@ export class FeedbackComponent implements OnInit {
     feedbackUrl = "";
     debugFeedbackUrl = "";
 
-    targetEmail = "users@streampipes.apache.org";
+    targetEmail = "dev@streampipes.apache.org";
 
     constructor() {
     }
@@ -48,6 +48,8 @@ export class FeedbackComponent implements OnInit {
 
     closeDialog() {
         this.closeFeedbackEmitter.emit();
+        this.sendingFeedback = false;
+        this.sendingFeedbackFinished = false;
     }
 
     sendMail(){
diff --git a/ui/src/app/core-v2/components/toolbar/toolbar.component.html b/ui/src/app/core-v2/components/toolbar/toolbar.component.html
index 0ed1f1b..759526a 100644
--- a/ui/src/app/core-v2/components/toolbar/toolbar.component.html
+++ b/ui/src/app/core-v2/components/toolbar/toolbar.component.html
@@ -31,24 +31,32 @@
         <span fxFlex></span>
         <div fxFlex="40" fxLayout fxLayoutAlign="end center" *ngIf="authenticated" style="height:100%;">
             <div style="height:100%;">
-                <div [ngStyle]="feedbackMenuBackground" fxLayout fxLayoutAlign="center center" style="height: 100%;">
-                <button mat-button mat-icon-button
-                        matTooltip="Feedback" matTooltipPosition="below"
-                        [ngClass]="feedbackOpen ? 'sp-icon-button-no-hover' : 'sp-icon-button'" (click)="toggleFeedback()" style="min-width:0px;" layout layout-align="center center">
-                    <i [ngStyle]="feedbackMenuIconColor" class="material-icons">feedback</i>
-                </button>
+                <div [ngStyle]="feedbackOpen.menuOpen ? {'background-color': 'white'} : {'background-color': '#39b54a'}" fxLayout fxLayoutAlign="center center" style="height: 100%;">
+                    <button mat-button mat-icon-button
+                            [matMenuTriggerFor]="feedbackMenu"
+                            #feedbackOpen="matMenuTrigger"
+                            matTooltip="Feedback" matTooltipPosition="below"
+                            [ngClass]="feedbackOpen.menuOpen ? 'sp-icon-button-no-hover' : 'sp-icon-button'" style="min-width:0px;" fxLayout fxLayoutAlign="center center">
+                        <i [ngStyle]="feedbackOpen.menuOpen ? {'color': '#39b54a'} : {'color': 'white'}" class="material-icons">feedback</i>
+                    </button>
+                </div>
+            </div>
+            <mat-menu #feedbackMenu="matMenu" style="max-width: none;" class="feedback-menu-content">
+                <feedback (closeFeedbackEmitter)="closeFeedbackWindow()"></feedback>
+            </mat-menu>
+            <div style="height:100%;">
+                <div [ngStyle]="accountMenuOpen.menuOpen ? {'background-color': 'white'} : {'background-color': '#39b54a'}" fxLayout fxLayoutAlign="center center" style="height: 100%;">
+                    <button mat-button mat-icon-button
+                            fxLayout fxLayoutAlign="center center"
+                            [ngClass]="accountMenuOpen.menuOpen ? 'sp-icon-button-no-hover' : 'sp-icon-button'" style="min-width:0px;"
+                            [matMenuTriggerFor]="menu"
+                            #accountMenuOpen="matMenuTrigger"
+                            matTooltip="User Preferences" matTooltipPosition="below">
+                        <i [ngStyle]="accountMenuOpen.menuOpen ? {'color': '#39b54a'} : {'color': 'white'}" class="material-icons">account_circle</i>
+                    </button>
                 </div>
-                <feedback style="position:relative;left: -348px;" *ngIf="feedbackOpen" (closeFeedbackEmitter)="closeFeedbackWindow()"></feedback>
             </div>
-            <button mat-button mat-icon-button
-                    [ngClass]="accountMenuOpen ? 'sp-icon-button-no-hover' : 'sp-icon-button'" style="min-width:0px;"
-                    [matMenuTriggerFor]="menu"
-                    matTooltip="User Preferences" matTooltipPosition="below"
-                    (menuOpened)="openMenu()" (menuClosed)="closeMenu()">
-                <i [ngStyle]="accountMenuIconColor" class="material-icons">account_circle</i>
-            </button>
-            <mat-menu #menu="matMenu" id="account" [ngStyle]="accountMenuBackground"
-                      md-position-mode="target-right target" md-offset="8 52" style="margin:inherit;height:100%;" fxLayout fxLayoutAlign="center center">
+            <mat-menu #menu="matMenu" id="account">
                 <button mat-menu-item (click)="openInfo()" style="min-width:0px;">
                     <mat-icon aria-label="Info">help</mat-icon>
                     Info
diff --git a/ui/src/app/services/dialog-builder.service.ts b/ui/src/app/core-v2/components/toolbar/toolbar.component.scss
similarity index 59%
rename from ui/src/app/services/dialog-builder.service.ts
rename to ui/src/app/core-v2/components/toolbar/toolbar.component.scss
index 711203f..61efca3 100644
--- a/ui/src/app/services/dialog-builder.service.ts
+++ b/ui/src/app/core-v2/components/toolbar/toolbar.component.scss
@@ -16,26 +16,7 @@
  *
  */
 
-import * as angular from 'angular';
 
-export class DialogBuilder {
-
-    constructor() {
-
-    }
-
-    // TODO: Can't resolve
-    getDialogTemplate(controller, template) {
-        return {
-            controller: controller,
-            controllerAs: "ctrl",
-            bindToController: true,
-            template: template,
-            parent: angular.element(document.body),
-            clickOutsideToClose: false,
-            //scope: this.$scope,
-            //rootScope: this.$rootScope,
-            //preserveScope: true
-        }
-    }
-}
+::ng-deep .cdk-overlay-pane .feedback-menu-content{
+  min-width:500px;
+}
\ No newline at end of file
diff --git a/ui/src/app/core-v2/components/toolbar/toolbar.component.ts b/ui/src/app/core-v2/components/toolbar/toolbar.component.ts
index 9b2585d..f20d134 100644
--- a/ui/src/app/core-v2/components/toolbar/toolbar.component.ts
+++ b/ui/src/app/core-v2/components/toolbar/toolbar.component.ts
@@ -16,29 +16,22 @@
  *
  */
 
-import {Component, OnInit} from "@angular/core";
+import {Component, OnInit, ViewChild} from "@angular/core";
 import {BaseNavigationComponent} from "../base-navigation.component";
 import {Router} from "@angular/router";
 import {RestApi} from "../../../services/rest-api.service";
 import {AuthStatusService} from "../../../services/auth-status.service";
+import {MatMenuTrigger} from "@angular/material/menu";
 
 @Component({
   selector: 'toolbar',
   templateUrl: './toolbar.component.html',
+  styleUrls: ['./toolbar.component.scss']
 })
 export class ToolbarComponent extends BaseNavigationComponent implements OnInit {
 
-  feedbackOpen: boolean = false;
-  accountMenuOpen: boolean = false;
-
-  whiteColor: string = "#FFFFFF";
-  greenColor: string = "#39b54a";
-
-  accountMenuBackground: any = this.makeColor('background-color', this.greenColor);
-  accountMenuIconColor: any = this.makeColor('color', this.whiteColor);
-
-  feedbackMenuBackground: any = this.makeColor('background-color', this.greenColor);
-  feedbackMenuIconColor: any = this.makeColor('color', this.whiteColor);
+  @ViewChild('feedbackOpen') feedbackOpen: MatMenuTrigger;
+  @ViewChild('accountMenuOpen') accountMenuOpen: MatMenuTrigger;
 
   constructor(Router: Router,
               private RestApi: RestApi,
@@ -49,47 +42,10 @@ export class ToolbarComponent extends BaseNavigationComponent implements OnInit
   ngOnInit(): void {
     super.onInit();
   }
-  
-  openMenu() {
-    this.accountMenuOpen = true;
-  }
-  
-  closeMenu() {
-    this.accountMenuOpen = false;
-  }
-
-  makeColor(type: string, color: string) {
-    return {[type]: color};
-  }
-
-  toggleFeedback() {
-    this.feedbackOpen = !this.feedbackOpen;
-    this.updateFeedbackColors();
-  }
 
   closeFeedbackWindow() {
-    this.updateFeedbackColors();
-    this.feedbackOpen = false;
-  }
-
-  triggerAccountMenu($mdMenu, $event) {
-    this.updateAccountColors();
-    this.accountMenuOpen = true;
-    $mdMenu.open($event)
-  }
-
-  updateAccountColors() {
-    this.accountMenuBackground = this.getNewColor('background-color', this.accountMenuBackground);
-    this.accountMenuIconColor = this.getNewColor('color', this.accountMenuIconColor);
-  }
-
-  updateFeedbackColors() {
-    this.feedbackMenuBackground = this.getNewColor('background-color', this.feedbackMenuBackground);
-    this.feedbackMenuIconColor = this.getNewColor('color', this.feedbackMenuIconColor);
-  }
-
-  getNewColor(type: string, currentColor: any) {
-    return currentColor[type] == this.greenColor ? this.makeColor(type, this.whiteColor) : this.makeColor(type, this.greenColor);
+    //this.feedbackOpen = false;
+    this.feedbackOpen.closeMenu();
   }
 
   openDocumentation() {
@@ -97,7 +53,7 @@ export class ToolbarComponent extends BaseNavigationComponent implements OnInit
   };
 
   openInfo() {
-    this.Router.navigateByUrl("info");
+    this.Router.navigate(["info"]);
     this.activePage = "Info";
   }
 
diff --git a/ui/src/app/data-explorer/data-explorer.module.ts b/ui/src/app/data-explorer/data-explorer.module.ts
index 4ccff1a..9164145 100644
--- a/ui/src/app/data-explorer/data-explorer.module.ts
+++ b/ui/src/app/data-explorer/data-explorer.module.ts
@@ -148,11 +148,6 @@ export const MY_NATIVE_FORMATS = {
     ResizeService,
     RefreshDashboardService,
     SemanticTypeUtilsService,
-    {
-      provide: 'RestApi',
-      useFactory: ($injector: any) => $injector.get('RestApi'),
-      deps: ['$injector']
-    },
     ElementIconText,
     {
       provide: OWL_DATE_TIME_FORMATS, useValue: MY_NATIVE_FORMATS
diff --git a/ui/src/app/home/home.component.ts b/ui/src/app/home/home.component.ts
index b4b5213..e832263 100644
--- a/ui/src/app/home/home.component.ts
+++ b/ui/src/app/home/home.component.ts
@@ -19,6 +19,7 @@
 import {Component} from '@angular/core';
 import {DomSanitizer} from '@angular/platform-browser';
 import {HomeService} from './home.service';
+import {Router} from "@angular/router";
 
 @Component({
     templateUrl: './home.component.html',
@@ -28,7 +29,9 @@ export class HomeComponent {
 
     serviceLinks = [];
 
-    constructor(private homeService: HomeService, private sanitizer: DomSanitizer/*, private stateService: StateService*/) {
+    constructor(private homeService: HomeService,
+                private sanitizer: DomSanitizer,
+                private Router: Router) {
         this.serviceLinks = this.homeService.getServiceLinks();
     }
 
@@ -40,7 +43,7 @@ export class HomeComponent {
         if (link.link.newWindow) {
             window.open(link.link.value);
         } else {
-            //this.stateService.go(link.link.value);
+            this.Router.navigate([link.link.value]);
         }
     }
 
diff --git a/ui/src/app/home/home.module.ts b/ui/src/app/home/home.module.ts
index 445f3c8..4e3e47d 100644
--- a/ui/src/app/home/home.module.ts
+++ b/ui/src/app/home/home.module.ts
@@ -38,23 +38,7 @@ import {RestApi} from "../services/rest-api.service";
         StatusComponent
     ],
     providers: [
-        HomeService,
-        RestApi,
-        {
-            provide: '$http',
-            useFactory: ($injector: any) => $injector.get('$http'),
-            deps: ['$injector'],
-        },
-        {
-            provide: 'apiConstants',
-            useFactory: ($injector: any) => $injector.get('apiConstants'),
-            deps: ['$injector'],
-        },
-        {
-            provide: 'AuthStatusService',
-            useFactory: ($injector: any) => $injector.get('AuthStatusService'),
-            deps: ['$injector'],
-        },
+        HomeService
     ],
     entryComponents: [
         HomeComponent
diff --git a/ui/src/app/info/about/about.component.css b/ui/src/app/info/about/about.component.css
index 9c12245..c05e1cc 100644
--- a/ui/src/app/info/about/about.component.css
+++ b/ui/src/app/info/about/about.component.css
@@ -24,4 +24,8 @@
     margin-top:20px;
     margin-left:auto;
     margin-right:auto;
+}
+
+.p-10 {
+    padding: 10px;
 }
\ No newline at end of file
diff --git a/ui/src/app/info/about/about.component.html b/ui/src/app/info/about/about.component.html
index b3b7c87..ff653a2 100644
--- a/ui/src/app/info/about/about.component.html
+++ b/ui/src/app/info/about/about.component.html
@@ -28,7 +28,7 @@
             <div class="assemblyOptions sp-blue-bg" style="padding:5px;">
                 <h4>Resources</h4>
             </div>
-            <div class="sp-blue-border md-padding">
+            <div class="sp-blue-border p-10">
                 <ul>
                     <li>
                         <div fxLayout="row fill" fxFlex="100">
@@ -88,7 +88,7 @@
             <div class="assemblyOptions sp-blue-bg" style="padding:5px;">
                 <h4>Community & Support</h4>
             </div>
-            <div class="sp-blue-border md-padding">
+            <div class="sp-blue-border p-10">
                 <ul>
                     <li>
                         <div fxLayout="row fill" fxFlex="100">
@@ -123,7 +123,7 @@
                             </div>
                             <div fxFlex="95" fxLayoutAlign="start center">
                                 <h5>If you like
-                                    StreamPipes, give us a star at <a
+                                    StreamPipes, give us a star on <a
                                             href="https://github.com/apache/incubator-streampipes">Github</a>
                                 </h5>
                             </div>
diff --git a/ui/src/app/notifications/notifications.module.ts b/ui/src/app/notifications/notifications.module.ts
index 502e3ff..9a3f74f 100644
--- a/ui/src/app/notifications/notifications.module.ts
+++ b/ui/src/app/notifications/notifications.module.ts
@@ -44,11 +44,6 @@ import {InjectableRxStompConfig, RxStompService, rxStompServiceFactory} from "@s
 	providers: [
 		NotificationsService,
 		{
-			provide: 'RestApi',
-			useFactory: ($injector: any) => $injector.get('RestApi'),
-			deps: ['$injector'],
-		},
-		{
 			provide: RxStompService,
 			useFactory: rxStompServiceFactory,
 			deps: [InjectableRxStompConfig]
diff --git a/ui/src/scss/sp/feedback.ng1.scss b/ui/src/scss/sp/feedback.ng1.scss
index 482fe1b..f8e9b96 100644
--- a/ui/src/scss/sp/feedback.ng1.scss
+++ b/ui/src/scss/sp/feedback.ng1.scss
@@ -20,9 +20,7 @@
 
 .feedback-container {
   font-size:14pt;
-  position: absolute;
   background: white;
-  width: 400px;
   height: 600px;
   z-index: 100;
   //border-left: 2px solid $sp-color-primary;