Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add resources pools management + ACE/ACL management #1462

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ import { GroupResolver } from "./resolvers/group.resolver";
import { GroupRoleResolver } from "./resolvers/group-role.resolver";
import { RoleDetailComponent } from "./components/role-management/role-detail/role-detail.component";
import { RoleDetailResolver } from "./resolvers/role-detail.resolver";
import {AceManagementComponent} from "@components/ace-management/ace-management.component";
import {ResourcePoolsManagementComponent} from "@components/resource-pools-management/resource-pools-management.component";
import {ResourcePoolDetailsComponent} from "@components/resource-pool-details/resource-pool-details.component";
import {ResourcePoolsResolver} from "@resolvers/resource-pools.resolver";

const routes: Routes = [
{
Expand Down Expand Up @@ -99,6 +103,15 @@ const routes: Routes = [
groups: UserGroupsResolver,
controller: ControllerResolve},
},
{
path: 'controller/:controller_id/management/resourcePools/:pool_id',
component: ResourcePoolDetailsComponent,
canActivate: [LoginGuard],
resolve: {
pool: ResourcePoolsResolver,
controller: ControllerResolve
}
},
{ path: 'installed-software', component: InstalledSoftwareComponent },
{ path: 'controller/:controller_id/systemstatus', component: SystemStatusComponent, canActivate: [LoginGuard] },

Expand Down Expand Up @@ -231,6 +244,14 @@ const routes: Routes = [
{
path: 'roles',
component: RoleManagementComponent
},
{
path: "resourcePools",
component: ResourcePoolsManagementComponent
},
{
path: 'aces',
component: AceManagementComponent
}
]
},
Expand Down
27 changes: 27 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,22 @@ import { ExportPortableProjectComponent } from './components/export-portable-pro
import { NodesMenuConfirmationDialogComponent } from './components/project-map/nodes-menu/nodes-menu-confirmation-dialog/nodes-menu-confirmation-dialog.component';
import { ConfirmationDeleteAllProjectsComponent } from './components/projects/confirmation-delete-all-projects/confirmation-delete-all-projects.component';
import { ProjectMapLockConfirmationDialogComponent } from './components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component';
import {AceManagementComponent} from "@components/ace-management/ace-management.component";
import { AddAceDialogComponent } from './components/ace-management/add-ace-dialog/add-ace-dialog.component';
import { AutocompleteComponent } from './components/ace-management/add-ace-dialog/autocomplete/autocomplete.component';
import { DeleteAceDialogComponent } from './components/ace-management/delete-ace-dialog/delete-ace-dialog.component';
import { AceFilterPipe } from './filters/ace-filter.pipe';
import {CdkAccordionModule} from "@angular/cdk/accordion";
import {CdkTreeModule} from "@angular/cdk/tree";

import { PrivilegeComponent } from './components/role-management/role-detail/privilege/privilege.component';
import { GroupPrivilegesPipe } from './components/role-management/role-detail/privilege/group-privileges.pipe';
import { ResourcePoolsManagementComponent } from './components/resource-pools-management/resource-pools-management.component';
import { AddResourcePoolDialogComponent } from './components/resource-pools-management/add-resource-pool-dialog/add-resource-pool-dialog.component';
import { DeleteResourcePoolComponent } from './components/resource-pools-management/delete-resource-pool/delete-resource-pool.component';
import { ResourcePoolsFilterPipe } from './components/resource-pools-management/resource-pools-filter.pipe';
import { ResourcePoolDetailsComponent } from './components/resource-pool-details/resource-pool-details.component';
import { DeleteResourceConfirmationDialogComponent } from './components/resource-pool-details/delete-resource-confirmation-dialog/delete-resource-confirmation-dialog.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -533,8 +547,19 @@ import { GroupPrivilegesPipe } from './components/role-management/role-detail/pr
NodesMenuConfirmationDialogComponent,
ConfirmationDeleteAllProjectsComponent,
ProjectMapLockConfirmationDialogComponent,
AceManagementComponent,
AddAceDialogComponent,
AutocompleteComponent,
DeleteAceDialogComponent,
AceFilterPipe,
PrivilegeComponent,
GroupPrivilegesPipe,
ResourcePoolsManagementComponent,
AddResourcePoolDialogComponent,
DeleteResourcePoolComponent,
ResourcePoolsFilterPipe,
ResourcePoolDetailsComponent,
DeleteResourceConfirmationDialogComponent,
],
imports: [
BrowserModule,
Expand All @@ -560,6 +585,8 @@ import { GroupPrivilegesPipe } from './components/role-management/role-detail/pr
MatSlideToggleModule,
MatCheckboxModule,
MatAutocompleteModule,
CdkAccordionModule,
CdkTreeModule,
],
providers: [
SettingsService,
Expand Down
98 changes: 98 additions & 0 deletions src/app/components/ace-management/ace-management.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<div class="content" *ngIf="isReady; else loading">
<div class="default-header">
<div class="row">
<h1 class="col">ACEs management</h1>
<button class="col" mat-raised-button color="primary" (click)="deleteMultiple()" class="add-ace-button" [disabled]="selection.selected.length == 0">
Delete selected ACEs
</button>
<button class="col" mat-raised-button color="primary" (click)="addACE()" class="add-ace-button">
Add ACE
</button>
</div>
</div>

<form>
<mat-form-field class="full-width">
<input matInput placeholder="Search by path, user/group or role" [(ngModel)]="searchText"
[ngModelOptions]="{ standalone: true }"/>
</mat-form-field>
</form>

<div class="default-content">
<table mat-table [dataSource]="dataSource | aceFilter: searchText:endpoints " class="mat-elevation-z8" matSort #acesSort="matSort">

<ng-container matColumnDef="select" >
<th mat-header-cell *matHeaderCellDef class="small-col">
<mat-checkbox (change)="$event ? masterToggle() : null"
[checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()">
</mat-checkbox>
</th>
<td mat-cell *matCellDef="let row" class="small-col">
<mat-checkbox (click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)">
</mat-checkbox>
</td>
</ng-container>

<ng-container matColumnDef="path">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Path</th>
<td mat-cell *matCellDef="let element"> {{getNameByUuidFromEndpoint(element.path)}} </td>
</ng-container>

<ng-container matColumnDef="user/group">
<th mat-header-cell *matHeaderCellDef mat-sort-header>User/Group</th>
<td mat-cell *matCellDef="let element">
<div *ngIf="element.ace_type === 'user' else groupId">{{getNameByUuidFromEndpoint(element.user_id)}}</div>
<ng-template #groupId>{{getNameByUuidFromEndpoint(element.group_id)}}</ng-template>
</td>
</ng-container>

<ng-container matColumnDef="role">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Role</th>
<td mat-cell *matCellDef="let element"> {{getNameByUuidFromEndpoint(element.role_id)}} </td>
</ng-container>

<ng-container matColumnDef="propagate">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Propagate</th>
<td mat-cell *matCellDef="let element"> {{element.propagate}} </td>
</ng-container>

<ng-container matColumnDef="allowed">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Allowed</th>
<td mat-cell *matCellDef="let element"> {{element.allowed}} </td>
</ng-container>

<ng-container matColumnDef="created_at">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Created</th>
<td mat-cell *matCellDef="let element"> {{element.created_at}} </td>
</ng-container>

<ng-container matColumnDef="updated_at">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Last update</th>
<td mat-cell *matCellDef="let element"> {{element.updated_at}} </td>
</ng-container>

<ng-container matColumnDef="delete">
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let element"><button mat-button (click)="onDelete(element)"><mat-icon>delete</mat-icon></button></td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>


</table>
<mat-paginator #acesPaginator="matPaginator"
[pageSizeOptions]="[5, 10, 20]"
showFirstLastButtons
aria-label="Select page">
</mat-paginator>
</div>
</div>
<ng-template #loading>
<div>
<mat-spinner class="loader"></mat-spinner>
</div>
</ng-template>
26 changes: 26 additions & 0 deletions src/app/components/ace-management/ace-management.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
table {
width: 100%;
}

.full-width {
width: 940px;
margin-left: -470px;
left: 50%;
}

.add-ace-button {
height: 40px;
width: 160px;
margin: 20px;
}

.loader {
position: absolute;
margin: auto;
height: 175px;
bottom: 0;
left: 0;
right: 0;
top: 0;
width: 175px;
}
23 changes: 23 additions & 0 deletions src/app/components/ace-management/ace-management.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AceManagementComponent } from './ace-management.component';

describe('AceManagementComponent', () => {
let component: AceManagementComponent;
let fixture: ComponentFixture<AceManagementComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AceManagementComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(AceManagementComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading