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/07/10 15:53:15 UTC
[incubator-dlab] 12/19: [DLAB-834]: added proper data keys
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit bde4c9600ae05a43d6b6a16e52969c3030f8ee0d
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Tue Jul 9 13:25:31 2019 +0300
[DLAB-834]: added proper data keys
---
.../management-grid/management-grid.component.scss | 8 ++++-
.../management-grid/management-grid.component.ts | 19 ++++++----
.../management/management.component.html | 9 +++--
.../management/management.component.ts | 42 +++++++++-------------
4 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss
index e2f7646..c52342f 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss
@@ -18,30 +18,36 @@
*/
.dashboard_table {
+
.th_user,
.th_name {
width: 20%;
}
+
.th_shape,
.th_status {
width: 12% !important;
}
+
.th_resources {
width: 33%;
}
+
.dashboard_table_body {
td:first-child {
cursor: default;
}
}
}
+
.source .resource-wrap .resource-name .detailed-link {
cursor: default !important;
}
table {
width: 100%;
+
.actions {
text-align: right;
}
-}
\ No newline at end of file
+}
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index c6014db..3e965dc 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -24,6 +24,7 @@ import { ToastrService } from 'ngx-toastr';
import { HealthStatusService } from '../../../core/services';
import { ConfirmationDialogType } from '../../../shared';
import { ConfirmationDialogComponent } from '../../../shared/modal-dialog/confirmation-dialog';
+import { EnvironmentsDataService } from '../management-data.service';
export interface ManageAction {
action: string;
@@ -41,7 +42,11 @@ export interface ManageAction {
]
})
export class ManagementGridComponent implements OnInit {
- @Input() allEnvironmentData: Array<any>;
+ // @Input() allEnvironmentData: Array<any>;
+
+ allEnvironmentData: Array<any>;
+ loading: boolean = false;
+
@Input() environmentsHealthStatuses: Array<any>;
@Input() resources: Array<any>;
@Input() isAdmin: boolean;
@@ -49,15 +54,17 @@ export class ManagementGridComponent implements OnInit {
@Output() refreshGrid: EventEmitter<{}> = new EventEmitter();
@Output() actionToggle: EventEmitter<ManageAction> = new EventEmitter();
- displayedColumns: string[] = ['user', 'type', 'shape', 'status', 'resources', 'actions'];
+ displayedColumns: string[] = ['user', 'type', 'project', 'shape', 'status', 'resources', 'actions'];
constructor(
private healthStatusService: HealthStatusService,
+ private environmentsDataService: EnvironmentsDataService,
public toastr: ToastrService,
public dialog: MatDialog
) { }
ngOnInit() {
+ this.environmentsDataService._data.subscribe(data => this.allEnvironmentData = data);
}
buildGrid(): void {
@@ -74,7 +81,7 @@ export class ManagementGridComponent implements OnInit {
result && this.actionToggle.emit({ action, environment, resource });
});
} else {
- const type = (environment.name === 'edge node' || environment.type.toLowerCase() === 'edge node')
+ const type = (environment.resource_type.toLowerCase() === 'edge node')
? ConfirmationDialogType.StopEdgeNode : ConfirmationDialogType.StopExploratory;
if (action === 'stop') {
@@ -104,9 +111,9 @@ export class ManagementGridComponent implements OnInit {
if (notebook.name === 'edge node') {
return this.allEnvironmentData
.filter(env => env.user === notebook.user)
- .some(el => this.inProgress([el]) || this.inProgress(el.resources));
- } else if (notebook.resources.length) {
- return this.inProgress(notebook.resources);
+ .some(el => this.inProgress([el]) || this.inProgress(el.computational_resources));
+ } else if (notebook.computational_resources.length) {
+ return this.inProgress(notebook.computational_resources);
}
}
return false;
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
index 16e9f5d..63c253f 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
@@ -38,9 +38,8 @@
</button>
</div>
<mat-divider></mat-divider>
- <management-grid
- [currentUser]="user.toLowerCase()" [isAdmin]="healthStatus?.admin"
- [allEnvironmentData]="allEnvironmentData" [environmentsHealthStatuses]="healthStatus?.list_resources"
- (refreshGrid)="buildGrid()" (actionToggle)="manageEnvironmentAction($event)">
+ <management-grid [currentUser]="user.toLowerCase()" [isAdmin]="healthStatus?.admin"
+ [environmentsHealthStatuses]="healthStatus?.list_resources" (refreshGrid)="buildGrid()"
+ (actionToggle)="manageEnvironmentAction($event)">
</management-grid>
-</div>
\ No newline at end of file
+</div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index 0db2a3c..abcf6e3 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -36,6 +36,8 @@ import { SsnMonitorComponent } from './ssn-monitor/ssn-monitor.component';
import { ManageEnvironmentComponent } from './manage-environment/manage-environment-dilog.component';
import { EndpointsComponent } from './endpoints/endpoints.component';
+import { EnvironmentsDataService } from './management-data.service';
+
@Component({
selector: 'environments-management',
templateUrl: './management.component.html',
@@ -55,7 +57,8 @@ export class ManagementComponent implements OnInit {
private backupService: BackupService,
private manageEnvironmentsService: ManageEnvironmentsService,
private userResourceService: UserResourceService,
- private storageService: StorageService
+ private storageService: StorageService,
+ private environmentsDataService: EnvironmentsDataService
) { }
ngOnInit() {
@@ -65,6 +68,7 @@ export class ManagementComponent implements OnInit {
public buildGrid() {
this.getEnvironmentHealthStatus();
+ this.environmentsDataService.updateEnvironmentData();
}
public manageEnvironmentAction($event) {
@@ -72,8 +76,8 @@ export class ManagementComponent implements OnInit {
.environmentManagement(
$event.environment.user,
$event.action,
- $event.environment.name === 'edge node' ? 'edge' : $event.environment.name,
- $event.resource ? $event.resource.computational_name : null
+ $event.environment.resource_type === 'edge node' ? 'edge' : $event.environment.resource_name,
+ $event.computational_resources ? $event.computational_resources.computational_name : null
).subscribe(
() => this.buildGrid(),
error => this.toastr.error('Environment management failed!', 'Oops!'));
@@ -92,7 +96,7 @@ export class ManagementComponent implements OnInit {
this.getActiveUsersList().subscribe(usersList => {
this.getTotalBudgetData().subscribe(
total => {
- const dialogRef = this.dialog.open(ManageEnvironmentComponent, { data: { usersList, total }, panelClass: 'modal-xl-s'});
+ const dialogRef = this.dialog.open(ManageEnvironmentComponent, { data: { usersList, total }, panelClass: 'modal-xl-s' });
dialogRef.componentInstance.manageEnv.subscribe((data) => this.manageEnvironment(data));
dialogRef.afterClosed().subscribe(result => result && this.setBudgetLimits(result));
}, () => this.toastr.error('Failed users list loading!', 'Oops!'));
@@ -104,14 +108,14 @@ export class ManagementComponent implements OnInit {
}
isEnvironmentsInProgress(data): boolean {
- return data.exploratory.some(el => {
+ return data.some(el => {
return el.status === 'creating' || el.status === 'starting' ||
el.computational_resources.some(elem => elem.status === 'creating' || elem.status === 'starting' || elem.status === 'configuring');
});
}
isNotebookInProgress(data): boolean {
- return data.exploratory.some(el => el.status === 'creating');
+ return data.some(el => el.status === 'creating');
}
setBudgetLimits($event) {
@@ -144,36 +148,24 @@ export class ManagementComponent implements OnInit {
private getExploratoryList() {
this.userResourceService.getUserProvisionedResources()
.subscribe((result) => {
+ debugger;
this.anyEnvInProgress = this.isEnvironmentsInProgress(result);
this.notebookInProgress = this.isNotebookInProgress(result);
});
}
- private getAllEnvironmentData() {
- this.manageEnvironmentsService
- .getAllEnvironmentData()
- .subscribe((result: Array<EnvironmentModel>) => this.allEnvironmentData = this.loadEnvironmentList(result));
- }
-
- private loadEnvironmentList(data): Array<EnvironmentModel> {
- if (data)
- return data.map(value => new EnvironmentModel(
- value.resource_name || value.resource_type,
- value.status,
- value.shape,
- value.computational_resources,
- value.user,
- value.public_ip,
- value.resource_type
- ));
- }
+ // private getAllEnvironmentData() {
+ // this.manageEnvironmentsService
+ // .getAllEnvironmentData()
+ // .subscribe((result: Array<EnvironmentModel>) => this.allEnvironmentData = result);
+ // }
private getEnvironmentHealthStatus() {
this.healthStatusService
.getEnvironmentStatuses()
.subscribe((status: GeneralEnvironmentStatus) => {
this.healthStatus = status;
- this.healthStatus.admin && this.getAllEnvironmentData();
+ // this.healthStatus.admin && this.getAllEnvironmentData();
this.getExploratoryList();
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org