fix: 操作记录改名访问记录并加宽弹窗;版本发布时间戳改为 UTC+8 展示
build-and-deploy / build-and-deploy (push) Successful in 42s
build-and-deploy / build-and-deploy (push) Successful in 42s
This commit is contained in:
@@ -482,6 +482,18 @@ body {
|
||||
width: 360px;
|
||||
}
|
||||
|
||||
/* 宽模态框:访问记录等表格型内容,宽度至少占屏幕的 70% */
|
||||
.modal-wide {
|
||||
width: min(86vw, 1720px);
|
||||
max-width: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-wide .modal-body {
|
||||
max-height: 70vh;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
+3
-3
@@ -47,7 +47,7 @@
|
||||
<span class="group-label">数据</span>
|
||||
<button id="btn-export-config" class="toolbar-btn" title="导出配置">📥 导出</button>
|
||||
<button id="btn-import-config" class="toolbar-btn" title="导入配置">📤 导入</button>
|
||||
<button id="btn-audit" class="toolbar-btn" title="查看当前项目操作记录">📜 操作记录</button>
|
||||
<button id="btn-audit" class="toolbar-btn" title="查看当前项目访问记录">📜 访问记录</button>
|
||||
<input type="file" id="import-file-input" accept=".json" style="display:none">
|
||||
</div>
|
||||
</div>
|
||||
@@ -305,9 +305,9 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-overlay" id="modal-audit" style="display:none">
|
||||
<div class="modal" style="max-width:920px">
|
||||
<div class="modal modal-wide">
|
||||
<div class="modal-header">
|
||||
<h3>操作记录 <span id="audit-title" style="font-weight:normal;font-size:12px;color:#999"></span></h3>
|
||||
<h3>访问记录 <span id="audit-title" style="font-weight:normal;font-size:12px;color:#999"></span></h3>
|
||||
<button class="modal-close" onclick="closeModal('modal-audit')">✕</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
+5
-5
@@ -672,7 +672,7 @@ async function copyAddress() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开操作记录弹窗
|
||||
* 打开访问记录弹窗
|
||||
* @param {string|null} key - 为空时查当前项目全部记录;否则查指定配置键的记录
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@@ -689,19 +689,19 @@ async function openAudit(key) {
|
||||
const logs = await API.getAudit(state.currentProject.id, key || "");
|
||||
renderAudit(logs);
|
||||
} catch (err) {
|
||||
toast("加载操作记录失败: " + err.message, "error");
|
||||
toast("加载访问记录失败: " + err.message, "error");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染操作记录表格
|
||||
* @param {Array} logs - 操作记录列表
|
||||
* 渲染访问记录表格
|
||||
* @param {Array} logs - 访问记录列表
|
||||
* @returns {void}
|
||||
*/
|
||||
function renderAudit(logs) {
|
||||
const tbody = document.getElementById("audit-tbody");
|
||||
if (!logs || !logs.length) {
|
||||
tbody.innerHTML = '<tr><td colspan="7" style="text-align:center;color:#999;padding:24px">暂无操作记录</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="7" style="text-align:center;color:#999;padding:24px">暂无访问记录</td></tr>';
|
||||
return;
|
||||
}
|
||||
const ACTION_NAMES = { read: "读取", create: "新增", update: "更新", delete: "删除" };
|
||||
|
||||
+29
-8
@@ -2,26 +2,47 @@
|
||||
* 版本信息
|
||||
* 版本号格式: v1.0.<git commit hash> build <yyyyMMdd HHmmss>
|
||||
* - commit hash: 优先取环境变量 GIT_COMMIT(Docker 构建时传入),否则本地 git rev-parse
|
||||
* - build time: 优先取环境变量 BUILD_TIME(Docker 构建时传入),否则为进程启动时刻
|
||||
* - build time: 优先取环境变量 BUILD_TIME(Docker 构建时传入,按 UTC 时刻理解),否则为进程启动时刻
|
||||
* 时间戳统一按东八区(UTC+8)展示。
|
||||
*/
|
||||
const { execFileSync } = require("child_process");
|
||||
|
||||
const UTC8_MS = 8 * 60 * 60 * 1000;
|
||||
|
||||
function pad(n) {
|
||||
return String(n).padStart(2, "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将日期换算为东八区墙钟时间并格式化 yyyyMMdd HHmmss
|
||||
* @param {Date} d - UTC 时刻
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatDateTime(d) {
|
||||
const t = new Date(d.getTime() + UTC8_MS);
|
||||
return (
|
||||
d.getFullYear() +
|
||||
pad(d.getMonth() + 1) +
|
||||
pad(d.getDate()) +
|
||||
t.getUTCFullYear() +
|
||||
pad(t.getUTCMonth() + 1) +
|
||||
pad(t.getUTCDate()) +
|
||||
" " +
|
||||
pad(d.getHours()) +
|
||||
pad(d.getMinutes()) +
|
||||
pad(d.getSeconds())
|
||||
pad(t.getUTCHours()) +
|
||||
pad(t.getUTCMinutes()) +
|
||||
pad(t.getUTCSeconds())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* BUILD_TIME(CI 传入的 UTC yyyyMMddHHmmss)换算为东八区展示
|
||||
* @param {string} ts - UTC 时间戳
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatBuildTimeUtc8(ts) {
|
||||
const m = String(ts).match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/);
|
||||
if (!m) return ts;
|
||||
const utc = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]));
|
||||
return formatDateTime(utc);
|
||||
}
|
||||
|
||||
function shortenHash(hash) {
|
||||
return (hash || "unknown").slice(0, 8);
|
||||
}
|
||||
@@ -43,7 +64,7 @@ function resolveCommitHash() {
|
||||
|
||||
function resolveBuildTime() {
|
||||
if (process.env.BUILD_TIME && process.env.BUILD_TIME !== "unknown" && process.env.BUILD_TIME !== "") {
|
||||
return process.env.BUILD_TIME;
|
||||
return formatBuildTimeUtc8(process.env.BUILD_TIME);
|
||||
}
|
||||
return formatDateTime(new Date());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user