Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds plus indicator when is_num_identity_overrides_complete is false #4938

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions frontend/common/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions frontend/web/components/CompareIdentities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ const CompareIdentities: FC<CompareIdentitiesType> = ({
/>
<IdentityOverridesIcon
count={data.num_identity_overrides}
showPlusIndicator={
data.is_num_identity_overrides_complete === false
}
/>
</Row>
</div>
Expand Down
5 changes: 5 additions & 0 deletions frontend/web/components/FeatureRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -230,6 +233,7 @@ class TheComponent extends Component {
)
}}
count={projectFlag.num_identity_overrides}
showPlusIndicator={showPlusIndicator}
/>
</Row>
</Flex>
Expand Down Expand Up @@ -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 && (
<Tooltip
Expand Down
12 changes: 10 additions & 2 deletions frontend/web/components/IdentityOverridesIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ import UsersIcon from './svg/UsersIcon'

type IdentityOverridesIconType = {
count: number | null
showPlusIndicator?: boolean
onClick?: (e: FormEvent) => void
}

const IdentityOverridesIcon: FC<IdentityOverridesIconType> = ({
count,
onClick,
showPlusIndicator,
}) => {
if (!count) {
return null
}
const plusIndicatorText = showPlusIndicator ? '+' : ''
return (
<div onClick={onClick}>
<Tooltip
Expand All @@ -23,12 +26,17 @@ const IdentityOverridesIcon: FC<IdentityOverridesIconType> = ({
style={{ border: 'none' }}
>
<UsersIcon className='chip-svg-icon' />
<span>{count}</span>
<span>
{count}
{plusIndicatorText}
</span>
</span>
}
place='top'
>
{`${count} Identity Override${count !== 1 ? 's' : ''}`}
{`${count}${plusIndicatorText} Identity Override${
count !== 1 || showPlusIndicator ? 's' : ''
}`}
</Tooltip>
</div>
)
Expand Down
Loading