mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Streams] Enable dependencies linting rule (#216177)
This commit is contained in:
parent
ffb196f8e6
commit
d03727f93a
7 changed files with 87 additions and 83 deletions
|
@ -967,7 +967,7 @@ module.exports = {
|
|||
files: [
|
||||
'x-pack/platform/plugins/shared/observability_solution/**/*.{ts,tsx}',
|
||||
'x-pack/solutions/observability/plugins/**/*.{ts,tsx}',
|
||||
'x-pack/solutions/observability/plugins/{streams,streams_app}/**/*.{ts,tsx}',
|
||||
'x-pack/platform/plugins/shared/{streams,streams_app}/**/*.{ts,tsx}',
|
||||
'x-pack/solutions/observability/packages/**/*.{ts,tsx}',
|
||||
],
|
||||
rules: {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { compact } from 'lodash';
|
||||
import { useEuiTheme } from '@elastic/eui';
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
IlmPolicyDeletePhase,
|
||||
IlmPolicyHotPhase,
|
||||
|
@ -19,78 +20,81 @@ import { rolloverCondition } from '../helpers/rollover_condition';
|
|||
export const useIlmPhasesColorAndDescription = () => {
|
||||
const { euiTheme } = useEuiTheme();
|
||||
|
||||
return {
|
||||
ilmPhases: {
|
||||
hot: {
|
||||
color: euiTheme.colors.vis.euiColorVis6,
|
||||
description: (phase: IlmPolicyPhase | IlmPolicyDeletePhase, phases: IlmPolicyPhases) => {
|
||||
const hotPhase = phase as IlmPolicyHotPhase;
|
||||
const hasNextPhase = Boolean(
|
||||
phases.warm || phases.cold || phases.frozen || phases.delete
|
||||
);
|
||||
const condition = rolloverCondition(hotPhase.rollover);
|
||||
return compact([
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.hotPhaseDescription', {
|
||||
return useMemo(
|
||||
() => ({
|
||||
ilmPhases: {
|
||||
hot: {
|
||||
color: euiTheme.colors.vis.euiColorVis6,
|
||||
description: (phase: IlmPolicyPhase | IlmPolicyDeletePhase, phases: IlmPolicyPhases) => {
|
||||
const hotPhase = phase as IlmPolicyHotPhase;
|
||||
const hasNextPhase = Boolean(
|
||||
phases.warm || phases.cold || phases.frozen || phases.delete
|
||||
);
|
||||
const condition = rolloverCondition(hotPhase.rollover);
|
||||
return compact([
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.hotPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Recent, frequently-searched data. Best indexing and search performance.',
|
||||
}),
|
||||
hasNextPhase
|
||||
? condition
|
||||
? i18n.translate(
|
||||
'xpack.streams.streamDetailLifecycle.hotPhaseRolloverDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'*Time since rollover. Current rollover condition: {condition}.',
|
||||
values: { condition },
|
||||
}
|
||||
)
|
||||
: i18n.translate(
|
||||
'xpack.streams.streamDetailLifecycle.hotPhaseNoRolloverDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'*Time since rollover. Data will not move to the next phase because rollover is not enabled.',
|
||||
}
|
||||
)
|
||||
: '',
|
||||
]);
|
||||
},
|
||||
},
|
||||
warm: {
|
||||
color: euiTheme.colors.vis.euiColorVis9,
|
||||
description: () => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.warmPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Recent, frequently-searched data. Best indexing and search performance.',
|
||||
'Frequently searched data, rarely updated. Optimized for search, not indexing.',
|
||||
}),
|
||||
hasNextPhase
|
||||
? condition
|
||||
? i18n.translate(
|
||||
'xpack.streams.streamDetailLifecycle.hotPhaseRolloverDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'*Time since rollover. Current rollover condition: {condition}.',
|
||||
values: { condition },
|
||||
}
|
||||
)
|
||||
: i18n.translate(
|
||||
'xpack.streams.streamDetailLifecycle.hotPhaseNoRolloverDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'*Time since rollover. Data will not move to the next phase because rollover is not enabled.',
|
||||
}
|
||||
)
|
||||
: '',
|
||||
]);
|
||||
],
|
||||
},
|
||||
cold: {
|
||||
color: euiTheme.colors.vis.euiColorVis1,
|
||||
description: () => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.coldPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Data searched infrequently, not updated. Optimized for cost savings over search performance.',
|
||||
}),
|
||||
],
|
||||
},
|
||||
frozen: {
|
||||
color: euiTheme.colors.vis.euiColorVis2,
|
||||
description: () => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.frozenPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Most cost-effective way to store your data and still be able to search it.',
|
||||
}),
|
||||
],
|
||||
},
|
||||
delete: {
|
||||
color: euiTheme.border.color,
|
||||
description: (phase: IlmPolicyPhase | IlmPolicyDeletePhase) => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.deletePhaseDescription', {
|
||||
defaultMessage: 'Data deleted after {duration}.',
|
||||
values: { duration: phase.min_age! },
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
warm: {
|
||||
color: euiTheme.colors.vis.euiColorVis9,
|
||||
description: () => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.warmPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Frequently searched data, rarely updated. Optimized for search, not indexing.',
|
||||
}),
|
||||
],
|
||||
},
|
||||
cold: {
|
||||
color: euiTheme.colors.vis.euiColorVis1,
|
||||
description: () => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.coldPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Data searched infrequently, not updated. Optimized for cost savings over search performance.',
|
||||
}),
|
||||
],
|
||||
},
|
||||
frozen: {
|
||||
color: euiTheme.colors.vis.euiColorVis2,
|
||||
description: () => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.frozenPhaseDescription', {
|
||||
defaultMessage:
|
||||
'Most cost-effective way to store your data and still be able to search it.',
|
||||
}),
|
||||
],
|
||||
},
|
||||
delete: {
|
||||
color: euiTheme.border.color,
|
||||
description: (phase: IlmPolicyPhase | IlmPolicyDeletePhase) => [
|
||||
i18n.translate('xpack.streams.streamDetailLifecycle.deletePhaseDescription', {
|
||||
defaultMessage: 'Data deleted after {duration}.',
|
||||
values: { duration: phase.min_age! },
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
}),
|
||||
[euiTheme]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -102,7 +102,7 @@ export const useIngestionRate = ({
|
|||
})),
|
||||
};
|
||||
},
|
||||
[data.search, definition, timeRange, stats]
|
||||
[data.search, definition, timeRange, stats, core.uiSettings]
|
||||
);
|
||||
|
||||
return {
|
||||
|
@ -250,7 +250,7 @@ export const useIngestionRatePerTier = ({
|
|||
|
||||
return { start, end, interval, buckets };
|
||||
},
|
||||
[data.search, streamsRepositoryClient, definition, timeRange, stats]
|
||||
[data.search, streamsRepositoryClient, definition, timeRange, stats, core.uiSettings, ilmPhases]
|
||||
);
|
||||
|
||||
return {
|
||||
|
|
|
@ -22,7 +22,7 @@ export interface DiscoverStreamsLinkProps {
|
|||
locator: StreamsAppLocator;
|
||||
}
|
||||
|
||||
function DiscoverStreamsLink(props: DiscoverStreamsLinkProps) {
|
||||
export function DiscoverStreamsLink(props: DiscoverStreamsLinkProps) {
|
||||
return (
|
||||
<RedirectAppLinks coreStart={{ application: props.coreApplication }}>
|
||||
<EuiFlexGroup direction="column" gutterSize="xs" responsive={false}>
|
||||
|
@ -75,12 +75,13 @@ function DiscoverStreamsLinkContent({
|
|||
doc,
|
||||
locator,
|
||||
}: DiscoverStreamsLinkProps) {
|
||||
const index = doc.raw._index;
|
||||
const flattenedDoc = doc.flattened;
|
||||
const index = doc.raw._index;
|
||||
const fallbackStreamName = getFallbackStreamName(flattenedDoc);
|
||||
const { value, loading, error } = useStreamsAppFetch(
|
||||
async ({ signal }) => {
|
||||
if (!index) {
|
||||
return getFallbackStreamName(flattenedDoc);
|
||||
return fallbackStreamName;
|
||||
}
|
||||
const definition = await streamsRepositoryClient.fetch(
|
||||
'GET /internal/streams/_resolve_index',
|
||||
|
@ -95,7 +96,7 @@ function DiscoverStreamsLinkContent({
|
|||
);
|
||||
return definition?.stream?.name;
|
||||
},
|
||||
[streamsRepositoryClient, index],
|
||||
[streamsRepositoryClient, index, fallbackStreamName],
|
||||
{ disableToastOnError: true }
|
||||
);
|
||||
const params = useMemo(() => ({ name: value }), [value]);
|
||||
|
@ -113,6 +114,3 @@ function DiscoverStreamsLinkContent({
|
|||
|
||||
return <EuiLink href={redirectUrl}>{value}</EuiLink>;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default DiscoverStreamsLink;
|
||||
|
|
|
@ -10,7 +10,9 @@ import { dynamic } from '@kbn/shared-ux-utility';
|
|||
import React from 'react';
|
||||
import { DiscoverStreamsLinkProps } from './discover_streams_link';
|
||||
|
||||
export const DiscoverStreamsLink = dynamic(() => import('./discover_streams_link'));
|
||||
export const DiscoverStreamsLink = dynamic(() =>
|
||||
import('./discover_streams_link').then((m) => ({ default: m.DiscoverStreamsLink }))
|
||||
);
|
||||
|
||||
export function createDiscoverStreamsLink(services: Omit<DiscoverStreamsLinkProps, 'doc'>) {
|
||||
return (props: StreamsFeatureRenderDeps) => <DiscoverStreamsLink {...services} {...props} />;
|
||||
|
|
|
@ -41,7 +41,7 @@ export const useDashboardsFetch = (name?: string) => {
|
|||
|
||||
return response;
|
||||
},
|
||||
[name, streamsRepositoryClient]
|
||||
[name, streamsRepositoryClient, telemetryClient]
|
||||
);
|
||||
|
||||
return dashboardsFetch;
|
||||
|
|
|
@ -68,7 +68,7 @@ export const useStreamsAppFetch: UseAbortableAsync<{}, { disableToastOnError?: b
|
|||
({ signal }) => {
|
||||
return callback({ signal });
|
||||
},
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
deps,
|
||||
optionsForHook
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue