From ca300267e4c8e96f562f260034fde91f122ab09e Mon Sep 17 00:00:00 2001 From: Tiago Fonseca Date: Mon, 23 Dec 2024 14:48:16 -0300 Subject: [PATCH] fix/speed_up_identity_overrides ref: #4931 Signed-off-by: Tiago Fonseca --- frontend/common/types/responses.ts | 1 + frontend/web/components/CompareIdentities.tsx | 3 +++ frontend/web/components/FeatureRow.js | 5 +++++ frontend/web/components/IdentityOverridesIcon.tsx | 12 ++++++++++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/common/types/responses.ts b/frontend/common/types/responses.ts index 0679b3795ca4..3c5ef7005e99 100644 --- a/frontend/common/types/responses.ts +++ b/frontend/common/types/responses.ts @@ -436,6 +436,7 @@ export type ProjectFlag = { id: number initial_value: FlagsmithValue is_archived: boolean + is_num_identity_overrides_complete: boolean is_server_key_only: boolean multivariate_options: MultivariateOption[] name: string diff --git a/frontend/web/components/CompareIdentities.tsx b/frontend/web/components/CompareIdentities.tsx index 0267b6f8c378..0de5528f1749 100644 --- a/frontend/web/components/CompareIdentities.tsx +++ b/frontend/web/components/CompareIdentities.tsx @@ -314,6 +314,9 @@ const CompareIdentities: FC = ({ /> diff --git a/frontend/web/components/FeatureRow.js b/frontend/web/components/FeatureRow.js index 7e6cd4c32cb6..7e1bb1dd62fa 100644 --- a/frontend/web/components/FeatureRow.js +++ b/frontend/web/components/FeatureRow.js @@ -141,6 +141,9 @@ class TheComponent extends Component { const changeRequestsEnabled = Utils.changeRequestsEnabled( environment && environment.minimum_change_request_approvals, ) + const showPlusIndicator = + projectFlag?.is_num_identity_overrides_complete === false + const onChange = () => { if (disableControls) { return @@ -230,6 +233,7 @@ class TheComponent extends Component { ) }} count={projectFlag.num_identity_overrides} + showPlusIndicator={showPlusIndicator} /> @@ -292,6 +296,7 @@ class TheComponent extends Component { this.editFeature(projectFlag, environmentFlags[id], 1) }} count={projectFlag.num_identity_overrides} + showPlusIndicator={showPlusIndicator} /> {projectFlag.is_server_key_only && ( void } const IdentityOverridesIcon: FC = ({ count, onClick, + showPlusIndicator, }) => { if (!count) { return null } + const plusIndicatorText = showPlusIndicator ? '+' : '' return (
= ({ style={{ border: 'none' }} > - {count} + + {count} + {plusIndicatorText} + } place='top' > - {`${count} Identity Override${count !== 1 ? 's' : ''}`} + {`${count}${plusIndicatorText} Identity Override${ + count !== 1 || showPlusIndicator ? 's' : '' + }`}
)