@next-libs/cmdb-instances 7.21.8 → 7.22.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.
Files changed (26) hide show
  1. package/dist/cjs/data-providers/fetchCmdbInstanceDetail.js +15 -4
  2. package/dist/cjs/data-providers/fetchCmdbInstanceDetail.js.map +1 -1
  3. package/dist/cjs/data-providers/fetchCmdbInstanceSearch.js +7 -2
  4. package/dist/cjs/data-providers/fetchCmdbInstanceSearch.js.map +1 -1
  5. package/dist/cjs/data-providers/fetchCmdbObjectRef.js +6 -2
  6. package/dist/cjs/data-providers/fetchCmdbObjectRef.js.map +1 -1
  7. package/dist/cjs/instance-detail/InstanceDetail.js +27 -20
  8. package/dist/cjs/instance-detail/InstanceDetail.js.map +1 -1
  9. package/dist/cjs/instance-detail/components/instance-relation-table-show/instance-relation-table-show.js +7 -4
  10. package/dist/cjs/instance-detail/components/instance-relation-table-show/instance-relation-table-show.js.map +1 -1
  11. package/dist/esm/data-providers/fetchCmdbInstanceDetail.js +15 -4
  12. package/dist/esm/data-providers/fetchCmdbInstanceDetail.js.map +1 -1
  13. package/dist/esm/data-providers/fetchCmdbInstanceSearch.js +7 -2
  14. package/dist/esm/data-providers/fetchCmdbInstanceSearch.js.map +1 -1
  15. package/dist/esm/data-providers/fetchCmdbObjectRef.js +6 -2
  16. package/dist/esm/data-providers/fetchCmdbObjectRef.js.map +1 -1
  17. package/dist/esm/instance-detail/InstanceDetail.js +27 -20
  18. package/dist/esm/instance-detail/InstanceDetail.js.map +1 -1
  19. package/dist/esm/instance-detail/components/instance-relation-table-show/instance-relation-table-show.js +7 -4
  20. package/dist/esm/instance-detail/components/instance-relation-table-show/instance-relation-table-show.js.map +1 -1
  21. package/dist/types/data-providers/fetchCmdbInstanceDetail.d.ts +2 -2
  22. package/dist/types/data-providers/fetchCmdbInstanceSearch.d.ts +1 -1
  23. package/dist/types/data-providers/fetchCmdbObjectRef.d.ts +1 -1
  24. package/dist/types/instance-detail/InstanceDetail.d.ts +4 -2
  25. package/dist/types/instance-detail/components/instance-relation-table-show/instance-relation-table-show.d.ts +1 -0
  26. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"fetchCmdbInstanceSearch.js","names":["InstanceApi_postSearchV3","fetchCmdbInstanceSearch","objectId","params"],"sources":["../../../src/data-providers/fetchCmdbInstanceSearch.ts"],"sourcesContent":["import {\n InstanceApi_PostSearchV3RequestBody,\n InstanceApi_PostSearchV3ResponseBody,\n InstanceApi_postSearchV3,\n} from \"@next-sdk/cmdb-sdk\";\n\nexport function fetchCmdbInstanceSearch(\n objectId: string,\n params: InstanceApi_PostSearchV3RequestBody\n): Promise<Partial<InstanceApi_PostSearchV3ResponseBody>> {\n return InstanceApi_postSearchV3(objectId, params);\n}\n"],"mappings":"AAAA,SAGEA,wBAAwB,QACnB,oBAAoB;AAE3B,OAAO,SAASC,uBAAuBA,CACrCC,QAAgB,EAChBC,MAA2C,EACa;EACxD,OAAOH,wBAAwB,CAACE,QAAQ,EAAEC,MAAM,CAAC;AACnD","ignoreList":[]}
1
+ {"version":3,"file":"fetchCmdbInstanceSearch.js","names":["InstanceApi_postSearchV3","http","fetchCmdbInstanceSearch","objectId","params","sourceId","post","_objectSpread"],"sources":["../../../src/data-providers/fetchCmdbInstanceSearch.ts"],"sourcesContent":["import {\n InstanceApi_PostSearchV3RequestBody,\n InstanceApi_PostSearchV3ResponseBody,\n InstanceApi_postSearchV3,\n} from \"@next-sdk/cmdb-sdk\";\n\nimport { http } from \"@next-core/brick-http\";\n\nexport function fetchCmdbInstanceSearch(\n objectId: string,\n params: InstanceApi_PostSearchV3RequestBody,\n sourceId?: string\n): Promise<Partial<InstanceApi_PostSearchV3ResponseBody>> {\n return sourceId\n ? http.post(\n \"api/gateway/easyops.api.cmdb.topo_center.ProxyPostSearchV3@1.0.1/api/v1/proxy-post-search-v3\",\n {\n ...params,\n objectId,\n sourceId,\n }\n )\n : InstanceApi_postSearchV3(objectId, params);\n}\n"],"mappings":";AAAA,SAGEA,wBAAwB,QACnB,oBAAoB;AAE3B,SAASC,IAAI,QAAQ,uBAAuB;AAE5C,OAAO,SAASC,uBAAuBA,CACrCC,QAAgB,EAChBC,MAA2C,EAC3CC,QAAiB,EACuC;EACxD,OAAOA,QAAQ,GACXJ,IAAI,CAACK,IAAI,CACP,8FAA8F,EAAAC,aAAA,CAAAA,aAAA,KAEzFH,MAAM;IACTD,QAAQ;IACRE;EAAQ,EAEZ,CAAC,GACDL,wBAAwB,CAACG,QAAQ,EAAEC,MAAM,CAAC;AAChD","ignoreList":[]}
@@ -1,6 +1,10 @@
1
1
  import { CmdbObjectApi_getObjectRef } from "@next-sdk/cmdb-sdk";
2
- export function fetchCmdbObjectRef(objectId) {
3
- return CmdbObjectApi_getObjectRef({
2
+ import { http } from "@next-core/brick-http";
3
+ export function fetchCmdbObjectRef(objectId, sourceId) {
4
+ return sourceId ? http.post("api/gateway/easyops.api.cmdb.topo_center.ProxyGetObjectRef@1.0.0/api/v1/proxy-get-object-ref", {
5
+ ref_object: objectId,
6
+ sourceId
7
+ }) : CmdbObjectApi_getObjectRef({
4
8
  ref_object: objectId
5
9
  });
6
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fetchCmdbObjectRef.js","names":["CmdbObjectApi_getObjectRef","fetchCmdbObjectRef","objectId","ref_object"],"sources":["../../../src/data-providers/fetchCmdbObjectRef.ts"],"sourcesContent":["import {\n CmdbObjectApi_GetObjectRefResponseBody,\n CmdbObjectApi_getObjectRef,\n} from \"@next-sdk/cmdb-sdk\";\n\nexport function fetchCmdbObjectRef(\n objectId: string\n): Promise<CmdbObjectApi_GetObjectRefResponseBody> {\n return CmdbObjectApi_getObjectRef({ ref_object: objectId });\n}\n"],"mappings":"AAAA,SAEEA,0BAA0B,QACrB,oBAAoB;AAE3B,OAAO,SAASC,kBAAkBA,CAChCC,QAAgB,EACiC;EACjD,OAAOF,0BAA0B,CAAC;IAAEG,UAAU,EAAED;EAAS,CAAC,CAAC;AAC7D","ignoreList":[]}
1
+ {"version":3,"file":"fetchCmdbObjectRef.js","names":["CmdbObjectApi_getObjectRef","http","fetchCmdbObjectRef","objectId","sourceId","post","ref_object"],"sources":["../../../src/data-providers/fetchCmdbObjectRef.ts"],"sourcesContent":["import {\n CmdbObjectApi_GetObjectRefResponseBody,\n CmdbObjectApi_getObjectRef,\n} from \"@next-sdk/cmdb-sdk\";\nimport { http } from \"@next-core/brick-http\";\n\nexport function fetchCmdbObjectRef(\n objectId: string,\n sourceId?: string\n): Promise<CmdbObjectApi_GetObjectRefResponseBody> {\n return sourceId\n ? http.post(\n \"api/gateway/easyops.api.cmdb.topo_center.ProxyGetObjectRef@1.0.0/api/v1/proxy-get-object-ref\",\n {\n ref_object: objectId,\n sourceId,\n }\n )\n : CmdbObjectApi_getObjectRef({ ref_object: objectId });\n}\n"],"mappings":"AAAA,SAEEA,0BAA0B,QACrB,oBAAoB;AAC3B,SAASC,IAAI,QAAQ,uBAAuB;AAE5C,OAAO,SAASC,kBAAkBA,CAChCC,QAAgB,EAChBC,QAAiB,EACgC;EACjD,OAAOA,QAAQ,GACXH,IAAI,CAACI,IAAI,CACP,8FAA8F,EAC9F;IACEC,UAAU,EAAEH,QAAQ;IACpBC;EACF,CACF,CAAC,GACDJ,0BAA0B,CAAC;IAAEM,UAAU,EAAEH;EAAS,CAAC,CAAC;AAC1D","ignoreList":[]}
@@ -104,7 +104,8 @@ export class LegacyInstanceDetail extends React.Component {
104
104
  },
105
105
  searchValue: "",
106
106
  scrollContainer: null,
107
- httpErrorSting: ""
107
+ httpErrorSting: "",
108
+ externalSourceId: ""
108
109
  };
109
110
  }
110
111
  render() {
@@ -117,7 +118,8 @@ export class LegacyInstanceDetail extends React.Component {
117
118
  } = this.state;
118
119
  var {
119
120
  showCard = true,
120
- useHttpErrorString = false
121
+ useHttpErrorString = false,
122
+ externalSourceId
121
123
  } = this.props;
122
124
  return (
123
125
  /*#__PURE__*/
@@ -168,7 +170,7 @@ export class LegacyInstanceDetail extends React.Component {
168
170
  width: 300
169
171
  },
170
172
  onSearch: value => {
171
- this.searchInstanceRelationData(1, this.state.relationTablePagination.pageSize, this.state.currentAttr, value);
173
+ this.searchInstanceRelationData(1, this.state.relationTablePagination.pageSize, this.state.currentAttr, value, externalSourceId);
172
174
  },
173
175
  enterButton: true
174
176
  }), /*#__PURE__*/React.createElement(InstanceRelationTableShow, {
@@ -181,17 +183,18 @@ export class LegacyInstanceDetail extends React.Component {
181
183
  this.setState({
182
184
  filterObjectId: _object_id
183
185
  }, () => {
184
- this.searchInstanceRelationData(1, this.state.relationTablePagination.pageSize, this.state.currentAttr, undefined);
186
+ this.searchInstanceRelationData(1, this.state.relationTablePagination.pageSize, this.state.currentAttr, undefined, externalSourceId);
185
187
  });
186
188
  }
187
189
  },
188
190
  relationTablePagination: this.state.relationTablePagination,
189
191
  relationFieldUrlTemplate: this.props.relationFieldUrlTemplate,
190
192
  isPagination: true,
193
+ externalSourceId: externalSourceId,
191
194
  total: (instanceRelationModalData === null || instanceRelationModalData === void 0 ? void 0 : instanceRelationModalData.total) || 0,
192
195
  paginationChange: (page, pageSize, relationData) => {
193
196
  if (page !== this.state.relationTablePagination.current || pageSize !== this.state.relationTablePagination.pageSize) {
194
- this.searchInstanceRelationData(page, pageSize, relationData);
197
+ this.searchInstanceRelationData(page, pageSize, relationData, undefined, externalSourceId);
195
198
  }
196
199
  }
197
200
  }))), (_this$props$brickConf = this.props.brickConfigList) === null || _this$props$brickConf === void 0 ? void 0 : _this$props$brickConf.map(config => /*#__PURE__*/React.createElement(Card, {
@@ -435,7 +438,8 @@ export class LegacyInstanceDetail extends React.Component {
435
438
  var {
436
439
  modelDataMap,
437
440
  modelData,
438
- instanceData
441
+ instanceData,
442
+ externalSourceId
439
443
  } = this.state;
440
444
  var config;
441
445
  var isComponentMode = false;
@@ -499,11 +503,12 @@ export class LegacyInstanceDetail extends React.Component {
499
503
  relationData: attr,
500
504
  value: (_instanceData$attr$__ = instanceData[attr.__id]) === null || _instanceData$attr$__ === void 0 ? void 0 : _instanceData$attr$__.slice(0, 10),
501
505
  relationFieldUrlTemplate: this.props.relationFieldUrlTemplate,
502
- filterInstanceSourceDisabled: true
506
+ filterInstanceSourceDisabled: true,
507
+ externalSourceId: externalSourceId
503
508
  }), ((_instanceData$attr$__2 = instanceData[attr.__id]) === null || _instanceData$attr$__2 === void 0 ? void 0 : _instanceData$attr$__2.length) >= 10 && /*#__PURE__*/React.createElement(Button, {
504
509
  "data-testid": "view-more-" + attr.__id,
505
510
  type: "link",
506
- onClick: () => this.handleRelationModal(attr)
511
+ onClick: () => this.handleRelationModal(attr, externalSourceId)
507
512
  }, i18n.t("".concat(NS_LIBS_CMDB_INSTANCES, ":").concat(K.VIEW_MORE)))), !isStructs(attr) && !isStruct(attr) && !isAttachment(attr) && !isRelation(attr) && !isXmlField(attr) && !isPasswordField(attr) && isComponentMode && !isUrl(attr) && !isFloat(attr) && !isJson(attr) && (attrCustomConfig.useBrick ? /*#__PURE__*/React.createElement(BrickAsComponent, {
508
513
  useBrick: attrCustomConfig.useBrick,
509
514
  data: {
@@ -537,15 +542,15 @@ export class LegacyInstanceDetail extends React.Component {
537
542
  })));
538
543
  }
539
544
  // istanbul ignore next
540
- handleRelationModal(attr) {
545
+ handleRelationModal(attr, externalSourceId) {
541
546
  var _this = this;
542
547
  return _asyncToGenerator(function* () {
543
- yield _this.searchInstanceRelationData(1, 10, attr);
548
+ yield _this.searchInstanceRelationData(1, 10, attr, undefined, externalSourceId);
544
549
  })();
545
550
  }
546
551
 
547
552
  // istanbul ignore next
548
- searchInstanceRelationData(page, pageSize, attr, value) {
553
+ searchInstanceRelationData(page, pageSize, attr, value, externalSourceId) {
549
554
  var _this2 = this;
550
555
  return _asyncToGenerator(function* () {
551
556
  var _modelData$view, _modelDataMap$objectI;
@@ -587,7 +592,7 @@ export class LegacyInstanceDetail extends React.Component {
587
592
  if (value !== undefined ? value : _this2.state.searchValue) {
588
593
  var oppositeModelDataMap = _this2.state.oppositeModelDataMap;
589
594
  if (_this2.state.oppositeObjectId !== objectId) {
590
- var oppositeModelList = yield fetchCmdbObjectRef(objectId);
595
+ var oppositeModelList = yield fetchCmdbObjectRef(objectId, externalSourceId);
591
596
  oppositeModelDataMap = keyBy(oppositeModelList.data, "objectId");
592
597
  _this2.setState({
593
598
  oppositeObjectId: objectId,
@@ -616,7 +621,7 @@ export class LegacyInstanceDetail extends React.Component {
616
621
  if (_this2.props.ignorePermission) {
617
622
  instanceRelationModalData = (yield http.post("api/gateway/easyops.api.cmdb.instance.PostSearchV3WithAdmin/v3/object/".concat(objectId, "/instance/_search"), _objectSpread({}, params))).data;
618
623
  } else {
619
- instanceRelationModalData = yield fetchCmdbInstanceSearch(objectId, params);
624
+ instanceRelationModalData = yield fetchCmdbInstanceSearch(objectId, params, externalSourceId);
620
625
  }
621
626
  _this2.setState({
622
627
  instanceRelationModalData,
@@ -813,6 +818,7 @@ export class LegacyInstanceDetail extends React.Component {
813
818
  return _asyncToGenerator(function* () {
814
819
  var modelListData, modelDataMap, instanceData;
815
820
  var relationLimit = 10;
821
+ var externalSourceId = props.externalSourceId;
816
822
  try {
817
823
  if (props.modelDataList) {
818
824
  modelDataMap = keyBy(props.modelDataList, "objectId");
@@ -820,25 +826,25 @@ export class LegacyInstanceDetail extends React.Component {
820
826
  var {
821
827
  fields
822
828
  } = _this5.getInstanceDetailData(props, modelDataMap);
823
- instanceData = yield fetchCmdbInstanceDetailByFields(props.objectId, props.instanceId, fields, relationLimit);
829
+ instanceData = yield fetchCmdbInstanceDetailByFields(props.objectId, props.instanceId, fields, relationLimit, externalSourceId);
824
830
  } else {
825
- instanceData = yield fetchCmdbInstanceDetail(props.objectId, props.instanceId);
831
+ instanceData = yield fetchCmdbInstanceDetail(props.objectId, props.instanceId, externalSourceId);
826
832
  }
827
833
  } else {
828
834
  if (props.showFields) {
829
- modelListData = yield fetchCmdbObjectRef(props.objectId);
835
+ modelListData = yield fetchCmdbObjectRef(props.objectId, externalSourceId);
830
836
  modelDataMap = keyBy(modelListData.data, "objectId");
831
837
  var {
832
838
  fields: _fields
833
839
  } = _this5.getInstanceDetailData(props, modelDataMap);
834
- instanceData = yield fetchCmdbInstanceDetailByFields(props.objectId, props.instanceId, _fields, relationLimit);
840
+ instanceData = yield fetchCmdbInstanceDetailByFields(props.objectId, props.instanceId, _fields, relationLimit, externalSourceId);
835
841
  } else {
836
842
  if (props.ignorePermission) {
837
843
  [modelListData, {
838
844
  data: instanceData
839
- }] = yield Promise.all([fetchCmdbObjectRef(props.objectId), http.get("api/gateway/easyops.api.cmdb.instance.GetDetailWithAdmin/object/".concat(props.objectId, "/instance/").concat(props.instanceId), {})]);
845
+ }] = yield Promise.all([fetchCmdbObjectRef(props.objectId, externalSourceId), http.get("api/gateway/easyops.api.cmdb.instance.GetDetailWithAdmin/object/".concat(props.objectId, "/instance/").concat(props.instanceId), {})]);
840
846
  } else {
841
- [modelListData, instanceData] = yield Promise.all([fetchCmdbObjectRef(props.objectId), fetchCmdbInstanceDetail(props.objectId, props.instanceId)]);
847
+ [modelListData, instanceData] = yield Promise.all([fetchCmdbObjectRef(props.objectId, externalSourceId), fetchCmdbInstanceDetail(props.objectId, props.instanceId, externalSourceId)]);
842
848
  }
843
849
  modelDataMap = keyBy(modelListData.data, "objectId");
844
850
  }
@@ -858,7 +864,8 @@ export class LegacyInstanceDetail extends React.Component {
858
864
  instanceData,
859
865
  loaded: true,
860
866
  basicInfoGroupListShow: [],
861
- basicInfoGroupList: []
867
+ basicInfoGroupList: [],
868
+ externalSourceId
862
869
  });
863
870
  _this5.setBasicInfoGroupList(_this5.state);
864
871
  // this.setFormattedInstanceData(this.state);