mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[UnifiedSearch] Reduce length for filter badge id (#170439)
## Summary This PR aims to reduce the possible long length of filter badge test id. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
96a4d5b63f
commit
4053f711b1
3 changed files with 7 additions and 2 deletions
|
@ -11,6 +11,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import React, { FC } from 'react';
|
||||
import { Filter, isFilterPinned } from '@kbn/es-query';
|
||||
import { DataView } from '@kbn/data-views-plugin/common';
|
||||
import { stringHash } from '@kbn/ml-string-hash';
|
||||
import type { FilterLabelStatus } from '../filter_item/filter_item';
|
||||
import { FilterBadge } from '../../filter_badge';
|
||||
|
||||
|
@ -103,7 +104,7 @@ export const FilterView: FC<Props> = ({
|
|||
hideAlias={hideAlias}
|
||||
{...badgeProps}
|
||||
{...rest}
|
||||
data-test-subj={`filter-badge-'${innerText}' ${rest['data-test-subj']}`}
|
||||
data-test-subj={`filter-badge-${stringHash(innerText || '')} ${rest['data-test-subj']}`}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
"@kbn/text-based-editor",
|
||||
"@kbn/core-doc-links-browser",
|
||||
"@kbn/core-lifecycle-browser",
|
||||
"@kbn/ml-string-hash",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { stringHash } from '@kbn/ml-string-hash';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function AssetDetailsProvider({ getService }: FtrProviderContext) {
|
||||
|
@ -101,7 +102,9 @@ export function AssetDetailsProvider({ getService }: FtrProviderContext) {
|
|||
|
||||
async getMetadataAppliedFilter() {
|
||||
const filter = await testSubjects.find(
|
||||
"filter-badge-'host.architecture: arm64' filter filter-enabled filter-key-host.architecture filter-value-arm64 filter-unpinned filter-id-0"
|
||||
`filter-badge-${stringHash(
|
||||
'host.architecture: arm64'
|
||||
)} filter filter-enabled filter-key-host.architecture filter-value-arm64 filter-unpinned filter-id-0`
|
||||
);
|
||||
return filter.getVisibleText();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue