@blueking/monitor-apm-log 2.3.15 → 2.3.16

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 +100 -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,17 @@ 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
+ memoryObj = JSON.parse(storageStr);
54490
+ }
54491
+ Object.assign(memoryObj, {
54492
+ [bizAppKey]: idList
54493
+ });
54494
+ localStorage.setItem('MONITOR_LOG_RECENT_INDEX_SET_ID', JSON.stringify(memoryObj));
54415
54495
  }
54416
54496
  this.indexSetIdList = idList;
54417
54497
  this.indexSetType = type;
@@ -213885,56 +213965,6 @@ const getRuleMessage = rule => {
213885
213965
  }, [t('取消')])])])]);
213886
213966
  }
213887
213967
  }));
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
213968
  ;// ./src/views/retrieve-v3/search-result/log-clustering/log-table/content-table/cluster-popover/regex-match/index.tsx
213939
213969
  /*
213940
213970
  * Tencent is pleased to support the open source community by making
@@ -221892,6 +221922,7 @@ var sub_bar_component = normalizeComponent(
221892
221922
 
221893
221923
 
221894
221924
 
221925
+
221895
221926
  /* harmony default export */ const use_monitor_app_init = (indexSetApi => {
221896
221927
  const store = use_store();
221897
221928
  const router = useRouter();
@@ -222013,18 +222044,29 @@ var sub_bar_component = normalizeComponent(
222013
222044
  // 本地如果没有 MONITOR_LOG_RECENT_INDEX_SET_IDS,则默认取第一个有数据的索引集
222014
222045
  // 同时,更新索引信息到store中
222015
222046
  if (!indexSetIdList.value.length) {
222016
- const memoryIdStr = localStorage.getItem('MONITOR_LOG_RECENT_INDEX_SET_ID');
222047
+ const query = getLocationQueryParams();
222048
+ const bizAppKey = `${query.bizId} ${query['filter-app_name']}`;
222049
+ const memoryStr = localStorage.getItem('MONITOR_LOG_RECENT_INDEX_SET_ID');
222017
222050
  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;
222051
+ if (memoryStr) {
222052
+ const memoryObj = JSON.parse(memoryStr);
222053
+ const memoryIds = memoryObj[bizAppKey];
222054
+ if (memoryIds) {
222055
+ const memoryId = memoryIds[0];
222056
+ const defaultValidItem = resp.find(item => item.index_set_id === memoryId && item.tags.every(tag => tag.tag_id !== 4));
222057
+ if (defaultValidItem) {
222058
+ defaultId = memoryId;
222059
+ }
222023
222060
  }
222024
222061
  }
222025
222062
  if (!defaultId) {
222026
222063
  const dataValidItem = resp.find(item => item.tags.every(tag => tag.tag_id !== 4));
222027
- defaultId = `${dataValidItem.index_set_id}`;
222064
+ if (dataValidItem) {
222065
+ defaultId = `${dataValidItem.index_set_id}`;
222066
+ } else {
222067
+ // 也可能存在只有无数据的采集项,这种情况取第一个即可
222068
+ defaultId = `${resp[0].index_set_id}`;
222069
+ }
222028
222070
  }
222029
222071
  store.commit('updateIndexItem', {
222030
222072
  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.16","description":"","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT"}