Skip to content

Commit 0dc9427

Browse files
committed
Refactor role and user pages.
1 parent 1d3e48a commit 0dc9427

File tree

13 files changed

+267
-207
lines changed

13 files changed

+267
-207
lines changed

angular/src/app/roles/create-role/create-role.component.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,6 @@ <h4 class="modal-title">
4747
</div>
4848
</div>
4949

50-
<div class="row">
51-
<div class="col-sm-12">
52-
<div class="form-group form-float">
53-
<div class="">
54-
<input id="isactive" type="checkbox" name="IsActive" [(ngModel)]="role.isActive" checked class="form-control" />
55-
<label for="isactive" class="form-label">{{l("IsActive")}}</label>
56-
</div>
57-
</div>
58-
</div>
59-
</div>
60-
6150
<div class="row clearfix">
6251
<div class="col-sm-12">
6352
<h4>Permissions</h4>

angular/src/app/roles/create-role/create-role.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit {
3535

3636
show(): void {
3737
this.active = true;
38-
this.role = new CreateRoleDto({ isActive: true, isStatic: false });
38+
this.role = new CreateRoleDto({ isStatic: false });
3939

4040
this.modal.show();
4141
}

angular/src/app/roles/edit-role/edit-role.component.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,6 @@ <h4 class="modal-title">
4848
</div>
4949
</div>
5050

51-
<div class="row">
52-
<div class="col-sm-12">
53-
<div class="form-group form-float">
54-
<div class="">
55-
<input id="isactive" [disabled]="role.isStatic" type="checkbox" name="IsActive" [(ngModel)]="role.isActive" checked class="form-control" />
56-
<label for="isactive" class="form-label">{{l("IsActive")}}</label>
57-
</div>
58-
</div>
59-
</div>
60-
</div>
61-
6251
<div class="row" *ngIf="role.isStatic">
6352
<div class="col-sm-12">
6453
<p style="color:red">Static Role</p>

angular/src/app/users/create-user/create-user.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
22
import { ModalDirective } from 'ngx-bootstrap';
3-
import { UserServiceProxy, RoleServiceProxy, CreateUserDto, RoleDto } from '@shared/service-proxies/service-proxies';
3+
import { UserServiceProxy, CreateUserDto, RoleDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
55

66
import * as _ from "lodash";
@@ -24,14 +24,12 @@ export class CreateUserComponent extends AppComponentBase implements OnInit {
2424
constructor(
2525
injector: Injector,
2626
private _userService: UserServiceProxy,
27-
private _roleService: RoleServiceProxy
2827
) {
2928
super(injector);
3029
}
3130

3231
ngOnInit(): void {
33-
//max of 1000 roles, todo: change to -1 for all
34-
this._roleService.getAll(0,1000)
32+
this._userService.getRoles()
3533
.subscribe((result) => {
3634
this.roles = result.items;
3735
});
@@ -60,6 +58,7 @@ export class CreateUserComponent extends AppComponentBase implements OnInit {
6058
}
6159

6260
save(): void {
61+
//TODO: Refactor this, don't use jQuery style code
6362
var roles = [];
6463
$(this.modalContent.nativeElement).find("[name=role]").each((ind:number, elem:Element) => {
6564
if($(elem).is(":checked") == true){

angular/src/app/users/edit-user/edit-user.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef } from '@angular/core';
22
import { ModalDirective } from 'ngx-bootstrap';
3-
import { UserServiceProxy, RoleServiceProxy, UserDto, RoleDto } from '@shared/service-proxies/service-proxies';
3+
import { UserServiceProxy, UserDto, RoleDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
55

66
import * as _ from "lodash";
@@ -24,8 +24,7 @@ export class EditUserComponent extends AppComponentBase {
2424

2525
constructor(
2626
injector: Injector,
27-
private _userService: UserServiceProxy,
28-
private _roleService: RoleServiceProxy
27+
private _userService: UserServiceProxy
2928
) {
3029
super(injector);
3130
}
@@ -40,7 +39,7 @@ export class EditUserComponent extends AppComponentBase {
4039
}
4140

4241
show(id:number): void {
43-
this._roleService.getAll(0,1000)
42+
this._userService.getRoles()
4443
.subscribe((result) => {
4544
this.roles = result.items;
4645
});

angular/src/shared/paged-listing-component-base.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-

2-
import { AppComponentBase } from "shared/app-component-base";
3-
import { Injector, Component, ViewEncapsulation, OnInit } from '@angular/core';
1+
import { AppComponentBase } from "shared/app-component-base";
2+
import { Injector, OnInit } from '@angular/core';
43

54
export class PagedResultDto {
65
items: any[];

0 commit comments

Comments
 (0)