-
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
[Dataset Quality]Add logic to display degraded fields in DQ Flyout #183934
Merged
achyutjhunjhunwala
merged 14 commits into
elastic:main
from
achyutjhunjhunwala:logic-to-display-degraded-fields
May 29, 2024
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
919b207
Add logic to display degraded fields in DQ Flyout
achyutjhunjhunwala 23fa2e2
Revert synthtrace changes
achyutjhunjhunwala 07c0fc6
Move pagination logic to state machine and added URL sync logic for s…
achyutjhunjhunwala f38aec5
Fix logic to only call specific datastream
achyutjhunjhunwala 592c396
Add API tests
achyutjhunjhunwala aed4b24
Merge branch 'main' into logic-to-display-degraded-fields
achyutjhunjhunwala 0402cb9
Add FTR tests
achyutjhunjhunwala 00563cd
Fix checktype issue on Public State
achyutjhunjhunwala add5206
Merge branch 'main' into logic-to-display-degraded-fields
achyutjhunjhunwala 803f067
Fix type issue with url schema
achyutjhunjhunwala 75113c7
Fix ts issue with synthtrace
achyutjhunjhunwala e24a79c
Fix review comments iteration 1
achyutjhunjhunwala 10abcbc
Change tooltip message for degraded fields
achyutjhunjhunwala 6f06c20
Merge branch 'main' into logic-to-display-degraded-fields
achyutjhunjhunwala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/observability_solution/dataset_quality/common/data_stream_details/errors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export class GetDataStreamsDetailsError extends Error { | ||
constructor(message: string) { | ||
super(message); | ||
Object.setPrototypeOf(this, new.target.prototype); | ||
this.name = 'GetDataStreamsDetailsError'; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/observability_solution/dataset_quality/common/data_stream_details/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export * from './errors'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ | |
|
||
export * from './dataset_types'; | ||
export * from './quality_types'; | ||
|
||
export type SortDirection = 'asc' | 'desc'; |
52 changes: 52 additions & 0 deletions
52
...servability_solution/dataset_quality/public/components/flyout/degraded_fields/columns.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiBasicTableColumn } from '@elastic/eui'; | ||
import { FieldFormat } from '@kbn/field-formats-plugin/common'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { DegradedField } from '../../../../common/api_types'; | ||
|
||
const fieldColumnName = i18n.translate('xpack.datasetQuality.flyout.degradedField.field', { | ||
defaultMessage: 'Field', | ||
}); | ||
|
||
const countColumnName = i18n.translate('xpack.datasetQuality.flyout.degradedField.count', { | ||
defaultMessage: 'Count', | ||
}); | ||
|
||
const lastOccurrenceColumnName = i18n.translate( | ||
'xpack.datasetQuality.flyout.degradedField.lastOccurrence', | ||
{ | ||
defaultMessage: 'Last Occurrence', | ||
} | ||
); | ||
|
||
export const getDegradedFieldsColumns = ({ | ||
dateFormatter, | ||
}: { | ||
dateFormatter: FieldFormat; | ||
}): Array<EuiBasicTableColumn<DegradedField>> => [ | ||
{ | ||
name: fieldColumnName, | ||
field: 'name', | ||
}, | ||
{ | ||
name: countColumnName, | ||
sortable: true, | ||
field: 'count', | ||
truncateText: true, | ||
}, | ||
{ | ||
name: lastOccurrenceColumnName, | ||
sortable: true, | ||
field: 'lastOccurrence', | ||
render: (lastOccurrence: number) => { | ||
return dateFormatter.convert(lastOccurrence); | ||
}, | ||
}, | ||
]; |
25 changes: 25 additions & 0 deletions
25
...ity_solution/dataset_quality/public/components/flyout/degraded_fields/degraded_fields.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiFlexGroup, EuiPanel, EuiTitle, EuiIconTip } from '@elastic/eui'; | ||
import { flyoutImprovementText, flyoutImprovementTooltip } from '../../../../common/translations'; | ||
import { DegradedFieldTable } from './table'; | ||
|
||
export function DegradedFields() { | ||
return ( | ||
<EuiPanel hasBorder grow={false}> | ||
achyutjhunjhunwala marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<EuiFlexGroup responsive={false} alignItems="center" gutterSize="xs"> | ||
<EuiTitle size="xxxs"> | ||
<h6>{flyoutImprovementText}</h6> | ||
</EuiTitle> | ||
<EuiIconTip content={flyoutImprovementTooltip} color="subdued" size="m" /> | ||
</EuiFlexGroup> | ||
<DegradedFieldTable /> | ||
</EuiPanel> | ||
); | ||
} |
54 changes: 54 additions & 0 deletions
54
...observability_solution/dataset_quality/public/components/flyout/degraded_fields/table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiBasicTable, EuiEmptyPrompt } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types'; | ||
import { useDatasetQualityDegradedField } from '../../../hooks'; | ||
import { getDegradedFieldsColumns } from './columns'; | ||
import { | ||
flyoutDegradedFieldsTableLoadingText, | ||
flyoutDegradedFieldsTableNoData, | ||
} from '../../../../common/translations'; | ||
|
||
export const DegradedFieldTable = () => { | ||
const { isLoading, pagination, renderedItems, onTableChange, sort, fieldFormats } = | ||
useDatasetQualityDegradedField(); | ||
const dateFormatter = fieldFormats.getDefaultInstance(KBN_FIELD_TYPES.DATE, [ | ||
ES_FIELD_TYPES.DATE, | ||
]); | ||
const columns = getDegradedFieldsColumns({ dateFormatter }); | ||
|
||
return ( | ||
<EuiBasicTable | ||
tableLayout="fixed" | ||
columns={columns} | ||
items={renderedItems ?? []} | ||
loading={isLoading} | ||
sorting={sort} | ||
onChange={onTableChange} | ||
pagination={pagination} | ||
data-test-subj="datasetQualityFlyoutDegradedFieldTable" | ||
rowProps={{ | ||
'data-test-subj': 'datasetQualityFlyoutDegradedTableRow', | ||
}} | ||
noItemsMessage={ | ||
isLoading ? ( | ||
flyoutDegradedFieldsTableLoadingText | ||
) : ( | ||
<EuiEmptyPrompt | ||
data-test-subj="datasetQualityFlyoutDegradedTableNoData" | ||
layout="vertical" | ||
title={<h2>{flyoutDegradedFieldsTableNoData}</h2>} | ||
hasBorder={false} | ||
titleSize="m" | ||
/> | ||
) | ||
} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like there's a typo here. "Please note..." instead of "Please not..." You can probably remove that part anyway and just say "This list may not be exhaustive." We could also change the tooltip a little more and say, "A partial list of degraded fields found in your dataset." to imply that it's not exhaustive.
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.
Thank @mdbirnstiehl I will go with
"A partial list of degraded fields found in your dataset."
and update the tooltip in my next PR