Skip to content

Commit 0e499bf

Browse files
feat(multi-org): render RateLimitAlert.tsx in global header when multiOrg flag is on (#5549)
1 parent decf176 commit 0e499bf

File tree

28 files changed

+107
-43
lines changed

28 files changed

+107
-43
lines changed

src/accounts/AccountHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React, {FC} from 'react'
44
import {Page} from '@influxdata/clockface'
55
import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
66
import LimitChecker from 'src/cloud/components/LimitChecker'
7+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
78

89
type Props = {
910
testID?: string
@@ -13,7 +14,7 @@ const AccountHeader: FC<Props> = ({testID = 'member-page--header'}) => (
1314
<Page.Header fullWidth={true} testID={testID}>
1415
<Page.Title title="Account" />
1516
<LimitChecker>
16-
<RateLimitAlert location="account" />
17+
{!isFlagEnabled('multiOrg') && <RateLimitAlert location="account" />}
1718
</LimitChecker>
1819
</Page.Header>
1920
)

src/alerting/components/AlertHistoryIndex.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {ResourceIDs} from 'src/checks/reducers'
3434
import {ResourceType, AlertHistoryType, AppState} from 'src/types'
3535
import {RouteComponentProps} from 'react-router-dom'
3636
import TimeZoneDropdown from 'src/shared/components/TimeZoneDropdown'
37+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
3738

3839
export const ResourceIDsContext = createContext<ResourceIDs>(null)
3940

@@ -82,7 +83,7 @@ const AlertHistoryIndex: FC<Props> = ({
8283
title="Check Statuses"
8384
testID="alert-history-title"
8485
/>
85-
<RateLimitAlert />
86+
{!isFlagEnabled('multiOrg') && <RateLimitAlert />}
8687
</Page.Header>
8788
<Page.ControlBar fullWidth={true}>
8889
<Page.ControlBarRight>

src/alerting/components/AlertingIndex.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
ThresholdCheckOverlay,
2525
DeadmanCheckOverlay as NewDeadmanCheckEO,
2626
} from 'src/overlays/components'
27-
import {FeatureFlag} from 'src/shared/utils/featureFlag'
27+
import {FeatureFlag, isFlagEnabled} from 'src/shared/utils/featureFlag'
2828

2929
// Utils
3030
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
@@ -65,7 +65,9 @@ const AlertingIndex: FunctionComponent = () => {
6565
<Page.Header fullWidth={true} testID="alerts-page--header">
6666
<Page.Title title="Alerts" />
6767
<ErrorBoundary>
68-
<RateLimitAlert location="alerting" />
68+
{!isFlagEnabled('multiOrg') && (
69+
<RateLimitAlert location="alerting" />
70+
)}
6971
</ErrorBoundary>
7072
</Page.Header>
7173
<Page.Contents

src/billing/components/BillingPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import LimitChecker from 'src/cloud/components/LimitChecker'
1111
// Utils
1212
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
1313
import AccountTabContainer from 'src/accounts/AccountTabContainer'
14+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
1415

1516
const BillingPage: FC = () => {
1617
return (
@@ -19,7 +20,9 @@ const BillingPage: FC = () => {
1920
<Page.Header fullWidth={true} testID="billing-page--header">
2021
<Page.Title title="Account" />
2122
<LimitChecker>
22-
<RateLimitAlert location="billing" />
23+
{!isFlagEnabled('multiOrg') && (
24+
<RateLimitAlert location="billing" />
25+
)}
2326
</LimitChecker>
2427
</Page.Header>
2528
<AccountTabContainer activeTab="billing">

src/checks/components/CheckHistory.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
2828

2929
// Types
3030
import {AppState, ResourceType} from 'src/types'
31+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
3132

3233
const CheckHistory: FC = () => {
3334
const resourceIDs = useSelector((state: AppState) => ({
@@ -57,7 +58,9 @@ const CheckHistory: FC = () => {
5758
title="Check Statuses"
5859
testID="alert-history-title"
5960
/>
60-
<RateLimitAlert location="check history" />
61+
{!isFlagEnabled('multiOrg') && (
62+
<RateLimitAlert location="check history" />
63+
)}
6164
</Page.Header>
6265
<Page.ControlBar fullWidth={true}>
6366
<Page.ControlBarLeft>

src/cloud/components/RateLimitAlert.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@
22
display: flex;
33
align-items: center;
44
}
5+
6+
.cf-panel--body__xs {
7+
padding: 8px;
8+
}
9+
10+
.cf-banner-panel .cf-panel--body__xs .cf-banner-panel--icon {
11+
margin-right: 0;
12+
}

src/cloud/components/RateLimitAlert.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ interface Props {
5656
location?: string
5757
}
5858

59+
const bannerStyle = {border: 'none', borderRadius: '6px'}
60+
5961
const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
6062
const resources = useSelector(extractRateLimitResources)
6163
const status = useSelector(extractRateLimitStatus)
@@ -68,6 +70,7 @@ const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
6870
dispatch(showOverlay('write-limit', null, () => dispatch(dismissOverlay)))
6971
}
7072

73+
// notification for write limit reached
7174
useEffect(() => {
7275
if (CLOUD && status === 'exceeded' && resources.includes('write')) {
7376
if (showUpgrade) {
@@ -110,6 +113,7 @@ const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
110113
? IconFont.AlertTriangle
111114
: IconFont.Cloud
112115

116+
// banner panel for cardinality limit exceeded
113117
if (CLOUD && status === 'exceeded' && resources.includes('cardinality')) {
114118
return (
115119
<FlexBox
@@ -124,13 +128,15 @@ const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
124128
icon={icon}
125129
hideMobileIcon={true}
126130
textColor={InfluxColors.Yeti}
131+
style={bannerStyle}
127132
>
128133
<RateLimitAlertContent />
129134
</BannerPanel>
130135
</FlexBox>
131136
)
132137
}
133138

139+
// upgrade button
134140
if (CLOUD && !alertOnly) {
135141
return (
136142
<CloudUpgradeButton
@@ -155,6 +161,7 @@ const RateLimitAlert: FC<Props> = ({alertOnly, className, location}) => {
155161
}
156162
)
157163
}}
164+
size={ComponentSize.ExtraSmall}
158165
/>
159166
)
160167
}

src/cloud/components/RateLimitAlertContent.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ export const UpgradeContent: FC<UpgradeProps> = ({
109109
return (
110110
<div className={`${className} rate-alert--content__free`}>
111111
<FlexBox
112-
justifyContent={JustifyContent.Center}
112+
justifyContent={JustifyContent.SpaceBetween}
113113
className="rate-alert--button"
114+
stretchToFitWidth={true}
114115
>
115116
<UpgradeMessage
116117
{...{isCredit250ExperienceActive, limitText, link, type}}
@@ -138,6 +139,7 @@ export const UpgradeContent: FC<UpgradeProps> = ({
138139
}
139140
)
140141
}}
142+
size={ComponentSize.ExtraSmall}
141143
/>
142144
</FlexBox>
143145
</div>

src/dashboards/components/DashboardPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import {
4646
DASHBOARD_ID,
4747
} from 'src/shared/constants/routes'
4848
import ErrorBoundary from 'src/shared/components/ErrorBoundary'
49+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
4950

5051
const dashRoute = `/${ORGS}/${ORG_ID}/${DASHBOARDS}/${DASHBOARD_ID}`
5152

@@ -62,7 +63,9 @@ const SingleDashboardPage: FC<ManualRefreshProps> = ({
6263
return (
6364
<>
6465
<DashboardHeader onManualRefresh={onManualRefresh} />
65-
<RateLimitAlert alertOnly={true} location="dashboard page" />
66+
{!isFlagEnabled('multiOrg') && (
67+
<RateLimitAlert alertOnly={true} location="dashboard page" />
68+
)}
6669
<VariablesControlBar />
6770
<ErrorBoundary>
6871
<DashboardComponent manualRefresh={manualRefresh} />

src/dashboards/components/dashboard_index/DashboardsIndex.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {SortTypes} from 'src/shared/utils/sort'
4444
import {DashboardSortKey} from 'src/shared/components/resource_sort_dropdown/generateSortItems'
4545

4646
import ErrorBoundary from 'src/shared/components/ErrorBoundary'
47+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
4748

4849
type ReduxProps = ConnectedProps<typeof connector>
4950
type Props = ReduxProps & RouteComponentProps<{orgID: string}>
@@ -120,7 +121,9 @@ class DashboardIndex extends PureComponent<Props, State> {
120121
>
121122
<Page.Header fullWidth={true}>
122123
<Page.Title title="Dashboards" />
123-
<RateLimitAlert location="dashboards" />
124+
{!isFlagEnabled('multiOrg') && (
125+
<RateLimitAlert location="dashboards" />
126+
)}
124127
</Page.Header>
125128
<Page.ControlBar fullWidth={true}>
126129
<ErrorBoundary>

0 commit comments

Comments
 (0)