-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[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> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<EuiLinkTo | ||
to={generateEncodedPath(ENGINE_SCHEMA_PATH, { engineName })} | ||
data-test-subj="displayedEngine" | ||
> | ||
{engineName} | ||
</EuiLinkTo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very helpful, IMO.
<EuiButtonEmpty size="xs" flush="both" data-test-subj="hiddenEnginesToggle"> | ||
+{hiddenEngines.length} | ||
</EuiButtonEmpty> | ||
</EuiToolTip> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
...earch/public/applications/app_search/components/schema/components/truncated_engines_list.tsx
Outdated
Show resolved
Hide resolved
data-test-subj="hiddenEnginesTooltip" | ||
> | ||
<EuiButtonEmpty size="xs" flush="both" data-test-subj="hiddenEnginesToggle"> | ||
+{hiddenEngines.length} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 IntlMessageFormat
i18n
as an array value, it could do the concatenation for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -14,7 +14,9 @@ import { i18n } from '@kbn/i18n'; | |||
|
|||
import { FlashMessages } from '../../../../shared/flash_messages'; | |||
import { Loading } from '../../../../shared/loading'; | |||
import { DataPanel } from '../../data_panel'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]> Co-authored-by: Jason Stoltzfus <[email protected]>
💚 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 <[email protected]> Co-authored-by: Jason Stoltzfus <[email protected]> Co-authored-by: Constance <[email protected]> Co-authored-by: Jason Stoltzfus <[email protected]>
* 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 <[email protected]> Co-authored-by: Jason Stoltzfus <[email protected]>
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 purpose
warning is flagged for manual review, which is intentional given that links are within tables.