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
commit fbcc5f209020ed3e6b23674788666ddd43f40703 Author: Dmytro Gnatyshyn <di1...@ukr.net> AuthorDate: Mon Jan 27 17:01:34 2020 +0200 [DLAB-1451]: Added url to application facade --- .../create-legion-cluster.component.html | 26 +++++++------- .../create-legion-cluster.component.ts | 2 -- .../legion-deployment.component.ts | 8 ++++- .../legion-list/legion-list.component.html | 4 +-- .../services/applicationServiceFacade.service.ts | 41 ++++++++++++++++++++++ .../app/core/services/legion-deployment.service.ts | 25 +++++++++++-- .../resources-grid/resources-grid.component.html | 2 +- .../src/app/shared/navbar/navbar.component.html | 2 +- 8 files changed, 87 insertions(+), 23 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 92ee71a..fcba08d 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 @@ -1,6 +1,6 @@ <div class="create-legion-cluster" id="dialog-box"> <header class="dialog-header"> - <h4 class="modal-title">Create Legion cluster</h4> + <h4 class="modal-title">Create Odahu cluster</h4> <button type="button" class="close" (click)="dialogRef.close()">×</button> </header> <div class="dialog-content selection"> @@ -52,18 +52,18 @@ </div> </div> - <div class="control-group"> - <label class="label" [ngStyle]="!createLegionClusterForm.controls.useExistingClusterUrl.value && {'width': '100%' }"> - <input type="checkbox" formControlName="useExistingClusterUrl"/> Use existing k8s cluster - </label> - <div class="control" *ngIf="createLegionClusterForm.controls.useExistingClusterUrl.value"> - <input type="text" class="form-control" - formControlName="existingClusterUrl" placeholder="Enter Legion k8s cluster URL"/> - <span class="error url-error"> - <span *ngIf="!createLegionClusterForm.controls.existingClusterUrl.valid">Please enter valid cluster URL</span> - </span> - </div> - </div> +<!-- <div class="control-group">--> +<!-- <label class="label" [ngStyle]="!createLegionClusterForm.controls.useExistingClusterUrl.value && {'width': '100%' }">--> +<!-- <input type="checkbox" formControlName="useExistingClusterUrl"/> Use existing k8s cluster--> +<!-- </label>--> +<!-- <div class="control" *ngIf="createLegionClusterForm.controls.useExistingClusterUrl.value">--> +<!-- <input type="text" class="form-control"--> +<!-- formControlName="existingClusterUrl" placeholder="Enter ODAHU k8s cluster URL"/>--> +<!-- <span class="error url-error">--> +<!-- <span *ngIf="!createLegionClusterForm.controls.existingClusterUrl.valid">Please enter valid cluster URL</span>--> +<!-- </span>--> +<!-- </div>--> +<!-- </div>--> <div class="text-center m-top-30"> <button mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">Cancel</button> 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 b0bebff..8fd2d46 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 @@ -79,8 +79,6 @@ export class CreateLegionClusterComponent implements OnInit { project: ['', Validators.required], endpoint: ['', Validators.required], name: ['', Validators.required], - useExistingClusterUrl: [false], - existingClusterUrl: ['', Validators.pattern(PATTERNS.fullUrl)] }); } 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 c1b7a35..1767441 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,6 +6,12 @@ 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; +} + @Component({ selector: 'dlab-legion-deployment', templateUrl: './legion-deployment.component.html', @@ -34,7 +40,7 @@ export class LegionDeploymentComponent implements OnInit { public createLegionClaster(): void { this.dialog.open(CreateLegionClusterComponent, { panelClass: 'modal-lg' }) - .afterClosed().subscribe(result => { + .afterClosed().subscribe((result: OdahuCluster[]) => { result && this.createLegionCluster(result); this.refreshGrid() }); 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 2a24402..e0ac85c 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 @@ -19,7 +19,7 @@ </ng-container> <ng-container matColumnDef="legion-name"> - <th mat-header-cell *matHeaderCellDef class="legion-name"> Legion cluster Name </th> + <th mat-header-cell *matHeaderCellDef class="legion-name"> Odahu cluster Name </th> <td mat-cell *matCellDef="let element" class="legion-name"> <span *ngIf="element && element.name">{{element.name}}</span> </td> @@ -82,7 +82,7 @@ [colSpan]="displayedColumns.length" class="info"> <span *ngIf="!legionClustersList.length"> - No legion clusters </span> + No Odahu clusters </span> </td> <td mat-footer-cell *matFooterCellDef></td> </ng-container> 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 e37293b..573c05f 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 @@ -74,6 +74,7 @@ export class ApplicationServiceFacade { private static readonly DOWNLOAD_REPORT = 'download_report'; private static readonly SETTINGS = 'settings'; private static readonly PROJECT = 'project'; + private static readonly ODAHU = 'oduhu'; private static readonly ENDPOINT = 'endpoint'; private static readonly ENDPOINT_CONNECTION = 'endpoint_connection'; @@ -600,6 +601,43 @@ export class ApplicationServiceFacade { null); } + public createOdahuCluster(data): Observable<any> { + return this.buildRequest(HTTPMethod.POST, + this.requestRegistry.Item(ApplicationServiceFacade.ODAHU), + data); + } + + public getOdahuList(): Observable<any> { + return this.buildRequest(HTTPMethod.GET, + this.requestRegistry.Item(ApplicationServiceFacade.ODAHU), + null); + } + + // public buildGetUserProjectsList(params?): Observable<any> { + // return this.buildRequest(HTTPMethod.GET, + // this.requestRegistry.Item(ApplicationServiceFacade.PROJECT) + params, + // null); + // } + // + // public buildDeleteProject(param): Observable<any> { + // return this.buildRequest(HTTPMethod.DELETE, + // this.requestRegistry.Item(ApplicationServiceFacade.PROJECT) + param, + // null); + // } + // + // public buildToggleProjectStatus(param, data): Observable<any> { + // return this.buildRequest(HTTPMethod.POST, + // this.requestRegistry.Item(ApplicationServiceFacade.PROJECT) + param, + // data); + // } + // + // public buildUpdateProjectsBudget(param, data): Observable<any> { + // return this.buildRequest(HTTPMethod.PUT, + // this.requestRegistry.Item(ApplicationServiceFacade.PROJECT) + param, + // data, + // { observe: 'response' }); + // } + private setupRegistry(): void { this.requestRegistry = new Dictionary<string>(); @@ -677,6 +715,9 @@ export class ApplicationServiceFacade { this.requestRegistry.Add(ApplicationServiceFacade.PROJECT, '/api/project'); this.requestRegistry.Add(ApplicationServiceFacade.ENDPOINT, '/api/endpoint'); this.requestRegistry.Add(ApplicationServiceFacade.ENDPOINT_CONNECTION, '/api/endpoint/url/'); + + // odahu + this.requestRegistry.Add(ApplicationServiceFacade.ODAHU, '/api/oduhu'); } private buildRequest(method: HTTPMethod, url_path: string, body: any, opt?) { 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 8a45252..89cfe80 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 @@ -1,5 +1,8 @@ import { Injectable } from '@angular/core'; -import {from} from "rxjs"; +import {from, Observable} from "rxjs"; +import { map, catchError } from 'rxjs/operators'; +import { ApplicationServiceFacade } from './applicationServiceFacade.service'; +import { ErrorUtils } from '../util'; @Injectable({ providedIn: 'root' @@ -22,14 +25,30 @@ export class LegionDeploymentService { // name: "claster1", // } ]}]; - constructor() { } + constructor(private applicationServiceFacade: ApplicationServiceFacade) { } public getLegionClasters(){ const obsList = from(this.list); - return obsList + return obsList; } public addLegionCluster(cluster) { this.list[0].clasters.push(cluster); } + + public createOduhuCluster(data): Observable<{}> { + return this.applicationServiceFacade + .createOdahuCluster(data) + .pipe( + map(response => response), + catchError(ErrorUtils.handleServiceError)); + } + + public getOduhuClustersList(): Observable<{}> { + return this.applicationServiceFacade + .getOdahuList() + .pipe( + map(response => response), + catchError(ErrorUtils.handleServiceError)); + } } diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html index f5e2bdf..b8a97d5 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html @@ -105,7 +105,7 @@ <tr *ngFor="let element of element.exploratory; let i = index" class="element-row mat-row"> <td class="name-col"> <span matTooltip="{{ element.name }}" matTooltipPosition="above" (click)="printDetailEnvironmentModal(element)">{{ element.name }}</span> - <span (click)="printDetailLegionModal(element)" ><i class="material-icons legion-icon">cloud_circle</i></span> + <!--<span (click)="printDetailLegionModal(element)" ><i class="material-icons legion-icon">cloud_circle</i></span>--> </td> <td class="status-col status" ngClass="{{ element.status.toLowerCase() || ''}}"> {{element.status | underscoreless }} 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 bca5141..d344274 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 @@ -90,7 +90,7 @@ </a> <a class="sub-nav-item" [style.margin-left.px]="isExpanded ? '30' : '0'" [routerLink]="['/legion-deployment']" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}"> - <span *ngIf="isExpanded; else legion">Legion deployment</span> + <span *ngIf="isExpanded; else legion">Odahu deployment</span> <ng-template #legion><i class="material-icons">get_app</i></ng-template> </a> <a class="sub-nav-item" [style.margin-left.px]="isExpanded ? '30' : '0'" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org