@blueking/monitor-apm-log 2.3.23 → 2.3.24
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 +30 -3
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -115745,9 +115745,18 @@ class TaskEventManager {
|
|
|
115745
115745
|
}
|
|
115746
115746
|
const taskEventManager = new TaskEventManager();
|
|
115747
115747
|
class UseSegmentProp {
|
|
115748
|
+
/**
|
|
115749
|
+
* 全局实例递增计数器。
|
|
115750
|
+
* 同一页面可能同时加载多个检索包(例如 apm + trace),它们会共享 document.body。
|
|
115751
|
+
* 这里通过递增计数为每个 UseSegmentProp 实例生成稳定且唯一的 owner id,
|
|
115752
|
+
* 用于隔离弹层 DOM 的查询与复用,避免“后加载包误复用先加载包节点”。
|
|
115753
|
+
*/
|
|
115754
|
+
static instanceCounter = 0;
|
|
115748
115755
|
className = 'bklog-segment-pop-content';
|
|
115749
115756
|
wrapperClassName = 'bklog-pop-wrapper';
|
|
115750
115757
|
wrapperIdName = 'bklog_pop_wrapper';
|
|
115758
|
+
/** 当前实例的 owner id,用于把弹层内容与实例绑定 */
|
|
115759
|
+
instanceId;
|
|
115751
115760
|
refContent;
|
|
115752
115761
|
delineate;
|
|
115753
115762
|
$t;
|
|
@@ -115766,6 +115775,9 @@ class UseSegmentProp {
|
|
|
115766
115775
|
const {
|
|
115767
115776
|
$t
|
|
115768
115777
|
} = use_locale();
|
|
115778
|
+
// 生成实例唯一 owner,后续会写到 DOM data 属性中做精确定位。
|
|
115779
|
+
UseSegmentProp.instanceCounter += 1;
|
|
115780
|
+
this.instanceId = `segment-pop-${UseSegmentProp.instanceCounter}`;
|
|
115769
115781
|
this.$t = $t;
|
|
115770
115782
|
this.refContent = (0,external_vue_.ref)();
|
|
115771
115783
|
this.delineate = delineate;
|
|
@@ -115866,7 +115878,15 @@ class UseSegmentProp {
|
|
|
115866
115878
|
});
|
|
115867
115879
|
return (0,external_vue_.h)('div', {
|
|
115868
115880
|
class: 'segment-event-icons event-tippy-content',
|
|
115869
|
-
ref: refName
|
|
115881
|
+
ref: refName,
|
|
115882
|
+
attrs: {
|
|
115883
|
+
/**
|
|
115884
|
+
* 将弹层内容显式声明为“属于哪个 UseSegmentProp 实例”。
|
|
115885
|
+
* 当多个独立包并存时,后续 mounted/query 会基于该属性做实例级选择,
|
|
115886
|
+
* 避免跨包共享节点造成事件上下文错配,进而出现点击无响应。
|
|
115887
|
+
*/
|
|
115888
|
+
'data-segment-owner': this.instanceId
|
|
115889
|
+
}
|
|
115870
115890
|
}, [eventBoxList.map(item => (0,external_vue_.h)('div', {
|
|
115871
115891
|
class: 'segment-event-box',
|
|
115872
115892
|
attrs: {
|
|
@@ -115912,7 +115932,13 @@ class UseSegmentProp {
|
|
|
115912
115932
|
target.classList.add(this.wrapperClassName);
|
|
115913
115933
|
document.body.appendChild(target);
|
|
115914
115934
|
}
|
|
115915
|
-
|
|
115935
|
+
/**
|
|
115936
|
+
* 仅匹配“当前实例拥有”的弹层节点:
|
|
115937
|
+
* - 不再使用通配 `.event-tippy-content`,避免命中其他包创建的节点
|
|
115938
|
+
* - 如果当前实例节点不存在才创建,存在则直接复用(幂等)
|
|
115939
|
+
*/
|
|
115940
|
+
const ownContentSelector = `.${this.className} .event-tippy-content[data-segment-owner="${this.instanceId}"]`;
|
|
115941
|
+
if (!target.querySelector(ownContentSelector)) {
|
|
115916
115942
|
const app = new (external_vue_default())({
|
|
115917
115943
|
render: () => {
|
|
115918
115944
|
return (0,external_vue_.h)('div', {
|
|
@@ -115926,7 +115952,8 @@ class UseSegmentProp {
|
|
|
115926
115952
|
target.append(app.$el);
|
|
115927
115953
|
}
|
|
115928
115954
|
if (!this.refContent.value) {
|
|
115929
|
-
|
|
115955
|
+
// refContent 只缓存当前实例节点,保证 getSegmentContent 的引用与事件绑定一致。
|
|
115956
|
+
this.refContent.value = target.querySelector(ownContentSelector);
|
|
115930
115957
|
}
|
|
115931
115958
|
};
|
|
115932
115959
|
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.24","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}
|