@blueking/monitor-trace-log 2.0.21 → 2.0.23
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
|
@@ -125508,6 +125508,8 @@ class UseSegmentProp {
|
|
|
125508
125508
|
className = 'bklog-segment-pop-content';
|
|
125509
125509
|
wrapperClassName = 'bklog-pop-wrapper';
|
|
125510
125510
|
wrapperIdName = 'bklog_pop_wrapper';
|
|
125511
|
+
/** 当前实例的 owner id,用于把弹层内容与实例绑定 */
|
|
125512
|
+
instanceId;
|
|
125511
125513
|
refContent;
|
|
125512
125514
|
delineate;
|
|
125513
125515
|
$t;
|
|
@@ -125515,6 +125517,20 @@ class UseSegmentProp {
|
|
|
125515
125517
|
stopPropagation;
|
|
125516
125518
|
aiBluekingEnabled;
|
|
125517
125519
|
highlightEnabled;
|
|
125520
|
+
/**
|
|
125521
|
+
* 生成实例 owner id(跨 bundle 全局唯一)。
|
|
125522
|
+
*
|
|
125523
|
+
* 注意:APM 和 Trace 在宿主页里可能是两个独立构建产物,
|
|
125524
|
+
* 如果只使用“模块内 static 计数器”,每个 bundle 都会从 1 开始计数,
|
|
125525
|
+
* 最终产生同名 owner(例如都叫 segment-pop-1),依然会误复用对方节点。
|
|
125526
|
+
*
|
|
125527
|
+
* 这里把计数器提升到 window 级别,确保两个独立包共享同一计数空间。
|
|
125528
|
+
*/
|
|
125529
|
+
static getNextInstanceId() {
|
|
125530
|
+
const nextCounter = (window.__BKLOG_SEGMENT_POP_COUNTER__ ?? 0) + 1;
|
|
125531
|
+
window.__BKLOG_SEGMENT_POP_COUNTER__ = nextCounter;
|
|
125532
|
+
return `segment-pop-${nextCounter}`;
|
|
125533
|
+
}
|
|
125518
125534
|
constructor() {
|
|
125519
125535
|
let {
|
|
125520
125536
|
delineate = false,
|
|
@@ -125526,6 +125542,8 @@ class UseSegmentProp {
|
|
|
125526
125542
|
const {
|
|
125527
125543
|
$t
|
|
125528
125544
|
} = use_locale();
|
|
125545
|
+
// 生成全局唯一 owner,后续会写到 DOM data 属性中做精确定位。
|
|
125546
|
+
this.instanceId = UseSegmentProp.getNextInstanceId();
|
|
125529
125547
|
this.$t = $t;
|
|
125530
125548
|
this.refContent = (0,vue_esm.ref)();
|
|
125531
125549
|
this.delineate = delineate;
|
|
@@ -125626,7 +125644,15 @@ class UseSegmentProp {
|
|
|
125626
125644
|
});
|
|
125627
125645
|
return (0,vue_esm.h)('div', {
|
|
125628
125646
|
class: 'segment-event-icons event-tippy-content',
|
|
125629
|
-
ref: refName
|
|
125647
|
+
ref: refName,
|
|
125648
|
+
attrs: {
|
|
125649
|
+
/**
|
|
125650
|
+
* 将弹层内容显式声明为“属于哪个 UseSegmentProp 实例”。
|
|
125651
|
+
* 当多个独立包并存时,后续 mounted/query 会基于该属性做实例级选择,
|
|
125652
|
+
* 避免跨包共享节点造成事件上下文错配,进而出现点击无响应。
|
|
125653
|
+
*/
|
|
125654
|
+
'data-segment-owner': this.instanceId
|
|
125655
|
+
}
|
|
125630
125656
|
}, [eventBoxList.map(item => (0,vue_esm.h)('div', {
|
|
125631
125657
|
class: 'segment-event-box',
|
|
125632
125658
|
attrs: {
|
|
@@ -125672,7 +125698,13 @@ class UseSegmentProp {
|
|
|
125672
125698
|
target.classList.add(this.wrapperClassName);
|
|
125673
125699
|
document.body.appendChild(target);
|
|
125674
125700
|
}
|
|
125675
|
-
|
|
125701
|
+
/**
|
|
125702
|
+
* 仅匹配“当前实例拥有”的弹层节点:
|
|
125703
|
+
* - 不再使用通配 `.event-tippy-content`,避免命中其他包创建的节点
|
|
125704
|
+
* - 如果当前实例节点不存在才创建,存在则直接复用(幂等)
|
|
125705
|
+
*/
|
|
125706
|
+
const ownContentSelector = `.${this.className} .event-tippy-content[data-segment-owner="${this.instanceId}"]`;
|
|
125707
|
+
if (!target.querySelector(ownContentSelector)) {
|
|
125676
125708
|
const app = new vue_esm["default"]({
|
|
125677
125709
|
render: () => {
|
|
125678
125710
|
return (0,vue_esm.h)('div', {
|
|
@@ -125686,7 +125718,8 @@ class UseSegmentProp {
|
|
|
125686
125718
|
target.append(app.$el);
|
|
125687
125719
|
}
|
|
125688
125720
|
if (!this.refContent.value) {
|
|
125689
|
-
|
|
125721
|
+
// refContent 只缓存当前实例节点,保证 getSegmentContent 的引用与事件绑定一致。
|
|
125722
|
+
this.refContent.value = target.querySelector(ownContentSelector);
|
|
125690
125723
|
}
|
|
125691
125724
|
};
|
|
125692
125725
|
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.23","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}
|