Skip to content

Commit

Permalink
[8.8] [ML] Data Frame Analytics creation wizard: ensure preview datag…
Browse files Browse the repository at this point in the history
…rid displays expected fields (#156435) (#156597)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[ML] Data Frame Analytics creation wizard: ensure preview datagrid
displays expected fields
(#156435)](#156435)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Melissa
Alvarez","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-03T17:10:47Z","message":"[ML]
Data Frame Analytics creation wizard: ensure preview datagrid displays
expected fields (#156435)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/154009\r\n\r\nThis PR ensures
the column field check for the data grid preview in DFA\r\nuses the Data
view fields.\r\n\r\nBEFORE:\r\n\r\n<img width=\"1214\"
alt=\"image\"\r\nsrc=\"https://user-images.githubusercontent.com/6446462/228678497-ffe65bf9-1b4c-4f56-bb3d-fe69ac941e62.png\">\r\n\r\nAFTER:
\r\n\r\n<img width=\"1178\"
alt=\"image\"\r\nsrc=\"https://user-images.githubusercontent.com/6446462/235797816-34425648-a470-4631-b6c2-ba453f62752d.png\">\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"22f01bfa0ebfadfb13c999080f6cd6ea170e1d98","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Data
Frame
Analytics","v8.8.0","v8.9.0"],"number":156435,"url":"https://github.com/elastic/kibana/pull/156435","mergeCommit":{"message":"[ML]
Data Frame Analytics creation wizard: ensure preview datagrid displays
expected fields (#156435)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/154009\r\n\r\nThis PR ensures
the column field check for the data grid preview in DFA\r\nuses the Data
view fields.\r\n\r\nBEFORE:\r\n\r\n<img width=\"1214\"
alt=\"image\"\r\nsrc=\"https://user-images.githubusercontent.com/6446462/228678497-ffe65bf9-1b4c-4f56-bb3d-fe69ac941e62.png\">\r\n\r\nAFTER:
\r\n\r\n<img width=\"1178\"
alt=\"image\"\r\nsrc=\"https://user-images.githubusercontent.com/6446462/235797816-34425648-a470-4631-b6c2-ba453f62752d.png\">\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"22f01bfa0ebfadfb13c999080f6cd6ea170e1d98"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156435","number":156435,"mergeCommit":{"message":"[ML]
Data Frame Analytics creation wizard: ensure preview datagrid displays
expected fields (#156435)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/154009\r\n\r\nThis PR ensures
the column field check for the data grid preview in DFA\r\nuses the Data
view fields.\r\n\r\nBEFORE:\r\n\r\n<img width=\"1214\"
alt=\"image\"\r\nsrc=\"https://user-images.githubusercontent.com/6446462/228678497-ffe65bf9-1b4c-4f56-bb3d-fe69ac941e62.png\">\r\n\r\nAFTER:
\r\n\r\n<img width=\"1178\"
alt=\"image\"\r\nsrc=\"https://user-images.githubusercontent.com/6446462/235797816-34425648-a470-4631-b6c2-ba453f62752d.png\">\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"22f01bfa0ebfadfb13c999080f6cd6ea170e1d98"}}]}]
BACKPORT-->

Co-authored-by: Melissa Alvarez <[email protected]>
  • Loading branch information
kibanamachine and alvarezmelissa87 authored May 3, 2023
1 parent ec997b3 commit 7dd0f45
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { extractErrorMessage } from '@kbn/ml-error-utils';
import { isRuntimeMappings } from '../../../../../../common/util/runtime_field_utils';
import { RuntimeMappings } from '../../../../../../common/types/fields';
import { DEFAULT_SAMPLER_SHARD_SIZE } from '../../../../../../common/constants/field_histograms';
import { newJobCapsServiceAnalytics } from '../../../../services/new_job_capabilities/new_job_capabilities_service_analytics';

import { DataLoader } from '../../../../datavisualizer/index_based/data_loader';

Expand Down Expand Up @@ -60,7 +59,7 @@ function getRuntimeFieldColumns(runtimeMappings: RuntimeMappings) {
}

function getIndexPatternColumns(indexPattern: DataView, fieldsFilter: string[]) {
const { fields } = newJobCapsServiceAnalytics;
const { fields } = indexPattern;

return fields
.filter((field) => fieldsFilter.includes(field.name))
Expand Down Expand Up @@ -117,9 +116,9 @@ export const useIndexData = (

// Get all field names for each returned doc and flatten it
// to a list of unique field names used across all docs.
const allKibanaIndexPatternFields = getFieldsFromKibanaIndexPattern(indexPattern);
const allDataViewFields = getFieldsFromKibanaIndexPattern(indexPattern);
const populatedFields = [...new Set(docs.map(Object.keys).flat(1))]
.filter((d) => allKibanaIndexPatternFields.includes(d))
.filter((d) => allDataViewFields.includes(d))
.sort();

setStatus(INDEX_STATUS.LOADED);
Expand Down

0 comments on commit 7dd0f45

Please sign in to comment.