Skip to content

Commit

Permalink
Merge branch 'master' into uptime_alerting-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Mar 18, 2020
2 parents f0066db + 95a42ed commit 04c5fff
Show file tree
Hide file tree
Showing 60 changed files with 469 additions and 682 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"url": "https://github.com/elastic/kibana.git"
},
"resolutions": {
"**/@types/node": "10.12.27",
"**/@types/node": ">=10.17.17 <10.20.0",
"**/@types/react": "^16.9.19",
"**/@types/react-router": "^5.1.3",
"**/@types/hapi": "^17.0.18",
Expand Down Expand Up @@ -350,7 +350,7 @@
"@types/mocha": "^5.2.7",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/node": "^10.12.27",
"@types/node": ">=10.17.17 <10.20.0",
"@types/node-forge": "^0.9.0",
"@types/normalize-path": "^3.0.0",
"@types/numeral": "^0.0.26",
Expand Down
8 changes: 7 additions & 1 deletion packages/kbn-dev-utils/src/run/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import { inspect } from 'util';

// @ts-ignore @types are outdated and module is super simple
import exitHook from 'exit-hook';

Expand Down Expand Up @@ -62,7 +64,11 @@ export async function run(fn: RunFn, options: Options = {}) {

process.on('unhandledRejection', error => {
log.error('UNHANDLED PROMISE REJECTION');
log.error(error);
log.error(
error instanceof Error
? error
: new Error(`non-Error type rejection value: ${inspect(error)}`)
);
process.exit(1);
});

Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39806,6 +39806,7 @@ exports.isFailError = fail_1.isFailError;
*/
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = __webpack_require__(36);
const util_1 = __webpack_require__(29);
// @ts-ignore @types are outdated and module is super simple
const exit_hook_1 = tslib_1.__importDefault(__webpack_require__(348));
const tooling_log_1 = __webpack_require__(415);
Expand All @@ -39825,7 +39826,9 @@ async function run(fn, options = {}) {
});
process.on('unhandledRejection', error => {
log.error('UNHANDLED PROMISE REJECTION');
log.error(error);
log.error(error instanceof Error
? error
: new Error(`non-Error type rejection value: ${util_1.inspect(error)}`));
process.exit(1);
});
const handleErrorWithoutExit = (error) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/lodash.clonedeepwith": "^4.5.3",
"@types/log-symbols": "^2.0.0",
"@types/ncp": "^2.0.1",
"@types/node": "^10.12.27",
"@types/node": ">=10.17.17 <10.20.0",
"@types/ora": "^1.3.5",
"@types/read-pkg": "^4.0.0",
"@types/strip-ansi": "^3.0.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/kbn-test/src/functional_test_runner/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { resolve } from 'path';
import { inspect } from 'util';
import { run, createFlagError, Flags } from '@kbn/dev-utils';
import { FunctionalTestRunner } from './functional_test_runner';

Expand Down Expand Up @@ -86,7 +87,11 @@ export function runFtrCli() {
}
};

process.on('unhandledRejection', err => teardown(err));
process.on('unhandledRejection', err =>
teardown(
err instanceof Error ? err : new Error(`non-Error type rejection value: ${inspect(err)}`)
)
);
process.on('SIGTERM', () => teardown());
process.on('SIGINT', () => teardown());

Expand Down
12 changes: 11 additions & 1 deletion x-pack/legacy/plugins/uptime/common/constants/rest_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/

export enum REST_API_URLS {
export enum API_URLS {
INDEX_PATTERN = `/api/uptime/index_pattern`,
INDEX_STATUS = '/api/uptime/index_status',
MONITOR_LOCATIONS = `/api/uptime/monitor/locations`,
MONITOR_DURATION = `/api/uptime/monitor/duration`,
MONITOR_DETAILS = `/api/uptime/monitor/details`,
MONITOR_SELECTED = `/api/uptime/monitor/selected`,
MONITOR_STATUS = `/api/uptime/monitor/status`,
PINGS = '/api/uptime/pings',
PING_HISTOGRAM = `/api/uptime/ping/histogram`,
SNAPSHOT_COUNT = `/api/uptime/snapshot/count`,
FILTERS = `/api/uptime/filters`,
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import React, { useEffect } from 'react';
import { connect } from 'react-redux';
import { useUrlParams } from '../../../hooks';
import { AppState } from '../../../state';
import { fetchSnapshotCount } from '../../../state/actions';
import { getSnapshotCountAction } from '../../../state/actions';
import { SnapshotComponent } from '../../functional/snapshot';
import { Snapshot as SnapshotType } from '../../../../common/runtime_types';
import { SnapShotQueryParams } from '../../../state/api';

/**
* Props expected from parent components.
Expand All @@ -37,7 +38,7 @@ interface StoreProps {
* for this component's life cycle
*/
interface DispatchProps {
loadSnapshotCount: typeof fetchSnapshotCount;
loadSnapshotCount: typeof getSnapshotCountAction;
}

/**
Expand All @@ -57,7 +58,7 @@ export const Container: React.FC<Props> = ({
const { dateRangeStart, dateRangeEnd, statusFilter } = getUrlParams();

useEffect(() => {
loadSnapshotCount(dateRangeStart, dateRangeEnd, esKuery, statusFilter);
loadSnapshotCount({ dateRangeStart, dateRangeEnd, filters: esKuery, statusFilter });
}, [dateRangeStart, dateRangeEnd, esKuery, lastRefresh, loadSnapshotCount, statusFilter]);
return <SnapshotComponent count={count} height={height} loading={loading} />;
};
Expand All @@ -81,13 +82,8 @@ const mapStateToProps = ({
* @param dispatch redux-provided action dispatcher
*/
const mapDispatchToProps = (dispatch: any) => ({
loadSnapshotCount: (
dateRangeStart: string,
dateRangeEnd: string,
filters?: string,
statusFilter?: string
): DispatchProps => {
return dispatch(fetchSnapshotCount(dateRangeStart, dateRangeEnd, filters, statusFilter));
loadSnapshotCount: (params: SnapShotQueryParams): DispatchProps => {
return dispatch(getSnapshotCountAction(params));
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import React, { useEffect } from 'react';
import { connect } from 'react-redux';
import { AppState } from '../../../state';
import { getMonitorDetails } from '../../../state/selectors';
import { monitorDetailsSelector } from '../../../state/selectors';
import { MonitorDetailsActionPayload } from '../../../state/actions/types';
import { fetchMonitorDetails } from '../../../state/actions/monitor';
import { getMonitorDetailsAction } from '../../../state/actions/monitor';
import { MonitorListDrawerComponent } from '../../functional/monitor_list/monitor_list_drawer/monitor_list_drawer';
import { useUrlParams } from '../../../hooks';
import { MonitorSummary } from '../../../../common/graphql/types';
Expand All @@ -18,7 +18,7 @@ import { MonitorDetails } from '../../../../common/runtime_types/monitor';
interface ContainerProps {
summary: MonitorSummary;
monitorDetails: MonitorDetails;
loadMonitorDetails: typeof fetchMonitorDetails;
loadMonitorDetails: typeof getMonitorDetailsAction;
}

const Container: React.FC<ContainerProps> = ({ summary, loadMonitorDetails, monitorDetails }) => {
Expand All @@ -38,12 +38,12 @@ const Container: React.FC<ContainerProps> = ({ summary, loadMonitorDetails, moni
};

const mapStateToProps = (state: AppState, { summary }: any) => ({
monitorDetails: getMonitorDetails(state, summary),
monitorDetails: monitorDetailsSelector(state, summary),
});

const mapDispatchToProps = (dispatch: any) => ({
loadMonitorDetails: (actionPayload: MonitorDetailsActionPayload) =>
dispatch(fetchMonitorDetails(actionPayload)),
dispatch(getMonitorDetailsAction(actionPayload)),
});

export const MonitorListDrawer = connect(mapStateToProps, mapDispatchToProps)(Container);
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import React, { useContext, useEffect } from 'react';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { AppState } from '../../../state';
import { selectMonitorLocations, selectMonitorStatus } from '../../../state/selectors';
import { monitorLocationsSelector, selectMonitorStatus } from '../../../state/selectors';
import { MonitorStatusBarComponent } from '../../functional/monitor_status_details/monitor_status_bar';
import { getMonitorStatus, getSelectedMonitor } from '../../../state/actions';
import { getMonitorStatusAction, getSelectedMonitorAction } from '../../../state/actions';
import { useUrlParams } from '../../../hooks';
import { Ping } from '../../../../common/graphql/types';
import { MonitorLocations } from '../../../../common/runtime_types/monitor';
Expand Down Expand Up @@ -57,20 +57,20 @@ const Container: React.FC<Props> = ({

const mapStateToProps = (state: AppState, ownProps: OwnProps) => ({
monitorStatus: selectMonitorStatus(state),
monitorLocations: selectMonitorLocations(state, ownProps.monitorId),
monitorLocations: monitorLocationsSelector(state, ownProps.monitorId),
});

const mapDispatchToProps = (dispatch: Dispatch<any>): DispatchProps => ({
loadMonitorStatus: (dateStart: string, dateEnd: string, monitorId: string) => {
dispatch(
getMonitorStatus({
getMonitorStatusAction({
monitorId,
dateStart,
dateEnd,
})
);
dispatch(
getSelectedMonitor({
getSelectedMonitorAction({
monitorId,
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { useUrlParams } from '../../../hooks';
import { AppState } from '../../../state';
import { selectMonitorLocations } from '../../../state/selectors';
import { fetchMonitorLocations, MonitorLocationsPayload } from '../../../state/actions/monitor';
import { monitorLocationsSelector } from '../../../state/selectors';
import { getMonitorLocationsAction, MonitorLocationsPayload } from '../../../state/actions/monitor';
import { MonitorStatusDetailsComponent } from '../../functional/monitor_status_details';
import { MonitorLocations } from '../../../../common/runtime_types';
import { UptimeRefreshContext } from '../../../contexts';
Expand All @@ -24,7 +24,7 @@ interface StoreProps {
}

interface DispatchProps {
loadMonitorLocations: typeof fetchMonitorLocations;
loadMonitorLocations: typeof getMonitorLocationsAction;
}

type Props = OwnProps & StoreProps & DispatchProps;
Expand All @@ -48,12 +48,12 @@ export const Container: React.FC<Props> = ({
);
};
const mapStateToProps = (state: AppState, { monitorId }: OwnProps) => ({
monitorLocations: selectMonitorLocations(state, monitorId),
monitorLocations: monitorLocationsSelector(state, monitorId),
});

const mapDispatchToProps = (dispatch: Dispatch<any>) => ({
loadMonitorLocations: (params: MonitorLocationsPayload) => {
dispatch(fetchMonitorLocations(params));
dispatch(getMonitorLocationsAction(params));
},
});

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions x-pack/legacy/plugins/uptime/public/lib/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
export { combineFiltersAndUserSearch } from './combine_filters_and_user_search';
export { convertMicrosecondsToMilliseconds } from './convert_measurements';
export * from './observability_integration';
export { getApiPath } from './get_api_path';
export { getChartDateLabel } from './charts';
export { parameterizeValues } from './parameterize_values';
export { seriesHasDownValues } from './series_has_down_values';
export { stringifyKueries } from './stringify_kueries';
export { UptimeUrlParams, getSupportedUrlParams } from './url_params';

This file was deleted.

4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/uptime/public/pages/monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MonitorStatusDetails } from '../components/connected';
import { Ping } from '../../common/graphql/types';
import { AppState } from '../state';
import { selectSelectedMonitor } from '../state/selectors';
import { getSelectedMonitor } from '../state/actions';
import { getSelectedMonitorAction } from '../state/actions';
import { PageHeader } from './page_header';

interface StateProps {
Expand Down Expand Up @@ -102,7 +102,7 @@ const mapDispatchToProps: MapDispatchToPropsFunction<DispatchProps, {}> = (dispa
return {
dispatchGetMonitorStatus: (monitorId: string) => {
dispatch(
getSelectedMonitor({
getSelectedMonitorAction({
monitorId,
})
);
Expand Down
Loading

0 comments on commit 04c5fff

Please sign in to comment.