diff --git a/console-ui/public/portal/index.html b/console-ui/public/portal/index.html index 56393b2..70ddf20 100644 --- a/console-ui/public/portal/index.html +++ b/console-ui/public/portal/index.html @@ -443,6 +443,21 @@ if (!window.ARCRUN_API_BASE) {
管理帳號與知識庫授權
+
執行紀錄保留期
+
+
保留天數
+
執行紀錄是稽核資料,超過保留天數會被每日自動清除;預設 90 天(3 個月),也可設為「不刪除」(企業稽核用途)。
+
+ + + +
+
+
+
+
帳號管理
新增同仁帳號
@@ -1573,9 +1588,57 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { }); } + // 執行紀錄保留期(P7):GET/PUT /portal/admin/execution-log-retention,role=admin 閘(server 端)。 + // retention_days: number=自訂天數;null=「不刪除」(企業稽核,leo 08-07:「我願意花很多錢 + // 保存,不要刪除」);未設定過的租戶也會回一個值(KBDB 端退回預設 90 天)。 + function loadRetention() { + $('ad-ret-current').textContent = '載入中…'; + adminApi('GET', '/portal/admin/execution-log-retention') + .then(function (x) { + if (guard401(x.status)) return; + if (!x.ok) { $('ad-ret-current').textContent = ''; $('ad-ret-status').textContent = x.d.error || ('讀取失敗(HTTP ' + x.status + ')'); return; } + var days = x.d.retention_days; + var def = x.d.default_days || 90; + $('ad-ret-never').checked = (days === null); + $('ad-ret-days').value = (days === null) ? '' : (days != null ? days : def); + $('ad-ret-days').disabled = (days === null); + $('ad-ret-current').textContent = (days === null) + ? '目前設定:不刪除(企業稽核)' + : '目前設定:保留 ' + (days != null ? days : def) + ' 天' + (days == null ? '(沿用預設值,尚未自訂)' : ''); + }) + .catch(function (e) { $('ad-ret-current').textContent = ''; $('ad-ret-status').textContent = friendlyErr(e); }); + } + $('ad-ret-never').addEventListener('change', function () { + $('ad-ret-days').disabled = this.checked; + }); + $('ad-ret-save').addEventListener('click', function () { + var st = $('ad-ret-status'); + st.textContent = ''; + var never = $('ad-ret-never').checked; + var body; + if (never) { + body = { retention_days: null }; + } else { + var n = parseInt($('ad-ret-days').value, 10); + if (!n || n <= 0) { st.textContent = '請輸入大於 0 的天數,或勾「不刪除」'; return; } + body = { retention_days: n }; + } + $('ad-ret-save').disabled = true; + adminApi('PUT', '/portal/admin/execution-log-retention', body) + .then(function (x) { + $('ad-ret-save').disabled = false; + if (guard401(x.status)) return; + if (!x.ok) { st.textContent = x.d.error || ('儲存失敗(HTTP ' + x.status + ')'); return; } + toast('保留期已更新'); + loadRetention(); + }) + .catch(function (e) { $('ad-ret-save').disabled = false; st.textContent = friendlyErr(e); }); + }); + function loadAdmin() { $('ad-users').innerHTML = '
載入中…
'; $('ad-libs').innerHTML = '
載入中…
'; + loadRetention(); adminApi('GET', '/portal/admin/libraries') .then(function (x) { if (guard401(x.status)) return;