mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-12 13:48:35 +02: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>
|
<BoldTitle>Is this feature complete?</BoldTitle>
|
||||||
<InfoText sx={{ mb: 1 }}>
|
<InfoText sx={{ mb: 1 }}>
|
||||||
Marking the feature as complete does not affect any
|
Marking the feature flag as complete does not affect any
|
||||||
configuration, but it moves the feature into it’s next life
|
configuration; however, it moves the feature flag to its next
|
||||||
cycle stage and is an indication that you have learned what you
|
lifecycle stage and indicates that you have learned what you
|
||||||
needed in order to progress with the feature. It serves as a
|
needed in order to progress with the feature. It serves as a
|
||||||
reminder to start cleaning up the flag and removing it from the
|
reminder to start cleaning up the feature flag and removing it
|
||||||
code.
|
from the code.
|
||||||
</InfoText>
|
</InfoText>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
color='inherit'
|
color='inherit'
|
||||||
|
@ -5,6 +5,7 @@ import { useState } from 'react';
|
|||||||
import useFeatureLifecycleApi from 'hooks/api/actions/useFeatureLifecycleApi/useFeatureLifecycleApi';
|
import useFeatureLifecycleApi from 'hooks/api/actions/useFeatureLifecycleApi/useFeatureLifecycleApi';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { SingleVariantOptions } from './SingleVariantOptions';
|
import { SingleVariantOptions } from './SingleVariantOptions';
|
||||||
|
import { useParentVariantOptions } from 'hooks/api/getters/useFeatureDependencyOptions/useFeatureDependencyOptions';
|
||||||
|
|
||||||
interface IMarkCompletedDialogueProps {
|
interface IMarkCompletedDialogueProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -24,6 +25,10 @@ export const MarkCompletedDialogue = ({
|
|||||||
onComplete,
|
onComplete,
|
||||||
}: IMarkCompletedDialogueProps) => {
|
}: IMarkCompletedDialogueProps) => {
|
||||||
const { markFeatureCompleted } = useFeatureLifecycleApi();
|
const { markFeatureCompleted } = useFeatureLifecycleApi();
|
||||||
|
const { parentVariantOptions: variantOptions } = useParentVariantOptions(
|
||||||
|
projectId,
|
||||||
|
featureId,
|
||||||
|
);
|
||||||
const [status, setStatus] = useState<Status>('kept');
|
const [status, setStatus] = useState<Status>('kept');
|
||||||
const [variant, setVariant] = useState<string | undefined>(undefined);
|
const [variant, setVariant] = useState<string | undefined>(undefined);
|
||||||
const onClick = async () => {
|
const onClick = async () => {
|
||||||
@ -96,18 +101,26 @@ export const MarkCompletedDialogue = ({
|
|||||||
}}
|
}}
|
||||||
control={<Radio />}
|
control={<Radio />}
|
||||||
/>
|
/>
|
||||||
<LegalValueLabel
|
<ConditionallyRender
|
||||||
key={'kept-with-variant'}
|
condition={variantOptions.length > 0}
|
||||||
value={'kept-with-variant'}
|
show={
|
||||||
legal={{
|
<LegalValueLabel
|
||||||
value: 'We decided to keep the feature variant',
|
key={'kept-with-variant'}
|
||||||
description:
|
value={'kept-with-variant'}
|
||||||
'Choose to specify which feature variant will be kept',
|
legal={{
|
||||||
}}
|
value: 'We decided to keep the feature variant',
|
||||||
control={<Radio />}
|
description:
|
||||||
|
'Choose to specify which feature variant will be kept',
|
||||||
|
}}
|
||||||
|
control={<Radio />}
|
||||||
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={status === 'kept-with-variant'}
|
condition={
|
||||||
|
variantOptions.length > 0 &&
|
||||||
|
status === 'kept-with-variant'
|
||||||
|
}
|
||||||
show={
|
show={
|
||||||
<SingleVariantOptions
|
<SingleVariantOptions
|
||||||
parent={featureId}
|
parent={featureId}
|
||||||
|
@ -126,6 +126,7 @@ export const ProjectFeatureToggles = ({
|
|||||||
rowActionsDialogs,
|
rowActionsDialogs,
|
||||||
setFeatureArchiveState,
|
setFeatureArchiveState,
|
||||||
setFeatureStaleDialogState,
|
setFeatureStaleDialogState,
|
||||||
|
setShowMarkCompletedDialogue,
|
||||||
} = useRowActions(refetch, projectId);
|
} = useRowActions(refetch, projectId);
|
||||||
|
|
||||||
const isPlaceholder = Boolean(initialLoad || (loading && total));
|
const isPlaceholder = Boolean(initialLoad || (loading && total));
|
||||||
@ -206,7 +207,12 @@ export const ProjectFeatureToggles = ({
|
|||||||
show={
|
show={
|
||||||
<FeatureLifecycleCell
|
<FeatureLifecycleCell
|
||||||
feature={original}
|
feature={original}
|
||||||
onComplete={refetch}
|
onComplete={() => {
|
||||||
|
setShowMarkCompletedDialogue({
|
||||||
|
featureId: original.name,
|
||||||
|
open: true,
|
||||||
|
});
|
||||||
|
}}
|
||||||
onUncomplete={refetch}
|
onUncomplete={refetch}
|
||||||
onArchive={() =>
|
onArchive={() =>
|
||||||
setFeatureArchiveState(original.name)
|
setFeatureArchiveState(original.name)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog';
|
import { FeatureArchiveDialog } from 'component/common/FeatureArchiveDialog/FeatureArchiveDialog';
|
||||||
import { FeatureStaleDialog } from 'component/common/FeatureStaleDialog/FeatureStaleDialog';
|
import { FeatureStaleDialog } from 'component/common/FeatureStaleDialog/FeatureStaleDialog';
|
||||||
|
import { MarkCompletedDialogue } from 'component/feature/FeatureView/FeatureOverview/FeatureLifecycle/MarkCompletedDialogue';
|
||||||
|
|
||||||
export const useRowActions = (onChange: () => void, projectId: string) => {
|
export const useRowActions = (onChange: () => void, projectId: string) => {
|
||||||
const [featureArchiveState, setFeatureArchiveState] = useState<
|
const [featureArchiveState, setFeatureArchiveState] = useState<
|
||||||
@ -12,6 +13,13 @@ export const useRowActions = (onChange: () => void, projectId: string) => {
|
|||||||
stale?: boolean;
|
stale?: boolean;
|
||||||
}>({});
|
}>({});
|
||||||
|
|
||||||
|
const [showMarkCompletedDialogue, setShowMarkCompletedDialogue] = useState<{
|
||||||
|
featureId: string;
|
||||||
|
open: boolean;
|
||||||
|
}>({
|
||||||
|
featureId: 'default',
|
||||||
|
open: false,
|
||||||
|
});
|
||||||
const rowActionsDialogs = (
|
const rowActionsDialogs = (
|
||||||
<>
|
<>
|
||||||
<FeatureStaleDialog
|
<FeatureStaleDialog
|
||||||
@ -34,6 +42,18 @@ export const useRowActions = (onChange: () => void, projectId: string) => {
|
|||||||
featureIds={[featureArchiveState || '']}
|
featureIds={[featureArchiveState || '']}
|
||||||
projectId={projectId}
|
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,
|
rowActionsDialogs,
|
||||||
setFeatureArchiveState,
|
setFeatureArchiveState,
|
||||||
setFeatureStaleDialogState,
|
setFeatureStaleDialogState,
|
||||||
|
setShowMarkCompletedDialogue,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user