@next-libs/cmdb-instances 6.6.6 → 6.7.3

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,47 @@
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
+ ## [6.7.3](https://github.com/easyops-cn/next-libs/compare/@next-libs/cmdb-instances@6.7.2...@next-libs/cmdb-instances@6.7.3) (2021-10-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cmdb-instance:** 修复实例来源筛选后删除筛选条件未清空控件选择的值 ([8e34847](https://github.com/easyops-cn/next-libs/commit/8e34847489b181ad8499cdc3ecbaae9340dc51ff))
12
+
13
+
14
+
15
+
16
+
17
+ ## [6.7.2](https://github.com/easyops-cn/next-libs/compare/@next-libs/cmdb-instances@6.7.1...@next-libs/cmdb-instances@6.7.2) (2021-10-20)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **cmdb-instance:** 父模型实例列表显示实例来源字段修改 ([3db0d91](https://github.com/easyops-cn/next-libs/commit/3db0d91b1541e368912caf48f7fa5b74e07c29f5))
23
+
24
+
25
+
26
+
27
+
28
+ ## [6.7.1](https://github.com/easyops-cn/next-libs/compare/@next-libs/cmdb-instances@6.7.0...@next-libs/cmdb-instances@6.7.1) (2021-10-20)
29
+
30
+ **Note:** Version bump only for package @next-libs/cmdb-instances
31
+
32
+
33
+
34
+
35
+
36
+ # [6.7.0](https://github.com/easyops-cn/next-libs/compare/@next-libs/cmdb-instances@6.6.6...@next-libs/cmdb-instances@6.7.0) (2021-10-20)
37
+
38
+
39
+ ### Features
40
+
41
+ * **cmdb-instance:** 父模型实例列表显示实例来源 ([873dcf1](https://github.com/easyops-cn/next-libs/commit/873dcf11f45e2a112bcc3810aa97102a70edc742))
42
+
43
+
44
+
45
+
46
+
6
47
  ## [6.6.6](https://github.com/easyops-cn/next-libs/compare/@next-libs/cmdb-instances@6.6.5...@next-libs/cmdb-instances@6.6.6) (2021-10-20)
7
48
 
8
49
  **Note:** Version bump only for package @next-libs/cmdb-instances
@@ -104,4 +104,7 @@ exports.K = K;
104
104
  K["FREE_SELECTION"] = "FREE_SELECTION";
105
105
  K["APP_SELECTION"] = "APP_SELECTION";
106
106
  K["ATTRIBUTE_NAME_REQUIRED"] = "ATTRIBUTE_NAME_REQUIRED";
107
+ K["INSTANCE_SOURCE"] = "INSTANCE_SOURCE";
108
+ K["INSTANCE_SOURCE_TOOLTIP"] = "INSTANCE_SOURCE_TOOLTIP";
109
+ K["INSTANCE_SOURCE_TAG_TEXT"] = "INSTANCE_SOURCE_TAG_TEXT";
107
110
  })(K || (exports.K = K = {}));
@@ -101,7 +101,10 @@ const locale = {
101
101
  [_constants.K.ALL_CLUSTER]: "All cluster",
102
102
  [_constants.K.FREE_SELECTION]: "Free selection",
103
103
  [_constants.K.APP_SELECTION]: "App selection",
104
- [_constants.K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} is required"
104
+ [_constants.K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} is required",
105
+ [_constants.K.INSTANCE_SOURCE]: "Instance source",
106
+ [_constants.K.INSTANCE_SOURCE_TOOLTIP]: "The instance comes from a common model that inherits the current parent model",
107
+ [_constants.K.INSTANCE_SOURCE_TAG_TEXT]: 'Instance source: equal to "{{query}}"'
105
108
  };
106
109
  var _default = locale;
107
110
  exports.default = _default;
@@ -101,7 +101,10 @@ const locale = {
101
101
  [_constants.K.ALL_CLUSTER]: "所有集群",
102
102
  [_constants.K.FREE_SELECTION]: "自由筛选",
103
103
  [_constants.K.APP_SELECTION]: "按应用筛选",
104
- [_constants.K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} 为必填项"
104
+ [_constants.K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} 为必填项",
105
+ [_constants.K.INSTANCE_SOURCE]: "实例来源",
106
+ [_constants.K.INSTANCE_SOURCE_TOOLTIP]: "实例来源于继承当前父模型的普通模型",
107
+ [_constants.K.INSTANCE_SOURCE_TAG_TEXT]: '实例来源:等于"{{query}}"'
105
108
  };
106
109
  var _default = locale;
107
110
  exports.default = _default;
@@ -262,6 +262,23 @@ function InstanceList(props) {
262
262
  idObjectMap
263
263
  };
264
264
  }, [props.objectList, props.objectId]);
265
+ const [inheritanceModelIdNameMap, setInheritanceModelIdNameMap] = (0, _react.useState)({});
266
+
267
+ const fetchInheritanceModelIdNameMap = async modelData => {
268
+ let idNameMap = {};
269
+
270
+ if (modelData.isAbstract) {
271
+ idNameMap = await (0, _cmdbSdk.CmdbObjectApi_getIdMapName)({
272
+ parentObjectId: modelData.objectId
273
+ });
274
+ }
275
+
276
+ setInheritanceModelIdNameMap(idNameMap);
277
+ };
278
+
279
+ (0, _react.useEffect)(() => {
280
+ fetchInheritanceModelIdNameMap(modelData);
281
+ }, [modelData]);
265
282
 
266
283
  const computeDefaultFields = ({
267
284
  inModal
@@ -318,6 +335,7 @@ function InstanceList(props) {
318
335
  fieldIds = _sortFieldIds(fieldIds);
319
336
  const hideModelData = modelData.view.hide_columns || [];
320
337
  fieldIds = fieldIds.filter(field => !hideModelData.includes(field));
338
+ modelData.isAbstract && fieldIds.push("_object_id");
321
339
  return fieldIds;
322
340
  };
323
341
 
@@ -330,6 +348,7 @@ function InstanceList(props) {
330
348
  q: props.q,
331
349
  aq: props.aq,
332
350
  aqToShow: props.aqToShow || initAqToShow(props.aq, modelData),
351
+ instanceSourceQuery: props.instanceSourceQuery,
333
352
  asc: props.asc,
334
353
  sort: props.sort,
335
354
  page: (_ref = (_props$dataSource$pag = (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.page) !== null && _props$dataSource$pag !== void 0 ? _props$dataSource$pag : props.page) !== null && _ref !== void 0 ? _ref : 1,
@@ -422,6 +441,12 @@ function InstanceList(props) {
422
441
  };
423
442
  }
424
443
 
444
+ if (state.instanceSourceQuery) {
445
+ query = { ...query,
446
+ _object_id: state.instanceSourceQuery
447
+ };
448
+ }
449
+
425
450
  if (!(0, _lodash.isEmpty)(query)) {
426
451
  v3Data.query = data.query = query;
427
452
  }
@@ -527,7 +552,7 @@ function InstanceList(props) {
527
552
  }
528
553
 
529
554
  refreshInstanceList(state.sort, state.asc, 1);
530
- }, [state.q, state.aq, state.pageSize, state.aliveHosts, state.relatedToMe, props.objectId, props.permission, props.defaultQuery]); // on other condition change
555
+ }, [state.q, state.aq, state.instanceSourceQuery, state.pageSize, state.aliveHosts, state.relatedToMe, props.objectId, props.permission, props.defaultQuery]); // on other condition change
531
556
 
532
557
  (0, _react.useEffect)(() => {
533
558
  if ((0, _lodash.isEmpty)(state.fieldIds)) return;
@@ -631,6 +656,15 @@ function InstanceList(props) {
631
656
  (_props$onPaginationCh2 = props.onPaginationChange) === null || _props$onPaginationCh2 === void 0 ? void 0 : _props$onPaginationCh2.call(props, pagination);
632
657
  };
633
658
 
659
+ const onInstanceSourceChange = instanceSourceQuery => {
660
+ var _props$onInstanceSour;
661
+
662
+ setState({
663
+ instanceSourceQuery
664
+ });
665
+ (_props$onInstanceSour = props.onInstanceSourceChange) === null || _props$onInstanceSour === void 0 ? void 0 : _props$onInstanceSour.call(props, instanceSourceQuery);
666
+ };
667
+
634
668
  const onRelatedToMeChange = checked => {
635
669
  var _props$onRelatedToMeC;
636
670
 
@@ -933,7 +967,7 @@ function InstanceList(props) {
933
967
  q: state.aqToShow,
934
968
  fieldToShow: state.fieldToShow,
935
969
  onSearch: onAdvancedSearch
936
- })), !props.hideSearchConditions && !state.searchByApp && (state.q || !(0, _lodash.isEmpty)(conditions)) && /*#__PURE__*/_react.default.createElement("div", {
970
+ })), !props.hideSearchConditions && !state.searchByApp && (state.instanceSourceQuery || state.q || !(0, _lodash.isEmpty)(conditions)) && /*#__PURE__*/_react.default.createElement("div", {
937
971
  className: _InstanceListModule.default.searchConditions
938
972
  }, /*#__PURE__*/_react.default.createElement("span", null, _i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.CURRENT_FILTER_REQUIREMENTS}`)), state.q && /*#__PURE__*/_react.default.createElement(_antd.Tag, {
939
973
  closable: true,
@@ -943,6 +977,13 @@ function InstanceList(props) {
943
977
  }
944
978
  }, _i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.FUZZY_SEARCH}`, {
945
979
  query: state.q
980
+ })), state.instanceSourceQuery && /*#__PURE__*/_react.default.createElement(_antd.Tag, {
981
+ closable: true,
982
+ onClose: () => {
983
+ onInstanceSourceChange(null);
984
+ }
985
+ }, _i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.INSTANCE_SOURCE_TAG_TEXT}`, {
986
+ query: (inheritanceModelIdNameMap === null || inheritanceModelIdNameMap === void 0 ? void 0 : inheritanceModelIdNameMap[state.instanceSourceQuery]) || state.instanceSourceQuery
946
987
  })), conditions.map(condition => /*#__PURE__*/_react.default.createElement(_antd.Tag, {
947
988
  key: `${condition.attrId}${condition.valuesStr}-${(0, _lodash.uniqueId)()}`,
948
989
  closable: true,
@@ -965,6 +1006,10 @@ function InstanceList(props) {
965
1006
  onPaginationChange: onPaginationChange,
966
1007
  onSortingChange: onSortingChange,
967
1008
  onSelectionChange: onSelectionChange,
1009
+ onInstanceSourceChange: onInstanceSourceChange,
1010
+ instanceSourceQuery: state.instanceSourceQuery,
1011
+ inheritanceModelIdNameMap: inheritanceModelIdNameMap,
1012
+ filterInstanceSourceDisabled: props.filterInstanceSourceDisabled,
968
1013
  autoBreakLine: state.autoBreakLine,
969
1014
  relationLinkDisabled: props.relationLinkDisabled,
970
1015
  pageSizeOptions: props.pageSizeOptions,
@@ -131,7 +131,9 @@ function InstanceListModal(props) {
131
131
  permission: props.permission,
132
132
  aliveHosts: fixAliveHosts,
133
133
  fixAliveHosts: fixAliveHosts,
134
+ instanceSourceQuery: props.instanceSourceQuery,
134
135
  searchDisabled: props.searchDisabled,
136
+ filterInstanceSourceDisabled: props.filterInstanceSourceDisabled,
135
137
  advancedSearchDisabled: props.advancedSearchDisabled,
136
138
  aliveHostsDisabled: props.aliveHostsDisabled,
137
139
  relatedToMeDisabled: props.relatedToMeDisabled,
@@ -25,6 +25,8 @@ var _icons = require("@ant-design/icons");
25
25
 
26
26
  var _brickTypes = require("@next-core/brick-types");
27
27
 
28
+ var _cmdbSdk = require("@next-sdk/cmdb-sdk");
29
+
28
30
  var _basicComponents = require("@next-libs/basic-components");
29
31
 
30
32
  var _cmdbUtils = require("@next-libs/cmdb-utils");
@@ -74,7 +76,27 @@ class LegacyInstanceListTable extends _react.default.Component {
74
76
  super(props);
75
77
  (0, _defineProperty2.default)(this, "keyDisplayConfigMap", {});
76
78
  (0, _defineProperty2.default)(this, "recordUseBrickDataMap", void 0);
79
+ (0, _defineProperty2.default)(this, "inheritanceModelIdNameMap", void 0);
80
+ (0, _defineProperty2.default)(this, "instanceSourceTitle", /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", null, _i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.INSTANCE_SOURCE}`)), /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
81
+ title: _i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.INSTANCE_SOURCE_TOOLTIP}`)
82
+ }, /*#__PURE__*/_react.default.createElement("span", {
83
+ className: _InstanceListTableModule.default.titleTooltipIcon
84
+ }, /*#__PURE__*/_react.default.createElement(_basicComponents.GeneralIcon, {
85
+ icon: {
86
+ lib: "antd",
87
+ icon: "question-circle",
88
+ theme: "filled"
89
+ }
90
+ })))));
77
91
  (0, _defineProperty2.default)(this, "onChange", (pagination, filters, sorter, extra) => {
92
+ var _filters$_object_id;
93
+
94
+ const newInstanceSourceQuery = filters === null || filters === void 0 ? void 0 : (_filters$_object_id = filters._object_id) === null || _filters$_object_id === void 0 ? void 0 : _filters$_object_id[0];
95
+
96
+ if (newInstanceSourceQuery !== this.state.instanceSourceQuery) {
97
+ this.props.onInstanceSourceChange(newInstanceSourceQuery);
98
+ }
99
+
78
100
  if ( // pagination.current will pass in 0 when total is 0 and sorter has changed
79
101
  pagination.current > 0 && pagination.current !== this.state.pagination.current || pagination.pageSize !== this.state.pagination.pageSize) {
80
102
  var _this$props$onPaginat, _this$props;
@@ -114,6 +136,7 @@ class LegacyInstanceListTable extends _react.default.Component {
114
136
  (_this$props$propertyD = this.props.propertyDisplayConfigs) === null || _this$props$propertyD === void 0 ? void 0 : _this$props$propertyD.forEach(config => this.keyDisplayConfigMap[config.key] = config);
115
137
  const fieldIds = this.props.fieldIds;
116
138
  const sortedColumns = this.getChangeColumns(fieldIds);
139
+ this.inheritanceModelIdNameMap = this.props.inheritanceModelIdNameMap;
117
140
  const defaultPagination = {
118
141
  disabled: this.props.paginationDisabled,
119
142
  pageSizeOptions: this.props.pageSizeOptions,
@@ -126,6 +149,7 @@ class LegacyInstanceListTable extends _react.default.Component {
126
149
  };
127
150
  this.state = {
128
151
  list: this.props.instanceListData.list,
152
+ instanceSourceQuery: this.props.instanceSourceQuery,
129
153
  columns: this.getMergedColumns(sortedColumns, this.props.extraColumns),
130
154
  pagination: { ...defaultPagination,
131
155
  total: this.props.instanceListData.total,
@@ -214,7 +238,29 @@ class LegacyInstanceListTable extends _react.default.Component {
214
238
  }
215
239
 
216
240
  getMergedColumns(columns, extraColumns) {
217
- return extraColumns ? [...columns, ...this.processExtraColumns(extraColumns)] : columns;
241
+ let mergedColumns = extraColumns ? [...columns, ...this.processExtraColumns(extraColumns)] : columns;
242
+
243
+ if (this.props.modelData.isAbstract) {
244
+ mergedColumns = [{
245
+ title: this.instanceSourceTitle,
246
+ dataIndex: "_object_id",
247
+ ...(!this.props.filterInstanceSourceDisabled ? {
248
+ filters: (0, _lodash.map)(this.inheritanceModelIdNameMap, (value, key) => ({
249
+ text: value,
250
+ value: key
251
+ })),
252
+ filterMultiple: false,
253
+ filteredValue: this.props.instanceSourceQuery && [this.props.instanceSourceQuery]
254
+ } : {}),
255
+ render: (value, record, index) => {
256
+ var _this$inheritanceMode;
257
+
258
+ return /*#__PURE__*/_react.default.createElement(_antd.Tag, null, ((_this$inheritanceMode = this.inheritanceModelIdNameMap) === null || _this$inheritanceMode === void 0 ? void 0 : _this$inheritanceMode[value]) || value);
259
+ }
260
+ }, ...mergedColumns.filter(c => c.dataIndex !== "_object_id")];
261
+ }
262
+
263
+ return mergedColumns;
218
264
  }
219
265
 
220
266
  processExtraColumns(extraColumns) {
@@ -249,7 +295,23 @@ class LegacyInstanceListTable extends _react.default.Component {
249
295
  });
250
296
  }
251
297
 
298
+ async componentDidMount() {
299
+ if (this.props.modelData.isAbstract && (0, _lodash.isNil)(this.inheritanceModelIdNameMap)) {
300
+ this.inheritanceModelIdNameMap = await (0, _cmdbSdk.CmdbObjectApi_getIdMapName)({
301
+ parentObjectId: this.props.modelData.objectId
302
+ });
303
+ }
304
+
305
+ const columns = this.getChangeColumns(this.props.fieldIds);
306
+ this.setState({
307
+ columns: this.getMergedColumns(columns, this.props.extraColumns)
308
+ });
309
+ }
310
+
252
311
  UNSAFE_componentWillReceiveProps(nextProps) {
312
+ this.inheritanceModelIdNameMap = { ...this.inheritanceModelIdNameMap,
313
+ ...nextProps.inheritanceModelIdNameMap
314
+ };
253
315
  const columns = this.getChangeColumns(nextProps.fieldIds);
254
316
  this.setState({
255
317
  columns: this.getMergedColumns(columns, nextProps.extraColumns)
@@ -474,8 +536,10 @@ class LegacyInstanceListTable extends _react.default.Component {
474
536
  const detailUrlTemplate = (0, _cmdbUtils.getTemplateFromMap)(this.props.detailUrlTemplates, object.objectId);
475
537
 
476
538
  if (detailUrlTemplate) {
539
+ var _this$inheritanceMode2;
540
+
477
541
  const data = { ...record,
478
- objectId: object.objectId
542
+ objectId: object.isAbstract ? record._object_id : object.objectId
479
543
  };
480
544
  const url = (0, _cmdbUtils.parseTemplate)(detailUrlTemplate, data);
481
545
 
@@ -491,13 +555,13 @@ class LegacyInstanceListTable extends _react.default.Component {
491
555
  to: url,
492
556
  onClick: e => this.handleClickItem(e, record.instanceId),
493
557
  "data-testid": "instance-detail-link"
494
- }, !firstColumns ? {
558
+ }, !firstColumns || object.isAbstract ? {
495
559
  target: "_blank"
496
560
  } : this.props.target ? {
497
561
  target: this.props.target
498
562
  } : {}), /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
499
563
  placement: "top",
500
- title: `${_i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.JUMP_TO}`)}${object.name}${_i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.INSTANCE_DETAIL}`)}`
564
+ title: `${_i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.JUMP_TO}`)}${object.isAbstract ? ((_this$inheritanceMode2 = this.inheritanceModelIdNameMap) === null || _this$inheritanceMode2 === void 0 ? void 0 : _this$inheritanceMode2[record._object_id]) || record._object_id : object.name}${_i18next.default.t(`${_constants.NS_LIBS_CMDB_INSTANCES}:${_constants.K.INSTANCE_DETAIL}`)}`
501
565
  }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("span", {
502
566
  className: _InstanceListTableModule.default.iconWrap
503
567
  }, /*#__PURE__*/_react.default.createElement(_basicComponents.GeneralIcon, {
@@ -632,6 +696,12 @@ class LegacyInstanceListTable extends _react.default.Component {
632
696
  columns
633
697
  });
634
698
  }
699
+
700
+ if (this.props.instanceSourceQuery !== prevProps.instanceSourceQuery) {
701
+ this.setState({
702
+ instanceSourceQuery: this.props.instanceSourceQuery
703
+ });
704
+ }
635
705
  }
636
706
 
637
707
  render() {
@@ -96,4 +96,7 @@ export var K;
96
96
  K["FREE_SELECTION"] = "FREE_SELECTION";
97
97
  K["APP_SELECTION"] = "APP_SELECTION";
98
98
  K["ATTRIBUTE_NAME_REQUIRED"] = "ATTRIBUTE_NAME_REQUIRED";
99
+ K["INSTANCE_SOURCE"] = "INSTANCE_SOURCE";
100
+ K["INSTANCE_SOURCE_TOOLTIP"] = "INSTANCE_SOURCE_TOOLTIP";
101
+ K["INSTANCE_SOURCE_TAG_TEXT"] = "INSTANCE_SOURCE_TAG_TEXT";
99
102
  })(K || (K = {}));
@@ -93,6 +93,9 @@ var locale = {
93
93
  [K.ALL_CLUSTER]: "All cluster",
94
94
  [K.FREE_SELECTION]: "Free selection",
95
95
  [K.APP_SELECTION]: "App selection",
96
- [K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} is required"
96
+ [K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} is required",
97
+ [K.INSTANCE_SOURCE]: "Instance source",
98
+ [K.INSTANCE_SOURCE_TOOLTIP]: "The instance comes from a common model that inherits the current parent model",
99
+ [K.INSTANCE_SOURCE_TAG_TEXT]: 'Instance source: equal to "{{query}}"'
97
100
  };
98
101
  export default locale;
@@ -93,6 +93,9 @@ var locale = {
93
93
  [K.ALL_CLUSTER]: "所有集群",
94
94
  [K.FREE_SELECTION]: "自由筛选",
95
95
  [K.APP_SELECTION]: "按应用筛选",
96
- [K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} 为必填项"
96
+ [K.ATTRIBUTE_NAME_REQUIRED]: "{{attribute_name}} 为必填项",
97
+ [K.INSTANCE_SOURCE]: "实例来源",
98
+ [K.INSTANCE_SOURCE_TOOLTIP]: "实例来源于继承当前父模型的普通模型",
99
+ [K.INSTANCE_SOURCE_TAG_TEXT]: '实例来源:等于"{{query}}"'
97
100
  };
98
101
  export default locale;
@@ -5,7 +5,7 @@ import { difference, isEmpty, isEqual, isString, map, uniq, union, filter, rejec
5
5
  import { BrickAsComponent, handleHttpError } from "@next-core/brick-kit";
6
6
  import i18n from "i18next";
7
7
  import { K, NS_LIBS_CMDB_INSTANCES } from "../i18n/constants";
8
- import { InstanceApi_postSearchV3 } from "@next-sdk/cmdb-sdk";
8
+ import { InstanceApi_postSearchV3, CmdbObjectApi_getIdMapName } from "@next-sdk/cmdb-sdk";
9
9
  import { Icon as LegacyIcon } from "@ant-design/compatible";
10
10
  import { Button, Spin, Input, Tag, Select } from "antd";
11
11
  import { getRelationObjectSides, forEachAvailableFields, getInstanceNameKeys } from "@next-libs/cmdb-utils";
@@ -231,6 +231,29 @@ export function InstanceList(props) {
231
231
  idObjectMap
232
232
  };
233
233
  }, [props.objectList, props.objectId]);
234
+ var [inheritanceModelIdNameMap, setInheritanceModelIdNameMap] = useState({});
235
+
236
+ var fetchInheritanceModelIdNameMap = /*#__PURE__*/function () {
237
+ var _ref = _asyncToGenerator(function* (modelData) {
238
+ var idNameMap = {};
239
+
240
+ if (modelData.isAbstract) {
241
+ idNameMap = yield CmdbObjectApi_getIdMapName({
242
+ parentObjectId: modelData.objectId
243
+ });
244
+ }
245
+
246
+ setInheritanceModelIdNameMap(idNameMap);
247
+ });
248
+
249
+ return function fetchInheritanceModelIdNameMap(_x) {
250
+ return _ref.apply(this, arguments);
251
+ };
252
+ }();
253
+
254
+ useEffect(() => {
255
+ fetchInheritanceModelIdNameMap(modelData);
256
+ }, [modelData]);
234
257
 
235
258
  var computeDefaultFields = ({
236
259
  inModal
@@ -287,22 +310,24 @@ export function InstanceList(props) {
287
310
  fieldIds = _sortFieldIds(fieldIds);
288
311
  var hideModelData = modelData.view.hide_columns || [];
289
312
  fieldIds = fieldIds.filter(field => !hideModelData.includes(field));
313
+ modelData.isAbstract && fieldIds.push("_object_id");
290
314
  return fieldIds;
291
315
  };
292
316
 
293
317
  var [q, setQ] = useState(props.q);
294
318
  var [state, setState] = useReducer(reducer, undefined, () => {
295
- var _ref, _props$dataSource$pag, _props$dataSource, _ref2, _props$dataSource$pag2, _props$dataSource2;
319
+ var _ref2, _props$dataSource$pag, _props$dataSource, _ref3, _props$dataSource$pag2, _props$dataSource2;
296
320
 
297
321
  return {
298
322
  objectId: props.objectId,
299
323
  q: props.q,
300
324
  aq: props.aq,
301
325
  aqToShow: props.aqToShow || initAqToShow(props.aq, modelData),
326
+ instanceSourceQuery: props.instanceSourceQuery,
302
327
  asc: props.asc,
303
328
  sort: props.sort,
304
- page: (_ref = (_props$dataSource$pag = (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.page) !== null && _props$dataSource$pag !== void 0 ? _props$dataSource$pag : props.page) !== null && _ref !== void 0 ? _ref : 1,
305
- pageSize: (_ref2 = (_props$dataSource$pag2 = (_props$dataSource2 = props.dataSource) === null || _props$dataSource2 === void 0 ? void 0 : _props$dataSource2.pageSize) !== null && _props$dataSource$pag2 !== void 0 ? _props$dataSource$pag2 : props.pageSize) !== null && _ref2 !== void 0 ? _ref2 : 10,
329
+ page: (_ref2 = (_props$dataSource$pag = (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.page) !== null && _props$dataSource$pag !== void 0 ? _props$dataSource$pag : props.page) !== null && _ref2 !== void 0 ? _ref2 : 1,
330
+ pageSize: (_ref3 = (_props$dataSource$pag2 = (_props$dataSource2 = props.dataSource) === null || _props$dataSource2 === void 0 ? void 0 : _props$dataSource2.pageSize) !== null && _props$dataSource$pag2 !== void 0 ? _props$dataSource$pag2 : props.pageSize) !== null && _ref3 !== void 0 ? _ref3 : 10,
306
331
  aliveHosts: props.aliveHosts,
307
332
  relatedToMe: props.relatedToMe,
308
333
  inited: false,
@@ -328,7 +353,7 @@ export function InstanceList(props) {
328
353
  var isFirstRunRef = useRef(true);
329
354
 
330
355
  var getInstanceListData = /*#__PURE__*/function () {
331
- var _ref3 = _asyncToGenerator(function* (sort, asc, page) {
356
+ var _ref4 = _asyncToGenerator(function* (sort, asc, page) {
332
357
  var _modelData$attrList, _modelData$attrList$f2, _modelData$attrList$f3, _props$onSearchExecut;
333
358
 
334
359
  var data = {};
@@ -392,6 +417,12 @@ export function InstanceList(props) {
392
417
  });
393
418
  }
394
419
 
420
+ if (state.instanceSourceQuery) {
421
+ query = _objectSpread(_objectSpread({}, query), {}, {
422
+ _object_id: state.instanceSourceQuery
423
+ });
424
+ }
425
+
395
426
  if (!isEmpty(query)) {
396
427
  v3Data.query = data.query = query;
397
428
  }
@@ -414,13 +445,13 @@ export function InstanceList(props) {
414
445
  return promise ? promise : InstanceApi_postSearchV3(props.objectId, v3Data);
415
446
  });
416
447
 
417
- return function getInstanceListData(_x, _x2, _x3) {
418
- return _ref3.apply(this, arguments);
448
+ return function getInstanceListData(_x2, _x3, _x4) {
449
+ return _ref4.apply(this, arguments);
419
450
  };
420
451
  }();
421
452
 
422
453
  var refreshInstanceList = /*#__PURE__*/function () {
423
- var _ref4 = _asyncToGenerator(function* (sort, asc, page) {
454
+ var _ref5 = _asyncToGenerator(function* (sort, asc, page) {
424
455
  setState({
425
456
  loading: true
426
457
  });
@@ -452,8 +483,8 @@ export function InstanceList(props) {
452
483
  }
453
484
  });
454
485
 
455
- return function refreshInstanceList(_x4, _x5, _x6) {
456
- return _ref4.apply(this, arguments);
486
+ return function refreshInstanceList(_x5, _x6, _x7) {
487
+ return _ref5.apply(this, arguments);
457
488
  };
458
489
  }();
459
490
 
@@ -507,7 +538,7 @@ export function InstanceList(props) {
507
538
  }
508
539
 
509
540
  refreshInstanceList(state.sort, state.asc, 1);
510
- }, [state.q, state.aq, state.pageSize, state.aliveHosts, state.relatedToMe, props.objectId, props.permission, props.defaultQuery]); // on other condition change
541
+ }, [state.q, state.aq, state.instanceSourceQuery, state.pageSize, state.aliveHosts, state.relatedToMe, props.objectId, props.permission, props.defaultQuery]); // on other condition change
511
542
 
512
543
  useEffect(() => {
513
544
  if (isEmpty(state.fieldIds)) return;
@@ -520,7 +551,7 @@ export function InstanceList(props) {
520
551
 
521
552
 
522
553
  var onSelectionChange = /*#__PURE__*/function () {
523
- var _ref5 = _asyncToGenerator(function* (selected) {
554
+ var _ref6 = _asyncToGenerator(function* (selected) {
524
555
  var _props$onSelectionCha;
525
556
 
526
557
  var {
@@ -554,8 +585,8 @@ export function InstanceList(props) {
554
585
  });
555
586
  });
556
587
 
557
- return function onSelectionChange(_x7) {
558
- return _ref5.apply(this, arguments);
588
+ return function onSelectionChange(_x8) {
589
+ return _ref6.apply(this, arguments);
559
590
  };
560
591
  }();
561
592
 
@@ -617,6 +648,15 @@ export function InstanceList(props) {
617
648
  (_props$onPaginationCh2 = props.onPaginationChange) === null || _props$onPaginationCh2 === void 0 ? void 0 : _props$onPaginationCh2.call(props, pagination);
618
649
  };
619
650
 
651
+ var onInstanceSourceChange = instanceSourceQuery => {
652
+ var _props$onInstanceSour;
653
+
654
+ setState({
655
+ instanceSourceQuery
656
+ });
657
+ (_props$onInstanceSour = props.onInstanceSourceChange) === null || _props$onInstanceSour === void 0 ? void 0 : _props$onInstanceSour.call(props, instanceSourceQuery);
658
+ };
659
+
620
660
  var onRelatedToMeChange = checked => {
621
661
  var _props$onRelatedToMeC;
622
662
 
@@ -918,7 +958,7 @@ export function InstanceList(props) {
918
958
  q: state.aqToShow,
919
959
  fieldToShow: state.fieldToShow,
920
960
  onSearch: onAdvancedSearch
921
- })), !props.hideSearchConditions && !state.searchByApp && (state.q || !isEmpty(conditions)) && /*#__PURE__*/React.createElement("div", {
961
+ })), !props.hideSearchConditions && !state.searchByApp && (state.instanceSourceQuery || state.q || !isEmpty(conditions)) && /*#__PURE__*/React.createElement("div", {
922
962
  className: styles.searchConditions
923
963
  }, /*#__PURE__*/React.createElement("span", null, i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.CURRENT_FILTER_REQUIREMENTS))), state.q && /*#__PURE__*/React.createElement(Tag, {
924
964
  closable: true,
@@ -928,6 +968,13 @@ export function InstanceList(props) {
928
968
  }
929
969
  }, i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.FUZZY_SEARCH), {
930
970
  query: state.q
971
+ })), state.instanceSourceQuery && /*#__PURE__*/React.createElement(Tag, {
972
+ closable: true,
973
+ onClose: () => {
974
+ onInstanceSourceChange(null);
975
+ }
976
+ }, i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.INSTANCE_SOURCE_TAG_TEXT), {
977
+ query: (inheritanceModelIdNameMap === null || inheritanceModelIdNameMap === void 0 ? void 0 : inheritanceModelIdNameMap[state.instanceSourceQuery]) || state.instanceSourceQuery
931
978
  })), conditions.map(condition => /*#__PURE__*/React.createElement(Tag, {
932
979
  key: "".concat(condition.attrId).concat(condition.valuesStr, "-").concat(uniqueId()),
933
980
  closable: true,
@@ -950,6 +997,10 @@ export function InstanceList(props) {
950
997
  onPaginationChange: onPaginationChange,
951
998
  onSortingChange: onSortingChange,
952
999
  onSelectionChange: onSelectionChange,
1000
+ onInstanceSourceChange: onInstanceSourceChange,
1001
+ instanceSourceQuery: state.instanceSourceQuery,
1002
+ inheritanceModelIdNameMap: inheritanceModelIdNameMap,
1003
+ filterInstanceSourceDisabled: props.filterInstanceSourceDisabled,
953
1004
  autoBreakLine: state.autoBreakLine,
954
1005
  relationLinkDisabled: props.relationLinkDisabled,
955
1006
  pageSizeOptions: props.pageSizeOptions,
@@ -117,7 +117,9 @@ export function InstanceListModal(props) {
117
117
  permission: props.permission,
118
118
  aliveHosts: fixAliveHosts,
119
119
  fixAliveHosts: fixAliveHosts,
120
+ instanceSourceQuery: props.instanceSourceQuery,
120
121
  searchDisabled: props.searchDisabled,
122
+ filterInstanceSourceDisabled: props.filterInstanceSourceDisabled,
121
123
  advancedSearchDisabled: props.advancedSearchDisabled,
122
124
  aliveHostsDisabled: props.aliveHostsDisabled,
123
125
  relatedToMeDisabled: props.relatedToMeDisabled,
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
4
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
4
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
@@ -7,9 +8,10 @@ import React from "react";
7
8
  import { withTranslation } from "react-i18next";
8
9
  import classnames from "classnames";
9
10
  import { Button, Popover, Table, Tag, Tooltip, Modal } from "antd";
10
- import { isNil, isBoolean, compact } from "lodash";
11
+ import { isNil, isBoolean, compact, map } from "lodash";
11
12
  import { DeleteOutlined } from "@ant-design/icons";
12
13
  import { PropertyDisplayType } from "@next-core/brick-types";
14
+ import { CmdbObjectApi_getIdMapName } from "@next-sdk/cmdb-sdk";
13
15
  import { Link, GeneralIcon } from "@next-libs/basic-components";
14
16
  import { forEachAvailableFields, getInstanceNameKeys, getTemplateFromMap, parseTemplate, modifyModelData } from "@next-libs/cmdb-utils";
15
17
  import { ModelAttributeValueType } from "../model-attribute-form-control/ModelAttributeFormControl";
@@ -52,7 +54,29 @@ export class LegacyInstanceListTable extends React.Component {
52
54
 
53
55
  _defineProperty(this, "recordUseBrickDataMap", void 0);
54
56
 
57
+ _defineProperty(this, "inheritanceModelIdNameMap", void 0);
58
+
59
+ _defineProperty(this, "instanceSourceTitle", /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.INSTANCE_SOURCE))), /*#__PURE__*/React.createElement(Tooltip, {
60
+ title: i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.INSTANCE_SOURCE_TOOLTIP))
61
+ }, /*#__PURE__*/React.createElement("span", {
62
+ className: styles.titleTooltipIcon
63
+ }, /*#__PURE__*/React.createElement(GeneralIcon, {
64
+ icon: {
65
+ lib: "antd",
66
+ icon: "question-circle",
67
+ theme: "filled"
68
+ }
69
+ })))));
70
+
55
71
  _defineProperty(this, "onChange", (pagination, filters, sorter, extra) => {
72
+ var _filters$_object_id;
73
+
74
+ var newInstanceSourceQuery = filters === null || filters === void 0 ? void 0 : (_filters$_object_id = filters._object_id) === null || _filters$_object_id === void 0 ? void 0 : _filters$_object_id[0];
75
+
76
+ if (newInstanceSourceQuery !== this.state.instanceSourceQuery) {
77
+ this.props.onInstanceSourceChange(newInstanceSourceQuery);
78
+ }
79
+
56
80
  if ( // pagination.current will pass in 0 when total is 0 and sorter has changed
57
81
  pagination.current > 0 && pagination.current !== this.state.pagination.current || pagination.pageSize !== this.state.pagination.pageSize) {
58
82
  var _this$props$onPaginat, _this$props;
@@ -94,6 +118,7 @@ export class LegacyInstanceListTable extends React.Component {
94
118
  (_this$props$propertyD = this.props.propertyDisplayConfigs) === null || _this$props$propertyD === void 0 ? void 0 : _this$props$propertyD.forEach(config => this.keyDisplayConfigMap[config.key] = config);
95
119
  var fieldIds = this.props.fieldIds;
96
120
  var sortedColumns = this.getChangeColumns(fieldIds);
121
+ this.inheritanceModelIdNameMap = this.props.inheritanceModelIdNameMap;
97
122
  var defaultPagination = {
98
123
  disabled: this.props.paginationDisabled,
99
124
  pageSizeOptions: this.props.pageSizeOptions,
@@ -106,6 +131,7 @@ export class LegacyInstanceListTable extends React.Component {
106
131
  };
107
132
  this.state = {
108
133
  list: this.props.instanceListData.list,
134
+ instanceSourceQuery: this.props.instanceSourceQuery,
109
135
  columns: this.getMergedColumns(sortedColumns, this.props.extraColumns),
110
136
  pagination: _objectSpread(_objectSpread({}, defaultPagination), {}, {
111
137
  total: this.props.instanceListData.total,
@@ -194,7 +220,29 @@ export class LegacyInstanceListTable extends React.Component {
194
220
  }
195
221
 
196
222
  getMergedColumns(columns, extraColumns) {
197
- return extraColumns ? [...columns, ...this.processExtraColumns(extraColumns)] : columns;
223
+ var mergedColumns = extraColumns ? [...columns, ...this.processExtraColumns(extraColumns)] : columns;
224
+
225
+ if (this.props.modelData.isAbstract) {
226
+ mergedColumns = [_objectSpread(_objectSpread({
227
+ title: this.instanceSourceTitle,
228
+ dataIndex: "_object_id"
229
+ }, !this.props.filterInstanceSourceDisabled ? {
230
+ filters: map(this.inheritanceModelIdNameMap, (value, key) => ({
231
+ text: value,
232
+ value: key
233
+ })),
234
+ filterMultiple: false,
235
+ filteredValue: this.props.instanceSourceQuery && [this.props.instanceSourceQuery]
236
+ } : {}), {}, {
237
+ render: (value, record, index) => {
238
+ var _this$inheritanceMode;
239
+
240
+ return /*#__PURE__*/React.createElement(Tag, null, ((_this$inheritanceMode = this.inheritanceModelIdNameMap) === null || _this$inheritanceMode === void 0 ? void 0 : _this$inheritanceMode[value]) || value);
241
+ }
242
+ }), ...mergedColumns.filter(c => c.dataIndex !== "_object_id")];
243
+ }
244
+
245
+ return mergedColumns;
198
246
  }
199
247
 
200
248
  processExtraColumns(extraColumns) {
@@ -229,7 +277,26 @@ export class LegacyInstanceListTable extends React.Component {
229
277
  });
230
278
  }
231
279
 
280
+ componentDidMount() {
281
+ var _this = this;
282
+
283
+ return _asyncToGenerator(function* () {
284
+ if (_this.props.modelData.isAbstract && isNil(_this.inheritanceModelIdNameMap)) {
285
+ _this.inheritanceModelIdNameMap = yield CmdbObjectApi_getIdMapName({
286
+ parentObjectId: _this.props.modelData.objectId
287
+ });
288
+ }
289
+
290
+ var columns = _this.getChangeColumns(_this.props.fieldIds);
291
+
292
+ _this.setState({
293
+ columns: _this.getMergedColumns(columns, _this.props.extraColumns)
294
+ });
295
+ })();
296
+ }
297
+
232
298
  UNSAFE_componentWillReceiveProps(nextProps) {
299
+ this.inheritanceModelIdNameMap = _objectSpread(_objectSpread({}, this.inheritanceModelIdNameMap), nextProps.inheritanceModelIdNameMap);
233
300
  var columns = this.getChangeColumns(nextProps.fieldIds);
234
301
  this.setState({
235
302
  columns: this.getMergedColumns(columns, nextProps.extraColumns)
@@ -454,8 +521,10 @@ export class LegacyInstanceListTable extends React.Component {
454
521
  var detailUrlTemplate = getTemplateFromMap(this.props.detailUrlTemplates, object.objectId);
455
522
 
456
523
  if (detailUrlTemplate) {
524
+ var _this$inheritanceMode2;
525
+
457
526
  var data = _objectSpread(_objectSpread({}, record), {}, {
458
- objectId: object.objectId
527
+ objectId: object.isAbstract ? record._object_id : object.objectId
459
528
  });
460
529
 
461
530
  var url = parseTemplate(detailUrlTemplate, data);
@@ -472,13 +541,13 @@ export class LegacyInstanceListTable extends React.Component {
472
541
  to: url,
473
542
  onClick: e => this.handleClickItem(e, record.instanceId),
474
543
  "data-testid": "instance-detail-link"
475
- }, !firstColumns ? {
544
+ }, !firstColumns || object.isAbstract ? {
476
545
  target: "_blank"
477
546
  } : this.props.target ? {
478
547
  target: this.props.target
479
548
  } : {}), /*#__PURE__*/React.createElement(Tooltip, {
480
549
  placement: "top",
481
- title: "".concat(i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.JUMP_TO))).concat(object.name).concat(i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.INSTANCE_DETAIL)))
550
+ title: "".concat(i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.JUMP_TO))).concat(object.isAbstract ? ((_this$inheritanceMode2 = this.inheritanceModelIdNameMap) === null || _this$inheritanceMode2 === void 0 ? void 0 : _this$inheritanceMode2[record._object_id]) || record._object_id : object.name).concat(i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.INSTANCE_DETAIL)))
482
551
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
483
552
  className: styles.iconWrap
484
553
  }, /*#__PURE__*/React.createElement(GeneralIcon, {
@@ -614,6 +683,12 @@ export class LegacyInstanceListTable extends React.Component {
614
683
  columns
615
684
  });
616
685
  }
686
+
687
+ if (this.props.instanceSourceQuery !== prevProps.instanceSourceQuery) {
688
+ this.setState({
689
+ instanceSourceQuery: this.props.instanceSourceQuery
690
+ });
691
+ }
617
692
  }
618
693
 
619
694
  render() {
@@ -22,19 +22,33 @@
22
22
  font-weight: normal;
23
23
  color: #595959;
24
24
  }
25
+
25
26
  .moreButtonsContainer {
26
27
  background: #f5f5f5;
27
28
  border: none;
28
29
  }
30
+
29
31
  .moreButtonsContainer:hover {
30
32
  background: #f5f5f5;
31
33
  }
34
+
32
35
  .linkKey {
33
36
  padding-left: 5px;
34
37
  }
38
+
35
39
  .iconWrap {
36
40
  transform: translateY(0px);
37
41
  }
42
+
38
43
  .iconWrapOfStruct {
39
44
  transform: translateY(5px);
40
45
  }
46
+
47
+ .titleTooltipIcon {
48
+ margin: 0 3px;
49
+ color: #8c8c8c;
50
+
51
+ &:hover {
52
+ color: #595959;
53
+ }
54
+ }
@@ -93,7 +93,10 @@ export declare enum K {
93
93
  ALL_CLUSTER = "ALL_CLUSTER",
94
94
  FREE_SELECTION = "FREE_SELECTION",
95
95
  APP_SELECTION = "APP_SELECTION",
96
- ATTRIBUTE_NAME_REQUIRED = "ATTRIBUTE_NAME_REQUIRED"
96
+ ATTRIBUTE_NAME_REQUIRED = "ATTRIBUTE_NAME_REQUIRED",
97
+ INSTANCE_SOURCE = "INSTANCE_SOURCE",
98
+ INSTANCE_SOURCE_TOOLTIP = "INSTANCE_SOURCE_TOOLTIP",
99
+ INSTANCE_SOURCE_TAG_TEXT = "INSTANCE_SOURCE_TAG_TEXT"
97
100
  }
98
101
  export declare type Locale = {
99
102
  [key in K]: string;
@@ -35,6 +35,8 @@ interface InstanceListProps {
35
35
  selectDisabled?: boolean;
36
36
  pageSizeOptions?: string[];
37
37
  showSizeChanger?: boolean;
38
+ filterInstanceSourceDisabled?: boolean;
39
+ instanceSourceQuery?: string;
38
40
  onSearchExecute?(data: InstanceApi_PostSearchRequestBody, v3Data: InstanceApi_PostSearchV3RequestBody): Promise<InstanceApi_PostSearchV3ResponseBody> | void;
39
41
  onSearch?(value: string): void;
40
42
  onAdvancedSearch?(queries: Query[]): void;
@@ -44,6 +46,7 @@ interface InstanceListProps {
44
46
  onSelectionChange?(selection: ReadSelectionChangeDetail): void;
45
47
  onRelatedToMeChange?(value: boolean): void;
46
48
  onAliveHostsChange?(value: boolean): void;
49
+ onInstanceSourceChange?(instanceResource: string): void;
47
50
  relationLinkDisabled?: boolean;
48
51
  notifyCurrentFields?: (fiels: string[]) => void;
49
52
  defaultQuery?: {
@@ -13,11 +13,13 @@ export interface InstanceListModalProps {
13
13
  presetConfigs?: InstanceListPresetConfigs;
14
14
  permission?: string[];
15
15
  aq?: Query[];
16
+ instanceSourceQuery?: string;
16
17
  searchDisabled?: boolean;
17
18
  advancedSearchDisabled?: boolean;
18
19
  aliveHostsDisabled?: boolean;
19
20
  relatedToMeDisabled?: boolean;
20
21
  moreButtonsDisabled?: boolean;
22
+ filterInstanceSourceDisabled?: boolean;
21
23
  sortDisabled?: boolean;
22
24
  selectDisabled?: boolean;
23
25
  singleSelect?: boolean;
@@ -25,10 +25,14 @@ export interface InstanceListTableProps extends WithTranslation {
25
25
  selectDisabled?: boolean;
26
26
  autoBreakLine?: boolean;
27
27
  sortDisabled?: boolean;
28
+ instanceSourceQuery?: string;
29
+ inheritanceModelIdNameMap?: Record<string, string>;
30
+ filterInstanceSourceDisabled?: boolean;
28
31
  onClickItem?(evt: React.MouseEvent<HTMLAnchorElement, MouseEvent>, id: string): void;
29
32
  onPaginationChange?(pagination: ReadPaginationChangeDetail): void;
30
33
  onSortingChange?(sorting: ReadSortingChangeDetail): void;
31
34
  onSelectionChange?(selection: ReadSelectionChangeDetail): void;
35
+ onInstanceSourceChange?(instanceSourceQuery: string): void;
32
36
  relationLinkDisabled?: boolean;
33
37
  paginationDisabled?: boolean;
34
38
  pageSizeOptions?: string[];
@@ -42,6 +46,7 @@ export interface InstanceListTableProps extends WithTranslation {
42
46
  }
43
47
  interface InstanceListTableState {
44
48
  list: Record<string, any>[];
49
+ instanceSourceQuery?: string;
45
50
  columns?: ColumnType<Record<string, any>>[];
46
51
  pagination: TablePaginationConfig;
47
52
  defaultPagination: TablePaginationConfig;
@@ -49,12 +54,15 @@ interface InstanceListTableState {
49
54
  export declare class LegacyInstanceListTable extends React.Component<InstanceListTableProps, InstanceListTableState> {
50
55
  keyDisplayConfigMap: Record<string, PropertyDisplayConfig>;
51
56
  recordUseBrickDataMap: Map<unknown, InstanceListUseBrickData>;
57
+ inheritanceModelIdNameMap: Record<string, string>;
58
+ instanceSourceTitle: React.ReactElement;
52
59
  constructor(props: InstanceListTableProps);
53
60
  openConfirmModal(index: number): void;
54
61
  remove(index: number): void;
55
62
  getChangeColumns(ids: string[]): ColumnType<Record<string, any>>[];
56
63
  getMergedColumns(columns: ColumnType<Record<string, any>>[], extraColumns: CustomColumn[]): ColumnType<Record<string, any>>[];
57
64
  processExtraColumns(extraColumns: CustomColumn[]): ColumnType<Record<string, any>>[];
65
+ componentDidMount(): Promise<void>;
58
66
  UNSAFE_componentWillReceiveProps(nextProps: InstanceListTableProps): void;
59
67
  handleClickItem(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, id: string): void;
60
68
  getCustomPropertyRender(config: PropertyDisplayConfig, isPrimary?: boolean): (value: any, record: Record<string, any>, index: number) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-libs/cmdb-instances",
3
- "version": "6.6.6",
3
+ "version": "6.7.3",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "https://github.com/easyops-cn/next-libs/tree/master/libs/cmdb-instances",
6
6
  "license": "GPL-3.0",
@@ -50,5 +50,5 @@
50
50
  "immutability-helper": "^3.1.1",
51
51
  "marked": "^2.1.3"
52
52
  },
53
- "gitHead": "bb7e58e42bd056499085305a7bb3e2eff306b9cb"
53
+ "gitHead": "d692fdc49831a52922c09ec7899383d1fb6c25b7"
54
54
  }