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

Use the displayName property in default editor #73311

Merged
merged 4 commits into from
Oct 27, 2020

Conversation

timroes
Copy link
Contributor

@timroes timroes commented Jul 27, 2020

Summary

This will make the default vis editor to use the displayName instead of the name property of an index pattern field properly. (It currently already showed it after selection, but not in the list.

Easiest way to test this is to enable the shortDots:enable setting under advanced settings. Now all field names containing at least a . should be shortened before that to just one letter per block.

This is a preparation for #69908 where users can specify the displayName themselves.

Known bugs

When opening the checkbox and there are duplicate items the checkmark is shown before both items, not just the one actually selected. That's a bug in EUI and will be still be fixed via (elastic/eui#4162) so ignore this for review, it will be fixed with one of the next EUI upgrades (which happens before the 7.11 release).

screenshot-20201020-153309

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@timroes timroes added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Vis Editor Visualization editor issues v8.0.0 v7.10.0 labels Jul 27, 2020
@timroes timroes requested review from stratoula, sulemanof and a team July 27, 2020 16:30
@timroes timroes requested a review from a team as a code owner July 27, 2020 16:30
@elasticmachine
Copy link
Contributor

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

@timroes timroes added the release_note:skip Skip the PR/issue when compiling release notes label Jul 27, 2020
@@ -57,7 +57,7 @@ export class Field implements IFieldType {
visualizable?: boolean;
scripted?: boolean;
subType?: IFieldSubType;
displayName?: string;
displayName: string;

This comment was marked as outdated.

@@ -52,7 +52,7 @@ function FieldParamEditor({
}: FieldParamEditorProps) {
const [isDirty, setIsDirty] = useState(false);
const selectedOptions: ComboBoxGroupedOptions<IndexPatternField> = value
? [{ label: value.displayName || value.name, target: value }]
? [{ label: value.displayName, target: value }]

This comment was marked as outdated.

@timroes timroes requested a review from kertal July 27, 2020 16:32
@timroes timroes marked this pull request as draft July 27, 2020 16:51
@timroes
Copy link
Contributor Author

timroes commented Jul 27, 2020

Blocked on elastic/eui#3803

@@ -93,7 +93,7 @@ function getAggParamsToRender({
}
}
fields = filterAggTypeFields(availableFields, agg);
indexedFields = groupAndSortBy(fields, 'type', 'name');
indexedFields = groupAndSortBy(fields, 'type', 'displayName');
Copy link
Member

Choose a reason for hiding this comment

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

if there were displayName duplicates, you could prevent troubles with the EuiComboBox by appending the name in this case. So it could be ${displayName} (${name}).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we really want this. I mean e.g. the shortDots setting will change the display name. If a user actually will use this, I assume they really want their names shortened, and I have the feeling printing the long name then for them again, kind of defines the purpose of why they used this setting?

Copy link
Member

Choose a reason for hiding this comment

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

I'd just suggest to display it this way, if there are conflicts with duplicates. so users named 2 fields the same way.
or shortDots converts i.have.cookies and i.hate.cookies to i.h.cookies

@timroes timroes force-pushed the fix/displayname-in-visualize branch from 813b9af to 89abb0b Compare October 20, 2020 12:53
@timroes timroes removed the request for review from a team October 20, 2020 12:54
@timroes timroes requested a review from kertal October 20, 2020 18:58
@timroes timroes marked this pull request as ready for review October 20, 2020 18:59
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.

The only "weird" thing that I noticed is the duplicates but as it is going to be fixed on 7.11 then we are fine. I can't find any other regressions and code is LGTM

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, merged with #69908 and worked.
Bildschirmfoto 2020-10-21 um 13 00 15
Bildschirmfoto 2020-10-21 um 13 03 46

Bildschirmfoto 2020-10-21 um 12 59 44

Only thing I noticed, that for some cases it would be useful if the search of the Combobox would also search the keys (the original field names)

@timroes
Copy link
Contributor Author

timroes commented Oct 27, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
visDefaultEditor 448.8KB 448.8KB +17.0B

page load bundle size

id before after diff
visDefaultEditor 34.4KB 35.4KB +1.0KB

History

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

@timroes timroes merged commit b3af2e9 into elastic:master Oct 27, 2020
@timroes timroes deleted the fix/displayname-in-visualize branch October 27, 2020 12:55
timroes pushed a commit to timroes/kibana that referenced this pull request Oct 27, 2020
* Use displayName in field list in visualize editor

* Set key in combo box

* Fix jest tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 27, 2020
* master:
  [Security Solution][Endpoint][Admin] Malware Protections Notify User Version (elastic#81415)
  Revert "[Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)"
  [Maps] Use default format when proxying EMS-files (elastic#79760)
  [Discover] Deangularize context.html (elastic#81442)
  Use the displayName property in default editor (elastic#73311)
  adds bug label to Bug report for Security Solution template (elastic#81643)
  [ML] Transforms: Remove index field limitation for custom query. (elastic#81467)
  [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)
  [Task Manager] Mark task as failed if maxAttempts has been met. (elastic#80681)
  [Lens] Fix URL query loss on redirect (elastic#81475)
  Log reason for 404 in field existence check (elastic#81315)
timroes pushed a commit that referenced this pull request Oct 27, 2020
* Use displayName in field list in visualize editor

* Set key in combo box

* Fix jest tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 27, 2020
* master: (87 commits)
  [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81778)
  [i18n] add get_kibana_translation_paths tests (elastic#81624)
  [UX] Fix search term reset from url (elastic#81654)
  [Lens] Improved range formatter (elastic#80132)
  [Resolver] `SideEffectContext` changes, remove `@testing-library` uses (elastic#81077)
  [Time to Visualize] Update Library Text with Call to Action (elastic#81667)
  [docs] Resolving failed Kibana upgrade migrations (elastic#80999)
  [ftr/menuToggle] provide helper for enhanced menu toggle handling (elastic#81709)
  [Task Manager] adds basic observability into Task Manager's runtime operations (elastic#77868)
  Doc changes for stack management and grouped feature privileges (elastic#80486)
  Added functional test for alerts list filters by status, alert type and action type. Did a code refactoring and splitting for alerts tests. (elastic#81422)
  [Security Solution][Endpoint][Admin] Malware Protections Notify User Version (elastic#81415)
  Revert "[Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)"
  [Maps] Use default format when proxying EMS-files (elastic#79760)
  [Discover] Deangularize context.html (elastic#81442)
  Use the displayName property in default editor (elastic#73311)
  adds bug label to Bug report for Security Solution template (elastic#81643)
  [ML] Transforms: Remove index field limitation for custom query. (elastic#81467)
  [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)
  [Task Manager] Mark task as failed if maxAttempts has been met. (elastic#80681)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Feature:Vis Editor Visualization editor issues release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants