Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into implement/ftr…
Browse files Browse the repository at this point in the history
…-docker-servers
  • Loading branch information
spalger committed Mar 31, 2020
2 parents e1fc6e4 + 4083d66 commit f41eee4
Show file tree
Hide file tree
Showing 68 changed files with 989 additions and 431 deletions.
31 changes: 26 additions & 5 deletions x-pack/legacy/plugins/apm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,17 @@ export const apm: LegacyPluginInitializer = kibana => {
privileges: {
all: {
app: ['apm', 'kibana'],
api: ['apm', 'apm_write', 'actions-read', 'alerting-read'],
api: [
'apm',
'apm_write',
'actions-read',
'actions-all',
'alerting-read',
'alerting-all'
],
catalogue: ['apm'],
savedObject: {
all: ['action', 'action_task_params'],
all: ['alert', 'action', 'action_task_params'],
read: []
},
ui: [
Expand All @@ -124,13 +131,27 @@ export const apm: LegacyPluginInitializer = kibana => {
},
read: {
app: ['apm', 'kibana'],
api: ['apm', 'actions-read', 'alerting-read'],
api: [
'apm',
'actions-read',
'actions-all',
'alerting-read',
'alerting-all'
],
catalogue: ['apm'],
savedObject: {
all: ['action', 'action_task_params'],
all: ['alert', 'action', 'action_task_params'],
read: []
},
ui: ['show', 'alerting:show', 'actions:show']
ui: [
'show',
'alerting:show',
'actions:show',
'alerting:save',
'actions:save',
'alerting:delete',
'actions:delete'
]
}
}
});
Expand Down
29 changes: 11 additions & 18 deletions x-pack/legacy/plugins/maps/public/actions/map_actions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
*/
/* eslint-disable @typescript-eslint/consistent-type-definitions */

import { Filter, Query } from 'src/plugins/data/public';
import { Filter, Query, TimeRange } from 'src/plugins/data/public';
import { AnyAction } from 'redux';
import { LAYER_TYPE } from '../../common/constants';
import { DataMeta, MapFilters } from '../../common/descriptor_types';
import {
MapCenterAndZoom,
MapRefreshConfig,
} from '../../../../../plugins/maps/common/descriptor_types';

export type SyncContext = {
startLoading(dataId: string, requestToken: symbol, meta: DataMeta): void;
Expand All @@ -27,31 +31,20 @@ export function updateSourceProp(
newLayerType?: LAYER_TYPE
): void;

export interface MapCenter {
lat: number;
lon: number;
zoom: number;
}

export function setGotoWithCenter(config: MapCenter): AnyAction;
export function setGotoWithCenter(config: MapCenterAndZoom): AnyAction;

export function replaceLayerList(layerList: unknown[]): AnyAction;

export interface QueryGroup {
export type QueryGroup = {
filters: Filter[];
query?: Query;
timeFilters: unknown;
refresh: unknown;
}
timeFilters?: TimeRange;
refresh?: boolean;
};

export function setQuery(query: QueryGroup): AnyAction;

export interface RefreshConfig {
isPaused: boolean;
interval: number;
}

export function setRefreshConfig(config: RefreshConfig): AnyAction;
export function setRefreshConfig(config: MapRefreshConfig): AnyAction;

export function disableScrollZoom(): AnyAction;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { connect } from 'react-redux';
import { LayerControl } from './view';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE } from '../../../../../../../plugins/maps/public/reducers/ui.js';
import { FLYOUT_STATE } from '../../../../../../../plugins/maps/public/reducers/ui';
import { updateFlyout, setIsLayerTOCOpen } from '../../../actions/ui_actions';
import { setSelectedLayer } from '../../../actions/map_actions';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import _ from 'lodash';
import { connect } from 'react-redux';
import { TOCEntry } from './view';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE } from '../../../../../../../../../plugins/maps/public/reducers/ui.js';
import { FLYOUT_STATE } from '../../../../../../../../../plugins/maps/public/reducers/ui';
import { updateFlyout, hideTOCDetails, showTOCDetails } from '../../../../../actions/ui_actions';
import { getIsReadOnly, getOpenTOCDetails } from '../../../../../selectors/ui_selectors';
import {
Expand Down
12 changes: 8 additions & 4 deletions x-pack/legacy/plugins/maps/public/embeddable/map_embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import {
hideLayerControl,
hideViewControl,
setHiddenLayers,
MapCenter,
} from '../actions/map_actions';
import { MapCenterAndZoom } from '../../../../../plugins/maps/common/descriptor_types';
import { setReadOnly, setIsLayerTOCOpen, setOpenTOCDetails } from '../actions/ui_actions';
import { getIsLayerTOCOpen, getOpenTOCDetails } from '../selectors/ui_selectors';
import {
Expand All @@ -71,7 +71,6 @@ export interface MapEmbeddableInput extends EmbeddableInput {
timeRange?: TimeRange;
filters: Filter[];
query?: Query;
refresh?: unknown;
refreshConfig: RefreshInterval;
isLayerTOCOpen: boolean;
openTOCDetails?: string[];
Expand All @@ -80,7 +79,7 @@ export interface MapEmbeddableInput extends EmbeddableInput {
hideToolbarOverlay?: boolean;
hideLayerControl?: boolean;
hideViewControl?: boolean;
mapCenter?: MapCenter;
mapCenter?: MapCenterAndZoom;
hiddenLayers?: string[];
hideFilterActions?: boolean;
}
Expand Down Expand Up @@ -153,7 +152,12 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapEmbeddableO
timeRange,
filters,
refresh,
}: Pick<MapEmbeddableInput, 'query' | 'timeRange' | 'filters' | 'refresh'>) {
}: {
query?: Query;
timeRange?: TimeRange;
filters: Filter[];
refresh?: boolean;
}) {
this._prevTimeRange = timeRange;
this._prevQuery = query;
this._prevFilters = filters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import _ from 'lodash';
import { PhraseFilter } from '../../../../../../../src/plugins/data/public';
import { TooltipFeature } from '../../../../../../plugins/maps/common/descriptor_types';

export interface ITooltipProperty {
getPropertyKey(): string;
Expand All @@ -16,11 +17,6 @@ export interface ITooltipProperty {
getESFilters(): Promise<PhraseFilter[]>;
}

export interface MapFeature {
id: number;
layerId: string;
}

export interface LoadFeatureProps {
layerId: string;
featureId: number;
Expand All @@ -34,7 +30,7 @@ export interface FeatureGeometry {
export interface RenderTooltipContentParams {
addFilters(filter: object): void;
closeTooltip(): void;
features: MapFeature[];
features: TooltipFeature[];
isLocked: boolean;
getLayerName(layerId: string): Promise<string>;
loadFeatureProperties({ layerId, featureId }: LoadFeatureProps): Promise<ITooltipProperty[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Query } from '../../../common/descriptor_types';
import { MapQuery } from '../../../common/descriptor_types';

// Refresh only query is query where timestamps are different but query is the same.
// Triggered by clicking "Refresh" button in QueryBar
export function isRefreshOnlyQuery(
prevQuery: Query | undefined,
newQuery: Query | undefined
prevQuery: MapQuery | undefined,
newQuery: MapQuery | undefined
): boolean {
if (!prevQuery || !newQuery) {
return false;
Expand Down
12 changes: 7 additions & 5 deletions x-pack/legacy/plugins/maps/public/selectors/map_selectors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
*/

import { AnyAction } from 'redux';
import { MapCenter } from '../actions/map_actions';
import { MapCenter } from '../../common/descriptor_types';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MapStoreState } from '../../../../../plugins/maps/public/reducers/store';

export function getHiddenLayerIds(state: unknown): string[];
export function getHiddenLayerIds(state: MapStoreState): string[];

export function getMapZoom(state: unknown): number;
export function getMapZoom(state: MapStoreState): number;

export function getMapCenter(state: unknown): MapCenter;
export function getMapCenter(state: MapStoreState): MapCenter;

export function getQueryableUniqueIndexPatternIds(state: unknown): string[];
export function getQueryableUniqueIndexPatternIds(state: MapStoreState): string[];
13 changes: 0 additions & 13 deletions x-pack/legacy/plugins/maps/public/selectors/ui_selectors.js

This file was deleted.

19 changes: 19 additions & 0 deletions x-pack/legacy/plugins/maps/public/selectors/ui_selectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MapStoreState } from '../../../../../plugins/maps/public/reducers/store';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FLYOUT_STATE, INDEXING_STAGE } from '../../../../../plugins/maps/public/reducers/ui';

export const getFlyoutDisplay = ({ ui }: MapStoreState): FLYOUT_STATE => ui.flyoutDisplay;
export const getIsSetViewOpen = ({ ui }: MapStoreState): boolean => ui.isSetViewOpen;
export const getIsLayerTOCOpen = ({ ui }: MapStoreState): boolean => ui.isLayerTOCOpen;
export const getOpenTOCDetails = ({ ui }: MapStoreState): string[] => ui.openTOCDetails;
export const getIsFullScreen = ({ ui }: MapStoreState): boolean => ui.isFullScreen;
export const getIsReadOnly = ({ ui }: MapStoreState): boolean => ui.isReadOnly;
export const getIndexingStage = ({ ui }: MapStoreState): INDEXING_STAGE | null =>
ui.importIndexingStage;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ const MySpinner = styled(EuiLoadingSpinner)`
`;

interface Props {
disabled?: boolean;
isLoading: boolean;
title: string | React.ReactNode;
onSubmit: (title: string) => void;
}

const EditableTitleComponent: React.FC<Props> = ({ onSubmit, isLoading, title }) => {
const EditableTitleComponent: React.FC<Props> = ({
disabled = false,
onSubmit,
isLoading,
title,
}) => {
const [editMode, setEditMode] = useState(false);
const [changedTitle, onTitleChange] = useState<string>(typeof title === 'string' ? title : '');

Expand Down Expand Up @@ -104,6 +110,7 @@ const EditableTitleComponent: React.FC<Props> = ({ onSubmit, isLoading, title })
{isLoading && <MySpinner />}
{!isLoading && (
<MyEuiButtonIcon
isDisabled={disabled}
aria-label={i18n.EDIT_TITLE_ARIA(title as string)}
iconType="pencil"
onClick={onClickEditIcon}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useInsertTimeline = <T extends FormData>(form: FormHook<T>, fieldNa
});
const handleOnTimelineChange = useCallback(
(title: string, id: string | null) => {
const builtLink = `${basePath}/app/siem#/timelines?timeline=(id:${id},isOpen:!t)`;
const builtLink = `${basePath}/app/siem#/timelines?timeline=(id:'${id}',isOpen:!t)`;
const currentValue = form.getFormData()[fieldName];
const newValue: string = [
currentValue.slice(0, cursorPosition.start),
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/siem/public/containers/case/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const getCases = async ({
signal,
}: FetchCasesProps): Promise<AllCases> => {
const query = {
reporters: filterOptions.reporters.map(r => r.username),
reporters: filterOptions.reporters.map(r => r.username ?? '').filter(r => r !== ''),
tags: filterOptions.tags,
...(filterOptions.status !== '' ? { status: filterOptions.status } : {}),
...(filterOptions.search.length > 0 ? { search: filterOptions.search } : {}),
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/siem/public/containers/case/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export enum SortFieldCase {
export interface ElasticUser {
readonly email?: string | null;
readonly fullName?: string | null;
readonly username: string;
readonly username?: string | null;
}

export interface FetchCasesProps extends ApiProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { useCallback, useEffect, useState } from 'react';

import { isEmpty } from 'lodash/fp';
import { User } from '../../../../../../plugins/case/common/api';
import { errorToToaster, useStateToaster } from '../../components/toasters';
import { getReporters } from './api';
Expand Down Expand Up @@ -44,9 +45,12 @@ export const useGetReporters = (): UseGetReporters => {
});
try {
const response = await getReporters(abortCtrl.signal);
const myReporters = response
.map(r => (r.full_name == null || isEmpty(r.full_name) ? r.username ?? '' : r.full_name))
.filter(u => !isEmpty(u));
if (!didCancel) {
setReporterState({
reporters: response.map(r => r.full_name ?? r.username ?? 'N/A'),
reporters: myReporters,
respReporters: response,
isLoading: false,
isError: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const formatServiceRequestData = (myCase: Case): ServiceConnectorCaseParams => {
createdAt,
createdBy: {
fullName: createdBy.fullName ?? null,
username: createdBy?.username,
username: createdBy?.username ?? '',
},
comments: comments
.filter(c => {
Expand All @@ -168,14 +168,14 @@ const formatServiceRequestData = (myCase: Case): ServiceConnectorCaseParams => {
createdAt: c.createdAt,
createdBy: {
fullName: c.createdBy.fullName ?? null,
username: c.createdBy.username,
username: c.createdBy.username ?? '',
},
updatedAt: c.updatedAt,
updatedBy:
c.updatedBy != null
? {
fullName: c.updatedBy.fullName ?? null,
username: c.updatedBy.username,
username: c.updatedBy.username ?? '',
}
: null,
})),
Expand All @@ -187,7 +187,7 @@ const formatServiceRequestData = (myCase: Case): ServiceConnectorCaseParams => {
updatedBy != null
? {
fullName: updatedBy.fullName ?? null,
username: updatedBy.username,
username: updatedBy.username ?? '',
}
: null,
};
Expand Down
Loading

0 comments on commit f41eee4

Please sign in to comment.