1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-09 11:14:29 +02:00

feat: Last seen per environment feature toggle list

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
andreas-unleash 2023-08-21 15:22:29 +03:00
parent 31104183ac
commit 70c07b19ac
No known key found for this signature in database
GPG Key ID: DB82A1577B38F66B

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 {