@next-libs/cmdb-instances 7.9.0 → 7.9.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.
@@ -127,7 +127,7 @@ function updateSortFields(oldFields, sortInfo, sortType) {
127
127
  asc,
128
128
  sort
129
129
  } = sortInfo;
130
- const order = ["series-number", "auto-increment-id"].includes(sortType) ? asc ? 2 : -2 : asc ? 1 : -1;
130
+ const order = (0, _lodash.isNil)(asc) ? 0 : ["series-number", "auto-increment-id"].includes(sortType) ? asc ? 2 : -2 : asc ? 1 : -1;
131
131
  return oldFields.map(item => {
132
132
  if (item.field === sort) {
133
133
  item.order = order;
@@ -416,23 +416,16 @@ function LegacyInstanceList(props) {
416
416
  } else {
417
417
  asc = ["series-number", "auto-increment-id"].includes(sortType) ? -2 : -1;
418
418
  }
419
- let sortFields;
420
- if (props.saveFieldsBackend) {
421
- sortFields = (await fieldsProvider.query([props.objectId])).sortFields;
422
- }
419
+ const sortFields = (await fieldsProvider.query([props.objectId])).sortFields;
423
420
  const extraFixedFieldIds = (_props$extraFixedFiel = props.extraFixedFields) !== null && _props$extraFixedFiel !== void 0 ? _props$extraFixedFiel : [];
424
421
  if ((0, _lodash.isEmpty)(fieldIds)) {
425
- if (props.saveFieldsBackend) {
426
- fieldIds = sortFields.map(item => item.field);
427
- if ((0, _lodash.isEmpty)(sort) || (0, _lodash.isEmpty)(asc)) {
428
- const orderField = sortFields.find(item => item.order !== 0);
429
- if (orderField) {
430
- sort = orderField.field;
431
- asc = orderField.order;
432
- }
422
+ fieldIds = sortFields.map(item => item.field);
423
+ if ((0, _lodash.isEmpty)(sort) || (0, _lodash.isEmpty)(asc)) {
424
+ const orderField = sortFields.find(item => item.order !== 0);
425
+ if (orderField) {
426
+ sort = orderField.field;
427
+ asc = orderField.order;
433
428
  }
434
- } else {
435
- fieldIds = jsonLocalStorage.getItem(`${modelData.objectId}-selectAttrIds`);
436
429
  }
437
430
  }
438
431
  if ((0, _lodash.isEmpty)(fieldIds)) {
@@ -822,7 +815,7 @@ function LegacyInstanceList(props) {
822
815
  sort = info.sort;
823
816
  }
824
817
  // istanbul ignore next
825
- if (props.saveFieldsBackend) {
818
+ if (props.saveFieldsBackend && sortFields.find(item => item.field === info.sort)) {
826
819
  try {
827
820
  var _modelData$attrList3, _modelData$attrList3$, _modelData$attrList3$2;
828
821
  const oldsortFields = sortFields;