1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat: archived toggles do not show switch (#8696)

Archived toggles will not show switch anymore, but a dash.

![Screenshot from 2024-11-08
11-41-17](https://github.com/user-attachments/assets/d43de8ff-13c3-4f70-8f8f-b7e5bbc4d0bc)
This commit is contained in:
Jaanus Sellin 2024-11-08 12:27:41 +02:00 committed by GitHub
parent b4fde58fa0
commit 5733f91347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,12 @@ const StyledSwitchContainer = styled('div', {
}), }),
})); }));
const StyledDiv = styled('div')(({ theme }) => ({
flexGrow: 0,
...flexRow,
justifyContent: 'center',
}));
interface IFeatureToggleCellProps { interface IFeatureToggleCellProps {
projectId: string; projectId: string;
environmentName: string; environmentName: string;
@ -90,3 +96,6 @@ export const PlaceholderFeatureToggleCell = () => (
<div data-loading>toggle</div> <div data-loading>toggle</div>
</StyledSwitchContainer> </StyledSwitchContainer>
); );
export const ArchivedFeatureToggleCell = () => (
<StyledDiv aria-hidden='true'>-</StyledDiv>
);

View File

@ -26,6 +26,7 @@ import { createColumnHelper, useReactTable } from '@tanstack/react-table';
import { withTableState } from 'utils/withTableState'; import { withTableState } from 'utils/withTableState';
import type { FeatureSearchResponseSchema } from 'openapi'; import type { FeatureSearchResponseSchema } from 'openapi';
import { import {
ArchivedFeatureToggleCell,
FeatureToggleCell, FeatureToggleCell,
PlaceholderFeatureToggleCell, PlaceholderFeatureToggleCell,
} from './FeatureToggleCell/FeatureToggleCell'; } from './FeatureToggleCell/FeatureToggleCell';
@ -292,6 +293,7 @@ export const ProjectFeatureToggles = ({
return columnHelper.accessor( return columnHelper.accessor(
(row) => ({ (row) => ({
archived: row.archivedAt !== null,
featureId: row.name, featureId: row.name,
environment: row.environments?.find( environment: row.environments?.find(
(featureEnvironment) => (featureEnvironment) =>
@ -317,10 +319,13 @@ export const ProjectFeatureToggles = ({
featureId, featureId,
environment, environment,
someEnabledEnvironmentHasVariants, someEnabledEnvironmentHasVariants,
archived,
} = getValue(); } = getValue();
return isPlaceholder ? ( return isPlaceholder ? (
<PlaceholderFeatureToggleCell /> <PlaceholderFeatureToggleCell />
) : archived ? (
<ArchivedFeatureToggleCell />
) : ( ) : (
<FeatureToggleCell <FeatureToggleCell
value={environment?.enabled || false} value={environment?.enabled || false}