Authored by qinchao

可用区hostinfo

... ... @@ -18,6 +18,9 @@ public class HostInfo implements Serializable {
private int cloudType;
//云可用区类型,aws还是aws,而腾讯云分为腾讯云 和 腾讯云az2
private int cloudDetailType;
private String tags;
private String createTime;
... ...
... ... @@ -28,7 +28,6 @@ import java.util.Map;
@Controller
@RequestMapping("javaApi")
public class JavaAPICtrl {
Logger log = LoggerFactory.getLogger(JavaAPICtrl.class);
@Autowired
private HttpRestClient httpClient;
... ... @@ -51,13 +50,7 @@ public class JavaAPICtrl {
@ResponseBody
public String getJavaApiInfo() {
String strType = "";
log.debug("get all type");
strType = httpClient.defaultGet(HttpUriContants.JAVA_API_GET, String.class);
log.info("all type: {}", strType);
return strType;
}
... ... @@ -73,7 +66,6 @@ public class JavaAPICtrl {
@RequestMapping("/save")
@ResponseBody
public BaseResponse saveApiInfo(JavaApiInfoReq req) {
log.info("java api save req : {}", req);
BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_SAVE, req, BaseResponse.class);
return rep;
}
... ... @@ -82,7 +74,6 @@ public class JavaAPICtrl {
@RequestMapping("/del")
@ResponseBody
public BaseResponse delApiInfo(@RequestParam int id) {
log.info("java api del id : {}", id);
BaseResponse rep = httpClient.defaultGet(HttpUriContants.JAVA_API_DEL + "?id=" + id, BaseResponse.class);
return rep;
}
... ... @@ -91,7 +82,6 @@ public class JavaAPICtrl {
@RequestMapping("/status")
@ResponseBody
public BaseResponse status(@RequestParam("list") String strList) {
log.info("status req : {}", strList);
BaseResponse rep;
try {
List<JavaApiStatusReq> req = JSON.parseArray(strList, JavaApiStatusReq.class);
... ... @@ -147,7 +137,7 @@ public class JavaAPICtrl {
@RequestMapping("/allStatus")
@ResponseBody
public BaseResponse allStatus() {
log.info("get allStatus");
//log.info("get allStatus");
BaseResponse rep;
try {
rep = httpClient.defaultGet(HttpUriContants.JAVA_API_STATUS_ALL, BaseResponse.class);
... ...
... ... @@ -9,12 +9,12 @@
</div>
<div class="form-group" >
<label class="col-sm-2 control-label"> <span style="color:red">*</span>云类型:</label>
<label class="col-sm-2 control-label"> <span style="color:red">*</span>云可用区:</label>
<div class="col-sm-8">
<select id="cloudType" name="cloudType" class="form-control" onchange="autoHostName();">
<select id="cloudDetailType" name="cloudDetailType" class="form-control" onchange="autoHostName();">
<option value="1">AWS</option>
<option value="2">腾讯云</option>
<option value="3">腾讯云az2</option>
<option value="21">腾讯云</option>
<option value="22">腾讯云az2</option>
</select>
</div>
</div>
... ... @@ -44,14 +44,14 @@
function autoHostName(){
var hostIp=$("#hostInfoForm #hostIp").val();
var cloudType=$('#hostInfoForm #cloudType option:selected').text();
var cloudDetailType=$('#hostInfoForm #cloudDetailType option:selected').text();
var tags="";
$("input[name='appName']:checked").each(function(){
if(tags.indexOf($(this).attr('value')+'-')<0){
tags += $(this).attr('value')+'-';
}
});
$("#hostInfoForm #alias").val(cloudType+"-"+tags+hostIp);
$("#hostInfoForm #alias").val(cloudDetailType+"-"+tags+hostIp);
}
function endWithChars(str,endStr){
... ...
... ... @@ -97,12 +97,12 @@
<input type="text" id="hostIp" name="hostIp" class="form-control" placeholder="" style="width: 230px"/>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">云类型:</span>
<select id="cloudType" name="cloudType" class="form-control">
<option value="0">全部</option>
<span class="input-group-addon">云可用区:</span>
<select id="cloudDetailType" name="cloudDetailType" class="form-control">
<option value="">全部</option>
<option value="1">AWS</option>
<option value="2">腾讯云</option>
<option value="3">腾讯云az2</option>
<option value="21">腾讯云</option>
<option value="22">腾讯云az2</option>
<%--<option value="3">其他</option>--%>
</select>
</div>
... ... @@ -214,15 +214,17 @@
field : "hostIp",
width : "10%"
}, {
title : "云类型",
field : "cloudType",
title : "云可用区",
field : "cloudDetailType",
formatter : function(value, rowData, rowIndex) {
if(value == 1){
return 'AWS';
} else if(value == 2){
} else if(value == 21){
return '腾讯云';
}else if(value == 22){
return '腾讯云az2';
}else{
return '其他';
return value;
}
},
width : "5%"
... ... @@ -301,13 +303,13 @@
$("#searchHostInfoBtn").click(function () {
var alias = $("#alias").val();
var hostIp = $("#hostIp").val();
var cloudType = $("#cloudType").val();
var cloudDetailType = $("#cloudDetailType").val();
var tags=$("#tags").val();
var onlyShowTagsIsNull=$("#tagsIsNull").val();
$("#hostInfoTable").table("load", {
'alias': alias,
'hostIp': $.trim(hostIp),
'cloudType': cloudType,
'cloudDetailType': cloudDetailType,
'tags': JSON.stringify(tags),
'onlyShowTagsIsNull':onlyShowTagsIsNull
});
... ... @@ -351,7 +353,21 @@
tags += $(this).attr('value')+',';
}
});
var cloudType = $("#hostInfoForm #cloudType").val();
var cloudDetailType = $("#hostInfoForm #cloudDetailType").val();
var cloudType=0;
if(cloudDetailType==1){
cloudType=1;
}else if(cloudDetailType==21||cloudDetailType==22){
cloudType= cloudDetailType - 20 ;
}
if(cloudType<=0){
$("#hostInfoForm #messageAlert").alerts({
content : "请选择正确的云可用区类型!",
type : "danger"
});
}
var alias = $("#hostInfoForm #alias").val();
... ... @@ -366,6 +382,7 @@
tags:tags,
hostIp:hostIp,
cloudType:cloudType,
cloudDetailType:cloudDetailType,
alias:alias
};
... ...