Skip to content

Commit 6c68289

Browse files
authored
chore: Reorganise feature tabs (#6660)
1 parent f644ab2 commit 6c68289

11 files changed

Lines changed: 78 additions & 63 deletions

File tree

docs/docs/deployment-self-hosting/scaling-and-performance/using-influxdb-for-analytics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ data
5454
|> to(bucket: "default_downsampled_15m")
5555
```
5656

57-
Once this task has run, and you have made some flag evaluations with analytics enabled (see documentation [here](/managing-flags/flag-analytics) for information on this), you should see data in the 'Analytics' tab against each feature in your dashboard.
57+
Once this task has run, and you have made some flag evaluations with analytics enabled (see documentation [here](/managing-flags/flag-analytics) for information on this), you should see data in the 'Usage' tab against each feature in your dashboard.
5858

5959
8. Create another new task with the following query. This will downsample your per-millisecond API request data down to 1-hour blocks for faster queries. Set it to run every 1 hour.
6060

docs/docs/managing-flags/code-references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Integrating with Code References **does not** expose your source code to Flagsmi
127127

128128
:::
129129

130-
Feature details will expand on the _Code References_ tab, and list locations of each code reference:
130+
Feature details will expand on the _Usage_ tab, and list locations of each code reference:
131131

132132
![Code References listed for each repository within Feature details](./code-references/feature-details.png)
133133

105 KB
Loading

docs/docs/managing-flags/flag-analytics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_position: 20
88

99
Flag analytics allow you to track how often individual flags are evaluated within the Flagsmith SDK.
1010

11-
To view Analytics for a particular flag, browse to the relevant environment and click on a single flag to edit that flag.
11+
To view Analytics for a particular flag, browse to the relevant environment and click on a single flag to edit that flag. Analytics are displayed in the _Usage_ tab alongside Code References.
1212

1313
![Image](/img/flag-analytics.png)
1414

docs/static/img/flag-analytics.png

159 KB
Loading

frontend/common/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,13 @@ const Constants = {
441441
unhealthyColor: '#D35400',
442442
},
443443
featurePanelTabs: {
444-
ANALYTICS: 'analytics',
445444
FEATURE_HEALTH: 'feature-health',
446445
HISTORY: 'history',
447446
IDENTITY_OVERRIDES: 'identity-overrides',
448447
LINKS: 'links',
449448
SEGMENT_OVERRIDES: 'segment-overrides',
450449
SETTINGS: 'settings',
450+
USAGE: 'usage',
451451
VALUE: 'value',
452452
},
453453
forms: {

frontend/web/components/feature-page/FeatureNavTab/CodeReferences/FeatureCodeReferencesContainer.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ const FeatureCodeReferencesContainer: React.FC<
4444

4545
if (!data || data.length === 0) {
4646
return (
47-
<div className='d-flex justify-content-center items-center'>
48-
<h6 className='text-gray-500'>
49-
No code references found for this feature
50-
</h6>
47+
<div className='text-center text-muted'>
48+
No code references found for this feature.
5149
</div>
5250
)
5351
}

frontend/web/components/feature-page/FeatureNavTab/FeatureAnalytics.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ const FlagAnalytics: FC<FlagAnalyticsType> = ({
7979
)}
8080
{!isLoading && data && !hasData && (
8181
<div
82-
style={{ height: 400 }}
82+
style={{ height: 200 }}
8383
className='text-center justify-content-center align-items-center text-muted mt-4 d-flex'
8484
>
85-
No analytics data available for the selected environment
85+
No analytics data available for the selected environments
8686
{environmentIds?.length > 1 ? 's' : ''}.
8787
</div>
8888
)}

frontend/web/components/feature-summary/FeatureTags.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,19 @@ const FeatureTags: FC<FeatureTagsType> = ({ editFeature, projectFlag }) => {
7171
{isCodeReferencesEnabled && hasScannedCodeReferences && (
7272
<Tooltip
7373
title={
74-
<VCSProviderTag
75-
count={codeReferencesCounts}
76-
isWarning={codeReferencesCounts === 0}
77-
vcsProvider={VCSProvider.GITHUB}
78-
/>
74+
<div
75+
onClick={(e) => {
76+
e.stopPropagation()
77+
editFeature(Constants.featurePanelTabs.USAGE)
78+
}}
79+
style={{ cursor: 'pointer' }}
80+
>
81+
<VCSProviderTag
82+
count={codeReferencesCounts}
83+
isWarning={codeReferencesCounts === 0}
84+
vcsProvider={VCSProvider.GITHUB}
85+
/>
86+
</div>
7987
}
8088
place='top'
8189
>

frontend/web/components/modals/create-feature/index.js

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ import { FlagValueFooter } from 'components/modals/FlagValueFooter'
3838
import { getPermission } from 'common/services/usePermission'
3939
import { getChangeRequests } from 'common/services/useChangeRequest'
4040
import FeatureHealthTabContent from 'components/feature-health/FeatureHealthTabContent'
41-
import { IonIcon } from '@ionic/react'
42-
import { warning } from 'ionicons/icons'
4341
import FeaturePipelineStatus from 'components/release-pipelines/FeaturePipelineStatus'
4442
import FeatureInPipelineGuard from 'components/release-pipelines/FeatureInPipelineGuard'
4543
import FeatureCodeReferencesContainer from 'components/feature-page/FeatureNavTab/CodeReferences/FeatureCodeReferencesContainer'
46-
import BetaFlag from 'components/BetaFlag'
4744
import ProjectProvider from 'common/providers/ProjectProvider'
4845
import CreateFeature from './tabs/CreateFeature'
4946
import FeatureSettings from './tabs/FeatureSettings'
@@ -629,6 +626,8 @@ const Index = class extends Component {
629626
const isCodeReferencesEnabled = Utils.getFlagsmithHasFeature(
630627
'git_code_references',
631628
)
629+
const hasCodeReferences =
630+
isCodeReferencesEnabled || projectFlag?.code_references_counts?.length > 0
632631

633632
try {
634633
if (!isEdit && projectFlag.name && regex) {
@@ -1567,41 +1566,65 @@ const Index = class extends Component {
15671566
)
15681567
}
15691568
</Permission>
1570-
{!Project.disableAnalytics && (
1571-
<TabItem tabLabel={'Analytics'}>
1572-
<div className='mb-4'>
1573-
<FeatureAnalytics
1574-
projectId={`${project.id}`}
1575-
featureId={`${projectFlag.id}`}
1576-
defaultEnvironmentIds={[
1577-
`${environment.id}`,
1578-
]}
1579-
/>
1580-
</div>
1569+
{(!Project.disableAnalytics ||
1570+
hasCodeReferences) && (
1571+
<TabItem
1572+
tabLabelString='Usage'
1573+
tabLabel={
1574+
<Row className='justify-content-center'>
1575+
Usage
1576+
</Row>
1577+
}
1578+
>
1579+
{!Project.disableAnalytics && (
1580+
<div className='mb-4'>
1581+
<FeatureAnalytics
1582+
projectId={`${project.id}`}
1583+
featureId={`${projectFlag.id}`}
1584+
defaultEnvironmentIds={[
1585+
`${environment.id}`,
1586+
]}
1587+
/>
1588+
</div>
1589+
)}
1590+
{hasCodeReferences && (
1591+
<FormGroup className='mb-4'>
1592+
<div className='d-flex align-items-center gap-2 mb-2'>
1593+
<h5 className='mb-0'>
1594+
Code references
1595+
</h5>
1596+
<span
1597+
className='chip chip--xs bg-primary text-white'
1598+
style={{ border: 'none' }}
1599+
>
1600+
New
1601+
</span>
1602+
</div>
1603+
<div className='text-muted mb-2'>
1604+
Code references allow you to track
1605+
where feature flags are being used
1606+
within your code.{' '}
1607+
<a
1608+
target='_blank'
1609+
href='https://docs.flagsmith.com/managing-flags/code-references'
1610+
rel='noreferrer'
1611+
>
1612+
Learn more
1613+
</a>
1614+
</div>
1615+
<FeatureCodeReferencesContainer
1616+
featureId={projectFlag.id}
1617+
projectId={this.props.projectId}
1618+
/>
1619+
</FormGroup>
1620+
)}
15811621
</TabItem>
15821622
)}
15831623
{
15841624
<TabItem
15851625
data-test='feature_health'
1586-
tabLabelString='Feature Health'
1587-
tabLabel={
1588-
<Row className='d-flex justify-content-center align-items-center pr-1 gap-1'>
1589-
<BetaFlag flagName={'feature_health'}>
1590-
Feature Health
1591-
{this.props.hasUnhealthyEvents && (
1592-
<IonIcon
1593-
icon={warning}
1594-
style={{
1595-
color:
1596-
Constants.featureHealth
1597-
.unhealthyColor,
1598-
marginBottom: -2,
1599-
}}
1600-
/>
1601-
)}
1602-
</BetaFlag>
1603-
</Row>
1604-
}
1626+
tabLabelString='Health'
1627+
tabLabel={'Health'}
16051628
>
16061629
<FeatureHealthTabContent
16071630
projectId={projectFlag.project}
@@ -1610,20 +1633,6 @@ const Index = class extends Component {
16101633
/>
16111634
</TabItem>
16121635
}
1613-
{isCodeReferencesEnabled && (
1614-
<TabItem
1615-
tabLabel={
1616-
<Row className='justify-content-center'>
1617-
Code References
1618-
</Row>
1619-
}
1620-
>
1621-
<FeatureCodeReferencesContainer
1622-
featureId={projectFlag.id}
1623-
projectId={this.props.projectId}
1624-
/>
1625-
</TabItem>
1626-
)}
16271636
{hasIntegrationWithGithub &&
16281637
projectFlag?.id && (
16291638
<TabItem

0 commit comments

Comments
 (0)