@next-core/brick-kit 2.128.0 → 2.129.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.129.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.129.0...@next-core/brick-kit@2.129.1) (2022-08-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **handleHttpError:** 修复请求报错msg超出弹窗的问题 refs INSTANCE-2681 ([0944a36](https://github.com/easyops-cn/next-core/commit/0944a36f2733f4f10ae77f93391adaf5ed994cd8))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.129.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.128.1...@next-core/brick-kit@2.129.0) (2022-08-19)
18
+
19
+
20
+ ### Features
21
+
22
+ * support crsf token ([3ef8c62](https://github.com/easyops-cn/next-core/commit/3ef8c624af8126185222ce2e98c4c5622e6de9e7))
23
+
24
+
25
+
26
+
27
+
28
+ ## [2.128.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.128.0...@next-core/brick-kit@2.128.1) (2022-08-19)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * fix menu prefetch in standalone apps ([e96b0cf](https://github.com/easyops-cn/next-core/commit/e96b0cfbe973a285ec6f8b5ceb2d8a3e638210bb))
34
+ * support setting standalone app root ([8e0d3e4](https://github.com/easyops-cn/next-core/commit/8e0d3e49c2c2b93f2b05de4a857c6c6724f27b82))
35
+
36
+
37
+
38
+
39
+
6
40
  # [2.128.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.127.3...@next-core/brick-kit@2.128.0) (2022-08-18)
7
41
 
8
42
 
@@ -1414,7 +1414,8 @@
1414
1414
  userInstanceId: newAuth.userInstanceId,
1415
1415
  loginFrom: newAuth.loginFrom,
1416
1416
  accessRule: newAuth.accessRule,
1417
- isAdmin: newAuth.isAdmin
1417
+ isAdmin: newAuth.isAdmin,
1418
+ csrfToken: newAuth.csrfToken
1418
1419
  }); // re-init analytics to set user_id
1419
1420
 
1420
1421
  if (easyopsAnalytics.userAnalytics.initialized) {
@@ -1438,6 +1439,7 @@
1438
1439
  auth.userInstanceId = undefined;
1439
1440
  auth.accessRule = undefined;
1440
1441
  auth.isAdmin = undefined;
1442
+ auth.csrfToken = undefined;
1441
1443
  resetPermissionPreChecks(); // re-init analytics to clear user_id
1442
1444
 
1443
1445
  easyopsAnalytics.userAnalytics.setUserId();
@@ -3011,30 +3013,30 @@
3011
3013
  return _constructMenu.apply(this, arguments);
3012
3014
  }
3013
3015
 
3014
- function constructMenuByMenusList(_x4, _x5, _x6) {
3015
- return _constructMenuByMenusList.apply(this, arguments);
3016
+ function preConstructMenus(_x4, _x5, _x6) {
3017
+ return _preConstructMenus.apply(this, arguments);
3016
3018
  }
3017
3019
 
3018
- function _constructMenuByMenusList() {
3019
- _constructMenuByMenusList = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
3020
- var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
3020
+ function _preConstructMenus() {
3021
+ _preConstructMenus = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
3022
+ var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3021
3023
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3022
3024
  });
3023
- return _constructMenuByMenusList.apply(this, arguments);
3025
+ return _preConstructMenus.apply(this, arguments);
3024
3026
  }
3025
3027
 
3026
3028
  var getMenu = menuId => processMenuCache.get(menuId);
3027
- function fetchMenuById(_x7, _x8) {
3029
+ function fetchMenuById(_x7, _x8, _x9) {
3028
3030
  return _fetchMenuById.apply(this, arguments);
3029
3031
  }
3030
3032
 
3031
3033
  function _fetchMenuById() {
3032
- _fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel) {
3034
+ _fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel, isPreFetch) {
3033
3035
  if (menuCache.has(menuId)) {
3034
3036
  return menuCache.get(menuId);
3035
3037
  }
3036
3038
 
3037
- var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3039
+ var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3038
3040
  page: 1,
3039
3041
  page_size: 200,
3040
3042
  fields: {
@@ -3130,7 +3132,7 @@
3130
3132
  });
3131
3133
  }
3132
3134
 
3133
- function loadDynamicMenuItems(_x9) {
3135
+ function loadDynamicMenuItems(_x10) {
3134
3136
  return _loadDynamicMenuItems.apply(this, arguments);
3135
3137
  }
3136
3138
 
@@ -3148,13 +3150,13 @@
3148
3150
  return _loadDynamicMenuItems.apply(this, arguments);
3149
3151
  }
3150
3152
 
3151
- function processMenu(_x10, _x11, _x12, _x13) {
3153
+ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3152
3154
  return _processMenu.apply(this, arguments);
3153
3155
  }
3154
3156
 
3155
3157
  function _processMenu() {
3156
- _processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu) {
3157
- var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel),
3158
+ _processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3159
+ var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3158
3160
  {
3159
3161
  items,
3160
3162
  app
@@ -3207,19 +3209,19 @@
3207
3209
  });
3208
3210
  });
3209
3211
 
3210
- return function (_x14) {
3212
+ return function (_x16) {
3211
3213
  return _ref2.apply(this, arguments);
3212
3214
  };
3213
3215
  }()));
3214
3216
  }
3215
3217
 
3216
- function processMenuTitle(_x15) {
3218
+ function processMenuTitle(_x17) {
3217
3219
  return _processMenuTitle.apply(this, arguments);
3218
3220
  }
3219
3221
 
3220
3222
  function _processMenuTitle() {
3221
3223
  _processMenuTitle = _asyncToGenerator__default["default"](function* (menuData) {
3222
- if (menuData.title || !menuData.titleDataSource) {
3224
+ if (menuData.title || _.isEmpty(menuData.titleDataSource)) {
3223
3225
  return menuData.title;
3224
3226
  }
3225
3227
 
@@ -3308,7 +3310,7 @@
3308
3310
  return false;
3309
3311
  }
3310
3312
 
3311
- function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
3313
+ function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3312
3314
  return _computeRealValueWithOverrideApp.apply(this, arguments);
3313
3315
  }
3314
3316
 
@@ -4014,8 +4016,11 @@
4014
4016
  content: /*#__PURE__*/React__default["default"].createElement("div", {
4015
4017
  style: {
4016
4018
  whiteSpace: "pre-wrap"
4019
+ },
4020
+ dangerouslySetInnerHTML: {
4021
+ __html: httpErrorToString(error)
4017
4022
  }
4018
- }, httpErrorToString(error)),
4023
+ }),
4019
4024
  okText: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.MODAL_OK))
4020
4025
  });
4021
4026
  }
@@ -9521,10 +9526,11 @@
9521
9526
  return Object.assign({}, (_this$bootstrapData = this.bootstrapData) === null || _this$bootstrapData === void 0 ? void 0 : (_this$bootstrapData$s = _this$bootstrapData.settings) === null || _this$bootstrapData$s === void 0 ? void 0 : _this$bootstrapData$s.featureFlags);
9522
9527
  }
9523
9528
 
9524
- getStandaloneMenus(menuId) {
9529
+ getStandaloneMenus(menuId, isPreFetch) {
9525
9530
  var _currentStoryboard$me, _currentStoryboard$me2;
9526
9531
 
9527
- var currentAppId = this.currentApp.id;
9532
+ var app = isPreFetch ? this.nextApp : this.currentApp;
9533
+ var currentAppId = app.id;
9528
9534
  var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
9529
9535
  var menus = (_currentStoryboard$me = currentStoryboard.meta) !== null && _currentStoryboard$me !== void 0 && _currentStoryboard$me.injectMenus ? _.cloneDeep(currentStoryboard.meta.injectMenus) : (_currentStoryboard$me2 = currentStoryboard.meta) !== null && _currentStoryboard$me2 !== void 0 && _currentStoryboard$me2.menus ? _.cloneDeep(currentStoryboard.meta.menus) : [];
9530
9536
  return menus.filter(menu => menu.menuId === menuId).map(menu => {
@@ -10955,7 +10961,7 @@
10955
10961
  var useMenus = brickUtils.scanAppGetMenuInAny(data);
10956
10962
 
10957
10963
  if (useMenus.length) {
10958
- yield constructMenuByMenusList(useMenus, _this7.getCurrentContext(), _this7.kernel);
10964
+ yield preConstructMenus(useMenus, _this7.getCurrentContext(), _this7.kernel);
10959
10965
  }
10960
10966
  })();
10961
10967
  }