...
|
...
|
@@ -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>
|
|
|
|
|
|
<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(" ");
|
|
|
$("<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();
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
|