@blueking/monitor-trace-log 2.0.21 → 2.0.22
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
|
@@ -125505,9 +125505,18 @@ class TaskEventManager {
|
|
|
125505
125505
|
}
|
|
125506
125506
|
const taskEventManager = new TaskEventManager();
|
|
125507
125507
|
class UseSegmentProp {
|
|
125508
|
+
/**
|
|
125509
|
+
* 全局实例递增计数器。
|
|
125510
|
+
* 同一页面可能同时加载多个检索包(例如 apm + trace),它们会共享 document.body。
|
|
125511
|
+
* 这里通过递增计数为每个 UseSegmentProp 实例生成稳定且唯一的 owner id,
|
|
125512
|
+
* 用于隔离弹层 DOM 的查询与复用,避免“后加载包误复用先加载包节点”。
|
|
125513
|
+
*/
|
|
125514
|
+
static instanceCounter = 0;
|
|
125508
125515
|
className = 'bklog-segment-pop-content';
|
|
125509
125516
|
wrapperClassName = 'bklog-pop-wrapper';
|
|
125510
125517
|
wrapperIdName = 'bklog_pop_wrapper';
|
|
125518
|
+
/** 当前实例的 owner id,用于把弹层内容与实例绑定 */
|
|
125519
|
+
instanceId;
|
|
125511
125520
|
refContent;
|
|
125512
125521
|
delineate;
|
|
125513
125522
|
$t;
|
|
@@ -125526,6 +125535,9 @@ class UseSegmentProp {
|
|
|
125526
125535
|
const {
|
|
125527
125536
|
$t
|
|
125528
125537
|
} = use_locale();
|
|
125538
|
+
// 生成实例唯一 owner,后续会写到 DOM data 属性中做精确定位。
|
|
125539
|
+
UseSegmentProp.instanceCounter += 1;
|
|
125540
|
+
this.instanceId = `segment-pop-${UseSegmentProp.instanceCounter}`;
|
|
125529
125541
|
this.$t = $t;
|
|
125530
125542
|
this.refContent = (0,vue_esm.ref)();
|
|
125531
125543
|
this.delineate = delineate;
|
|
@@ -125626,7 +125638,15 @@ class UseSegmentProp {
|
|
|
125626
125638
|
});
|
|
125627
125639
|
return (0,vue_esm.h)('div', {
|
|
125628
125640
|
class: 'segment-event-icons event-tippy-content',
|
|
125629
|
-
ref: refName
|
|
125641
|
+
ref: refName,
|
|
125642
|
+
attrs: {
|
|
125643
|
+
/**
|
|
125644
|
+
* 将弹层内容显式声明为“属于哪个 UseSegmentProp 实例”。
|
|
125645
|
+
* 当多个独立包并存时,后续 mounted/query 会基于该属性做实例级选择,
|
|
125646
|
+
* 避免跨包共享节点造成事件上下文错配,进而出现点击无响应。
|
|
125647
|
+
*/
|
|
125648
|
+
'data-segment-owner': this.instanceId
|
|
125649
|
+
}
|
|
125630
125650
|
}, [eventBoxList.map(item => (0,vue_esm.h)('div', {
|
|
125631
125651
|
class: 'segment-event-box',
|
|
125632
125652
|
attrs: {
|
|
@@ -125672,7 +125692,13 @@ class UseSegmentProp {
|
|
|
125672
125692
|
target.classList.add(this.wrapperClassName);
|
|
125673
125693
|
document.body.appendChild(target);
|
|
125674
125694
|
}
|
|
125675
|
-
|
|
125695
|
+
/**
|
|
125696
|
+
* 仅匹配“当前实例拥有”的弹层节点:
|
|
125697
|
+
* - 不再使用通配 `.event-tippy-content`,避免命中其他包创建的节点
|
|
125698
|
+
* - 如果当前实例节点不存在才创建,存在则直接复用(幂等)
|
|
125699
|
+
*/
|
|
125700
|
+
const ownContentSelector = `.${this.className} .event-tippy-content[data-segment-owner="${this.instanceId}"]`;
|
|
125701
|
+
if (!target.querySelector(ownContentSelector)) {
|
|
125676
125702
|
const app = new vue_esm["default"]({
|
|
125677
125703
|
render: () => {
|
|
125678
125704
|
return (0,vue_esm.h)('div', {
|
|
@@ -125686,7 +125712,8 @@ class UseSegmentProp {
|
|
|
125686
125712
|
target.append(app.$el);
|
|
125687
125713
|
}
|
|
125688
125714
|
if (!this.refContent.value) {
|
|
125689
|
-
|
|
125715
|
+
// refContent 只缓存当前实例节点,保证 getSegmentContent 的引用与事件绑定一致。
|
|
125716
|
+
this.refContent.value = target.querySelector(ownContentSelector);
|
|
125690
125717
|
}
|
|
125691
125718
|
};
|
|
125692
125719
|
getSegmentContent(keyRef, onSegmentEnumClick) {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@blueking/monitor-trace-log","version":"2.0.
|
|
1
|
+
{"name":"@blueking/monitor-trace-log","version":"2.0.22","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}
|