Authored by zhengyouwei

delete all nginx modify

... ... @@ -205,10 +205,14 @@ public class HttpUriContants {
public static final String JAVA_ERROR_INFO_GET = "/newJavaApiInfo/queryErrorInfoListByApiName";
//ABtest
public static final String ABTEST_GET = "/abtest/get";
public static final String ABTEST_INSERT = "/abtest/insert";
public static final String ABTEST_UPDATE = "/abtest/update";
public static final String ABTEST_DELETE = "/abtest/delete";
public static final String ABTEST_CONFIG_GET = "/abtestConfig/get";
public static final String ABTEST_CONFIG_INSERT = "/abtestConfig/insert";
public static final String ABTEST_CONFIG_UPDATE = "/abtestConfig/update";
public static final String ABTEST_CONFIG_DELETE = "/abtestConfig/delete";
public static final String ABTEST_TOTAL_GETALL = "/abtestTotal/getAll";
public static final String ABTEST_TOTAL_INSERT = "/abtestTotal/insert";
public static final String ABTEST_TOTAL_UPDATE = "/abtestTotal/update";
public static final String ABTEST_TOTAL_DELETE = "/abtestTotal/delete";
}
... ...
... ... @@ -7,7 +7,7 @@ import lombok.Data;
*/
@Data
public class ABTest {
public class ABTestConfig {
private int id;
... ...
package com.ui.model.req;
import lombok.Data;
/**
* Created by zhengyouwei on 2016/12/16.
*/
@Data
public class ABTestTotal {
private int id;
private String type;
private String startTime;
private String endTime;
private int inUse;
private String appType;
private String appVersion;
}
... ...
... ... @@ -12,5 +12,6 @@ public class AbTestReq extends PageRequest{
private String abType;
private String name;
}
... ...
... ... @@ -3,77 +3,85 @@ package com.ui.ctrl;
import com.ui.contants.HttpUriContants;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.req.ABTest;
import com.ui.model.req.ABTestConfig;
import com.ui.model.req.AbTestReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by zhengyouwei on 2016/12/16.
*/
@Controller
@RequestMapping("/abtest")
public class ABTestCtrl {
@RequestMapping("/abtestConfig")
public class ABTestConfigCtrl {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private HttpRestClient httpRestClient;
@RequestMapping("/toABTets")
@RequestMapping("/toABTestConfig")
@ResponseBody
public ModelAndView toABTets() {
return new ModelAndView("abtest/abtest");
}
public ModelAndView toABTets(Model model) {
/**
* 新增
* @return
*/
@RequestMapping("/insert")
@ResponseBody
public BaseResponse insert(ABTest abTest) {
BaseResponse response=httpRestClient.defaultPost(HttpUriContants.ABTEST_INSERT, abTest, BaseResponse.class);
return response;
List<String> configTypes = new ArrayList<>();
configTypes.add("RESOURCE");
configTypes.add("UI");
model.addAttribute("configTypes",configTypes );
return new ModelAndView("abtest/abtestConfig");
}
/**
* 更新
* 保存
*
* @return
*/
@RequestMapping("/update")
@RequestMapping("/save")
@ResponseBody
public BaseResponse update( ABTest abTest) {
BaseResponse response=httpRestClient.defaultPost(HttpUriContants.ABTEST_UPDATE, abTest, BaseResponse.class);
return response;
public BaseResponse insert(ABTestConfig abTest) {
if (abTest.getId() == 0) {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_CONFIG_INSERT, abTest, BaseResponse.class);
return response;
} else {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_CONFIG_UPDATE, abTest, BaseResponse.class);
return response;
}
}
/**
* 删除
*
* @return
*/
@RequestMapping("/delete")
@ResponseBody
public BaseResponse<Integer> delete(int id) {
BaseResponse response=httpRestClient.defaultPost(HttpUriContants.ABTEST_DELETE+"?id="+id, null, BaseResponse.class);
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_CONFIG_DELETE + "?id=" + id, null, BaseResponse.class);
return response;
}
/**
* 获取
*
* @return
*/
@RequestMapping("/get")
@ResponseBody
public BaseResponse get(AbTestReq abTestReq) {
BaseResponse response=httpRestClient.defaultPost(HttpUriContants.ABTEST_GET, abTestReq, BaseResponse.class);
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_CONFIG_GET, abTestReq, BaseResponse.class);
return response;
}
... ...
package com.ui.ctrl.app;
import com.ui.contants.HttpUriContants;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.req.ABTestConfig;
import com.ui.model.req.ABTestTotal;
import com.ui.model.req.AbTestReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by zhengyouwei on 2016/12/16.
*/
@Controller
@RequestMapping("/abtestTotal")
public class ABTestTotalCtrl {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private HttpRestClient httpRestClient;
@RequestMapping("/toABTestTotal")
@ResponseBody
public ModelAndView toABTets(Model model) {
return new ModelAndView("abtest/abtestTotal");
}
/**
* 保存
*
* @return
*/
@RequestMapping("/save")
@ResponseBody
public BaseResponse insert(ABTestTotal abTest) {
if (abTest.getId() == 0) {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_TOTAL_INSERT, abTest, BaseResponse.class);
return response;
} else {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_TOTAL_UPDATE, abTest, BaseResponse.class);
return response;
}
}
/**
* 删除
*
* @return
*/
@RequestMapping("/delete")
@ResponseBody
public BaseResponse<Integer> delete(int id) {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_TOTAL_DELETE + "?id=" + id, null, BaseResponse.class);
return response;
}
/**
* 获取
*
* @return
*/
@RequestMapping("/getall")
@ResponseBody
public BaseResponse getall() {
BaseResponse response = httpRestClient.defaultPost(HttpUriContants.ABTEST_TOTAL_GETALL,null, BaseResponse.class);
return response;
}
}
... ...
... ... @@ -52,7 +52,9 @@
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.select.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jstree/jstree.min.js"></script>
<script src="<%=basePath %>js/jquery.toaster.js"></script>
<script>
var contextPath = '<%=basePath %>';
</script>
<title>YOHO!运维</title>
</head>
<body>
... ... @@ -64,7 +66,7 @@
<div id="content">
<div id="breadcrumb">
<a href="#" title="Go to Home" class="tip-bottom"><i
class="icon-home"></i> Home</a> <a href="#" class="current">标签</a>
class="icon-home"></i> Home</a> <a href="#" class="current">ABTEST配置</a>
</div>
<div class="container-fluid">
... ... @@ -79,43 +81,43 @@
style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left;">
<span class="input-group-addon">ABType:</span>
<select id="environment" name="environment" class="form-control">
<span class="input-group-addon">类型:</span>
<select id="ABType" name="ABType" class="form-control">
<option value="all" selected="selected"></option>
<c:forEach items="${environments }" var="envi">
<option value="${envi }">${envi }</option>
<c:forEach items="${ABTypes }" var="ABType">
<option value="${ABType }">${ABType }</option>
</c:forEach>
</select>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">项目:</span>
<select id="currentProject" name="currentProject" class="form-control">
<option value="all"></option>
<c:forEach items="${projects }" var="project">
<option value="${project.name }">${project.name }</option>
<span class="input-group-addon">配置:</span>
<select id="configType" name="configType" class="form-control">
<option value="all" selected="selected"></option>
<c:forEach items="${configTypes }" var="configType">
<option value="${configType }">${configType }</option>
</c:forEach>
</select>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">状态:</span>
<select id="currentStatus" name="currentStatus" class="form-control">
<option value="0"></option>
<option value="1">正在进行</option>
<option value="2">成功</option>
<option value="3">强制退出</option>
<option value="4">出错退出</option>
<span class="input-group-addon">名称:</span>
<select id="name" name="name" class="form-control">
<c:forEach items="${names }" var="name">
<option value="${name }">${name }</option>
</c:forEach>
</select>
</div>
<button id="searchBtn" class="btn btn-primary" style="margin-left: 18px;">搜索</button>
<button id="searchBtn" class="btn btn-primary" style="margin-left: 18px;"
onclick="search()">搜索
</button>
</div>
<a href="#" id="addHostGroup" class="btn btn-success" style="margin-top: 12px;margin-left: 0px;"
onclick="editHostGroup(0,0)">新增标签</a></div>
&nbsp;&nbsp;
<a href="#" id="addABConfig" class="btn btn-success" style="margin-top: 12px;margin-left: 0px;"
onclick="editConfig(0,0,0,0,0,0)">新增配置</a></div>
</div>
</div>
<div id="hostGroupTable">
<div id="abtestTable">
</div>
</div>
... ... @@ -132,26 +134,70 @@
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body">
<form id="hostGroupForm" class="form-horizontal">
<form id="configForm" class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label"> <span style="color:red">*</span>AB类型:</label>
<div class="col-sm-8">
<select id="ABType-add" name="ABType-add" class="form-control" style="width: 300px">
<c:forEach items="${ABTypes }" var="ABType">
<option value="${ABType }">${ABType }</option>
</c:forEach>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"> <span style="color:red">*</span>配置类型:</label>
<div class="col-sm-8">
<select id="configType-add" name="configType-add" class="form-control" style="width: 300px">
<c:forEach items="${configTypes }" var="configType">
<option value="${configType }">${configType }</option>
</c:forEach>
</select>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"> <span style="color:red">*</span>名称:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="name-add" name="name-add"
placeholder="name" maxlength="30" size="40"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"> <span style="color:red">*</span>值:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="value-add" name="value-add"
placeholder="值" maxlength="30" size="40"/>
</div>
</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">
<input type="text" class="form-control" id="editGroupName" name="editGroupName"
placeholder="输入标签名称" maxlength="30" size="40"/>
<input type="text" class="form-control" id="comment-add" name="comment-add"
placeholder="说明" maxlength="30" size="40"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"> </label>
<div class="col-sm-8" id="messageAlert"></div>
</div>
<input type="hidden" name="editGroupId"/>
<input type="hidden" name="editId"/>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-success" value="Validate" onclick="saveHostGroup()">提交</button>
<button type="button" class="btn btn-success" value="Validate" onclick="saveConfig()">提交</button>
</div>
</div>
<!-- /.modal-content -->
... ... @@ -160,24 +206,8 @@
</div>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script type="text/javascript">
$("#li_host").addClass("active open");
$("#li_hostGroupList").addClass("active");
function localAlert(title, message) {
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: title,
backdrop: "static",
content: message,
buttons: [{
text: "确定",
className: "btn-danger",
onclick: function () {
$(dialog).dialog("hide");
}
}]
});
}
$("#li_abtest").addClass("active open");
$("#li_ABTestConfig").addClass("active");
</script>
</body>
... ... @@ -186,74 +216,157 @@
<script>
$(function () {
//加载表格
$("#hostGroupTable").table({
$("#abtestTable").table({
columnAutoWidth: false,
url: "getHostGroups",
url: contextPath + "/abtest/get",
striped: true,
title: "标签信息列表",
title: "配置表",
pagination: true,
pageSize: 10,
loadFilter: function (data) {
return defaultLoadFilter(data);
},
columns: [{
title: "标签名",
field: "groupName",
width: "30%"
title: "id",
field: "id",
width: "10%"
}, {
title: "名称",
field: "name",
width: "10%"
}, {
title: "AB类型",
field: "abType",
width: "15%"
}, {
title: "配置类型",
field: "configType",
width: "15%"
}, {
title: "值",
field: "value",
width: "15%"
}, {
title: "说明",
field: "comment",
width: "20%"
}, {
title: "更新时间",
field: "updateTime",
width: "10%"
}, {
title: "操作",
formatter: function (value, rowData, rowIndex) {
var div = $("<div>");
$("<button onclick=\"editHostGroup(\'" + rowData.id + "\',\'" + rowData.groupName + "\')\">").addClass("btn btn-xs btn-success").html("修改").appendTo(div);
$("<button onclick=\"editConfig(\'" + rowData.id + "\',\'" + rowData.name + "\',\'" + rowData.value + "\')\">").addClass("btn btn-xs btn-success").html("修改").appendTo(div);
div.append("&nbsp;");
$("<button onclick=\"deleteHostGroup(\'" + rowData.id + "\')\">").addClass("btn btn-xs btn-danger").html("删除").appendTo(div);
$("<button onclick=\"deleteConfig(\'" + rowData.id + "\')\">").addClass("btn btn-xs btn-danger").html("删除").appendTo(div);
return div;
}
}]
});
});
//点击查询按钮
function search() {
var ABType = $("#ABType").val();
var configType = $("#configType").val();
var name = $("#name").val();
$("#abtestTable").table("load", {
'abType': ABType,
'configType': configType,
'name': name
});
}
;
//打开新增或修改页面
function editHostGroup(id, groupName) {
$("#hostGroupForm #messageAlert").hide();
function editConfig(id, name, abType, configType, value, comment) {
$("#configForm #messageAlert").hide();
if (id == 0) {//新增页面
$("input[name='editGroupId']").val(0);
$("input[name='editGroupName']").val("");
$("#myModalLabel").text("新增标签信息");
$("input[name='editId']").val(0);
$("input[name='name-add']").val("");
$("input[name='value-add']").val("");
$("input[name='comment-add']").val("");
$("#myModalLabel").text("新增");
} else {
$("#myModalLabel").text("修改标签信息");
$("input[name='editGroupId']").val(id);
$("input[name='editGroupName']").val(groupName);
$("#myModalLabel").text("修改");
$("input[name='editId']").val(id);
$("input[name='name-add']").val(name);
$("input[name='value-add']").val(value);
$("input[name='comment-add']").val(comment);
$("#ABType-add option[value='"+abType+"']").attr("selected","selected");
$("#configType-add option[value='"+configType+"']").attr("selected","selected");
}
$("#myModal").modal('show');
}
//打开新增或修改页面
function saveHostGroup() {
var id = $("input[name='editGroupId']").val();
var groupName = $("input[name='editGroupName']").val();
if (groupName == null || groupName == "") {
$("#hostGroupForm #messageAlert").alerts({
content: "请输入标签名称!",
function saveConfig() {
var id = $("input[name='editId']").val();
var abType = $("#ABType-add").val();
var configType = $("#configType-add").val();
var name = $("#name-add").val();
var value = $("#value-add").val();
var comment = $("#comment-add").val();
if (abType == null || abType == "") {
$("#configForm #messageAlert").alerts({
content: "请选择AB类型!",
type: "danger"
});
return;
}
if (configType == null || configType == "") {
$("#configForm #messageAlert").alerts({
content: "请选择配置类型!",
type: "danger"
});
return;
}
if (name == null || name == "") {
$("#configForm #messageAlert").alerts({
content: "请输入名称!",
type: "danger"
});
return;
}
if (value == null || value == "") {
$("#configForm #messageAlert").alerts({
content: "请输入值!",
type: "danger"
});
return;
}
if (comment == null || comment == "") {
$("#configForm #messageAlert").alerts({
content: "请选择说明!",
type: "danger"
});
return;
}
var param = {
id: id,
groupName: groupName
name: name,
abType: abType,
configType: configType,
value: value,
comment: comment
}
$.ajax({
type: 'post',
url: "saveHostGroup.do",
url: contextPath + "/abtest/save",
data: param,
dataType: 'json',
success: function (data) {
if (!data || data.code != 200) {
localAlert('删除失败', data.message);
localAlert('新增失败', data.message);
} else {
$("#myModal").modal('hide');
$("#hostGroupTable").table("load");
search();
}
},
error: function (data) {
... ... @@ -262,13 +375,13 @@
});
}
//打开新增或修改页面
function deleteHostGroup(id) {
//删除
function deleteConfig(id) {
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "你确定删除吗",
backdrop: "static",
content: "你确定要删除该标签信息吗?",
content: "你确定要删除该配置吗?",
buttons: [{
text: "否",
className: "btn-danger",
... ... @@ -281,18 +394,15 @@
onclick: function () {
$(dialog).dialog("hide");
$.ajax({
url: "deleteHostGroup",
url: contextPath + "/abtest/delete?id=" + id,
type: 'post',
async: false,
data: {
id: id
},
dataType: "json",
success: function (data) {
if (!data || data.code != 200) {
localAlert('删除失败', data.message);
}
$("#hostGroupTable").table("load");
search();
}
});
}
... ...
... ... @@ -131,11 +131,15 @@
<div class="form-group">
<label class="col-sm-1 control-label">范围选择</label>
<div class="col-sm-8">
<div class="rdio rdio-default">
<input type="radio" name="operate-1" id="all" value="all_val" checked="checked"
onclick="operSelect(1)"/>
<label for="all">All</label>
</div>
<%--<div class="rdio rdio-default">--%>
<%--<input type="radio" name="operate-1" id="all" value="all_val" checked="checked"--%>
<%--onclick="operSelect(1)"/>--%>
<%--<label for="all">All</label>--%>
<%--</div>--%>
<div>
<strong><font color="red">先同步AWS,一小时后再同步QQ</font></strong>
</div>
<div class="rdio rdio-default">
<input type="radio" name="operate-1" value="qcloud_val" id="qcloud"
... ...
... ... @@ -47,6 +47,12 @@ innerHTML += "<li id='li_handledWork'><a id='li_handledWork_a' href=''><i class=
innerHTML += "<li id='li_works'><a id='li_works_a' href=''><i class='icon icon-th'></i> <span>工单列表</span></a></li>";
innerHTML += "</ul></li>";
/*ABtest*/
innerHTML += "<li class='submenu' id='li_abtest'><a id='li_abtest_a' href='#'><i class='icon icon-th-list'></i> <span>ABTest</span><span class='label'>2</span></a><ul>";
innerHTML += "<li id='li_ABTestTotal'><a id='li_ABTestTotal_a' href=''><i class='icon icon-th'></i> <span>总体配置</span></a></li>";
innerHTML += "<li id='li_ABTestConfig'><a id='li_ABTestConfig_a' href=''><i class='icon icon-th'></i> <span>基础配置</span></a></li>";
innerHTML += "</ul></li>";
/*配置管理*/
innerHTML += "<li class='submenu' id='li_config'><a id='li_config_a' href='#'><i class='icon icon-th-list'></i> <span>配置管理</span><span class='label'>7</span></a><ul>";
innerHTML += "<li id='li_zkMonitor'><a id='li_zkMonitor_a' href=''><i class='icon icon-th'></i> <span>ZK配置管理</span></a></li>";
... ... @@ -138,6 +144,9 @@ document.getElementById("li_ips_compare_a").setAttribute("href", path + "/compar
//document.getElementById("li_limitswitch_a").setAttribute("href", path + "/limitSwitch/toLimitSwitch");
document.getElementById("li_lbswitch_a").setAttribute("href", path + "/lbSwitch/toLbSwitch");
document.getElementById("li_monit_a").setAttribute("href",path+"/monit/toMonit");
document.getElementById("li_ABTestConfig_a").setAttribute("href",path+"/abtestConfig/toABTestConfig");
document.getElementById("li_ABTestTotal_a").setAttribute("href",path+"/abtestTotal/toABTestTotal");
function getUrlBasePath() {
var location = ( window.location + '').split('/');
... ...