OpenWrt_Luci_Lua/Mi_Lua/luci/view/web/setting/lamp.htm
2015-05-09 18:48:46 +08:00

157 lines
4.0 KiB
HTML

<%
--[[
Info 路由器重启恢复
]]--
local ver = require("xiaoqiang.XQVersion").webVersion
local request_uri = luci.http.getenv("REQUEST_URI")
%>
<%include('web/inc/head')%>
<title>小米路由器</title>
<link rel="stylesheet" href="<%=resource%>/web/css/page.set.reboot.css?v=<%=ver%>"/>
</head>
<body>
<!-- upgread -->
<div class="mod-setting-panel">
<div class="hd">
<h3>LAMP</h3>
</div>
<div class="bd">
<div class="mod-set-reboot">
<div class="btn-box">
<button class="btn btn-primary" id="btnCreateSandbox">
<span>Create Sandbox</span>
</button>
</div>
<div class="btn-box">
<button class="btn btn-primary" id="btnIsSandboxCreated">
<span>Is Sandbox Created</span>
</button>
</div>
<div class="btn-box">
<button class="btn btn-primary" id="btnMountThings">
<span>Mount Things</span>
</button>
</div>
<div class="btn-box">
<button class="btn btn-primary" id="btnAreThingsMounted">
<span>Are Things Mounted</span>
</button>
</div>
<div class="btn-box">
<button class="btn btn-primary" id="btnStartDropbear">
<span>Start Dropbear</span>
</button>
</div>
<div class="btn-box">
<button class="btn btn-primary" id="btnStopDropbear">
<span>Stop Dropbear</span>
</button>
</div>
<div class="btn-box">
<button class="btn btn-primary" id="btnIsDropbearStarted">
<span>Is Dropbear Started</span>
</button>
</div>
</div>
</div>
</div>
<%include('web/inc/g.js.base')%>
<script>
var modelLamp = (function(){
function createSandbox(){
var callback = function(rsp){}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","create_sandbox")%>', {}, callback);
}
function isSandboxCreated(){
var callback = function(rsp){
var msg = "null";
if (rsp["isSandboxCreated"]) {
msg = "Created."
} else {
msg = "Not yet."
}
window.top.art.dialog({
title: false,
content: msg
});
}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","is_sandbox_created")%>', {}, callback);
}
function mountThings(){
var callback = function(rsp){}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","mount_things")%>', {}, callback);
}
function areThingsMounted(){
var callback = function(rsp){
var msg = "null";
if (rsp["areThingsMounted"]) {
msg = "Mounted."
} else {
msg = "Not yet."
}
window.top.art.dialog({
title: false,
content: msg
});
}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","are_things_mounted")%>', {}, callback);
}
function startDropbear(){
var callback = function(rsp){}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","start_dropbear")%>', {}, callback);
}
function stopDropbear(){
var callback = function(rsp){}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","stop_dropbear")%>', {}, callback);
}
function isDropbearStarted(){
var callback = function(rsp){
var msg = "null";
if (rsp["isDropbearStarted"]) {
msg = "Started."
} else {
msg = "Not yet."
}
window.top.art.dialog({
title: false,
content: msg
});
}
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem","is_dropbear_started")%>', {}, callback);
}
return {
createSandbox : createSandbox,
isSandboxCreated : isSandboxCreated,
mountThings : mountThings,
areThingsMounted : areThingsMounted,
startDropbear : startDropbear,
stopDropbear : stopDropbear,
isDropbearStarted : isDropbearStarted
}
}());
$(function(){
$("#btnCreateSandbox").click(function(){
modelLamp.createSandbox();
});
$("#btnIsSandboxCreated").click(function(){
modelLamp.isSandboxCreated();
});
$("#btnMountThings").click(function(){
modelLamp.mountThings();
});
$("#btnAreThingsMounted").click(function(){
modelLamp.areThingsMounted();
});
$("#btnStartDropbear").click(function(){
modelLamp.startDropbear();
});
$("#btnStopDropbear").click(function(){
modelLamp.stopDropbear();
});
$("#btnIsDropbearStarted").click(function(){
modelLamp.isDropbearStarted();
});
});
</script>