Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/components/Insights/InsightsCatalog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { usePrevious } from "../../../hooks/usePrevious";

import { useTheme } from "styled-components";
import { actions as globalActions } from "../../../actions";
import { getFeatureFlagValue } from "../../../featureFlags";
import { useDebounce } from "../../../hooks/useDebounce";
import { isNumber } from "../../../typeGuards/isNumber";
import { isString } from "../../../typeGuards/isString";
import { isUndefined } from "../../../typeGuards/isUndefined";
import { GetInsightStatsPayload } from "../../../types";
import { FeatureFlag, GetInsightStatsPayload } from "../../../types";
import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent";
import { formatUnit } from "../../../utils/formatUnit";
import { ConfigContext } from "../../common/App/ConfigContext";
Expand Down Expand Up @@ -202,6 +203,11 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => {
selectedFilters
]);

const areInsightStatsSupported = getFeatureFlagValue(
config,
FeatureFlag.ARE_INSIGHT_STATS_SUPPORTED
);

return (
<>
<s.Toolbar>
Expand Down Expand Up @@ -247,11 +253,16 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => {
{mode === ViewMode.All ? (
<>
{!searchInputValue &&
!props.hideInsightsStats &&
(insights.length > 0 || selectedFilters.length > 0) && (
<InsightStats
criticalCount={config.insightStats?.criticalInsightsCount}
allIssuesCount={config.insightStats?.allIssuesCount}
unreadCount={config.insightStats?.unreadInsightsCount || 0}
unreadCount={
areInsightStatsSupported
? config.insightStats?.unreadInsightsCount || 0
: props.unreadCount || 0
}
onChange={handleFilterSelectionChange}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions src/components/Insights/InsightsCatalog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface InsightsCatalogProps {
isDismissalEnabled: boolean;
unreadCount?: number;
isMarkingAsReadEnabled: boolean;
hideInsightsStats?: boolean;
}

export enum ViewMode {
Expand Down
1 change: 1 addition & 0 deletions src/components/Insights/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export const Insights = (props: InsightsProps) => {
isDismissalEnabled={isDismissalEnabled}
unreadCount={data.unreadCount}
isMarkingAsReadEnabled={isMarkingAsReadEnabled}
hideInsightsStats={props.insightViewType === "Analytics"}
/>
);
};
Expand Down
3 changes: 2 additions & 1 deletion src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ConfigContextData } from "./components/common/App/types";
import { FeatureFlag } from "./types";

export const featureFlagMinBackendVersions: Record<FeatureFlag, string> = {
[FeatureFlag.ARE_IMPACT_HIGHLIGHTS_ENABLED]: "0.3.7"
[FeatureFlag.ARE_IMPACT_HIGHLIGHTS_ENABLED]: "0.3.7",
[FeatureFlag.ARE_INSIGHT_STATS_SUPPORTED]: "0.3.7"
};

export const getFeatureFlagValue = (
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Duration } from "./globals";

export enum FeatureFlag {
ARE_IMPACT_HIGHLIGHTS_ENABLED
ARE_IMPACT_HIGHLIGHTS_ENABLED,
ARE_INSIGHT_STATS_SUPPORTED
}

export enum InsightType {
Expand Down