Skip to content

Commit 76aaa74

Browse files
scastillo-jpLEON12699
authored andcommitted
feat: TT-190create feature toggle in azure
1 parent 01cb3ac commit 76aaa74

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

src/app/modules/users/components/users-list/users-list.component.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,35 @@
1919
<td class="col-4 text-break">{{ user.email }}</td>
2020
<td class="col-5 text-break">{{ user.name }}</td>
2121
<td class="col-3 text-center">
22-
<div *ngIf="flakyToggle; else elseBlock">
22+
<div *ngIf="isUserGroupsToggleOn">
2323
<ui-switch
2424
size="small"
2525
(change)="switchGroup(user.id, user.groups, 'time-tracker-admin')"
2626
[checked]="user.groups.includes('time-tracker-admin')"
2727
></ui-switch>
28-
admin
28+
group admin
2929
<ui-switch
3030
size="small"
3131
(change)="switchGroup(user.id, user.groups, 'time-tracker-tester')"
3232
[checked]="user.groups.includes('time-tracker-tester')"
3333
></ui-switch>
34-
test
34+
group test
3535
</div>
36-
<ng-template #elseBlock>
37-
<div>
38-
<ui-switch
39-
size="small"
40-
(change)="switchRole(user.id, user.roles, 'admin','time-tracker-admin')"
41-
[checked]="user.roles.includes('time-tracker-admin')"
42-
></ui-switch>
43-
admin
44-
<ui-switch
45-
size="small"
46-
(change)="switchRole(user.id, user.roles,'tester','time-tracker-tester')"
47-
[checked]="user.roles.includes('time-tracker-tester')"
48-
></ui-switch>
49-
test
50-
</div>
51-
</ng-template>
5236

37+
<div *ngIf="!isUserGroupsToggleOn">
38+
<ui-switch
39+
size="small"
40+
(change)="switchRole(user.id, user.roles, 'admin','time-tracker-admin')"
41+
[checked]="user.roles.includes('time-tracker-admin')"
42+
></ui-switch>
43+
admin
44+
<ui-switch
45+
size="small"
46+
(change)="switchRole(user.id, user.roles,'tester','time-tracker-tester')"
47+
[checked]="user.roles.includes('time-tracker-tester')"
48+
></ui-switch>
49+
test
50+
</div>
5351
</td>
5452
</tr>
5553
</tbody>

src/app/modules/users/components/users-list/users-list.component.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
3131
dtOptions: any = {};
3232
switchGroupsSubscription: Subscription;
3333
isEnableToggleSubscription: Subscription;
34-
isUserGroupsToggleOn;
35-
flakyToggle = true; // borrar para implementar feature toggle
34+
isUserGroupsToggleOn: boolean;
3635

3736
constructor(
3837
private store: Store<User>,
@@ -53,7 +52,6 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
5352

5453
this.isEnableToggleSubscription = this.isFeatureToggleActivated().subscribe((flag) => {
5554
this.isUserGroupsToggleOn = flag;
56-
console.log('in subscription', this.isUserGroupsToggleOn);
5755
});
5856

5957
this.switchGroupsSubscription = this.actionsSubject$
@@ -105,8 +103,8 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
105103

106104
switchRole(userId: string, userRoles: string[], roleId: string, roleValue: string) {
107105
userRoles.includes(roleValue)
108-
? this.store.dispatch(new RevokeRoleUser(userId, roleId))
109-
: this.store.dispatch(new GrantRoleUser(userId, roleId));
106+
? this.store.dispatch(new RevokeRoleUser(userId, roleId))
107+
: this.store.dispatch(new GrantRoleUser(userId, roleId));
110108
}
111109

112110
switchGroup(userId: string, userGroups: string[], groupName: string) {

0 commit comments

Comments
 (0)