Skip to content

Commit

Permalink
Dev 1.10.0 bug fix (#693)
Browse files Browse the repository at this point in the history
* Code Optimization

* Code Optimization

* Code Optimization

* Code Optimization

* fix miss code

* New interface: Retrieve data source list based on type name

---------

Co-authored-by: “v_kkhuang” <“420895376@qq.com”>
  • Loading branch information
v-kkhuang and “v_kkhuang” authored Dec 26, 2024
1 parent 24af105 commit 80c881d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public AMNode fillMetricsToNode(AMNode amNode, NodeMetrics metrics) {
amNode.setNodeHealthyInfo(parseHealthyInfo(metrics));
amNode.setNodeOverLoadInfo(parseOverLoadInfo(metrics));
amNode.setUpdateTime(metrics.getUpdateTime());
amNode.setNodeDescription(metrics.getDescription());
return amNode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,44 @@ public Message encryptDatasourcePassword(
"Fail to aes of data source[加密数据源密码失败]");
}

@ApiOperation(
value = "getDataSourceByTypeName",
notes = "get data source by datasource type name",
response = Message.class)
@RequestMapping(value = "/info-by-type", method = RequestMethod.GET)
public Message getDataSourceListByTypes(
HttpServletRequest request,
@RequestParam(value = "typeName", required = false) String typeName,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
return RestfulApiHelper.doAndResponse(
() -> {
String userName = ModuleUserUtils.getOperationUser(request, "getDataSourceByTypeName");
if (AuthContext.isAdministrator(userName)) {
userName = null;
}
List<DataSource> queryList = new ArrayList<>();
Message message = Message.ok();
List<DataSourceType> dataSourceTypes =
dataSourceRelateService.getAllDataSourceTypes(request.getHeader("Content-Language"));
// 从dataSourceTypes过滤出typeName为typeName的数据源类型
for (DataSourceType dataSourceType : dataSourceTypes) {
if (dataSourceType.getName().equals(typeName)) {
DataSourceVo dataSourceVo =
new DataSourceVo(null, Long.valueOf(dataSourceType.getId()), null, null);
dataSourceVo.setCurrentPage(null != currentPage ? currentPage : 1);
dataSourceVo.setPageSize(null != pageSize ? pageSize : 10);
dataSourceVo.setPermissionUser(userName);
PageInfo<DataSource> pageInfo =
dataSourceInfoService.queryDataSourceInfoPage(dataSourceVo);
queryList = pageInfo.getList();
message.data("totalPage", pageInfo.getTotal());
}
}
return message.data("queryList", queryList);
},
"Fail to get all types of data source[获取数据源列表失败]");
}
/**
* Inner method to insert data source
*
Expand Down

0 comments on commit 80c881d

Please sign in to comment.