Skip to content

Commit b016e39

Browse files
committed
Remove unnecessary validation code #75
1 parent f1ac222 commit b016e39

File tree

12 files changed

+15
-104
lines changed

12 files changed

+15
-104
lines changed

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

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { RoleServiceProxy, CreateRoleDto, ListResultDtoOfPermissionDto } from '@
44
import { AppComponentBase } from '@shared/app-component-base';
55

66
@Component({
7-
selector: 'create-role-modal',
8-
templateUrl: './create-role.component.html'
7+
selector: 'create-role-modal',
8+
templateUrl: './create-role.component.html'
99
})
1010
export class CreateRoleComponent extends AppComponentBase implements OnInit {
11-
@ViewChild('createRoleModal') modal: ModalDirective;
12-
@ViewChild('modalContent') modalContent: ElementRef;
11+
@ViewChild('createRoleModal') modal: ModalDirective;
12+
@ViewChild('modalContent') modalContent: ElementRef;
1313

1414
active: boolean = false;
1515
saving: boolean = false;
@@ -27,8 +27,7 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit {
2727

2828
ngOnInit(): void {
2929
this._roleService.getAllPermissions()
30-
.subscribe((permissions:ListResultDtoOfPermissionDto) =>
31-
{
30+
.subscribe((permissions: ListResultDtoOfPermissionDto) => {
3231
this.permissions = permissions;
3332
});
3433
}
@@ -42,31 +41,20 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit {
4241

4342
onShown(): void {
4443
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
45-
46-
$('#frm_create_role').validate({
47-
highlight: input => {
48-
$(input).parents('.form-line').addClass('error');
49-
},
50-
unhighlight: input => {
51-
$(input).parents('.form-line').removeClass('error');
52-
},
53-
errorPlacement: (error, element) => {
54-
$(element).parents('.form-group').append(error);
55-
}
56-
});
5744
}
5845

5946
save(): void {
6047
var permissions = [];
6148
$(this.modalContent.nativeElement).find("[name=permission]").each(
6249
(index: number, elem: Element) => {
63-
if ($(elem).is(":checked") == true) {
50+
if ($(elem).is(":checked")) {
6451
permissions.push(elem.getAttribute("value").valueOf());
6552
}
6653
}
6754
);
6855

6956
this.role.permissions = permissions;
57+
7058
this.saving = true;
7159
this._roleService.create(this.role)
7260
.finally(() => { this.saving = false; })

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<span aria-hidden="true">&times;</span>
1111
</button>
1212
<h4 class="modal-title">
13-
<span>{{l("EditRole")}}</span>
13+
<span>{{l("EditRole")}} <span *ngIf="role.isStatic"> (<span style="color:red">static</span>)</span></span>
1414
</h4>
1515
</div>
1616
<div class="modal-body">
@@ -48,12 +48,6 @@ <h4 class="modal-title">
4848
</div>
4949
</div>
5050

51-
<div class="row" *ngIf="role.isStatic">
52-
<div class="col-sm-12">
53-
<p style="color:red">Static Role</p>
54-
</div>
55-
</div>
56-
5751
<div class="row clearfix">
5852
<div class="col-sm-12">
5953
<h4>Permissions</h4>

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,6 @@ export class EditRoleComponent extends AppComponentBase implements OnInit {
4646

4747
onShown(): void {
4848
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
49-
50-
$('#frm_edit_role').validate({
51-
highlight: function (input) {
52-
$(input).parents('.form-line').addClass('error');
53-
},
54-
unhighlight: function (input) {
55-
$(input).parents('.form-line').removeClass('error');
56-
},
57-
errorPlacement: function (error, element) {
58-
$(element).parents('.form-group').append(error);
59-
}
60-
});
6149
}
6250

6351
checkPermission(permissionName: string): string {

angular/src/app/roles/roles.component.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,14 @@ <h2>
2323
<thead>
2424
<tr>
2525
<th>{{l('RoleName')}}</th>
26-
<th>{{l('Description')}}</th>
27-
<th>
28-
<div style="text-align:center">{{l('IsActive')}}</div>
29-
</th>
26+
<th>{{l('DisplayName')}}</th>
3027
<th>{{l('Actions')}}</th>
3128
</tr>
3229
</thead>
3330
<tbody>
3431
<tr *ngFor="let role of roles | paginate: { id: 'server', itemsPerPage: pageSize, currentPage: pageNumber, totalItems: totalItems }">
32+
<td>{{role.name}}</td>
3533
<td>{{role.displayName}}</td>
36-
<td>{{role.description}}</td>
37-
<td align="center">
38-
<i class="material-icons" *ngIf="role.isActive" style="color:green;">check_box</i>
39-
<i class="material-icons" *ngIf="!role.isActive" style="color:red;">indeterminate_check_box</i>
40-
</td>
4134
<td class="dropdown">
4235
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
4336
<i class="material-icons">menu</i>

angular/src/app/tenants/create-tenant/create-tenant.component.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ export class CreateTenantComponent extends AppComponentBase {
3535

3636
onShown(): void {
3737
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
38-
39-
$('#frm_create_tenant').validate({
40-
highlight: input => {
41-
$(input).parents('.form-line').addClass('error');
42-
},
43-
unhighlight: input => {
44-
$(input).parents('.form-line').removeClass('error');
45-
},
46-
errorPlacement: (error, element) => {
47-
$(element).parents('.form-group').append(error);
48-
}
49-
});
5038
}
5139

5240
save(): void {

angular/src/app/tenants/edit-tenant/edit-tenant.component.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ export class EditTenantComponent extends AppComponentBase{
4040

4141
onShown(): void {
4242
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
43-
44-
$('#frm_edit_tenant').validate({
45-
highlight(input) {
46-
$(input).parents('.form-line').addClass('error');
47-
},
48-
unhighlight(input) {
49-
$(input).parents('.form-line').removeClass('error');
50-
},
51-
errorPlacement(error, element) {
52-
$(element).parents('.form-group').append(error);
53-
}
54-
});
5543
}
5644

5745
save(): void {

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ export class CreateUserComponent extends AppComponentBase implements OnInit {
4343

4444
onShown(): void {
4545
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
46-
47-
$('#frm_create_user').validate({
48-
highlight: input => {
49-
$(input).parents('.form-line').addClass('error');
50-
},
51-
unhighlight: input => {
52-
$(input).parents('.form-line').removeClass('error');
53-
},
54-
errorPlacement: (error, element) => {
55-
$(element).parents('.form-group').append(error);
56-
}
57-
});
5846
}
5947

6048
save(): void {

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,12 @@ export class EditUserComponent extends AppComponentBase {
5656

5757
onShown(): void {
5858
$.AdminBSB.input.activate($(this.modalContent.nativeElement));
59-
$('#frm_edit_user').validate({
60-
highlight: input => {
61-
$(input).parents('.form-line').addClass('error');
62-
},
63-
unhighlight: input => {
64-
$(input).parents('.form-line').removeClass('error');
65-
},
66-
errorPlacement: (error, element) => {
67-
$(element).parents('.form-group').append(error);
68-
}
69-
});
7059
}
7160

7261
save(): void {
7362
var roles = [];
7463
$(this.modalContent.nativeElement).find("[name=role]").each(function(ind:number, elem:Element){
75-
if($(elem).is(":checked") == true){
64+
if($(elem).is(":checked")){
7665
roles.push(elem.getAttribute("value").valueOf());
7766
}
7867
});

angular/src/shared/service-proxies/service-proxies.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,6 @@ export class CreateRoleDto {
13971397
displayName: string;
13981398
normalizedName: string;
13991399
description: string;
1400-
isActive: boolean;
14011400
isStatic: boolean;
14021401
permissions: string[];
14031402
constructor(data?: any) {
@@ -1406,7 +1405,6 @@ export class CreateRoleDto {
14061405
this.displayName = data["displayName"] !== undefined ? data["displayName"] : null;
14071406
this.normalizedName = data["normalizedName"] !== undefined ? data["normalizedName"] : null;
14081407
this.description = data["description"] !== undefined ? data["description"] : null;
1409-
this.isActive = data["isActive"] !== undefined ? data["isActive"] : null;
14101408
this.isStatic = data["isStatic"] !== undefined ? data["isStatic"] : null;
14111409
if (data["permissions"] && data["permissions"].constructor === Array) {
14121410
this.permissions = [];
@@ -1426,7 +1424,6 @@ export class CreateRoleDto {
14261424
data["displayName"] = this.displayName !== undefined ? this.displayName : null;
14271425
data["normalizedName"] = this.normalizedName !== undefined ? this.normalizedName : null;
14281426
data["description"] = this.description !== undefined ? this.description : null;
1429-
data["isActive"] = this.isActive !== undefined ? this.isActive : null;
14301427
data["isStatic"] = this.isStatic !== undefined ? this.isStatic : null;
14311428
if (this.permissions && this.permissions.constructor === Array) {
14321429
data["permissions"] = [];
@@ -2062,8 +2059,7 @@ export class CreateUserDto {
20622059
emailAddress: string;
20632060
isActive: boolean;
20642061
roles: string[];
2065-
password: string;
2066-
confirmPassword: string;
2062+
password: string;
20672063
constructor(data?: any) {
20682064
if (data !== undefined) {
20692065
this.userName = data["userName"] !== undefined ? data["userName"] : null;
@@ -2077,7 +2073,6 @@ export class CreateUserDto {
20772073
this.roles.push(item);
20782074
}
20792075
this.password = data["password"] !== undefined ? data["password"] : null;
2080-
this.confirmPassword = data["confirmPassword"] !== undefined ? data["confirmPassword"] : null;
20812076
}
20822077
}
20832078

@@ -2098,7 +2093,6 @@ export class CreateUserDto {
20982093
data["roles"].push(item);
20992094
}
21002095
data["password"] = this.password !== undefined ? this.password : null;
2101-
data["confirmPassword"] = this.confirmPassword !== undefined ? this.confirmPassword : null;
21022096
return data;
21032097
}
21042098

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Roles/Dto/CreateRoleDto.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public class CreateRoleDto
2323
[StringLength(Role.MaxDescriptionLength)]
2424
public string Description { get; set; }
2525

26-
public bool IsActive { get; set; }
27-
2826
public bool IsStatic { get; set; }
2927

3028
public List<string> Permissions { get; set; }

0 commit comments

Comments
 (0)