diff --git a/bkmonitor/webpack/src/trace/pages/main/span-details.scss b/bkmonitor/webpack/src/trace/pages/main/span-details.scss index d22503c81..a49e9738e 100644 --- a/bkmonitor/webpack/src/trace/pages/main/span-details.scss +++ b/bkmonitor/webpack/src/trace/pages/main/span-details.scss @@ -13,6 +13,25 @@ } } +%json-head { + position: absolute; + top: 8px; + right: 8px; + font-size: 16px; + color: #63656e; + + .icon-monitor { + margin-left: 12px; + font-size: 16px; + color: #979ba5; + cursor: pointer; + + &:hover { + color: #3a84ff; + } + } +} + .span-details-sideslider { /* stylelint-disable-next-line declaration-no-important */ position: fixed !important; @@ -82,7 +101,11 @@ } .json-text-style { - @extend %json-style + @extend %json-style; + + .json-head { + @extend %json-head; + } } } @@ -567,8 +590,13 @@ } .json-text-style { + position: relative; margin-top: 12px; - @extend %json-style + @extend %json-style; + + .json-head { + @extend %json-head; + } } } @@ -755,5 +783,5 @@ .graph-tools { /* stylelint-disable-next-line declaration-no-important */ left: 60px !important; - } -} \ No newline at end of file + } +} diff --git a/bkmonitor/webpack/src/trace/pages/main/span-details.tsx b/bkmonitor/webpack/src/trace/pages/main/span-details.tsx index 00fdccd58..8759f4640 100644 --- a/bkmonitor/webpack/src/trace/pages/main/span-details.tsx +++ b/bkmonitor/webpack/src/trace/pages/main/span-details.tsx @@ -615,13 +615,22 @@ export default defineComponent({ function handleTitleCopy(content: string) { let text = ''; const { spanID } = props.spanDetails; - if (content === 'text') { - text = spanID; - } else { - const hash = `#${window.__BK_WEWEB_DATA__?.baseroute || '/'}home/?app_name=${ - appName.value - }&search_type=accurate&search_id=spanID&trace_id=${spanID}`; - text = location.href.replace(location.hash, hash); + switch (content) { + case 'text': { + text = spanID; + break; + } + case 'original': { + text = JSON.stringify(originalData.value); + break; + } + default: { + const hash = `#${window.__BK_WEWEB_DATA__?.baseroute || '/'}home/?app_name=${ + appName.value + }&search_type=accurate&search_id=spanID&trace_id=${spanID}`; + text = location.href.replace(location.hash, hash); + break; + } } copyText(text, (msg: string) => { Message({ @@ -974,6 +983,22 @@ export default defineComponent({ ); + + // 复制json字符串数据的icon + const copyOriginalElem = () => ( +
+ + handleTitleCopy('original')} + /> + +
+ ); if (window.enable_apm_profiling) { tabList.push({ label: t('性能分析'), @@ -993,6 +1018,7 @@ export default defineComponent({ > {props.withSideSlider && showOriginalData.value ? (
+ {copyOriginalElem()}
) : ( @@ -1021,6 +1047,7 @@ export default defineComponent({
{titleInfoElem()}
+ {copyOriginalElem()}