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

[Visualize] Fix export table for table export links #71249

Merged
merged 7 commits into from
Jul 14, 2020

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Jul 9, 2020

Summary

This PR addresses a naming issue with the export link in the Visualize Data Table plugin.
The plugin itself contains some download logic, which was ignoring the table name since the 7.7.0 release.

In this PR:

  • 🐛 Use the visualization title when available: pick it from the params rather than the vis as the latter is set only at building time, not refreshed
  • 🐛 Use the same unsaved default name as the Inspector download actions

Fixes #67289

Checklist

@dej611 dej611 added Feature:Data Table Data table visualization feature release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 v7.9.0 labels Jul 9, 2020
@dej611 dej611 requested a review from sulemanof July 9, 2020 14:11
@dej611 dej611 self-assigned this Jul 9, 2020
@dej611 dej611 linked an issue Jul 9, 2020 that may be closed by this pull request
@dej611 dej611 force-pushed the fix/csv-export-filename branch from 53f7542 to 8940633 Compare July 9, 2020 14:29
@dej611
Copy link
Contributor Author

dej611 commented Jul 9, 2020

@elasticmachine merge upstream

@dej611
Copy link
Contributor Author

dej611 commented Jul 13, 2020

@elasticmachine merge upstream

@dej611 dej611 marked this pull request as ready for review July 13, 2020 12:14
@dej611 dej611 requested a review from a team July 13, 2020 12:14
@dej611 dej611 requested a review from a team as a code owner July 13, 2020 12:14
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM for app-arch changes

@stratoula
Copy link
Contributor

stratoula commented Jul 14, 2020

@dej611 thanx for taking care of this! Do you also want to update the table_vis_fn_test, add also a test title to the visConfig object? Also can you update the description with the issue that it closes? 🚀

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

LGTM, tested in FF 🍪

Copy link
Contributor

@sulemanof sulemanof left a comment

Choose a reason for hiding this comment

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

The next steps do not work for me:

  1. Export just saved visualization:
  • create a new data table visualization;
  • save it (do not left the page);
  • export table - the unsaved.csv title is in use (expected the saved title)
  1. Export renamed visualization:
  • open any saved visualization;
  • re-save it with new name (do not left the page);
  • click export - the previous saved title is in use (expected the new saved title)

@dej611 dej611 requested a review from sulemanof July 14, 2020 10:44
@@ -33,6 +33,7 @@ export const visualization = () => ({
const visType = config.visType || visConfig.type;

const vis = new ExprVis({
title: config.title,
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to be unnecessary line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may be unnecessary for this case, but ExprVis has a title prop already configured, the title position was not in the right location so I fixed while there.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, but the config doesn't have a title in any kind of visualization.
The config is the result of fn of a visualization (in case of table vis that's the result of table_vis_fn.ts -> fn function).
If you check configs of other visualizations, you'll see that any config doesn't have a title.
So this line do nothing

Copy link
Contributor

@sulemanof sulemanof left a comment

Choose a reason for hiding this comment

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

LGTM, checked locally, works as expected

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-xpack-agent / Kibana Embedded in iframe with X-Pack Security.x-pack/test/functional_embedded/tests/iframe_embedded·ts.Kibana embedded in iframe should open Kibana for logged-in user

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 6 times on tracked branches: https://github.com/elastic/kibana/issues/70928

[00:00:00]       │
[00:00:00]         └-: Kibana embedded
[00:00:00]           └-> "before all" hook
[00:00:00]           └-: in iframe
[00:00:00]             └-> "before all" hook
[00:00:00]             └-> should open Kibana for logged-in user
[00:00:00]               └-> "before each" hook: global before each
[00:00:00]               │ debg TestSubjects.exists(headerGlobalNav)
[00:00:00]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="headerGlobalNav"]') with timeout=2500
[00:00:02]               │ debg --- retry.tryForTime error: [data-test-subj="headerGlobalNav"] is not displayed
[00:00:03]               │ debg navigating to login url: https://localhost:6131/login
[00:00:03]               │ debg navigate to: https://localhost:6131/login
[00:00:03]               │ debg browser[INFO] https://localhost:6131/login?_t=1594727844134 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:00:03]               │
[00:00:03]               │ debg browser[INFO] https://localhost:6131/bundles/app/core/bootstrap.js 42:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:00:03]               │ debg ... sleep(700) start
[00:00:04]               │ debg ... sleep(700) end
[00:00:04]               │ debg returned from get, calling refresh
[00:00:04]               │ debg browser[INFO] https://localhost:6131/login?_t=1594727844134 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:00:04]               │
[00:00:04]               │ debg browser[INFO] https://localhost:6131/bundles/app/core/bootstrap.js 42:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:00:04]               │ debg currentUrl = https://localhost:6131/login
[00:00:04]               │          appUrl = https://localhost:6131/login
[00:00:04]               │ debg TestSubjects.find(kibanaChrome)
[00:00:04]               │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:00:08]               │ debg browser[INFO] https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 452:106112 "INFO: 2020-07-14T11:57:27Z
[00:00:08]               │        Adding connection to https://localhost:6131/elasticsearch
[00:00:08]               │
[00:00:08]               │      "
[00:00:08]               │ debg ... sleep(501) start
[00:00:08]               │ debg ... sleep(501) end
[00:00:08]               │ debg in navigateTo url = https://localhost:6131/login
[00:00:08]               │ debg TestSubjects.exists(statusPageContainer)
[00:00:08]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:00:11]               │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:00:11]               │ debg Waiting for Login Form to appear.
[00:00:11]               │ debg Waiting up to 100000ms for login form...
[00:00:11]               │ debg TestSubjects.exists(loginForm)
[00:00:11]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="loginForm"]') with timeout=2500
[00:00:12]               │ debg TestSubjects.setValue(loginUsername, elastic)
[00:00:12]               │ debg TestSubjects.click(loginUsername)
[00:00:12]               │ debg Find.clickByCssSelector('[data-test-subj="loginUsername"]') with timeout=10000
[00:00:12]               │ debg Find.findByCssSelector('[data-test-subj="loginUsername"]') with timeout=10000
[00:00:12]               │ debg TestSubjects.setValue(loginPassword, changeme)
[00:00:12]               │ debg TestSubjects.click(loginPassword)
[00:00:12]               │ debg Find.clickByCssSelector('[data-test-subj="loginPassword"]') with timeout=10000
[00:00:12]               │ debg Find.findByCssSelector('[data-test-subj="loginPassword"]') with timeout=10000
[00:00:12]               │ debg TestSubjects.click(loginSubmit)
[00:00:12]               │ debg Find.clickByCssSelector('[data-test-subj="loginSubmit"]') with timeout=10000
[00:00:12]               │ debg Find.findByCssSelector('[data-test-subj="loginSubmit"]') with timeout=10000
[00:00:12]               │ debg Waiting for login result, expected: undefined.
[00:00:12]               │ debg Waiting up to 20000ms for logout button visible...
[00:00:12]               │ debg TestSubjects.exists(userMenuButton)
[00:00:12]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="userMenuButton"]') with timeout=2500
[00:00:15]               │ debg browser[INFO] https://localhost:6131/app/home 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:00:15]               │
[00:00:15]               │ debg browser[INFO] https://localhost:6131/bundles/app/core/bootstrap.js 42:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:00:15]               │ debg browser[INFO] https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 452:106112 "INFO: 2020-07-14T11:57:35Z
[00:00:15]               │        Adding connection to https://localhost:6131/elasticsearch
[00:00:15]               │
[00:00:15]               │      "
[00:00:15]               │ debg --- retry.tryForTime error: [data-test-subj="userMenuButton"] is not displayed
[00:00:15]               │ proc [kibana]  error  [11:57:36.921] [error][client][connection] Error: 140331499439936:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
[00:00:15]               │ proc [kibana] 
[00:00:16]               │ERROR browser[SEVERE] http://localhost:6131/api/_newsfeed-FTS-external-service-simulators/kibana/v8.0.0-SNAPSHOT.json - Failed to load resource: net::ERR_EMPTY_RESPONSE
[00:00:16]               │ERROR browser[SEVERE] https://localhost:6131/34551/bundles/plugin/newsfeed/newsfeed.plugin.js 0:19107 TypeError: Failed to fetch
[00:00:16]               │          at Fetch._callee3$ (https://localhost:6131/34551/bundles/core/core.entry.js:34:105174)
[00:00:16]               │          at l (https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:368:155138)
[00:00:16]               │          at Generator._invoke (https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:368:154891)
[00:00:16]               │          at Generator.forEach.e.<computed> [as throw] (https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:368:155495)
[00:00:16]               │          at fetch_asyncGeneratorStep (https://localhost:6131/34551/bundles/core/core.entry.js:34:99267)
[00:00:16]               │          at _throw (https://localhost:6131/34551/bundles/core/core.entry.js:34:99675)
[00:00:16]               │ debg TestSubjects.exists(userMenuButton)
[00:00:16]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="userMenuButton"]') with timeout=2500
[00:00:16]               │ debg TestSubjects.exists(userMenu)
[00:00:16]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="userMenu"]') with timeout=2500
[00:00:18]               │ debg --- retry.tryForTime error: [data-test-subj="userMenu"] is not displayed
[00:00:19]               │ debg TestSubjects.click(userMenuButton)
[00:00:19]               │ debg Find.clickByCssSelector('[data-test-subj="userMenuButton"]') with timeout=10000
[00:00:19]               │ debg Find.findByCssSelector('[data-test-subj="userMenuButton"]') with timeout=10000
[00:00:19]               │ debg Waiting up to 20000ms for user menu opened...
[00:00:19]               │ debg TestSubjects.exists(userMenu)
[00:00:19]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="userMenu"]') with timeout=2500
[00:00:19]               │ debg TestSubjects.exists(userMenu > logoutLink)
[00:00:19]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="userMenu"] [data-test-subj="logoutLink"]') with timeout=2500
[00:00:19]               │ debg TestSubjects.find(iframe_embedded)
[00:00:19]               │ debg Find.findByCssSelector('[data-test-subj="iframe_embedded"]') with timeout=10000
[00:00:19]               │ debg browser[INFO] https://localhost:6131/app/home 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:00:19]               │
[00:00:19]               │ debg browser[INFO] https://localhost:6131/bundles/app/core/bootstrap.js 42:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:00:20]               │ debg TestSubjects.exists(headerGlobalNav)
[00:00:20]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="headerGlobalNav"]') with timeout=2500
[00:00:22]               │ debg browser[INFO] https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 452:106112 "INFO: 2020-07-14T11:57:42Z
[00:00:22]               │        Adding connection to https://localhost:6131/elasticsearch
[00:00:22]               │
[00:00:22]               │      "
[00:00:22]               │ debg --- retry.tryForTime error: [data-test-subj="headerGlobalNav"] is not displayed
[00:00:22]               │ proc [kibana]  error  [11:57:43.871] [error][client][connection] Error: 140331499439936:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
[00:00:22]               │ proc [kibana] 
[00:00:22]               │ERROR browser[SEVERE] http://localhost:6131/api/_newsfeed-FTS-external-service-simulators/kibana/v8.0.0-SNAPSHOT.json - Failed to load resource: net::ERR_EMPTY_RESPONSE
[00:00:22]               │ERROR browser[SEVERE] https://localhost:6131/34551/bundles/plugin/newsfeed/newsfeed.plugin.js 0:19107 TypeError: Failed to fetch
[00:00:22]               │          at Fetch._callee3$ (https://localhost:6131/34551/bundles/core/core.entry.js:34:105174)
[00:00:22]               │          at l (https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:368:155138)
[00:00:22]               │          at Generator._invoke (https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:368:154891)
[00:00:22]               │          at Generator.forEach.e.<computed> [as throw] (https://localhost:6131/34551/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:368:155495)
[00:00:22]               │          at fetch_asyncGeneratorStep (https://localhost:6131/34551/bundles/core/core.entry.js:34:99267)
[00:00:22]               │          at _throw (https://localhost:6131/34551/bundles/core/core.entry.js:34:99675)
[00:00:23]               │ info Taking screenshot "/dev/shm/workspace/kibana/x-pack/test/functional_embedded/screenshots/failure/Kibana embedded in iframe should open Kibana for logged-in user.png"
[00:00:23]               │ info Current URL is: https://localhost:6131/iframe_embedded
[00:00:23]               │ info Saving page source to: /dev/shm/workspace/kibana/x-pack/test/functional_embedded/failure_debug/html/Kibana embedded in iframe should open Kibana for logged-in user.html
[00:00:23]               └- ✖ fail: Kibana embedded in iframe should open Kibana for logged-in user
[00:00:23]               │      Error: expected true to equal false
[00:00:23]               │       at Assertion.assert (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:100:11)
[00:00:23]               │       at Assertion.be.Assertion.equal (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:227:8)
[00:00:23]               │       at Assertion.be (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:69:22)
[00:00:23]               │       at Context.it (test/functional_embedded/tests/iframe_embedded.ts:39:33)
[00:00:23]               │ 
[00:00:23]               │ 

Stack Trace

Error: expected true to equal false
    at Assertion.assert (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:100:11)
    at Assertion.be.Assertion.equal (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:227:8)
    at Assertion.be (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:69:22)
    at Context.it (test/functional_embedded/tests/iframe_embedded.ts:39:33)

Build metrics

✅ unchanged

History

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

@dej611 dej611 merged commit 6154002 into elastic:master Jul 14, 2020
@dej611 dej611 deleted the fix/csv-export-filename branch July 14, 2020 12:41
dej611 added a commit to dej611/kibana that referenced this pull request Jul 14, 2020
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
dej611 added a commit that referenced this pull request Jul 14, 2020
…71629)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 14, 2020
* master: (21 commits)
  [Maps] 7.9 design improvements (elastic#71563)
  [ML] Changing all calls to ML endpoints to use internal user (elastic#70487)
  [eventLog] prevent log writing when initialization fails (elastic#71339)
  [Observability] landing page always being displayed (elastic#71494)
  [IM] Address data stream copy feedback (elastic#71615)
  [Logs UI] Anomalies page dataset filtering (elastic#71110)
  [data.search.aggs] Remove `use_field_mapping` from top hits agg (elastic#71168)
  [ML] Anomaly swim lane embeddable navigation and filter actions (elastic#71082)
  Fixes typo in siem_cloudtrail job description (elastic#71569)
  Require granted API Keys to have a name (elastic#71623)
  Update  getUsageForCollection (elastic#71609)
  Only fetch saved elements once (elastic#71310)
  [SecuritySolution][Resolver] Adding siem index and guarding process ancestry (elastic#71570)
  [APM] Additional data telemetry changes (elastic#71112)
  [Visualize] Fix export table for table export links (elastic#71249)
  [Search] Server side search API (elastic#70446)
  use inclusive language (elastic#71607)
  [Security Solution] Hide timeline footer when Resolver is open (elastic#71516)
  [Index template wizard] Remove shadow and use border for components panels (elastic#71606)
  [ML] Kibana API endpoint for histogram chart data (elastic#70976)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Table Data table visualization feature release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use visualization name for CSV export filename
6 participants