324 lines
12 KiB
HTML
324 lines
12 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
<title>#(_res.get("route.config"))</title>
|
|
<meta name="author" content="Matthew Wagerfield" />
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
<style>
|
|
.center{
|
|
text-align:center;
|
|
}
|
|
.remove-dialog{
|
|
width: 300px !important;
|
|
left:60% !important;
|
|
margin-top:15%;
|
|
}
|
|
</style>
|
|
</head>
|
|
#include("/common/header.html")
|
|
<body>
|
|
#if(session.successMessage!=null&&session.successMessage!="")
|
|
<input id="successMessage" value="#(_res.get(session.successMessage))"
|
|
style="display: none"> #else
|
|
<input id="successMessage" value="#(session.successMessage)"
|
|
style="display: none"> #end
|
|
|
|
#if(session.errorMessage!=null&&session.errorMessage!="")
|
|
<input id="errorMessage" value="#(_res.get(session.errorMessage))"
|
|
style="display: none"> #else
|
|
<input id="errorMessage" value="#(session.errorMessage)"
|
|
style="display: none"> #end
|
|
|
|
|
|
<div class="row-fluid" style="margin: 10px 20px; width: 95%">
|
|
<div class="box span12">
|
|
<div class="box-header">
|
|
<span data-toggle='modal' data-target='#routeModal' style="z-index: 999;position: absolute;right: 50px;" onclick="add()"><a href="#"><i class="halflings-icon plus"></i></a></span>
|
|
</div>
|
|
<div class="box-content">
|
|
<ul class="nav tab-menu nav-tabs" id="myTab">
|
|
#for(systemRouteConfig:systemRouteConfigs)
|
|
#if(session.tabTag)
|
|
#if(session.tabTag==systemRouteConfig.key)
|
|
<li class="active" id='#(systemRouteConfig.key)'><a href="#CPUSled#(for.index)">CPU Sled#(for.index)</a></li>
|
|
#else
|
|
<li id="#(systemRouteConfig.key)"><a href="#CPUSled#(for.index)">CPU Sled#(for.index)</a></li>
|
|
#end
|
|
#else
|
|
#if(for.index==0)
|
|
<li class="active" id='#(systemRouteConfig.key)'><a href="#CPUSled#(for.index)">CPU Sled#(for.index)</a></li>
|
|
#else
|
|
<li id="#(systemRouteConfig.key)"><a href="#CPUSled#(for.index)">CPU Sled#(for.index)</a></li>
|
|
#end
|
|
#end
|
|
#end
|
|
</ul>
|
|
|
|
<div id="myTabContent" class="tab-content">
|
|
|
|
#for(systemRouteConfigData:systemRouteConfigs)
|
|
#if(session.tabTag)
|
|
#if(session.tabTag==systemRouteConfigData.key)
|
|
<div class="tab-pane active" id="CPUSled#(for.index)">
|
|
#else
|
|
<div class="tab-pane" id="CPUSled#(for.index)">
|
|
#end
|
|
#else
|
|
#if(for.index==0)
|
|
<div class="tab-pane active" id="CPUSled#(for.index)">
|
|
#else
|
|
<div class="tab-pane" id="CPUSled#(for.index)">
|
|
#end
|
|
#end
|
|
|
|
<table
|
|
class="table table-striped table-bordered bootstrap-datatable datatable dataTable"
|
|
id="DataTables_Table_0"
|
|
aria-describedby="DataTables_Table_0_info">
|
|
<thead>
|
|
<tr role="row">
|
|
<th style='text-align:center;vertical-align: middle;'class="sorting_asc" role="columnheader" tabindex="0"
|
|
aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
|
|
aria-sort="ascending"
|
|
aria-label="Username: activate to sort column descending"
|
|
style="width: 153px;">Ip</th>
|
|
<th style='text-align:center;vertical-align: middle;'class="sorting" role="columnheader" tabindex="0"
|
|
aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
|
|
aria-label="Date registered: activate to sort column ascending"
|
|
style="width: 225px;">Mask</th>
|
|
<th style='text-align:center;vertical-align: middle;'class="sorting" role="columnheader" tabindex="0"
|
|
aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
|
|
aria-label="Role: activate to sort column ascending"
|
|
style="width: 126px;">Gateway</th>
|
|
<th style='text-align:center;vertical-align: middle;'class="sorting" role="columnheader" tabindex="0"
|
|
aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
|
|
aria-label="Role: activate to sort column ascending"
|
|
style="width: 126px;">Interface</th>
|
|
<th style='text-align:center;vertical-align: middle;'class="sorting" role="columnheader" tabindex="0"
|
|
aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
|
|
aria-label="Actions: activate to sort column ascending"
|
|
style="width: 50px;">Handle</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody role="alert" aria-live="polite" aria-relevant="all" id="dataShow">
|
|
#for(systemRouteConfig:systemRouteConfigData.value)
|
|
<tr class="odd">
|
|
<td style='text-align:center;vertical-align: middle;'>#(systemRouteConfig.destination_ip)</td>
|
|
<td style='text-align:center;vertical-align: middle;'>#(systemRouteConfig.ip_mask)</td>
|
|
<td style='text-align:center;vertical-align: middle;'>#(systemRouteConfig.gateway)</td>
|
|
<td style='text-align:center;vertical-align: middle;'>#(systemRouteConfig.r_interface)</td>
|
|
<td style='text-align:center;vertical-align: middle;'>
|
|
<a data-toggle='modal' data-target='#routeModal' class="btn btn-info" href="#" onclick='modify(this)'> <i
|
|
class="halflings-icon white edit"></i>
|
|
</a> <a class="btn btn-danger" href="#" onclick='remove(this)'> <i
|
|
class="halflings-icon white trash"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
#end
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
#end
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="modal fade" id="routeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style='background-color: rgba(51, 51, 51, 1);color:white'>
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
|
|
×
|
|
</button>
|
|
<h4 class="modal-title" id="myModalLabel" style='color:white'>
|
|
<span id="handle"></span>
|
|
</h4>
|
|
</div>
|
|
<div class="modal-body" style='color:black'>
|
|
<form class="form-horizontal" id="routeConfigForm">
|
|
<input type='hidden' value='' id='request_ip' name='ip'>
|
|
<fieldset>
|
|
<div class="control-group">
|
|
<label class="control-label" for="focusedInput" style='color:white'>#(_res.get("destination.ip"))</label>
|
|
<div class="controls">
|
|
<input class="input-xlarge focused" id="ip_address_old" type="hidden" name="destination_ip_old" >
|
|
<input class="input-xlarge focused" id="ip_address" type="text" value="" name="destination_ip" onblur='checkIp(this)'>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="control-group">
|
|
<label class="control-label" for="focusedInput" style='color:white'>#(_res.get("mask"))</label>
|
|
<div class="controls">
|
|
<input class="input-xlarge focused" id="mask_old" type="hidden" value="" name="ip_mask_old">
|
|
<input class="input-xlarge focused" id="mask" type="text" value="" name="ip_mask" onblur='checkMask(this)'>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label" for="focusedInput" style='color:white'>#(_res.get("gateway"))</label>
|
|
<div class="controls">
|
|
<input class="input-xlarge focused" id="gateway_old" type="hidden" value="" name="gateway_old">
|
|
<input class="input-xlarge focused" id="gateway" type="text" value="" name="gateway" onblur='checkGateway(this)'>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label" for="focusedInput" style='color:white'>#(_res.get("interface"))</label>
|
|
<div class="controls" id='updateDiv'>
|
|
<input class="input-xlarge focused" id="interface" type="text" value="" name="r_interface" onblur='checkInterface(this)'>
|
|
</div>
|
|
<div class="control-group" id='addDiv'>
|
|
<div class="controls">
|
|
<select id="selectError3" name="r_interface">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer" style='background-color: rgba(51, 51, 51, 1);'>
|
|
<button type="button" class="btn btn-default" data-dismiss="modal" id="closeDialog">#(_res.get("admin.common.close"))
|
|
</button>
|
|
<button type="button" class="btn btn-primary" id="dialogClick">
|
|
#(_res.get('save.changes'))
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
<script>
|
|
changeFlag=true;
|
|
$(function(){
|
|
//使模态框隐藏
|
|
$("#routeModal").hide();
|
|
})
|
|
|
|
function changeRoute(){
|
|
if(changeFlag){
|
|
console.log('修改操作')
|
|
$('#routeConfigForm').submit();
|
|
}else{
|
|
alert("#(_res.get('error.message'))");
|
|
return;
|
|
}
|
|
}
|
|
|
|
$(function(){
|
|
var successMessage=$("#successMessage").val();
|
|
var errorMessage=$("#errorMessage").val();
|
|
if(successMessage!=null&&successMessage!=''&&successMessage!=undefined){
|
|
xcsoft.success(successMessage,2000);
|
|
#(session.removeAttribute("successMessage"))
|
|
#(session.removeAttribute("tabTag"))
|
|
}else if(errorMessage!=null&&errorMessage!=''&&errorMessage!=undefined){
|
|
xcsoft.error(errorMessage,2000);
|
|
#(session.removeAttribute("errorMessage"))
|
|
}
|
|
})
|
|
|
|
function remove(a,b){
|
|
var dialog=BootstrapDialog.confirm({
|
|
title: 'WARNING',
|
|
message: '<div style="text-align:center;font-size:20px">#(_res.get("remove.message"))</div>',
|
|
cssClass: 'remove-dialog',
|
|
closable: true,
|
|
draggable: true,
|
|
btnCancelLabel: '#(_res.get("cancel"))',
|
|
btnOKLabel: '#(_res.get("remove"))',
|
|
callback: function(result) {
|
|
if(result){
|
|
var routeInfo=$(a).parent().prevAll();
|
|
var ip=$(routeInfo[3]).html();
|
|
var mask=$(routeInfo[2]).html();
|
|
var gateway=$(routeInfo[1]).html();
|
|
var r_interface=$(routeInfo[0]).html();
|
|
var serverIp=$("li.active").attr("id");
|
|
window.location.href='/route/removeRoute?destination_ip='+ip+'&ip_mask='+mask+'&gateway='+gateway+'&r_interface='+r_interface+'&ip='+serverIp;
|
|
}else{
|
|
dialog.close();
|
|
}
|
|
}
|
|
});
|
|
dialog.getModalHeader().hide();
|
|
}
|
|
|
|
function add(){
|
|
var request_ip=$("li.active").attr("id");
|
|
$.ajax({
|
|
type:"post",
|
|
dataType:'json',
|
|
url:"/route/queryNetworkNames?ip="+request_ip,
|
|
async:true,
|
|
success:function (res){
|
|
if(res.error!=''&&res.error!=undefined){
|
|
//
|
|
}else{
|
|
$("#selectError3").empty();
|
|
var networkNames=res.networkNames
|
|
for(var i=0;i<networkNames.length;i++){
|
|
$("#selectError3").append("<option value='"+networkNames[i]+"'>"+networkNames[i]+"</option>")
|
|
}
|
|
}
|
|
}
|
|
})
|
|
$("#updateDiv").hide();
|
|
$('#handle').html('#(_res.get("create"))');
|
|
$('#routeConfigForm').find("input").attr('value','');
|
|
$('#dialogClick').click(function(){
|
|
$('#routeConfigForm').attr('action','/route/newRoute');
|
|
$('#routeConfigForm').submit();
|
|
});
|
|
$("#selectError3").removeAttr("disabled");
|
|
$("#interface").attr("disabled","disabled");
|
|
$("#addDiv").show();
|
|
$('#dialogClick').removeAttr('disabled');
|
|
$("#interfaceErrorMessage").remove();
|
|
$("#interface").removeAttr('readonly')
|
|
$('#handle').html('#(_res.get("create"))');
|
|
$('#routeConfigForm').find("input").attr('value','');
|
|
$("#request_ip").val($("li.active").attr("id"));
|
|
$('#dialogClick').click(function(){
|
|
$('#routeConfigForm').attr('action','/route/newRoute');
|
|
$('#routeConfigForm').submit();
|
|
});
|
|
}
|
|
|
|
function modify(a){
|
|
$("#interface").removeAttr("disabled");
|
|
$("#selectError3").attr("disabled","disabled");
|
|
$("#updateDiv").show();
|
|
$("#addDiv").hide();
|
|
$('#handle').html('#(_res.get("modify"))');
|
|
$("#routeConfigForm input").val();
|
|
var routeInfo=$(a).parent().prevAll();
|
|
$("#ip_address").val($(routeInfo[3]).html());
|
|
$("#ip_address_old").val($(routeInfo[3]).html());
|
|
$("#mask").val($(routeInfo[2]).html());
|
|
$("#mask_old").val($(routeInfo[2]).html());
|
|
$("#gateway").val($(routeInfo[1]).html());
|
|
$("#gateway_old").val($(routeInfo[1]).html());
|
|
$("#interface").val($(routeInfo[0]).html());
|
|
$("#request_ip").val($("li.active").attr("id"));
|
|
$("#interface").attr('readonly','readonly');
|
|
$('#routeConfigForm').attr('action','/route/modifyRoute');
|
|
$('#dialogClick').click(function(){
|
|
changeRoute();
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</html>
|