Skip to content

Commit

Permalink
Simplified messaging for service popop with not data in the current e…
Browse files Browse the repository at this point in the history
…nvironment
  • Loading branch information
ogupte committed Jul 8, 2020
1 parent 13a95fd commit 55b1e91
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 25 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/apm/common/service_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export interface Connection {

export interface ServiceNodeMetrics {
hasEnvironmentData: boolean;
environmentsWithData: string[];
avgMemoryUsage: number | null;
avgCpuUsage: number | null;
transactionKPIs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
.add('example', () => (
<ServiceMetricList
hasEnvironmentData={true}
environmentsWithData={['test']}
avgErrorsPerMinute={15.738888706725826}
transactionKPIs={{
avgTransactionDuration: 61634.38905590272,
Expand All @@ -25,7 +24,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
.add('some null values', () => (
<ServiceMetricList
hasEnvironmentData={true}
environmentsWithData={['test']}
avgErrorsPerMinute={7.615972134074397}
transactionKPIs={{
avgTransactionDuration: 238792.54809512055,
Expand All @@ -38,7 +36,6 @@ storiesOf('app/ServiceMap/Popover/ServiceMetricList', module)
.add('all null values', () => (
<ServiceMetricList
hasEnvironmentData={true}
environmentsWithData={['test']}
avgErrorsPerMinute={null}
transactionKPIs={{
avgTransactionDuration: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { useFetcher, FETCH_STATUS } from '../../../../hooks/useFetcher';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { ServiceMetricList } from './ServiceMetricList';
import { AnomalyDetection } from './AnomalyDetection';
import { ENVIRONMENT_NOT_DEFINED } from '../../../../../common/environment_filter_values';
import { ALL_OPTION } from '../../../../hooks/useEnvironments';
import { MaxAnomaly } from '../../../../../common/anomaly_detection';

interface ServiceMetricFetcherProps {
Expand Down Expand Up @@ -65,7 +63,7 @@ export function ServiceMetricFetcher({
title={i18n.translate(
'xpack.apm.serviceMap.popoverMetrics.noEnvironmentDataCallout.title',
{
defaultMessage: 'No service data for current environment',
defaultMessage: 'No data for current environment',
}
)}
size="s"
Expand All @@ -74,14 +72,7 @@ export function ServiceMetricFetcher({
{i18n.translate(
'xpack.apm.serviceMap.popoverMetrics.noEnvironmentDataCallout.text',
{
defaultMessage: `This service belongs to an environment outside of the currently selected environment ({currentEnvironment}). Change the environment filter to [{environmentsWithData}] to see info on this service.`,
values: {
currentEnvironment: getEnvironmentLabel(environment),
environmentsWithData: [
ALL_OPTION.text,
...data.environmentsWithData.map(getEnvironmentLabel),
].join(', '),
},
defaultMessage: `No data available. Try switching to another environment.`,
}
)}
</EuiCallOut>
Expand All @@ -107,12 +98,3 @@ function LoadingSpinner() {
</EuiFlexGroup>
);
}

function getEnvironmentLabel(environment: string) {
if (environment === ENVIRONMENT_NOT_DEFINED) {
return i18n.translate('xpack.apm.filter.environment.notDefinedLabel', {
defaultMessage: 'Not defined',
});
}
return environment;
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export async function getServiceMapServiceNodeInfo({

return {
hasEnvironmentData,
environmentsWithData,
...errorMetrics,
transactionKPIs,
...cpuMetrics,
Expand Down

0 comments on commit 55b1e91

Please sign in to comment.