Added a checkbox to the usermanagement screen.. Does nothing yet #865 #1456

This commit is contained in:
Jamie.Rees 2017-08-07 14:22:23 +01:00
parent bd27e4ad70
commit 018cd7a072
5 changed files with 81 additions and 58 deletions

View file

@ -6,6 +6,10 @@
emailAddress: string, emailAddress: string,
password: string, password: string,
userType: UserType, userType: UserType,
// FOR UI
checked: boolean,
} }
export enum UserType { export enum UserType {

View file

@ -27,7 +27,8 @@ export class UserManagementAddComponent implements OnInit {
id: "", id: "",
password: "", password: "",
username: "", username: "",
userType: UserType.LocalUser userType: UserType.LocalUser,
checked:false
} }
} }

View file

@ -21,58 +21,68 @@
<!-- Table --> <!-- Table -->
<table class="table table-striped table-hover table-responsive table-condensed"> <table class="table table-striped table-hover table-responsive table-condensed">
<thead> <thead>
<tr> <tr>
<th> <th>
<a> <a>
Username <input type="checkbox" ng-checked="checkAll" (change)="checkAllBoxes()">
<!--<span ng-show="sortType == 'username' && !sortReverse" class="fa fa-caret-down"></span> </a>
<span ng-show="sortType == 'username' && sortReverse" class="fa fa-caret-up"></span>--> </th>
</a> <th>
</th> <a>
<th> Username
<a> <!--<span ng-show="sortType == 'username' && !sortReverse" class="fa fa-caret-down"></span>
Alias <span ng-show="sortType == 'username' && sortReverse" class="fa fa-caret-up"></span>-->
</a> </a>
</th> </th>
<th> <th>
<a> <a>
Email Alias
</a> </a>
</th> </th>
<th> <th>
Roles <a>
</th> Email
<th> </a>
<a> </th>
User Type <th>
</a> Roles
</th> </th>
</tr> <th>
<a>
User Type
</a>
</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let u of users"> <tr *ngFor="let u of users">
<td> <td>
{{u.username}} <input type="checkbox" [(ngModel)]="u.checked">
</td> </td>
<td> <td>
{{u.alias}} {{u.username}}
</td> </td>
<td> <td>
{{u.emailAddress}} {{u.alias}}
</td> </td>
<td> <td>
<div *ngFor="let claim of u.claims"><span *ngIf="claim.enabled">{{claim.value}}</span></div> {{u.emailAddress}}
</td>
<td>
<div *ngFor="let claim of u.claims">
<span *ngIf="claim.enabled">{{claim.value}}</span>
</div>
</td> </td>
<td ng-hide="hideColumns"> <td ng-hide="hideColumns">
<span *ngIf="u.userType === 1">Local User</span> <span *ngIf="u.userType === 1">Local User</span>
<span *ngIf="u.userType === 2">Plex User</span> <span *ngIf="u.userType === 2">Plex User</span>
<span *ngIf="u.userType === 3">Emby User</span> <span *ngIf="u.userType === 3">Emby User</span>
</td> </td>
<td> <td>
<a [routerLink]="['/usermanagement/edit/' + u.id]" class="btn btn-sm btn-info-outline">Details/Edit</a> <a [routerLink]="['/usermanagement/edit/' + u.id]" class="btn btn-sm btn-info-outline">Details/Edit</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -98,14 +108,14 @@
<input type="text" [(ngModel)]="selectedUser.alias" class="form-control form-control-custom " id="alias" name="alias" value="{{selectedUser?.alias}}"> <input type="text" [(ngModel)]="selectedUser.alias" class="form-control form-control-custom " id="alias" name="alias" value="{{selectedUser?.alias}}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="alias" class="control-label">Email Address</label> <label for="alias" class="control-label">Email Address</label>
<div> <div>
<input type="text" [(ngModel)]="selectedUser.emailAddress" class="form-control form-control-custom " id="emailAddress" name="emailAddress" value="{{selectedUser?.emailAddress}}"> <input type="text" [(ngModel)]="selectedUser.emailAddress" class="form-control form-control-custom " id="emailAddress" name="emailAddress" value="{{selectedUser?.emailAddress}}">
</div> </div>
</div> </div>
<div *ngFor="let c of selectedUser.claims"> <div *ngFor="let c of selectedUser.claims">
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
@ -115,8 +125,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View file

@ -4,7 +4,7 @@ import { IUser } from '../interfaces/IUser';
import { IdentityService } from '../services/identity.service'; import { IdentityService } from '../services/identity.service';
@Component({ @Component({
templateUrl: './usermanagement.component.html' templateUrl: './usermanagement.component.html'
}) })
export class UserManagementComponent implements OnInit { export class UserManagementComponent implements OnInit {
@ -19,6 +19,12 @@ export class UserManagementComponent implements OnInit {
} }
users: IUser[]; users: IUser[];
checkAll = false;
checkAllBoxes() {
this.checkAll = !this.checkAll;
this.users.forEach(user => {
user.checked = this.checkAll;
});
}
} }

View file

@ -2,6 +2,7 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MultiSelectModule } from 'primeng/primeng';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@ -28,6 +29,7 @@ const routes: Routes = [
ReactiveFormsModule, ReactiveFormsModule,
RouterModule.forChild(routes), RouterModule.forChild(routes),
NgbModule.forRoot(), NgbModule.forRoot(),
MultiSelectModule
], ],
declarations: [ declarations: [
UserManagementComponent, UserManagementComponent,
@ -41,6 +43,6 @@ const routes: Routes = [
providers: [ providers: [
IdentityService IdentityService
], ],
}) })
export class UserManagementModule { } export class UserManagementModule { }