[App Search] Meta engines schema view#100087
Conversation
- Used for listing source engines - New in Kibana: now links to source engine schema pages for easier schema fixes!
|
This is the last schema view!!! With this PR, I think all our views but crawler are migrated 🤞 💦 |
| {Object.entries(conflictingFields).map(([fieldName, conflicts]) => | ||
| Object.entries(conflicts).map(([fieldType, engines], i) => { | ||
| const isFirstRow = i === 0; | ||
| return ( | ||
| <EuiTableRow key={`${fieldName}-${fieldType}`}> | ||
| {isFirstRow && ( | ||
| <EuiTableRowCell | ||
| rowSpan={Object.values(conflicts).length} | ||
| data-test-subj="fieldName" | ||
| > | ||
| <code>{fieldName}</code> | ||
| </EuiTableRowCell> | ||
| )} |
| <EuiLinkTo | ||
| to={generateEncodedPath(ENGINE_SCHEMA_PATH, { engineName })} | ||
| data-test-subj="displayedEngine" | ||
| > | ||
| {engineName} | ||
| </EuiLinkTo> |
There was a problem hiding this comment.
Hopefully y'all agree the source engine links are helpful! Very pleased it's such an easy thing for us to do now in Kibana.
| <EuiButtonEmpty size="xs" flush="both" data-test-subj="hiddenEnginesToggle"> | ||
| +{hiddenEngines.length} | ||
| </EuiButtonEmpty> | ||
| </EuiToolTip> |
| 'xpack.enterpriseSearch.appSearch.engine.schema.metaEngine.conflictsCalloutTitle', | ||
| { | ||
| defaultMessage: | ||
| '{conflictingFieldsCount, plural, one {# field is} other {# fields are}} not searchable', |
There was a problem hiding this comment.
I'm not actually sure this i18n is correct. Does anyone know for sure how to handle is vs. are pluralization in i18n?... 😬
There was a problem hiding this comment.
I don't. But this looks good sufficient to me. Since the entire message is in the i18n string I think the translator has enough control to make this work in other languages.
JasonStoltz
left a comment
There was a problem hiding this comment.
This looks great @constancecchen. I really appreciate the cleanup of the field types conflicts, it looks 10x better than before. The code is super clean and modular as well.
I dropped a couple of comments about i18n, I'd just merge this PR as is though, we can circle back to those later if we decide it's warranted.
| data-test-subj="hiddenEnginesTooltip" | ||
| > | ||
| <EuiButtonEmpty size="xs" flush="both" data-test-subj="hiddenEnginesToggle"> | ||
| +{hiddenEngines.length} |
There was a problem hiding this comment.
Should we i18n this?
I didn't test this, but would it be something like...
| +{hiddenEngines.length} | |
| {i18n.translate( | |
| 'xpack.enterpriseSearch.appSearch.engine.schema.metaEngine.additionalEnginesCount', | |
| { defaultMessage: '+{count, number}', values: { count: hiddenEngines.length } } | |
| }) |
I'm actually unsure of what the best practice is here. If you're unsure also maybe we can inquire with #kibana-localization
Or perhaps just a FormattedNumber would work here. I guess it depends on whether the + is significant to translate to other languages.
|
|
||
| const displayedEngines = engines.slice(0, cutoff); | ||
| const hiddenEngines = engines.slice(cutoff); | ||
| const SEPARATOR = ', '; |
There was a problem hiding this comment.
I actually wonder if this should be i18ned as well.
I did some digging in the localization channel in slack, I think if you pass an array of values as a value to IntlMessageFormati18n as an array value, it could do the concatenation for you.
There was a problem hiding this comment.
I think the difficulty here is that I'm using SEPARATOR in various places and not just as a joined array (e.g. conditionally if the tooltip truncation kicks in, in a .map because we're using EuiLinkTo for the engine names, etc. 🤔
To be honest, I think a better approach might be to use something like <EuiBadge> or some other EUI list component to list out engines in any case... Maybe just copy what we do for analytics tags:
Our tag truncation component (link) also uses and X more text instead of a "+X" copy. We avoid all the i18n shenanigans with commas AND the + with that approach 🤔
@daveyholler what do you think?... would engine names in badges be weird?
|
|
||
| import { FlashMessages } from '../../../../shared/flash_messages'; | ||
| import { Loading } from '../../../../shared/loading'; | ||
| import { DataPanel } from '../../data_panel'; |
There was a problem hiding this comment.
Woah, nice, looks like you created this for another view and were able to reuse? That's great.
There was a problem hiding this comment.
Haha all credit goes to @daveyholler for this component! 🎉
| 'xpack.enterpriseSearch.appSearch.engine.schema.metaEngine.conflictsCalloutTitle', | ||
| { | ||
| defaultMessage: | ||
| '{conflictingFieldsCount, plural, one {# field is} other {# fields are}} not searchable', |
There was a problem hiding this comment.
I don't. But this looks good sufficient to me. Since the entire message is in the i18n string I think the translator has enough control to make this work in other languages.
…h/components/schema/components/truncated_engines_list.tsx Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
|
Going to go ahead and merge for now / to get this done before GAH, but would definitely like to revisit i18n more broadly in the future! |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Unknown metric groupsReferences to deprecated APIs
History
To update your PR or re-run it, just comment with: |
* Set up TruncatedEnginesList component - Used for listing source engines - New in Kibana: now links to source engine schema pages for easier schema fixes! * Add meta engines schema active fields table * Render meta engine schema conflicts table & warning callout * Update x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/truncated_engines_list.tsx Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com> Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* Set up TruncatedEnginesList component - Used for listing source engines - New in Kibana: now links to source engine schema pages for easier schema fixes! * Add meta engines schema active fields table * Render meta engine schema conflicts table & warning callout * Update x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/truncated_engines_list.tsx Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com> Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com> Co-authored-by: Constance <constancecchen@users.noreply.github.com> Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
* Set up TruncatedEnginesList component - Used for listing source engines - New in Kibana: now links to source engine schema pages for easier schema fixes! * Add meta engines schema active fields table * Render meta engine schema conflicts table & warning callout * Update x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/truncated_engines_list.tsx Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com> Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>



Summary
Meta engines do not have documents/schema themselves, so they instead display an overview of the source engine schema as well as showing any conflicts in types for source engines.
Screencaps
New in Kibana / different from ent-search
QA
Checklist
Links with the same name have a similar purposewarning is flagged for manual review, which is intentional given that links are within tables.