You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by dg...@apache.org on 2020/12/16 12:26:40 UTC

[incubator-datalab] 03/06: Code refactoring

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

dgnatyshyn pushed a commit to branch DATALAB-2182
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit ae23c3584f9fe7f1184aef1141a7c06bae531610
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Fri Dec 11 16:15:13 2020 +0200

    Code refactoring
---
 .../management-grid/management-grid.component.ts   |  3 +-
 .../project/project-list/project-list.component.ts | 37 ++++------------------
 .../src/app/core/services/progress-bar.service.ts  |  9 +++---
 .../app/reports/reporting/reporting.component.ts   |  2 +-
 .../bucket-browser/bucket-browser.component.ts     |  6 ++--
 .../bucket-browser/bucket-browser.module.ts        | 24 +++++++-------
 .../bucket-confirmation-dialog.component.html      | 18 +++++------
 .../bucket-confirmation-dialog.component.ts        |  2 +-
 .../bucket-browser/bucket-data.service.ts          | 28 ++++++++--------
 .../buckets-tree/bucket-tree.component.ts          |  1 -
 .../resources-grid/resources-grid.component.ts     | 33 ++++++++++---------
 .../src/app/shared/navbar/navbar.component.html    |  3 +-
 .../src/app/shared/navbar/navbar.component.ts      | 23 +++-----------
 13 files changed, 78 insertions(+), 111 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index fee16e1..2e0b0f1 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -117,6 +117,7 @@ export class ManagementGridComponent implements OnInit, AfterViewInit, AfterView
 
 
   ngAfterViewInit() {
+    this.progressBarService.startProgressBar();
     this.tableEl = this.table._elementRef.nativeElement;
     this.checkMaxRight();
   }
@@ -132,7 +133,7 @@ export class ManagementGridComponent implements OnInit, AfterViewInit, AfterView
   }
 
   getEnvironmentData() {
-    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
+    this.progressBarService.startProgressBar();
     this.environmentsDataService._data.subscribe(data => {
       if (data) {
         this.allEnvironmentData = EnvironmentModel.loadEnvironments(data);
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
index 4900fd8..1a3c5aa 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
@@ -67,14 +67,14 @@ export class ProjectListComponent implements OnInit, OnDestroy {
   }
 
   private getProjectList() {
-    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
+    this.progressBarService.startProgressBar();
     this.subscriptions.add(this.projectDataService._projects.subscribe((value: Project[]) => {
       this.projectList = value;
       if (this.projectList) {
         this.projectList.forEach(project => {
-          project.areRunningNode = this.areStartedEndpoints(project);
-          project.areStoppedNode = this.areStoppedEndpoints(project);
-          project.areTerminatedNode = this.areTerminatedOrFailedEndpoints(project);
+          project.areRunningNode = this.areResoursesInStatuses(project.endpoints, ['RUNNING']);
+          project.areStoppedNode = this.areResoursesInStatuses(project.endpoints, ['STOPPED']);
+          project.areTerminatedNode = this.areResoursesInStatuses(project.endpoints, ['TERMINATED', 'FAILED']);
         });
       }
       if (value) this.dataSource = new MatTableDataSource(value);
@@ -91,28 +91,10 @@ export class ProjectListComponent implements OnInit, OnDestroy {
     this.dataSource = new MatTableDataSource(filteredList);
   }
 
-  public toggleEndpointAction(project, action, endpoint) {
-    this.toggleStatus.emit({project, endpoint, action});
-  }
-
   public editProject(item: Project[]) {
     this.editItem.emit(item);
   }
 
-  public isInProgress(project) {
-    if (project)
-      return project.endpoints.some(e => e.status !== 'RUNNING' && e.status !== 'STOPPED' && e.status !== 'TERMINATED' && e.status !== 'FAILED');
-  }
-
-  public isActiveEndpoint(project) {
-    if (project)
-      return project.endpoints.some(e => e.status !== 'TERMINATED' && e.status !== 'FAILED');
-  }
-
-  public toEndpointStatus(status) {
-    return CheckUtils.endpointStatus[status] || status;
-  }
-
   public openEdgeDialog(action, project) {
       const endpoints = project.endpoints.filter(endpoint => {
         if (action === 'stop') {
@@ -137,14 +119,7 @@ export class ProjectListComponent implements OnInit, OnDestroy {
       );
     }
 
-  public areStartedEndpoints(project) {
-    return project.endpoints.filter(endpoint => endpoint.status === 'RUNNING').length > 0;
-  }
-
-  public areStoppedEndpoints(project) {
-    return project.endpoints.filter(endpoint => endpoint.status === 'STOPPED').length > 0;
-  }
-  public areTerminatedOrFailedEndpoints(project) {
-    return project.endpoints.filter(endpoint => endpoint.status === 'TERMINATED' || endpoint.status === 'FAILED').length > 0;
+  public areResoursesInStatuses(resources, statuses: Array<string>) {
+    return resources.some(resource => statuses.some(status => resource.status === status));
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts
index 2bbefea..095d937 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts
@@ -17,14 +17,15 @@
  * under the License.
  */
 
-import { Injectable } from '@angular/core';
-import { Subject } from 'rxjs';
+import {ApplicationRef, ChangeDetectorRef, Injectable} from '@angular/core';
+import {BehaviorSubject, Subject, timer} from 'rxjs';
+import {take} from 'rxjs/operators';
 
 @Injectable({
   providedIn: 'root'
 })
 export class ProgressBarService {
-  public showProgressBar = new Subject();
+  public showProgressBar = new BehaviorSubject(false);
 
   constructor() { }
 
@@ -33,6 +34,6 @@ export class ProgressBarService {
   }
 
   public startProgressBar() {
-    this.showProgressBar.next(true);
+    timer(0).subscribe(_ => this.showProgressBar.next(true));
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
index c06675a..20f835e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
@@ -93,7 +93,7 @@ export class ReportingComponent implements OnInit, OnDestroy {
   }
 
   getGeneralBillingData() {
-    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
+    this.progressBarService.startProgressBar();
     this.cashedFilterData = JSON.parse(JSON.stringify(this.reportData));
     Object.setPrototypeOf(this.cashedFilterData, Object.getPrototypeOf(this.reportData));
     this.billingReportService.getGeneralBillingData(this.reportData)
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
index 0c9937f..065e724 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
@@ -158,7 +158,7 @@ export class BucketBrowserComponent implements OnInit, OnDestroy {
       }
       if (toBigFile || toMany) {
         this.dialog.open(BucketConfirmationDialogComponent, {data: {
-          items: {toBig: toBigFile, toMany: toMany}, type: 'uploading-error'
+          items: {toBig: toBigFile, toMany: toMany}, type: 'upload_limitation'
           } , width: '550px'})
           .afterClosed().subscribe((res) => {
          if (res) {
@@ -236,7 +236,7 @@ export class BucketBrowserComponent implements OnInit, OnDestroy {
 
   async openResolveDialog(existFile) {
     const dialog = this.dialog.open(BucketConfirmationDialogComponent, {
-      data: {items: existFile, type: 'upload-dublicat'} , width: '550px'
+      data: {items: existFile, type: 'resolve_conflicts'} , width: '550px'
     });
     return dialog.afterClosed().toPromise().then(result => {
       return Promise.resolve(result);
@@ -277,7 +277,7 @@ export class BucketBrowserComponent implements OnInit, OnDestroy {
 
   public deleteAddedFile(file) {
     if ( file.subscr && file.request) {
-      this.dialog.open(BucketConfirmationDialogComponent, {data: {items: file, type: 'cancel-uploading'} , width: '550px'})
+      this.dialog.open(BucketConfirmationDialogComponent, {data: {items: file, type: 'cancel'} , width: '550px'})
         .afterClosed().subscribe((res) => {
           res && file.subscr.unsubscribe();
           res && this.addedFiles.splice(this.addedFiles.indexOf(file), 1);
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts
index 66fd74d..0da2eef 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts
@@ -33,19 +33,21 @@ import {BucketConfirmationDialogComponent} from './bucket-confirmation-dialog/bu
 import {BucketTreeComponent} from './buckets-tree/bucket-tree.component';
 import {ConvertFileSizePipeModule} from '../../core/pipes/convert-file-size';
 import {LocalDatePipeModule} from '../../core/pipes/local-date-pipe';
+import {ConvertActionPipeModule} from '../../core/pipes/convert-action-pipe';
 
 @NgModule({
-    imports: [
-        CommonModule,
-        FormsModule,
-        ReactiveFormsModule,
-        ResourcesGridModule,
-        ExploratoryEnvironmentCreateModule,
-        MaterialModule,
-        MatTreeModule,
-        ConvertFileSizePipeModule,
-        LocalDatePipeModule
-    ],
+  imports: [
+    CommonModule,
+    FormsModule,
+    ReactiveFormsModule,
+    ResourcesGridModule,
+    ExploratoryEnvironmentCreateModule,
+    MaterialModule,
+    MatTreeModule,
+    ConvertFileSizePipeModule,
+    LocalDatePipeModule,
+    ConvertActionPipeModule
+  ],
   declarations: [
     BucketBrowserComponent,
     FolderTreeComponent,
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.html
index 674a709..c411779 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.html
@@ -21,10 +21,10 @@
 
   <header class="dialog-header">
     <h4 class="modal-title">
-        <span *ngIf="data.type === 'delete'">Delete</span>
-        <span *ngIf="data.type === 'upload-dublicat'">Resolve conflicts</span>
-        <span *ngIf="data.type === 'cancel-uploading'">Cancel</span>
-        <span *ngIf="data.type === 'uploading-error'">Upload limitation</span>
+        <span *ngIf="data.type === 'delete'">{{data.type | convertaction}}</span>
+<!--        <span *ngIf="data.type === 'resolve_conflicts'">Resolve conflicts</span>-->
+<!--        <span *ngIf="data.type === 'cancel'">Cancel</span>-->
+<!--        <span *ngIf="data.type === 'upload_limitation'">Upload limitation</span>-->
     </h4>
     <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
   </header>
@@ -67,7 +67,7 @@
         </div>
       </div>
 
-      <div *ngIf="data.type === 'upload-dublicat'">
+      <div *ngIf="data.type === 'resolve_conflicts'">
         <p>
           <span
           class="strong upload-item-name ellipsis"
@@ -92,14 +92,14 @@
         </div>
       </div>
 
-      <div *ngIf="data.type === 'cancel-uploading'">
+      <div *ngIf="data.type === 'cancel'">
         <p class="upload-message"><span>Cancel uploading file </span> <span class="strong ellipsis upload-item-name">{{data.items.name}}.</span></p>
         <div class="text-center m-top-20">
           <span class="strong">Do you want to proceed?</span>
         </div>
       </div>
 
-      <div *ngIf="data.type === 'uploading-error'">
+      <div *ngIf="data.type === 'upload_limitation'">
         <p class="upload-limit-message" *ngIf="data.items.toMany">Only the first fifty objects will be uploaded.</p>
         <p class="upload-limit-message" *ngIf="data.items.toBig">Only file(s) within 4 GB will be uploaded.</p>
         <div class="text-center m-top-20">
@@ -107,12 +107,12 @@
         </div>
       </div>
 
-      <div class="text-center m-top-20" *ngIf="data.type === 'delete' || data.type === 'cancel-uploading' || data.type === 'uploading-error'">
+      <div class="text-center m-top-20" *ngIf="data.type === 'delete' || data.type === 'cancel' || data.type === 'upload_limitation'">
         <button  mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">No</button>
         <button mat-raised-button type="button" class="butt butt-success action" (click)="dialogRef.close(true)">Yes</button>
       </div>
 
-      <div class="text-center m-top-20" *ngIf="data.type === 'upload-dublicat'">
+      <div class="text-center m-top-20" *ngIf="data.type === 'resolve_conflicts'">
         <button  mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">Cancel</button>
         <button mat-raised-button type="button" class="butt butt-success action" (click)="submitResolving()">Continue</button>
       </div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.ts
index 2d75b20..7c8e49a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { Component, OnInit, Inject, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
+import { Component, OnInit, Inject, ViewEncapsulation } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts
index 8573105..f133793 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts
@@ -93,24 +93,24 @@ export class BucketDataService {
 
   public refreshBucketdata(bucket, endpoint) {
     let backetData = [];
-    this.bucketBrowserService.getBucketData(bucket, endpoint).subscribe(v => {
-    const copiedData = JSON.parse(JSON.stringify(v));
-    this.serverData = v;
-    if (this.emptyFolder) {
-      copiedData.unshift(this.emptyFolder);
-    }
-
-    backetData = this.convertToFolderTree(copiedData);
-    const data = this.buildFileTree({[bucket]: backetData}, 0);
-    this._bucketData.next(data);
-    });
+    // this.bucketBrowserService.getBucketData(bucket, endpoint).subscribe(v => {
+    // const copiedData = JSON.parse(JSON.stringify(v));
+    // this.serverData = v;
     // if (this.emptyFolder) {
-    //   array.unshift(this.emptyFolder);
+    //   copiedData.unshift(this.emptyFolder);
     // }
-    // this.serverData = array;
-    // backetData = this.convertToFolderTree(array);
+    //
+    // backetData = this.convertToFolderTree(copiedData);
     // const data = this.buildFileTree({[bucket]: backetData}, 0);
     // this._bucketData.next(data);
+    // });
+    if (this.emptyFolder) {
+      array.unshift(this.emptyFolder);
+    }
+    this.serverData = array;
+    backetData = this.convertToFolderTree(array);
+    const data = this.buildFileTree({[bucket]: backetData}, 0);
+    this._bucketData.next(data);
   }
 
   public buildFileTree(obj: {[key: string]: any}, level: number): TodoItemNode[] {
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/buckets-tree/bucket-tree.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/buckets-tree/bucket-tree.component.ts
index c22cb8d..fb0b9db 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/buckets-tree/bucket-tree.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/buckets-tree/bucket-tree.component.ts
@@ -28,7 +28,6 @@ interface BucketNode {
   children?: BucketNode[];
 }
 
-/** Flat node with expandable and level information */
 interface BucketFlatNode {
   expandable: boolean;
   name: string;
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 397b2bd..fecfb73 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -18,7 +18,13 @@
  */
 
 import {Project} from '../../administration/project/project.component';
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
+import {
+  Component,
+  EventEmitter,
+  Input,
+  OnInit,
+  Output
+} from '@angular/core';
 import { animate, state, style, transition, trigger } from '@angular/animations';
 import { ToastrService } from 'ngx-toastr';
 import { MatDialog } from '@angular/material/dialog';
@@ -41,9 +47,8 @@ import {OdahuActionDialogComponent} from '../../shared/modal-dialog/odahu-action
 import {ComputationModel} from '../computational/computational-resource.model';
 import {NotebookModel} from '../exploratory/notebook.model';
 import {AuditService} from '../../core/services/audit.service';
-import {JAN} from '@angular/material/core';
-import {ReconfirmationDialogComponent} from '../../administration/management/management-grid/management-grid.component';
 import {CompareUtils} from '../../core/util/compareUtils';
+import {timer} from 'rxjs';
 
 export interface SharedEndpoint {
   edge_node_ip: string;
@@ -97,17 +102,16 @@ export class ResourcesGridComponent implements OnInit {
   @Input() projects: Array<any>;
   @Output() getEnvironments: EventEmitter<any> = new EventEmitter();
 
-  environments: Exploratory[];
+  public environments: Exploratory[];
+  public collapseFilterRow: boolean = false;
+  public filtering: boolean = false;
+  public activeFiltering: boolean = false;
+  public activeProject: any;
+  public healthStatus: GeneralEnvironmentStatus;
 
-  collapseFilterRow: boolean = false;
-  filtering: boolean = false;
-  activeFiltering: boolean = false;
-  activeProject: any;
-  healthStatus: GeneralEnvironmentStatus;
-
-  filteredEnvironments: Exploratory[] = [];
-  filterConfiguration: FilterConfigurationModel = new FilterConfigurationModel('', [], [], [], '', '');
-  filterForm: FilterConfigurationModel = new FilterConfigurationModel('', [], [], [], '', '');
+  public filteredEnvironments: Exploratory[] = [];
+  public filterConfiguration: FilterConfigurationModel = new FilterConfigurationModel('', [], [], [], '', '');
+  public filterForm: FilterConfigurationModel = new FilterConfigurationModel('', [], [], [], '', '');
 
   public filteringColumns: Array<any> = [
     { title: 'Environment name', name: 'name', class: 'name-col', filter_class: 'name-filter', filtering: true },
@@ -149,7 +153,7 @@ export class ResourcesGridComponent implements OnInit {
   }
 
   public buildGrid(): void {
-    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
+    this.progressBarService.startProgressBar();
     this.userResourceService.getUserProvisionedResources()
       .subscribe((result: any) => {
         this.environments = ExploratoryModel.loadEnvironments(result);
@@ -159,7 +163,6 @@ export class ResourcesGridComponent implements OnInit {
         (this.environments.length) ? this.getUserPreferences() : this.filteredEnvironments = [];
         this.healthStatus && !this.healthStatus.billingEnabled && this.modifyGrid();
         this.progressBarService.stopProgressBar();
-
         }, () => this.progressBarService.stopProgressBar());
   }
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
index 89de5e0..6b7e853 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
@@ -18,7 +18,8 @@
   -->
 
 <div class="nav-bar" [hidden]="!isLoggedIn">
-  <mat-progress-bar *ngIf="showProgressBar" mode="indeterminate"></mat-progress-bar>
+<!--  <mat-progress-bar *ngIf="showProgressBar" mode="indeterminate"></mat-progress-bar>-->
+  <mat-progress-bar *ngIf="progressBarService.showProgressBar | async" mode="indeterminate"></mat-progress-bar>
   <div class="menu-area" *ngIf="healthStatus">
 
     <button class="hamburger" (click)="collapse()">
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
index 73dd5d9..5d51e1e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
@@ -25,8 +25,6 @@ import { RouterOutlet } from '@angular/router';
 
 import { ApplicationSecurityService, HealthStatusService, AppRoutingService, SchedulerService, StorageService } from '../../core/services';
 import { GeneralEnvironmentStatus } from '../../administration/management/management.model';
-import { DICTIONARY } from '../../../dictionary/global.dictionary';
-import { FileUtils } from '../../core/util';
 import { NotificationDialogComponent } from '../modal-dialog/notification-dialog';
 import {
   trigger,
@@ -34,13 +32,10 @@ import {
   transition,
   style,
   query, group,
-  sequence,
-  animateChild,
-  state
+
 } from '@angular/animations';
 import {skip, take} from 'rxjs/operators';
 import {ProgressBarService} from '../../core/services/progress-bar.service';
-import {tick} from '@angular/core/testing';
 
 
 interface Quota {
@@ -90,10 +85,8 @@ export class NavbarComponent implements OnInit, OnDestroy {
   isLoggedIn: boolean = false;
   metadata: any;
   isExpanded: boolean = true;
-  public showProgressBar: any = false;
   healthStatus: GeneralEnvironmentStatus;
   subscriptions: Subscription = new Subscription();
-  showProgressBarSubscr = new Subscription();
 
   constructor(
     public toastr: ToastrService,
@@ -104,13 +97,9 @@ export class NavbarComponent implements OnInit, OnDestroy {
     private storage: StorageService,
     private dialog: MatDialog,
     private progressBarService: ProgressBarService,
-    private changeDetector: ChangeDetectorRef,
-    private applicationRef: ApplicationRef,
   ) { }
 
   ngOnInit() {
-    this.showProgressBarSubscr = this.progressBarService.showProgressBar
-      .subscribe(isProgressBarVissible => this.showProgressBar = isProgressBarVissible);
     this.applicationSecurityService.loggedInStatus.subscribe(response => {
       this.subscriptions.unsubscribe();
       this.subscriptions.closed = false;
@@ -131,7 +120,6 @@ export class NavbarComponent implements OnInit, OnDestroy {
 
   ngOnDestroy(): void {
     this.subscriptions.unsubscribe();
-    this.showProgressBarSubscr.unsubscribe();
   }
 
   public getRouterOutletState(routerOutlet: RouterOutlet) {
@@ -155,11 +143,6 @@ export class NavbarComponent implements OnInit, OnDestroy {
 
   collapse() {
     this.isExpanded = !this.isExpanded;
-    const timeout = window.setTimeout(() => {
-      // this.changeDetector.detectChanges();
-      this.applicationRef.tick();
-      window.clearTimeout(timeout);
-    }, 400);
   }
 
   public emitQuotes(alert, total_quota?, exideedProjects?, informProjects?): void {
@@ -189,7 +172,9 @@ export class NavbarComponent implements OnInit, OnDestroy {
         if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100) checkQuotaAlert = 'total_quota';
         if (exceedProjects.length > 0 && informProjects.length === 0) checkQuotaAlert = 'project_exceed';
         if (informProjects.length > 0 && exceedProjects.length > 0) checkQuotaAlert = 'project_inform_and_exceed';
-        if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100 && exceedProjects.length > 0) checkQuotaAlert = 'total_quota_and_project_exceed';
+        if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100 && exceedProjects.length > 0) {
+          checkQuotaAlert = 'total_quota_and_project_exceed';
+        }
         if (params.totalQuotaUsed >= this.quotesLimit && params.totalQuotaUsed < 100
           && informProjects.length > 0 && exceedProjects.length > 0) checkQuotaAlert = 'total_quota_and_project_inform_and_exceed';
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org