@blueking/monitor-apm-log 2.3.23 → 2.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +36 -3
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -115748,6 +115748,8 @@ class UseSegmentProp {
|
|
|
115748
115748
|
className = 'bklog-segment-pop-content';
|
|
115749
115749
|
wrapperClassName = 'bklog-pop-wrapper';
|
|
115750
115750
|
wrapperIdName = 'bklog_pop_wrapper';
|
|
115751
|
+
/** 当前实例的 owner id,用于把弹层内容与实例绑定 */
|
|
115752
|
+
instanceId;
|
|
115751
115753
|
refContent;
|
|
115752
115754
|
delineate;
|
|
115753
115755
|
$t;
|
|
@@ -115755,6 +115757,20 @@ class UseSegmentProp {
|
|
|
115755
115757
|
stopPropagation;
|
|
115756
115758
|
aiBluekingEnabled;
|
|
115757
115759
|
highlightEnabled;
|
|
115760
|
+
/**
|
|
115761
|
+
* 生成实例 owner id(跨 bundle 全局唯一)。
|
|
115762
|
+
*
|
|
115763
|
+
* 注意:APM 和 Trace 在宿主页里可能是两个独立构建产物,
|
|
115764
|
+
* 如果只使用“模块内 static 计数器”,每个 bundle 都会从 1 开始计数,
|
|
115765
|
+
* 最终产生同名 owner(例如都叫 segment-pop-1),依然会误复用对方节点。
|
|
115766
|
+
*
|
|
115767
|
+
* 这里把计数器提升到 window 级别,确保两个独立包共享同一计数空间。
|
|
115768
|
+
*/
|
|
115769
|
+
static getNextInstanceId() {
|
|
115770
|
+
const nextCounter = (window.__BKLOG_SEGMENT_POP_COUNTER__ ?? 0) + 1;
|
|
115771
|
+
window.__BKLOG_SEGMENT_POP_COUNTER__ = nextCounter;
|
|
115772
|
+
return `segment-pop-${nextCounter}`;
|
|
115773
|
+
}
|
|
115758
115774
|
constructor() {
|
|
115759
115775
|
let {
|
|
115760
115776
|
delineate = false,
|
|
@@ -115766,6 +115782,8 @@ class UseSegmentProp {
|
|
|
115766
115782
|
const {
|
|
115767
115783
|
$t
|
|
115768
115784
|
} = use_locale();
|
|
115785
|
+
// 生成全局唯一 owner,后续会写到 DOM data 属性中做精确定位。
|
|
115786
|
+
this.instanceId = UseSegmentProp.getNextInstanceId();
|
|
115769
115787
|
this.$t = $t;
|
|
115770
115788
|
this.refContent = (0,external_vue_.ref)();
|
|
115771
115789
|
this.delineate = delineate;
|
|
@@ -115866,7 +115884,15 @@ class UseSegmentProp {
|
|
|
115866
115884
|
});
|
|
115867
115885
|
return (0,external_vue_.h)('div', {
|
|
115868
115886
|
class: 'segment-event-icons event-tippy-content',
|
|
115869
|
-
ref: refName
|
|
115887
|
+
ref: refName,
|
|
115888
|
+
attrs: {
|
|
115889
|
+
/**
|
|
115890
|
+
* 将弹层内容显式声明为“属于哪个 UseSegmentProp 实例”。
|
|
115891
|
+
* 当多个独立包并存时,后续 mounted/query 会基于该属性做实例级选择,
|
|
115892
|
+
* 避免跨包共享节点造成事件上下文错配,进而出现点击无响应。
|
|
115893
|
+
*/
|
|
115894
|
+
'data-segment-owner': this.instanceId
|
|
115895
|
+
}
|
|
115870
115896
|
}, [eventBoxList.map(item => (0,external_vue_.h)('div', {
|
|
115871
115897
|
class: 'segment-event-box',
|
|
115872
115898
|
attrs: {
|
|
@@ -115912,7 +115938,13 @@ class UseSegmentProp {
|
|
|
115912
115938
|
target.classList.add(this.wrapperClassName);
|
|
115913
115939
|
document.body.appendChild(target);
|
|
115914
115940
|
}
|
|
115915
|
-
|
|
115941
|
+
/**
|
|
115942
|
+
* 仅匹配“当前实例拥有”的弹层节点:
|
|
115943
|
+
* - 不再使用通配 `.event-tippy-content`,避免命中其他包创建的节点
|
|
115944
|
+
* - 如果当前实例节点不存在才创建,存在则直接复用(幂等)
|
|
115945
|
+
*/
|
|
115946
|
+
const ownContentSelector = `.${this.className} .event-tippy-content[data-segment-owner="${this.instanceId}"]`;
|
|
115947
|
+
if (!target.querySelector(ownContentSelector)) {
|
|
115916
115948
|
const app = new (external_vue_default())({
|
|
115917
115949
|
render: () => {
|
|
115918
115950
|
return (0,external_vue_.h)('div', {
|
|
@@ -115926,7 +115958,8 @@ class UseSegmentProp {
|
|
|
115926
115958
|
target.append(app.$el);
|
|
115927
115959
|
}
|
|
115928
115960
|
if (!this.refContent.value) {
|
|
115929
|
-
|
|
115961
|
+
// refContent 只缓存当前实例节点,保证 getSegmentContent 的引用与事件绑定一致。
|
|
115962
|
+
this.refContent.value = target.querySelector(ownContentSelector);
|
|
115930
115963
|
}
|
|
115931
115964
|
};
|
|
115932
115965
|
getSegmentContent(keyRef, onSegmentEnumClick) {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@blueking/monitor-apm-log","version":"2.3.
|
|
1
|
+
{"name":"@blueking/monitor-apm-log","version":"2.3.25","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}
|