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/03/03 09:33:50 UTC
[incubator-dlab] branch develop updated: [DLAB-1579]: Added confirmation dialog with information about termina… (#630)
This is an automated email from the ASF dual-hosted git repository.
dgnatyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push:
new cfff604 [DLAB-1579]: Added confirmation dialog with information about termina… (#630)
cfff604 is described below
commit cfff6042103282f737a36ea400ae65e8657447e6
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Tue Mar 3 11:33:40 2020 +0200
[DLAB-1579]: Added confirmation dialog with information about termina… (#630)
[DLAB-1579]: Added confirmation dialog with information about termination users instances
---
.../app/administration/roles/roles.component.ts | 50 ++++++++++++++++++----
.../reporting-grid/reporting-grid.component.html | 1 -
.../src/app/reporting/reporting.component.ts | 4 +-
.../resources-grid/resources-grid.component.scss | 1 +
.../confirmation-dialog-type.enum.ts | 3 +-
.../confirmation-dialog.component.html | 9 ++--
.../webapp/src/assets/styles/_dialogs.scss | 6 +++
.../webapp/src/dictionary/azure.dictionary.ts | 6 +--
8 files changed, 60 insertions(+), 20 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
index cf2f086..8afec35 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
@@ -25,7 +25,8 @@ import { ToastrService } from 'ngx-toastr';
import { RolesGroupsService, HealthStatusService } from '../../core/services';
import { CheckUtils } from '../../core/util';
import { DICTIONARY } from '../../../dictionary/global.dictionary';
-import {ProgressBarService} from "../../core/services/progress-bar.service";
+import {ProgressBarService} from '../../core/services/progress-bar.service';
+import {ConfirmationDialogComponent, ConfirmationDialogType} from '../../shared/modal-dialog/confirmation-dialog';
@Component({
selector: 'dlab-roles',
@@ -50,6 +51,7 @@ export class RolesComponent implements OnInit {
stepperView: boolean = false;
displayedColumns: string[] = ['name', 'roles', 'users', 'actions'];
@Output() manageRolesGroupAction: EventEmitter<{}> = new EventEmitter();
+ private startedGroups;
constructor(
public toastr: ToastrService,
@@ -65,18 +67,18 @@ export class RolesComponent implements OnInit {
}
openManageRolesDialog() {
- setTimeout(() => {this.progressBarService.startProgressBar()} , 0);
+ setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
this.rolesService.getGroupsData().subscribe(groups => {
this.rolesService.getRolesData().subscribe(
(roles: any) => {
this.roles = roles;
this.rolesList = roles.map(role => role.description);
this.updateGroupData(groups);
-
+ this.getGroupsListCopy();
this.stepperView = false;
},
error => this.toastr.error(error.message, 'Oops!'));
- this.progressBarService.stopProgressBar()
+ this.progressBarService.stopProgressBar();
},
error => {
this.toastr.error(error.message, 'Oops!');
@@ -142,10 +144,29 @@ export class RolesComponent implements OnInit {
}, () => this.toastr.error('Group creation failed!', 'Oops!'));
break;
case 'update':
- this.rolesService.updateGroup($event.value).subscribe(res => {
- this.toastr.success('Group data successfully updated!', 'Success!');
- this.getGroupsData();
- }, () => this.toastr.error('Failed group data updating!', 'Oops!'));
+ const currGroup = this.startedGroups.filter(group => group.group === $event.value.name);
+ const deletedUsers = currGroup[0].users.filter(user => {
+ if ($event.value.users.includes(user)) {
+ return false;
+ } else {
+ return true;
+ }
+ });
+ if (deletedUsers.length) {
+ this.dialog.open(ConfirmationDialogComponent, { data:
+ { notebook: deletedUsers, type: ConfirmationDialogType.deleteUser }, panelClass: 'modal-sm' })
+ .afterClosed().subscribe((res) => {
+ if (!res) {
+ $event.value.users = $event.value.users.concat(deletedUsers);
+ this.updateGroup($event.value, ', but users did\'t delete from group');
+ } else {
+ this.updateGroup($event.value, '');
+ }
+ });
+ } else {
+ this.updateGroup($event.value, '');
+ }
+
break;
case 'delete':
if ($event.type === 'users') {
@@ -171,13 +192,24 @@ export class RolesComponent implements OnInit {
}, []);
}
+ public updateGroup(value, extraMesssage){
+ this.rolesService.updateGroup(value).subscribe(res => {
+ this.toastr.success(`Group data successfully updated${extraMesssage}!`, 'Success!');
+ this.getGroupsData();
+ }, () => this.toastr.error('Failed group data updating!', 'Oops!'));
+ }
+
public updateGroupData(groups) {
- this.groupsData = groups.map(v=>v).sort((a,b) => (a.group > b.group) ? 1 : ((b.group > a.group) ? -1 : 0));
+ this.groupsData = groups.map(v => v).sort((a, b) => (a.group > b.group) ? 1 : ((b.group > a.group) ? -1 : 0));
this.groupsData.forEach(item => {
item.selected_roles = item.roles.map(role => role.description);
});
}
+ private getGroupsListCopy() {
+ this.startedGroups = this.groupsData.map(env => JSON.parse(JSON.stringify(env)));
+ }
+
public groupValidarion(): ValidatorFn {
const duplicateList: any = this.groupsData.map(item => item.group.toLowerCase());
return <ValidatorFn>((control: FormControl) => {
diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
index bae8593..4a92bc6 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
@@ -209,7 +209,6 @@
</td>
</ng-container>
-
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true" class="header-row"></tr>
<tr [hidden]="!collapseFilterRow || !PROVIDER" mat-header-row *matHeaderRowDef="displayedFilterColumns; sticky: true"
diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
index 2737ea7..51cca06 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
@@ -100,13 +100,13 @@ export class ReportingComponent implements OnInit, OnDestroy {
}
}
}, e => {
- this.PROVIDER = 'gcp';
+ this.PROVIDER = 'azure';
if (this.PROVIDER) {
this.rebuildBillingReport();
}
}) ;
} else {
- this.PROVIDER = 'gcp';
+ this.PROVIDER = 'azure';
if (this.PROVIDER) {
this.rebuildBillingReport();
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.scss
index 86ec9bf..57abbc1 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.scss
@@ -227,6 +227,7 @@ tr.detail-row {
.filter-row .actions {
text-align: right;
display: flex;
+ justify-content: flex-end;
}
.filter-row .actions button {
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog-type.enum.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog-type.enum.ts
index 701f03f..ca05251 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog-type.enum.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog-type.enum.ts
@@ -21,5 +21,6 @@ export enum ConfirmationDialogType {
StopExploratory = 0,
TerminateExploratory = 1,
TerminateComputationalResources = 2,
- StopEdgeNode = 3
+ StopEdgeNode = 3,
+ deleteUser = 4,
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html
index 30155fe..b1fd8ba 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html
@@ -23,7 +23,7 @@
<span *ngIf="model.notebook.name && model.notebook.name !== 'edge node'">
<span>{{ confirmationType ? 'Terminate' : 'Stop' }} notebook: {{ model.notebook.name }}</span>
</span>
- <span *ngIf="model.notebook.type === 'Edge Node' || model.notebook.name === 'edge node'">
+ <span *ngIf="model.notebook.type === 'Edge Node' || model.notebook.name === 'edge node' || data.type === 4">
<i class="material-icons">priority_high</i>Warning
</span>
</h4>
@@ -31,8 +31,8 @@
</header>
<div class="dialog-content">
<div class="content-box">
- <p class="info text-center">{{ model.title }}</p>
-
+ <p *ngIf="data.type !== 4" class="info text-center">{{ model.title }}</p>
+ <p *ngIf="data.type === 4" class="text-center delete-user">User<span *ngIf="data.notebook.length>1">s</span> <span class="strong"> {{data.notebook.join(', ')}} </span>will be deleted from this group. All <span *ngIf="data.notebook.length===1">his</span><span *ngIf="data.notebook.length>1">their</span> resources authorized within this group will be terminated.</p>
<mat-list class="resources"
[hidden]="model.notebook.type === 'Edge Node' || model.notebook.name === 'edge node'
|| !model.notebook.resources || model.notebook.resources.length === 0 || (!isAliveResources && !confirmationType) || onlyKilled">
@@ -58,7 +58,8 @@
</div>
<div class="text-center m-top-20">
<button mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">No</button>
- <button mat-raised-button type="button" class="butt butt-success action" (click)="confirm()">Yes</button>
+ <button *ngIf="data.type !== 4" mat-raised-button type="button" class="butt butt-success action" (click)="confirm()">Yes</button>
+ <button *ngIf="data.type === 4" mat-raised-button type="button" class="butt butt-success action" (click)="dialogRef.close(true)">Yes</button>
</div>
</div>
</div>
diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
index f1fa89f..fb144a6 100644
--- a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
+++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
@@ -335,6 +335,12 @@ mat-dialog-container {
top: 49%;
}
+.confirmation-dialog p.delete-user{
+ font-weight: 500;
+ max-height: 200px;
+ overflow: auto;
+}
+
@media screen and (max-width: 1280px) {
.modal-fullscreen {
max-width: 100vw !important;
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts
index be25a2c..0478533 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/azure.dictionary.ts
@@ -34,9 +34,9 @@ export const NAMING_CONVENTION_AZURE = {
'max_cluster_name_length': 10,
'billing': {
'resourceName': 'resourceName',
- 'cost': 'costString',
+ 'cost': 'cost',
'costTotal': 'cost_total',
- 'currencyCode': 'currencyCode',
+ 'currencyCode': 'currency_code',
'dateFrom': 'from',
'dateTo': 'to',
'service': 'meterCategory',
@@ -44,7 +44,7 @@ export const NAMING_CONVENTION_AZURE = {
'type': '',
'resourceType': 'resource_type',
'instance_size': 'shape',
- 'dlabId': 'dlabId'
+ 'dlabId': 'dlab_id'
},
'service': 'Category',
'type': '',
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org