You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2018/08/18 00:20:09 UTC

[09/14] helix git commit: add proper prompt after cluster creation

add proper prompt after cluster creation


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/e94b82ab
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/e94b82ab
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/e94b82ab

Branch: refs/heads/master
Commit: e94b82abbe54036ab6911ae9dda74e6466f96eae
Parents: 813b8c6
Author: Vivo Xu <vx...@linkedin.com>
Authored: Fri Mar 9 14:23:56 2018 -0800
Committer: Vivo Xu <vx...@linkedin.com>
Committed: Wed Aug 8 15:38:01 2018 -0700

----------------------------------------------------------------------
 .../cluster-detail.component.html               |  2 +-
 .../cluster-detail.component.spec.ts            |  6 ++----
 .../cluster-detail/cluster-detail.component.ts  | 21 +++++---------------
 .../cluster-list/cluster-list.component.html    |  2 +-
 .../cluster-list/cluster-list.component.spec.ts |  4 ++--
 .../cluster-list/cluster-list.component.ts      | 14 ++++++++++++-
 .../instance-detail.component.spec.ts           |  6 ++----
 7 files changed, 26 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
index 5b8a78c..e0fe3ac 100644
--- a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
+++ b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.html
@@ -34,7 +34,7 @@
           <mat-icon>add_circle</mat-icon>
           <span>Add an Instance</span>
         </button>
-        <button mat-menu-item *ngIf="false" (click)="deleteCluster()" disabled>
+        <button mat-menu-item *ngIf="false" (click)="deleteCluster()">
           <mat-icon>delete</mat-icon>
           <span>DELETE this Cluster</span>
         </button>

http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.spec.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.spec.ts b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.spec.ts
index f55d259..458620a 100644
--- a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.spec.ts
+++ b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.spec.ts
@@ -1,8 +1,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { NO_ERRORS_SCHEMA } from '@angular/core';
-import { HttpModule } from '@angular/http';
-import { RouterTestingModule } from '@angular/router/testing';
 
+import { TestingModule } from '../../../testing/testing.module';
 import { ClusterDetailComponent } from './cluster-detail.component';
 
 describe('ClusterDetailComponent', () => {
@@ -12,8 +11,7 @@ describe('ClusterDetailComponent', () => {
   beforeEach(async(() => {
     TestBed.configureTestingModule({
       imports: [
-        HttpModule,
-        RouterTestingModule
+        TestingModule
       ],
       declarations: [
         ClusterDetailComponent

http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
index d2a3bb3..0fbc0c1 100644
--- a/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
+++ b/helix-front/client/app/cluster/cluster-detail/cluster-detail.component.ts
@@ -157,30 +157,19 @@ export class ClusterDetailComponent implements OnInit {
   }
 
   deleteCluster() {
-    // disable delete function right now since it's too dangerous
-    /*
-    this.dialog
-      .open(ConfirmDialogComponent, {
-        data: {
-          title: 'Confirmation',
-          message: 'Are you sure you want to delete this cluster?'
-        }
-      })
-      .afterClosed()
-      .subscribe(result => {
+    this.helperService
+      .showConfirmation('Are you sure you want to delete this cluster?')
+      .then(result => {
         if (result) {
           this.clusterService
             .remove(this.cluster.name)
             .subscribe(data => {
-              this.snackBar.open('Cluster deleted!', 'OK', {
-                duration: 2000,
-              });
+              this.helperService.showSnackBar('Cluster deleted!');
               // FIXME: should reload cluster list as well
               this.router.navigate(['..'], { relativeTo: this.route });
             });
-        }
+          }
       });
-      */
   }
 
 }

http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-list/cluster-list.component.html b/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
index c32b1b8..dad205d 100644
--- a/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
+++ b/helix-front/client/app/cluster/cluster-list/cluster-list.component.html
@@ -11,7 +11,7 @@
     <button mat-mini-fab *ngIf="can" (click)="createCluster()">
       <mat-icon>add</mat-icon>
     </button>
-    <h3 mat-subheader>Clusters ({{ clusters.length }})</h3>
+    <h3 mat-subheader>Clusters in {{ service }} ({{ clusters.length }})</h3>
     <a *ngFor="let cluster of clusters"
       mat-list-item
       [routerLink]="[cluster.name]"

http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/cluster/cluster-list/cluster-list.component.spec.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-list/cluster-list.component.spec.ts b/helix-front/client/app/cluster/cluster-list/cluster-list.component.spec.ts
index 9c46a86..ab81aca 100644
--- a/helix-front/client/app/cluster/cluster-list/cluster-list.component.spec.ts
+++ b/helix-front/client/app/cluster/cluster-list/cluster-list.component.spec.ts
@@ -1,7 +1,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { NO_ERRORS_SCHEMA } from '@angular/core';
-import { HttpModule } from '@angular/http';
 
+import { TestingModule } from '../../../testing/testing.module';
 import { ClusterListComponent } from './cluster-list.component';
 
 describe('ClusterListComponent', () => {
@@ -11,7 +11,7 @@ describe('ClusterListComponent', () => {
   beforeEach(async(() => {
     TestBed.configureTestingModule({
       imports: [
-        HttpModule
+        TestingModule
       ],
       declarations: [
         ClusterListComponent

http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts b/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
index 35d0b92..2e1cb06 100644
--- a/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
+++ b/helix-front/client/app/cluster/cluster-list/cluster-list.component.ts
@@ -1,5 +1,6 @@
 import { Component, OnInit } from '@angular/core';
 import { MatDialog, MatSnackBar } from '@angular/material';
+import { Router } from '@angular/router';
 
 import { ClusterService } from '../shared/cluster.service';
 import { Cluster } from '../shared/cluster.model';
@@ -17,16 +18,19 @@ export class ClusterListComponent implements OnInit {
   errorMessage: string = '';
   isLoading: boolean = true;
   can: boolean = false;
+  service = '';
 
   constructor(
     protected clusterService: ClusterService,
     protected dialog: MatDialog,
-    protected snackBar: MatSnackBar
+    protected snackBar: MatSnackBar,
+    protected router: Router
   ) { }
 
   ngOnInit() {
     this.loadClusters();
     this.clusterService.can().subscribe(data => this.can = data);
+    this.service = this.router.url.split('/')[1];
   }
 
   loadClusters() {
@@ -71,6 +75,14 @@ export class ClusterListComponent implements OnInit {
             this.snackBar.open('Cluster created!', 'OK', {
               duration: 2000,
             });
+            this.dialog.open(AlertDialogComponent, {
+              width: '600px',
+              data: {
+                title: 'What\'s Next',
+                message: 'New cluster is created yet not activated. When you are ready to activate this cluster,'
+                  + ' please select "Activate this Cluster" menu in the cluster operations to continue.'
+              }
+            });
             this.loadClusters();
           });
       }

http://git-wip-us.apache.org/repos/asf/helix/blob/e94b82ab/helix-front/client/app/instance/instance-detail/instance-detail.component.spec.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/instance/instance-detail/instance-detail.component.spec.ts b/helix-front/client/app/instance/instance-detail/instance-detail.component.spec.ts
index f170b71..229e9d4 100644
--- a/helix-front/client/app/instance/instance-detail/instance-detail.component.spec.ts
+++ b/helix-front/client/app/instance/instance-detail/instance-detail.component.spec.ts
@@ -1,8 +1,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { NO_ERRORS_SCHEMA } from '@angular/core';
-import { HttpModule } from '@angular/http';
-import { RouterTestingModule } from '@angular/router/testing';
 
+import { TestingModule } from '../../../testing/testing.module';
 import { InstanceDetailComponent } from './instance-detail.component';
 
 describe('InstanceDetailComponent', () => {
@@ -12,8 +11,7 @@ describe('InstanceDetailComponent', () => {
   beforeEach(async(() => {
     TestBed.configureTestingModule({
       imports: [
-        HttpModule,
-        RouterTestingModule
+        TestingModule
       ],
       declarations: [ InstanceDetailComponent ],
       schemas: [