Authored by qinchao

搜索流量切换

... ... @@ -5,15 +5,13 @@ import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.domain.InternalDomain;
import com.ui.model.domain.InternalDomainHistory;
import com.ui.model.req.ProjectBuildReq;
import com.ui.model.req.TagReq;
import com.ui.model.req.User;
import com.ui.project.ProjectEnvironment;
import com.ui.project.ProjectOnline;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -61,6 +59,37 @@ public class InternalDnsCtrl {
}
}
/**
* 搜索dns配置:
* 即再name前面添加冒号,则不生效
* @param ids
* @param httpSession
* @return
*/
@RequestMapping("/updateNameForSearch")
@ResponseBody
public BaseResponse updateNameForSearch(String ids,HttpSession httpSession){
for(String id:ids.split(",")){
if(StringUtils.isNotBlank(id)){
InternalDomain paramInternalDomain=new InternalDomain();
paramInternalDomain.setId(Integer.parseInt(id));
BaseResponse<InternalDomain> queryResponse = httpRestClient.exchangeForpost(HttpUriContants.INTERNAL_DOMAIN_SELECTBYID ,
new ParameterizedTypeReference<BaseResponse<InternalDomain>>() {}, paramInternalDomain);
InternalDomain updateInternalDomain=queryResponse.getData();
if(updateInternalDomain!=null){
if(updateInternalDomain.getName().startsWith(";")){
updateInternalDomain.setName(updateInternalDomain.getName().substring(1));
}else{
updateInternalDomain.setName(";"+updateInternalDomain.getName());
}
}
addUser(updateInternalDomain,httpSession);
httpRestClient.defaultPost(HttpUriContants.INTERNAL_DOMAIN_UPDATE, updateInternalDomain, BaseResponse.class);
}
}
return new BaseResponse();
}
@RequestMapping("selectAll")
@ResponseBody
public BaseResponse selectAll(InternalDomain internalDomain,HttpSession httpSession){
... ...
... ... @@ -73,91 +73,140 @@
</div>
<div class="container-fluid">
<div class="widget-box">
<div class="panel-body">
<div class="row">
<div class="col-xs-11">
<!-- PAGE CONTENT BEGINS -->
<div class="row">
<div class="col-xs-12 col-sm-12 widget-container-span">
<div class="tabbable">
<ul class="nav nav-tabs" id="myTab">
<li class="active" style="width: 110px">
<a data-toggle="tab" href="#home">
<em class="green icon-cloud bigger-110"></em>
aws
</a>
</li>
<li style="width: 110px">
<a data-toggle="tab" href="#profile">
<em class="green icon-cloud bigger-110"></em>
qq
</a>
</li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane in active">
<button class="btn btn-sm btn-primary"
onclick="reloadTable('aws')">
<em class="icon-cogs bigger-110"></em>
刷新
</button>
<button class="btn btn-sm btn-primary"
onclick="switchSearch('aws')">
<em class="icon-cogs bigger-110"></em>
aws流量切换
</button>
<button class="btn btn-sm btn-danger"
onclick="commit('aws')">
<em class="icon-cogs bigger-110"></em>
提交至域名服务器
</button>
<h3 class="header smaller red"></h3>
<table id="awsDetailTable"></table>
</div>
<div id="profile" class="tab-pane">
<button class="btn btn-sm btn-primary"
onclick="reloadTable('qcloud')">
<em class="icon-cogs bigger-110"></em>
刷新
</button>
<button class="btn btn-sm btn-primary"
onclick="switchSearch('qcloud')">
<em class="icon-cogs bigger-110"></em>
qcloud流量切换
</button>
<button class="btn btn-sm btn-danger"
onclick="commit('qcloud')">
<em class="icon-cogs bigger-110"></em>
提交至域名服务器
</button>
<h3 class="header smaller red"></h3>
<table id="qcloudDetailTable"></table>
</div>
</div>
</div>
</div>
<!-- /span -->
</div>
<!-- /row -->
</div>
</div>
<div class="widget-box">
<div class="widget-title" style="height: 50px;">
<h5 style="display: inline">aws流量切换</h5>
</div>
<div class="panel-body">
<button class="btn btn-sm btn-primary"
onclick="reloadTable('aws')">
<em class="icon-cogs bigger-110"></em>
刷新
</button>
<button class="btn btn-sm btn-primary"
onclick="switchSearch('aws')">
<em class="icon-cogs bigger-110"></em>
aws流量切换
</button>
<button class="btn btn-sm btn-danger"
onclick="commit('aws')">
<em class="icon-cogs bigger-110"></em>
提交至域名服务器
</button>
<h3 class="header smaller"></h3>
<table id="awsDetailTable"></table>
</div>
<h3 class="header smaller"></h3>
<div class="widget-title" style="height: 50px;">
<h5 style="display: inline">qcloud流量切换</h5>
</div>
<div class="panel-body">
<button class="btn btn-sm btn-primary"
onclick="reloadTable('qcloud')">
<em class="icon-cogs bigger-110"></em>
刷新
</button>
<button class="btn btn-sm btn-primary"
onclick="switchSearch('qcloud')">
<em class="icon-cogs bigger-110"></em>
qcloud流量切换
</button>
<button class="btn btn-sm btn-danger"
onclick="commit('qcloud')">
<em class="icon-cogs bigger-110"></em>
提交至域名服务器
</button>
<h3 class="header smaller"></h3>
<table id="qcloudDetailTable"></table>
</div>
</div>
<%--
<div class="panel-body">
<div class="row">
<div class="col-xs-11">
<!-- PAGE CONTENT BEGINS -->
<div class="row">
<div class="col-xs-12 col-sm-12 widget-container-span">
<div class="tabbable">
<ul class="nav nav-tabs" id="myTab">
<li class="active" style="width: 110px">
<a data-toggle="tab" href="#home">
<em class="green icon-cloud bigger-110"></em>
aws
</a>
</li>
<li style="width: 110px">
<a data-toggle="tab" href="#profile">
<em class="green icon-cloud bigger-110"></em>
qq
</a>
</li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane in active">
<button class="btn btn-sm btn-primary"
onclick="reloadTable('aws')">
<em class="icon-cogs bigger-110"></em>
刷新
</button>
<button class="btn btn-sm btn-primary"
onclick="switchSearch('aws')">
<em class="icon-cogs bigger-110"></em>
aws流量切换
</button>
<button class="btn btn-sm btn-danger"
onclick="commit('aws')">
<em class="icon-cogs bigger-110"></em>
提交至域名服务器
</button>
<h3 class="header smaller red"></h3>
<table id="awsDetailTable"></table>
</div>
<div id="profile" class="tab-pane">
<button class="btn btn-sm btn-primary"
onclick="reloadTable('qcloud')">
<em class="icon-cogs bigger-110"></em>
刷新
</button>
<button class="btn btn-sm btn-primary"
onclick="switchSearch('qcloud')">
<em class="icon-cogs bigger-110"></em>
qcloud流量切换
</button>
<button class="btn btn-sm btn-danger"
onclick="commit('qcloud')">
<em class="icon-cogs bigger-110"></em>
提交至域名服务器
</button>
<h3 class="header smaller red"></h3>
<table id="qcloudDetailTable"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>--%>
</div>
</div>
... ... @@ -176,6 +225,8 @@
<script>
var aws_search_record_ids="";
var qcloud_search_record_ids="";
$(function () {
//加载表格
$("#awsDetailTable").table({
... ... @@ -225,6 +276,15 @@
style='danger';
}
return style;
},
onLoadSuccess:function (data) {
aws_search_record_ids="";
for(var i=0;i<data.length;i++){
if(aws_search_record_ids.length>0){
aws_search_record_ids += ",";
}
aws_search_record_ids += data[i].id
}
}
});
... ... @@ -276,6 +336,15 @@
style='danger';
}
return style;
},
onLoadSuccess:function (data) {
qcloud_search_record_ids="";
for(var i=0;i<data.length;i++){
if(qcloud_search_record_ids.length>0){
qcloud_search_record_ids += ",";
}
qcloud_search_record_ids += data[i].id
}
}
});
... ... @@ -288,9 +357,9 @@
};
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "你确定刷新yohoops.org."+cloud+"吗",
title: "你确定刷新吗",
backdrop: "static",
content: "你确定要刷新到服务器吗?",
content: "你确定要刷新到服务器吗?--->yohoops.org."+cloud,
buttons: [{
text: "否",
className: "btn-danger",
... ... @@ -318,12 +387,33 @@
}
//搜索dns配置:即再name前面添加冒号,则不生效
function switchSearch(cloud) {
alert("开发中"+cloud);
var record_ids="";
if("aws"==cloud){
record_ids=aws_search_record_ids;
}else{
record_ids=qcloud_search_record_ids;
}
$.ajax({
url: contextPath + "/internalDns/updateNameForSearch",
type: 'post',
async: false,
dataType: "json",
data: {ids:record_ids},
success: function (data) {
reloadTable(cloud);
}
});
}
//刷新table
function reloadTable(cloud){
$("#awsDetailTable").table("load");
$("#qcloudDetailTable").table("load");
if("aws"==cloud){
$("#awsDetailTable").table("load");
}else{
$("#qcloudDetailTable").table("load");
}
}
</script>
\ No newline at end of file
... ...