1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Refactor/remove last seen at flag (#5394)

This PR removes the feature flag for displaying the new last seen by
environments component.
This commit is contained in:
Fredrik Strand Oseberg 2023-11-22 13:32:38 +01:00 committed by GitHub
parent dc1aaf6d99
commit 5414fa6663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 17 additions and 63 deletions

View File

@ -64,8 +64,6 @@ export const ArchiveTable = ({
}: IFeaturesArchiveTableProps) => {
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
const isMediumScreen = useMediaQuery(theme.breakpoints.down('lg'));
const { setToastData, setToastApiError } = useToast();
const [deleteModalOpen, setDeleteModalOpen] = useState(false);
const [deletedFeature, setDeletedFeature] = useState<IFeatureToggle>();
@ -73,16 +71,12 @@ export const ArchiveTable = ({
const [revivedFeature, setRevivedFeature] = useState<IFeatureToggle>();
const [searchParams, setSearchParams] = useSearchParams();
const { reviveFeature } = useFeatureArchiveApi();
const [searchValue, setSearchValue] = useState(
searchParams.get('search') || '',
);
const { uiConfig } = useUiConfig();
const showEnvironmentLastSeen = Boolean(
uiConfig.flags.lastSeenByEnvironment,
);
const columns = useMemo(
() => [
@ -111,11 +105,7 @@ export const ArchiveTable = ({
Header: 'Seen',
accessor: 'lastSeenAt',
Cell: ({ value, row: { original: feature } }: any) => {
return showEnvironmentLastSeen ? (
<FeatureEnvironmentSeenCell feature={feature} />
) : (
<FeatureSeenCell value={value} />
);
return <FeatureEnvironmentSeenCell feature={feature} />;
},
align: 'center',
maxWidth: 80,
@ -199,7 +189,7 @@ export const ArchiveTable = ({
},
],
//eslint-disable-next-line
[projectId, showEnvironmentLastSeen],
[projectId],
);
const {

View File

@ -331,8 +331,7 @@ export const FeatureArchiveDialog: VFC<IFeatureArchiveDialogProps> = ({
<ConditionallyRender
condition={Boolean(
uiConfig.flags.lastSeenByEnvironment &&
featuresWithUsage &&
featuresWithUsage &&
featuresWithUsage?.length > 0,
)}
show={

View File

@ -72,9 +72,7 @@ export const FeatureToggleListTable: VFC = () => {
const [searchParams, setSearchParams] = useSearchParams();
const { setToastApiError } = useToast();
const { uiConfig } = useUiConfig();
const showEnvironmentLastSeen = Boolean(
uiConfig.flags.lastSeenByEnvironment,
);
const [initialState] = useState(() => ({
sortBy: [
{
@ -138,11 +136,7 @@ export const FeatureToggleListTable: VFC = () => {
Header: 'Seen',
accessor: 'lastSeenAt',
Cell: ({ value, row: { original: feature } }: any) => {
return showEnvironmentLastSeen ? (
<FeatureEnvironmentSeenCell feature={feature} />
) : (
<FeatureSeenCell value={value} />
);
return <FeatureEnvironmentSeenCell feature={feature} />;
},
align: 'center',
maxWidth: 80,
@ -206,7 +200,7 @@ export const FeatureToggleListTable: VFC = () => {
searchable: true,
},
],
[isFavoritesPinned, showEnvironmentLastSeen],
[isFavoritesPinned],
);
const {

View File

@ -33,10 +33,6 @@ export const FeatureOverviewSidePanelDetails = ({
const { uiConfig } = useUiConfig();
const showDependentFeatures = useShowDependentFeatures(feature.project);
const showLastSeenByEnvironment = Boolean(
uiConfig.flags.lastSeenByEnvironment,
);
const lastSeenEnvironments: ILastSeenEnvironments[] =
feature.environments?.map((env) => ({
name: env.name,
@ -57,13 +53,12 @@ export const FeatureOverviewSidePanelDetails = ({
)}
</span>
</StyledDetail>
{showLastSeenByEnvironment && (
<FeatureEnvironmentSeen
featureLastSeen={feature.lastSeenAt}
environments={lastSeenEnvironments}
sx={{ p: 0 }}
/>
)}
<FeatureEnvironmentSeen
featureLastSeen={feature.lastSeenAt}
environments={lastSeenEnvironments}
sx={{ p: 0 }}
/>
</FlexRow>
<ConditionallyRender
condition={showDependentFeatures}

View File

@ -150,9 +150,6 @@ export const PaginatedProjectFeatureToggles = ({
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
const [showExportDialog, setShowExportDialog] = useState(false);
const { uiConfig } = useUiConfig();
const showEnvironmentLastSeen = Boolean(
uiConfig.flags.lastSeenByEnvironment,
);
const onFavorite = useCallback(
async (feature: IFeatureToggleListItem) => {
@ -213,13 +210,11 @@ export const PaginatedProjectFeatureToggles = ({
Header: 'Seen',
accessor: 'lastSeenAt',
Cell: ({ value, row: { original: feature } }: any) => {
return showEnvironmentLastSeen ? (
return (
<MemoizedFeatureEnvironmentSeenCell
feature={feature}
data-loading
/>
) : (
<FeatureSeenCell value={value} />
);
},
align: 'center',

View File

@ -133,9 +133,6 @@ export const ProjectFeatureToggles = ({
const { isChangeRequestConfigured } = useChangeRequestsEnabled(projectId);
const [showExportDialog, setShowExportDialog] = useState(false);
const { uiConfig } = useUiConfig();
const showEnvironmentLastSeen = Boolean(
uiConfig.flags.lastSeenByEnvironment,
);
const onFavorite = useCallback(
async (feature: IFeatureToggleListItem) => {
@ -202,10 +199,8 @@ export const ProjectFeatureToggles = ({
Header: 'Seen',
accessor: 'lastSeenAt',
Cell: ({ value, row: { original: feature } }: any) => {
return showEnvironmentLastSeen ? (
return (
<MemoizedFeatureEnvironmentSeenCell feature={feature} />
) : (
<FeatureSeenCell value={value} />
);
},
align: 'center',

View File

@ -54,9 +54,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
const isMediumScreen = useMediaQuery(theme.breakpoints.down('lg'));
const { uiConfig } = useUiConfig();
const showEnvironmentLastSeen = Boolean(
uiConfig.flags.lastSeenByEnvironment,
);
const { featureTypes } = useFeatureTypes();
const data: IReportTableRow[] = useMemo<IReportTableRow[]>(
@ -89,11 +87,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
Header: 'Seen',
accessor: 'lastSeenAt',
Cell: ({ value, row: { original: feature } }: any) => {
return showEnvironmentLastSeen ? (
<FeatureEnvironmentSeenCell feature={feature} />
) : (
<FeatureSeenCell value={value} />
);
return <FeatureEnvironmentSeenCell feature={feature} />;
},
align: 'center',
maxWidth: 80,
@ -144,7 +138,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
maxWidth: 120,
},
],
[showEnvironmentLastSeen],
[],
);
const {

View File

@ -60,7 +60,6 @@ export type UiFlags = {
advancedPlayground?: boolean;
customRootRolesKillSwitch?: boolean;
strategyVariant?: boolean;
lastSeenByEnvironment?: boolean;
doraMetrics?: boolean;
variantTypeNumber?: boolean;
privateProjects?: boolean;

View File

@ -88,7 +88,6 @@ exports[`should create default config 1`] = `
"featuresExportImport": true,
"filterInvalidClientMetrics": false,
"googleAuthEnabled": false,
"lastSeenByEnvironment": false,
"maintenanceMode": false,
"messageBanner": {
"enabled": false,

View File

@ -21,7 +21,6 @@ export type IFlagKey =
| 'disableNotifications'
| 'advancedPlayground'
| 'filterInvalidClientMetrics'
| 'lastSeenByEnvironment'
| 'customRootRolesKillSwitch'
| 'variantTypeNumber'
| 'privateProjects'
@ -106,10 +105,6 @@ const flags: IFlags = {
process.env.FILTER_INVALID_CLIENT_METRICS,
false,
),
lastSeenByEnvironment: parseEnvVarBoolean(
process.env.LAST_SEEN_BY_ENVIRONMENT,
false,
),
customRootRolesKillSwitch: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_CUSTOM_ROOT_ROLES_KILL_SWITCH,
false,

View File

@ -37,7 +37,6 @@ process.nextTick(async () => {
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
lastSeenByEnvironment: true,
variantTypeNumber: true,
privateProjects: true,
dependentFeatures: true,