1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

Feat: last seen toggle list (#4541)

Closes #
[1-1279](https://linear.app/unleash/issue/1-1279/update-the-feature-toggle-page-with-the-new-design)

![Screenshot 2023-08-21 at 15 39
54](https://github.com/Unleash/unleash/assets/104830839/bddf85b8-efd5-4bb3-8422-8682ceb96514)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
andreas-unleash 2023-08-21 15:49:33 +03:00 committed by GitHub
parent 6250064183
commit 3acff3e6d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ import { useEnvironments } from 'hooks/api/getters/useEnvironments/useEnvironmen
import { ExportDialog } from './ExportDialog'; import { ExportDialog } from './ExportDialog';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { focusable } from 'themes/themeStyles'; import { focusable } from 'themes/themeStyles';
import { FeatureEnvironmentSeenCell } from 'component/common/Table/cells/FeatureSeenCell/FeatureEnvironmentSeenCell';
export const featuresPlaceholder: FeatureSchema[] = Array(15).fill({ export const featuresPlaceholder: FeatureSchema[] = Array(15).fill({
name: 'Name of the feature', name: 'Name of the feature',
@ -69,6 +70,9 @@ export const FeatureToggleListTable: VFC = () => {
const { features = [], loading, refetchFeatures } = useFeatures(); const { features = [], loading, refetchFeatures } = useFeatures();
const [searchParams, setSearchParams] = useSearchParams(); const [searchParams, setSearchParams] = useSearchParams();
const { uiConfig } = useUiConfig(); const { uiConfig } = useUiConfig();
const showEnvironmentLastSeen = Boolean(
uiConfig.flags.lastSeenByEnvironment
);
const [initialState] = useState(() => ({ const [initialState] = useState(() => ({
sortBy: [ sortBy: [
{ {
@ -125,10 +129,15 @@ export const FeatureToggleListTable: VFC = () => {
{ {
Header: 'Seen', Header: 'Seen',
accessor: 'lastSeenAt', accessor: 'lastSeenAt',
Cell: FeatureSeenCell, Cell: ({ value, row: { original: feature } }: any) => {
sortType: 'date', return showEnvironmentLastSeen ? (
<FeatureEnvironmentSeenCell feature={feature} />
) : (
<FeatureSeenCell value={value} />
);
},
align: 'center', align: 'center',
maxWidth: 85, maxWidth: 80,
}, },
{ {
Header: 'Type', Header: 'Type',
@ -190,7 +199,7 @@ export const FeatureToggleListTable: VFC = () => {
searchable: true, searchable: true,
}, },
], ],
[isFavoritesPinned] [isFavoritesPinned, showEnvironmentLastSeen]
); );
const { const {