|
1 | 1 | import React from 'react'; |
2 | 2 |
|
3 | 3 | import {CirclePlay, Clock, Display, Person, Rocket} from '@gravity-ui/icons'; |
4 | | -import {ArrowToggle, Button, Disclosure, Flex, Icon, Label, Text} from '@gravity-ui/uikit'; |
| 4 | +import {ArrowToggle, Button, Card, Flex, Icon, Label, Text} from '@gravity-ui/uikit'; |
5 | 5 | import {useHistory, useLocation} from 'react-router-dom'; |
6 | 6 |
|
7 | 7 | import {TenantTabsGroups, getTenantPath} from '../../containers/Tenant/TenantPages'; |
@@ -128,61 +128,57 @@ export function QueriesActivityBar({tenantName}: QueriesActivityBarProps) { |
128 | 128 | history.push(path); |
129 | 129 | }; |
130 | 130 |
|
| 131 | + const handleToggleExpanded = () => { |
| 132 | + setExpanded(!expanded); |
| 133 | + }; |
| 134 | + |
131 | 135 | return ( |
132 | 136 | <div className={b({expanded})} style={{display: isActivityBarHidden ? 'none' : undefined}}> |
133 | | - <Disclosure expanded={expanded} onUpdate={setExpanded} className={b('disclosure')}> |
134 | | - <Disclosure.Summary> |
135 | | - {(props) => ( |
136 | | - <div {...props} className={b('header')}> |
137 | | - <Flex justifyContent="space-between" className={b('content-wrapper')}> |
138 | | - <Flex direction="column" className={b('title-section')}> |
139 | | - <Text variant="subheader-2" className={b('title')}> |
140 | | - {i18n('title_queries-activity')} |
141 | | - </Text> |
142 | | - <Text |
143 | | - color="secondary" |
144 | | - variant="caption-2" |
145 | | - className={b('subtitle')} |
146 | | - > |
147 | | - {i18n('context_monitor-changes-realtime')} |
148 | | - </Text> |
149 | | - </Flex> |
150 | | - |
151 | | - <div className={b('metrics')}> |
152 | | - <Label |
153 | | - theme={runningQueriesCount > 0 ? 'success' : 'unknown'} |
154 | | - size="s" |
155 | | - icon={<Icon data={CirclePlay} size={14} />} |
156 | | - > |
157 | | - {runningQueriesCount} |
158 | | - </Label> |
159 | | - |
160 | | - <Label |
161 | | - theme="clear" |
162 | | - size="s" |
163 | | - icon={<Icon data={Rocket} size={14} />} |
164 | | - value={formatTrendValue(qps.trend.value)} |
165 | | - > |
166 | | - {i18n('value_per-sec', {count: qps.value})} |
167 | | - </Label> |
168 | | - |
169 | | - <Label |
170 | | - theme="clear" |
171 | | - size="s" |
172 | | - icon={<Icon data={Clock} size={14} />} |
173 | | - value={formatTrendValue(latency.trend.value)} |
174 | | - > |
175 | | - {i18n('value_ms', {time: latency.value})} |
176 | | - </Label> |
177 | | - </div> |
178 | | - </Flex> |
179 | | - |
180 | | - <ArrowToggle direction={props.expanded ? 'top' : 'bottom'} /> |
| 137 | + <Card className={b('card')} type="container" view={expanded ? 'outlined' : 'raised'}> |
| 138 | + <div className={b('header')} onClick={handleToggleExpanded}> |
| 139 | + <Flex justifyContent="space-between" className={b('content-wrapper')}> |
| 140 | + <Flex direction="column" className={b('title-section')}> |
| 141 | + <Text variant="subheader-2" className={b('title')}> |
| 142 | + {i18n('title_queries-activity')} |
| 143 | + </Text> |
| 144 | + <Text color="secondary" variant="caption-2" className={b('subtitle')}> |
| 145 | + {i18n('context_monitor-changes-realtime')} |
| 146 | + </Text> |
| 147 | + </Flex> |
| 148 | + |
| 149 | + <div className={b('metrics')}> |
| 150 | + <Label |
| 151 | + theme={runningQueriesCount > 0 ? 'success' : 'unknown'} |
| 152 | + size="s" |
| 153 | + icon={<Icon data={CirclePlay} size={14} />} |
| 154 | + > |
| 155 | + {runningQueriesCount} |
| 156 | + </Label> |
| 157 | + |
| 158 | + <Label |
| 159 | + theme="clear" |
| 160 | + size="s" |
| 161 | + icon={<Icon data={Rocket} size={14} />} |
| 162 | + value={formatTrendValue(qps.trend.value)} |
| 163 | + > |
| 164 | + {i18n('value_per-sec', {count: qps.value})} |
| 165 | + </Label> |
| 166 | + |
| 167 | + <Label |
| 168 | + theme="clear" |
| 169 | + size="s" |
| 170 | + icon={<Icon data={Clock} size={14} />} |
| 171 | + value={formatTrendValue(latency.trend.value)} |
| 172 | + > |
| 173 | + {i18n('value_ms', {time: latency.value})} |
| 174 | + </Label> |
181 | 175 | </div> |
182 | | - )} |
183 | | - </Disclosure.Summary> |
| 176 | + </Flex> |
| 177 | + |
| 178 | + <ArrowToggle direction={expanded ? 'top' : 'bottom'} /> |
| 179 | + </div> |
184 | 180 |
|
185 | | - {expanded ? ( |
| 181 | + {expanded && ( |
186 | 182 | <div className={b('content')}> |
187 | 183 | <div className={b('stats')}> |
188 | 184 | <Label |
@@ -222,13 +218,13 @@ export function QueriesActivityBar({tenantName}: QueriesActivityBarProps) { |
222 | 218 | </Button> |
223 | 219 | </div> |
224 | 220 | </div> |
225 | | - ) : null} |
226 | | - </Disclosure> |
227 | | - <QueriesActivityCharts |
228 | | - tenantName={tenantName} |
229 | | - expanded={expanded} |
230 | | - onChartDataStatusChange={handleChartDataStatusChange} |
231 | | - /> |
| 221 | + )} |
| 222 | + <QueriesActivityCharts |
| 223 | + tenantName={tenantName} |
| 224 | + expanded={expanded} |
| 225 | + onChartDataStatusChange={handleChartDataStatusChange} |
| 226 | + /> |
| 227 | + </Card> |
232 | 228 | </div> |
233 | 229 | ); |
234 | 230 | } |
0 commit comments