@next-libs/cmdb-instances 7.28.10 → 7.29.0
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/dist/cjs/instance-list/InstanceList.js +33 -10
- package/dist/cjs/instance-list/InstanceList.js.map +1 -1
- package/dist/cjs/instance-list-table/DisplaySettingsModal.js +1 -1
- package/dist/cjs/instance-list-table/DisplaySettingsModal.js.map +1 -1
- package/dist/cjs/instance-list-table/InstanceListTable.js +6 -2
- package/dist/cjs/instance-list-table/InstanceListTable.js.map +1 -1
- package/dist/esm/instance-list/InstanceList.js +34 -11
- package/dist/esm/instance-list/InstanceList.js.map +1 -1
- package/dist/esm/instance-list-table/DisplaySettingsModal.js +1 -1
- package/dist/esm/instance-list-table/DisplaySettingsModal.js.map +1 -1
- package/dist/esm/instance-list-table/InstanceListTable.js +6 -2
- package/dist/esm/instance-list-table/InstanceListTable.js.map +1 -1
- package/dist/types/instance-list/InstanceList.d.ts +6 -1
- package/dist/types/instance-list-table/InstanceListTable.d.ts +1 -0
- package/package.json +2 -2
|
@@ -297,6 +297,18 @@ const initAqToShow = (aq, modelData, isToShow = true) => {
|
|
|
297
297
|
return;
|
|
298
298
|
};
|
|
299
299
|
exports.initAqToShow = initAqToShow;
|
|
300
|
+
// 判断是不是字符串数组
|
|
301
|
+
function isStringArray(arr) {
|
|
302
|
+
return (0, _lodash.isArray)(arr) && arr.every(item => (0, _lodash.isString)(item));
|
|
303
|
+
}
|
|
304
|
+
// 格式化extraFixedFields
|
|
305
|
+
function getExtraFixedFields(fields) {
|
|
306
|
+
if ((0, _lodash.isNil)(fields) || isStringArray(fields)) {
|
|
307
|
+
return fields;
|
|
308
|
+
} else {
|
|
309
|
+
return fields.map(v => v.field);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
300
312
|
function LegacyInstanceList(props) {
|
|
301
313
|
var _props$selectedRowKey, _state$appList, _props$extraOperateBr, _props$extraFilterBri;
|
|
302
314
|
const {
|
|
@@ -371,6 +383,9 @@ function LegacyInstanceList(props) {
|
|
|
371
383
|
idObjectMap
|
|
372
384
|
};
|
|
373
385
|
}, [props.objectList, props.objectId]);
|
|
386
|
+
const processFixedFields = (0, _react.useMemo)(() => {
|
|
387
|
+
return getExtraFixedFields(props === null || props === void 0 ? void 0 : props.extraFixedFields);
|
|
388
|
+
}, [props.extraFixedFields]);
|
|
374
389
|
const [inheritanceModelIdNameMap, setInheritanceModelIdNameMap] = (0, _react.useState)({});
|
|
375
390
|
const [fixedHeader, setFixHeader] = (0, _react.useState)(false);
|
|
376
391
|
const fetchInheritanceModelIdNameMap = async modelData => {
|
|
@@ -435,7 +450,7 @@ function LegacyInstanceList(props) {
|
|
|
435
450
|
// istanbul ignore next
|
|
436
451
|
|
|
437
452
|
const getFieldsAsync = async () => {
|
|
438
|
-
var _props$presetConfigs3, _modelData$attrList, _modelData$attrList$f2, _modelData$attrList$f3
|
|
453
|
+
var _props$presetConfigs3, _modelData$attrList, _modelData$attrList$f2, _modelData$attrList$f3;
|
|
439
454
|
let sort = props.sort;
|
|
440
455
|
let fieldIds = (_props$presetConfigs3 = props.presetConfigs) === null || _props$presetConfigs3 === void 0 ? void 0 : _props$presetConfigs3.fieldIds;
|
|
441
456
|
const sortType = modelData === null || modelData === void 0 ? void 0 : (_modelData$attrList = modelData.attrList) === null || _modelData$attrList === void 0 ? void 0 : (_modelData$attrList$f2 = _modelData$attrList.find(attr => attr.id === sort)) === null || _modelData$attrList$f2 === void 0 ? void 0 : (_modelData$attrList$f3 = _modelData$attrList$f2.value) === null || _modelData$attrList$f3 === void 0 ? void 0 : _modelData$attrList$f3.default_type;
|
|
@@ -457,7 +472,7 @@ function LegacyInstanceList(props) {
|
|
|
457
472
|
sortFields = returnData.sortFields;
|
|
458
473
|
backendDefaultFields = returnData.defaultSortFields;
|
|
459
474
|
}
|
|
460
|
-
const extraFixedFieldIds =
|
|
475
|
+
const extraFixedFieldIds = processFixedFields !== null && processFixedFields !== void 0 ? processFixedFields : [];
|
|
461
476
|
if ((0, _lodash.isEmpty)(fieldIds)) {
|
|
462
477
|
fieldIds = sortFields.map(item => item.field);
|
|
463
478
|
if ((0, _lodash.isEmpty)(sort) || (0, _lodash.isEmpty)(asc)) {
|
|
@@ -488,9 +503,9 @@ function LegacyInstanceList(props) {
|
|
|
488
503
|
};
|
|
489
504
|
};
|
|
490
505
|
const getFields = () => {
|
|
491
|
-
var _props$presetConfigs4
|
|
506
|
+
var _props$presetConfigs4;
|
|
492
507
|
let fieldIds = (_props$presetConfigs4 = props.presetConfigs) === null || _props$presetConfigs4 === void 0 ? void 0 : _props$presetConfigs4.fieldIds;
|
|
493
|
-
const extraFixedFieldIds =
|
|
508
|
+
const extraFixedFieldIds = processFixedFields !== null && processFixedFields !== void 0 ? processFixedFields : [];
|
|
494
509
|
if ((0, _lodash.isEmpty)(fieldIds)) {
|
|
495
510
|
fieldIds = jsonLocalStorage.getItem(`${modelData.objectId}-selectAttrIds`);
|
|
496
511
|
}
|
|
@@ -561,7 +576,7 @@ function LegacyInstanceList(props) {
|
|
|
561
576
|
var _modelData$attrList2, _modelData$attrList2$, _modelData$attrList2$2, _props$onSearchExecut;
|
|
562
577
|
const data = {};
|
|
563
578
|
const v3Data = {
|
|
564
|
-
fields:
|
|
579
|
+
fields: processFixedFields ? (0, _lodash.uniq)(["instanceId"].concat(processFixedFields)) : ["instanceId"]
|
|
565
580
|
};
|
|
566
581
|
if (!(0, _lodash.isEmpty)(props.permission)) {
|
|
567
582
|
v3Data.permission = data.permission = props.permission;
|
|
@@ -582,7 +597,7 @@ function LegacyInstanceList(props) {
|
|
|
582
597
|
}];
|
|
583
598
|
}
|
|
584
599
|
if (state.q) {
|
|
585
|
-
query = getQuery(modelData, idObjectMap, state.q, state.fieldIds, props.onlySearchByIp,
|
|
600
|
+
query = getQuery(modelData, idObjectMap, state.q, state.fieldIds, props.onlySearchByIp, processFixedFields);
|
|
586
601
|
}
|
|
587
602
|
if (state.q && props.useInstanceArchiveProvider) {
|
|
588
603
|
archiveData.key_word = state.q;
|
|
@@ -1006,10 +1021,10 @@ function LegacyInstanceList(props) {
|
|
|
1006
1021
|
// 后台返回的默认配置
|
|
1007
1022
|
|
|
1008
1023
|
const defaultFields = (0, _react.useMemo)(() => {
|
|
1009
|
-
var _props$presetConfigs15
|
|
1024
|
+
var _props$presetConfigs15;
|
|
1010
1025
|
let defaultFields;
|
|
1011
1026
|
const fieldIds = (_props$presetConfigs15 = props.presetConfigs) === null || _props$presetConfigs15 === void 0 ? void 0 : _props$presetConfigs15.fieldIds,
|
|
1012
|
-
extraFixedFieldIds =
|
|
1027
|
+
extraFixedFieldIds = processFixedFields !== null && processFixedFields !== void 0 ? processFixedFields : [];
|
|
1013
1028
|
if (!(0, _lodash.isEmpty)(fieldIds)) {
|
|
1014
1029
|
defaultFields = props.presetConfigs.fieldIds;
|
|
1015
1030
|
} else {
|
|
@@ -1029,7 +1044,7 @@ function LegacyInstanceList(props) {
|
|
|
1029
1044
|
defaultFields = (0, _lodash.uniq)([...defaultFields, ...extraFixedFieldIds]);
|
|
1030
1045
|
}
|
|
1031
1046
|
return defaultFields;
|
|
1032
|
-
}, [props.presetConfigs, modelData, state.backendDefaultFields]);
|
|
1047
|
+
}, [props.presetConfigs, modelData, state.backendDefaultFields, processFixedFields]);
|
|
1033
1048
|
|
|
1034
1049
|
// istanbul ignore next
|
|
1035
1050
|
const handleConfirm = async ({
|
|
@@ -1257,6 +1272,13 @@ function LegacyInstanceList(props) {
|
|
|
1257
1272
|
});
|
|
1258
1273
|
}
|
|
1259
1274
|
}, [props.aq, props.aqToShow, props.showFilterInstanceSource]);
|
|
1275
|
+
const fixedFieldIds = (0, _react.useMemo)(() => {
|
|
1276
|
+
if (!props.extraFixedFields || isStringArray(props.extraFixedFields)) {
|
|
1277
|
+
return [];
|
|
1278
|
+
} else {
|
|
1279
|
+
return props.extraFixedFields.filter(v => v.fixed).map(v => v.field);
|
|
1280
|
+
}
|
|
1281
|
+
}, [props.extraFixedFields]);
|
|
1260
1282
|
return /*#__PURE__*/_react.default.createElement(_antd.Spin, {
|
|
1261
1283
|
spinning: state.loading
|
|
1262
1284
|
}, state.inited && !state.failed ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (!props.searchDisabled || !props.advancedSearchDisabled || !props.relatedToMeDisabled || !props.aliveHostsDisabled || !props.moreButtonsDisabled) && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1453,7 +1475,8 @@ function LegacyInstanceList(props) {
|
|
|
1453
1475
|
showCustomizedSerialNumber: props.showCustomizedSerialNumber,
|
|
1454
1476
|
relationLimit: props.relationLimit,
|
|
1455
1477
|
onRelationMoreIconClick: props.onRelationMoreIconClick,
|
|
1456
|
-
configProps: props.tableConfigProps
|
|
1478
|
+
configProps: props.tableConfigProps,
|
|
1479
|
+
fixedFieldIds: fixedFieldIds
|
|
1457
1480
|
})) :
|
|
1458
1481
|
/*#__PURE__*/
|
|
1459
1482
|
// 加个空白的div是为了将loading效果撑起来
|