@@ -6,14 +6,23 @@ import {isEmpty} from 'lodash'
66import { AutoSizer } from 'react-virtualized'
77
88// Components
9- import { Sort , ComponentSize , EmptyState } from '@influxdata/clockface'
9+ import {
10+ Sort ,
11+ ComponentSize ,
12+ EmptyState ,
13+ BannerPanel ,
14+ Gradients ,
15+ IconFont ,
16+ InfluxColors ,
17+ } from '@influxdata/clockface'
1018import SearchWidget from 'src/shared/components/search_widget/SearchWidget'
1119import TokenList from 'src/authorizations/pagination/TokenList'
1220import FilterList from 'src/shared/components/FilterList'
1321import TabbedPageHeader from 'src/shared/components/tabbed_page/TabbedPageHeader'
1422import GenerateTokenDropdown from 'src/authorizations/components/GenerateTokenDropdown'
1523import GenerateTokenDropdownRedesigned from 'src/authorizations/components/redesigned/GenerateTokenDropdown'
1624import ResourceSortDropdown from 'src/shared/components/resource_sort_dropdown/ResourceSortDropdown'
25+ import TokensRedesignBanner from 'src/authorizations/components/TokensRedesignBanner'
1726
1827// Types
1928import { AppState , Authorization , ResourceType } from 'src/types'
@@ -45,6 +54,7 @@ interface StateProps {
4554
4655const DEFAULT_PAGINATION_CONTROL_HEIGHT = 62
4756const DEFAULT_TAB_NAVIGATION_HEIGHT = 62
57+ const DEFAULT_ALERT_HEIGHT = 100
4858
4959type SortKey = keyof Authorization
5060
@@ -122,46 +132,79 @@ class TokensTab extends PureComponent<Props, State> {
122132 rightHeaderItems = < GenerateTokenDropdownRedesigned />
123133 }
124134
135+ 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+ >
146+ < TokensRedesignBanner />
147+ </ BannerPanel >
148+ </ >
149+ )
150+ }
151+ }
152+
125153 return (
126- < AutoSizer >
127- { ( { width, height} ) => {
128- const heightWithPagination =
129- this . paginationRef ?. current ?. clientHeight +
130- DEFAULT_TAB_NAVIGATION_HEIGHT ||
131- DEFAULT_PAGINATION_CONTROL_HEIGHT + DEFAULT_TAB_NAVIGATION_HEIGHT
132-
133- const adjustedHeight = height - heightWithPagination
134- return (
135- < >
136- < TabbedPageHeader
137- childrenLeft = { leftHeaderItems }
138- childrenRight = { rightHeaderItems }
139- width = { width }
140- />
141- < FilterAuthorizations
142- list = { tokens }
143- searchTerm = { searchTerm }
144- searchKeys = { this . searchKeys }
145- >
146- { filteredAuths => (
147- < TokenList
148- tokenCount = { tokens . length }
149- auths = { filteredAuths }
150- emptyState = { this . emptyState }
151- pageWidth = { width }
152- pageHeight = { adjustedHeight }
153- searchTerm = { searchTerm }
154- sortKey = { sortKey }
155- sortDirection = { sortDirection }
156- sortType = { sortType }
157- onClickColumn = { this . handleClickColumn }
154+ < >
155+ { tokensBanner ( ) }
156+ < AutoSizer >
157+ { ( { width, height} ) => {
158+ // 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 )
172+
173+ const adjustedHeight = height - heightWithPagination
174+ return (
175+ < >
176+ < div style = { { margin : '10px 0px' } } >
177+ < TabbedPageHeader
178+ childrenLeft = { leftHeaderItems }
179+ childrenRight = { rightHeaderItems }
180+ width = { width }
158181 />
159- ) }
160- </ FilterAuthorizations >
161- </ >
162- )
163- } }
164- </ AutoSizer >
182+ < FilterAuthorizations
183+ list = { tokens }
184+ searchTerm = { searchTerm }
185+ searchKeys = { this . searchKeys }
186+ >
187+ { filteredAuths => (
188+ < TokenList
189+ tokenCount = { tokens . length }
190+ auths = { filteredAuths }
191+ emptyState = { this . emptyState }
192+ pageWidth = { width }
193+ pageHeight = { adjustedHeight }
194+ searchTerm = { searchTerm }
195+ sortKey = { sortKey }
196+ sortDirection = { sortDirection }
197+ sortType = { sortType }
198+ onClickColumn = { this . handleClickColumn }
199+ />
200+ ) }
201+ </ FilterAuthorizations >
202+ </ div >
203+ </ >
204+ )
205+ } }
206+ </ AutoSizer >
207+ </ >
165208 )
166209 }
167210
0 commit comments