1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

feat: lifecycle column text (#9731)

This commit is contained in:
Mateusz Kwasniewski 2025-04-09 13:44:32 +02:00 committed by GitHub
parent 02aadfe1bb
commit f26bf2b8d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 12 deletions

View File

@ -38,6 +38,7 @@ interface IFeatureLifecycleProps {
onComplete?: () => void;
onUncomplete?: () => void;
onArchive?: () => void;
expanded?: boolean;
}
export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
@ -45,6 +46,7 @@ export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
onComplete,
onUncomplete,
onArchive,
expanded,
...rest
}) => {
const environments = feature.environments
@ -58,6 +60,7 @@ export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
onComplete={onComplete}
onUncomplete={onUncomplete}
feature={feature}
expanded={expanded}
/>
</Box>
);

View File

@ -182,12 +182,13 @@ export const FeatureToggleListTable: FC = () => {
cell: ({ row: { original } }) => (
<FeatureLifecycleCell
feature={original}
expanded
data-loading
/>
),
enableSorting: false, // FIXME: enable sorting by lifecycle
size: 50,
meta: { align: 'center', width: '1%' },
meta: { width: '1%' },
}),
columnHelper.accessor('project', {
header: 'Project',

View File

@ -5,6 +5,8 @@ import { populateCurrentStage } from './populateCurrentStage';
import type { FC } from 'react';
import type { Lifecycle } from 'interfaces/featureToggle';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import { getFeatureLifecycleName } from 'component/common/FeatureLifecycle/getFeatureLifecycleName';
import { Box } from '@mui/material';
export interface LifecycleFeature {
lifecycle?: Lifecycle;
@ -23,7 +25,8 @@ export const FeatureLifecycle: FC<{
onComplete?: () => void;
onUncomplete?: () => void;
feature: LifecycleFeature;
}> = ({ feature, onComplete, onUncomplete, onArchive }) => {
expanded?: boolean;
}> = ({ feature, expanded, onComplete, onUncomplete, onArchive }) => {
const currentStage = populateCurrentStage(feature);
const { markFeatureUncompleted, loading } = useFeatureLifecycleApi();
const { trackEvent } = usePlausibleTracker();
@ -39,15 +42,20 @@ export const FeatureLifecycle: FC<{
};
return currentStage ? (
<FeatureLifecycleTooltip
stage={currentStage!}
project={feature.project}
onArchive={onArchive}
onComplete={onComplete}
onUncomplete={onUncomplete ? onUncompleteHandler : undefined}
loading={loading}
>
<FeatureLifecycleStageIcon stage={currentStage} />
</FeatureLifecycleTooltip>
<Box sx={(theme) => ({ display: 'flex', gap: theme.spacing(0.5) })}>
<FeatureLifecycleTooltip
stage={currentStage!}
project={feature.project}
onArchive={onArchive}
onComplete={onComplete}
onUncomplete={onUncomplete ? onUncompleteHandler : undefined}
loading={loading}
>
<FeatureLifecycleStageIcon stage={currentStage} />
</FeatureLifecycleTooltip>{' '}
<p>
{expanded ? getFeatureLifecycleName(currentStage.name) : null}
</p>
</Box>
) : null;
};