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/02 15:37:20 UTC
[incubator-dlab] branch develop updated: [DLAB-1118]: Added 'Test'
button to endpoints (#515)
This is an automated email from the ASF dual-hosted git repository.
dgnatyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push:
new 84862e8 [DLAB-1118]: Added 'Test' button to endpoints (#515)
84862e8 is described below
commit 84862e8a313264c187c1bc207d1d23ee963d9fbb
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Thu Jan 2 17:37:12 2020 +0200
[DLAB-1118]: Added 'Test' button to endpoints (#515)
---
.../management/endpoints/endpoints.component.html | 9 ++-
.../management/endpoints/endpoints.component.scss | 4 +-
.../management/endpoints/endpoints.component.ts | 64 ++++++++++++++++++++++
.../src/app/administration/management/index.ts | 9 ++-
.../administration/project/project.component.ts | 8 ++-
.../services/applicationServiceFacade.service.ts | 8 +++
.../src/app/core/services/endpoint.service.ts | 12 +++-
.../edge-action-dialog.component.ts | 4 +-
.../src/main/resources/webapp/src/styles.scss | 4 ++
9 files changed, 107 insertions(+), 15 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.html
index 5c64c16..73173cd 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.html
@@ -76,9 +76,12 @@
</div>
</form>
<div class="action-group m-bott-10">
- <button mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">Cancel</button>
- <button mat-raised-button type="button" [disabled]="!createEndpointForm.valid"
- (click)="assignChanges(createEndpointForm.value)" class="butt butt-success action">Connect</button>
+ <button mat-raised-button type="button" [disabled]="!this.createEndpointForm.value.url || !createEndpointForm.valid" class="butt action" (click)="getEndpoinConnectionStatus()">Test Endpoint</button>
+ <div class="action-butt">
+ <button mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">Cancel</button>
+ <button mat-raised-button type="button" [disabled]="!createEndpointForm.valid"
+ (click)="assignChanges(createEndpointForm.value)" class="butt butt-success action">Connect</button>
+ </div>
</div>
</div>
</mat-tab>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.scss
index 8987602..aaaa19e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.scss
@@ -43,7 +43,9 @@
}
.action-group {
- text-align: center;
+ display: flex;
+ justify-content: space-between;
+ padding: 0 10px;
}
.endpoints {
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
index 97aa6af..2cf0088 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts
@@ -86,6 +86,12 @@ export class EndpointsComponent implements OnInit {
});
}
+ private getEndpoinConnectionStatus(){
+ const url = this.createEndpointForm.value.url;
+ let getStatus = this.endpointService.getEndpoinConnectionStatus(encodeURIComponent(url));
+ this.dialog.open(EndpointTestResultDialogComponent, { data: {url: this.createEndpointForm.value.url, getStatus}, panelClass: 'modal-sm' });
+ }
+
private static createResourceList(name: string, resource: Array<any>, nodeStatus: string): Object {
return {name, resource, nodeStatus}
}
@@ -110,3 +116,61 @@ export class EndpointsComponent implements OnInit {
this.endpointService.getEndpointsData().subscribe((endpoints: any) => this.endpoints = endpoints);
}
}
+
+@Component({
+ selector: 'endpoint-test-result-dialog',
+ template: `
+ <div id="dialog-box">
+ <div class="dialog-header">
+ <h4 class="modal-title">Endpoint test</h4>
+ <button type="button" class="close" (click)="dialogRef.close()">×</button>
+ </div>
+ <div class="progress-bar" >
+ <mat-progress-bar *ngIf="!response" mode="indeterminate"></mat-progress-bar>
+ </div>
+ <div class="content-box">
+ <div mat-dialog-content class="content message">
+ <p class="dialog-message ellipsis" *ngIf="!response">Connecting to url <span class="strong" matTooltip="{{data.url}}" [matTooltipPosition]="'before'">{{data.url}}</span></p>
+ <p class="dialog-message ellipsis" *ngIf="isConnected && response"><i class="material-icons icons-possition active">check_circle</i>Connected to url <span matTooltip="{{data.url}}" [matTooltipPosition]="'before'" class="strong">{{data.url}}</span></p>
+ <p class="dialog-message ellipsis" *ngIf="!isConnected && response"><i class="material-icons icons-possition failed">cancel</i>Failed to connect to url <span matTooltip="{{data.url}}" [matTooltipPosition]="'before'" class="strong">{{data.url}}</span></p>
+ </div>
+ <div class="text-center m-top-20 m-bott-10">
+ <button type="button" class="butt" mat-raised-button (click)="dialogRef.close()">Close</button>
+ </div>
+ </div>
+ </div>
+ `,
+ styles: [
+ `#dialog-box {overflow: hidden}
+ .icons-possition {line-height: 25px; vertical-align: middle; padding-right: 7px }
+ .content { color: #718ba6; padding: 15px 50px; font-size: 14px; font-weight: 400; margin: 0; }
+ .info .confirm-dialog { color: #607D8B; }
+ header { display: flex; justify-content: space-between; color: #607D8B; }
+ header h4 i { vertical-align: bottom; }
+ header a i { font-size: 20px; }
+ header a:hover i { color: #35afd5; cursor: pointer; }
+ label { font-size: 15px; font-weight: 500; font-family: "Open Sans",sans-serif; cursor: pointer; display: flex; align-items: center;}
+ .progress-bar{ height: 4px;}
+ .dialog-message{min-height: 25px; overflow: hidden}
+ `
+ ]
+})
+export class EndpointTestResultDialogComponent {
+ public isConnected = false;
+ public response = false;
+ constructor(
+ public dialogRef: MatDialogRef<EndpointTestResultDialogComponent>,
+ @Inject(MAT_DIALOG_DATA) public data: any
+ ) {
+ this.data.getStatus.subscribe(() => {
+ this.isConnected = true;
+ this.response = true;
+ return;
+ },
+ ()=> {
+ this.isConnected = false;
+ this.response = true;
+ return;
+ })
+ }
+}
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
index bb6e960..28c47a6 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts
@@ -36,7 +36,7 @@ import { ManageEnvironmentComponent, ConfirmActionDialogComponent } from './mana
import { DirectivesModule } from '../../core/directives';
import { SsnMonitorComponent } from './ssn-monitor/ssn-monitor.component';
-import { EndpointsComponent } from './endpoints/endpoints.component';
+import {EndpointsComponent, EndpointTestResultDialogComponent} from './endpoints/endpoints.component';
import { ProjectModule } from '../project';
export * from './management.component';
@@ -62,7 +62,8 @@ export * from './management.component';
ReconfirmationDialogComponent,
ConfirmActionDialogComponent,
SsnMonitorComponent,
- EndpointsComponent
+ EndpointsComponent,
+ EndpointTestResultDialogComponent
],
entryComponents: [
ReconfirmationDialogComponent,
@@ -70,7 +71,9 @@ export * from './management.component';
BackupDilogComponent,
SsnMonitorComponent,
EndpointsComponent,
- ManageEnvironmentComponent],
+ ManageEnvironmentComponent,
+ EndpointTestResultDialogComponent
+ ],
providers: [EnvironmentsDataService],
exports: [ManagementComponent]
})
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
index 72b6430..06a4f2a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
@@ -121,7 +121,7 @@ export class ProjectComponent implements OnInit, OnDestroy {
private toggleStatusRequest(data, action) {
this.projectService.toggleProjectStatus(data, action).subscribe(() => {
this.refreshGrid();
- this.toastr.success(`Endpoint ${this.toEndpointAction(action)} is in progress!`, 'Processing!');
+ this.toastr.success(`Edge node ${this.toEndpointAction(action)} is in progress!`, 'Processing!');
}, error => this.toastr.error(error.message, 'Oops!'));
}
@@ -132,9 +132,11 @@ export class ProjectComponent implements OnInit, OnDestroy {
private toEndpointAction(action) {
if (action === 'start') {
- return 'connect';
+ return 'starting';
} else if (action === 'stop') {
- return 'disconnect';
+ return 'stopping';
+ } else if (action === 'terminate') {
+ return 'terminating';
} else {
return action;
}
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 7d78506..e37293b 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
@@ -75,6 +75,7 @@ export class ApplicationServiceFacade {
private static readonly SETTINGS = 'settings';
private static readonly PROJECT = 'project';
private static readonly ENDPOINT = 'endpoint';
+ private static readonly ENDPOINT_CONNECTION = 'endpoint_connection';
private requestRegistry: Dictionary<string>;
@@ -593,6 +594,12 @@ export class ApplicationServiceFacade {
null);
}
+ public getEndpointConnectionStatus(endpointUrl): Observable<any> {
+ return this.buildRequest(HTTPMethod.GET,
+ this.requestRegistry.Item(ApplicationServiceFacade.ENDPOINT_CONNECTION) + endpointUrl,
+ null);
+ }
+
private setupRegistry(): void {
this.requestRegistry = new Dictionary<string>();
@@ -669,6 +676,7 @@ export class ApplicationServiceFacade {
// project
this.requestRegistry.Add(ApplicationServiceFacade.PROJECT, '/api/project');
this.requestRegistry.Add(ApplicationServiceFacade.ENDPOINT, '/api/endpoint');
+ this.requestRegistry.Add(ApplicationServiceFacade.ENDPOINT_CONNECTION, '/api/endpoint/url/');
}
private buildRequest(method: HTTPMethod, url_path: string, body: any, opt?) {
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts
index 67efbe2..ae522c5 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts
@@ -35,9 +35,7 @@ export class EndpointService {
return this.applicationServiceFacade
.buildGetEndpointsData()
.pipe(
- map(response => {
- return response
- }),
+ map(response => response),
catchError(ErrorUtils.handleServiceError));
}
@@ -65,5 +63,13 @@ export class EndpointService {
map(response => response),
catchError(ErrorUtils.handleServiceError));
}
+
+ public getEndpoinConnectionStatus(endpointUrl): Observable<{}> {
+ return this.applicationServiceFacade
+ .getEndpointConnectionStatus(endpointUrl)
+ .pipe(
+ map(response => response),
+ catchError(ErrorUtils.handleServiceError));
+ }
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts
index 913d6bb..9f75c8f 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts
@@ -7,7 +7,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
template: `
<div id="dialog-box">
<header class="dialog-header">
- <h4 class="modal-title"><span class="action">{{data.type | titlecase}}</span> endpoints</h4>
+ <h4 class="modal-title"><span class="action">{{data.type | titlecase}}</span> edge node</h4>
<button type="button" class="close" (click)="dialogRef.close()">×</button>
</header>
<div mat-dialog-content class="content message mat-dialog-content">
@@ -23,7 +23,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
<p class="m-top-20 action-text"><span class="strong">Do you want to proceed?</span></p>
- <div class="text-center m-top-30 m-bott-10">
+ <div class="text-center m-top-30 m-bott-30">
<button type="button" class="butt" mat-raised-button (click)="dialogRef.close()">No</button>
<button type="button" class="butt butt-success" mat-raised-button (click)="dialogRef.close(endpointsNewStatus)" [disabled]="!endpointsNewStatus.length">Yes</button>
</div>
diff --git a/services/self-service/src/main/resources/webapp/src/styles.scss b/services/self-service/src/main/resources/webapp/src/styles.scss
index 2651949..e1bbe94 100644
--- a/services/self-service/src/main/resources/webapp/src/styles.scss
+++ b/services/self-service/src/main/resources/webapp/src/styles.scss
@@ -315,6 +315,10 @@ input[type='number'] {
margin-bottom: 10px;
}
+.m-bott-30 {
+ margin-bottom: 10px;
+}
+
.m-top-10p {
margin-top: 10%;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org