2 ~ Licensed to the Apache Software Foundation (ASF) under one
3 ~ or more contributor license agreements. See the NOTICE file
4 ~ distributed with this work for additional information
5 ~ regarding copyright ownership. The ASF licenses this file
6 ~ to you under the Apache License, Version 2.0 (the
7 ~ "License"); you may not use this file except in compliance
8 ~ with the License. You may obtain a copy of the License at
10 ~ http://www.apache.org/licenses/LICENSE-2.0
11 ~ Unless required by applicable law or agreed to in writing,
12 ~ software distributed under the License is distributed on an
13 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 ~ KIND, either express or implied. See the License for the
15 ~ specific language governing permissions and limitations
19 <form class="mt-3 mb-3" [formGroup]="userForm" (ngSubmit)="onSubmit()">
20 <div class="form-group row col-md-8">
21 <div class="col-md-2 col-form-label">{{'form.edit' |translate}} <span
22 class="fas fa-edit"></span></div>
23 <div class="col-md-6">
24 <input class="form-check-input" type="checkbox" [value]="editMode" [checked]="editMode"
25 (change)="editMode=!editMode"
29 <div class="form-group row col-md-8">
30 <label class="col-md-2 col-form-label" for="id">{{'roles.attributes.id' |translate}}</label>
31 <div class="col-md-6">
32 <input type="text" formControlName="id" id="id" class="form-control-plaintext"
33 [attr.readonly]="true">
36 <div class="form-group row col-md-8">
37 <label class="col-md-2 col-form-label" for="id">{{'roles.attributes.name' |translate}}</label>
38 <div class="col-md-6">
39 <input type="text" formControlName="name" id="name"
40 class="form-control-plaintext"
41 [attr.readonly]="true">
44 <div class="form-group row col-md-8">
45 <label class="col-md-2 col-form-label" for="id">{{'roles.attributes.description' |translate}}</label>
46 <div class="col-md-6">
47 <input type="text" formControlName="description" id="description"
48 [ngClass]="valid('description')"
49 [attr.readonly]="editMode?null:'true'">
52 <div class="form-group row col-md-8">
53 <label class="col-md-2 col-form-label" for="id">{{'roles.attributes.resource' |translate}}</label>
54 <div class="col-md-6">
55 <input type="text" formControlName="resource" id="resource" class="form-control-plaintext"
56 [attr.readonly]="true">
59 <div class="form-group row col-md-8">
60 <div class="col-md-2"></div>
61 <div class="col-md-4">
62 <div class="form-check">
63 <input class="form-check-input" type="checkbox" formControlName="assignable"
64 id="assignable" [attr.disabled]="true">
65 <label class="form-check-label " for="assignable">
66 {{'roles.attributes.assignable'|translate}}
69 <div class="form-check">
70 <input class="form-check-input" type="checkbox" formControlName="template_instance"
71 id="template_instance" [attr.disabled]="true">
72 <label class="form-check-label " for="template_instance">
73 {{'roles.attributes.template_instance'|translate}}
77 <div class="col-md-3" *ngIf="editMode">
78 <button class="btn btn-primary" type="submit"
79 [disabled]="userForm.invalid || !userForm.dirty">{{'form.button.save'|translate}}</button>
84 <ngb-accordion activeIds="">
85 <ngb-panel id="parents">
86 <ng-template ngbPanelHeader let-opened="opened">
87 <div class="d-flex align-items-center justify-content-between">
88 <button ngbPanelToggle class="btn btn-link text-left shadow-none">
89 <h3>{{'roles.edit.parents'|translate}}</h3></button>
90 <ng-container *ngIf="!opened"><i class="fa fa-eye-slash"></i></ng-container>
91 <ng-container *ngIf="opened"><i class="fa fa-eye"></i></ng-container>
94 <ng-template ngbPanelContent>
95 <ng-container *ngIf="editRole?.parents.length>0">
96 <ul class="list-group" *ngFor="let parentRole of editRole?.parents">
97 <li class="list-group-item"><a routerLink="../{{parentRole?.id}}">{{parentRole?.name}}</a></li>
102 <ngb-panel id="children">
103 <ng-template ngbPanelHeader let-opened="opened">
104 <div class="d-flex align-items-center justify-content-between">
105 <button ngbPanelToggle class="btn btn-link text-left shadow-none">
106 <h3>{{'roles.edit.children'|translate}}</h3></button>
107 <ng-container *ngIf="!opened"><i class="fa fa-eye-slash"></i></ng-container>
108 <ng-container *ngIf="opened"><i class="fa fa-eye"></i></ng-container>
111 <ng-template ngbPanelContent>
112 <ng-container *ngIf="editRole?.children.length>0">
113 <ul class="list-group" *ngFor="let childRole of editRole?.children">
114 <li class="list-group-item"><a routerLink="../{{childRole?.id}}">{{childRole?.name}}</a></li>
120 <ngb-panel id="permissions">
121 <ng-template ngbPanelHeader let-opened="opened">
122 <div class="d-flex align-items-center justify-content-between">
124 <button ngbPanelToggle class="btn btn-link text-left shadow-none">
125 <h3>{{'roles.edit.permissions'|translate}}</h3></button>
126 <ng-container *ngIf="!opened"><i class="fa fa-eye-slash"></i></ng-container>
127 <ng-container *ngIf="opened"><i class="fa fa-eye"></i></ng-container>
130 <ng-template ngbPanelContent>
131 <ng-container *ngIf="editRole">
132 <table class="table">
135 <th>{{'permissions.attributes.permission'|translate}}</th>
136 <th>{{'permissions.attributes.operation'|translate}}</th>
137 <th>{{'permissions.attributes.resource'|translate}}</th>
140 <tbody *ngFor="let perm of editRole.permissions">
142 <td>{{perm.name}}</td>
143 <td>{{perm.operation.name}}</td>
144 <td>{{perm.resource.identifier}}</td>
154 <ng-template ngbPanelHeader let-opened="opened">
155 <div class="d-flex align-items-center justify-content-between">
156 <button ngbPanelToggle class="btn btn-link text-left shadow-none">
157 <h3>{{'roles.edit.users'|translate}}</h3></button>
158 <ng-container *ngIf="!opened"><i class="fa fa-eye-slash"></i></ng-container>
159 <ng-container *ngIf="opened"><i class="fa fa-eye"></i></ng-container>
162 <ng-template ngbPanelContent>
163 <h4>{{'roles.edit.usersParents'|translate}}</h4>
164 <app-paginated-entities [service]="roleUserParentService" pageSize="5" [(sortField)]="userParentSortField"
165 [(sortOrder)]="userParentSortOrder" [displayControlsIfSinglePage]="false"
166 [id]="'userParentSection'"
169 <ng-container *ngIf="userParentSection.items$ |async as itemLoader">
170 <ng-template [ngIf]="itemLoader.loading">
171 <div class="spinner-border text-primary" role="status">
172 <span class="sr-only">Loading...</span>
176 <ng-container *ngIf="userParentSection.items$ |stripLoading|async as userItem">
177 <table class="table table-striped table-bordered">
178 <thead class="thead-light">
179 <tr sorted [sortFieldEmitter]="userParentSection.sortFieldChange"
180 [sortOrderEmitter]="userParentSection.sortOrderChange"
181 [toggleObserver]="userParentSection">
182 <app-th-sorted [fieldArray]="['user_id']"
183 contentText="users.attributes.user_id"></app-th-sorted>
184 <app-th-sorted [fieldArray]="['full_name']"
185 contentText="users.attributes.full_name"></app-th-sorted>
189 <tr *ngFor="let user of userItem.data">
190 <td><span data-toggle="tooltip" placement="left"
191 ngbTooltip="{{user.id}}">{{user.user_id}}</span>
193 <td>{{user.full_name}}</td>
198 </app-paginated-entities>
200 <h4>{{'roles.edit.usersInstance'|translate}}</h4>
201 <app-paginated-entities [service]="roleUserService" pageSize="5" [(sortField)]="userSortField"
203 [(sortOrder)]="userSortOrder"
204 [displayIfEmpty]="false" [displayKeyIfEmpty]="'roles.edit.noUsersAssigned'"
205 [displayControlsIfSinglePage]="false"
208 <ng-container *ngIf="userSection.items$ |async as itemLoader">
209 <ng-template [ngIf]="itemLoader.loading">
210 <div class="spinner-border text-primary" role="status">
211 <span class="sr-only">Loading...</span>
215 <ng-container *ngIf="userSection.items$ |stripLoading|async as userItem">
216 <table class="table table-striped table-bordered">
217 <thead class="thead-light">
218 <tr sorted [sortFieldEmitter]="userSection.sortFieldChange"
219 [sortOrderEmitter]="userSection.sortOrderChange"
220 [toggleObserver]="userSection">
221 <app-th-sorted [fieldArray]="['user_id']"
222 contentText="users.attributes.user_id"></app-th-sorted>
223 <app-th-sorted [fieldArray]="['full_name']"
224 contentText="users.attributes.full_name"></app-th-sorted>
225 <th>{{'headers.action'|translate}}</th>
229 <tr *ngFor="let user of userItem.data">
230 <td><span data-toggle="tooltip" placement="left"
231 ngbTooltip="{{user.id}}">{{user.user_id}}</span>
233 <td>{{user.full_name}}</td>
234 <td><a href="javascript: void(0)" (click)="unassignUser(user.user_id)"><span
235 class="fas fa-user-minus"></span></a></td>
240 </app-paginated-entities>
243 <ng-template #userResultTemplate let-r="result" let-t="term">
244 <ngb-highlight [result]="r.user_id + ' - ' + r.full_name" [term]="t"></ngb-highlight>
246 <div class="form-group">
247 <label for="typeahead-http">{{'roles.edit.assignUserSearch'|translate}}</label>
248 <input id="typeahead-http" type="text" class="form-control col-md-2"
249 name="userSearchField"
250 [class.is-invalid]="userSearchFailed" [resultTemplate]="userResultTemplate"
251 [inputFormatter]="getUserId"
253 [(ngModel)]="userSearchModel" [ngbTypeahead]="searchUser" placeholder="User Search"/>
254 <small *ngIf="userSearching"
255 class="form-text text-muted">{{'form.searching' |translate}}</small>
256 <div class="invalid-feedback"
257 *ngIf="userSearchFailed">{{'roles.edit.userSearchFailed'|translate}}</div>
259 <button class="btn btn-primary" (click)="assignUserRole()">{{'roles.edit.assignButton'|translate}}</button>
263 <div *ngIf="success">
267 <div>Error {{errorResult.error_messages}}</div>