@blueking/monitor-apm-log 2.3.15 → 2.3.17

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 +108 -58
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -51988,6 +51988,75 @@ function throttle(func, wait, options) {
51988
51988
 
51989
51989
  /* harmony default export */ const lodash_es_throttle = (throttle);
51990
51990
 
51991
+ ;// ./src/utils/decode.ts
51992
+ /*
51993
+ * Tencent is pleased to support the open source community by making
51994
+ * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
51995
+ *
51996
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
51997
+ *
51998
+ * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
51999
+ *
52000
+ * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
52001
+ *
52002
+ * ---------------------------------------------------
52003
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
52004
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
52005
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
52006
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
52007
+ *
52008
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
52009
+ * the Software.
52010
+ *
52011
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
52012
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52013
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
52014
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
52015
+ * IN THE SOFTWARE.
52016
+ */
52017
+
52018
+ // base64转规则列表
52019
+ function base64ToRuleList(str) {
52020
+ if (!str) {
52021
+ return [];
52022
+ }
52023
+ try {
52024
+ const ruleList = JSON.parse(base64Decode(str));
52025
+ const ruleNewList = ruleList.reduce((pre, cur, index) => {
52026
+ const itemObj = {};
52027
+ const matchVal = cur.match(/:(.*)/);
52028
+ const key = cur.substring(0, matchVal.index);
52029
+ itemObj[key] = matchVal[1];
52030
+ itemObj.__Index__ = index;
52031
+ pre.push(itemObj);
52032
+ return pre;
52033
+ }, []);
52034
+ return ruleNewList;
52035
+ } catch {
52036
+ return [];
52037
+ }
52038
+ }
52039
+ ;// ./src/utils/url.ts
52040
+ /** 读取当前 URL 中的全部 query(兼容 hash 路由与 location.search) */
52041
+ const getLocationQueryParams = () => {
52042
+ const query = {};
52043
+ const merge = source => {
52044
+ if (!source) {
52045
+ return;
52046
+ }
52047
+ const search = source.startsWith('?') ? source : `?${source}`;
52048
+ new URLSearchParams(search).forEach((value, key) => {
52049
+ query[key] = value;
52050
+ });
52051
+ };
52052
+ merge(window.location.search);
52053
+ const hashQuery = window.location.hash.includes('?') ? window.location.hash.split('?').slice(1).join('?') : '';
52054
+ merge(hashQuery);
52055
+ return query;
52056
+ };
52057
+ ;// ./src/utils/index.ts
52058
+
52059
+
51991
52060
  ;// ./src/global/utils/path.ts
51992
52061
  // 实现 path.join 功能, 组合为一个合法路径, 并且去掉重复的 /
51993
52062
  // 例如: a/, /b/ -> a/b
@@ -54292,6 +54361,7 @@ var RouteQueryTab;
54292
54361
 
54293
54362
 
54294
54363
 
54364
+
54295
54365
  var STORAGE_KEY;
54296
54366
  (function (STORAGE_KEY) {
54297
54367
  // eslint-disable-next-line no-unused-vars
@@ -54411,7 +54481,21 @@ class RetrieveHelper extends base {
54411
54481
  let fireEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
54412
54482
  // 监控下的关联日志需要再浏览器本地记住最近一次使用的索引集
54413
54483
  if (window.__IS_MONITOR_COMPONENT__) {
54414
- localStorage.setItem('MONITOR_LOG_RECENT_INDEX_SET_ID', JSON.stringify(idList));
54484
+ const query = getLocationQueryParams();
54485
+ const bizAppKey = `${query.bizId} ${query['filter-app_name']}`;
54486
+ let memoryObj = {};
54487
+ const storageStr = localStorage.getItem('MONITOR_LOG_RECENT_INDEX_SET_ID');
54488
+ if (storageStr) {
54489
+ // 兼容旧的代码,后期可以去除
54490
+ const parseValue = JSON.parse(storageStr);
54491
+ if (!Array.isArray(parseValue)) {
54492
+ memoryObj = parseValue;
54493
+ }
54494
+ }
54495
+ Object.assign(memoryObj, {
54496
+ [bizAppKey]: idList
54497
+ });
54498
+ localStorage.setItem('MONITOR_LOG_RECENT_INDEX_SET_ID', JSON.stringify(memoryObj));
54415
54499
  }
54416
54500
  this.indexSetIdList = idList;
54417
54501
  this.indexSetType = type;
@@ -213885,56 +213969,6 @@ const getRuleMessage = rule => {
213885
213969
  }, [t('取消')])])])]);
213886
213970
  }
213887
213971
  }));
213888
- ;// ./src/utils/decode.ts
213889
- /*
213890
- * Tencent is pleased to support the open source community by making
213891
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
213892
- *
213893
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
213894
- *
213895
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
213896
- *
213897
- * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
213898
- *
213899
- * ---------------------------------------------------
213900
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
213901
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
213902
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
213903
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
213904
- *
213905
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
213906
- * the Software.
213907
- *
213908
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
213909
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
213910
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
213911
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
213912
- * IN THE SOFTWARE.
213913
- */
213914
-
213915
- // base64转规则列表
213916
- function base64ToRuleList(str) {
213917
- if (!str) {
213918
- return [];
213919
- }
213920
- try {
213921
- const ruleList = JSON.parse(base64Decode(str));
213922
- const ruleNewList = ruleList.reduce((pre, cur, index) => {
213923
- const itemObj = {};
213924
- const matchVal = cur.match(/:(.*)/);
213925
- const key = cur.substring(0, matchVal.index);
213926
- itemObj[key] = matchVal[1];
213927
- itemObj.__Index__ = index;
213928
- pre.push(itemObj);
213929
- return pre;
213930
- }, []);
213931
- return ruleNewList;
213932
- } catch {
213933
- return [];
213934
- }
213935
- }
213936
- ;// ./src/utils/index.ts
213937
-
213938
213972
  ;// ./src/views/retrieve-v3/search-result/log-clustering/log-table/content-table/cluster-popover/regex-match/index.tsx
213939
213973
  /*
213940
213974
  * Tencent is pleased to support the open source community by making
@@ -221892,6 +221926,7 @@ var sub_bar_component = normalizeComponent(
221892
221926
 
221893
221927
 
221894
221928
 
221929
+
221895
221930
  /* harmony default export */ const use_monitor_app_init = (indexSetApi => {
221896
221931
  const store = use_store();
221897
221932
  const router = useRouter();
@@ -222013,18 +222048,33 @@ var sub_bar_component = normalizeComponent(
222013
222048
  // 本地如果没有 MONITOR_LOG_RECENT_INDEX_SET_IDS,则默认取第一个有数据的索引集
222014
222049
  // 同时,更新索引信息到store中
222015
222050
  if (!indexSetIdList.value.length) {
222016
- const memoryIdStr = localStorage.getItem('MONITOR_LOG_RECENT_INDEX_SET_ID');
222051
+ const query = getLocationQueryParams();
222052
+ const bizAppKey = `${query.bizId} ${query['filter-app_name']}`;
222053
+ const memoryStr = localStorage.getItem('MONITOR_LOG_RECENT_INDEX_SET_ID');
222017
222054
  let defaultId = '';
222018
- if (memoryIdStr) {
222019
- const memoryId = JSON.parse(memoryIdStr)[0];
222020
- const defaultValidItem = resp.find(item => item.index_set_id === memoryId);
222021
- if (defaultValidItem) {
222022
- defaultId = memoryId;
222055
+ if (memoryStr) {
222056
+ const parseValue = JSON.parse(memoryStr);
222057
+ // 兼容旧的代码,后期可以去除
222058
+ if (!Array.isArray(parseValue)) {
222059
+ const memoryObj = parseValue;
222060
+ const memoryIds = memoryObj[bizAppKey];
222061
+ if (memoryIds) {
222062
+ const memoryId = memoryIds[0];
222063
+ const defaultValidItem = resp.find(item => item.index_set_id === memoryId && item.tags.every(tag => tag.tag_id !== 4));
222064
+ if (defaultValidItem) {
222065
+ defaultId = memoryId;
222066
+ }
222067
+ }
222023
222068
  }
222024
222069
  }
222025
222070
  if (!defaultId) {
222026
222071
  const dataValidItem = resp.find(item => item.tags.every(tag => tag.tag_id !== 4));
222027
- defaultId = `${dataValidItem.index_set_id}`;
222072
+ if (dataValidItem) {
222073
+ defaultId = `${dataValidItem.index_set_id}`;
222074
+ } else {
222075
+ // 也可能存在只有无数据的采集项,这种情况取第一个即可
222076
+ defaultId = `${resp[0].index_set_id}`;
222077
+ }
222028
222078
  }
222029
222079
  store.commit('updateIndexItem', {
222030
222080
  ids: [defaultId],
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@blueking/monitor-apm-log","version":"2.3.15","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.17","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}