Skip to content

Commit d603268

Browse files
authored
feat: add alert banner on new tokens UI (#3559)
* feat: add alert banner on new tokens UI * fix: update personal api token to custom api token * fix: wording
1 parent e794584 commit d603268

File tree

5 files changed

+67
-35
lines changed

5 files changed

+67
-35
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Libraries
2+
import React, {FunctionComponent} from 'react'
3+
4+
// Constants
5+
6+
const PostDeploymentTokensBanner: FunctionComponent = () => (
7+
<div>
8+
Our Tokens UI has changed. You are only able to view and safely store token
9+
details at the point of creation. If you lose access to token credentials,
10+
you can generate a new token.
11+
</div>
12+
)
13+
14+
export default PostDeploymentTokensBanner

src/authorizations/components/redesigned/CustomApiTokenOverlay.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,7 @@ const CustomApiTokenOverlay: FC<Props> = props => {
255255

256256
return (
257257
<Overlay.Container maxWidth={800}>
258-
<Overlay.Header
259-
title="Generate a Personal API Token"
260-
onDismiss={onClose}
261-
/>
258+
<Overlay.Header title="Generate a Custom API Token" onDismiss={onClose} />
262259
<Overlay.Body>
263260
<Form>
264261
<FlexBox

src/authorizations/components/redesigned/DisplayTokenOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const DisplayTokenOverlay: FC<Props> = props => {
4141
alignItems={AlignItems.Stretch}
4242
>
4343
<Alert icon={IconFont.AlertTriangle} color={ComponentColor.Primary}>
44-
Make sure to copy your new personal API token now. You won't be able
44+
Make sure to copy your new custom API token now. You won't be able
4545
to see it again!
4646
</Alert>
4747

src/authorizations/components/redesigned/TokensTab.tsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@ import {withRouter, RouteComponentProps} from 'react-router-dom'
55
import {isEmpty} from 'lodash'
66

77
// Components
8-
import {Sort, ComponentSize, EmptyState} from '@influxdata/clockface'
8+
import {
9+
Sort,
10+
ComponentSize,
11+
EmptyState,
12+
FlexBox,
13+
FlexDirection,
14+
AlignItems,
15+
BannerPanel,
16+
Gradients,
17+
IconFont,
18+
InfluxColors,
19+
} from '@influxdata/clockface'
920
import SearchWidget from 'src/shared/components/search_widget/SearchWidget'
1021
import {TokenList} from 'src/authorizations/components/redesigned/TokenList'
1122
import FilterList from 'src/shared/components/FilterList'
@@ -19,6 +30,7 @@ import {SortTypes} from 'src/shared/utils/sort'
1930

2031
// Selectors
2132
import {getAll} from 'src/resources/selectors'
33+
import PostDeploymentTokensBanner from '../PostDeploymentTokensBanner'
2234

2335
enum AuthSearchKeys {
2436
Description = 'description',
@@ -80,7 +92,20 @@ class TokensTab extends PureComponent<Props, State> {
8092
const rightHeaderItems = <GenerateTokenDropdown />
8193

8294
return (
83-
<>
95+
<FlexBox
96+
direction={FlexDirection.Column}
97+
alignItems={AlignItems.Center}
98+
margin={ComponentSize.Large}
99+
>
100+
<BannerPanel
101+
size={ComponentSize.ExtraSmall}
102+
gradient={Gradients.PolarExpress}
103+
icon={IconFont.Bell}
104+
hideMobileIcon={true}
105+
textColor={InfluxColors.Yeti}
106+
>
107+
<PostDeploymentTokensBanner />
108+
</BannerPanel>
84109
<TabbedPageHeader
85110
childrenLeft={leftHeaderItems}
86111
childrenRight={rightHeaderItems}
@@ -102,7 +127,7 @@ class TokensTab extends PureComponent<Props, State> {
102127
/>
103128
)}
104129
</FilterAuthorizations>
105-
</>
130+
</FlexBox>
106131
)
107132
}
108133

src/authorizations/pagination/TokensTab.tsx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import GenerateTokenDropdown from 'src/authorizations/components/GenerateTokenDr
2323
import GenerateTokenDropdownRedesigned from 'src/authorizations/components/redesigned/GenerateTokenDropdown'
2424
import ResourceSortDropdown from 'src/shared/components/resource_sort_dropdown/ResourceSortDropdown'
2525
import TokensRedesignBanner from 'src/authorizations/components/TokensRedesignBanner'
26+
import PostDeploymentTokensBanner from 'src/authorizations/components/PostDeploymentTokensBanner'
2627

2728
// Types
2829
import {AppState, Authorization, ResourceType} from 'src/types'
@@ -133,21 +134,23 @@ class TokensTab extends PureComponent<Props, State> {
133134
}
134135

135136
const tokensBanner = () => {
136-
if (!isFlagEnabled('tokensUIRedesign')) {
137-
return (
138-
<>
139-
<BannerPanel
140-
size={ComponentSize.ExtraSmall}
141-
gradient={Gradients.PolarExpress}
142-
icon={IconFont.Bell}
143-
hideMobileIcon={true}
144-
textColor={InfluxColors.Yeti}
145-
>
137+
return (
138+
<>
139+
<BannerPanel
140+
size={ComponentSize.ExtraSmall}
141+
gradient={Gradients.PolarExpress}
142+
icon={IconFont.Bell}
143+
hideMobileIcon={true}
144+
textColor={InfluxColors.Yeti}
145+
>
146+
{isFlagEnabled('tokensUIRedesign') ? (
147+
<PostDeploymentTokensBanner />
148+
) : (
146149
<TokensRedesignBanner />
147-
</BannerPanel>
148-
</>
149-
)
150-
}
150+
)}
151+
</BannerPanel>
152+
</>
153+
)
151154
}
152155

153156
return (
@@ -156,19 +159,12 @@ class TokensTab extends PureComponent<Props, State> {
156159
<AutoSizer>
157160
{({width, height}) => {
158161
// if tokens redesign flag is off, adjust the page height so the banner doesn't push the pagination controller off
159-
let heightWithPagination
160-
isFlagEnabled('tokensUIRedesign')
161-
? (heightWithPagination =
162-
this.paginationRef?.current?.clientHeight +
163-
DEFAULT_TAB_NAVIGATION_HEIGHT ||
164-
DEFAULT_PAGINATION_CONTROL_HEIGHT +
165-
DEFAULT_TAB_NAVIGATION_HEIGHT)
166-
: (heightWithPagination =
167-
this.paginationRef?.current?.clientHeight +
168-
DEFAULT_TAB_NAVIGATION_HEIGHT ||
169-
DEFAULT_PAGINATION_CONTROL_HEIGHT +
170-
DEFAULT_TAB_NAVIGATION_HEIGHT +
171-
DEFAULT_ALERT_HEIGHT)
162+
const heightWithPagination =
163+
this.paginationRef?.current?.clientHeight +
164+
DEFAULT_TAB_NAVIGATION_HEIGHT ||
165+
DEFAULT_PAGINATION_CONTROL_HEIGHT +
166+
DEFAULT_TAB_NAVIGATION_HEIGHT +
167+
DEFAULT_ALERT_HEIGHT
172168

173169
const adjustedHeight = height - heightWithPagination
174170
return (

0 commit comments

Comments
 (0)