Compare commits

...

4 Commits
master ... dev

Author SHA1 Message Date
633542a2be feat: Web服务区域新增添加Web服务功能
- 添加新增Web服务按钮到筛选栏
- 实现完整的Web服务添加表单(ID、名称、端口、目录、启动命令等)
- 新增的Web服务具有所有现有功能(启停、日志、状态监控)
- 移除之前的文本块功能
2026-06-25 12:29:29 +08:00
ffe3dd1fc3 feat: Web服务区域新增文本块功能
- 添加新增文本块按钮到筛选栏
- 实现文本块增删改查功能
- 支持多种颜色主题(蓝/绿/黄/红/紫/灰)
- 文本块显示在Web服务网格中
- 数据存储在localStorage
2026-06-25 12:19:26 +08:00
701889d22f Merge remote-tracking branch 'origin/master' into dev 2026-06-25 12:11:52 +08:00
1c97f3bd1e chore: 创建dev分支,端口改为16023 2026-06-25 12:05:55 +08:00
14 changed files with 125 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -21,7 +21,7 @@ ALERT_CONFIG_FILE = 'alert_config.json'
# 应用配置
APP_NAME = "项目服务管理面板"
APP_VERSION = "v3.4.1"
APP_PORT = 16022
APP_PORT = 16023
# 监控配置
DEFAULT_THRESHOLDS = {

View File

@@ -446229,3 +446229,7 @@
127.0.0.1 - - [25/Jun/2026 12:10:58] "GET /api/alerts HTTP/1.1" 200 -
127.0.0.1 - - [25/Jun/2026 12:10:58] "GET /api/system/stats HTTP/1.1" 200 -
127.0.0.1 - - [25/Jun/2026 12:11:07] "GET /api/projects HTTP/1.1" 200 -
[2026-06-25 12:19:01] 项目服务管理面板 v3.4.1 初始化完成
[2026-06-25 12:19:01] 启动 项目服务管理面板,端口: 16023
[2026-06-25 12:29:07] 项目服务管理面板 v3.4.1 初始化完成
[2026-06-25 12:29:07] 启动 项目服务管理面板,端口: 16023

View File

@@ -177,6 +177,7 @@
<button onclick="filterType('cli')" class="filter-bar-btn" data-type="cli"><i class="ri-terminal-box-line"></i> CLI工具</button>
<button onclick="filterType('extension')" class="filter-bar-btn" data-type="extension"><i class="ri-chrome-line"></i> 插件</button>
<button onclick="showAddServiceModal()" class="filter-bar-btn add-btn"><i class="ri-add-circle-line"></i> 新增服务</button>
<button onclick="showAddWebModal()" class="filter-bar-btn add-btn"><i class="ri-server-line"></i> 新增Web服务</button>
</div>
<!-- 项目列表 -->
@@ -750,6 +751,63 @@
</div>
</div>
<!-- 新增Web服务模态框 -->
<div id="addWebModal" class="modal-overlay hidden">
<div class="card rounded-xl modal-content p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="font-bold text-lg">新增Web服务</h3>
<button onclick="closeAddWebModal()" class="text-gray-400 hover:text-white"><i class="ri-close-line text-xl"></i></button>
</div>
<form id="addWebForm" onsubmit="saveWebProject(event)">
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">服务ID *</label>
<input type="text" id="webProjectId" required class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="唯一标识my-service">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">服务名称 *</label>
<input type="text" id="webProjectName" required class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="显示名称">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">端口 *</label>
<input type="text" id="webProjectPorts" required class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="多个端口用逗号分隔8080,8081">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">项目目录</label>
<input type="text" id="webProjectDir" class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="相对于works目录tech-blog">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">启动命令</label>
<input type="text" id="webProjectStartCmd" class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="如python3 app.py">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">停止命令</label>
<input type="text" id="webProjectStopCmd" class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="可选">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">后台URL</label>
<input type="text" id="webProjectAdminUrl" class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="如http://localhost:8080/admin">
</div>
<div class="mb-3">
<label class="block text-gray-400 text-sm mb-1">描述</label>
<input type="text" id="webProjectDesc" class="w-full bg-gray-700 text-gray-200 px-3 py-2 rounded-lg" placeholder="简要描述">
</div>
<div class="flex justify-end gap-2">
<button type="button" onclick="closeAddWebModal()" class="btn bg-gray-600 hover:bg-gray-700 px-4 py-2 rounded-lg">取消</button>
<button type="submit" class="btn bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg">添加</button>
</div>
</form>
</div>
</div>
<!-- 邮件通知规则模态框 -->
<div id="emailRuleModal" class="modal-overlay hidden">
<div class="card rounded-xl modal-content p-6">
@@ -1816,6 +1874,68 @@
localStorage.setItem('customServices', JSON.stringify(services));
}
// ==================== 新增Web服务管理 ====================
function showAddWebModal() {
document.getElementById('addWebForm').reset();
document.getElementById('addWebModal').classList.remove('hidden');
}
function closeAddWebModal() {
document.getElementById('addWebModal').classList.add('hidden');
}
function saveWebProject(event) {
event.preventDefault();
const id = document.getElementById('webProjectId').value.trim();
const name = document.getElementById('webProjectName').value.trim();
const portsStr = document.getElementById('webProjectPorts').value.trim();
const directory = document.getElementById('webProjectDir').value.trim();
const startCmd = document.getElementById('webProjectStartCmd').value.trim();
const stopCmd = document.getElementById('webProjectStopCmd').value.trim();
const adminUrl = document.getElementById('webProjectAdminUrl').value.trim();
const description = document.getElementById('webProjectDesc').value.trim();
// 解析端口
const ports = portsStr.split(',').map(p => parseInt(p.trim())).filter(p => !isNaN(p));
if (ports.length === 0) {
alert('请输入有效的端口号');
return;
}
const data = {
id: id,
name: name,
type: 'web',
ports: ports,
directory: directory,
start_cmd: startCmd || 'python3 app.py',
stop_cmd: stopCmd,
admin_url: adminUrl,
description: description
};
fetch('/api/projects/add', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
})
.then(res => res.json())
.then(result => {
if (result.error) {
alert('错误: ' + result.error);
return;
}
closeAddWebModal();
loadProjects();
alert('Web服务添加成功');
})
.catch(err => {
alert('添加失败: ' + err.message);
});
}
// ==================== 邮件通知规则管理 ====================
function getEmailRules() {