This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch DLAB-959
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-959 by this push:
new c72b784 [DLAB-959]: update ingrid status after project action selected
c72b784 is described below
commit c72b78411d983bcf413ecaf7451ef92fadcffd29
Author: Andriana Kovalyshyn <[email protected]>
AuthorDate: Wed Aug 7 11:02:24 2019 +0200
[DLAB-959]: update ingrid status after project action selected
---
.../manage-environment-dilog.component.html | 18 ++++++++++----
.../manage-environment-dilog.component.ts | 18 ++++++++------
.../management/management.component.ts | 29 ++++++++++++----------
3 files changed, 39 insertions(+), 26 deletions(-)
diff --git
a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
index f52a7e0..5c72e2a 100644
---
a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
+++
b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
@@ -47,9 +47,8 @@
quotes cannot be greater than total budget</span>
</div>
<div class="action">
- <span
- *ngIf="
manageUsersForm.controls['projects'].controls[i].value['status'] === 'ACTIVE';
else not_active"
- matTooltip="Stop" matTooltipPosition="above"
(click)="applyAction('stop', item)"><i
+ <span matTooltip="Stop" matTooltipPosition="above"
(click)="applyAction('stop', item)"
+
*ngIf="manageUsersForm.controls['projects'].controls[i].value['status'] ===
'ACTIVE'; else not_active"><i
class="material-icons">pause_circle_outline</i></span>
<ng-template #not_active>
@@ -58,8 +57,17 @@
</span>
</ng-template>
- <span matTooltip="Terminate" matTooltipPosition="above"
(click)="applyAction('terminate', item)"><i
- class="material-icons">phonelink_off</i></span>
+
+ <span matTooltip="Terminate" matTooltipPosition="above"
(click)="applyAction('terminate', item)"
+
*ngIf="manageUsersForm.controls['projects'].controls[i].value['status'] !==
'DELETED'
+ &&
manageUsersForm.controls['projects'].controls[i].value['status'] !==
'DELETING'; else deleted">
+ <i class="material-icons">phonelink_off</i>
+ </span>
+ <ng-template #deleted>
+ <span class="disabled" matTooltip="Project is deleted"
matTooltipPosition="above">
+ <i class="material-icons">phonelink_off</i>
+ </span>
+ </ng-template>
</div>
</mat-list-item>
</div>
diff --git
a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
index 70f8fbd..c0bbadb 100644
---
a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
+++
b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
@@ -30,26 +30,21 @@ import { DICTIONARY } from
'../../../../dictionary/global.dictionary';
})
export class ManageEnvironmentComponent implements OnInit {
readonly DICTIONARY = DICTIONARY;
- // public usersList: Array<string> = [];
public manageUsersForm: FormGroup;
public manageTotalsForm: FormGroup;
@Output() manageEnv: EventEmitter<{}> = new EventEmitter();
- // @Output() setBudget: EventEmitter<{}> = new EventEmitter();
constructor(
@Inject(MAT_DIALOG_DATA) public data: any,
- private _fb: FormBuilder,
public dialog: MatDialog,
- public dialogRef: MatDialogRef<ManageEnvironmentComponent>
+ public dialogRef: MatDialogRef<ManageEnvironmentComponent>,
+ private _fb: FormBuilder,
) { }
ngOnInit() {
!this.manageUsersForm && this.initForm();
- this.manageUsersForm.setControl('projects',
- this._fb.array((this.data.projectsList || []).map((x: any) =>
this._fb.group({
- project: x.name, budget: [x.budget, [Validators.min(0),
this.userValidityCheck.bind(this)]], status: x.status
- }))));
+ this.setProjectsControl();
this.manageUsersForm.controls['total'].setValue(this.data.total.conf_max_budget
|| null);
}
@@ -71,6 +66,13 @@ export class ManageEnvironmentComponent implements OnInit {
});
}
+ public setProjectsControl() {
+ this.manageUsersForm.setControl('projects',
+ this._fb.array((this.data.projectsList || []).map((x: any) =>
this._fb.group({
+ project: x.name, budget: [x.budget, [Validators.min(0),
this.userValidityCheck.bind(this)]], status: x.status
+ }))));
+ }
+
private initForm(): void {
this.manageUsersForm = this._fb.group({
total: [null, [Validators.min(0), this.totalValidityCheck.bind(this)]],
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 94a9ebb..be26294 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
@@ -48,8 +48,8 @@ import { ProjectService } from '../../core/services';
export class ManagementComponent implements OnInit {
public user: string = '';
public healthStatus: GeneralEnvironmentStatus;
- public allEnvironmentData: Array<EnvironmentModel>;
public anyEnvInProgress: boolean = false;
+ public dialogRef: any;
constructor(
public toastr: ToastrService,
@@ -95,12 +95,11 @@ export class ManagementComponent implements OnInit {
}
openManageEnvironmentDialog() {
- // this.getActiveUsersList().subscribe(usersList => {
this.projectService.getProjectsList().subscribe(projectsList => {
this.getTotalBudgetData().subscribe(total => {
- const dialogRef = this.dialog.open(ManageEnvironmentComponent, { data:
{ projectsList, total }, panelClass: 'modal-xl-s' });
- dialogRef.componentInstance.manageEnv.subscribe((data) =>
this.manageEnvironment(data));
- dialogRef.afterClosed().subscribe(result => result &&
this.setBudgetLimits(result));
+ this.dialogRef = this.dialog.open(ManageEnvironmentComponent, { data:
{ projectsList, total }, panelClass: 'modal-xl-s' });
+ this.dialogRef.componentInstance.manageEnv.subscribe((data) =>
this.manageEnvironment(data));
+ this.dialogRef.afterClosed().subscribe(result => result &&
this.setBudgetLimits(result));
}, () => this.toastr.error('Failed users list loading!', 'Oops!'));
});
}
@@ -129,18 +128,22 @@ export class ManagementComponent implements OnInit {
manageEnvironment(event: { action: string, project: any }) {
if (event.action === 'stop')
- this.projectService
- .toggleProjectStatus(event.project, event.action)
- .subscribe(() =>
- this.toastr.success(`Action ${event.action} is processing!`,
'Processing!') &&
- this.buildGrid(), error => this.toastr.error(error.message,
'Oops!'));
+ this.projectService.toggleProjectStatus(event.project, event.action)
+ .subscribe(() => this.handleSuccessAction(event.action), error =>
this.toastr.error(error.message, 'Oops!'));
if (event.action === 'terminate')
this.projectService.deleteProject(event.project.project_name)
- .subscribe(() =>
- this.toastr.success(`Action ${event.action} is processing!`,
'Processing!') &&
- this.buildGrid(), error => this.toastr.error(error.message,
'Oops!'));
+ .subscribe(() => this.handleSuccessAction(event.action), error =>
this.toastr.error(error.message, 'Oops!'));
+ }
+ handleSuccessAction(action) {
+ this.toastr.success(`Action ${action} is processing!`, 'Processing!');
+ this.projectService.getProjectsList().subscribe(data => {
+ debugger;
+ this.dialogRef.componentInstance.data.projectsList = data
+ this.dialogRef.componentInstance.setProjectsControl();
+ });
+ this.buildGrid()
}
get creatingBackup(): boolean {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]