Skip to content

Commit

Permalink
primeng: admin permissions
Browse files Browse the repository at this point in the history
Co-Authored-by: Johnny Mariéthoz <[email protected]>
Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
jma and Garfield-fr committed Jan 9, 2025
1 parent 6e46b53 commit e3717cd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
@if (globalPermissions) {
<div class="container">
<h1 translate>Permissions matrix</h1>
<div class="my-3">
<label for="filter" translate>Filter permission list</label>
<input id="filter" class="form-control" #search (keyup)="filterPermissions(search.value)" />
<small class="form-text text-muted" translate>Enter a part of the permission name to filter the list.</small>
</div>
<div class="flex flex-column gap-2">
<label for="filter" translate>Filter permission list</label>
<input
pInputText
id="filter"
aria-describedby="filter-help"
#search
(keyup)="filterPermissions(search.value)"
/>
<small id="filter-help" class="text-color-secondary" translate>
Enter a part of the permission name to filter the list.
</small>
</div>

@if (filteredPermissionNames.length >0) {
<table class="table table-header-rotated table-striped">
<table>
<thead>
<tr>
<th class="vertical-header">&nbsp;</th>
<th>&nbsp;</th>
@for (role of roles; track role) {
<th class="vertical-header" [ngClass]="'type-'+role.type.replace('_', '-')">
<th [ngClass]="'type-'+role.type.replace('_', '-')">
<span>{{ role.name | translate }}</span>
</th>
}
Expand All @@ -38,16 +46,16 @@ <h1 translate>Permissions matrix</h1>
<tbody>
@for (permissionName of filteredPermissionNames; track permissionName) {
<tr>
<td class="permission">{{ permissionName }}</td>
<td>{{ permissionName }}</td>
@for (role of roles; track role) {
<td class="access text-center" [ngClass]="'type-'+role.type.replace('_', '-')">
<td [ngClass]="'type-'+role.type.replace('_', '-')">
<span title="{{ role.name | translate }}">
<i
class="fa fa-square"
[ngClass]="{
'text-success': true === globalPermissions[role.name].actions[permissionName],
'text-danger': false === globalPermissions[role.name].actions[permissionName],
'text-secondary': null === globalPermissions[role.name].actions[permissionName]
'text-error': false === globalPermissions[role.name].actions[permissionName],
'text-color-secondary': null === globalPermissions[role.name].actions[permissionName]
}">
</i>
</span>
Expand All @@ -58,7 +66,6 @@ <h1 translate>Permissions matrix</h1>
</tbody>
</table>
} @else {
<h4 class="text-center text-uppercase font-weight-bold mt-4" translate>No Result</h4>
<p class="mt-3" translate>No result</p>
}
</div>
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@import 'node_modules/bootstrap/scss/_functions';
@import 'node_modules/bootstrap/scss/_variables';

table {
position: relative;

tr td:nth-child(2),
td.type-system-role + td.type-role {
border-left: $border-width*2 solid $border-color;
}
th.type-system-role {
background-color: #f4f4f4;
}

th {
position: sticky;
top: 0;
background: $white;
}

.vertical-header {
text-align: left;
}

.vertical-header span {
writing-mode: vertical-rl;
transform: rotate(180deg);
text-align: left;
max-height: 200px;
}

.permission {
width: 200px;
}

.access {
width: 30px;
admin-permission-detail-view {
table {
@extend .relative, .w-full, .mt-3;
border-spacing: 0;
thead tr {
@extend .bg-white, .sticky, .top-0, .vertical-align-bottom;
th span {
@extend .text-left, .max-h-13rem, .text-sm, .p-2;
writing-mode: vertical-rl;
transform: rotate(180deg);
}
th.type-system-role {
@extend .surface-100;
}
}
tbody {
tr:nth-of-type(odd) {
@extend .surface-100;
}
td {
@extend .p-3, .w-13rem, .text-center, .w-2rem;
}
td:nth-child(2),
td.type-system-role + td.type-role {
@extend .surface-border, .border-left-2;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { IRolePermission, PermissionApiService } from '../../../api/permission-a

@Component({
selector: 'admin-permission-detail-view',
templateUrl: './permission-detail-view.component.html',
styleUrls: ['./permission-detail-view.component.scss'],
templateUrl: './permission-detail-view.component.html'
})
export class PermissionDetailViewComponent implements OnInit {

Expand Down
1 change: 1 addition & 0 deletions projects/admin/src/app/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
@import '../menu/menu-app/menu-app.component.scss';
@import '../record/detail-view/document-detail-view/holding/holding.component.scss';
@import '../record/detail-view/entities-detail-view/remote/entities-remote-detail-view.component.scss';
@import '../record/detail-view/permission-detail-view/permission-detail-view.component.scss';
}

@layer rero-ils-ui {
Expand Down

0 comments on commit e3717cd

Please sign in to comment.