Skip to content

Commit 4b26432

Browse files
Merge pull request #3483 from RedisInsight/fe/feature/RI-5800-stream-details
#RI-5800 - update stream details
2 parents 3f850ec + e0a3d5c commit 4b26432

File tree

22 files changed

+333
-134
lines changed

22 files changed

+333
-134
lines changed

redisinsight/ui/src/components/popover-item-editor/PopoverItemEditor.spec.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

redisinsight/ui/src/components/popover-item-editor/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

redisinsight/ui/src/components/popover-item-editor/styles.module.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.

redisinsight/ui/src/components/virtual-grid/VirtualGrid.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ const VirtualGrid = (props: IProps) => {
3737
scrollTopProp = 0,
3838
maxTableWidth = 0,
3939
hideProgress,
40+
stickLastColumnHeaderCell,
4041
} = props
4142

4243
const scrollTopRef = useRef<number>(0)
43-
const [width, setWidth] = useState<number>(100)
44+
const [width, setWidth] = useState<number>(200)
4445
const [height, setHeight] = useState<number>(100)
4546
const [forceScrollTop, setForceScrollTop] = useState<Maybe<number>>(scrollTopProp)
4647
const [expandedRows, setExpandedRows] = useState<number[]>([])
@@ -155,9 +156,10 @@ const VirtualGrid = (props: IProps) => {
155156
}, [setRowHeight, rowIndex, expanded])
156157

157158
if (rowIndex === 0) {
159+
const isLastColumn = columns.length - 1 === columnIndex
158160
return (
159-
<div ref={cellRef} style={style}>
160-
<div className={cx(styles.gridHeaderItem, 'truncateText')}>
161+
<hgroup className={styles.gridHeaderCell} ref={cellRef} style={style}>
162+
<div className={cx(styles.gridHeaderItem, 'truncateText', { [styles.lastHeaderItem]: isLastColumn })}>
161163
{isObject(content) && (
162164
<>
163165
{!!content?.sortable && (
@@ -184,9 +186,10 @@ const VirtualGrid = (props: IProps) => {
184186
)}
185187
{!isObject(content) && renderNotEmptyContent(content)}
186188
</div>
187-
</div>
189+
</hgroup>
188190
)
189191
}
192+
190193
if (columnIndex === 0) {
191194
const lastColumn = columns[columns.length - 1]
192195
const allDynamicRowsHeight: number[] = Object.values(rowHeightsMap.current)
@@ -233,7 +236,8 @@ const VirtualGrid = (props: IProps) => {
233236
className={cx(styles.gridItem,
234237
rowIndex % 2
235238
? styles.gridItemOdd
236-
: styles.gridItemEven)}
239+
: styles.gridItemEven,
240+
columnIndex === columns.length - 2 ? 'penult' : '')}
237241
>
238242
{column?.render && isObject(rowData) && column?.render(rowData, expanded) }
239243
{!column?.render && content }
@@ -248,6 +252,7 @@ const VirtualGrid = (props: IProps) => {
248252
columns.length - 1,
249253
Math.max(maxTableWidth, width),
250254
columns,
255+
{ stickLastColumnHeaderCell }
251256
)
252257

253258
return (

redisinsight/ui/src/components/virtual-grid/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export interface IProps {
6565
hideFooter?: boolean
6666
maxTableWidth?: number
6767
hideProgress?: boolean
68+
stickLastColumnHeaderCell?: boolean
6869
}
6970

7071
export interface ISortedColumn {

redisinsight/ui/src/components/virtual-grid/styles.module.scss

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,48 @@ $paddingCell: 12px;
1616
border-left-width: 0;
1717
border-top-width: 0;
1818
cursor: pointer;
19+
20+
&:global(.penult) {
21+
border-right: 0;
22+
}
1923
}
2024

2125
.gridItemLast {
2226
z-index: 6;
2327
margin-top: -50px;
2428
padding-top: 16px;
29+
border-left: 1px solid var(--tableDarkestBorderColor);
30+
}
31+
32+
.gridHeaderCell {
33+
border: 1px solid var(--separatorColorLight);
34+
35+
&:not(:last-of-type) {
36+
border-right: 0;
37+
}
38+
39+
&:first-of-type {
40+
border-right: 1px solid var(--separatorColorLight);
41+
}
42+
43+
&:last-of-type, &:nth-of-type(2) {
44+
border-left: 0;
45+
}
46+
47+
&:last-of-type {
48+
border-left: 1px solid var(--separatorColorLight);
49+
}
2550
}
2651

2752
.gridHeaderItem {
2853
overflow: hidden;
2954
align-items: center;
30-
line-height: 44px;
31-
height: 60px;
55+
line-height: 38px;
56+
height: 58px;
3257
text-transform: none;
3358
z-index: 5;
3459
padding: $paddingCell;
3560
background-color: var(--euiColorEmptyShade);
36-
border-bottom: 1px solid var(--tableDarkestBorderColor);
3761

3862
&Sortable {
3963
&:hover {

redisinsight/ui/src/components/virtual-grid/utils.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const useInnerElementType = (
3838
columnCount: number,
3939
tableWidth: number,
4040
columns: ITableColumn[],
41+
options: Record<string, any> = {}
4142
) => React.useMemo(
4243
() =>
4344
React.forwardRef((props:ReactNode, ref) => {
@@ -129,7 +130,8 @@ export const useInnerElementType = (
129130
})
130131
)
131132

132-
const shownColumnsCount = shownIndecies.to.column - shownIndecies.from.column
133+
const toColumnDelta = options?.stickLastColumnHeaderCell ? -1 : 0
134+
const shownColumnsCount = shownIndecies.to.column + toColumnDelta - shownIndecies.from.column
133135

134136
for (let i = 1; i <= shownColumnsCount; i += 1) {
135137
const columnIndex = i + shownIndecies.from.column
@@ -157,6 +159,27 @@ export const useInnerElementType = (
157159
)
158160
}
159161

162+
// last sticky column
163+
if (options?.stickLastColumnHeaderCell) {
164+
const columnIndex = columns.length - 1
165+
children.push(
166+
React.createElement(Cell, {
167+
key: `0:${columnIndex}`,
168+
rowIndex: 0,
169+
columnIndex,
170+
style: {
171+
display: 'inline-flex',
172+
width: columnWidth(columnIndex, tableWidth, columns),
173+
height: rowHeight(0),
174+
position: 'sticky',
175+
top: 0,
176+
right: 0,
177+
zIndex: 3,
178+
}
179+
})
180+
)
181+
}
182+
160183
const shownRowsCount = shownIndecies.to.row - shownIndecies.from.row
161184

162185
for (let i = 1; i <= shownRowsCount; i += 1) {

redisinsight/ui/src/components/virtual-table/styles.module.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,15 @@ $footerHeight: 38px;
188188
font-size: 13px;
189189
align-items: normal;
190190
}
191+
191192
:global(.ReactVirtualized__Table__headerRow) {
192193
border: 1px solid var(--separatorColorLight) !important;
194+
// fix border alignment, need to investigate why this happens
195+
padding: 0 !important;
193196
}
197+
194198
:global(.ReactVirtualized__Table__rowColumn) {
195199
overflow: visible !important;
196-
// fix border alignment, need to investigate why this happens
197-
margin-right: 1px !important;
198200

199201
&:global(.actions.singleAction) {
200202
.tableRowCell {
@@ -213,6 +215,10 @@ $footerHeight: 38px;
213215
& > div:not(:last-of-type) {
214216
border-right: 1px solid var(--separatorColor);
215217
}
218+
219+
:global(.ReactVirtualized__Table__headerColumn) {
220+
border-right-color: var(--separatorColorLight) !important;
221+
}
216222
}
217223
}
218224

redisinsight/ui/src/pages/browser/modules/key-details/components/stream-details/groups-view/GroupsView/styles.module.scss

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
min-width: 330px;
1616
}
1717

18-
.editLastId {
19-
margin-right: 4px;
18+
.editableCell {
19+
padding: 12px 40px 12px 12px;
2020
}
2121

2222
.idText, .error {
@@ -30,3 +30,15 @@
3030
.error {
3131
color: var(--euiColorDangerText);
3232
}
33+
34+
.container {
35+
:global(.ReactVirtualized__Table__rowColumn) {
36+
display: flex;
37+
}
38+
}
39+
40+
.editBtn {
41+
position: absolute;
42+
top: 20px;
43+
right: 0;
44+
}

redisinsight/ui/src/pages/browser/modules/key-details/components/stream-details/groups-view/GroupsViewWrapper.spec.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { instance, mock } from 'ts-mockito'
33
import { cloneDeep } from 'lodash'
4-
import { cleanup, fireEvent, mockedStore, render, screen } from 'uiSrc/utils/test-utils'
4+
import { act, cleanup, fireEvent, mockedStore, render, screen } from 'uiSrc/utils/test-utils'
55
import {
66
deleteConsumerGroups,
77
loadConsumerGroups,
@@ -116,7 +116,10 @@ describe('GroupsViewWrapper', () => {
116116

117117
const afterRenderActions = [...store.getActions()]
118118

119-
fireEvent.click(screen.getByTestId('edit-stream-last-id-123'))
119+
act(() => {
120+
fireEvent.mouseEnter(screen.getByTestId('stream-group_content-value-123'))
121+
})
122+
fireEvent.click(screen.getByTestId('stream-group_edit-btn-123'))
120123

121124
expect(store.getActions()).toEqual([...afterRenderActions, setSelectedKeyRefreshDisabled(true)])
122125
})

0 commit comments

Comments
 (0)