Skip to content
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

Conversation

alisonelizabeth
Copy link
Contributor

@alisonelizabeth alisonelizabeth commented Mar 23, 2020

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

  1. Create a remote cluster with proxy mode enabled and Server name defined
  2. Edit the cluster and remove the Server name value (empty input)
  3. For now, to verify, go to Console and call GET _cluster/settings and check that the server_name field is no longer associated with the remote cluster.

@alisonelizabeth alisonelizabeth added Feature:CCR and Remote Clusters v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more release_note:skip Skip the PR/issue when compiling release notes v7.7.0 labels Mar 23, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@jloleysens jloleysens added this to In progress in Elasticsearch UI Mar 24, 2020
Copy link
Contributor

@jloleysens jloleysens left a 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,
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just serverName || null

Copy link
Contributor Author

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.

@alisonelizabeth
Copy link
Contributor Author

@jloleysens I updated this PR based on your feedback. Great catch! Mind taking another look?

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alisonelizabeth alisonelizabeth merged commit 6b6f6ae into elastic:master Mar 24, 2020
Elasticsearch UI automation moved this from In progress to Done Mar 24, 2020
@alisonelizabeth alisonelizabeth deleted the bugfix/remote_clusters/edit_server_name branch March 24, 2020 19:35
alisonelizabeth added a commit to alisonelizabeth/kibana that referenced this pull request Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:CCR and Remote Clusters release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v8.0.0
Projects
Development

Successfully merging this pull request may close these issues.

[Remote clusters] Cannot delete server name field in edit mode
4 participants