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 2019/12/19 13:33:40 UTC
[incubator-dlab] 01/02: [1402] Conveyed edge node on confirmation
dialog
This is an automated email from the ASF dual-hosted git repository.
dgnatyshyn pushed a commit to branch DLAB-1402
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 5a66a6d48fe89239b1dddd89b321547bc4292630
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Thu Dec 19 15:05:56 2019 +0200
[1402] Conveyed edge node on confirmation dialog
---
.../management/endpoints/endpoints.component.ts | 42 +++++++++++++++++-----
.../services/applicationServiceFacade.service.ts | 6 ++++
.../src/app/core/services/endpoint.service.ts | 8 +++++
.../notification-dialog.component.ts | 11 ++++--
4 files changed, 55 insertions(+), 12 deletions(-)
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 7a89f87..60d56d9 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
@@ -26,6 +26,7 @@ import {EndpointService, UserResourceService} from '../../../core/services';
import { NotificationDialogComponent } from '../../../shared/modal-dialog/notification-dialog';
import { PATTERNS } from '../../../core/util';
import {ExploratoryModel} from "../../../resources/resources-grid/resources-grid.model";
+import {map} from "rxjs/operators";
export interface Endpoint {
name: string;
@@ -43,7 +44,8 @@ export class EndpointsComponent implements OnInit {
endpoints: Endpoint[] = [];
displayedColumns: string[] = ['name', 'url', 'account', 'endpoint_tag', 'actions'];
private resources: any;
- private filtredResource: Array<any>;
+ private filtredResource: {projectName, resourceList, nodeStatus};
+
constructor(
@Inject(MAT_DIALOG_DATA) public data: any,
@@ -73,15 +75,24 @@ export class EndpointsComponent implements OnInit {
}, error => this.toastr.error(error.message || 'Endpoint connection failed!', 'Oops!'));
}
+
+
public deleteEndpoint(data) {
- if(this.resources.length){
- this.filtredResource = this.resources.filter(project => {
- project.filtredExploratory = project.exploratory.filter(resource => resource.endpoint === data.name && resource.status !== 'terminated');
- return project.filtredExploratory.length
- });
- }else{
- this.filtredResource = this.resources
- }
+ this.endpointService.getEndpointsResource(data.name)
+ .pipe(map(resource =>
+ resource.projects.map(project =>
+ this.createFilterList(
+ project.name,
+ resource.exploratories.filter(notebook => notebook.project === project.name),
+ project.endpoints.filter(endpoint => endpoint.name === data.name)[0].status))
+ .filter(project => project.nodeStatus !== "TERMINATED")))
+ .subscribe((resource: any) => {
+ // this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: data, list: resource }, panelClass: 'modal-sm' })
+ // .afterClosed().subscribe(result => {
+ // result === 'noTerminate' && this.deleteEndpointOption(data, false);
+ // result === 'terminate' && this.deleteEndpointOption(data, true);
+ // });
+ });
this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: data, list: this.filtredResource }, panelClass: 'modal-sm' })
.afterClosed().subscribe(result => {
@@ -90,6 +101,10 @@ export class EndpointsComponent implements OnInit {
});
}
+ createFilterList(name, resource, nodeStatus){
+ return {name, resource, nodeStatus}
+ }
+
private initFormModel(): void {
this.createEndpointForm = this._fb.group({
name: ['', Validators.compose([Validators.required, Validators.pattern(PATTERNS.namePattern)])],
@@ -110,10 +125,19 @@ export class EndpointsComponent implements OnInit {
this.endpointService.getEndpointsData().subscribe((endpoints: any) => this.endpoints = endpoints);
}
+ private getResourceList(endpoint) {
+ console.log(endpoint);
+ this.endpointService.getEndpointsResource(endpoint).subscribe((resource: any) => {
+ this.filtredResource = resource.exploratories;
+
+ });
+ }
+
private getResource(): void{
this.userResourceService.getUserProvisionedResources()
.subscribe((result: any) => {
this.resources = ExploratoryModel.loadEnvironments(result);
+ console.log(this.resources)
})
}
}
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 ca03c2a..7d78506 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
@@ -575,6 +575,12 @@ export class ApplicationServiceFacade {
null);
}
+ public getEndpointsResource(endpoint): Observable<any> {
+ return this.buildRequest(HTTPMethod.GET,
+ this.requestRegistry.Item(ApplicationServiceFacade.ENDPOINT) + `/${endpoint}/resources`,
+ null);
+ }
+
public buildCreateEndpoint(data): Observable<any> {
return this.buildRequest(HTTPMethod.POST,
this.requestRegistry.Item(ApplicationServiceFacade.ENDPOINT),
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 98801b4..aa94418 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
@@ -47,6 +47,14 @@ export class EndpointService {
catchError(ErrorUtils.handleServiceError));
}
+ public getEndpointsResource(endpoint): Observable<any> {
+ return this.applicationServiceFacade
+ .getEndpointsResource(endpoint)
+ .pipe(
+ map(response => response),
+ catchError(ErrorUtils.handleServiceError));
+ }
+
public deleteEndpoint(data): Observable<any> {
const url = `/${data}`;
return this.applicationServiceFacade
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
index a4762fc..ea8fb41 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
@@ -71,9 +71,10 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
<div class="scrolling-content resource-heigth">
<div class="resource-list-row sans node" *ngFor="let project of data.list">
<div class="resource-name ellipsis">
- <div *ngFor="let notebook of project.filtredExploratory">{{notebook.name}}</div>
+ <div>Edge node</div>
+ <div *ngFor="let notebook of project.resource">{{notebook.exploratory_name}}</div>
</div>
- <div class="project ellipsis">{{project.project}}</div>
+ <div class="project ellipsis">{{project.name}}</div>
</div>
</div>
</div>
@@ -142,11 +143,15 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
`]
})
export class NotificationDialogComponent{
- public willNotTerminate: boolean = !this.data.list.length;
+ public willNotTerminate: boolean = false;
constructor(
public dialogRef: MatDialogRef<NotificationDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
+ if(this.data.list){
+ this.willNotTerminate = !this.data.list.length;
+ }
+ console.log(this.data.list)
}
public terminateResource(): void{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org