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 766d0f9fd4ce380a3452d2306e7f0a02f760bcc5 Author: Andriana Kovalyshyn <[email protected]> AuthorDate: Thu May 30 13:27:18 2019 +0300 [DLAB-631]: moved manage roles functionality into separate page --- .../app/administration/administration.module.ts | 5 +- .../src/app/administration/management/index.ts | 7 -- .../management/management.component.html | 44 +++++------ .../management/management.component.ts | 92 +++++++++++----------- .../resources/webapp/src/app/app.routing.module.ts | 11 ++- 5 files changed, 77 insertions(+), 82 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/administration.module.ts b/services/self-service/src/main/resources/webapp/src/app/administration/administration.module.ts index 2ae70a4..e535bda 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/administration.module.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/administration.module.ts @@ -22,10 +22,11 @@ import { CommonModule } from '@angular/common'; import { ManagenementModule } from './management'; import { ProjectModule } from './project'; +import { RolesModule } from './roles'; @NgModule({ - imports: [CommonModule, ManagenementModule, ProjectModule], + imports: [CommonModule, ManagenementModule, ProjectModule, RolesModule], declarations: [], - exports: [ManagenementModule, ProjectModule] + exports: [ManagenementModule, ProjectModule, RolesModule] }) export class AdministrationModule { } diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts index f5146e4..3dadada 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/index.ts @@ -38,12 +38,10 @@ import { FormControlsModule } from '../../shared/form-controls'; import { BackupDilogComponent } from './backup-dilog/backup-dilog.component'; import { ManageEnvironmentComponent, ConfirmActionDialogComponent } from './manage-environment/manage-environment-dilog.component'; -import { GroupNameValidationDirective } from './manage-roles-groups/group-name-validarion.directive'; import { DirectivesModule } from '../../core/directives'; import { SsnMonitorComponent } from './ssn-monitor/ssn-monitor.component'; import { EndpointsComponent } from './endpoints/endpoints.component'; -import { ManageRolesGroupsComponent, ConfirmDeleteUserAccountDialogComponent } from './manage-roles-groups/manage-roles-groups.component'; import { ProjectModule } from '../project'; export * from './management.component'; @@ -67,21 +65,16 @@ export * from './management.component'; declarations: [ ManagementComponent, ManagementGridComponent, - - GroupNameValidationDirective, BackupDilogComponent, ManageEnvironmentComponent, ConfirmationDialogComponent, ConfirmActionDialogComponent, - ConfirmDeleteUserAccountDialogComponent, SsnMonitorComponent, - ManageRolesGroupsComponent, EndpointsComponent ], entryComponents: [ ConfirmationDialogComponent, ConfirmActionDialogComponent, - ConfirmDeleteUserAccountDialogComponent, BackupDilogComponent, SsnMonitorComponent, EndpointsComponent, 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 fb159c2..cffca62 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 @@ -18,33 +18,29 @@ --> <div class="sub-nav base-retreat"> - <div *ngIf="healthStatus?.admin" class="admin-group"> - <button mat-raised-button class="butt ssn" (click)="showEndpointsDialog()"> - <i class="material-icons"></i>Endpoints - </button> - <button mat-raised-button class="butt ssn" (click)="openManageRolesDialog()"> - <i class="material-icons"></i>Manage roles - </button> - <button mat-raised-button class="butt ssn" (click)="openSsnMonitorDialog()"> - <i class="material-icons"></i>SSN Monitor - </button> - <button mat-raised-button class="butt env" (click)="openManageEnvironmentDialog()"> - <i class="material-icons"></i>Manage environment - </button> - <button mat-raised-button class="butt" (click)="showBackupDialog()" [disabled]="creatingBackup"> - <i class="material-icons">backup</i>Backup - </button> - </div> - <button mat-raised-button class="butt" (click)="buildGrid()"> + <div *ngIf="healthStatus?.admin" class="admin-group"> + <button mat-raised-button class="butt ssn" (click)="showEndpointsDialog()"> + <i class="material-icons"></i>Endpoints + </button> + <button mat-raised-button class="butt ssn" (click)="openSsnMonitorDialog()"> + <i class="material-icons"></i>SSN Monitor + </button> + <button mat-raised-button class="butt env" (click)="openManageEnvironmentDialog()"> + <i class="material-icons"></i>Manage environment + </button> + <button mat-raised-button class="butt" (click)="showBackupDialog()" [disabled]="creatingBackup"> + <i class="material-icons">backup</i>Backup + </button> + </div> + <button mat-raised-button class="butt" (click)="buildGrid()"> <i class="material-icons">autorenew</i>Refresh </button> </div> -<management-grid [currentUser]="user.toLowerCase()" [uploadKey]="uploadKey" [healthStatus]="healthStatus?.status" [isAdmin]="healthStatus?.admin" [allEnvironmentData]="allEnvironmentData" [environmentsHealthStatuses]="healthStatus?.list_resources" (refreshGrid)="buildGrid()" - (actionToggle)="manageEnvironmentAction($event)"> +<management-grid [currentUser]="user.toLowerCase()" [uploadKey]="uploadKey" [healthStatus]="healthStatus?.status" + [isAdmin]="healthStatus?.admin" [allEnvironmentData]="allEnvironmentData" + [environmentsHealthStatuses]="healthStatus?.list_resources" (refreshGrid)="buildGrid()" + (actionToggle)="manageEnvironmentAction($event)"> </management-grid> -<progress-dialog #preloaderModal></progress-dialog> - -<dlab-manage-roles-groups #rolesGroupsModal (manageRolesGroupAction)="manageRolesGroups($event)"> -</dlab-manage-roles-groups> \ No newline at end of file +<progress-dialog #preloaderModal></progress-dialog> \ No newline at end of file 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 bca3920..e698281 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 @@ -60,7 +60,7 @@ export class ManagementComponent implements OnInit, OnDestroy { @ViewChild('keyUploadModal') keyUploadDialog; @ViewChild('preloaderModal') preloaderDialog; @ViewChild('ssnMonitor') ssnMonitorDialog; - @ViewChild('rolesGroupsModal') rolesGroupsDialog; + // @ViewChild('rolesGroupsModal') rolesGroupsDialog; constructor( public toastr: ToastrService, @@ -111,7 +111,7 @@ export class ManagementComponent implements OnInit, OnDestroy { } showEndpointsDialog() { - this.dialog.open(EndpointsComponent, { panelClass: 'modal-sm' }) + this.dialog.open(EndpointsComponent, { panelClass: 'modal-xl-s' }) .afterClosed().subscribe(result => result && this.buildGrid()); } @@ -140,14 +140,14 @@ export class ManagementComponent implements OnInit, OnDestroy { () => this.toastr.error('Failed ssn data loading!', 'Oops!')); } - openManageRolesDialog() { - this.rolesService.getGroupsData().subscribe(group => { - this.rolesService.getRolesData().subscribe( - roles => this.rolesGroupsDialog.open({ isFooter: false }, group, roles), - error => this.toastr.error(error.message, 'Oops!')); - }, - error => this.toastr.error(error.message, 'Oops!')); - } + // openManageRolesDialog() { + // this.rolesService.getGroupsData().subscribe(group => { + // this.rolesService.getRolesData().subscribe( + // roles => this.rolesGroupsDialog.open({ isFooter: false }, group, roles), + // error => this.toastr.error(error.message, 'Oops!')); + // }, + // error => this.toastr.error(error.message, 'Oops!')); + // } isEnvironmentsInProgress(data): boolean { return data.exploratory.some(el => { @@ -169,37 +169,37 @@ export class ManagementComponent implements OnInit, OnDestroy { error => this.toastr.error(error.message, 'Oops!')); } - manageRolesGroups($event) { - switch ($event.action) { - case 'create': - this.rolesService.setupNewGroup($event.value).subscribe(res => { - this.toastr.success('Group creation success!', 'Created!'); - this.getGroupsData(); - }, () => 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!')); - break; - case 'delete': - if ($event.type === 'users') { - this.rolesService.removeUsersForGroup($event.value).subscribe(res => { - this.toastr.success('Users was successfully deleted!', 'Success!'); - this.getGroupsData(); - }, () => this.toastr.error('Failed users deleting!', 'Oops!')); - } else if ($event.type === 'group') { - console.log('delete group'); - this.rolesService.removeGroupById($event.value).subscribe(res => { - this.toastr.success('Group was successfully deleted!', 'Success!'); - this.getGroupsData(); - }, () => this.toastr.error('Failed group deleting!', 'Oops!')); - } - break; - default: - } - } + // manageRolesGroups($event) { + // switch ($event.action) { + // case 'create': + // this.rolesService.setupNewGroup($event.value).subscribe(res => { + // this.toastr.success('Group creation success!', 'Created!'); + // this.getGroupsData(); + // }, () => 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!')); + // break; + // case 'delete': + // if ($event.type === 'users') { + // this.rolesService.removeUsersForGroup($event.value).subscribe(res => { + // this.toastr.success('Users was successfully deleted!', 'Success!'); + // this.getGroupsData(); + // }, () => this.toastr.error('Failed users deleting!', 'Oops!')); + // } else if ($event.type === 'group') { + // console.log('delete group'); + // this.rolesService.removeGroupById($event.value).subscribe(res => { + // this.toastr.success('Group was successfully deleted!', 'Success!'); + // this.getGroupsData(); + // }, () => this.toastr.error('Failed group deleting!', 'Oops!')); + // } + // break; + // default: + // } + // } setBudgetLimits($event) { this.healthStatusService.updateUsersBudget($event.users).subscribe((result: any) => { @@ -212,11 +212,11 @@ export class ManagementComponent implements OnInit, OnDestroy { }, error => this.toastr.error(error.message, 'Oops!')); } - getGroupsData() { - this.rolesService.getGroupsData().subscribe( - list => this.rolesGroupsDialog.updateGroupData(list), - error => this.toastr.error(error.message, 'Oops!')); - } + // getGroupsData() { + // this.rolesService.getGroupsData().subscribe( + // list => this.rolesGroupsDialog.updateGroupData(list), + // error => this.toastr.error(error.message, 'Oops!')); + // } manageEnvironment(event: { action: string, user: string }) { this.healthStatusService diff --git a/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts b/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts index dae0bd9..5135e02 100644 --- a/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts +++ b/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts @@ -30,8 +30,9 @@ import { ReportingComponent } from './reporting/reporting.component'; import { WebterminalComponent } from './webterminal/webterminal.component'; import { ManagementComponent } from './administration/management/management.component'; import { ProjectComponent } from './administration/project/project.component'; +import { RolesComponent } from './administration/roles/roles.component'; -import { AuthorizationGuard, CheckParamsGuard, CloudProviderGuard } from './core/services'; +import { AuthorizationGuard, CheckParamsGuard, CloudProviderGuard, AdminGuard } from './core/services'; const routes: Routes = [{ path: 'login', @@ -56,11 +57,15 @@ const routes: Routes = [{ }, { path: 'projects', component: ProjectComponent, - canActivate: [AuthorizationGuard], + canActivate: [AuthorizationGuard, AdminGuard], + }, { + path: 'roles', + component: RolesComponent, + canActivate: [AuthorizationGuard, AdminGuard], }, { path: 'environment_management', component: ManagementComponent, - canActivate: [AuthorizationGuard] + canActivate: [AuthorizationGuard, AdminGuard] }, { path: 'terminal/:id', component: WebterminalComponent --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
