@blueking/monitor-apm-log 2.3.26 → 2.3.27

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.
Files changed (2) hide show
  1. package/main.js +117 -27
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -117610,19 +117610,48 @@ var json_formatter_component = normalizeComponent(
117610
117610
  let firstLogEl = null;
117611
117611
  let throttleTimer;
117612
117612
  let timer;
117613
+ let scrollBindTimer;
117614
+ let highlightTimer;
117615
+ let initLogResultTimer;
117616
+ let filterCheckTimer;
117617
+ let handleScroll = () => {};
117613
117618
  let displayFieldNames = [];
117619
+ let contextLogRequestSeq = 0;
117620
+ const contentLogRequestId = 'retrieve_getContentLog_contextLog';
117621
+ const isContextLogVisible = () => isShow.value && props.isShow;
117622
+ const isCurrentContextLogRequest = requestSeq => isContextLogVisible() && requestSeq === contextLogRequestSeq;
117623
+ const clearContextLogTimers = () => {
117624
+ clearTimeout(timer);
117625
+ clearTimeout(throttleTimer);
117626
+ clearTimeout(scrollBindTimer);
117627
+ clearTimeout(highlightTimer);
117628
+ clearTimeout(initLogResultTimer);
117629
+ clearTimeout(filterCheckTimer);
117630
+ };
117631
+ const cleanupContextLogEffects = () => {
117632
+ contextLogRequestSeq += 1;
117633
+ clearContextLogTimers();
117634
+ contextLog.value?.removeEventListener('scroll', handleScroll);
117635
+ logLoading.value = false;
117636
+ src_api.cancel(contentLogRequestId);
117637
+ };
117614
117638
  (0,external_vue_.watch)(() => props.isShow, () => {
117615
117639
  isShow.value = props.isShow;
117616
117640
  if (isShow.value) {
117617
- setTimeout(() => {
117618
- logResultRef.value.init();
117641
+ contextLogRequestSeq += 1;
117642
+ initLogResultTimer = setTimeout(() => {
117643
+ if (isContextLogVisible()) {
117644
+ logResultRef.value?.init();
117645
+ }
117619
117646
  });
117647
+ return;
117620
117648
  }
117649
+ cleanupContextLogEffects();
117621
117650
  }, {
117622
117651
  immediate: true
117623
117652
  });
117624
117653
  (0,external_vue_.watch)(() => [props.indexSetId, props.logParams], async () => {
117625
- if (props.indexSetId && props.logParams) {
117654
+ if (isContextLogVisible() && props.indexSetId && props.logParams && Object.keys(props.logParams).length) {
117626
117655
  localParams.value = {};
117627
117656
  deepClone(props.logParams);
117628
117657
  await requestContentLog();
@@ -117631,7 +117660,11 @@ var json_formatter_component = normalizeComponent(
117631
117660
  immediate: true
117632
117661
  });
117633
117662
  (0,external_vue_.watch)(activeFilterKey, () => {
117634
- setTimeout(() => {
117663
+ clearTimeout(filterCheckTimer);
117664
+ filterCheckTimer = setTimeout(() => {
117665
+ if (!isContextLogVisible()) {
117666
+ return;
117667
+ }
117635
117668
  const lineDomList = Array.from(logViewRef.value?.$el.querySelectorAll('.line') || []);
117636
117669
  if (lineDomList.length && lineDomList.every(item => item.style.display === 'none')) {
117637
117670
  isFilterEmpty.value = true;
@@ -117652,6 +117685,7 @@ var json_formatter_component = normalizeComponent(
117652
117685
  localParams.value = {};
117653
117686
  };
117654
117687
  const handleAfterLeave = () => {
117688
+ cleanupContextLogEffects();
117655
117689
  dataFilterRef.value?.reset();
117656
117690
  logResultRef.value?.reset();
117657
117691
  highlightList.value = [];
@@ -117677,8 +117711,8 @@ var json_formatter_component = normalizeComponent(
117677
117711
  });
117678
117712
  };
117679
117713
  const handleKeyup = event => {
117680
- if (event.keyCode === 27) {
117681
- contextLog.value?.removeEventListener('scroll', handleScroll);
117714
+ if (event.keyCode === 27 && isContextLogVisible()) {
117715
+ cleanupContextLogEffects();
117682
117716
  handleAfterLeave();
117683
117717
  }
117684
117718
  };
@@ -117729,11 +117763,22 @@ var json_formatter_component = normalizeComponent(
117729
117763
  return ['log'];
117730
117764
  };
117731
117765
  const requestContentLog = async direction => {
117766
+ if (!isContextLogVisible()) {
117767
+ return;
117768
+ }
117769
+ const requestSeq = contextLogRequestSeq;
117770
+ const paramsSnapshot = {
117771
+ ...localParams.value
117772
+ };
117773
+ const dtEventTimeStamp = paramsSnapshot.dtEventTimeStamp ?? props.logParams?.dtEventTimeStamp;
117774
+ if (!props.indexSetId || dtEventTimeStamp === undefined || dtEventTimeStamp === null || dtEventTimeStamp === 'None') {
117775
+ return;
117776
+ }
117732
117777
  const data = Object.assign({
117733
117778
  size: 50,
117734
117779
  zero: zero.value,
117735
- dtEventTimeStamp: props.logParams.dtEventTimeStamp
117736
- }, localParams.value);
117780
+ dtEventTimeStamp
117781
+ }, paramsSnapshot);
117737
117782
  if (direction === 'down') {
117738
117783
  data.begin = nextBegin.value;
117739
117784
  } else if (direction === 'top') {
@@ -117748,7 +117793,13 @@ var json_formatter_component = normalizeComponent(
117748
117793
  index_set_id: props.indexSetId
117749
117794
  },
117750
117795
  data
117796
+ }, {
117797
+ catchIsShowMessage: false,
117798
+ requestId: contentLogRequestId
117751
117799
  });
117800
+ if (!isCurrentContextLogRequest(requestSeq)) {
117801
+ return;
117802
+ }
117752
117803
  const {
117753
117804
  list
117754
117805
  } = res.data;
@@ -117782,18 +117833,26 @@ var json_formatter_component = normalizeComponent(
117782
117833
  }
117783
117834
  }
117784
117835
  } catch (e) {
117785
- console.error(e);
117786
- } finally {
117787
- logLoading.value = false;
117788
- if (highlightList.value.length) {
117789
- setTimeout(() => {
117790
- dataFilterRef.value.getHighlightControl()?.initLightItemList(direction);
117791
- });
117836
+ if (isCurrentContextLogRequest(requestSeq)) {
117837
+ console.warn(e);
117792
117838
  }
117793
- if (zero.value) {
117794
- (0,external_vue_.nextTick)(() => {
117795
- initLogScrollPosition();
117796
- });
117839
+ } finally {
117840
+ if (isCurrentContextLogRequest(requestSeq)) {
117841
+ logLoading.value = false;
117842
+ if (highlightList.value.length) {
117843
+ highlightTimer = setTimeout(() => {
117844
+ if (isCurrentContextLogRequest(requestSeq)) {
117845
+ dataFilterRef.value?.getHighlightControl()?.initLightItemList(direction);
117846
+ }
117847
+ });
117848
+ }
117849
+ if (zero.value) {
117850
+ (0,external_vue_.nextTick)(() => {
117851
+ if (isCurrentContextLogRequest(requestSeq)) {
117852
+ initLogScrollPosition();
117853
+ }
117854
+ });
117855
+ }
117797
117856
  }
117798
117857
  }
117799
117858
  };
@@ -117828,8 +117887,11 @@ var json_formatter_component = normalizeComponent(
117828
117887
  reverseLogList.value = handleFormatList(reverseRawList, list);
117829
117888
  };
117830
117889
  const initLogScrollPosition = () => {
117890
+ if (!isContextLogVisible() || !contextLog.value) {
117891
+ return;
117892
+ }
117831
117893
  // 确定第0条的位置
117832
- firstLogEl = document.querySelector('.dialog-log-markdown .log-init');
117894
+ firstLogEl = contextLog.value.querySelector('.log-init');
117833
117895
  // 没有数据
117834
117896
  if (!firstLogEl) return;
117835
117897
  contextLog.value.removeEventListener('scroll', handleScroll);
@@ -117843,16 +117905,23 @@ var json_formatter_component = normalizeComponent(
117843
117905
  }
117844
117906
  zero.value = false;
117845
117907
  // 避免重复请求
117846
- setTimeout(() => {
117847
- contextLog.value.addEventListener('scroll', handleScroll, {
117848
- passive: true
117849
- });
117908
+ clearTimeout(scrollBindTimer);
117909
+ scrollBindTimer = setTimeout(() => {
117910
+ if (isContextLogVisible() && contextLog.value) {
117911
+ contextLog.value.addEventListener('scroll', handleScroll, {
117912
+ passive: true
117913
+ });
117914
+ }
117850
117915
  });
117851
117916
  };
117852
- const handleScroll = () => {
117917
+ handleScroll = () => {
117918
+ if (!isContextLogVisible()) {
117919
+ return;
117920
+ }
117853
117921
  clearTimeout(timer);
117922
+ const requestSeq = contextLogRequestSeq;
117854
117923
  timer = setTimeout(() => {
117855
- if (logLoading.value) {
117924
+ if (!isCurrentContextLogRequest(requestSeq) || logLoading.value || !contextLog.value) {
117856
117925
  return;
117857
117926
  }
117858
117927
  const {
@@ -117864,6 +117933,9 @@ var json_formatter_component = normalizeComponent(
117864
117933
  // 滚动到顶部
117865
117934
  requestContentLog('top').then(() => {
117866
117935
  (0,external_vue_.nextTick)(() => {
117936
+ if (!isCurrentContextLogRequest(requestSeq) || !contextLog.value) {
117937
+ return;
117938
+ }
117867
117939
  // 记录刷新前滚动位置
117868
117940
  const newScrollHeight = contextLog.value.scrollHeight;
117869
117941
  contextLog.value.scrollTo({
@@ -117910,6 +117982,8 @@ var json_formatter_component = normalizeComponent(
117910
117982
  }, 300);
117911
117983
  };
117912
117984
  const handleChooseRow = data => {
117985
+ cleanupContextLogEffects();
117986
+ contextLogRequestSeq += 1;
117913
117987
  initLogValues();
117914
117988
  deepClone(data);
117915
117989
  requestContentLog();
@@ -117925,6 +117999,7 @@ var json_formatter_component = normalizeComponent(
117925
117999
  });
117926
118000
  });
117927
118001
  (0,external_vue_.onBeforeUnmount)(() => {
118002
+ cleanupContextLogEffects();
117928
118003
  document.removeEventListener('keyup', handleKeyup);
117929
118004
  });
117930
118005
  return () => (0,external_vue_.h)("bk-dialog", {
@@ -121859,9 +121934,24 @@ function use_lazy_render_deepQueryShadowSelector(selector) {
121859
121934
  resetPageState();
121860
121935
  }
121861
121936
  });
121862
- addEvent([retrieve_events.SEARCH_VALUE_CHANGE, retrieve_events.SEARCH_TIME_CHANGE, retrieve_events.TREND_GRAPH_SEARCH, retrieve_events.SORT_LIST_CHANGED], () => {
121937
+ addEvent([retrieve_events.SEARCH_VALUE_CHANGE, retrieve_events.SEARCH_TIME_CHANGE, retrieve_events.TREND_GRAPH_SEARCH], () => {
121863
121938
  resetPageState();
121864
121939
  });
121940
+ addEvent(retrieve_events.SORT_LIST_CHANGED, () => {
121941
+ /**
121942
+ * SORT_LIST_CHANGED may be fired after the sort query has finished.
121943
+ * In that case tableDataSize has already changed and first-page reveal has already been scheduled/finished.
121944
+ * Resetting first-page layout again here would leave the skeleton pending forever because no new data-size
121945
+ * change will arrive to call scheduleFirstPageTableReveal().
121946
+ *
121947
+ * New sort queries already clear list and set loading in requestIndexSetQuery(), which drives the skeleton
121948
+ * through tableDataSize/isLoading watchers. Therefore this event only needs to force reset while the request
121949
+ * is still in-flight or before any result rows are available.
121950
+ */
121951
+ if (isLoading.value || isPageLoading.value || isRequesting.value || tableDataSize.value === 0) {
121952
+ resetPageState();
121953
+ }
121954
+ });
121865
121955
  addEvent(retrieve_events.AUTO_REFRESH, () => {
121866
121956
  resetPageState();
121867
121957
  store.dispatch('requestIndexSetQuery', {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@blueking/monitor-apm-log","version":"2.3.26","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}
1
+ {"name":"@blueking/monitor-apm-log","version":"2.3.27","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}