2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 14:57:16 +08:00

fix: goreleaser

This commit is contained in:
耗子
2023-06-25 01:07:32 +08:00
parent e26ce4ce86
commit 175b413432
3 changed files with 0 additions and 9 deletions

View File

@@ -1,250 +0,0 @@
<!--
Name: Openresty管理器
Author: 耗子
Date: 2023-06-24
-->
<title>OpenResty</title>
<div class="layui-fluid" id="component-tabs">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">OpenResty管理</div>
<div class="layui-card-body">
<div class="layui-tab">
<ul class="layui-tab-title">
<li class="layui-this">运行状态</li>
<li>配置修改</li>
<li>负载状态</li>
<li>错误日志</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<blockquote id="openresty-status" class="layui-elem-quote layui-quote-nm">当前状态:<span
class="layui-badge layui-bg-black">获取中</span></blockquote>
<div class="layui-btn-container" style="padding-top: 30px;">
<button id="openresty-start" class="layui-btn">启动</button>
<button id="openresty-stop" class="layui-btn layui-btn-danger">停止</button>
<button id="openresty-restart" class="layui-btn layui-btn-warm">重启</button>
<button id="openresty-reload" class="layui-btn layui-btn-normal">重载</button>
</div>
</div>
<div class="layui-tab-item">
<blockquote class="layui-elem-quote">此处修改的是OpenResty主配置文件如果你不了解各参数的含义请不要随意修改<br>
提示Ctrl+F 搜索关键字Ctrl+S 保存Ctrl+H 查找替换!
</blockquote>
<div id="openresty-config-editor"
style="height: 600px;"></div>
<div class="layui-btn-container" style="padding-top: 30px;">
<button id="openresty-config-save" class="layui-btn">保存</button>
</div>
</div>
<div class="layui-tab-item">
<table class="layui-hide" id="openresty-load-status"></table>
</div>
<div class="layui-tab-item">
<div class="layui-btn-container">
<button id="openresty-clean-error-log" class="layui-btn">清空日志</button>
</div>
<pre id="openresty-error-log" class="layui-code">
获取中...
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
let openresty_config_editor
layui.use(['index', 'code', 'table'], function () {
let $ = layui.$
, admin = layui.admin
, element = layui.element
, code = layui.code
, table = layui.table
admin.req({
url: '/api/plugins/openresty/status'
, method: 'get'
, success: function (result) {
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty运行状态获取失败接口返回' + result)
return false
}
if (result.data) {
$('#openresty-status').html('当前状态:<span class="layui-badge layui-bg-green">运行中</span>')
} else {
$('#openresty-status').html('当前状态:<span class="layui-badge layui-bg-red">已停止</span>')
}
}
})
// 获取openresty错误日志并渲染
admin.req({
url: '/api/plugins/openresty/errorLog'
, method: 'get'
, success: function (result) {
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty错误日志获取失败接口返回' + result)
$('#openresty-error-log').text('OpenResty错误日志获取失败请刷新重试')
code({
elem: '#openresty-error-log'
, title: 'error.log'
, encode: true
, about: false
})
return false
}
$('#openresty-error-log').text(result.data)
code({
elem: '#openresty-error-log'
, title: 'error.log'
, encode: true
, about: false
})
}
})
// 获取openresty配置并渲染
admin.req({
url: '/api/plugins/openresty/config'
, method: 'get'
, success: function (result) {
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty主配置获取失败接口返回' + result)
return false
}
$('#openresty-config-editor').text(result.data)
openresty_config_editor = ace.edit('openresty-config-editor', {
mode: 'ace/mode/nginx',
selectionStyle: 'text'
})
}
})
// 获取openresty负载状态并渲染
table.render({
elem: '#openresty-load-status'
, url: '/api/plugins/openresty/load'
, cols: [[
{ field: 'name', width: '80%', title: '属性', }
, { field: 'value', width: '20%', title: '当前值' }
]]
})
element.render()
// 事件监听
$('#openresty-start').click(function () {
admin.popup({
title: '<span style="color: red;">警告</span>'
,
shade: 0
,
anim: -1
,
area: ['300px', '200px']
,
id: 'layadmin-layer-skin-openresty-start'
,
skin: 'layui-anim layui-anim-upbit'
,
content: '面板的正常访问依赖OpenResty因此不支持在面板启动OpenResty如您确需操作请在SSH执行<span class="layui-badge-rim">systemctl start nginx</span>以启动OpenResty'
})
})
$('#openresty-stop').click(function () {
admin.popup({
title: '<span style="color: red;">警告</span>'
,
shade: 0
,
anim: -1
,
area: ['300px', '200px']
,
id: 'layadmin-layer-skin-openresty-stop'
,
skin: 'layui-anim layui-anim-upbit'
,
content: '面板的正常访问依赖OpenResty因此不支持在面板停止OpenResty如您确需操作请在SSH执行<span class="layui-badge-rim">systemctl stop nginx</span>以停止OpenResty'
})
})
$('#openresty-restart').click(function () {
layer.confirm('重启OpenResty有可能导致面板短时间无法访问是否继续重启', {
btn: ['重启', '取消']
}, function () {
index = layer.msg('正在重启OpenResty...', { icon: 16, time: 0 })
admin.req({
url: '/api/plugins/openresty/restart'
, method: 'post'
, beforeSend: function () {
layer.msg('已发送重启请求,请稍后刷新确认重启状态。')
}
, success: function (result) {
layer.close(index)
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty重启失败接口返回' + result)
return false
}
admin.events.refresh()
layer.alert('OpenResty重启成功')
}
})
})
})
$('#openresty-reload').click(function () {
index = layer.msg('正在重载OpenResty...', { icon: 16, time: 0 })
admin.req({
url: '/api/plugins/openresty/reload'
, method: 'post'
, success: function (result) {
layer.close(index)
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty重载失败接口返回' + result)
return false
}
layer.alert('OpenResty重载成功')
}
})
})
$('#openresty-config-save').click(function () {
index = layer.msg('正在保存OpenResty主配置...', { icon: 16, time: 0 })
admin.req({
url: '/api/plugins/openresty/config'
, method: 'post'
, data: {
config: openresty_config_editor.getValue()
}
, success: function (result) {
layer.close(index)
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty配置保存失败接口返回' + result)
return false
}
layer.alert('OpenResty配置保存成功')
}
})
})
$('#openresty-clean-error-log').click(function () {
index = layer.msg('正在清空OpenResty错误日志...', { icon: 16, time: 0 })
admin.req({
url: '/api/plugins/openresty/cleanErrorLog'
, method: 'post'
, success: function (result) {
layer.close(index)
if (result.code !== 0) {
console.log('耗子Linux面板OpenResty错误日志清空失败接口返回' + result)
return false
}
admin.events.refresh()
layer.msg('OpenResty错误日志已清空')
}
})
})
})
</script>

View File

@@ -22,6 +22,4 @@ func Route() {
route.Get("errorLog", openRestyController.ErrorLog)
route.Get("cleanErrorLog", openRestyController.ClearErrorLog)
})
facades.Route().StaticFile("panel/views/plugins/openresty.html", "plugins/openresty/public/views/openresty.html")
}