@blueking/monitor-trace-log 2.0.24 → 2.0.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 +117 -27
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -128325,19 +128325,48 @@ function cloneDeep(value) {
|
|
|
128325
128325
|
let firstLogEl = null;
|
|
128326
128326
|
let throttleTimer;
|
|
128327
128327
|
let timer;
|
|
128328
|
+
let scrollBindTimer;
|
|
128329
|
+
let highlightTimer;
|
|
128330
|
+
let initLogResultTimer;
|
|
128331
|
+
let filterCheckTimer;
|
|
128332
|
+
let handleScroll = () => {};
|
|
128328
128333
|
let displayFieldNames = [];
|
|
128334
|
+
let contextLogRequestSeq = 0;
|
|
128335
|
+
const contentLogRequestId = 'retrieve_getContentLog_contextLog';
|
|
128336
|
+
const isContextLogVisible = () => isShow.value && props.isShow;
|
|
128337
|
+
const isCurrentContextLogRequest = requestSeq => isContextLogVisible() && requestSeq === contextLogRequestSeq;
|
|
128338
|
+
const clearContextLogTimers = () => {
|
|
128339
|
+
clearTimeout(timer);
|
|
128340
|
+
clearTimeout(throttleTimer);
|
|
128341
|
+
clearTimeout(scrollBindTimer);
|
|
128342
|
+
clearTimeout(highlightTimer);
|
|
128343
|
+
clearTimeout(initLogResultTimer);
|
|
128344
|
+
clearTimeout(filterCheckTimer);
|
|
128345
|
+
};
|
|
128346
|
+
const cleanupContextLogEffects = () => {
|
|
128347
|
+
contextLogRequestSeq += 1;
|
|
128348
|
+
clearContextLogTimers();
|
|
128349
|
+
contextLog.value?.removeEventListener('scroll', handleScroll);
|
|
128350
|
+
logLoading.value = false;
|
|
128351
|
+
src_api.cancel(contentLogRequestId);
|
|
128352
|
+
};
|
|
128329
128353
|
(0,vue_esm.watch)(() => props.isShow, () => {
|
|
128330
128354
|
isShow.value = props.isShow;
|
|
128331
128355
|
if (isShow.value) {
|
|
128332
|
-
|
|
128333
|
-
|
|
128356
|
+
contextLogRequestSeq += 1;
|
|
128357
|
+
initLogResultTimer = setTimeout(() => {
|
|
128358
|
+
if (isContextLogVisible()) {
|
|
128359
|
+
logResultRef.value?.init();
|
|
128360
|
+
}
|
|
128334
128361
|
});
|
|
128362
|
+
return;
|
|
128335
128363
|
}
|
|
128364
|
+
cleanupContextLogEffects();
|
|
128336
128365
|
}, {
|
|
128337
128366
|
immediate: true
|
|
128338
128367
|
});
|
|
128339
128368
|
(0,vue_esm.watch)(() => [props.indexSetId, props.logParams], async () => {
|
|
128340
|
-
if (props.indexSetId && props.logParams) {
|
|
128369
|
+
if (isContextLogVisible() && props.indexSetId && props.logParams && Object.keys(props.logParams).length) {
|
|
128341
128370
|
localParams.value = {};
|
|
128342
128371
|
deepClone(props.logParams);
|
|
128343
128372
|
await requestContentLog();
|
|
@@ -128346,7 +128375,11 @@ function cloneDeep(value) {
|
|
|
128346
128375
|
immediate: true
|
|
128347
128376
|
});
|
|
128348
128377
|
(0,vue_esm.watch)(activeFilterKey, () => {
|
|
128349
|
-
|
|
128378
|
+
clearTimeout(filterCheckTimer);
|
|
128379
|
+
filterCheckTimer = setTimeout(() => {
|
|
128380
|
+
if (!isContextLogVisible()) {
|
|
128381
|
+
return;
|
|
128382
|
+
}
|
|
128350
128383
|
const lineDomList = Array.from(logViewRef.value?.$el.querySelectorAll('.line') || []);
|
|
128351
128384
|
if (lineDomList.length && lineDomList.every(item => item.style.display === 'none')) {
|
|
128352
128385
|
isFilterEmpty.value = true;
|
|
@@ -128367,6 +128400,7 @@ function cloneDeep(value) {
|
|
|
128367
128400
|
localParams.value = {};
|
|
128368
128401
|
};
|
|
128369
128402
|
const handleAfterLeave = () => {
|
|
128403
|
+
cleanupContextLogEffects();
|
|
128370
128404
|
dataFilterRef.value?.reset();
|
|
128371
128405
|
logResultRef.value?.reset();
|
|
128372
128406
|
highlightList.value = [];
|
|
@@ -128392,8 +128426,8 @@ function cloneDeep(value) {
|
|
|
128392
128426
|
});
|
|
128393
128427
|
};
|
|
128394
128428
|
const handleKeyup = event => {
|
|
128395
|
-
if (event.keyCode === 27) {
|
|
128396
|
-
|
|
128429
|
+
if (event.keyCode === 27 && isContextLogVisible()) {
|
|
128430
|
+
cleanupContextLogEffects();
|
|
128397
128431
|
handleAfterLeave();
|
|
128398
128432
|
}
|
|
128399
128433
|
};
|
|
@@ -128444,11 +128478,22 @@ function cloneDeep(value) {
|
|
|
128444
128478
|
return ['log'];
|
|
128445
128479
|
};
|
|
128446
128480
|
const requestContentLog = async direction => {
|
|
128481
|
+
if (!isContextLogVisible()) {
|
|
128482
|
+
return;
|
|
128483
|
+
}
|
|
128484
|
+
const requestSeq = contextLogRequestSeq;
|
|
128485
|
+
const paramsSnapshot = {
|
|
128486
|
+
...localParams.value
|
|
128487
|
+
};
|
|
128488
|
+
const dtEventTimeStamp = paramsSnapshot.dtEventTimeStamp ?? props.logParams?.dtEventTimeStamp;
|
|
128489
|
+
if (!props.indexSetId || dtEventTimeStamp === undefined || dtEventTimeStamp === null || dtEventTimeStamp === 'None') {
|
|
128490
|
+
return;
|
|
128491
|
+
}
|
|
128447
128492
|
const data = Object.assign({
|
|
128448
128493
|
size: 50,
|
|
128449
128494
|
zero: zero.value,
|
|
128450
|
-
dtEventTimeStamp
|
|
128451
|
-
},
|
|
128495
|
+
dtEventTimeStamp
|
|
128496
|
+
}, paramsSnapshot);
|
|
128452
128497
|
if (direction === 'down') {
|
|
128453
128498
|
data.begin = nextBegin.value;
|
|
128454
128499
|
} else if (direction === 'top') {
|
|
@@ -128463,7 +128508,13 @@ function cloneDeep(value) {
|
|
|
128463
128508
|
index_set_id: props.indexSetId
|
|
128464
128509
|
},
|
|
128465
128510
|
data
|
|
128511
|
+
}, {
|
|
128512
|
+
catchIsShowMessage: false,
|
|
128513
|
+
requestId: contentLogRequestId
|
|
128466
128514
|
});
|
|
128515
|
+
if (!isCurrentContextLogRequest(requestSeq)) {
|
|
128516
|
+
return;
|
|
128517
|
+
}
|
|
128467
128518
|
const {
|
|
128468
128519
|
list
|
|
128469
128520
|
} = res.data;
|
|
@@ -128497,18 +128548,26 @@ function cloneDeep(value) {
|
|
|
128497
128548
|
}
|
|
128498
128549
|
}
|
|
128499
128550
|
} catch (e) {
|
|
128500
|
-
|
|
128501
|
-
|
|
128502
|
-
logLoading.value = false;
|
|
128503
|
-
if (highlightList.value.length) {
|
|
128504
|
-
setTimeout(() => {
|
|
128505
|
-
dataFilterRef.value.getHighlightControl()?.initLightItemList(direction);
|
|
128506
|
-
});
|
|
128551
|
+
if (isCurrentContextLogRequest(requestSeq)) {
|
|
128552
|
+
console.warn(e);
|
|
128507
128553
|
}
|
|
128508
|
-
|
|
128509
|
-
|
|
128510
|
-
|
|
128511
|
-
|
|
128554
|
+
} finally {
|
|
128555
|
+
if (isCurrentContextLogRequest(requestSeq)) {
|
|
128556
|
+
logLoading.value = false;
|
|
128557
|
+
if (highlightList.value.length) {
|
|
128558
|
+
highlightTimer = setTimeout(() => {
|
|
128559
|
+
if (isCurrentContextLogRequest(requestSeq)) {
|
|
128560
|
+
dataFilterRef.value?.getHighlightControl()?.initLightItemList(direction);
|
|
128561
|
+
}
|
|
128562
|
+
});
|
|
128563
|
+
}
|
|
128564
|
+
if (zero.value) {
|
|
128565
|
+
(0,vue_esm.nextTick)(() => {
|
|
128566
|
+
if (isCurrentContextLogRequest(requestSeq)) {
|
|
128567
|
+
initLogScrollPosition();
|
|
128568
|
+
}
|
|
128569
|
+
});
|
|
128570
|
+
}
|
|
128512
128571
|
}
|
|
128513
128572
|
}
|
|
128514
128573
|
};
|
|
@@ -128543,8 +128602,11 @@ function cloneDeep(value) {
|
|
|
128543
128602
|
reverseLogList.value = handleFormatList(reverseRawList, list);
|
|
128544
128603
|
};
|
|
128545
128604
|
const initLogScrollPosition = () => {
|
|
128605
|
+
if (!isContextLogVisible() || !contextLog.value) {
|
|
128606
|
+
return;
|
|
128607
|
+
}
|
|
128546
128608
|
// 确定第0条的位置
|
|
128547
|
-
firstLogEl =
|
|
128609
|
+
firstLogEl = contextLog.value.querySelector('.log-init');
|
|
128548
128610
|
// 没有数据
|
|
128549
128611
|
if (!firstLogEl) return;
|
|
128550
128612
|
contextLog.value.removeEventListener('scroll', handleScroll);
|
|
@@ -128558,16 +128620,23 @@ function cloneDeep(value) {
|
|
|
128558
128620
|
}
|
|
128559
128621
|
zero.value = false;
|
|
128560
128622
|
// 避免重复请求
|
|
128561
|
-
|
|
128562
|
-
|
|
128563
|
-
|
|
128564
|
-
|
|
128623
|
+
clearTimeout(scrollBindTimer);
|
|
128624
|
+
scrollBindTimer = setTimeout(() => {
|
|
128625
|
+
if (isContextLogVisible() && contextLog.value) {
|
|
128626
|
+
contextLog.value.addEventListener('scroll', handleScroll, {
|
|
128627
|
+
passive: true
|
|
128628
|
+
});
|
|
128629
|
+
}
|
|
128565
128630
|
});
|
|
128566
128631
|
};
|
|
128567
|
-
|
|
128632
|
+
handleScroll = () => {
|
|
128633
|
+
if (!isContextLogVisible()) {
|
|
128634
|
+
return;
|
|
128635
|
+
}
|
|
128568
128636
|
clearTimeout(timer);
|
|
128637
|
+
const requestSeq = contextLogRequestSeq;
|
|
128569
128638
|
timer = setTimeout(() => {
|
|
128570
|
-
if (logLoading.value) {
|
|
128639
|
+
if (!isCurrentContextLogRequest(requestSeq) || logLoading.value || !contextLog.value) {
|
|
128571
128640
|
return;
|
|
128572
128641
|
}
|
|
128573
128642
|
const {
|
|
@@ -128579,6 +128648,9 @@ function cloneDeep(value) {
|
|
|
128579
128648
|
// 滚动到顶部
|
|
128580
128649
|
requestContentLog('top').then(() => {
|
|
128581
128650
|
(0,vue_esm.nextTick)(() => {
|
|
128651
|
+
if (!isCurrentContextLogRequest(requestSeq) || !contextLog.value) {
|
|
128652
|
+
return;
|
|
128653
|
+
}
|
|
128582
128654
|
// 记录刷新前滚动位置
|
|
128583
128655
|
const newScrollHeight = contextLog.value.scrollHeight;
|
|
128584
128656
|
contextLog.value.scrollTo({
|
|
@@ -128625,6 +128697,8 @@ function cloneDeep(value) {
|
|
|
128625
128697
|
}, 300);
|
|
128626
128698
|
};
|
|
128627
128699
|
const handleChooseRow = data => {
|
|
128700
|
+
cleanupContextLogEffects();
|
|
128701
|
+
contextLogRequestSeq += 1;
|
|
128628
128702
|
initLogValues();
|
|
128629
128703
|
deepClone(data);
|
|
128630
128704
|
requestContentLog();
|
|
@@ -128640,6 +128714,7 @@ function cloneDeep(value) {
|
|
|
128640
128714
|
});
|
|
128641
128715
|
});
|
|
128642
128716
|
(0,vue_esm.onBeforeUnmount)(() => {
|
|
128717
|
+
cleanupContextLogEffects();
|
|
128643
128718
|
document.removeEventListener('keyup', handleKeyup);
|
|
128644
128719
|
});
|
|
128645
128720
|
return () => (0,vue_esm.h)("bk-dialog", {
|
|
@@ -132574,9 +132649,24 @@ function use_lazy_render_deepQueryShadowSelector(selector) {
|
|
|
132574
132649
|
resetPageState();
|
|
132575
132650
|
}
|
|
132576
132651
|
});
|
|
132577
|
-
addEvent([retrieve_events.SEARCH_VALUE_CHANGE, retrieve_events.SEARCH_TIME_CHANGE, retrieve_events.TREND_GRAPH_SEARCH
|
|
132652
|
+
addEvent([retrieve_events.SEARCH_VALUE_CHANGE, retrieve_events.SEARCH_TIME_CHANGE, retrieve_events.TREND_GRAPH_SEARCH], () => {
|
|
132578
132653
|
resetPageState();
|
|
132579
132654
|
});
|
|
132655
|
+
addEvent(retrieve_events.SORT_LIST_CHANGED, () => {
|
|
132656
|
+
/**
|
|
132657
|
+
* SORT_LIST_CHANGED may be fired after the sort query has finished.
|
|
132658
|
+
* In that case tableDataSize has already changed and first-page reveal has already been scheduled/finished.
|
|
132659
|
+
* Resetting first-page layout again here would leave the skeleton pending forever because no new data-size
|
|
132660
|
+
* change will arrive to call scheduleFirstPageTableReveal().
|
|
132661
|
+
*
|
|
132662
|
+
* New sort queries already clear list and set loading in requestIndexSetQuery(), which drives the skeleton
|
|
132663
|
+
* through tableDataSize/isLoading watchers. Therefore this event only needs to force reset while the request
|
|
132664
|
+
* is still in-flight or before any result rows are available.
|
|
132665
|
+
*/
|
|
132666
|
+
if (isLoading.value || isPageLoading.value || isRequesting.value || tableDataSize.value === 0) {
|
|
132667
|
+
resetPageState();
|
|
132668
|
+
}
|
|
132669
|
+
});
|
|
132580
132670
|
addEvent(retrieve_events.AUTO_REFRESH, () => {
|
|
132581
132671
|
resetPageState();
|
|
132582
132672
|
store.dispatch('requestIndexSetQuery', {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@blueking/monitor-trace-log","version":"2.0.
|
|
1
|
+
{"name":"@blueking/monitor-trace-log","version":"2.0.25","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}
|