V1.2
1、新增服务器资源添加 (新增数据表pp_task_server) 2、新增远程服务器任务执行 3、删除邮件通知功能(pp_task删除两个有关字段)
This commit is contained in:
149
views/server/add.html
Normal file
149
views/server/add.html
Normal file
@@ -0,0 +1,149 @@
|
||||
<!-- 新增服务器 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "ServerController.Add"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="server_name">服务器名</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="server_name" value="" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="server_ip">服务器IP</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="server_ip" value="" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="port">服务器ssh端口</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="port" value="" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="type">验证类型</label>
|
||||
<div class="col-sm-6" >
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="type" value="0" > 密码
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="type" value="1" checked > 密钥
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-3" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group hide" style="margin-top: 15px" id="password">
|
||||
<label class="col-sm-3 control-label" for="password">服务器密码</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="password" value="" readonly />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group " style="margin-top: 15px" id="private_key_src">
|
||||
<label class="col-sm-3 control-label" for="private_key_src">私钥地址</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="private_key_src" value="/Users/haodaquan/.ssh/pp_rsa" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group " style="margin-top: 15px" id="public_key_src">
|
||||
<label class="col-sm-3 control-label" for="public_key_src">公钥地址</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="public_key_src" value="/Users/haodaquan/.ssh/pp_rsa.pub" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
<i style="font-size: 12px">公钥和私钥地址请在本地服务器生成,命令:ssh-keygen -t rsa -f pp_rsa</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="detail">说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="detail" class="form-control" id="detail" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
// $(".alert").hide();
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "ServerController.Add"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "ServerController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
|
||||
$("input[name='type']").click(function () {
|
||||
if ($(this).val() > 0) {
|
||||
$("#password").addClass('hide');
|
||||
$("#public_key_src").removeClass('hide');
|
||||
$("#private_key_src").removeClass('hide');
|
||||
} else {
|
||||
$("#password").removeClass('hide');
|
||||
$("#public_key_src").addClass('hide');
|
||||
$("#private_key_src").addClass('hide');
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
150
views/server/edit.html
Normal file
150
views/server/edit.html
Normal file
@@ -0,0 +1,150 @@
|
||||
<!-- 新增服务器 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "ServerController.Edit"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="server_name">服务器名</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="server_name" value="{{.server.ServerName}}" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="server_ip">服务器IP</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="server_ip" value="{{.server.ServerIp}}" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="port">服务器ssh端口</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="port" value="{{.server.Port}}" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="type">验证类型</label>
|
||||
<div class="col-sm-6" >
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="type" value="0" {{if eq .server.Type 0}}checked{{end}}> 密码
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="type" value="1" {{if eq .server.Type 1}}checked{{end}}> 密钥
|
||||
</label>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-3" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group {{if eq .server.Type 1}}hide{{end}}" style="margin-top: 15px" id="password">
|
||||
<label class="col-sm-3 control-label" for="password">服务器密码</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="password" value="{{.server.Password}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group {{if eq .server.Type 0}}hide{{end}}" style="margin-top: 15px" id="private_key_src">
|
||||
<label class="col-sm-3 control-label" for="private_key_src">私钥地址</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="private_key_src" value="{{.server.PrivateKeySrc}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group {{if eq .server.Type 0}}hide{{end}}" style="margin-top: 15px" id="public_key_src">
|
||||
<label class="col-sm-3 control-label" for="public_key_src">公钥地址</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="public_key_src" value="{{.server.PublicKeySrc}}" />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="detail">说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="detail" class="form-control" id="detail" rows="3">{{.server.Detail}}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<input type="hidden" name="id" value="{{.server.Id}}" />
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
// $(".alert").hide();
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "ServerController.Edit"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "ServerController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
|
||||
$("input[name='type']").click(function () {
|
||||
if ($(this).val() > 0) {
|
||||
$("#password").addClass('hide');
|
||||
$("#public_key_src").removeClass('hide');
|
||||
$("#private_key_src").removeClass('hide');
|
||||
} else {
|
||||
$("#password").removeClass('hide');
|
||||
$("#public_key_src").addClass('hide');
|
||||
$("#private_key_src").addClass('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
121
views/server/list.html
Normal file
121
views/server/list.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<!-- 分组列表 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="search-box row">
|
||||
<div class="col-md-4">
|
||||
<div class="btn-group pull-left" role="group" aria-label="...">
|
||||
<a href='{{urlfor "ServerController.Add"}}' class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> 新增服务器</a>
|
||||
<div class="btn-group" role="server">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="glyphicon glyphicon-edit"></span> 批量操作
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" onclick="javascript:batch('delete');"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> 删除</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class=" btn-large pull-right" >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="table-margin">
|
||||
<form id="form-list" method="post" action="">
|
||||
<table class="table table-bordered table-header">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="all_check" /></td>
|
||||
<td>ID</td>
|
||||
<td width="20%">服务器名称</td>
|
||||
<td width="">IP地址</td>
|
||||
<td width="">端口号</td>
|
||||
<td width="">验证类型</td>
|
||||
<td width="20%">备注</td>
|
||||
<td width="">创建时间</td>
|
||||
<td width="10%">操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $k,$v := .list}}
|
||||
<tr>
|
||||
<td class="chk"><input type="checkbox" name="ids" value="{{$v.id}}" /></td>
|
||||
<td class="center">{{$v.id}}</td>
|
||||
<td>{{$v.server_name}}</td>
|
||||
<td>{{$v.server_ip}}</td>
|
||||
<td>{{$v.port}}</td>
|
||||
<td>{{$v.type}}</td>
|
||||
<td>{{$v.detail}}</td>
|
||||
<td>{{$v.create_time}}</td>
|
||||
|
||||
<td>
|
||||
|
||||
<a class="btn btn-info btn-xs" href="{{urlfor "ServerController.Edit"}}?id={{$v.id}}">
|
||||
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> 编辑
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<div class="pull-right">
|
||||
{{str2html .pageBar}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function batch(action) {
|
||||
if ($("input[name='ids']:checked").size() < 1) {
|
||||
alert_message("请选择要操作的任务","alert-danger","alert-success");
|
||||
} else {
|
||||
if(action=='delete'){
|
||||
if(!confirm("确定要删除所选吗?")) return;
|
||||
}
|
||||
var url = "{{urlfor "ServerController.Batch"}}";
|
||||
$.post(url + "?action=" + action, $("#form-list").serialize(), function(out) {
|
||||
if (out.status != 0) {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//点击行换色
|
||||
$('tbody tr').click(function(){
|
||||
$(this).addClass("warning").siblings().removeClass("warning");
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user