1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +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; onComplete?: () => void;
onUncomplete?: () => void; onUncomplete?: () => void;
onArchive?: () => void; onArchive?: () => void;
expanded?: boolean;
} }
export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({ export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
@ -45,6 +46,7 @@ export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
onComplete, onComplete,
onUncomplete, onUncomplete,
onArchive, onArchive,
expanded,
...rest ...rest
}) => { }) => {
const environments = feature.environments const environments = feature.environments
@ -58,6 +60,7 @@ export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
onComplete={onComplete} onComplete={onComplete}
onUncomplete={onUncomplete} onUncomplete={onUncomplete}
feature={feature} feature={feature}
expanded={expanded}
/> />
</Box> </Box>
); );

View File

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

View File

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