blob: ec7bb021445001e27bc22039e928e8e877d540b9 [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001import {NgRedux} from "@angular-redux/store";
2import {AppState} from "../../store/reducers";
3import {Injectable} from "@angular/core";
4
5export enum Features {
6 FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST='FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST',
7 FLAG_1902_NEW_VIEW_EDIT='FLAG_1902_NEW_VIEW_EDIT',
8 FLAG_1902_VNF_GROUPING='FLAG_1902_VNF_GROUPING',
9 FLAG_VF_MODULE_RESUME_STATUS_CREATE = 'FLAG_VF_MODULE_RESUME_STATUS_CREATE',
10 DRAG_AND_DROP_OPERATION = 'DRAG_AND_DROP_OPERATION',
11 FLAG_1906_COMPONENT_INFO = 'FLAG_1906_COMPONENT_INFO',
12}
13
14@Injectable()
15export class FeatureFlagsService {
16
17 constructor(private store: NgRedux<AppState>){}
18
19 public getFlagState(flag: Features):boolean {
20 return FeatureFlagsService.getFlagState(flag, this.store);
21 }
22
23 /*static method for easy refactoring of code, so no injection of FeatureFlagsService is needed*/
24 public static getFlagState(flag: Features, store: NgRedux<AppState>):boolean {
25 return store.getState().global.flags[flag];
26 }
27
28
29}