You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/01/28 11:19:46 UTC

[incubator-dlab] branch DLAB-1357 updated: [DLAB-1457]: Added create and get odahu request

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

dgnatyshyn pushed a commit to branch DLAB-1357
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1357 by this push:
     new b7d6ed5  [DLAB-1457]: Added create and get odahu request
     new b9a993b  Merge remote-tracking branch 'origin/DLAB-1357' into DLAB-1357
b7d6ed5 is described below

commit b7d6ed580c8e203549eb2d9a533cd4a33c65fbaa
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Tue Jan 28 13:18:46 2020 +0200

    [DLAB-1457]: Added create and get odahu request
---
 .../create-legion-cluster.component.html           |  2 +-
 .../create-legion-cluster.component.ts             | 13 ++++++---
 .../legion-deployment-data.service.ts              |  3 +-
 .../legion-deployment.component.html               |  2 +-
 .../legion-deployment.component.ts                 | 21 ++++++--------
 .../legion-list/legion-list.component.html         |  4 +--
 .../legion-list/legion-list.component.ts           |  2 +-
 .../resources/webapp/src/app/core/core.module.ts   |  2 ++
 .../services/applicationServiceFacade.service.ts   |  1 -
 .../app/core/services/legion-deployment.service.ts | 33 ++--------------------
 10 files changed, 28 insertions(+), 55 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.html
index fcba08d..74714aa 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.html
@@ -68,7 +68,7 @@
         <div class="text-center m-top-30">
           <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"
-                  [disabled]="!createLegionClusterForm.valid" (click)="dialogRef.close(createLegionClusterForm.value)">
+                  [disabled]="!createLegionClusterForm.valid" (click)="createOdahuCluster(createLegionClusterForm.value)">
             Create
           </button>
         </div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.ts
index 8fd2d46..c57e902 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/create-legion-claster/create-legion-cluster.component.ts
@@ -23,7 +23,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 import { ToastrService } from 'ngx-toastr';
 
 import { Project } from '../../../administration/project/project.component';
-import { UserResourceService, ProjectService } from '../../../core/services';
+import { UserResourceService, ProjectService, LegionDeploymentService } from '../../../core/services';
 
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import {PATTERNS} from "../../../core/util";
@@ -49,7 +49,8 @@ export class CreateLegionClusterComponent implements OnInit {
     public toastr: ToastrService,
     public dialogRef: MatDialogRef<CreateLegionClusterComponent>,
     private _fb: FormBuilder,
-    private projectService: ProjectService
+    private projectService: ProjectService,
+    private legionDeploymentService: LegionDeploymentService,
   ) {
   }
 
@@ -58,7 +59,7 @@ export class CreateLegionClusterComponent implements OnInit {
     this.initFormModel();
   }
 
-  public getProjectsgetProjects(): void{
+  public getProjects(): void{
     this.projectService.getProjectsList().subscribe((projects: any) => this.projects = projects);
   }
 
@@ -76,10 +77,14 @@ export class CreateLegionClusterComponent implements OnInit {
 
   private initFormModel(): void {
     this.createLegionClusterForm = this._fb.group({
+      name: ['', Validators.required],
       project: ['', Validators.required],
       endpoint: ['', Validators.required],
-      name: ['', Validators.required],
     });
   }
 
+  private createOdahuCluster(value): void{
+    this.dialogRef.close();
+    this.legionDeploymentService.createOdahuNewCluster(value).subscribe();
+  }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment-data.service.ts b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment-data.service.ts
index e379aa7..ddce4e7 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment-data.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment-data.service.ts
@@ -21,8 +21,7 @@ export class LegionDeploymentDataService {
   private getClastersList(): void {
    this.legionDeploymentService.getOduhuClustersList().subscribe(
       (response: any ) => {
-        console.log(response);
-        return this._legionClasters.next(response.clasters)
+        return this._legionClasters.next(response)
       });
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.html
index 0d5089f..3b98588 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.html
@@ -21,7 +21,7 @@
 <div class="base-retreat">
   <div class="sub-nav">
     <div>
-      <button mat-raised-button class="butt butt-create" (click)="createLegionClaster()">
+      <button mat-raised-button class="butt butt-create" (click)="createLegionCluster()">
         <i class="material-icons">add</i>Create new
       </button>
     </div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.ts
index 3f0cbbd..4b4adfe 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-deployment.component.ts
@@ -6,11 +6,11 @@ import {ToastrService} from "ngx-toastr";
 import {CreateLegionClusterComponent} from "./create-legion-claster/create-legion-cluster.component";
 import {HealthStatusService, LegionDeploymentService} from "../../core/services";
 
-export interface OdahuCluster {
-  project: string;
-  endpoint: string;
-  name: string;
-}
+// export interface OdahuCluster {
+//   name: string;
+//   project: string;
+//   endpoint: string;
+// }
 
 @Component({
   selector: 'dlab-legion-deployment',
@@ -38,18 +38,13 @@ export class LegionDeploymentComponent implements OnInit {
       }));
   }
 
-  public createLegionClaster(): void {
+  public createLegionCluster(): void {
     this.dialog.open(CreateLegionClusterComponent, { panelClass: 'modal-lg' })
-      .afterClosed().subscribe((result: OdahuCluster[]) => {
-      result && this.createLegionCluster(result);
-        this.refreshGrid()
+      .afterClosed().subscribe((result) => {
+      result && this.getEnvironmentHealthStatus();
       });
   }
 
-  private createLegionCluster(value): void{
-    this.legionDeploymentService.createOduhuNewCluster(value);
-  }
-
   private getEnvironmentHealthStatus(): void {
     this.healthStatusService.getEnvironmentHealthStatus()
       .subscribe((result: any) => this.healthStatus = result);
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html
index 6fe5e32..77f4d54 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html
@@ -29,7 +29,7 @@
   <ng-container matColumnDef="legion-status">
     <th mat-header-cell *matHeaderCellDef class="legion-status"> Legion cluster status </th>
     <td mat-cell *matCellDef="let element" class="legion-status">
-      <span *ngIf="element && element.name">Running</span>
+      <span *ngIf="element && element.name">{{ element.status | titlecase}}</span>
     </td>
     <td mat-footer-cell *matFooterCellDef></td>
   </ng-container>
@@ -89,7 +89,7 @@
 
   <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
   <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
-  <!--<tr [hidden]="legionClustersList.length" mat-footer-row *matFooterRowDef="['placeholder']"></tr>&ndash;&gt;-->
+  <!--<tr [hidden]="legionClustersList.length" mat-footer-row *matFooterRowDef="['placeholder']"></tr>-->
 </table>
 
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts
index 49cedb9..5901f76 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts
@@ -11,7 +11,7 @@ import { MatTableDataSource } from '@angular/material/table';
 export class LegionListComponent implements OnInit {
   private legionClustersList: any[];
   private subscriptions: Subscription = new Subscription();
-  public dataSource: MatTableDataSource<unknown>;
+  public dataSource: MatTableDataSource<any>;
   displayedColumns: string[] = ['name', 'endpoint-url', 'legion-name', 'legion-status', "actions"];
 
   constructor(
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
index f815c70..411849c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts
@@ -40,6 +40,7 @@ import { RolesGroupsService } from './services/rolesManagement.service';
 import { DataengineConfigurationService } from './services/dataengineConfiguration.service';
 import { StorageService } from './services/storage.service';
 import { ProjectService } from './services/project.service';
+import { LegionDeploymentService } from './services/legion-deployment.service';
 import { EndpointService } from './services/endpoint.service';
 import { UserAccessKeyService } from './services/userAccessKey.service';
 
@@ -82,6 +83,7 @@ export class CoreModule {
         StorageService,
         ProjectService,
         EndpointService,
+        LegionDeploymentService,
         UserAccessKeyService,
 
         { provide: MatDialogRef, useValue: {} },
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
index 894be97..413f525 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
@@ -529,7 +529,6 @@ export class ApplicationServiceFacade {
   }
 
   public buildCreateProject(data): Observable<any> {
-    console.log(data)
     return this.buildRequest(HTTPMethod.POST,
       this.requestRegistry.Item(ApplicationServiceFacade.PROJECT),
       data);
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/legion-deployment.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/legion-deployment.service.ts
index 0d43969..8ff928a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/legion-deployment.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/legion-deployment.service.ts
@@ -4,39 +4,12 @@ import { map, catchError } from 'rxjs/operators';
 import { ApplicationServiceFacade } from './applicationServiceFacade.service';
 import { ErrorUtils } from '../util';
 
-@Injectable({
-  providedIn: 'root'
-})
+@Injectable()
+
 export class LegionDeploymentService {
-  public list =  [{clasters: [
-      // {
-      //   project: "Project5",
-      //   endpoint: "Endpoint24",
-      //   name: "claster1",
-      // },
-      // {
-      //   project: "Project4",
-      //   endpoint: "Endpoint23",
-      //   name: "claster1",
-      // },
-      // {
-      //   project: "Project3",
-      //   endpoint: "Endpoint21",
-      //   name: "claster1",
-      // }
-      ]}];
   constructor(private applicationServiceFacade: ApplicationServiceFacade) { }
 
-  // public getLegionClasters(){
-  //   const obsList = from(this.list);
-  //   return obsList;
-  // }
-  //
-  // public addLegionCluster(cluster) {
-  //   this.list[0].clasters.push(cluster);
-  // }
-
-  public createOduhuNewCluster(data): Observable<{}> {
+  public createOdahuNewCluster(data): Observable<{}> {
     return this.applicationServiceFacade
       .createOdahuCluster(data)
       .pipe(


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