mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Type checks] Fix infra obs ui typecheck (#167217)
## 📓 Summary
These changes fix the type-check issues related to infra obs UI code.
It also includes some fixes for the APM plugin that were stopping the
check step from passing.
---------
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
This commit is contained in:
parent
08d44fe52b
commit
34c084d65a
11 changed files with 36 additions and 20 deletions
|
@ -110,10 +110,12 @@ export function MobileStats({
|
|||
defaultMessage: 'Crash rate',
|
||||
}),
|
||||
icon: getIcon('bug'),
|
||||
value: data?.currentPeriod?.crashRate?.value ?? NOT_AVAILABLE_LABEL,
|
||||
value: data?.currentPeriod?.crashRate?.value ?? NaN,
|
||||
valueFormatter: (value: number) =>
|
||||
valueFormatter(Number((value * 100).toPrecision(2)), '%'),
|
||||
trend: data?.currentPeriod?.crashRate?.timeseries,
|
||||
Number.isNaN(value)
|
||||
? NOT_AVAILABLE_LABEL
|
||||
: valueFormatter(Number((value * 100).toPrecision(2)), '%'),
|
||||
trend: data?.currentPeriod?.crashRate?.timeseries ?? [],
|
||||
extra: getComparisonValueFormatter(data?.previousPeriod.crashRate?.value),
|
||||
trendShape: MetricTrendShape.Area,
|
||||
},
|
||||
|
@ -137,8 +139,9 @@ export function MobileStats({
|
|||
defaultMessage: 'Sessions',
|
||||
}),
|
||||
icon: getIcon('timeslider'),
|
||||
value: data?.currentPeriod?.sessions?.value ?? NOT_AVAILABLE_LABEL,
|
||||
valueFormatter: (value: number) => valueFormatter(value),
|
||||
value: data?.currentPeriod?.sessions?.value ?? NaN,
|
||||
valueFormatter: (value: number) =>
|
||||
Number.isNaN(value) ? NOT_AVAILABLE_LABEL : valueFormatter(value),
|
||||
trend: data?.currentPeriod?.sessions?.timeseries,
|
||||
extra: getComparisonValueFormatter(data?.previousPeriod.sessions?.value),
|
||||
trendShape: MetricTrendShape.Area,
|
||||
|
@ -149,10 +152,11 @@ export function MobileStats({
|
|||
defaultMessage: 'HTTP requests',
|
||||
}),
|
||||
icon: getIcon('kubernetesPod'),
|
||||
value: data?.currentPeriod?.requests?.value ?? NOT_AVAILABLE_LABEL,
|
||||
extra: getComparisonValueFormatter(data?.previousPeriod.requests?.value),
|
||||
valueFormatter: (value: number) => valueFormatter(value),
|
||||
trend: data?.currentPeriod?.requests?.timeseries,
|
||||
value: data?.currentPeriod?.requests?.value ?? NaN,
|
||||
valueFormatter: (value: number) =>
|
||||
Number.isNaN(value) ? NOT_AVAILABLE_LABEL : valueFormatter(value),
|
||||
trend: data?.currentPeriod?.requests?.timeseries ?? [],
|
||||
trendShape: MetricTrendShape.Area,
|
||||
},
|
||||
];
|
||||
|
|
|
@ -205,7 +205,7 @@ function SummaryMetric({
|
|||
loading: boolean;
|
||||
hasData: boolean;
|
||||
}) {
|
||||
const xlFontSize = useEuiFontSize('xl', { measurement: 'px' });
|
||||
const xlFontSize = useEuiFontSize('xl', { unit: 'px' });
|
||||
const { euiTheme } = useEuiTheme();
|
||||
|
||||
return (
|
||||
|
|
|
@ -25,7 +25,7 @@ const apmRouter = {
|
|||
} as ApmRouter;
|
||||
|
||||
const infraLocators = infraLocatorsMock;
|
||||
const observabilityLogExplorerLocators = observabilityLogExplorerLocatorsMock;
|
||||
const { allDatasetsLocator } = observabilityLogExplorerLocatorsMock;
|
||||
|
||||
const expectInfraLocatorsToBeCalled = () => {
|
||||
expect(infraLocators.nodeLogsLocator.getRedirectUrl).toBeCalledTimes(3);
|
||||
|
@ -65,7 +65,7 @@ describe('Transaction action menu', () => {
|
|||
location,
|
||||
apmRouter,
|
||||
infraLocators,
|
||||
observabilityLogExplorerLocators,
|
||||
allDatasetsLocator,
|
||||
infraLinksAvailable: false,
|
||||
rangeFrom: 'now-24h',
|
||||
rangeTo: 'now',
|
||||
|
@ -131,7 +131,7 @@ describe('Transaction action menu', () => {
|
|||
location,
|
||||
apmRouter,
|
||||
infraLocators,
|
||||
observabilityLogExplorerLocators,
|
||||
allDatasetsLocator,
|
||||
infraLinksAvailable: true,
|
||||
rangeFrom: 'now-24h',
|
||||
rangeTo: 'now',
|
||||
|
@ -216,7 +216,7 @@ describe('Transaction action menu', () => {
|
|||
location,
|
||||
apmRouter,
|
||||
infraLocators,
|
||||
observabilityLogExplorerLocators,
|
||||
allDatasetsLocator,
|
||||
infraLinksAvailable: true,
|
||||
rangeFrom: 'now-24h',
|
||||
rangeTo: 'now',
|
||||
|
|
|
@ -132,6 +132,11 @@ export const infraLocatorsMock: InfraLocators = {
|
|||
nodeLogsLocator: sharePluginMock.createLocator(),
|
||||
};
|
||||
|
||||
export const observabilityLogExplorerLocatorsMock = {
|
||||
allDatasetsLocator: sharePluginMock.createLocator(),
|
||||
singleDatasetLocator: sharePluginMock.createLocator(),
|
||||
};
|
||||
|
||||
const mockCorePlugins = {
|
||||
embeddable: {},
|
||||
inspector: {},
|
||||
|
|
|
@ -191,7 +191,7 @@ const getApmErrorDocRoute = createApmServerRoute({
|
|||
},
|
||||
});
|
||||
|
||||
interface ApmServicesListItem {
|
||||
export interface ApmServicesListItem {
|
||||
'service.name': string;
|
||||
'agent.name'?: string;
|
||||
'transaction.type'?: string;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { loggerMock } from '@kbn/logging-mocks';
|
||||
import { getTraceItems } from './get_trace_items';
|
||||
import {
|
||||
SearchParamsMock,
|
||||
|
@ -26,6 +27,7 @@ describe('trace queries', () => {
|
|||
apmEventClient: mockApmEventClient,
|
||||
start: 0,
|
||||
end: 50000,
|
||||
logger: loggerMock.create(),
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import { TimestampUs } from './fields/timestamp_us';
|
|||
import { Url } from './fields/url';
|
||||
import { User } from './fields/user';
|
||||
|
||||
interface Processor {
|
||||
export interface Processor {
|
||||
name: 'error';
|
||||
event: 'error';
|
||||
}
|
||||
|
|
|
@ -9,3 +9,4 @@ export { assetDetailsDashboards } from './asset_details';
|
|||
export { hostsViewDashboards } from './hosts_view';
|
||||
export { AVERAGE_SUBTITLE, METRICS_TOOLTIP } from './translations';
|
||||
export { XY_MISSING_VALUE_DOTTED_LINE_CONFIG, KPI_CHART_HEIGHT } from './constants';
|
||||
export * from './types';
|
||||
|
|
|
@ -57,8 +57,8 @@ export const DatasetsPopover = ({
|
|||
<EuiIcon type={iconType} />
|
||||
) : hasIntegration ? (
|
||||
<PackageIcon
|
||||
packageName={parentIntegration.name}
|
||||
version={parentIntegration.version}
|
||||
packageName={parentIntegration.name ?? ''}
|
||||
version={parentIntegration.version ?? '1.0.0'}
|
||||
icons={parentIntegration.icons}
|
||||
size="m"
|
||||
tryApi
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { DependencyList } from 'react';
|
||||
import { MlPluginStart } from '..';
|
||||
import { MlPluginSetup } from '..';
|
||||
import { MlLocatorParams } from '../../common/types/locator';
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@ import { MlLocatorParams } from '../../common/types/locator';
|
|||
* TODO remove basePath parameter
|
||||
*/
|
||||
export const useMlHref = (
|
||||
ml: MlPluginStart | undefined,
|
||||
ml: MlPluginSetup | undefined,
|
||||
basePath: string | undefined,
|
||||
params: MlLocatorParams,
|
||||
dependencies?: DependencyList
|
||||
|
|
|
@ -5,4 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export { SingleDatasetLocatorDefinition, AllDatasetsLocatorDefinition } from './locators';
|
||||
export {
|
||||
type ObservabilityLogExplorerLocators,
|
||||
SingleDatasetLocatorDefinition,
|
||||
AllDatasetsLocatorDefinition,
|
||||
} from './locators';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue