Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ export const getDatasetQualityTableColumns = ({
field: 'failedDocs.percentage',
sortable: true,
render: (_: any, dataStreamStat: DataStreamStat) => {
if (!dataStreamStat.hasFailureStore) {
if (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix for #231576

!dataStreamStat.hasFailureStore &&
dataStreamStat.userPrivileges?.canReadFailureStore
) {
const FailureStoreHoverLink = () => {
const [hovered, setHovered] = React.useState(false);
const locator = urlService.locators.get('INDEX_MANAGEMENT_LOCATOR_ID');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,25 @@ export default function QualitySummaryCards({
/>
</EuiFlexItem>
<EuiFlexItem grow={true}>
{!dataStreamSettingsLoading && !hasFailureStore && canUserReadFailureStore ? (
{!dataStreamSettingsLoading && !(hasFailureStore && canUserReadFailureStore) ? (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix for #231836

<Card
isDisabled={true}
title={overviewPanelDatasetQualityIndicatorFailedDocs}
kpiValue={i18n.translate('xpack.datasetQuality.noFailureStoreTitle', {
defaultMessage: 'No failure store',
})}
footer={
<EuiLink
href={locator?.getRedirectUrl(locatorParams)}
target="_blank"
external={false}
>
{i18n.translate('xpack.datasetQuality.enableFailureStore', {
defaultMessage: 'Enable failure store',
})}
</EuiLink>
canUserReadFailureStore && (
<EuiLink
href={locator?.getRedirectUrl(locatorParams)}
target="_blank"
external={false}
>
{i18n.translate('xpack.datasetQuality.enableFailureStore', {
defaultMessage: 'Enable failure store',
})}
</EuiLink>
)
Comment on lines +105 to +115
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code executes only when !(hasFailureStore && canUserReadFailureStore) is true, but then inside that statement, you're checking if canUserReadFailureStore is true. I think it that part might never execute.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the logic is if one of them or both are false we display the card.

then the link is only displayed if the user really has access to failure store and can enable it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I got confused a bit

}
/>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ import { useDatasetQualityContext } from '../components/dataset_quality/context'
export const useDatasetQualityState = () => {
const { service } = useDatasetQualityContext();

const { datasetUserPrivileges, dataStreamStats } =
useSelector(service, (state) => state.context) ?? {};
const { datasetUserPrivileges } = useSelector(service, (state) => state.context) ?? {};

const statsLoading = useSelector(
service,
(state) => state.matches('initializing') || state.matches('main.stats.datasets.fetching')
);

const canUserReadFailureStore = Boolean(
dataStreamStats?.some((ds) => ds.userPrivileges.canReadFailureStore)
Object.values(datasetUserPrivileges?.datasetsPrivilages ?? {})?.some(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix for #231564

(privilege) => privilege.canReadFailureStore
)
);

const canUserMonitorAnyDataset = Boolean(
Expand Down