@next-libs/cmdb-instances 7.2.4 → 7.2.5
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.
|
@@ -404,50 +404,8 @@ export function LegacyInstanceList(props) {
|
|
|
404
404
|
var [selectedRowKeys, setSelectedRowKeys] = useState((_props$selectedRowKey = props.selectedRowKeys) !== null && _props$selectedRowKey !== void 0 ? _props$selectedRowKey : []);
|
|
405
405
|
var cache = useRef(new Map());
|
|
406
406
|
var isFirstRunRef = useRef(true);
|
|
407
|
-
|
|
408
|
-
// istanbul ignore next
|
|
409
|
-
var onSelectionChange = useCallback( /*#__PURE__*/function () {
|
|
410
|
-
var _ref5 = _asyncToGenerator(function* (selected) {
|
|
411
|
-
var _props$onSelectionCha;
|
|
412
|
-
var {
|
|
413
|
-
selectedItems,
|
|
414
|
-
selectedKeys
|
|
415
|
-
} = selected;
|
|
416
|
-
setSelectedRowKeys(selectedKeys);
|
|
417
|
-
if (selectedKeys.length > compact(selectedItems).length) {
|
|
418
|
-
var ids = selectedKeys.filter(id => !cache.current.has(id));
|
|
419
|
-
if (ids.length) {
|
|
420
|
-
var resp;
|
|
421
|
-
var params = {
|
|
422
|
-
fields: ["instanceId"],
|
|
423
|
-
query: {
|
|
424
|
-
instanceId: {
|
|
425
|
-
$in: ids
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
page_size: ids.length
|
|
429
|
-
};
|
|
430
|
-
// useAutoDiscoveryProvider=true, 使用useProvider的接口,虽然这里列表用不到选择功能,但还是加上保持统一
|
|
431
|
-
if (props.useAutoDiscoveryProvider) {
|
|
432
|
-
resp = yield listProvider.query([props.objectId, Object.assign(params, props.extraParams)]);
|
|
433
|
-
} else {
|
|
434
|
-
resp = yield InstanceApi_postSearchV3(props.objectId, params);
|
|
435
|
-
}
|
|
436
|
-
resp.list.forEach(i => cache.current.set(i.instanceId, i));
|
|
437
|
-
}
|
|
438
|
-
selectedItems = selectedKeys.map(id => cache.current.get(id));
|
|
439
|
-
}
|
|
440
|
-
(_props$onSelectionCha = props.onSelectionChange) === null || _props$onSelectionCha === void 0 ? void 0 : _props$onSelectionCha.call(props, {
|
|
441
|
-
selectedItems,
|
|
442
|
-
selectedKeys
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
return function (_x2) {
|
|
446
|
-
return _ref5.apply(this, arguments);
|
|
447
|
-
};
|
|
448
|
-
}(), []);
|
|
449
407
|
var getInstanceListData = /*#__PURE__*/function () {
|
|
450
|
-
var
|
|
408
|
+
var _ref5 = _asyncToGenerator(function* (sort, asc, page) {
|
|
451
409
|
var _modelData$attrList, _modelData$attrList$f2, _modelData$attrList$f3, _props$onSearchExecut;
|
|
452
410
|
var data = {};
|
|
453
411
|
var v3Data = {
|
|
@@ -548,12 +506,12 @@ export function LegacyInstanceList(props) {
|
|
|
548
506
|
// useAutoDiscoveryProvider=true, 使用useProvider的接口
|
|
549
507
|
return promise ? promise : props.useAutoDiscoveryProvider ? listProvider.query([props.objectId, v3Data]) : InstanceApi_postSearchV3(props.objectId, v3Data);
|
|
550
508
|
});
|
|
551
|
-
return function getInstanceListData(_x3, _x4
|
|
552
|
-
return
|
|
509
|
+
return function getInstanceListData(_x2, _x3, _x4) {
|
|
510
|
+
return _ref5.apply(this, arguments);
|
|
553
511
|
};
|
|
554
512
|
}();
|
|
555
513
|
var refreshInstanceList = /*#__PURE__*/function () {
|
|
556
|
-
var
|
|
514
|
+
var _ref6 = _asyncToGenerator(function* (sort, asc, page) {
|
|
557
515
|
setState({
|
|
558
516
|
loading: true
|
|
559
517
|
});
|
|
@@ -590,8 +548,8 @@ export function LegacyInstanceList(props) {
|
|
|
590
548
|
});
|
|
591
549
|
}
|
|
592
550
|
});
|
|
593
|
-
return function refreshInstanceList(_x6, _x7
|
|
594
|
-
return
|
|
551
|
+
return function refreshInstanceList(_x5, _x6, _x7) {
|
|
552
|
+
return _ref6.apply(this, arguments);
|
|
595
553
|
};
|
|
596
554
|
}();
|
|
597
555
|
useEffect(() => {
|
|
@@ -612,14 +570,6 @@ export function LegacyInstanceList(props) {
|
|
|
612
570
|
setSelectedRowKeys((_props$selectedRowKey2 = props.selectedRowKeys) !== null && _props$selectedRowKey2 !== void 0 ? _props$selectedRowKey2 : []);
|
|
613
571
|
}, [props.objectId, props.selectedRowKeys]);
|
|
614
572
|
|
|
615
|
-
// istanbul ignore next
|
|
616
|
-
useEffect(() => {
|
|
617
|
-
onSelectionChange({
|
|
618
|
-
selectedKeys: [],
|
|
619
|
-
selectedItems: []
|
|
620
|
-
});
|
|
621
|
-
}, [state.sort, state.asc, state.fieldIds, state.appSearchInstanceId, state.currentChangeSelect, state.searchByApp, props.dataSource, state.presetConfigsQuery, state.q, state.aq, state.instanceSourceQuery, state.aliveHosts, state.relatedToMe, props.objectId, props.permission, props.defaultQuery]);
|
|
622
|
-
|
|
623
573
|
// on filter condition change
|
|
624
574
|
useEffect(() => {
|
|
625
575
|
if (isFirstRunRef.current) {
|
|
@@ -660,6 +610,48 @@ export function LegacyInstanceList(props) {
|
|
|
660
610
|
var onChange = e => {
|
|
661
611
|
setQ(e.target.value);
|
|
662
612
|
};
|
|
613
|
+
|
|
614
|
+
// istanbul ignore next
|
|
615
|
+
var onSelectionChange = useCallback( /*#__PURE__*/function () {
|
|
616
|
+
var _ref7 = _asyncToGenerator(function* (selected) {
|
|
617
|
+
var _props$onSelectionCha;
|
|
618
|
+
var {
|
|
619
|
+
selectedItems,
|
|
620
|
+
selectedKeys
|
|
621
|
+
} = selected;
|
|
622
|
+
setSelectedRowKeys(selectedKeys);
|
|
623
|
+
if (selectedKeys.length > compact(selectedItems).length) {
|
|
624
|
+
var ids = selectedKeys.filter(id => !cache.current.has(id));
|
|
625
|
+
if (ids.length) {
|
|
626
|
+
var resp;
|
|
627
|
+
var params = {
|
|
628
|
+
fields: ["instanceId"],
|
|
629
|
+
query: {
|
|
630
|
+
instanceId: {
|
|
631
|
+
$in: ids
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
page_size: ids.length
|
|
635
|
+
};
|
|
636
|
+
// useAutoDiscoveryProvider=true, 使用useProvider的接口,虽然这里列表用不到选择功能,但还是加上保持统一
|
|
637
|
+
if (props.useAutoDiscoveryProvider) {
|
|
638
|
+
resp = yield listProvider.query([props.objectId, Object.assign(params, props.extraParams)]);
|
|
639
|
+
} else {
|
|
640
|
+
resp = yield InstanceApi_postSearchV3(props.objectId, params);
|
|
641
|
+
}
|
|
642
|
+
resp.list.forEach(i => cache.current.set(i.instanceId, i));
|
|
643
|
+
}
|
|
644
|
+
selectedItems = selectedKeys.map(id => cache.current.get(id));
|
|
645
|
+
}
|
|
646
|
+
(_props$onSelectionCha = props.onSelectionChange) === null || _props$onSelectionCha === void 0 ? void 0 : _props$onSelectionCha.call(props, {
|
|
647
|
+
selectedItems,
|
|
648
|
+
selectedKeys
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
return function (_x8) {
|
|
652
|
+
return _ref7.apply(this, arguments);
|
|
653
|
+
};
|
|
654
|
+
}(), []);
|
|
663
655
|
var onSearch = value => {
|
|
664
656
|
var _props$onSearch;
|
|
665
657
|
var q = value.trim();
|
|
@@ -667,10 +659,6 @@ export function LegacyInstanceList(props) {
|
|
|
667
659
|
q
|
|
668
660
|
});
|
|
669
661
|
(_props$onSearch = props.onSearch) === null || _props$onSearch === void 0 ? void 0 : _props$onSearch.call(props, q);
|
|
670
|
-
onSelectionChange({
|
|
671
|
-
selectedKeys: [],
|
|
672
|
-
selectedItems: []
|
|
673
|
-
});
|
|
674
662
|
};
|
|
675
663
|
var onAdvancedSearch = (queries, queriesToShow, fieldToShow) => {
|
|
676
664
|
var _props$onAdvancedSear;
|
|
@@ -680,10 +668,6 @@ export function LegacyInstanceList(props) {
|
|
|
680
668
|
aqToShow: queriesToShow
|
|
681
669
|
});
|
|
682
670
|
(_props$onAdvancedSear = props.onAdvancedSearch) === null || _props$onAdvancedSear === void 0 ? void 0 : _props$onAdvancedSear.call(props, queries);
|
|
683
|
-
onSelectionChange({
|
|
684
|
-
selectedKeys: [],
|
|
685
|
-
selectedItems: []
|
|
686
|
-
});
|
|
687
671
|
};
|
|
688
672
|
var onSortingChange = useCallback(info => {
|
|
689
673
|
var _props$onSortingChang;
|