Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into fixup-team-as…
Browse files Browse the repository at this point in the history
…signment
  • Loading branch information
wayneseymour committed Jul 20, 2020
2 parents 05cb7a3 + b9413cf commit e20a9bf
Show file tree
Hide file tree
Showing 200 changed files with 1,607 additions and 875 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"@elastic/apm-rum": "^5.2.0",
"@elastic/charts": "19.8.1",
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "7.9.0-rc.1",
"@elastic/elasticsearch": "7.9.0-rc.2",
"@elastic/ems-client": "7.9.3",
"@elastic/eui": "26.3.1",
"@elastic/filesaver": "1.1.2",
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/dashboard/dashboard_error_handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
/**
* Common test suite for testing exception scenarious within dashboard
*/
// Flaky: https://github.com/elastic/kibana/issues/72146
describe.skip('dashboard error handling', () => {
describe('dashboard error handling', () => {
before(async () => {
await esArchiver.loadIfNeeded('dashboard/current/kibana');
await PageObjects.common.navigateToApp('dashboard');
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/dashboard/embeddable_rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ export default function ({ getService, getPageObjects }) {
await dashboardExpect.vegaTextsDoNotExist(['5,000']);
};

// FLAKY: https://github.com/elastic/kibana/issues/46305
describe.skip('dashboard embeddable rendering', function describeIndexTests() {
describe('dashboard embeddable rendering', function describeIndexTests() {
before(async () => {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const setupEnvironment = () => {
);

mockHttpClient.interceptors.response.use(({ data }) => data);
// This expects HttpSetup but we're giving it AxiosInstance.
// @ts-ignore
initHttp(mockHttpClient);
const { server, httpRequestsMockHelpers } = initHttpRequests();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { METRIC_TYPE } from '@kbn/analytics';
import { trackUiMetric } from './ui_metric';

import {
UIM_POLICY_DELETE,
Expand All @@ -15,8 +14,13 @@ import {
UIM_INDEX_RETRY_STEP,
} from '../constants';

import { trackUiMetric } from './ui_metric';
import { sendGet, sendPost, sendDelete, useRequest } from './http';

interface GenericObject {
[key: string]: any;
}

export async function loadNodes() {
return await sendGet(`nodes/list`);
}
Expand All @@ -33,7 +37,7 @@ export async function loadPolicies(withIndices: boolean) {
return await sendGet('policies', { withIndices });
}

export async function savePolicy(policy: any) {
export async function savePolicy(policy: GenericObject) {
return await sendPost(`policies`, policy);
}

Expand All @@ -58,14 +62,14 @@ export const removeLifecycleForIndex = async (indexNames: string[]) => {
return response;
};

export const addLifecyclePolicyToIndex = async (body: any) => {
export const addLifecyclePolicyToIndex = async (body: GenericObject) => {
const response = await sendPost(`index/add`, body);
// Only track successful actions.
trackUiMetric(METRIC_TYPE.COUNT, UIM_POLICY_ATTACH_INDEX);
return response;
};

export const addLifecyclePolicyToTemplate = async (body: any) => {
export const addLifecyclePolicyToTemplate = async (body: GenericObject) => {
const response = await sendPost(`template`, body);
// Only track successful actions.
trackUiMetric(METRIC_TYPE.COUNT, UIM_POLICY_ATTACH_INDEX_TEMPLATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { IHttpFetchError } from 'src/core/public';
import { fatalErrors, toasts } from './notification';

function createToastConfig(error, errorTitle) {
function createToastConfig(error: IHttpFetchError, errorTitle: string) {
if (error && error.body) {
// Error body shape is defined by the API.
const { error: errorString, statusCode, message } = error.body;

return {
Expand All @@ -17,7 +19,7 @@ function createToastConfig(error, errorTitle) {
}
}

export function showApiWarning(error, errorTitle) {
export function showApiWarning(error: IHttpFetchError, errorTitle: string) {
const toastConfig = createToastConfig(error, errorTitle);

if (toastConfig) {
Expand All @@ -26,10 +28,10 @@ export function showApiWarning(error, errorTitle) {

// This error isn't an HTTP error, so let the fatal error screen tell the user something
// unexpected happened.
return fatalErrors(error, errorTitle);
return fatalErrors.add(error, errorTitle);
}

export function showApiError(error, errorTitle) {
export function showApiError(error: IHttpFetchError, errorTitle: string) {
const toastConfig = createToastConfig(error, errorTitle);

if (toastConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { HttpSetup } from 'src/core/public';
import {
UseRequestConfig,
useRequest as _useRequest,
Error,
} from '../../../../../../src/plugins/es_ui_shared/public';

let _httpClient: any;
interface GenericObject {
[key: string]: any;
}

let _httpClient: HttpSetup;

export function init(httpClient: any): void {
export function init(httpClient: HttpSetup): void {
_httpClient = httpClient;
}

Expand All @@ -26,15 +31,15 @@ function getFullPath(path: string): string {
return apiPrefix;
}

export function sendPost(path: string, payload: any): any {
export function sendPost(path: string, payload: GenericObject) {
return _httpClient.post(getFullPath(path), { body: JSON.stringify(payload) });
}

export function sendGet(path: string, query?: any): any {
export function sendGet(path: string, query?: GenericObject): any {
return _httpClient.get(getFullPath(path), { query });
}

export function sendDelete(path: string): any {
export function sendDelete(path: string) {
return _httpClient.delete(getFullPath(path));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ import { removeLifecycleForIndex } from '../../application/services/api';
import { showApiError } from '../../application/services/api_errors';
import { toasts } from '../../application/services/notification';

export class RemoveLifecyclePolicyConfirmModal extends Component {
constructor(props) {
super(props);
this.state = {
policies: [],
selectedPolicyName: null,
selectedAlias: null,
};
}
interface Props {
indexNames: string[];
closeModal: () => void;
reloadIndices: () => void;
}

export class RemoveLifecyclePolicyConfirmModal extends Component<Props> {
removePolicy = async () => {
const { indexNames, closeModal, reloadIndices } = this.props;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiCallOut,
EuiOverlayMask,
EuiModal,
EuiModalHeader,
EuiModalHeaderTitle,
EuiModalBody,
EuiAccordion,
EuiCodeBlock,
EuiLink,
EuiText,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -61,9 +57,6 @@ export const AlertPreview: React.FC<Props> = (props) => {
const [previewResult, setPreviewResult] = useState<
(AlertPreviewSuccessResponsePayload & Record<string, any>) | null
>(null);
const [isErrorModalVisible, setIsErrorModalVisible] = useState<boolean>(false);
const onOpenModal = useCallback(() => setIsErrorModalVisible(true), [setIsErrorModalVisible]);
const onCloseModal = useCallback(() => setIsErrorModalVisible(false), [setIsErrorModalVisible]);

const onSelectPreviewLookbackInterval = useCallback((e) => {
setPreviewLookbackInterval(e.target.value);
Expand Down Expand Up @@ -271,33 +264,32 @@ export const AlertPreview: React.FC<Props> = (props) => {
iconType="alert"
>
{previewError.body && (
<FormattedMessage
id="xpack.infra.metrics.alertFlyout.alertPreviewErrorDesc"
defaultMessage="Try again later, or {viewTheError}."
values={{
viewTheError: <EuiLink onClick={onOpenModal}>view the error</EuiLink>,
}}
/>
<>
<FormattedMessage
id="xpack.infra.metrics.alertFlyout.alertPreviewErrorDesc"
defaultMessage="Please try again later or see details for more information."
/>
<EuiSpacer size={'s'} />
<EuiAccordion
id="alertErrorDetailsAccordion"
buttonContent={
<>
<EuiText size="s">
<FormattedMessage
id="xpack.infra.metrics.alertFlyout.errorDetails"
defaultMessage="Details"
/>
</EuiText>
</>
}
>
<EuiSpacer size={'s'} />
<EuiCodeBlock>{previewError.body.message}</EuiCodeBlock>
</EuiAccordion>
</>
)}
</EuiCallOut>
)}
{isErrorModalVisible && (
<EuiOverlayMask>
<EuiModal onClose={onCloseModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<FormattedMessage
id="xpack.infra.metrics.alertFlyout.alertPreviewErrorModalTitle"
defaultMessage="Alert preview error"
/>
</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<EuiCodeBlock>{previewError.body.message}</EuiCodeBlock>
</EuiModalBody>
</EuiModal>
</EuiOverlayMask>
)}
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { Fragment } from 'react';
import {
EuiFacetButton,
EuiFacetGroup,
Expand All @@ -14,8 +14,8 @@ import {
EuiTextColor,
EuiTitle,
} from '@elastic/eui';
import React, { Fragment } from 'react';
import styled from 'styled-components';
import { FormattedMessage } from '@kbn/i18n/react';
import {
AssetsGroupedByServiceByType,
AssetTypeToParts,
Expand Down Expand Up @@ -43,8 +43,15 @@ const FacetGroup = styled(EuiFacetGroup)`
`;

const FacetButton = styled(EuiFacetButton)`
padding: '${(props) => props.theme.eui.paddingSizes.xs} 0';
height: 'unset';
&&& {
.euiFacetButton__icon,
.euiFacetButton__quantity {
opacity: 1;
}
.euiFacetButton__text {
color: ${(props) => props.theme.eui.euiTextColor};
}
}
`;

export function AssetsFacetGroup({ assets }: { assets: AssetsGroupedByServiceByType }) {
Expand All @@ -70,7 +77,15 @@ export function AssetsFacetGroup({ assets }: { assets: AssetsGroupedByServiceByT
<EuiFlexItem>
<EuiTitle key={service} size="xs">
<EuiText>
<h4>{ServiceTitleMap[service]} Assets</h4>
<h4>
<FormattedMessage
id="xpack.ingestManager.epm.assetGroupTitle"
defaultMessage="{assetType} assets"
values={{
assetType: ServiceTitleMap[service],
}}
/>
</h4>
</EuiText>
</EuiTitle>
</EuiFlexItem>
Expand All @@ -83,13 +98,7 @@ export function AssetsFacetGroup({ assets }: { assets: AssetsGroupedByServiceByT
const iconType = type in AssetIcons && AssetIcons[type];
const iconNode = iconType ? <EuiIcon type={iconType} size="s" /> : '';
return (
<FacetButton
key={type}
quantity={parts.length}
icon={iconNode}
// https://github.com/elastic/eui/issues/2216
buttonRef={() => {}}
>
<FacetButton key={type} quantity={parts.length} icon={iconNode} isDisabled={true}>
<EuiTextColor color="subdued">{AssetTitleMap[type]}</EuiTextColor>
</FacetButton>
);
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/lists/common/constants.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ export const TAGS = [];
export const COMMENTS = [];
export const FILTER = 'name:Nicolas Bourbaki';
export const CURSOR = 'c29tZXN0cmluZ2ZvcnlvdQ==';
export const _VERSION = 'WzI5NywxXQ==';
4 changes: 4 additions & 0 deletions x-pack/plugins/lists/common/schemas/common/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,7 @@ export type Deserializer = t.TypeOf<typeof deserializer>;

export const deserializerOrUndefined = t.union([deserializer, t.undefined]);
export type DeserializerOrUndefined = t.TypeOf<typeof deserializerOrUndefined>;

export const _version = t.string;
export const _versionOrUndefined = t.union([_version, t.undefined]);
export type _VersionOrUndefined = t.TypeOf<typeof _versionOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const createEsBulkTypeSchema = t.exact(
})
);

export type CreateEsBulkTypeSchema = t.TypeOf<typeof createEsBulkTypeSchema>;
export type CreateEsBulkTypeSchema = t.OutputOf<typeof createEsBulkTypeSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export const indexEsListItemSchema = t.intersection([
esDataTypeUnion,
]);

export type IndexEsListItemSchema = t.TypeOf<typeof indexEsListItemSchema>;
export type IndexEsListItemSchema = t.OutputOf<typeof indexEsListItemSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export const indexEsListSchema = t.exact(
})
);

export type IndexEsListSchema = t.TypeOf<typeof indexEsListSchema>;
export type IndexEsListSchema = t.OutputOf<typeof indexEsListSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export const updateEsListItemSchema = t.intersection([
esDataTypeUnion,
]);

export type UpdateEsListItemSchema = t.TypeOf<typeof updateEsListItemSchema>;
export type UpdateEsListItemSchema = t.OutputOf<typeof updateEsListItemSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export const updateEsListSchema = t.exact(
})
);

export type UpdateEsListSchema = t.TypeOf<typeof updateEsListSchema>;
export type UpdateEsListSchema = t.OutputOf<typeof updateEsListSchema>;
Loading

0 comments on commit e20a9bf

Please sign in to comment.