mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: redirect to new feature flag creation (#7679)
Currently found only one instance that is using `create-toggle`. So changed behaviour for that.
This commit is contained in:
		
							parent
							
								
									049b26fb77
								
							
						
					
					
						commit
						4df8fd3810
					
				@ -9,6 +9,7 @@ import {
 | 
				
			|||||||
} from 'component/providers/AccessProvider/permissions';
 | 
					} from 'component/providers/AccessProvider/permissions';
 | 
				
			||||||
import { useContext } from 'react';
 | 
					import { useContext } from 'react';
 | 
				
			||||||
import AccessContext from 'contexts/AccessContext';
 | 
					import AccessContext from 'contexts/AccessContext';
 | 
				
			||||||
 | 
					import { useUiFlag } from 'hooks/useUiFlag';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const WarningContainer = styled(Box)(({ theme }) => ({
 | 
					const WarningContainer = styled(Box)(({ theme }) => ({
 | 
				
			||||||
    display: 'flex',
 | 
					    display: 'flex',
 | 
				
			||||||
@ -108,6 +109,7 @@ type ApplicationIssues =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
 | 
					const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
 | 
				
			||||||
    const { hasAccess } = useContext(AccessContext);
 | 
					    const { hasAccess } = useContext(AccessContext);
 | 
				
			||||||
 | 
					    const improveCreateFlagFlow = useUiFlag('improveCreateFlagFlow');
 | 
				
			||||||
    const length = features.length;
 | 
					    const length = features.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (length === 0) {
 | 
					    if (length === 0) {
 | 
				
			||||||
@ -128,12 +130,25 @@ const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
 | 
				
			|||||||
                        <ConditionallyRender
 | 
					                        <ConditionallyRender
 | 
				
			||||||
                            condition={hasAccess(CREATE_FEATURE)}
 | 
					                            condition={hasAccess(CREATE_FEATURE)}
 | 
				
			||||||
                            show={
 | 
					                            show={
 | 
				
			||||||
                                <StyledLink
 | 
					                                <ConditionallyRender
 | 
				
			||||||
                                    key={feature}
 | 
					                                    condition={improveCreateFlagFlow}
 | 
				
			||||||
                                    to={`/projects/default/create-toggle?name=${feature}`}
 | 
					                                    show={
 | 
				
			||||||
                                >
 | 
					                                        <StyledLink
 | 
				
			||||||
                                    Create feature flag
 | 
					                                            key={feature}
 | 
				
			||||||
                                </StyledLink>
 | 
					                                            to={`/projects/default?create=true&name=${feature}`}
 | 
				
			||||||
 | 
					                                        >
 | 
				
			||||||
 | 
					                                            Create feature flag
 | 
				
			||||||
 | 
					                                        </StyledLink>
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
 | 
					                                    elseShow={
 | 
				
			||||||
 | 
					                                        <StyledLink
 | 
				
			||||||
 | 
					                                            key={feature}
 | 
				
			||||||
 | 
					                                            to={`/projects/default/create-toggle?name=${feature}`}
 | 
				
			||||||
 | 
					                                        >
 | 
				
			||||||
 | 
					                                            Create feature flag
 | 
				
			||||||
 | 
					                                        </StyledLink>
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
 | 
					                                />
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        />
 | 
					                        />
 | 
				
			||||||
                    </IssueRowContainer>
 | 
					                    </IssueRowContainer>
 | 
				
			||||||
 | 
				
			|||||||
@ -46,6 +46,7 @@ const BreadcrumbNav = () => {
 | 
				
			|||||||
                item !== 'copy' &&
 | 
					                item !== 'copy' &&
 | 
				
			||||||
                item !== 'features' &&
 | 
					                item !== 'features' &&
 | 
				
			||||||
                item !== 'features2' &&
 | 
					                item !== 'features2' &&
 | 
				
			||||||
 | 
					                // TODO: this can be removed after new create flag flow goes live
 | 
				
			||||||
                item !== 'create-toggle' &&
 | 
					                item !== 'create-toggle' &&
 | 
				
			||||||
                item !== 'settings' &&
 | 
					                item !== 'settings' &&
 | 
				
			||||||
                item !== 'profile' &&
 | 
					                item !== 'profile' &&
 | 
				
			||||||
 | 
				
			|||||||
@ -197,6 +197,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
 | 
				
			|||||||
                    </StyledInputDescription>
 | 
					                    </StyledInputDescription>
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
 | 
					            // TODO: this can be removed after new create flag flow goes live
 | 
				
			||||||
            <FeatureProjectSelect
 | 
					            <FeatureProjectSelect
 | 
				
			||||||
                value={project}
 | 
					                value={project}
 | 
				
			||||||
                onChange={(projectId) => {
 | 
					                onChange={(projectId) => {
 | 
				
			||||||
@ -213,7 +214,6 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
 | 
				
			|||||||
                IconComponent={KeyboardArrowDownOutlined}
 | 
					                IconComponent={KeyboardArrowDownOutlined}
 | 
				
			||||||
                sx={styledSelectInput}
 | 
					                sx={styledSelectInput}
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
 | 
					 | 
				
			||||||
            <StyledInputDescription>
 | 
					            <StyledInputDescription>
 | 
				
			||||||
                How would you describe your feature flag?
 | 
					                How would you describe your feature flag?
 | 
				
			||||||
            </StyledInputDescription>
 | 
					            </StyledInputDescription>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user