Skip to content

Commit

Permalink
[APM] Always render collapsible library stackframes (#31320)
Browse files Browse the repository at this point in the history
* [APM] closes #28919 by always rending library stackframes as collapsible, even when there's only 1

* [APM] fix pluralization of library stack frames toggle

* [APM] renamed i18n variable in the translation
  • Loading branch information
ogupte authored Feb 20, 2019
1 parent 23830e2 commit c8cf805
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ export class LibraryStackFrames extends React.Component<Props, State> {
return null;
}

if (stackframes.length === 1) {
return (
<Stackframe
isLibraryFrame
codeLanguage={codeLanguage}
stackframe={stackframes[0]}
/>
);
}

return (
<div>
<LibraryFrameToggle>
Expand All @@ -65,8 +55,9 @@ export class LibraryStackFrames extends React.Component<Props, State> {
{i18n.translate(
'xpack.apm.stacktraceTab.libraryFramesToogleButtonLabel',
{
defaultMessage: '{stackframesLength} library frames',
values: { stackframesLength: stackframes.length }
defaultMessage:
'{count, plural, one {# library frame} other {# library frames}}',
values: { count: stackframes.length }
}
)}
</EuiLink>
Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/apm/public/components/shared/Stacktrace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,15 @@ export function Stacktrace({ stackframes = [], codeLanguage }: Props) {
{groups.map((group, i) => {
// library frame
if (group.isLibraryFrame) {
const hasMultipleStackframes = group.stackframes.length > 1;
const hasLeadingSpacer = hasMultipleStackframes && i !== 0;
const hasTrailingSpacer =
hasMultipleStackframes && i !== groups.length - 1;
return (
<Fragment key={i}>
{hasLeadingSpacer && <EuiSpacer size="m" />}
<EuiSpacer size="m" />
<LibraryStackFrames
initialVisiblity={!hasMultipleStackframes}
initialVisiblity={false}
stackframes={group.stackframes}
codeLanguage={codeLanguage}
/>
{hasTrailingSpacer && <EuiSpacer size="m" />}
<EuiSpacer size="m" />
</Fragment>
);
}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3442,7 +3442,7 @@
"xpack.apm.servicesTable.transactionsPerMinuteColumnLabel": "每分钟事务数",
"xpack.apm.servicesTable.transactionsPerMinuteUnitLabel": "tpm",
"xpack.apm.setupInstructionsButtonLabel": "设置说明",
"xpack.apm.stacktraceTab.libraryFramesToogleButtonLabel": "{stackframesLength} 库框架",
"xpack.apm.stacktraceTab.libraryFramesToogleButtonLabel": "{count} 库框架",
"xpack.apm.stacktraceTab.localVariablesToogleButtonLabel": "本地变量",
"xpack.apm.stacktraceTab.noStacktraceAvailableLabel": "没有可用的堆栈追溯信息。",
"xpack.apm.topNav.apmFeedbackDescription": "APM 反馈",
Expand Down Expand Up @@ -8231,4 +8231,4 @@
"xpack.watcher.watchActionsTitle": "满足后将执行 {watchActionsCount, plural, one{# 个操作} other {# 个操作}}",
"xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。"
}
}
}

0 comments on commit c8cf805

Please sign in to comment.