import { i18n } from '@kbn/i18n' ; import { isEmpty } from 'lodash' ; import { APMError } from '../../../../../typings/es_schemas/ui/apm_error' ; export interface ErrorTab { key : 'log_stacktrace' | 'exception_stacktrace' | 'metadata' ; label : string ; } export const logStacktraceTab = { key : 'log_stacktrace' , label : i18n . translate ( 'xpack.apm.propertiesTable.tabs.logStacktraceLabel' , { defaultMessage : 'Log stack trace' , } ) , } ; export const exceptionStacktraceTab = { key : 'exception_stacktrace' , label : i18n . translate ( 'xpack.apm.propertiesTable.tabs.exceptionStacktraceLabel' , { defaultMessage : 'Exception stack trace' , } ) , } ; export const metadataTab = { key : 'metadata' , label : i18n . translate ( 'xpack.apm.propertiesTable.tabs.metadataLabel' , { defaultMessage : 'Metadata' , } ) , } ; export function getTabs ( error ) { const hasLogStacktrace = ! isEmpty ( error . error . log ?. stacktrace ) ; return [ ... ( hasLogStacktrace ? [ logStacktraceTab ] : [ ] ) , exceptionStacktraceTab , metadataTab , ] ; }