Skip to content

Commit

Permalink
add some check and remove todo
Browse files Browse the repository at this point in the history
  • Loading branch information
blackstar-baba committed Sep 1, 2020
1 parent 9b2db11 commit 46b3b43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.blackstar.softwarelab.common.BaseController;
import com.blackstar.softwarelab.entity.Instance;
import com.blackstar.softwarelab.bean.SecurityUser;
import com.blackstar.softwarelab.service.IAppVersionService;
import com.blackstar.softwarelab.service.IInstanceService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -33,6 +34,9 @@ public class InstanceController extends BaseController {
@Autowired
private IInstanceService instanceService;

@Autowired
private IAppVersionService appVersionService;

private ObjectMapper objectMapper = new ObjectMapper();


Expand Down Expand Up @@ -62,6 +66,9 @@ private void check(Instance instance) {
if (ports == null) {
throw new RuntimeException("container info mush have ports");
}
if(appVersionService.getVersionByNameAndVersion(instance.getAppName(),instance.getAppVersion()) == null) {
throw new RuntimeException("can't find "+ instance.getAppName()+":"+instance.getAppVersion());
}
} catch (IOException e) {
throw new RuntimeException("check container info error:", e);
}
Expand All @@ -82,7 +89,7 @@ public boolean delete(@PathVariable String id) {
@RequestMapping(method = RequestMethod.GET)
public IPage<Instance> list(@RequestParam int pageNum, @RequestParam int pageSize, String image, String name, String sort) {
//add sort;
// todo change image to app
// todo change property name image to app
Page<Instance> instancePage = new Page<>(pageNum, pageSize);

QueryWrapper<Instance> appQueryWrapper = new QueryWrapper<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface AppVersionMapper extends BaseMapper<AppVersion> {

@Select({"<script>",
"select version,download_status downloadStatus from app_version",
" where app_name = #{name}",
" where app_name = #{appName}",
"</script>"})
List<AppVersion> getSimpleByAppName(String appName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ private void processImageDownload(WebSocketSession session, String content) {
AppVersion appVersion = AppVersion.builder().appName(split[0]).version(split[1]).build();

WebSocketResponseMessage responseMessage = null;
//todo get image from additional info
App app = appService.getByName(appVersion.getAppName());
String imageName = null;
try {
Expand Down

0 comments on commit 46b3b43

Please sign in to comment.