-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a custom and specific InvalidNode Error so that more helpful info…
…rmation can be displayed on the Metrics page Add a custom error for an invalid node check Add a component for displaying help when using an invalid node Throw the specific error from kibana_metrics_adapter Add an enum for specific error codes Look for and handle invalid node error in metrics/index Amend container to pass Error instance Add source configuration flyout to metrics/index to facilitate change source config button
- Loading branch information
Showing
6 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
x-pack/plugins/infra/public/components/metrics/invalid_node.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { WithSourceConfigurationFlyoutState } from '../../components/source_configuration/source_configuration_flyout_state'; | ||
import { WithKibanaChrome } from '../../containers/with_kibana_chrome'; | ||
|
||
interface InvalidNodeErrorProps { | ||
nodeName: string; | ||
intl: InjectedIntl; | ||
} | ||
|
||
const invalidNodeError: React.SFC<InvalidNodeErrorProps> = ({ nodeName, intl }) => ( | ||
<WithKibanaChrome> | ||
{({ basePath }) => ( | ||
<CenteredEmptyPrompt | ||
title={ | ||
<h2> | ||
{intl.formatMessage( | ||
{ | ||
id: 'xpack.infra.metrics.invalidNodeErrorTitle', | ||
defaultMessage: "Looks like {nodeName} isn't collecting any metrics data", | ||
}, | ||
{ nodeName } | ||
)} | ||
</h2> | ||
} | ||
body={ | ||
<p> | ||
{intl.formatMessage({ | ||
id: 'xpack.infra.metrics.invalidNodeErrorDescription', | ||
defaultMessage: 'Double check your configuration', | ||
})} | ||
</p> | ||
} | ||
actions={ | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiButton | ||
href={`${basePath}/app/kibana#/home/tutorial_directory/metrics`} | ||
color="primary" | ||
fill | ||
> | ||
{intl.formatMessage({ | ||
id: 'xpack.infra.homePage.noMetricsIndicesInstructionsActionLabel', | ||
defaultMessage: 'View setup instructions', | ||
})} | ||
</EuiButton> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<WithSourceConfigurationFlyoutState> | ||
{({ enable }) => ( | ||
<EuiButton color="primary" onClick={enable}> | ||
{intl.formatMessage({ | ||
id: 'xpack.infra.configureSourceActionLabel', | ||
defaultMessage: 'Change source configuration', | ||
})} | ||
</EuiButton> | ||
)} | ||
</WithSourceConfigurationFlyoutState> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
} | ||
/> | ||
)} | ||
</WithKibanaChrome> | ||
); | ||
|
||
export const InvalidNodeError = injectI18n(invalidNodeError); | ||
|
||
const CenteredEmptyPrompt = styled(EuiEmptyPrompt)` | ||
align-self: center; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
x-pack/plugins/infra/server/lib/adapters/metrics/lib/errors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { ApolloError } from 'apollo-server-errors'; | ||
import { InfraMetricsErrorCodes } from '../adapter_types'; | ||
|
||
export class InvalidNodeError extends ApolloError { | ||
constructor(message: string) { | ||
super(message, InfraMetricsErrorCodes.invalid_node); | ||
Object.defineProperty(this, 'name', { value: 'InvalidNodeError' }); | ||
} | ||
} |