You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/04/12 11:10:02 UTC
[incubator-dlab] 02/03: [DLAB-572]: added handler on edge creation
failing; app version added
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch DLAB-572
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 4e21daad433f65e8afb2665a421b6fc977aebc7f
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri Apr 12 14:08:47 2019 +0300
[DLAB-572]: added handler on edge creation failing; app version added
---
.../services/applicationServiceFacade.service.ts | 9 +++++
.../src/app/core/services/healthStatus.service.ts | 8 +++++
.../resources/webapp/src/app/management/index.ts | 6 ++--
.../manage-environment-dilog.component.ts | 4 +--
.../management-grid/management-grid.component.html | 38 +++++++++++-----------
.../management-grid/management-grid.component.scss | 3 ++
.../management-grid/management-grid.component.ts | 8 ++---
.../src/app/management/management.component.ts | 4 +--
.../webapp/src/app/management/management.model.ts | 3 +-
.../webapp/src/app/shared/navbar/index.ts | 5 +--
.../src/app/shared/navbar/navbar.component.html | 10 ++++++
.../src/app/shared/navbar/navbar.component.scss | 17 +++++++++-
.../src/app/shared/navbar/navbar.component.ts | 17 +++++++---
13 files changed, 93 insertions(+), 39 deletions(-)
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 b1fd570..79ae239 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
@@ -49,6 +49,7 @@ export class ApplicationServiceFacade {
private static readonly USER_PREFERENCES = 'user_preferences';
private static readonly BUDGET = 'budget';
private static readonly ENVIRONMENT_HEALTH_STATUS = 'environment_health_status';
+ private static readonly META_DATA = 'meta';
private static readonly ROLES = 'roles';
private static readonly GROUPS = 'groups';
private static readonly GROUP_ROLE = 'group_role';
@@ -514,6 +515,12 @@ export class ApplicationServiceFacade {
data);
}
+ public buildGetAppMetaData(): Observable<any> {
+ return this.buildRequest(RequestMethod.Get,
+ this.requestRegistry.Item(ApplicationServiceFacade.META_DATA),
+ null);
+ }
+
private setupRegistry(): void {
this.requestRegistry = new Dictionary<string>();
@@ -559,6 +566,8 @@ export class ApplicationServiceFacade {
// Environment Health Status
this.requestRegistry.Add(ApplicationServiceFacade.ENVIRONMENT_HEALTH_STATUS, '/api/infrastructure/status');
+ this.requestRegistry.Add(ApplicationServiceFacade.ENVIRONMENT_HEALTH_STATUS, '/api/infrastructure/status');
+ this.requestRegistry.Add(ApplicationServiceFacade.META_DATA, '/api/infrastructure/meta');
this.requestRegistry.Add(ApplicationServiceFacade.EDGE_NODE_START, '/api/infrastructure/edge/start');
this.requestRegistry.Add(ApplicationServiceFacade.EDGE_NODE_STOP, '/api/infrastructure/edge/stop');
this.requestRegistry.Add(ApplicationServiceFacade.EDGE_NODE_RECREATE, '/api/user/access_key/recover');
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
index f891dfc..545c481 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
@@ -176,6 +176,14 @@ export class HealthStatusService {
catchError(error => error));
}
+ public getAppMetaData(): Observable<{}> {
+ return this.applicationServiceFacade
+ .buildGetAppMetaData()
+ .pipe(
+ map(response => response),
+ catchError(error => error));
+ }
+
public resetStatusValue() {
this._statusData.next(<GeneralEnvironmentStatus>{});
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/index.ts b/services/self-service/src/main/resources/webapp/src/app/management/index.ts
index b46ea96..d49689c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/management/index.ts
@@ -33,7 +33,7 @@ import { MaterialModule } from '../shared/material.module';
import { ManagementComponent } from './management.component';
import {
ManagementGridComponent,
- ConfirmationDialog
+ ConfirmationDialogComponent
} from './management-grid/management-grid.component';
import { ComputationalResourcesModule } from '../resources/computational/computational-resources-list';
@@ -77,13 +77,13 @@ export * from './management.component';
GroupNameValidationDirective,
BackupDilogComponent,
ManageEnvironmentComponent,
- ConfirmationDialog,
+ ConfirmationDialogComponent,
ConfirmActionDialogComponent,
ConfirmDeleteUserAccountDialogComponent,
SsnMonitorComponent,
ManageRolesGroupsComponent
],
- entryComponents: [ConfirmationDialog, ConfirmActionDialogComponent, ConfirmDeleteUserAccountDialogComponent],
+ entryComponents: [ConfirmationDialogComponent, ConfirmActionDialogComponent, ConfirmDeleteUserAccountDialogComponent],
exports: [ManagementComponent]
})
export class ManagenementModule {}
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/manage-environment/manage-environment-dilog.component.ts b/services/self-service/src/main/resources/webapp/src/app/management/manage-environment/manage-environment-dilog.component.ts
index 4e7ec93..6a6d025 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/manage-environment/manage-environment-dilog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/management/manage-environment/manage-environment-dilog.component.ts
@@ -43,7 +43,7 @@ export class ManageEnvironmentComponent {
public dialog: MatDialog
) { }
- get usersEnvironments(): FormArray{
+ get usersEnvironments(): FormArray {
return <FormArray>this.manageUsersForm.get('users');
}
@@ -108,7 +108,7 @@ export class ManageEnvironmentComponent {
<button type="button" class="close" (click)="dialogRef.close()">×</button>
</div>
<div mat-dialog-content class="content">
- <p>Environment of <b>{{ data.user }}</b> will be
+ <p>Environment of <b>{{ data.user }}</b> will be
<span *ngIf="data.action === 'terminate'"> terminated.</span>
<span *ngIf="data.action === 'stop'">stopped.</span>
</p>
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.html
index c129575..42bae6b 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.html
@@ -23,7 +23,7 @@
<th class="th_name">Name</th>
<th class="th_status">Status</th>
<th class="th_shape">Shape</th>
- <th>Computational resources</th>
+ <th class="th_resources">Computational resources</th>
<th class="th_actions">Action</th>
</tr>
@@ -44,7 +44,7 @@
{{ resource.computational_name }}
</a>
</div>
- <span ngClass="{{resource.status.toLowerCase() || ''}}" class="resource-status">{{ resource.status }}</span>
+ <span ngClass="{{resource.status || ''}}" class="resource-status">{{ resource.status }}</span>
<div class="resource-actions">
<a class="start-stop-action" *ngIf="resource.image === 'docker.dlab-dataengine'">
<i class="material-icons" (click)="toggleResourceAction(env, 'stop', resource)"
@@ -62,18 +62,18 @@
</td>
<td class="settings">
<span #settings class="actions" (click)="actions.toggle($event, settings)"
- [ngClass]="{ 'disabled' : !uploadKey
- || (env.status !== 'running' && env.status !== 'stopped' && env.status !== 'stopping')
- || (env.name === 'edge node' && env.user === currentUser && env.status === 'stopping')
- || env.name === 'edge node' && env.user !== currentUser && env.status.toLowerCase() !== 'running' }"></span>
+ [ngClass]="{ 'disabled' : (!uploadKey && env.type === 'notebook')
+ || (env.status !== 'running' && env.status !== 'stopped' && env.status !== 'stopping' && env.status !== 'failed' )
+ || (env.type === 'edge node' && env.user === currentUser && env.status === 'stopping')
+ || env.type === 'edge node' && env.user !== currentUser && env.status !== 'running' }"></span>
<bubble-up #actions class="list-menu" position="bottom-left" alternative="top-left">
<ul class="list-unstyled">
- <li matTooltip="{{ env.name !== 'edge node' ? 'Unable to stop notebook because at least one computational resource is in progress' : 'Unable to stop edge node because at least one resource of this user is in progress' }}"
+ <li matTooltip="{{ env.type !== 'edge node' ? 'Unable to stop notebook because at least one computational resource is in progress' : 'Unable to stop edge node because at least one resource of this user is in progress' }}"
matTooltipPosition="above"
[matTooltipDisabled]="!isResourcesInProgress(env)"
- [hidden]="env.name === 'edge node' && env.status.toLowerCase() === 'stopped'">
+ [hidden]="env.name === 'edge node' && env.status === 'stopped'">
<div (click)="toggleResourceAction(env, 'stop')"
- [ngClass]="{'not-allowed' : env.status === 'stopped' || env.status === 'stopping' || env.status === 'starting' || env.status === 'creating image' || isResourcesInProgress(env)}">
+ [ngClass]="{'not-allowed' : env.status === 'stopped' || env.status === 'stopping' || env.status === 'starting' || env.status === 'creating image' || env.status === 'failed' || isResourcesInProgress(env)}">
<i class="material-icons">pause_circle_outline</i>
<span>Stop</span>
</div>
@@ -83,18 +83,18 @@
matTooltipPosition="above"
[matTooltipDisabled]="!isResourcesInProgress(env)">
<div (click)="toggleResourceAction(env, 'terminate')"
- [ngClass]="{'not-allowed' : env.status.toLowerCase() !== 'running' && env.status.toLowerCase() !== 'stopped' || isResourcesInProgress(env)}">
+ [ngClass]="{'not-allowed' : env.status !== 'running' && env.status !== 'stopped' || isResourcesInProgress(env)}">
<i class="material-icons">phonelink_off</i>
<span>Terminate</span>
</div>
</li>
<div *ngIf="env.name === 'edge node' && env.user === currentUser">
- <li (click)="toggleResourceAction(env, 'run')" *ngIf="env.status.toLowerCase() === 'stopped'">
+ <li (click)="toggleResourceAction(env, 'run')" *ngIf="env.status === 'stopped'">
<i class="material-icons">play_circle_outline</i>
<span>Start</span>
</li>
- <li (click)="toggleResourceAction(env, 'recreate')" *ngIf="env.status.toLowerCase() === 'terminated'">
+ <li (click)="toggleResourceAction(env, 'recreate')" *ngIf="env.status === 'terminated'">
<i class="material-icons">refresh</i>
<span>Recreate</span>
</li>
@@ -123,24 +123,24 @@
<td class="status" ngClass="{{env.status || ''}}">{{env.status}}</td>
<td class="settings">
<span #settings (click)="actions.toggle($event, settings)" class="actions"
- [ngClass]="{'disabled': env.status.toLowerCase() !== 'running'
- && env.status.toLowerCase() !== 'stopped'
- && env.status.toLowerCase() !== 'terminated'
+ [ngClass]="{'disabled': env.status !== 'running'
+ && env.status !== 'stopped'
+ && env.status !== 'terminated'
|| notebookInProgress
- || !uploadKey }">
+ || !uploadKey && env.status !== 'failed' }">
</span>
<bubble-up #actions class="list-menu" position="bottom-left" alternative="top-left">
<ul class="list-unstyled">
- <li (click)="toggleResourceAction(env, 'stop')" *ngIf="env.status.toLowerCase() === 'running'">
+ <li (click)="toggleResourceAction(env, 'stop')" *ngIf="env.status === 'running'">
<i class="material-icons">pause_circle_outline</i>
<span>Stop</span>
</li>
- <li (click)="toggleResourceAction(env, 'run')" *ngIf="env.status.toLowerCase() === 'stopped'">
+ <li (click)="toggleResourceAction(env, 'run')" *ngIf="env.status === 'stopped'">
<i class="material-icons">play_circle_outline</i>
<span>Start</span>
</li>
- <li (click)="toggleResourceAction(env, 'recreate')" *ngIf="env.status.toLowerCase() === 'terminated'">
+ <li (click)="toggleResourceAction(env, 'recreate')" *ngIf="env.status === 'terminated'">
<i class="material-icons">refresh</i>
<span>Recreate</span>
</li>
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.scss
index 14d324d..6198578 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.scss
@@ -26,6 +26,9 @@
.th_status {
width: 12% !important;
}
+ .th_resources {
+ width: 33%;
+ }
.dashboard_table_body {
td:first-child {
cursor: default;
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.ts
index bf7e257..7e69329 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/management/management-grid/management-grid.component.ts
@@ -70,7 +70,7 @@ export class ManagementGridComponent implements OnInit {
toggleResourceAction(environment, action: string, resource?) {
if (resource) {
const resource_name = resource ? resource.computational_name : environment.name;
- const dialogRef: MatDialogRef<ConfirmationDialog> = this.dialog.open(ConfirmationDialog, {
+ const dialogRef: MatDialogRef<ConfirmationDialogComponent> = this.dialog.open(ConfirmationDialogComponent, {
data: { action, resource_name, user: environment.user },
width: '550px',
panelClass: 'error-modalbox'
@@ -149,7 +149,7 @@ export class ManagementGridComponent implements OnInit {
<button type="button" class="close" (click)="dialogRef.close()">×</button>
</div>
<div mat-dialog-content class="content">
- <p>Resource <strong> {{ data.resource_name }}</strong> of user <strong> {{ data.user }} </strong> will be
+ <p>Resource <strong> {{ data.resource_name }}</strong> of user <strong> {{ data.user }} </strong> will be
<span *ngIf="data.action === 'terminate'"> decommissioned.</span>
<span *ngIf="data.action === 'stop'">stopped.</span>
</p>
@@ -163,9 +163,9 @@ export class ManagementGridComponent implements OnInit {
styles: [
]
})
-export class ConfirmationDialog {
+export class ConfirmationDialogComponent {
constructor(
- public dialogRef: MatDialogRef<ConfirmationDialog>,
+ public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/management.component.ts b/services/self-service/src/main/resources/webapp/src/app/management/management.component.ts
index b18eb83..8d21583 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/management.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/management/management.component.ts
@@ -44,7 +44,6 @@ export class ManagementComponent implements OnInit, OnDestroy {
public healthStatus: GeneralEnvironmentStatus;
public allEnvironmentData: Array<EnvironmentModel>;
public uploadKey: boolean = true;
-
public anyEnvInProgress: boolean = false;
public notebookInProgress: boolean = false;
@@ -253,7 +252,8 @@ export class ManagementComponent implements OnInit, OnDestroy {
value.status,
value.shape,
value.computational_resources,
- value.user
+ value.user,
+ value.resource_type
));
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/management/management.model.ts b/services/self-service/src/main/resources/webapp/src/app/management/management.model.ts
index 25b196f..79d55c8 100644
--- a/services/self-service/src/main/resources/webapp/src/app/management/management.model.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/management/management.model.ts
@@ -23,7 +23,8 @@ export class EnvironmentModel {
public status: string,
public shape: string,
public resources: Array<any>,
- public user: string
+ public user: string,
+ public type?: string
) { }
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts
index 3fb6b2f..121e255 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts
@@ -21,7 +21,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { MaterialModule } from '../material.module';
-import { ModalModule, UploadKeyDialogModule, ProgressDialogModule } from '../index';
+import { ModalModule, UploadKeyDialogModule, ProgressDialogModule, BubbleModule } from '../index';
import { NavbarComponent } from './navbar.component';
import { NotificationDialogModule } from '../modal-dialog/notification-dialog';
@@ -36,7 +36,8 @@ export * from './navbar.component';
NotificationDialogModule,
ModalModule,
UploadKeyDialogModule,
- ProgressDialogModule
+ ProgressDialogModule,
+ BubbleModule
],
declarations: [NavbarComponent],
exports: [NavbarComponent, RouterModule]
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 597cb0d..938473c 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
@@ -42,6 +42,16 @@
<a *ngIf="healthStatus.status" [routerLink]="['/environment_management']" class="statusbar">
<span class="material-icons" ngClass="{{healthStatus.status || ''}}">radio_button_checked</span>
</a>
+ <!-- *ngIf="metadata" -->
+ <a class="statusbar" #info (click)="actions.toggle($event, info)">
+ <span class="material-icons info">share</span>
+ </a>
+ <bubble-up #actions class="list-menu" position="bottom-right">
+ <div class="app-info">
+ <p><strong>Version:</strong> {{ metadata?.version | - }}</p>
+ <p><strong>Branch</strong> {{ metadata?.branch | - }}</p>
+ </div>
+ </bubble-up>
<button class="btn btn-logout" (click)="logout_btnClick()">Log out <span class="user-name">{{currentUserName}}</span></button>
</div>
</div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.scss b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.scss
index dcb454e..b6bc96f 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.scss
@@ -50,6 +50,7 @@
text-decoration: none;
justify-content: center;
color: #f9fafb;
+ cursor: pointer;
span {
align-self: center;
font-size: 18px;
@@ -68,6 +69,11 @@
color: #bd4146;
}
}
+ .info {
+ &:hover {
+ color: #c7d4d6;
+ }
+ }
}
.btn-logout {
height: 46px;
@@ -86,7 +92,16 @@
}
}
}
-
+.app-info {
+ padding: 15px;
+ p {
+ strong {
+ color: #455c74;
+ font-size: 16px;
+ font-weight: 600;
+ }
+ }
+}
a.nav-item {
position: relative;
height: 56px;
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
index a7a9618..d924fb1 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
@@ -51,6 +51,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
currentUserName: string;
quotesLimit: number = 70;
isLoggedIn: boolean = false;
+ metadata: any;
healthStatus: GeneralEnvironmentStatus;
subscriptions: Subscription = new Subscription();
@@ -87,6 +88,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
}));
this.subscriptions.add(timer(0, this.CHECK_ACTIVE_SCHEDULE_TIMEOUT).subscribe(() => this.refreshSchedulerData()));
this.currentUserName = this.getUserName();
+ this.checkVersionData();
}
});
}
@@ -151,7 +153,8 @@ export class NavbarComponent implements OnInit, OnDestroy {
}
private processAccessKeyStatus(status: number): void {
- if (status === HTTP_STATUS_CODES.NOT_FOUND) {
+ if (status === HTTP_STATUS_CODES.NOT_FOUND || status === HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR) {
+ this.preloaderDialog.bindDialog.isOpened && this.preloaderDialog.close();
this.keyUploadDialog.open({ isFooter: false });
this.alive = false;
} else if (status === HTTP_STATUS_CODES.ACCEPTED) {
@@ -193,23 +196,27 @@ export class NavbarComponent implements OnInit, OnDestroy {
return memo;
}
+ public checkVersionData(): void {
+ this.healthStatusService.getAppMetaData().subscribe(res => this.metadata = res);
+ }
+
private selectQuotesAlert(type: string, user_quota?: number, total_quota?: number): string {
const alerts = {
user_exceed: `Dear <b>${ this.currentUserName }</b>,<br />
DLab cloud infrastructure usage quota associated with your user has been exceeded.
- All your analytical environment will be stopped. To proceed working with environment,
+ All your analytical environment will be stopped. To proceed working with environment,
request increase of user quota from DLab administrator.`,
total_exceed: `Dear <b>${ this.currentUserName }</b>,<br />
DLab cloud infrastructure usage quota has been exceeded.
- All your analytical environment will be stopped. To proceed working with environment,
+ All your analytical environment will be stopped. To proceed working with environment,
request increase application quota from DLab administrator.`,
user_quota: `Dear <b>${ this.currentUserName }</b>,<br />
Cloud infrastructure usage quota associated with your user has been used for <b>${user_quota}%</b>.
- Once quota is depleted all your analytical environment will be stopped.
+ Once quota is depleted all your analytical environment will be stopped.
To proceed working with environment you'll have to request increase of user quota from DLab administrator.`,
total_quota: `Dear <b>${ this.currentUserName }</b>,<br />
DLab cloud infrastructure usage quota has been used for <b>${total_quota}%</b>.
- Once quota is depleted all your analytical environment will be stopped.
+ Once quota is depleted all your analytical environment will be stopped.
To proceed working with environment you'll have to request increase of user quota from DLab administrator. `
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org