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
40 changes: 25 additions & 15 deletions x-pack/plugins/uptime/common/constants/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -40,7 +42,10 @@ export const WaterfallChartFixedTopContainer = euiStyled.div`
border-bottom: ${(props) => `1px solid ${props.theme.eui.euiColorLightShade}`};
`;

export const WaterfallChartFixedTopContainerSidebarCover = euiStyled(EuiPanel)`
export const WaterfallChartFixedTopContainerSidebarCover: StyledComponent<
FunctionComponent<EuiPanelProps>,
EuiTheme
> = euiStyled(EuiPanel)`
height: 100%;
border-radius: 0 !important;
border: none;
Expand All @@ -60,7 +65,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%;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/uptime/public/state/alerts/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getCertificatesAction = createAsyncAction<GetCertsParams, CertResul
'GET_CERTIFICATES'
);

interface CertificatesState {
export interface CertificatesState {
certs: AsyncInitState<CertResult>;
}

Expand Down
7 changes: 3 additions & 4 deletions x-pack/plugins/uptime/public/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion x-pack/plugins/uptime/public/state/reducers/journey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface JourneyState {
error?: Error;
}

interface JourneyKVP {
export interface JourneyKVP {
[checkGroup: string]: JourneyState;
}

Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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) => {
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/uptime/server/lib/alerts/status_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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) => {
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/uptime/server/lib/alerts/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ 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';
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;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/uptime/server/lib/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface UMServerLibs extends UMDomainLibs {
framework: UMBackendFrameworkAdapter;
}

interface CountResponse {
export interface CountResponse {
body: {
count: number;
_shards: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { UMElasticsearchQueryFn } from '../adapters/framework';
import { SyntheticsJourneyApiResponse } from '../../../common/runtime_types';

interface GetJourneyDetails {
export interface GetJourneyDetails {
checkGroup: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { UMElasticsearchQueryFn } from '../adapters/framework';
import { Ping } from '../../../common/runtime_types';

interface GetJourneyStepsParams {
export interface GetJourneyStepsParams {
checkGroups: string[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { UMElasticsearchQueryFn } from '../adapters/framework';
import { NetworkEvent } from '../../../common/runtime_types';

interface GetNetworkEventsParams {
export interface GetNetworkEventsParams {
checkGroup: string;
stepIndex: string;
}
Expand Down
15 changes: 11 additions & 4 deletions x-pack/plugins/uptime/server/lib/requests/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
24 changes: 24 additions & 0 deletions x-pack/plugins/uptime/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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" }
]
}
6 changes: 5 additions & 1 deletion x-pack/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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" }
]
}
4 changes: 3 additions & 1 deletion x-pack/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"plugins/index_management/**/*",
"plugins/grokdebugger/**/*",
"plugins/upgrade_assistant/**/*",
"plugins/uptime/**/*",
"test/**/*"
],
"compilerOptions": {
Expand Down Expand Up @@ -146,6 +147,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" }
]
}
3 changes: 2 additions & 1 deletion x-pack/tsconfig.refs.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,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" }
]
}