Temporary disable automatic open/close sidebar 31/14531/1
authorSebastien Douheret <sebastien.douheret@iot.bzh>
Tue, 19 Jun 2018 15:09:54 +0000 (17:09 +0200)
committerSebastien Douheret <sebastien.douheret@iot.bzh>
Tue, 19 Jun 2018 15:09:56 +0000 (17:09 +0200)
Auto open/close logic in xds.layout.ts file seems buggy resulting to
a flicking sidebar. So disable this feature for now.

Change-Id: I1df6cd0af9f1b60cd54b48d763a870ef69a5fbe9
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
webapp/src/app/@theme/layouts/xds/xds.layout.html
webapp/src/app/@theme/layouts/xds/xds.layout.ts
webapp/src/app/pages/targets/target-add-modal/target-add-modal.component.html

index ee0a80b..ffbe80c 100644 (file)
@@ -9,17 +9,29 @@
 
     <nb-sidebar-header (click)="pinSidebar()">
       <!-- left sidebar -->
+      <!-- FIXME - bug flicking menu
       <nb-actions *ngIf="sidebar.id === 'left'" size="small" class="header-container right">
         <nb-action id="pin-sidebar" [icon]="(!sidebarPinned || sidebarCompact) ? 'fa fa-angle-double-right':'fa fa-angle-double-left'"
         [ngbTooltip]="sidebarPinned ? 'Undock the sidebar so it is hidden when no being focused':'Dock the sidebar so you can always see it'" placement="bottom">
         </nb-action>
       </nb-actions>
+      -->
+      <nb-actions *ngIf="sidebar.id === 'left'" size="small" class="header-container right">
+          <nb-action id="pin-sidebar" icon="fa fa-angle-double-left" placement="bottom" (click)="closeSidebar()">
+          </nb-action>
+      </nb-actions>
       <!-- right sidebar -->
+      <!-- FIXME - bug flicking menu
       <nb-actions *ngIf="sidebar.id === 'right'" size="small" class="header-container left">
         <nb-action id="pin-sidebar" [icon]="(!sidebarPinned || sidebarCompact) ? 'fa fa-angle-double-left':'fa fa-angle-double-right'"
         [ngbTooltip]="sidebarPinned ? 'Undock the sidebar so it is hidden when no being focused':'Dock the sidebar so you can always see it'" placement="bottom">
         </nb-action>
       </nb-actions>
+      -->
+      <nb-actions *ngIf="sidebar.id === 'right'" size="small" class="header-container left">
+          <nb-action id="pin-sidebar" icon="fa fa-angle-double-right" placement="bottom" (click)="closeSidebar()">
+          </nb-action>
+      </nb-actions>
     </nb-sidebar-header>
 
     <ng-content select="nb-menu"></ng-content>
index b362fff..f37d3ac 100644 (file)
@@ -80,14 +80,15 @@ export class XdsLayoutComponent implements OnDestroy {
     this.sidebarService.onExpand().subscribe(s => s.tag === 'menu-sidebar' && (this.sidebarCompact = false));
     this.menuService.onSubmenuToggle().subscribe(i => i.item && i.item.expanded && (this.sidebarCompact = false));
 
+    // FIXME: bug flicking menu - disable it for now
+    /*
     // Automatically expand sidebar on mouse over
     this._mouseEnterStream.flatMap(e => {
       return Observable
         .of(e)
         .delay(100)
         .takeUntil(this._mouseLeaveStream);
-    })
-      .subscribe(e => {
+      }).subscribe(e => {
         if (this.sidebarPinned || !this.sidebarCompact) {
           return;
         }
@@ -101,14 +102,14 @@ export class XdsLayoutComponent implements OnDestroy {
         .of(e)
         .delay(100)
         .takeUntil(this._mouseEnterStream);
-    })
-      .subscribe(e => {
+      }).subscribe(e => {
         if (this.sidebarPinned || this.sidebarCompact) {
           return;
         }
         // this._mouseEnterStream.emit(null);
         this.sidebarService.toggle(true, 'menu-sidebar');
       });
+      */
   }
 
   ngOnDestroy() {
@@ -118,14 +119,20 @@ export class XdsLayoutComponent implements OnDestroy {
   }
 
   onMouseEnter($event) {
-    this._mouseEnterStream.emit($event);
+    // FIXME: bug flicking menu - disable it for now
+    // this._mouseEnterStream.emit($event);
   }
 
   onMouseLeave($event) {
-    this._mouseLeaveStream.emit($event);
+    // FIXME: bug flicking menu - disable it for now
+    // this._mouseLeaveStream.emit($event);
   }
 
   pinSidebar() {
     this.sidebarPinned = !this.sidebarPinned;
   }
+
+  closeSidebar() {
+    this.sidebarService.toggle(true, 'menu-sidebar');
+  }
 }
index 84424b4..7a16330 100644 (file)
@@ -40,7 +40,7 @@
   <div class="col-12">
     <div class="offset-sm-4 col-sm-6">
       <button class="btn btn-md btn-secondary" (click)="cancelAction=true; closeModal()"> Cancel </button>
-      <button class="btn btn-md btn-primary" (click)="onSubmit()" [disabled]="!addTargetForm.valid">Add Folder</button>
+      <button class="btn btn-md btn-primary" (click)="onSubmit()" [disabled]="!addTargetForm.valid">Add Target</button>
     </div>
   </div>
 </div>