@@ -2,6 +2,7 @@ import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular
22import { ActionsSubject , select , Store } from '@ngrx/store' ;
33import { DataTableDirective } from 'angular-datatables' ;
44< < < << << HEAD
5+ < << << << HEAD
56import { Observable , Subject , Subscription } from 'rxjs ';
67import { delay , filter , map } from 'rxjs / operators ';
78import { FeatureManagerService } from 'src/app/modules/shared/feature-toggles/feature-toggle-manager.service' ;
@@ -21,6 +22,20 @@ import { FeatureManagerService } from 'src/app/modules/shared/feature-toggles/fe
2122import { User } from '../../models/users' ;
2223import { GrantRoleUser , LoadUsers , RevokeRoleUser , UserActionTypes , AddUserToGroup , RemoveUserToGroup } from '../../store/user.actions' ;
2324>>> >>> > fix : TT - 190 use add remove groups
25+ === = ===
26+ import { Observable, Subject, Subscription } from 'rxjs' ;
27+ import { delay , filter , map } from 'rxjs/operators' ;
28+ import { FeatureManagerService } from 'src/app/modules/shared/feature-toggles/feature-toggle-manager.service' ;
29+ import { User } from '../../models/users' ;
30+ import {
31+ GrantRoleUser ,
32+ LoadUsers ,
33+ RevokeRoleUser ,
34+ UserActionTypes ,
35+ AddUserToGroup ,
36+ RemoveUserToGroup ,
37+ } from '../../store/user.actions' ;
38+ > >>> >>> feat: TT - 190 Use add / remove groups endpoints in users section in UI
2439import { getIsLoading } from '../../store/user.selectors' ;
2540
2641@Component ( {
@@ -39,12 +54,17 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
3954 dtOptions : any = { } ;
4055 switchGroupsSubscription : Subscription ;
4156 isEnableToggleSubscription : Subscription ;
57+ < << << << HEAD
4258 isUserGroupsToggleOn : boolean ;
59+ === === =
60+ isUserGroupsToggleOn ;
61+ flakyToggle : boolean = false ; // borrar para implementar feature toggle
62+ > >>> >>> feat : TT - 190 Use add / remove groups endpoints in users section in UI
4363
4464 constructor (
4565 private store : Store < User > ,
4666 private actionsSubject$ : ActionsSubject ,
47- private featureManagerService : FeatureManagerService
67+ // private featureManagerService: FeatureManagerService
4868 ) {
4969 this . isLoading$ = store . pipe ( delay ( 0 ) , select ( getIsLoading ) ) ;
5070 }
@@ -58,9 +78,16 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
5878 this . rerenderDataTable ( ) ;
5979 } ) ;
6080
81+ < < < << << HEAD
6182 this . isEnableToggleSubscription = this. isFeatureToggleActivated ( ) . subscribe ( ( flag ) => {
6283 this . isUserGroupsToggleOn = flag ;
6384 } ) ;
85+ === = ===
86+ /* this.isEnableToggleSubscription = this.isFeatureToggleActivated().subscribe((flag) => {
87+ this.isUserGroupsToggleOn = flag;
88+ console.log('in subscription', this.isUserGroupsToggleOn);
89+ });*/
90+ > >>> > >> feat : TT - 190 Use add / remove groups endpoints in users section in UI
6491
6592 this . switchGroupsSubscription = this . actionsSubject$
6693 . pipe (
@@ -121,17 +148,32 @@ export class UsersListComponent implements OnInit, OnDestroy, AfterViewInit {
121148 : this . store . dispatch ( new AddUserToGroup ( userId , groupName ) ) ;
122149 }
123150
151+ < << << << HEAD
124152 isFeatureToggleActivated ( ) {
125153 return this . featureManagerService . isToggleEnabledForUser ( 'switch-group' ) . pipe (
154+ = === ===
155+ switchGroup ( userId : string , userGroups : string[ ] , groupName : string) {
156+ userGroups . includes ( groupName )
157+ ? this . store . dispatch ( new RemoveUserToGroup ( userId , groupName ) )
158+ : this . store . dispatch ( new AddUserToGroup ( userId , groupName ) ) ;
159+ }
160+
161+ /* isFeatureToggleActivated() {
162+ return this.featureManagerService.isToggleEnabledForUser('ui-list-technologies').pipe(
163+ >>>>>>> feat: TT-190 Use add/remove groups endpoints in users section in UI
126164 map((enabled) => {
127165 return enabled === true ? true : false;
128166 })
129167 );
168+ <<<<<<< HEAD
130169 }
131170
132171 switchGroups(userId: string, userGroups: string[], groupname: string, groupValue: string) {
133172 userGroups.includes(groupValue)
134173 ? this.store.dispatch(new RemoveUserFromGroup(userId, groupname))
135174 : this.store.dispatch(new AddUserToGroup(userId, groupname));
136175 }
176+ =======
177+ }*/
178+ > >>> >>> feat : TT - 190 Use add / remove groups endpoints in users section in UI
137179}
0 commit comments