mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -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,7 +20,8 @@ import { rolloverCondition } from '../helpers/rollover_condition';
|
|||
export const useIlmPhasesColorAndDescription = () => {
|
||||
const { euiTheme } = useEuiTheme();
|
||||
|
||||
return {
|
||||
return useMemo(
|
||||
() => ({
|
||||
ilmPhases: {
|
||||
hot: {
|
||||
color: euiTheme.colors.vis.euiColorVis6,
|
||||
|
@ -92,5 +94,7 @@ export const useIlmPhasesColorAndDescription = () => {
|
|||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
}),
|
||||
[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