Authored by zhengyouwei

dnspod

... ... @@ -92,11 +92,19 @@ public class HttpUriContants {
public static final String MODULE_DELETE_NAME = "/module/deleteByName";
/**
* nginx
* nginxswitch
*/
public static final String VIEW_NGINX_CONF= "/nginxswitch/viewNginxConf";
public static final String SWITCH_BEFORE= "/nginxswitch/switchbefore";
public static final String SWITCH_NGINX= "/nginxswitch/switchNginxConf";
/**
* dnspod
*/
public static final String VIEW_DNSPOD= "/dnspod/getDnsList";
public static final String DNS_SWITCH_BEFORE= "/dnspod/initSwitch";
public static final String SWITCH_DNS= "/dnspod/doSwitch";
public static final String VALIDE_TOKEN= "/dnspod/validateAPIToken";
}
... ...
package com.ui.model.domain;
import java.util.List;
public class OutRecod {
private String id;
private String desc;
private List<Record> list;
private String status;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public List<Record> getList() {
return list;
}
public void setList(List<Record> list) {
this.list = list;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
... ...
package com.ui.model.domain;
public class Record {
/**
* 记录ID编号
*/
private String id;
/**
* 主机记录
*/
private String name;
/**
* 记录类型
*/
private String type;
/**
* 解析线路
*/
private String line;
/**
* 记录值
*/
private String value;
/**
* 记录状态
*/
private String enabled;
/**
* 记录备注
*/
private String remark;
private String mx;
private String status;
private String monitor_status;
private String updated_on;
private String use_aqb;
private String ttl;
private String weight;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getEnabled() {
return enabled;
}
public void setEnabled(String enabled) {
this.enabled = enabled;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getMx() {
return mx;
}
public void setMx(String mx) {
this.mx = mx;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMonitor_status() {
return monitor_status;
}
public void setMonitor_status(String monitor_status) {
this.monitor_status = monitor_status;
}
public String getUpdated_on() {
return updated_on;
}
public void setUpdated_on(String updated_on) {
this.updated_on = updated_on;
}
public String getUse_aqb() {
return use_aqb;
}
public void setUse_aqb(String use_aqb) {
this.use_aqb = use_aqb;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getTtl() {
return ttl;
}
public void setTtl(String ttl) {
this.ttl = ttl;
}
}
... ...
package com.ui.ctrl;
import com.ui.contants.HttpUriContants;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.domain.OutRecod;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "dnspod")
public class DNSWebCtrl {
private Logger log = LoggerFactory.getLogger(DNSWebCtrl.class);
@Autowired
HttpRestClient httpRestClient;
/**
* 获取域名列表
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping(value = "toDns")
public ModelAndView getLocalRecords() {
ModelAndView mdv = new ModelAndView("switch/dnsSwitch");
BaseResponse<List<OutRecod>> response = httpRestClient.exchangeForget(HttpUriContants.VIEW_DNSPOD, new ParameterizedTypeReference<BaseResponse<List<OutRecod>>>() {
}, null);
mdv.addObject("code",response.getCode());
mdv.addObject("orders", response.getData());
return mdv;
}
/**
* 发送验证码
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping(value = "initSwitch")
@ResponseBody
public BaseResponse switchbefore(String id) {
Map map = new HashMap<>();
map.put("id",id);
return httpRestClient.defaultGet(HttpUriContants.DNS_SWITCH_BEFORE, BaseResponse.class, map);
}
/**
* 切换
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping(value = "doSwitch")
@ResponseBody
public BaseResponse doswitch(String token, String ticket) {
Map map = new HashMap<>();
map.put("token",token);
map.put("ticket",ticket);
return httpRestClient.defaultGet(HttpUriContants.SWITCH_DNS, BaseResponse.class, map);
}
/**
* 获取token
*
* @return 2016年5月18日上午10:22:44
*/
@RequestMapping(value = "validateAPIToken")
@ResponseBody
public BaseResponse getApiToken(String gcode) {
Map map = new HashMap<>();
map.put("gcode",gcode);
return httpRestClient.defaultGet(HttpUriContants.VALIDE_TOKEN, BaseResponse.class, map);
}
}
... ...
... ... @@ -68,9 +68,7 @@ public class NginxSwitchCtrl {
public BaseResponse switchNginxConf(String token, String ticket) {
Map map = new HashMap<>();
map.put("token",token);
map.put("ticket",ticket);
return httpRestClient.exchangeForget(HttpUriContants.SWITCH_NGINX, new ParameterizedTypeReference<BaseResponse<Map<String,List<Map<String, Object>>>>>() {
}, map);
return httpRestClient.defaultGet(HttpUriContants.SWITCH_NGINX, BaseResponse.class, map);
}
}
... ...
if(!("ace" in window)){window.ace={}}ace.config={cookie_expiry:604800,storage_method:2};ace.settings={is:function(b,a){return(ace.data.get("settings",b+"-"+a)==1)},exists:function(b,a){return(ace.data.get("settings",b+"-"+a)!==null)},set:function(b,a){ace.data.set("settings",b+"-"+a,1)},unset:function(b,a){ace.data.set("settings",b+"-"+a,-1)},remove:function(b,a){ace.data.remove("settings",b+"-"+a)},navbar_fixed:function(a){a=a||false;if(!a&&ace.settings.is("sidebar","fixed")){ace.settings.sidebar_fixed(false)}var b=document.getElementById("navbar");if(a){if(!ace.hasClass(b,"navbar-fixed-top")){ace.addClass(b,"navbar-fixed-top")}if(!ace.hasClass(document.body,"navbar-fixed")){ace.addClass(document.body,"navbar-fixed")}ace.settings.set("navbar","fixed")}else{ace.removeClass(b,"navbar-fixed-top");ace.removeClass(document.body,"navbar-fixed");ace.settings.unset("navbar","fixed")}document.getElementById("ace-settings-navbar").checked=a},breadcrumbs_fixed:function(a){a=a||false;if(a&&!ace.settings.is("sidebar","fixed")){ace.settings.sidebar_fixed(true)}var b=document.getElementById("breadcrumbs");if(a){if(!ace.hasClass(b,"breadcrumbs-fixed")){ace.addClass(b,"breadcrumbs-fixed")}if(!ace.hasClass(document.body,"breadcrumbs-fixed")){ace.addClass(document.body,"breadcrumbs-fixed")}ace.settings.set("breadcrumbs","fixed")}else{ace.removeClass(b,"breadcrumbs-fixed");ace.removeClass(document.body,"breadcrumbs-fixed");ace.settings.unset("breadcrumbs","fixed")}document.getElementById("ace-settings-breadcrumbs").checked=a},sidebar_fixed:function(a){a=a||false;if(!a&&ace.settings.is("breadcrumbs","fixed")){ace.settings.breadcrumbs_fixed(false)}if(a&&!ace.settings.is("navbar","fixed")){ace.settings.navbar_fixed(true)}var b=document.getElementById("sidebar");if(a){if(!ace.hasClass(b,"sidebar-fixed")){ace.addClass(b,"sidebar-fixed")}ace.settings.set("sidebar","fixed")}else{ace.removeClass(b,"sidebar-fixed");ace.settings.unset("sidebar","fixed")}document.getElementById("ace-settings-sidebar").checked=a},main_container_fixed:function(a){a=a||false;var c=document.getElementById("main-container");var b=document.getElementById("navbar-container");if(a){if(!ace.hasClass(c,"container")){ace.addClass(c,"container")}if(!ace.hasClass(b,"container")){ace.addClass(b,"container")}ace.settings.set("main-container","fixed")}else{ace.removeClass(c,"container");ace.removeClass(b,"container");ace.settings.unset("main-container","fixed")}document.getElementById("ace-settings-add-container").checked=a;if(navigator.userAgent.match(/webkit/i)){var d=document.getElementById("sidebar");ace.toggleClass(d,"menu-min");setTimeout(function(){ace.toggleClass(d,"menu-min")},0)}},sidebar_collapsed:function(c){c=c||false;var e=document.getElementById("sidebar");var d=document.getElementById("sidebar-collapse").querySelector('[class*="icon-"]');var b=d.getAttribute("data-icon1");var a=d.getAttribute("data-icon2");if(c){ace.addClass(e,"menu-min");ace.removeClass(d,b);ace.addClass(d,a);ace.settings.set("sidebar","collapsed")}else{ace.removeClass(e,"menu-min");ace.removeClass(d,a);ace.addClass(d,b);ace.settings.unset("sidebar","collapsed")}},};ace.settings.check=function(c,e){if(!ace.settings.exists(c,e)){return}var a=ace.settings.is(c,e);var b={"navbar-fixed":"navbar-fixed-top","sidebar-fixed":"sidebar-fixed","breadcrumbs-fixed":"breadcrumbs-fixed","sidebar-collapsed":"menu-min","main-container-fixed":"container"};var d=document.getElementById(c);if(a!=ace.hasClass(d,b[c+"-"+e])){ace.settings[c.replace("-","_")+"_"+e](a)}};ace.data_storage=function(e,c){var b="ace.";var d=null;var a=0;if((e==1||e===c)&&"localStorage" in window&&window.localStorage!==null){d=ace.storage;a=1}else{if(d==null&&(e==2||e===c)&&"cookie" in document&&document.cookie!==null){d=ace.cookie;a=2}}this.set=function(h,g,i,k){if(!d){return}if(i===k){i=g;g=h;if(i==null){d.remove(b+g)}else{if(a==1){d.set(b+g,i)}else{if(a==2){d.set(b+g,i,ace.config.cookie_expiry)}}}}else{if(a==1){if(i==null){d.remove(b+h+"."+g)}else{d.set(b+h+"."+g,i)}}else{if(a==2){var j=d.get(b+h);var f=j?JSON.parse(j):{};if(i==null){delete f[g];if(ace.sizeof(f)==0){d.remove(b+h);return}}else{f[g]=i}d.set(b+h,JSON.stringify(f),ace.config.cookie_expiry)}}}};this.get=function(h,g,j){if(!d){return null}if(g===j){g=h;return d.get(b+g)}else{if(a==1){return d.get(b+h+"."+g)}else{if(a==2){var i=d.get(b+h);var f=i?JSON.parse(i):{};return g in f?f[g]:null}}}};this.remove=function(g,f,h){if(!d){return}if(f===h){f=g;this.set(f,null)}else{this.set(g,f,null)}}};ace.cookie={get:function(c){var d=document.cookie,g,f=c+"=",a;if(!d){return}a=d.indexOf("; "+f);if(a==-1){a=d.indexOf(f);if(a!=0){return null}}else{a+=2}g=d.indexOf(";",a);if(g==-1){g=d.length}return decodeURIComponent(d.substring(a+f.length,g))},set:function(b,e,a,g,c,f){var h=new Date();if(typeof(a)=="object"&&a.toGMTString){a=a.toGMTString()}else{if(parseInt(a,10)){h.setTime(h.getTime()+(parseInt(a,10)*1000));a=h.toGMTString()}else{a=""}}document.cookie=b+"="+encodeURIComponent(e)+((a)?"; expires="+a:"")+((g)?"; path="+g:"")+((c)?"; domain="+c:"")+((f)?"; secure":"")},remove:function(a,b){this.set(a,"",-1000,b)}};ace.storage={get:function(a){return window.localStorage.getItem(a)},set:function(a,b){window.localStorage.setItem(a,b)},remove:function(a){window.localStorage.removeItem(a)}};ace.sizeof=function(c){var b=0;for(var a in c){if(c.hasOwnProperty(a)){b++}}return b};ace.hasClass=function(b,a){return(" "+b.className+" ").indexOf(" "+a+" ")>-1};ace.addClass=function(c,b){if(!ace.hasClass(c,b)){var a=c.className;c.className=a+(a.length?" ":"")+b}};ace.removeClass=function(b,a){ace.replaceClass(b,a)};ace.replaceClass=function(c,b,d){var a=new RegExp(("(^|\\s)"+b+"(\\s|$)"),"i");c.className=c.className.replace(a,function(e,g,f){return d?(g+d+f):" "}).replace(/^\s+|\s+$/g,"")};ace.toggleClass=function(b,a){if(ace.hasClass(b,a)){ace.removeClass(b,a)}else{ace.addClass(b,a)}};ace.data=new ace.data_storage(ace.config.storage_method);
\ No newline at end of file
... ...
<%@page language="java" contentType="text/html;charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
<link rel="stylesheet" href="<%=basePath %>css/jquery-ui.css"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap-responsive.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/uniform.css"/>
<link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
<link rel="stylesheet" href="<%=basePath %>css/font-awesome.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/dnspod_switch.css"/>
<link rel="stylesheet" href="<%=basePath %>css/ace.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/ace-rtl.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/ace-skins.min.css"/>
<script src="<%=basePath %>js/jquery-2.1.4.min.js"></script>
<script src="<%=basePath %>js/bootstrap.min.js"></script>
<script src="<%=basePath %>js/typeahead-bs2.min.js"></script>
<script src="<%=basePath %>js/ace-elements.min.js"></script>
<script src="<%=basePath %>js/ace.min.js"></script>
<script src="<%=basePath %>js/layer/layer.js"></script>
<script src="<%=basePath %>/js/unicorn.js"></script>
<script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/global.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.select.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jquery.toaster.js"></script>
<script src="<%=basePath %>script/dnspod_switch.js"></script>
<script>
var contextPath = '<%=basePath %>';
</script>
<title>YOHO!运维</title>
</head>
<body style="background-color: #444444;font-size: 14px">
<!-- 头部 -->
<div id="head">
</div>
<!-- 右侧具体内容 -->
<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">dns切换</a>
</div>
<c:forEach var="order" items="${orders}" varStatus="index">
<br>
<div class="row" style="height: 46px">
<!-- PAGE CONTENT BEGINS -->
<div class="col-xs-12 col-sm-12 widget-container-span ">
<div class="widget-box">
<%-- <c:choose>
<c:when test="${order.status=='enable'}">class="widget-box"</c:when>
<c:otherwise>class="widget-box collapsed"</c:otherwise>
</c:choose>--%>
<%-->--%>
<div class="widget-header header-color-dark ">
<h3 class="bigger lighter ">${order.desc}</h3>
<div class="widget-toolbar">
<a href="#" data-action="collapse">
<c:choose>
<c:when test="${order.status=='enable'}"> <i
class="1 icon-chevron-up bigger-125"></i></c:when>
<c:when test="${order.status=='disable'}"> <i
class="1 icon-chevron-down bigger-125"></i></c:when>
</c:choose>
</a>
</div>
<div class="widget-toolbar">
<c:if test="${order.status=='enable'}"><span
class="badge badge-success">enabled</span></c:if>
<c:if test="${order.status=='disable'}"><span
class="badge badge-danger">disabled</span></c:if>
</div>
</div>
<div class="widget-body ">
<div class="widget-toolbox">
<div class="btn-toolbar">
<div class="btn-group">
<c:choose>
<c:when test="${order.status=='enable'}">
<button class="btn btn-sm btn-success">
<i class="icon-off bigger-110"></i>
&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</c:when>
<c:when test="${order.status=='disable'}">
<button class="btn btn-sm btn-danger"
onclick="initSwitch(${order.id});">
<i class="icon-cog bigger-110"></i>
&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</c:when>
</c:choose>
</div>
</div>
</div>
<table class="table table-striped table-bordered table-hover">
<thead class="thin-border-bottom">
<tr>
<th>
<i class="icon-user"></i>Name
</th>
<th class="hidden-480">ID</th>
<th class="hidden-480">TTL</th>
<th class="hidden-480">Line</th>
<th class="hidden-480">Use_aqb</th>
<th class="hidden-480">Type</th>
<th>Value</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<c:forEach var="vo" items="${order.list}">
<tr>
<td width="10%"><a href="#">${vo.name}</a></td>
<td width="10%" class="hidden-480">${vo.id}</td>
<td width="10%" class="hidden-480">${vo.ttl}</td>
<td width="10%" class="hidden-480">${vo.line}</td>
<td width="10%" class="hidden-480">${vo.use_aqb}</td>
<td width="10%" class="hidden-480">${vo.type}</td>
<td width="10%">${vo.value}</td>
<td width="10%">
<c:if test="${vo.enabled=='1'}"><span
class="label label-success"> 开启</span></c:if>
<c:if test="${vo.enabled=='0'}"><span
class="label label-danger"> 关闭</span></c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<!-- PAGE CONTENT ENDS -->
</div>
<!-- /.row -->
</c:forEach>
<div class="modal fade" id="validateToken" tabindex="-1" role="dialog" aria-labelledby="validateTokenLabel"
aria-hidden="true" style="padding-top: 10%">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h2 class="modal-title" id="validateTokenLabel">
<span style="font-weight: bold;"> 验证短信</span>
</h2>
</div>
<div class="modal-body">
<form class="bs-example bs-example-form" action="" role="form" id="tokenForm">
<br>
<div class="input-group">
<span class="input-group-addon">SMS</span>
<input type="text" name="ticket" class="form-control">
<input type="hidden" name="token">
</div>
<br>
<div class="alert alert-danger" id="validateTokenRltInfo">
验证失败,请重试;
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="switchNginxConf()">验证</button>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
</div>
</div>
</div>
</div>
</div>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script>
$("#li_switch").addClass("active open");
$("#li_dnsswitch").addClass("active");
</script>
</body>
</html>
... ...
<%@page language="java" contentType="text/html;charset=utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>nginx切换</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="<%=basePath %>css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="<%=basePath %>css/font-awesome.min.css" />
<link rel="stylesheet" href="<%=basePath %>css/dnspod_switch.css" />
<link rel="stylesheet" href="<%=basePath %>css/ace.min.css" />
<link rel="stylesheet" href="<%=basePath %>css/ace-rtl.min.css" />
<link rel="stylesheet" href="<%=basePath %>css/ace-skins.min.css" />
</head>
<body>
<div class="navbar navbar-default" id="navbar">
<script type="text/javascript">
try{ace.settings.check('navbar' , 'fixed')}catch(e){}
</script>
<div class="navbar-container" id="navbar-container">
<div class="navbar-header pull-left">
<a href="<%=basePath %>login.do" class="navbar-brand">
<small>
<i class="icon-leaf"></i>
Yoho Ops
</small>
</a><!-- /.brand -->
</div><!-- /.navbar-header -->
</div><!-- /.container -->
</div>
<div class="main-container" id="main-container">
<script type="text/javascript">
try{ace.settings.check('main-container' , 'fixed')}catch(e){}
</script>
<div class="main-container-inner">
<a class="menu-toggler" id="menu-toggler" href="#">
<span class="menu-text"></span>
</a>
<div class="sidebar" id="sidebar">
<script type="text/javascript">
try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
</script>
<div class="sidebar-shortcuts" id="sidebar-shortcuts">
<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
<button class="btn btn-success">
<i class="icon-signal"></i>
</button>
<button class="btn btn-info">
<i class="icon-pencil"></i>
</button>
<button class="btn btn-warning">
<i class="icon-group"></i>
</button>
<button class="btn btn-danger">
<i class="icon-cogs"></i>
</button>
</div>
<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
<span class="btn btn-success"></span>
<span class="btn btn-info"></span>
<span class="btn btn-warning"></span>
<span class="btn btn-danger"></span>
</div>
</div><!-- #sidebar-shortcuts -->
<ul class="nav nav-list">
<li >
<a href="<%=basePath %>dnspod/getDnsList.do">
<i class="icon-dashboard"></i>
<span class="menu-text"> Dnspod Manage </span>
</a>
</li>
<li class="active">
<a href="<%=basePath %>nginx/viewNginxConf.do">
<i class="icon-desktop"></i>
<span class="menu-text"> Nginx Manage </span>
</a>
</li>
</ul><!-- /.nav-list -->
<div class="sidebar-collapse" id="sidebar-collapse">
<i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
</div>
<script type="text/javascript">
try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
</script>
</div>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<script type="text/javascript">
try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
</script>
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="<%=basePath %>dnspod/getDnsList.do">Home</a>
</li>
<li class="active">Nginx Manage</li>
</ul><!-- .breadcrumb -->
<input type="hidden" id="code" value="${code}">
</div>
<div class="page-content">
<div class="page-header">
<h1>
UI Elements
<small>
<i class="icon-double-angle-right"></i>
Common UI Features &amp; Elements
</small>
</h1>
</div><!-- /.page-header -->
<div class="row">
<div class="col-xs-12">
<!-- 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">
<i class="green icon-cloud bigger-110"></i>
亚马逊
</a>
</li>
<li style="width: 110px">
<a data-toggle="tab" href="#profile">
<i class="green icon-cloud bigger-110"></i>
腾讯云
</a>
</li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane in active">
<c:forEach items="${awsList}" var="map">
<c:if test="${map.name=='apigateway'||map.name=='grayapigateway'}">
<h3 class="header smaller red">${map.name}</h3>
<dl id="dt-list-1" class="dl-horizontal">
<c:forEach items="${map}" var="var">
<c:if test="${var.key!='server' && var.key!='name'}">
<dt>${var.key}</dt>
<dd>${var.value}</dd>
</c:if>
</c:forEach>
<dt>server</dt>
<dd>
<ul>
<c:forEach items="${map.server}" var="server">
<li>${server}</li>
</c:forEach>
</ul>
</dd>
</dl>
</c:if>
</c:forEach>
<h3 class="header smaller red"></h3>
<div class="btn-group">
<button class="btn btn-sm ">
线上切换
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('aws','qcloud')">
<i class="icon-cogs bigger-110"></i>
切向qcloud
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('aws','aws')">
<i class="icon-cogs bigger-110"></i>
切向aws
</button><br><br>
<button class="btn btn-sm ">
灰度切换
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('gray','qcloud')">
<i class="icon-cogs bigger-110"></i>
切向qcloud
</button>
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('gray','aws')">
<i class="icon-cogs bigger-110"></i>
切向aws
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('gray','gray')">
<i class="icon-cogs bigger-110"></i>
切向gray
</button>
</div>
</div>
<div id="profile" class="tab-pane">
<c:forEach items="${qcloudList}" var="map">
<c:if test="${map.name=='apigateway'||map.name=='grayapigateway'}">
<h3 class="header smaller red">${map.name}</h3>
<dl id="dt-list-1" class="dl-horizontal">
<c:forEach items="${map}" var="var">
<c:if test="${var.key!='server' && var.key!='name'}">
<dt>${var.key}</dt>
<dd>${var.value}</dd>
</c:if>
</c:forEach>
<dt>server</dt>
<dd>
<ul>
<c:forEach items="${map.server}" var="server">
<li>${server}</li>
</c:forEach>
</ul>
</dd>
</dl>
</c:if>
</c:forEach>
<h3 class="header smaller red"></h3>
<div class="btn-group">
<button class="btn btn-sm ">
线上切换
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('qcloud','qcloud')">
<i class="icon-cogs bigger-110"></i>
切向qcloud
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('qcloud','aws')">
<i class="icon-cogs bigger-110"></i>
切向aws
</button>
<br/><br/>
<button class="btn btn-sm ">
灰度切换
</button>&nbsp;&nbsp;
<button class="btn btn-sm btn-success" onclick="initSwitch('gray','qcloud')">
<i class="icon-cogs bigger-110"></i>
切向qcloud
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('gray','aws')">
<i class="icon-cogs bigger-110"></i>
切向aws
</button>
<button class="btn btn-sm btn-success" onclick="initSwitch('gray','gray')">
<i class="icon-cogs bigger-110"></i>
切向gray
</button>
</div>
</div>
</div>
</div>
</div><!-- /span -->
<div class="vspace-xs-6"></div>
</div><!-- /row -->
<div class="space"></div>
<script type="text/javascript">
var $path_assets = "assets";//this will be used in gritter alerts containing images
</script>
<!-- PAGE CONTENT ENDS -->
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.page-content -->
</div><!-- /.main-content -->
</div><!-- /.main-container-inner -->
<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
<i class="icon-double-angle-up icon-only bigger-110"></i>
</a>
</div><!-- /.main-container -->
<div class="modal fade" id="validateToken" tabindex="-1" role="dialog" aria-labelledby="validateTokenLabel" aria-hidden="true" style="padding-top: 10%">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h2 class="modal-title" id="validateTokenLabel">
<span style="font-weight: bold;"> 验证短信</span>
</h2>
</div>
<div class="modal-body">
<form class="bs-example bs-example-form" action="" role="form" id="tokenForm">
<br>
<div class="input-group">
<span class="input-group-addon">SMS</span>
<input type="text" name="ticket" class="form-control" >
<input type="hidden" name="token" >
</div>
<br>
<div class="alert alert-danger" id="validateTokenRltInfo">
验证失败,请重试;
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="switchNginxConf()">验证</button>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
</div>
</div>
</div>
</div>
<script src="<%=basePath %>js/jquery-2.1.4.min.js"></script>
<script src="<%=basePath %>js/bootstrap.min.js"></script>
<script src="<%=basePath %>js/typeahead-bs2.min.js"></script>
<script src="<%=basePath %>js/ace-elements.min.js"></script>
<script src="<%=basePath %>js/ace.min.js"></script>
<script src="<%=basePath %>script/nginx_switch.js"></script>
<script src="<%=basePath %>js/layer/layer.js"></script>
</body>
</html>
\ No newline at end of file
... ... @@ -61,6 +61,7 @@ document.getElementById("li_zkMonitor_a").setAttribute("href", path + "/zkTree/t
document.getElementById("li_user_a").setAttribute("href", path + "/manage/toUser");
document.getElementById("li_module_a").setAttribute("href", path + "/manage/toModule");
document.getElementById("li_nginxswitch_a").setAttribute("href", path + "/nginxswitch/toNginxSwitch");
//document.getElementById("li_dnsswitch_a").setAttribute("href", path + "/dnspod/toDns");
function getUrlBasePath() {
var location = ( window.location + '').split('/');
... ...
$(function () {
var code = $("#code").val();
if(code=='203'){
$(".page-content").html("");
$("#validateLoginTokenRltInfo").hide();
$("#validateLoginToken").modal('show');
}
});
function validateLoginToken(){
var loginToken = $("input[name='loginToken']").val();
var param = {
gcode:loginToken
}
$.ajax({
type : 'post',
url : 'validateAPIToken',
data : param,
dataType : 'text',
success : function(resp) {
var data = JSON.parse(resp);
if(data.code=="203"){
$("input[name='loginToken']").val("");
$("#validateLoginTokenRltInfo").show();
}else{
window.location.href=getUrlBasePath() + "/dnspod/getDnsList";
}
},
error : function(data) {
$("input[name='loginToken']").val("");
$("#validateLoginTokenRltInfo").show();
}
});
}
function initSwitch(id){
var param = {
id:id
}
$.ajax({
type : 'post',
url : 'initSwitch.do',
data : param,
dataType : 'text',
success : function(resp) {
var data = JSON.parse(resp);
if(data.code=="203"){
$(".page-content").html("");
$("#validateLoginTokenRltInfo").hide();
$("#validateLoginToken").modal('show');
}else{
$("input[name='token']").val(data.data);
$("#validateToken").modal('show');
$("#validateTokenfail").hide();
}
},
error : function(data) {
$("input[name='loginToken']").val("");
$("#validateLoginTokenRltInfo").show();
$("#validateLoginToken").modal('show');
}
});
}
function doSwitch(){
$.ajax({
type : 'post',
url : 'doSwitch.do',
data : $('#validateTokenForm').serialize(),
dataType : 'text',
success : function(resp) {
var data = JSON.parse(resp);
if(data.code == "203"){
$(".page-content").html("");
$("#validateLoginTokenRltInfo").hide();
$("#validateLoginToken").modal('show');
}else if(data.code == "201"){
$("input[name='loginToken']").val("");
$("#validateToken").modal('show');
$("#validateTokenRltInfo").hide();
$("#validateTokenfail").show();
}else{
window.location.href=getUrlBasePath() + "/dnspod/getDnsList";
}
},
error : function(data) {
$("input[name='loginToken']").val("");
$("#validateLoginTokenRltInfo").show();
$("#validateLoginToken").modal('show');
}
});
}
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@ function initSwitch(cloudName,target){
}
$.ajax({
type : 'post',
url : 'switchbefore.do',
url : 'switchbefore',
data : param,
dataType : 'text',
success : function(resp) {
... ... @@ -32,7 +32,7 @@ function initSwitch(cloudName,target){
function switchNginxConf(){
$.ajax({
type : 'post',
url : 'switchNginxConf.do',
url : 'switchNginxConf',
data : $('#tokenForm').serialize(),
dataType : 'text',
success : function(resp) {
... ...