mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[Uptime] Migrate to TypeScript project references (#90510)
* Add reference to Uptime plugin to root tsconfig.refs.json. * Add Uptime path to excluded list, and reference to references prop in `x-pack/tsconfig.json`. * Add reference to Uptime project in `x-pack/test/tsconfig.json`. * Add `tsconfig.json` project file to Uptime. * Fix broken JSON structure in test fixture. * Fix broken type exports. Introduce missing types. * Implement PR feedback. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
231610c720
commit
c7e23bffc6
22 changed files with 117 additions and 47 deletions
|
@ -7,23 +7,33 @@
|
|||
|
||||
import { ActionGroup } from '../../../alerts/common';
|
||||
|
||||
export type MonitorStatusActionGroup = ActionGroup<'xpack.uptime.alerts.actionGroups.monitorStatus'>;
|
||||
export type TLSActionGroup = ActionGroup<'xpack.uptime.alerts.actionGroups.tls'>;
|
||||
export type DurationAnomalyActionGroup = ActionGroup<'xpack.uptime.alerts.actionGroups.durationAnomaly'>;
|
||||
|
||||
export const MONITOR_STATUS: MonitorStatusActionGroup = {
|
||||
id: 'xpack.uptime.alerts.actionGroups.monitorStatus',
|
||||
name: 'Uptime Down Monitor',
|
||||
};
|
||||
|
||||
export const TLS: TLSActionGroup = {
|
||||
id: 'xpack.uptime.alerts.actionGroups.tls',
|
||||
name: 'Uptime TLS Alert',
|
||||
};
|
||||
|
||||
export const DURATION_ANOMALY: DurationAnomalyActionGroup = {
|
||||
id: 'xpack.uptime.alerts.actionGroups.durationAnomaly',
|
||||
name: 'Uptime Duration Anomaly',
|
||||
};
|
||||
|
||||
export const ACTION_GROUP_DEFINITIONS: {
|
||||
MONITOR_STATUS: ActionGroup<'xpack.uptime.alerts.actionGroups.monitorStatus'>;
|
||||
TLS: ActionGroup<'xpack.uptime.alerts.actionGroups.tls'>;
|
||||
DURATION_ANOMALY: ActionGroup<'xpack.uptime.alerts.actionGroups.durationAnomaly'>;
|
||||
MONITOR_STATUS: MonitorStatusActionGroup;
|
||||
TLS: TLSActionGroup;
|
||||
DURATION_ANOMALY: DurationAnomalyActionGroup;
|
||||
} = {
|
||||
MONITOR_STATUS: {
|
||||
id: 'xpack.uptime.alerts.actionGroups.monitorStatus',
|
||||
name: 'Uptime Down Monitor',
|
||||
},
|
||||
TLS: {
|
||||
id: 'xpack.uptime.alerts.actionGroups.tls',
|
||||
name: 'Uptime TLS Alert',
|
||||
},
|
||||
DURATION_ANOMALY: {
|
||||
id: 'xpack.uptime.alerts.actionGroups.durationAnomaly',
|
||||
name: 'Uptime Duration Anomaly',
|
||||
},
|
||||
MONITOR_STATUS,
|
||||
TLS,
|
||||
DURATION_ANOMALY,
|
||||
};
|
||||
|
||||
export const CLIENT_ALERT_TYPES = {
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
|
||||
import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiText, EuiPanelProps } from '@elastic/eui';
|
||||
import { rgba } from 'polished';
|
||||
import { euiStyled } from '../../../../../../../../../src/plugins/kibana_react/common';
|
||||
import { FunctionComponent } from 'react';
|
||||
import { StyledComponent } from 'styled-components';
|
||||
import { euiStyled, EuiTheme } from '../../../../../../../../../src/plugins/kibana_react/common';
|
||||
import { FIXED_AXIS_HEIGHT } from './constants';
|
||||
|
||||
interface WaterfallChartOuterContainerProps {
|
||||
|
@ -53,7 +55,10 @@ export const WaterfallChartAxisOnlyContainer = euiStyled(EuiFlexItem)`
|
|||
export const WaterfallChartTopContainer = euiStyled(EuiFlexGroup)`
|
||||
`;
|
||||
|
||||
export const WaterfallChartFixedTopContainerSidebarCover = euiStyled(EuiPanel)`
|
||||
export const WaterfallChartFixedTopContainerSidebarCover: StyledComponent<
|
||||
FunctionComponent<EuiPanelProps>,
|
||||
EuiTheme
|
||||
> = euiStyled(EuiPanel)`
|
||||
height: 100%;
|
||||
border-radius: 0 !important;
|
||||
border: none;
|
||||
|
@ -82,7 +87,10 @@ export const WaterfallChartSidebarContainer = euiStyled.div<WaterfallChartSideba
|
|||
overflow-y: hidden;
|
||||
`;
|
||||
|
||||
export const WaterfallChartSidebarContainerInnerPanel = euiStyled(EuiPanel)`
|
||||
export const WaterfallChartSidebarContainerInnerPanel: StyledComponent<
|
||||
FunctionComponent<EuiPanelProps>,
|
||||
EuiTheme
|
||||
> = euiStyled(EuiPanel)`
|
||||
border: 0;
|
||||
height: 100%;
|
||||
`;
|
||||
|
|
|
@ -12,7 +12,7 @@ import { IntegrationGroup } from './integration_group';
|
|||
import { MonitorSummary } from '../../../../../../common/runtime_types';
|
||||
import { toggleIntegrationsPopover, PopoverState } from '../../../../../state/actions';
|
||||
|
||||
interface ActionsPopoverProps {
|
||||
export interface ActionsPopoverProps {
|
||||
summary: MonitorSummary;
|
||||
popoverState: PopoverState | null;
|
||||
togglePopoverIsVisible: typeof toggleIntegrationsPopover;
|
||||
|
|
|
@ -261,7 +261,25 @@
|
|||
},
|
||||
"state": {
|
||||
"agent": null,
|
||||
"checks": ,
|
||||
"checks": [
|
||||
{
|
||||
"agent": { "id": "8f9a37fb-573a-4fdc-9895-440a5b39c250", "__typename": "Agent" },
|
||||
"container": null,
|
||||
"kubernetes": null,
|
||||
"monitor": {
|
||||
"ip": "127.0.0.1",
|
||||
"name": "localhost",
|
||||
"status": "up",
|
||||
"__typename": "CheckMonitor"
|
||||
},
|
||||
"observer": {
|
||||
"geo": { "name": null, "location": null, "__typename": "CheckGeo" },
|
||||
"__typename": "CheckObserver"
|
||||
},
|
||||
"timestamp": "1570538246143",
|
||||
"__typename": "Check"
|
||||
}
|
||||
],
|
||||
"geo": null,
|
||||
"observer": {
|
||||
"geo": { "name": [], "location": null, "__typename": "StateGeo" },
|
||||
|
|
|
@ -53,7 +53,7 @@ export const deleteAnomalyAlertAction = createAsyncAction<{ alertId: string }, a
|
|||
'DELETE ANOMALY ALERT'
|
||||
);
|
||||
|
||||
interface AlertState {
|
||||
export interface AlertState {
|
||||
connectors: AsyncInitState<ActionConnector[]>;
|
||||
newAlert: AsyncInitState<Alert<UptimeAlertTypeParams>>;
|
||||
alerts: AsyncInitState<AlertsResult>;
|
||||
|
|
|
@ -19,7 +19,7 @@ export const getCertificatesAction = createAsyncAction<GetCertsParams, CertResul
|
|||
'GET_CERTIFICATES'
|
||||
);
|
||||
|
||||
interface CertificatesState {
|
||||
export interface CertificatesState {
|
||||
certs: AsyncInitState<CertResult>;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,16 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { compose, createStore, applyMiddleware } from 'redux';
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
import { rootEffect } from './effects';
|
||||
import { rootReducer } from './reducers';
|
||||
|
||||
export type AppState = ReturnType<typeof rootReducer>;
|
||||
|
||||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||
|
||||
const sagaMW = createSagaMiddleware();
|
||||
|
||||
export const store = createStore(rootReducer, composeEnhancers(applyMiddleware(sagaMW)));
|
||||
export const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(sagaMW)));
|
||||
|
||||
sagaMW.run(rootEffect);
|
||||
|
|
|
@ -24,7 +24,7 @@ export interface JourneyState {
|
|||
error?: Error;
|
||||
}
|
||||
|
||||
interface JourneyKVP {
|
||||
export interface JourneyKVP {
|
||||
[checkGroup: string]: JourneyState;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import moment from 'moment';
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { ActionGroupIdsOf } from '../../../../alerts/common';
|
||||
import { updateState } from './common';
|
||||
import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts';
|
||||
import { DURATION_ANOMALY } from '../../../common/constants/alerts';
|
||||
import { commonStateTranslations, durationAnomalyTranslations } from './translations';
|
||||
import { AnomaliesTableRecord } from '../../../../ml/common/types/anomalies';
|
||||
import { getSeverityType } from '../../../../ml/common/util/anomaly_utils';
|
||||
|
@ -21,7 +21,6 @@ import { getMLJobId } from '../../../common/lib';
|
|||
import { getLatestMonitor } from '../requests/get_latest_monitor';
|
||||
import { uptimeAlertWrapper } from './uptime_alert_wrapper';
|
||||
|
||||
const { DURATION_ANOMALY } = ACTION_GROUP_DEFINITIONS;
|
||||
export type ActionGroupIds = ActionGroupIdsOf<typeof DURATION_ANOMALY>;
|
||||
|
||||
export const getAnomalySummary = (anomaly: AnomaliesTableRecord, monitorInfo: Ping) => {
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
Ping,
|
||||
GetMonitorAvailabilityParams,
|
||||
} from '../../../common/runtime_types';
|
||||
import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts';
|
||||
import { MONITOR_STATUS } from '../../../common/constants/alerts';
|
||||
import { updateState } from './common';
|
||||
import { commonMonitorStateI18, commonStateTranslations, DOWN_LABEL } from './translations';
|
||||
import { stringifyKueries, combineFiltersAndUserSearch } from '../../../common/lib';
|
||||
|
@ -29,7 +29,6 @@ import { MonitorStatusTranslations } from '../../../common/translations';
|
|||
import { getUptimeIndexPattern, IndexPatternTitleAndFields } from '../requests/get_index_pattern';
|
||||
import { UMServerLibs, UptimeESClient } from '../lib';
|
||||
|
||||
const { MONITOR_STATUS } = ACTION_GROUP_DEFINITIONS;
|
||||
export type ActionGroupIds = ActionGroupIdsOf<typeof MONITOR_STATUS>;
|
||||
|
||||
const getMonIdByLoc = (monitorId: string, location: string) => {
|
||||
|
|
|
@ -9,7 +9,7 @@ import moment from 'moment';
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { UptimeAlertTypeFactory } from './types';
|
||||
import { updateState } from './common';
|
||||
import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts';
|
||||
import { TLS } from '../../../common/constants/alerts';
|
||||
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants';
|
||||
import { Cert, CertResult } from '../../../common/runtime_types';
|
||||
import { commonStateTranslations, tlsTranslations } from './translations';
|
||||
|
@ -17,7 +17,6 @@ import { DEFAULT_FROM, DEFAULT_TO } from '../../rest_api/certs/certs';
|
|||
import { uptimeAlertWrapper } from './uptime_alert_wrapper';
|
||||
import { ActionGroupIdsOf } from '../../../../alerts/common';
|
||||
|
||||
const { TLS } = ACTION_GROUP_DEFINITIONS;
|
||||
export type ActionGroupIds = ActionGroupIdsOf<typeof TLS>;
|
||||
|
||||
const DEFAULT_SIZE = 20;
|
||||
|
|
|
@ -27,7 +27,7 @@ export interface UMServerLibs extends UMDomainLibs {
|
|||
framework: UMBackendFrameworkAdapter;
|
||||
}
|
||||
|
||||
interface CountResponse {
|
||||
export interface CountResponse {
|
||||
body: {
|
||||
count: number;
|
||||
_shards: {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { UMElasticsearchQueryFn } from '../adapters/framework';
|
||||
import { SyntheticsJourneyApiResponse } from '../../../common/runtime_types';
|
||||
|
||||
interface GetJourneyDetails {
|
||||
export interface GetJourneyDetails {
|
||||
checkGroup: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { UMElasticsearchQueryFn } from '../adapters/framework';
|
||||
import { Ping } from '../../../common/runtime_types';
|
||||
|
||||
interface GetJourneyStepsParams {
|
||||
export interface GetJourneyStepsParams {
|
||||
checkGroups: string[];
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { UMElasticsearchQueryFn } from '../adapters/framework';
|
||||
import { Ping } from '../../../common/runtime_types/ping';
|
||||
|
||||
interface GetJourneyScreenshotParams {
|
||||
export interface GetJourneyScreenshotParams {
|
||||
checkGroup: string;
|
||||
stepIndex: number;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { UMElasticsearchQueryFn } from '../adapters/framework';
|
||||
import { Ping } from '../../../common/runtime_types';
|
||||
|
||||
interface GetJourneyStepsParams {
|
||||
export interface GetJourneyStepsParams {
|
||||
checkGroup: string;
|
||||
syntheticEventTypes?: string | string[];
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { UMElasticsearchQueryFn } from '../adapters/framework';
|
||||
import { NetworkEvent } from '../../../common/runtime_types';
|
||||
|
||||
interface GetNetworkEventsParams {
|
||||
export interface GetNetworkEventsParams {
|
||||
checkGroup: string;
|
||||
stepIndex: string;
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ElasticsearchClientMock } from 'src/core/server/elasticsearch/client/mocks';
|
||||
import {
|
||||
elasticsearchServiceMock,
|
||||
savedObjectsClientMock,
|
||||
} from '../../../../../../src/core/server/mocks';
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { ElasticsearchClientMock } from '../../../../../../src/core/server/elasticsearch/client/mocks';
|
||||
import { createUptimeESClient } from '../lib';
|
||||
import { createUptimeESClient, UptimeESClient } from '../lib';
|
||||
|
||||
export interface MultiPageCriteria<K, T> {
|
||||
after_key?: K;
|
||||
|
@ -60,7 +60,14 @@ export const setupMockEsCompositeQuery = <K, C, I>(
|
|||
return esMock;
|
||||
};
|
||||
|
||||
export const getUptimeESMockClient = (esClientMock?: ElasticsearchClientMock) => {
|
||||
interface UptimeEsMockClient {
|
||||
esClient: ElasticsearchClientMock;
|
||||
uptimeEsClient: UptimeESClient;
|
||||
}
|
||||
|
||||
export const getUptimeESMockClient = (
|
||||
esClientMock?: ElasticsearchClientMock
|
||||
): UptimeEsMockClient => {
|
||||
const esClient = elasticsearchServiceMock.createElasticsearchClient();
|
||||
|
||||
const savedObjectsClient = savedObjectsClientMock.create();
|
||||
|
|
24
x-pack/plugins/uptime/tsconfig.json
Normal file
24
x-pack/plugins/uptime/tsconfig.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "./target/types",
|
||||
"emitDeclarationOnly": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true
|
||||
},
|
||||
"include": [
|
||||
"common/**/*",
|
||||
"public/**/*",
|
||||
"public/components/monitor/status_details/location_map/embeddables/low_poly_layer.json",
|
||||
"server/**/*",
|
||||
"server/lib/requests/__fixtures__/monitor_charts_mock.json",
|
||||
"../../../typings/**/*"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../alerts/tsconfig.json" },
|
||||
{ "path": "../ml/tsconfig.json" },
|
||||
{ "path": "../triggers_actions_ui/tsconfig.json" },
|
||||
{ "path": "../observability/tsconfig.json" }
|
||||
]
|
||||
}
|
|
@ -76,6 +76,10 @@
|
|||
{ "path": "../plugins/triggers_actions_ui/tsconfig.json" },
|
||||
{ "path": "../plugins/ui_actions_enhanced/tsconfig.json" },
|
||||
{ "path": "../plugins/upgrade_assistant/tsconfig.json" },
|
||||
{ "path": "../plugins/watcher/tsconfig.json" }
|
||||
{ "path": "../plugins/watcher/tsconfig.json" },
|
||||
{ "path": "../plugins/runtime_fields/tsconfig.json" },
|
||||
{ "path": "../plugins/index_management/tsconfig.json" },
|
||||
{ "path": "../plugins/watcher/tsconfig.json" },
|
||||
{ "path": "../plugins/uptime/tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
"plugins/index_management/**/*",
|
||||
"plugins/grokdebugger/**/*",
|
||||
"plugins/upgrade_assistant/**/*",
|
||||
"plugins/uptime/**/*",
|
||||
"test/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
|
@ -145,6 +146,7 @@
|
|||
{ "path": "./plugins/upgrade_assistant/tsconfig.json" },
|
||||
{ "path": "./plugins/runtime_fields/tsconfig.json" },
|
||||
{ "path": "./plugins/index_management/tsconfig.json" },
|
||||
{ "path": "./plugins/watcher/tsconfig.json" }
|
||||
{ "path": "./plugins/watcher/tsconfig.json" },
|
||||
{ "path": "./plugins/uptime/tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
{ "path": "./plugins/upgrade_assistant/tsconfig.json" },
|
||||
{ "path": "./plugins/runtime_fields/tsconfig.json" },
|
||||
{ "path": "./plugins/index_management/tsconfig.json" },
|
||||
{ "path": "./plugins/watcher/tsconfig.json" }
|
||||
{ "path": "./plugins/watcher/tsconfig.json" },
|
||||
{ "path": "./plugins/uptime/tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue