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/02/03 14:13:50 UTC
[incubator-dlab] branch DLAB-1357 updated: Added Odahu to resources.
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 0156872 Added Odahu to resources.
0156872 is described below
commit 0156872a0354a7d7357bbea197c76be5c87f9e47
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Mon Feb 3 16:13:14 2020 +0200
Added Odahu to resources.
---
.../create-legion-cluster.component.html | 10 +++
.../create-legion-cluster.component.ts | 4 +-
.../legion-list/legion-list.component.ts | 1 -
.../management-grid/management-grid.component.html | 2 +-
.../detail-dialog/detail-dialog.component.html | 23 +-----
.../resources-grid/resources-grid.component.html | 32 ++++++--
.../resources-grid/resources-grid.component.ts | 38 ++++++---
.../resources-grid/resources-grid.model.ts | 90 ++++++++++++++--------
8 files changed, 131 insertions(+), 69 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 8703c21..ff04e55 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
@@ -55,6 +55,16 @@
</div>
</div>
+ <div class="control-group name-control">
+ <label class="label">Custom tag</label>
+ <div class="control">
+ <input type="text" class="form-control" placeholder="Enter custom tag" formControlName="custom_tag">
+ <span class="error"
+ *ngIf="!createLegionClusterForm.controls.custom_tag.valid && createLegionClusterForm.controls.custom_tag.dirty">
+ Custom tag can only contain letters, numbers, hyphens and '_' but can not end with special characters</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-->
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 435ec52..8cc9cf2 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
@@ -65,7 +65,7 @@ export class CreateLegionClusterComponent implements OnInit {
public getUserProjects(): void {
this.projectService.getUserProjectsList(true).subscribe((projects: any) => {
- console.log(projects)
+ console.log(projects);
this.projects = projects.filter(project => project.endpoints.length > project.odahu.length);
});
}
@@ -74,7 +74,6 @@ export class CreateLegionClusterComponent implements OnInit {
this.endpoints = project.endpoints
.filter(e => e.status === 'RUNNING' && !this.data.some(odahu => odahu.endpoint === e.name && odahu.project === project.name))
.map(e => e.name);
- console.log(this.endpoints);
}
private initFormModel(): void {
@@ -82,6 +81,7 @@ export class CreateLegionClusterComponent implements OnInit {
name: ['', [Validators.required, Validators.pattern(PATTERNS.namePattern), this.checkDuplication.bind(this)]],
project: ['', Validators.required],
endpoint: ['', [Validators.required]],
+ custom_tag: ['', [Validators.pattern(PATTERNS.namePattern)]]
});
}
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 ce7c1b3..343d44f 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
@@ -46,5 +46,4 @@ export class LegionListComponent implements OnInit {
}, error => this.toastr.error(error.message || `Odahu cluster ${action} failed!`, 'Oops!')
);
}
-
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
index 3e04b97..0b87d17 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
@@ -123,7 +123,7 @@
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef class=""></th>
<td mat-cell *matCellDef="let element" class=" settings">
- <span #settings class="actions" (click)="actions.toggle($event, settings)" *ngIf="element.type !== 'edge node'"
+ <span #settings class="actions" (click)="actions.toggle($event, settings)" *ngIf="element.type !== 'edge node' && element.type !== 'odahu'"
[ngClass]="{
'disabled' : isActiveResources(element),
'disabled' : element.status !== 'running' && element.status !== 'stopped' && element.status !== 'stopping' && element.status !== 'failed' }"></span>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html
index 778e5dc..d00cb57 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html
@@ -19,7 +19,7 @@
<div class="detail-dialog" id="dialog-box">
<header class="dialog-header " [ngClass]="{'header-white': data.notebook}">
- <h4 *ngIf="data.legion" class="modal-title" >Legion cluster</h4>
+ <h4 *ngIf="data.legion" class="modal-title" >Odahu cluster</h4>
<button type="button" class="close" (click)="dialogRef.close()">×</button>
</header>
<div class="dialog-content">
@@ -134,25 +134,10 @@
<div class="content-box">
<div class="detail-info" *ngIf="!legion.error_message">
<div class="links_block">
- <p>
- <span class="description">URL for feedback storage</span>
+ <p *ngFor="let url of legion.url">
+ <span class="description">{{url.description}}: </span>
<a class="ellipsis" matTooltip=" http://172.31.48.131:8080/" matTooltipPosition="above" href=" http://172.31.48.131:8080/"
- target="_blank">
- http://172.31.48.131:8080/
- </a>
- </p>
- <p>
- <span class="description">URL for Swagger API registry</span>
- <a class="ellipsis" matTooltip=" http://172.31.48.131:8080/" matTooltipPosition="above" href=" http://172.31.48.131:8080/"
- target="_blank">
- http://172.31.48.131:8080/
- </a>
- </p>
- <p>
- <span class="description">URL for Grafana</span>
- <a class="ellipsis" matTooltip=" http://172.31.48.131:8080/" matTooltipPosition="above" href=" http://172.31.48.131:8080/"
- target="_blank">
- http://172.31.48.131:8080/
+ target="_blank">{{ url.url}}
</a>
</p>
</div>
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 b8a97d5..66b4e88 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
@@ -104,8 +104,8 @@
<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 *ngIf="element.shape !== 'odahu cluster'" matTooltip="{{ element.name }}" matTooltipPosition="above" (click)="printDetailEnvironmentModal(element)">{{ element.name }}</span>
+ <span *ngIf="element.shape === 'odahu cluster'" matTooltip="{{ element.name }}" matTooltipPosition="above" (click)="printDetailLegionModal(element)">{{ element.name }}</span>
</td>
<td class="status-col status" ngClass="{{ element.status.toLowerCase() || ''}}">
{{element.status | underscoreless }}
@@ -121,7 +121,7 @@
matTooltipPosition="above">
{{ element.tags.custom_tag }}
</mat-chip>
- <mat-chip matTooltip="User tag: {{ element.tags.user_tag }}" matTooltipPosition="above">
+ <mat-chip *ngIf="element.tags.user_tag" matTooltip="User tag: {{ element.tags.user_tag }}" matTooltipPosition="above">
{{ element.tags.user_tag }}
</mat-chip>
<mat-chip matTooltip="Project tag: {{ element.tags.project_tag }}" matTooltipPosition="above">
@@ -131,16 +131,18 @@
</td>
<td class="resources-col">
- <computational-resources-list [resources]="element.resources" [environment]="element"
+ <computational-resources-list *ngIf="element.shape !== 'odahu cluster'" [resources]="element.resources" [environment]="element"
(buildGrid)="buildGrid($event)">
</computational-resources-list>
</td>
<td *ngIf="healthStatus?.billingEnabled" class="cost-col">
+ <ng-template>
<span class="total_cost">{{ element.cost || 'N/A' }} {{ element.currency_code || '' }}</span>
<span (click)="element.billing && printCostDetails(element)" class="currency_details"
[ngClass]="{ 'not-allowed' : !element.billing }">
<i class="material-icons">help_outline</i>
</span>
+ </ng-template>
</td>
<td class="settings">
@@ -151,7 +153,7 @@
</span>
<bubble-up #actions class="list-menu" position="bottom-left" alternative="top-left">
- <ul class="list-unstyled">
+ <ul class="list-unstyled" *ngIf="element.shape !== 'odahu cluster'">
<div class="active-items" *ngIf="element.status.toLowerCase() !== 'failed'
&& element.status !== 'terminating'
&& element.status !== 'terminated'
@@ -213,6 +215,26 @@
</a>
</li>
</ul>
+ <ul class="list-unstyled" *ngIf="element.shape === 'odahu cluster'">
+ <li class="project-seting-item" *ngIf="element.status === 'stopped'" (click)="odahuAction(element, 'start')">
+ <i class="material-icons">play_circle_outline</i>
+ <a class="action">
+ Start
+ </a>
+ </li>
+ <li class="project-seting-item" *ngIf="element.status === 'running'" (click)="odahuAction(element, 'stop')">
+ <i class="material-icons">pause_circle_outline</i>
+ <a class="action" >
+ Stop
+ </a>
+ </li>
+ <li class="project-seting-item" *ngIf="element.status !== 'terminated' && element.status !== 'terminating'" (click)="odahuAction(element, 'terminate')">
+ <i class="material-icons">phonelink_off</i>
+ <a class="action">
+ Terminate
+ </a>
+ </li>
+ </ul>
</bubble-up>
</td>
</tr>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 43f40bf..a56bfaf 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -23,7 +23,7 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
import { ToastrService } from 'ngx-toastr';
import { MatDialog } from '@angular/material/dialog';
-import { UserResourceService } from '../../core/services';
+import {LegionDeploymentService, UserResourceService} from '../../core/services';
import { ExploratoryModel, Exploratory } from './resources-grid.model';
import { FilterConfigurationModel } from './filter-configuration.model';
@@ -39,7 +39,8 @@ import { ConfirmationDialogComponent } from '../../shared/modal-dialog/confirmat
import { SchedulerComponent } from '../scheduler';
import { DICTIONARY } from '../../../dictionary/global.dictionary';
-import {ProgressBarService} from "../../core/services/progress-bar.service";
+import {ProgressBarService} from '../../core/services/progress-bar.service';
+import {OdahuActionDialogComponent} from '../../shared/modal-dialog/odahu-action-dialog';
@Component({
selector: 'resources-grid',
@@ -88,15 +89,15 @@ export class ResourcesGridComponent implements OnInit {
private userResourceService: UserResourceService,
private dialog: MatDialog,
private progressBarService: ProgressBarService,
+ private legionDeploymentService: LegionDeploymentService,
) { }
ngOnInit(): void {
-
this.buildGrid();
}
public buildGrid(): void {
- setTimeout(() => {this.progressBarService.startProgressBar()} , 0);
+ setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
this.userResourceService.getUserProvisionedResources()
.subscribe((result: any) => {
this.environments = ExploratoryModel.loadEnvironments(result);
@@ -134,9 +135,9 @@ export class ResourcesGridComponent implements OnInit {
}
public isResourcesInProgress(notebook) {
- let env = this.getResourceByName(notebook.name);
+ const env = this.getResourceByName(notebook.name);
- if (env && env.resources.length) {
+ if (env && env.resources && env.resources.length) {
return env.resources.filter(item => (item.status !== 'failed' && item.status !== 'terminated'
&& item.status !== 'running' && item.status !== 'stopped')).length > 0;
}
@@ -207,7 +208,9 @@ export class ResourcesGridComponent implements OnInit {
// PRIVATE
private getResourceByName(notebook_name: string) {
return this.getEnvironmentsListCopy()
- .map(env => env.exploratory.find(({ name }) => name === notebook_name))
+ .map(env => env.exploratory.find(({ name }) => {
+ return name === notebook_name;
+ }))
.filter(notebook_name => !!notebook_name)[0];
}
@@ -223,11 +226,11 @@ export class ResourcesGridComponent implements OnInit {
if (shapes.indexOf(item.shape) === -1) shapes.push(item.shape);
if (statuses.indexOf(item.status) === -1) statuses.push(item.status);
statuses.sort(SortUtils.statusSort);
-
+ if (item.resources) {
item.resources.map((resource: any) => {
if (resources.indexOf(resource.status) === -1) resources.push(resource.status);
resources.sort(SortUtils.statusSort);
- });
+ }); }
}));
this.filterConfiguration = new FilterConfigurationModel('', statuses, shapes, resources, '', '');
@@ -237,7 +240,10 @@ export class ResourcesGridComponent implements OnInit {
let filteredData = this.getEnvironmentsListCopy();
const containsStatus = (list, selectedItems) => {
- return list.filter((item: any) => { if (selectedItems.indexOf(item.status) !== -1) return item; });
+ if (list && list.length) {
+ return list.filter((item: any) => { if (selectedItems.indexOf(item.status) !== -1) return item; });
+ }
+ return list;
};
if (filteredData.length) this.filtering = true;
@@ -252,7 +258,6 @@ export class ResourcesGridComponent implements OnInit {
const isName = item.name.toLowerCase().indexOf(config.name.toLowerCase()) !== -1;
const isStatus = config.statuses.length > 0 ? (config.statuses.indexOf(item.status) !== -1) : (config.type !== 'active');
const isShape = config.shapes.length > 0 ? (config.shapes.indexOf(item.shape) !== -1) : true;
-
const modifiedResources = containsStatus(item.resources, config.resources);
let isResources = config.resources.length > 0 ? (modifiedResources.length > 0) : true;
@@ -315,4 +320,15 @@ export class ResourcesGridComponent implements OnInit {
.subscribe((result) => { },
(error) => console.log('UPDATE USER PREFERENCES ERROR ', error));
}
+
+ private odahuAction(element: any, action: string) {
+ this.dialog.open(OdahuActionDialogComponent, {data: {type: action, item: element}, panelClass: 'modal-sm'})
+ .afterClosed().subscribe(result => {
+ result && this.legionDeploymentService.odahuAction(element, action).subscribe(v =>
+ this.buildGrid(),
+ error => this.toastr.error(`Odahu cluster ${action} failed!`, 'Oops!')
+ ) ;
+ }, error => this.toastr.error(error.message || `Odahu cluster ${action} failed!`, 'Oops!')
+ );
+ }
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts
index d9e4089..aace020 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.model.ts
@@ -54,37 +54,67 @@ export class ExploratoryModel {
public static loadEnvironments(data: Array<any>) {
if (data) {
return data.map((value) => {
+ const exploratory = value.exploratory.map(el => new ExploratoryModel(el.exploratory_name,
+ el.template_name,
+ el.image,
+ el.status,
+ el.shape,
+ el.computational_resources,
+ el.up_time,
+ el.exploratory_url,
+ value.shared[el.endpoint].edge_node_ip,
+ el.private_ip,
+ el.exploratory_user,
+ el.exploratory_pass,
+ value.shared[el.endpoint][DICTIONARY.bucket_name],
+ value.shared[el.endpoint][DICTIONARY.shared_bucket_name],
+ el.error_message,
+ el[DICTIONARY.billing.cost],
+ el[DICTIONARY.billing.currencyCode],
+ el.billing,
+ el.libs,
+ value.shared[el.endpoint][DICTIONARY.user_storage_account_name],
+ value.shared[el.endpoint][DICTIONARY.shared_storage_account_name],
+ value.shared[el.endpoint][DICTIONARY.datalake_name],
+ value.shared[el.endpoint][DICTIONARY.datalake_user_directory_name],
+ value.shared[el.endpoint][DICTIONARY.datalake_shared_directory_name],
+ el.project,
+ el.endpoint,
+ el.tags
+ ));
+
+ const odahu = value.odahu.map(el => new ExploratoryModel(
+ el.name,
+ el.template_name,
+ el.image,
+ el.status.toLowerCase(),
+ 'odahu cluster',
+ [],
+ el.up_time,
+ el.urls,
+ value.shared[el.endpoint].edge_node_ip,
+ el.private_ip,
+ el.exploratory_user,
+ el.exploratory_pass,
+ '',
+ '',
+ el.error_message,
+ el[DICTIONARY.billing.cost],
+ el[DICTIONARY.billing.currencyCode],
+ [],
+ [],
+ '',
+ '',
+ '',
+ '',
+ '',
+ el.project,
+ el.endpoint,
+ el.tags));
return {
project: value.project,
- exploratory: value.exploratory.map(el => new ExploratoryModel(el.exploratory_name,
- el.template_name,
- el.image,
- el.status,
- el.shape,
- el.computational_resources,
- el.up_time,
- el.exploratory_url,
- value.shared[el.endpoint].edge_node_ip,
- el.private_ip,
- el.exploratory_user,
- el.exploratory_pass,
- value.shared[el.endpoint][DICTIONARY.bucket_name],
- value.shared[el.endpoint][DICTIONARY.shared_bucket_name],
- el.error_message,
- el[DICTIONARY.billing.cost],
- el[DICTIONARY.billing.currencyCode],
- el.billing,
- el.libs,
- value.shared[el.endpoint][DICTIONARY.user_storage_account_name],
- value.shared[el.endpoint][DICTIONARY.shared_storage_account_name],
- value.shared[el.endpoint][DICTIONARY.datalake_name],
- value.shared[el.endpoint][DICTIONARY.datalake_user_directory_name],
- value.shared[el.endpoint][DICTIONARY.datalake_shared_directory_name],
- el.project,
- el.endpoint,
- el.tags
- ))
- }
+ exploratory: [...exploratory, ...odahu]
+ };
});
}
}
@@ -92,5 +122,5 @@ export class ExploratoryModel {
export interface Exploratory {
project: string;
- exploratory: ExploratoryModel[]
+ exploratory: ExploratoryModel[];
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org