mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: lifecycle improvements/fixes (#7044)
1. Now completed modal works from project view 2. Changed text for modal 3. Now variant selection will only appear if there are any variants
This commit is contained in:
		
							parent
							
								
									21961207ca
								
							
						
					
					
						commit
						4241e36819
					
				@ -273,12 +273,12 @@ const LiveStageDescription: FC<{
 | 
			
		||||
        <>
 | 
			
		||||
            <BoldTitle>Is this feature complete?</BoldTitle>
 | 
			
		||||
            <InfoText sx={{ mb: 1 }}>
 | 
			
		||||
                Marking the feature as complete does not affect any
 | 
			
		||||
                configuration, but it moves the feature into it’s next life
 | 
			
		||||
                cycle stage and is an indication that you have learned what you
 | 
			
		||||
                Marking the feature flag as complete does not affect any
 | 
			
		||||
                configuration; however, it moves the feature flag to its next
 | 
			
		||||
                lifecycle stage and indicates that you have learned what you
 | 
			
		||||
                needed in order to progress with the feature. It serves as a
 | 
			
		||||
                reminder to start cleaning up the flag and removing it from the
 | 
			
		||||
                code.
 | 
			
		||||
                reminder to start cleaning up the feature flag and removing it
 | 
			
		||||
                from the code.
 | 
			
		||||
            </InfoText>
 | 
			
		||||
            <PermissionButton
 | 
			
		||||
                color='inherit'
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,7 @@ import { useState } from 'react';
 | 
			
		||||
import useFeatureLifecycleApi from 'hooks/api/actions/useFeatureLifecycleApi/useFeatureLifecycleApi';
 | 
			
		||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
 | 
			
		||||
import { SingleVariantOptions } from './SingleVariantOptions';
 | 
			
		||||
import { useParentVariantOptions } from 'hooks/api/getters/useFeatureDependencyOptions/useFeatureDependencyOptions';
 | 
			
		||||
 | 
			
		||||
interface IMarkCompletedDialogueProps {
 | 
			
		||||
    isOpen: boolean;
 | 
			
		||||
@ -24,6 +25,10 @@ export const MarkCompletedDialogue = ({
 | 
			
		||||
    onComplete,
 | 
			
		||||
}: IMarkCompletedDialogueProps) => {
 | 
			
		||||
    const { markFeatureCompleted } = useFeatureLifecycleApi();
 | 
			
		||||
    const { parentVariantOptions: variantOptions } = useParentVariantOptions(
 | 
			
		||||
        projectId,
 | 
			
		||||
        featureId,
 | 
			
		||||
    );
 | 
			
		||||
    const [status, setStatus] = useState<Status>('kept');
 | 
			
		||||
    const [variant, setVariant] = useState<string | undefined>(undefined);
 | 
			
		||||
    const onClick = async () => {
 | 
			
		||||
@ -96,6 +101,9 @@ export const MarkCompletedDialogue = ({
 | 
			
		||||
                        }}
 | 
			
		||||
                        control={<Radio />}
 | 
			
		||||
                    />
 | 
			
		||||
                    <ConditionallyRender
 | 
			
		||||
                        condition={variantOptions.length > 0}
 | 
			
		||||
                        show={
 | 
			
		||||
                            <LegalValueLabel
 | 
			
		||||
                                key={'kept-with-variant'}
 | 
			
		||||
                                value={'kept-with-variant'}
 | 
			
		||||
@ -106,8 +114,13 @@ export const MarkCompletedDialogue = ({
 | 
			
		||||
                                }}
 | 
			
		||||
                                control={<Radio />}
 | 
			
		||||
                            />
 | 
			
		||||
                        }
 | 
			
		||||
                    />
 | 
			
		||||
                    <ConditionallyRender
 | 
			
		||||
                        condition={status === 'kept-with-variant'}
 | 
			
		||||
                        condition={
 | 
			
		||||
                            variantOptions.length > 0 &&
 | 
			
		||||
                            status === 'kept-with-variant'
 | 
			
		||||
                        }
 | 
			
		||||
                        show={
 | 
			
		||||
                            <SingleVariantOptions
 | 
			
		||||
                                parent={featureId}
 | 
			
		||||
 | 
			
		||||
@ -126,6 +126,7 @@ export const ProjectFeatureToggles = ({
 | 
			
		||||
        rowActionsDialogs,
 | 
			
		||||
        setFeatureArchiveState,
 | 
			
		||||
        setFeatureStaleDialogState,
 | 
			
		||||
        setShowMarkCompletedDialogue,
 | 
			
		||||
    } = useRowActions(refetch, projectId);
 | 
			
		||||
 | 
			
		||||
    const isPlaceholder = Boolean(initialLoad || (loading && total));
 | 
			
		||||
@ -206,7 +207,12 @@ export const ProjectFeatureToggles = ({
 | 
			
		||||
                        show={
 | 
			
		||||
                            <FeatureLifecycleCell
 | 
			
		||||
                                feature={original}
 | 
			
		||||
                                onComplete={refetch}
 | 
			
		||||
                                onComplete={() => {
 | 
			
		||||
                                    setShowMarkCompletedDialogue({
 | 
			
		||||
                                        featureId: original.name,
 | 
			
		||||
                                        open: true,
 | 
			
		||||
                                    });
 | 
			
		||||
                                }}
 | 
			
		||||
                                onUncomplete={refetch}
 | 
			
		||||
                                onArchive={() =>
 | 
			
		||||
                                    setFeatureArchiveState(original.name)
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
import { useState } from 'react';
 | 
			
		||||
import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog';
 | 
			
		||||
import { FeatureStaleDialog } from 'component/common/FeatureStaleDialog/FeatureStaleDialog';
 | 
			
		||||
import { MarkCompletedDialogue } from 'component/feature/FeatureView/FeatureOverview/FeatureLifecycle/MarkCompletedDialogue';
 | 
			
		||||
 | 
			
		||||
export const useRowActions = (onChange: () => void, projectId: string) => {
 | 
			
		||||
    const [featureArchiveState, setFeatureArchiveState] = useState<
 | 
			
		||||
@ -12,6 +13,13 @@ export const useRowActions = (onChange: () => void, projectId: string) => {
 | 
			
		||||
        stale?: boolean;
 | 
			
		||||
    }>({});
 | 
			
		||||
 | 
			
		||||
    const [showMarkCompletedDialogue, setShowMarkCompletedDialogue] = useState<{
 | 
			
		||||
        featureId: string;
 | 
			
		||||
        open: boolean;
 | 
			
		||||
    }>({
 | 
			
		||||
        featureId: 'default',
 | 
			
		||||
        open: false,
 | 
			
		||||
    });
 | 
			
		||||
    const rowActionsDialogs = (
 | 
			
		||||
        <>
 | 
			
		||||
            <FeatureStaleDialog
 | 
			
		||||
@ -34,6 +42,18 @@ export const useRowActions = (onChange: () => void, projectId: string) => {
 | 
			
		||||
                featureIds={[featureArchiveState || '']}
 | 
			
		||||
                projectId={projectId}
 | 
			
		||||
            />
 | 
			
		||||
            <MarkCompletedDialogue
 | 
			
		||||
                isOpen={showMarkCompletedDialogue.open}
 | 
			
		||||
                setIsOpen={(open) => {
 | 
			
		||||
                    setShowMarkCompletedDialogue({
 | 
			
		||||
                        ...showMarkCompletedDialogue,
 | 
			
		||||
                        open,
 | 
			
		||||
                    });
 | 
			
		||||
                }}
 | 
			
		||||
                projectId={projectId}
 | 
			
		||||
                featureId={showMarkCompletedDialogue.featureId}
 | 
			
		||||
                onComplete={onChange}
 | 
			
		||||
            />
 | 
			
		||||
        </>
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
@ -41,5 +61,6 @@ export const useRowActions = (onChange: () => void, projectId: string) => {
 | 
			
		||||
        rowActionsDialogs,
 | 
			
		||||
        setFeatureArchiveState,
 | 
			
		||||
        setFeatureStaleDialogState,
 | 
			
		||||
        setShowMarkCompletedDialogue,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user