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

Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid #92442

Merged
merged 11 commits into from
Mar 17, 2021

Conversation

DianaDerevyankina
Copy link
Contributor

Closes #59949

Summary

Replaced EuiCodeBlock with JsonCodeEditor in DiscoverGrid cell popover

image

To test:

  1. In Advanced settings set the value of doc_table:legacy property to false

    image

  2. Open Discover

  3. Click expand button on any cell in Document column

    image

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@DianaDerevyankina DianaDerevyankina added Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.13.0 labels Feb 23, 2021
@DianaDerevyankina DianaDerevyankina self-assigned this Feb 23, 2021
@alexwizp alexwizp requested a review from kertal February 25, 2021 06:53
Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

Thx for this migration! Is there an option to remove the line numbers here? Since I think they are not necessary in this case, and it would save a bit of screen space here. Also I'd like to have an opinion of our valued @elastic/kibana-design team about this change

@kertal kertal requested a review from a team February 25, 2021 10:35
@myasonik
Copy link
Contributor

I guess it would depend on the specific use case on whether or not the line numbers are helpful.

Not sure that this is what we want to do, but to at least know what the possibilities are: is it possible to add a toggle in this popover to show/hide the line numbers?

@DianaDerevyankina
Copy link
Contributor Author

@kertal what do you think about the toggle for displaying line numbers?

@kertal
Copy link
Member

kertal commented Mar 1, 2021

@kertal what do you think about the toggle for displaying line numbers?

I do agree that there might be situations when this is useful, but generally for me it's a quick preview and shouldn't have to much additional UI, dear @snide & @ryankeairns, wdyt?

@ryankeairns
Copy link
Contributor

I side with @kertal . This is a rather small preview capability whereas a user can access a larger view of the JSON in the flyout by clicking on the expand icon at the front of each row.

Generally speaking, I wonder about the value for this small preview. Perhaps we should consider opening the flyout with the JSON tab opened.

@kertal
Copy link
Member

kertal commented Mar 2, 2021

Generally speaking, I wonder about the value for this small preview. Perhaps we should consider opening the flyout with the JSON tab opened.

This is not just a small preview for the all of _fields or _source, it's being used for any data structure that is of type object, so I wonder if it should behave differently in this case?

@ryankeairns
Copy link
Contributor

Generally speaking, I wonder about the value for this small preview. Perhaps we should consider opening the flyout with the JSON tab opened.

This is not just a small preview for the all of _fields or _source, it's being used for any data structure that is of type object, so I wonder if it should behave differently in this case?

Ah, ok. For the non _fields or _source objects, is there any other way to expand or view that data or is the popover the only way?

@kertal
Copy link
Member

kertal commented Mar 2, 2021

Ah, ok. For the non _fields or _source objects, is there any other way to expand or view that data or is the popover the only way?

The popover is the only way to expand a single value, except of course they are part of the doc view table and JSON view.

@ryankeairns ryankeairns closed this Mar 2, 2021
@ryankeairns ryankeairns reopened this Mar 2, 2021
@ryankeairns
Copy link
Contributor

Thanks for the context @kertal . My line of thought here is to either include the line number or not (I lean towards not), but not invest much more in adding additional UI/options until we have a chance to think this through further. I sense there may be a path of leveraging the flyout in more cases, but that will take us running through a few use cases to verify that assumption.

PS - oops, I closed this on accident... speaking of tricky UX ;)

@kertal
Copy link
Member

kertal commented Mar 2, 2021

Thanks for the context @kertal . My line of thought here is to either include the line number or not (I lean towards not), but not invest much more in adding additional UI/options until we have a chance to think this through further. I sense there may be a path of leveraging the flyout in more cases, but that will take us running through a few use cases to verify that assumption.

PS - oops, I closed this on accident... speaking of tricky UX ;)

I also lead towards no line numbers, so I suggest going forward here (Think your unconsciousness wants also a close button in the popover, that might explain your choice of button ... suggesting a different issue for that ;)

@DianaDerevyankina DianaDerevyankina marked this pull request as ready for review March 4, 2021 10:55
@DianaDerevyankina DianaDerevyankina requested a review from a team March 4, 2021 10:55
@elasticmachine
Copy link
Contributor

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

@alexwizp
Copy link
Contributor

alexwizp commented Mar 4, 2021

@elasticmachine merge upstream

@@ -108,8 +109,7 @@ export const getRenderCellValueFn = (

if (field && field.type === '_source') {
if (isDetails) {
// nicely formatted JSON for the expanded view
return <span>{JSON.stringify(row, null, 2)}</span>;
return <JsonCodeEditor hit={row} hasLineNumbers={false} width={370} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please provide some details why 370 and maybe create constant for this?

@DianaDerevyankina DianaDerevyankina requested a review from a team as a code owner March 5, 2021 13:45
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

maps changes LGTM
code review

@kertal
Copy link
Member

kertal commented Mar 8, 2021

@elasticmachine merge upstream

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

Tested locally in Safari, Firefox, Chrome, OSX, works like expected with the Documents column, but with other columns it currently doesn't work, for example geoip.location
OLD:
Bildschirmfoto 2021-03-09 um 17 19 16
NEW:
Bildschirmfoto 2021-03-09 um 17 01 55

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 402.0KB 402.0KB +50.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 79.6KB 81.1KB +1.5KB

History

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

cc @dziyanadzeraviankina

Copy link
Member

@kertal kertal 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, tested locally in Chrome, Firefox, Safari, MacOS, works as expected, thx for the functional and the code simplification 🙏

@stratoula
Copy link
Contributor

@elasticmachine run elasticsearch-ci/docs

@DianaDerevyankina DianaDerevyankina merged commit bdcd2ec into elastic:master Mar 17, 2021
DianaDerevyankina added a commit to DianaDerevyankina/kibana that referenced this pull request Mar 17, 2021
* Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid

* Add optional "hasLineNumbers" property to JsonCodeEditor and removed line numbers from the popover

* Update json_code_editor snapshot

* Add functional test for cell expanded content popover

* Remove unused code

* Fix geo point case and refactor some code

Co-authored-by: Kibana Machine <[email protected]>
DianaDerevyankina added a commit that referenced this pull request Mar 17, 2021
…4780)

* Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid

* Add optional "hasLineNumbers" property to JsonCodeEditor and removed line numbers from the popover

* Update json_code_editor snapshot

* Add functional test for cell expanded content popover

* Remove unused code

* Fix geo point case and refactor some code

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
jloleysens added a commit that referenced this pull request Mar 17, 2021
…-action

* 'master' of github.com:elastic/kibana: (44 commits)
  Migrate the optimizer mixin to core (#94272)
  Replace EuiCodeBlock with JsonCodeEditor in DiscoverGrid (#92442)
  [ML] Anomaly Detection: Migrate validation messages links to use docLinks. (#94568)
  [Lists][Exceptions] - Adding basic linting, i18n and storybook support (#94772)
  [Fleet] Add test/fix for invalid/missing ids in bulk agent reassign (#94632)
  [Security Solution] [Cases] Move create page components and dependencies to Cases (#94444)
  [ML] Data Frame Analytics accessibility tests: fix flaky outlier creation test (#94735)
  [Security Solutions] Remove commented out old linter rules (#94753)
  [App Search] Role mappings migration part 2 (#94461)
  [CI] Update Backport action inputs to match updated ones (#94721)
  [chore] Remove the infra team from CODEOWNERS (#94740)
  [Connectors UI] Make UI use new connector APIs (#94180)
  [ML] Use indices options in anomaly detection job wizards (#91830)
  Remove `string` as a valid registry var type value (#94174)
  [Alerts] Replaces legacy es client with the ElasticsearchClient for alerts and triggers_actions_ui plugins. (#93364)
  [Reporting-CSV Export] Re-write CSV Export using SearchSource (#88303)
  chore(NA): upgrade bazel rules nodejs to v3.2.2 (#94726)
  [APM] Settings: Update layout and update/add descriptions (#94398)
  skip flaky suite (#94666)
  [XY axis] Integrates legend color picker with the eui palette (#90589)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/constants.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/configuration_context.tsx
#	x-pack/plugins/index_lifecycle_management/public/shared_imports.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand/collapse JSON in discover
10 participants