mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: Open-Source Strategy Constraints (#2112)
This commits lift the flags and makes Strategy Constraints available to all users of Unleash. Read more in the docs: https://docs.getunleash.io/advanced/strategy_constraints Enjoy! @ivarconr Author and maintainer
This commit is contained in:
		
							parent
							
								
									9ba441b9cf
								
							
						
					
					
						commit
						ef965d66de
					
				| @ -141,23 +141,13 @@ export const FeatureStrategyForm = ({ | ||||
|                     /> | ||||
|                 } | ||||
|             /> | ||||
|             <ConditionallyRender | ||||
|                 condition={Boolean(uiConfig.flags.C || uiConfig.flags.CO)} | ||||
|                 show={ | ||||
|                     <FeatureStrategyConstraints | ||||
|                         projectId={feature.project} | ||||
|                         environmentId={environmentId} | ||||
|                         strategy={strategy} | ||||
|                         setStrategy={setStrategy} | ||||
|                     /> | ||||
|                 } | ||||
|             /> | ||||
|             <ConditionallyRender | ||||
|                 condition={Boolean( | ||||
|                     uiConfig.flags.SE || uiConfig.flags.C || uiConfig.flags.CO | ||||
|                 )} | ||||
|                 show={<hr className={styles.hr} />} | ||||
|             <FeatureStrategyConstraints | ||||
|                 projectId={feature.project} | ||||
|                 environmentId={environmentId} | ||||
|                 strategy={strategy} | ||||
|                 setStrategy={setStrategy} | ||||
|             /> | ||||
|             <hr className={styles.hr} /> | ||||
|             <FeatureStrategyType | ||||
|                 strategy={strategy} | ||||
|                 strategyDefinition={strategyDefinition} | ||||
|  | ||||
| @ -147,7 +147,6 @@ exports[`returns all baseRoutes 1`] = ` | ||||
|   }, | ||||
|   { | ||||
|     "component": [Function], | ||||
|     "flag": "C", | ||||
|     "menu": {}, | ||||
|     "parent": "/context", | ||||
|     "path": "/context/create", | ||||
| @ -156,7 +155,6 @@ exports[`returns all baseRoutes 1`] = ` | ||||
|   }, | ||||
|   { | ||||
|     "component": [Function], | ||||
|     "flag": "C", | ||||
|     "menu": {}, | ||||
|     "parent": "/context", | ||||
|     "path": "/context/edit/:name", | ||||
| @ -165,7 +163,6 @@ exports[`returns all baseRoutes 1`] = ` | ||||
|   }, | ||||
|   { | ||||
|     "component": [Function], | ||||
|     "flag": "C", | ||||
|     "menu": { | ||||
|       "advanced": true, | ||||
|       "mobile": true, | ||||
|  | ||||
| @ -9,7 +9,7 @@ import AdminUsers from 'component/admin/users/UsersAdmin'; | ||||
| import { GroupsAdmin } from 'component/admin/groups/GroupsAdmin'; | ||||
| import { AuthSettings } from 'component/admin/auth/AuthSettings'; | ||||
| import Login from 'component/user/Login/Login'; | ||||
| import { C, EEA, P, RE, SE, UG } from 'component/common/flags'; | ||||
| import { EEA, P, RE, SE, UG } from 'component/common/flags'; | ||||
| import { NewUser } from 'component/user/NewUser/NewUser'; | ||||
| import ResetPassword from 'component/user/ResetPassword/ResetPassword'; | ||||
| import ForgottenPassword from 'component/user/ForgottenPassword/ForgottenPassword'; | ||||
| @ -203,7 +203,6 @@ export const routes: IRoute[] = [ | ||||
|         title: 'Create', | ||||
|         component: CreateUnleashContextPage, | ||||
|         type: 'protected', | ||||
|         flag: C, | ||||
|         menu: {}, | ||||
|     }, | ||||
|     { | ||||
| @ -212,7 +211,6 @@ export const routes: IRoute[] = [ | ||||
|         title: ':name', | ||||
|         component: EditContext, | ||||
|         type: 'protected', | ||||
|         flag: C, | ||||
|         menu: {}, | ||||
|     }, | ||||
|     { | ||||
| @ -220,7 +218,6 @@ export const routes: IRoute[] = [ | ||||
|         title: 'Context fields', | ||||
|         component: ContextList, | ||||
|         type: 'protected', | ||||
|         flag: C, | ||||
|         menu: { mobile: true, advanced: true }, | ||||
|     }, | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,6 @@ import { useAuthSplash } from 'hooks/api/getters/useAuth/useAuthSplash'; | ||||
| import { useLocation, Navigate } from 'react-router-dom'; | ||||
| import { matchPath } from 'react-router'; | ||||
| import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; | ||||
| import { IFlags } from 'interfaces/uiConfig'; | ||||
| import { IAuthSplash } from 'hooks/api/getters/useAuth/useAuthEndpoint'; | ||||
| import { activeSplashIds, SplashId } from 'component/splash/splash'; | ||||
| import { useAuthUser } from 'hooks/api/getters/useAuth/useAuthUser'; | ||||
| @ -31,10 +30,7 @@ export const SplashPageRedirect = () => { | ||||
| 
 | ||||
|     // Find the splash page to show (if any).
 | ||||
|     const showSplashId = activeSplashIds.find(splashId => { | ||||
|         return ( | ||||
|             isSplashRelevant(splashId, uiConfig.flags) && | ||||
|             !hasSeenSplashId(splashId, splash) | ||||
|         ); | ||||
|         return !hasSeenSplashId(splashId, splash); | ||||
|     }); | ||||
| 
 | ||||
|     if (!showSplashId) { | ||||
| @ -47,11 +43,3 @@ export const SplashPageRedirect = () => { | ||||
| const hasSeenSplashId = (splashId: SplashId, splash: IAuthSplash): boolean => { | ||||
|     return Boolean(splash[splashId]); | ||||
| }; | ||||
| 
 | ||||
| const isSplashRelevant = (splashId: SplashId, flags: IFlags): boolean => { | ||||
|     if (splashId === 'operators') { | ||||
|         return Boolean(flags.C || flags.CO); | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
| }; | ||||
|  | ||||
| @ -3070,15 +3070,10 @@ camelcase@^6.2.0: | ||||
|   resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" | ||||
|   integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== | ||||
| 
 | ||||
| caniuse-lite@^1.0.30001317: | ||||
|   version "1.0.30001325" | ||||
|   resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001325.tgz#2b4ad19b77aa36f61f2eaf72e636d7481d55e606" | ||||
|   integrity sha512-sB1bZHjseSjDtijV1Hb7PB2Zd58Kyx+n/9EotvZ4Qcz2K3d0lWB8dB4nb8wN/TsOGFq3UuAm0zQZNQ4SoR7TrQ== | ||||
| 
 | ||||
| caniuse-lite@^1.0.30001332: | ||||
|   version "1.0.30001339" | ||||
|   resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001339.tgz#f9aece4ea8156071613b27791547ba0b33f176cf" | ||||
|   integrity sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ== | ||||
| caniuse-lite@^1.0.30001317, caniuse-lite@^1.0.30001332: | ||||
|   version "1.0.30001414" | ||||
|   resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001414.tgz" | ||||
|   integrity sha512-t55jfSaWjCdocnFdKQoO+d2ct9C59UZg4dY3OnUlSZ447r8pUtIKdp0hpAzrGFultmTC+Us+KpKi4GZl/LXlFg== | ||||
| 
 | ||||
| caseless@~0.12.0: | ||||
|   version "0.12.0" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user