-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Remote clusters] Fix serialization for server_name field #60953
[Remote clusters] Fix serialization for server_name field #60953
Conversation
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
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.
Hey @alisonelizabeth !
Thanks for working on this fix so quickly!!
I left a comment on the current approach, let me know what you think!
@@ -157,7 +157,7 @@ export function serializeCluster(deserializedClusterObject: Cluster): ClusterPay | |||
mode: mode ?? null, | |||
proxy_address: proxyAddress ?? null, | |||
proxy_socket_connections: proxySocketConnections ?? null, | |||
server_name: serverName ?? null, | |||
server_name: serverName && serverName !== '' ? serverName : null, |
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 part: && serverName !== ''
will not be evaluated if serverName
is ''
because ''
is already falsey. It looks like the fix is serverName ? serverName : null
where the ??
was too restrictively looking at only overriding null
or undefined
.
Do you we face a similar challenge with the other values here?
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.
Or just serverName || null
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.
🤦♀ you're correct! I updated the code. I think it makes sense to use <value> || null
for all values as any falsely value would be invalid.
@jloleysens I updated this PR based on your feedback. Great catch! Mind taking another look? |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Fixes #60902
This PR addresses the scenario where a user has a remote cluster with the
server_name
field defined, and then decides to remove the value via the edit flow.Note: This fixes the UI logic, but it appears there is also a bug on the ES side. See: elastic/elasticsearch#53634 (comment)
How to test
Server name
definedServer name
value (empty input)GET _cluster/settings
and check that theserver_name
field is no longer associated with the remote cluster.