New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade antd to v4.15.6 #1748
Upgrade antd to v4.15.6 #1748
Conversation
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Codecov ReportPatch coverage is 📢 Thoughts on this report? Let us know!. |
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
@@ -32,7 +32,7 @@ export default class MonitorATMEmptyState extends React.PureComponent { | |||
return ( | |||
<Col> | |||
<Row justify="center"> | |||
<Col span={8} offset={8}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't removing offset
change the position of the column? When I see <Col span={8} offset={8}>
I interpret it "start from column 8 and span columns 8-15"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously (in antd 3x), the <Col span={8}>
was interpreted as, "The width of column should be 8 boxes out of the 24 boxes in a grid".
That offset
property defines that those 8 boxes must start from the 9th box out of those 24 boxes so that basically centers the col.
In antd 4x, this behavior is controlled by <Row justify="center">
. Don't know why it was not working previously in 3x, even though it existed before too.
Here's what the page looks like now:
|
||
if (!isEqual(activeSorters, tableSorting)) { | ||
const lastColumn = | ||
activeSorters[activeSorters.length - 1] ?? tableSorting[tableSorting.length - 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if both arrays are empty, isn't it possible to end up with lastColumn = undefined
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, I think, in that case, the onChange function wouldn't be called.
Whenever someone clicks the table header for sorting, the tableSorting or activeSorters would always return an array of size greater than or equal to 1.
onChange={(pagination, filters, { columnKey, order }) => { | ||
if (!isEqual({ columnKey, order }, this.state.tableSorting)) { | ||
const clickedColumn = tableTitles.get(columnKey || this.state.tableSorting.columnKey); | ||
onChange={(pagination, filters, sorter) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what specifically is changing in antd that requires these modifications, which look more complicated than before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In antd 4x, sorting by multiple sortable columns now reports all columns that are active in sorting, so the event handling code must also accept an array.
}); | ||
|
||
it('hides navigation buttons when not navigable', () => { | ||
wrapper.setProps({ navigable: false }); | ||
const button = wrapper.find('Button'); | ||
expect(button.length).toBe(1); | ||
expect(button.prop('icon')).toBe('close'); | ||
expect(button.getElement(CloseOutlined)).toBeDefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you not look it up by data-testid to avoid explicit dependency on ant icons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maybe it could be done that way too. I will try and update.
@@ -133,7 +133,7 @@ export default class TraceSpanView extends Component<Props, State> { | |||
const columns: ColumnProps<Span>[] = [ | |||
{ | |||
title: 'Service Name', | |||
dataIndex: 'process.serviceName', | |||
dataIndex: ['process', 'serviceName'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this our own notation or something that antd component supports, like a nested indexing path into a data structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
antd dataIndex
definition changes from 'xxx.yyy' to ['xxx', 'yyy']
.
So basically, antd now want us to supply dataIndex path in the form of an array for nested indexing pathnames.
Here's a link to that: https://4x.ant.design/docs/react/migration-v4#:~:text=Nest%20dataIndex%20definition%20changes%20from%20%27xxx.yyy%27%20to%20%5B%27xxx%27%2C%20%27yyy%27%5D
return <Option key={name}>{name} </Option>; | ||
return ( | ||
<Option value={name} key={name}> | ||
{name}{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, what's the need for the extra space in the display string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously it was return <Option key={name}>{name} </Option>;
(Notice an extra space after {name}
).
So, on running yarn fmt
, prettier detected that maybe that space is needed, and formatted it that way ({' '}
)
@@ -38,7 +38,7 @@ describe('<TraceSpanView>', () => { | |||
it('does not explode', () => { | |||
expect(wrapper).toBeDefined(); | |||
expect(wrapper.find('.title--TraceSpanView').length).toBe(1); | |||
expect(wrapper.find('.span-view-table').length).toBe(3); | |||
expect(wrapper.find('.span-view-table').length).toBe(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this count changing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the re-write of the Table in 4.x, there doesn't exist an extra withStore(Table)
wrapper with the class name span-view-table
.
|
||
.ant-menu-item:hover { | ||
background-color: transparent !important; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In antd 4x, the TopNav contains the hover effect by default, which is not what we had earlier.
This CSS property reverts that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't understand this one. The About Jaeger menu also self-activates on hover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The About Jaeger menu also self-activates on hover.
I just checked the live build on the previous version (3.x) without any change. It showed the same behavior there too.
If that was a bug, I would fix it in next PR.
About that CSS change, here's how it behaves without it:
screen-capture.1.webm
With it:
screen-capture.2.webm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
position: absolute; | ||
bottom: 14px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The position of the Timeframe Selector needs to be relative to the Col beside it.
Due to position: absolute
, the Selector was going to the bottom left corner, which is not the desired behavior.
bottom: 14px
is removed because it is already at an appropriate distance from the col below it.
margin: 0 -7px; | ||
margin: -3px -7px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to center the Keyboard shortcut panel icon vertically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'@layout-header-height': '64px', | ||
'@layout-header-height': '48px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Header's height was increased with 4.x upgrade. The resulting NavBar wasn't the one we had earlier. To revert this internal change, the height has to be decreased here.
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
@@ -59,7 +59,7 @@ export default class MonitorATMEmptyState extends React.PureComponent { | |||
)} | |||
{this.config.alert && ( | |||
<Row justify="center"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct that we have a row inside a row?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I am seeing, it's giving the expected result. Not sure 100% though, as there is not a strict guide about nested row and cols.
🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 🥳 |
I rebased #1636, which bumps antd even further - may fail on other issues |
Yes, antd requires another manual bump. The dependabot's PR would fail for now. |
part of #1703 |
Which problem is this PR solving?
Description of the changes
SorterResult
API is removed, so used lodash in place of thatCompareFn
typedef is no longer requiredwindow.matchMedia
, since some tests were using itdataIndex
now requires an array instead of nested string. Ex:"abc.def.ghi"
->["abc", "def", "ghi"]
How was this change tested?
What's next?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test