add old lci module
This commit is contained in:
1 parent
38a6e815f0
commit
8499631091
171 files changed
+25562
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
</head>
|
||||
<body>
|
||||
log
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='features/module.css') }}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="top-bar-con">
|
||||
<button class="newBtn">新建</button>
|
||||
<button class="flushBtn">刷新</button>
|
||||
</div>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td>模块名</td>
|
||||
<td>操作</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in modules %}
|
||||
<tr>
|
||||
<td>{{ item }}</td>
|
||||
<td>
|
||||
<button class="removeBtn" onclick="alert('暂未完成')">移除</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,199 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='features/process.css') }}">
|
||||
<!--
|
||||
<script>
|
||||
window.onload = function init() {
|
||||
const initReq = new XMLHttpRequest()
|
||||
const url = "http://qsont.xyz:8011/get-process"
|
||||
|
||||
initReq.open("get", url, true)
|
||||
initReq.send()
|
||||
addInProgessText()
|
||||
|
||||
initReq.onload = () => {
|
||||
if (initReq.status == 200 && initReq.readyState == 4) {
|
||||
const res = JSON.parse(initReq.responseText)
|
||||
let tBody = document.getElementById("tBody")
|
||||
|
||||
removeInProgessText()
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const pid = res[i].pid
|
||||
const status = res[i].status
|
||||
const cmd = res[i].cmd
|
||||
let trEle = document.createElement("tr")
|
||||
trEle.innerHTML = `
|
||||
<td class="text">${pid}</td>
|
||||
<td class="text">${status}</td>
|
||||
<td class="text">${cmd}</td>
|
||||
<td><button class="stopBtn" onclick="stopBtn('${pid}')">stop</button></td>
|
||||
`
|
||||
tBody.append(trEle)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (initReq.status == 500) {
|
||||
alert("服务端错误")
|
||||
return
|
||||
} else {
|
||||
alert(`意外错误 (${initReq.status})`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
initReq.onerror = () => {
|
||||
alert(`无法获取进程列表 (${initReq.status})`)
|
||||
}
|
||||
|
||||
function addInProgessText() {
|
||||
let inProgressText = document.getElementById("inProgressText")
|
||||
const dotAmount = 3
|
||||
let currDotAmount = 0
|
||||
let dot = ""
|
||||
setInterval(() => {
|
||||
dot = ""
|
||||
for (let i = 0; i < currDotAmount; i++) {
|
||||
dot = dot + "."
|
||||
}
|
||||
inProgressText.innerText = `Loading${dot}`
|
||||
if (currDotAmount >= dotAmount) {
|
||||
dot = ""
|
||||
currDotAmount = 0
|
||||
} else {
|
||||
currDotAmount++
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
|
||||
function removeInProgessText() {
|
||||
let inProgressText = document.getElementById("inProgressText")
|
||||
inProgressText.remove()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- stop, new flush -->
|
||||
<button class="newBtn" onclick="newBtn()">new</button>
|
||||
<button class="flushBtn" onclick="flushBtn()">flush</button>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title">PID</th>
|
||||
<th class="title">状态</th>
|
||||
<th class="title">命令</th>
|
||||
<th class="title">操作</th>
|
||||
</tr>
|
||||
{% for item in response %}
|
||||
<tr>
|
||||
<td>{{ item.pid }}</td>
|
||||
<td>{{ item.status }}</td>
|
||||
<td>{{ item.order }}</td>
|
||||
<td><button class="stopBtn" onclick="stopBtn('{{ item.pid }}')">stop</button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</thead>
|
||||
<tbody id="tBody"></tbody>
|
||||
</table>
|
||||
<div id="inProgressText"></div>
|
||||
|
||||
<div class="modal-con" id="modal-con">
|
||||
<div class="window">
|
||||
<div class="top-bar">
|
||||
<div class="close-btn" onclick="closeModal()">X</div>
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
<div class="prompt">输入模块名:</div>
|
||||
<input id="input-area" class="input-area" type="text">
|
||||
</div>
|
||||
<button class="create-btn" onclick="createProcess()">创建</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function newBtn() {
|
||||
const modal = document.getElementById("modal-con")
|
||||
modal.style.display = "flex"
|
||||
}
|
||||
|
||||
function createProcess() {
|
||||
const moduleName = document.getElementById("input-area").value
|
||||
const createReq = new XMLHttpRequest()
|
||||
const url = `{{ url_for('process.create_process', name=0) }}`.replace('0', moduleName);
|
||||
|
||||
createReq.open("post", url, true)
|
||||
createReq.send()
|
||||
|
||||
createReq.onload = () => {
|
||||
if (createReq.status == 200 && createReq.readyState == 4) {
|
||||
const res = JSON.parse(createReq.responseText)
|
||||
if (res.status == "success") {
|
||||
flushBtn()
|
||||
return
|
||||
}
|
||||
alert(`意外错误 (${createReq.status})`)
|
||||
return
|
||||
}
|
||||
|
||||
if (createReq.status == 500) {
|
||||
alert("服务端错误")
|
||||
return
|
||||
} else {
|
||||
alert(`意外错误 (${createReq.status})`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushBtn() {
|
||||
window.location = "{{ url_for('process.process') }}"
|
||||
}
|
||||
|
||||
function stopBtn(pid) {
|
||||
if (!confirm("确认停止该服务?")) {
|
||||
return
|
||||
}
|
||||
const url = `{{ url_for('process.kill_process', pid=0) }}`.replace('0', pid);
|
||||
const stopReq = new XMLHttpRequest();
|
||||
|
||||
stopReq.open("POST", url, true);
|
||||
stopReq.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
stopReq.send();
|
||||
|
||||
stopReq.onload = () => {
|
||||
if (stopReq.status == 200 && stopReq.readyState == 4) {
|
||||
flushBtn()
|
||||
return
|
||||
}
|
||||
|
||||
if (stopReq.status == 500) {
|
||||
alert("服务端错误")
|
||||
return
|
||||
} else {
|
||||
alert(`意外错误 (${stopReq.status})`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
const modal = document.getElementById("modal-con")
|
||||
const input = document.getElementById("input-area")
|
||||
|
||||
input.value = ""
|
||||
modal.style.display = "none"
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,162 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="icon" href="data:;base64,=">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='features/user.css') }}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="top-bar-con">
|
||||
<button class="addUserBtn" onclick="addUser()">添加用户</button>
|
||||
<button class="flushBtn" onclick="flush()">刷新</button>
|
||||
</div>
|
||||
|
||||
<table border="1">
|
||||
<thead>
|
||||
<td>用户ID</td>
|
||||
<td>用户名</td>
|
||||
<td>用户角色</td>
|
||||
<td>操作</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in response %}
|
||||
<tr>
|
||||
<td>{{ item.user_id}}</td>
|
||||
<td>{{ item.username }}</td>
|
||||
<td>{{ item.role }}</td>
|
||||
<td>
|
||||
{% if current_role == "admin" %}
|
||||
<button class="changePasswdBtn" onclick="changePasswd('{{ item.user_id }}')">修改密码</button>
|
||||
{% if item.username != "admin" %}
|
||||
<button class="deleteUserBtn" onclick="deleteUser('{{ item.user_id }}')">删除用户</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if current_role != "admin" and current_user_id == item.user_id %}
|
||||
<button class="changePasswdBtn" onclick="changePasswd('{{ item.user_id }}')">修改密码</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function addUser() {
|
||||
const url = "{{ url_for('user.add_user') }}"
|
||||
const addReq = new XMLHttpRequest()
|
||||
|
||||
let data = new URLSearchParams()
|
||||
// get user name
|
||||
const name = prompt("请输入用户名")
|
||||
if (name === null) return
|
||||
if (name === "") {
|
||||
alert("请输入用户名")
|
||||
return
|
||||
} else {
|
||||
data.append("username", name)
|
||||
}
|
||||
// get user password
|
||||
const passwd = prompt("请输入密码")
|
||||
if (passwd === null) return
|
||||
if (passwd === "") {
|
||||
alert("请输入密码")
|
||||
return
|
||||
} else {
|
||||
data.append("password", passwd)
|
||||
}
|
||||
|
||||
addReq.open("post", url, true)
|
||||
addReq.send(data)
|
||||
|
||||
addReq.onload = () => {
|
||||
if (addReq.status == 200 && addReq.readyState == 4) {
|
||||
alert(JSON.parse(addReq.responseText).message)
|
||||
flush()
|
||||
return
|
||||
}
|
||||
|
||||
if (addReq.status == 500) {
|
||||
alert("服务端错误")
|
||||
return
|
||||
} else {
|
||||
alert(`意外错误 (${addReq.status})`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changePasswd(id) {
|
||||
const url = "{{ url_for('user.change_password') }}"
|
||||
const changeReq = new XMLHttpRequest()
|
||||
|
||||
let data = new URLSearchParams()
|
||||
data.append("user_id", id)
|
||||
|
||||
// get user password
|
||||
const passwd = prompt("请输入新密码")
|
||||
if (passwd === null) return
|
||||
if (passwd === "") {
|
||||
alert("请输入密码")
|
||||
return
|
||||
} else {
|
||||
data.append("new_password", passwd)
|
||||
}
|
||||
|
||||
changeReq.open("post", url, true)
|
||||
changeReq.send(data)
|
||||
changeReq.onload = () => {
|
||||
if (changeReq.status == 200 && changeReq.readyState == 4) {
|
||||
alert(JSON.parse(changeReq.responseText).message)
|
||||
flush()
|
||||
return
|
||||
}
|
||||
|
||||
if (changeReq.status == 500) {
|
||||
alert("服务端错误")
|
||||
return
|
||||
} else {
|
||||
alert(`意外错误 (${changeReq.status})`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deleteUser(id) {
|
||||
if (!confirm("删除用户后不可恢复,确认继续?")) {
|
||||
return
|
||||
}
|
||||
const url = "{{ url_for('user.delete_user', user_id=0) }}".replace("0", id)
|
||||
const delReq = new XMLHttpRequest()
|
||||
|
||||
delReq.open("post", url, true)
|
||||
delReq.send()
|
||||
|
||||
delReq.onload = () => {
|
||||
if (delReq.status == 200 && delReq.readyState == 4) {
|
||||
alert(JSON.parse(delReq.responseText).message)
|
||||
flush()
|
||||
return
|
||||
}
|
||||
|
||||
if (delReq.status == 500) {
|
||||
alert("服务端错误")
|
||||
return
|
||||
} else {
|
||||
alert(`意外错误 (${delReq.status})`)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flush() {
|
||||
window.location = "{{ url_for('user.user') }}"
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user