mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
[Gitar] Cleaning up stale flag: timeAgoRefactor with value true (#7997)
Co-authored-by: Gitar <noreply@gitar.co> Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
This commit is contained in:
parent
3a9b9e9e55
commit
031a2e805a
@ -64,7 +64,6 @@
|
||||
"@types/react-router-dom": "5.3.3",
|
||||
"@types/react-table": "7.7.20",
|
||||
"@types/react-test-renderer": "18.3.0",
|
||||
"@types/react-timeago": "4.1.7",
|
||||
"@types/semver": "7.5.8",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"@uiw/codemirror-theme-duotone": "4.23.0",
|
||||
@ -111,7 +110,6 @@
|
||||
"react-router-dom": "6.16.0",
|
||||
"react-table": "7.8.0",
|
||||
"react-test-renderer": "18.3.1",
|
||||
"react-timeago": "7.2.0",
|
||||
"sass": "1.77.8",
|
||||
"semver": "7.6.3",
|
||||
"swr": "2.2.5",
|
||||
|
@ -14,9 +14,7 @@ const setupApi = (application: ApplicationOverviewSchema) => {
|
||||
application,
|
||||
);
|
||||
testServerRoute(server, '/api/admin/ui-config', {
|
||||
flags: {
|
||||
timeAgoRefactor: true,
|
||||
},
|
||||
flags: {},
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { vi } from 'vitest';
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import { NewTimeAgo as TimeAgo } from './TimeAgo';
|
||||
import { TimeAgo } from './TimeAgo';
|
||||
|
||||
const h = 3_600_000 as const;
|
||||
const min = 60_000 as const;
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { useEffect, useState, type FC } from 'react';
|
||||
import { formatDistanceToNow, secondsToMilliseconds } from 'date-fns';
|
||||
import { default as LegacyTimeAgo } from 'react-timeago';
|
||||
import { useUiFlag } from 'hooks/useUiFlag';
|
||||
|
||||
type TimeAgoProps = {
|
||||
date: Date | number | string | null | undefined;
|
||||
@ -17,18 +15,7 @@ const formatTimeAgo = (date: string | number | Date) =>
|
||||
.replace('about ', '')
|
||||
.replace('less than a minute ago', '< 1 minute ago');
|
||||
|
||||
export const TimeAgo: FC<TimeAgoProps> = ({ ...props }) => {
|
||||
const { date, fallback, refresh } = props;
|
||||
const timeAgoRefactorEnabled = useUiFlag('timeAgoRefactor');
|
||||
|
||||
if (timeAgoRefactorEnabled) return <NewTimeAgo {...props} />;
|
||||
if (!date) return fallback;
|
||||
return (
|
||||
<LegacyTimeAgo key={`${date}`} date={new Date(date)} live={refresh} />
|
||||
);
|
||||
};
|
||||
|
||||
export const NewTimeAgo: FC<TimeAgoProps> = ({
|
||||
export const TimeAgo: FC<TimeAgoProps> = ({
|
||||
date,
|
||||
fallback = '',
|
||||
refresh = true,
|
||||
@ -69,5 +56,3 @@ export const NewTimeAgo: FC<TimeAgoProps> = ({
|
||||
<time dateTime={state.dateTime.toISOString()}>{state.description}</time>
|
||||
);
|
||||
};
|
||||
|
||||
export default TimeAgo;
|
||||
|
@ -3,10 +3,10 @@ import CheckIcon from '@mui/icons-material/Check';
|
||||
import { Link as RouterLink } from 'react-router-dom';
|
||||
import ReportProblemOutlinedIcon from '@mui/icons-material/ReportProblemOutlined';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import ReactTimeAgo from 'react-timeago';
|
||||
import type { IProjectHealthReport } from 'interfaces/project';
|
||||
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
|
||||
import InfoOutlined from '@mui/icons-material/InfoOutlined';
|
||||
import { TimeAgo } from 'component/common/TimeAgo/TimeAgo';
|
||||
|
||||
const StyledBoxActive = styled(Box)(({ theme }) => ({
|
||||
display: 'flex',
|
||||
@ -142,9 +142,9 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
|
||||
</StyledHealthRating>
|
||||
<StyledLastUpdated>
|
||||
Last updated:{' '}
|
||||
<ReactTimeAgo
|
||||
<TimeAgo
|
||||
date={healthReport.updatedAt}
|
||||
live={false}
|
||||
refresh={false}
|
||||
/>
|
||||
</StyledLastUpdated>
|
||||
</>
|
||||
|
@ -91,7 +91,6 @@ export type UiFlags = {
|
||||
newEventSearch?: boolean;
|
||||
archiveProjects?: boolean;
|
||||
projectListImprovements?: boolean;
|
||||
timeAgoRefactor?: boolean;
|
||||
};
|
||||
|
||||
export interface IVersionInfo {
|
||||
|
@ -2881,15 +2881,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react-timeago@npm:4.1.7":
|
||||
version: 4.1.7
|
||||
resolution: "@types/react-timeago@npm:4.1.7"
|
||||
dependencies:
|
||||
"@types/react": "npm:*"
|
||||
checksum: 10c0/0f5965a0cdcced841889b45003c91643392caffc47470ed6e84784b940b3e8fe2031bce44a6c135e3adf6b5c21f46eb20c3b9211f1ec93c86f8e67ca732aed71
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react-transition-group@npm:^4.4.10":
|
||||
version: 4.4.10
|
||||
resolution: "@types/react-transition-group@npm:4.4.10"
|
||||
@ -8359,15 +8350,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"react-timeago@npm:7.2.0":
|
||||
version: 7.2.0
|
||||
resolution: "react-timeago@npm:7.2.0"
|
||||
peerDependencies:
|
||||
react: ^16.0.0 || ^17.0.0 || ^18.0.0
|
||||
checksum: 10c0/89051a12296934e3400319ca7887a0f3ae5a779fd9456769b526ac4771c47a431fb4c68f56ac9726e23d65aad55538f7e2f1c6adfa83224bc8f6278775c26fa3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"react-transition-group@npm:^4.4.5":
|
||||
version: 4.4.5
|
||||
resolution: "react-transition-group@npm:4.4.5"
|
||||
@ -9814,7 +9796,6 @@ __metadata:
|
||||
"@types/react-router-dom": "npm:5.3.3"
|
||||
"@types/react-table": "npm:7.7.20"
|
||||
"@types/react-test-renderer": "npm:18.3.0"
|
||||
"@types/react-timeago": "npm:4.1.7"
|
||||
"@types/semver": "npm:7.5.8"
|
||||
"@types/uuid": "npm:^9.0.0"
|
||||
"@uiw/codemirror-theme-duotone": "npm:4.23.0"
|
||||
@ -9863,7 +9844,6 @@ __metadata:
|
||||
react-router-dom: "npm:6.16.0"
|
||||
react-table: "npm:7.8.0"
|
||||
react-test-renderer: "npm:18.3.1"
|
||||
react-timeago: "npm:7.2.0"
|
||||
sass: "npm:1.77.8"
|
||||
semver: "npm:7.6.3"
|
||||
swr: "npm:2.2.5"
|
||||
|
@ -147,7 +147,6 @@ exports[`should create default config 1`] = `
|
||||
"showInactiveUsers": false,
|
||||
"signals": false,
|
||||
"strictSchemaValidation": false,
|
||||
"timeAgoRefactor": false,
|
||||
"useMemoizedActiveTokens": false,
|
||||
"useProjectReadModel": false,
|
||||
"userAccessUIEnabled": false,
|
||||
|
@ -63,8 +63,7 @@ export type IFlagKey =
|
||||
| 'archiveProjects'
|
||||
| 'projectListImprovements'
|
||||
| 'useProjectReadModel'
|
||||
| 'addonUsageMetrics'
|
||||
| 'timeAgoRefactor';
|
||||
| 'addonUsageMetrics';
|
||||
|
||||
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
|
||||
|
||||
@ -309,10 +308,6 @@ const flags: IFlags = {
|
||||
process.env.UNLEASH_EXPERIMENTAL_ADDON_USAGE_METRICS,
|
||||
false,
|
||||
),
|
||||
timeAgoRefactor: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_TIMEAGO_REFACTOR,
|
||||
false,
|
||||
),
|
||||
};
|
||||
|
||||
export const defaultExperimentalOptions: IExperimentalOptions = {
|
||||
|
@ -56,7 +56,6 @@ process.nextTick(async () => {
|
||||
projectListImprovements: true,
|
||||
useProjectReadModel: true,
|
||||
addonUsageMetrics: true,
|
||||
timeAgoRefactor: true,
|
||||
},
|
||||
},
|
||||
authentication: {
|
||||
|
Loading…
Reference in New Issue
Block a user