mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
ui: 配置页未保存状态改显式徽标,系统管理并入高级设置
- 亮度配置/高级设置 header 的圆点指示改为右侧「未保存/已保存」徽标 - 系统管理组 (日志大小/等级) 迁入高级设置折叠区,随「保存设置」写入 - useConfig 同步字段归属:dirtyAdvanced 监听与 saveAdvanced 写入,恢复默认时同时保存两部分
This commit is contained in:
1 parent
8c93f521ed
commit
7ebbfaf24b
3 files changed
+61
-55
No files matched your search
@@ -501,15 +501,24 @@ input:checked + .slider:before {
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.unsaved-dot {
|
||||
display: inline-block;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--md-sys-color-error);
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
.save-badge {
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.save-badge.unsaved {
|
||||
color: var(--color-warning);
|
||||
background: color-mix(in srgb, var(--color-warning) 15%, transparent);
|
||||
}
|
||||
|
||||
.save-badge.saved {
|
||||
color: #2f9e63;
|
||||
background: rgba(47, 158, 99, 0.14);
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
|
||||
@@ -16,7 +16,6 @@ export function useConfig() {
|
||||
const uiMaxBri = ref('')
|
||||
const maxBri = ref('')
|
||||
const stepsNum = ref('50')
|
||||
const logMaxSize = ref('500')
|
||||
|
||||
// 执行策略
|
||||
const autoBriSleep = ref(false)
|
||||
@@ -34,6 +33,7 @@ export function useConfig() {
|
||||
const inotifyEvents = ref('c')
|
||||
const debugMode = ref(false)
|
||||
const logLevel = ref('info')
|
||||
const logMaxSize = ref('500')
|
||||
|
||||
// 脸污标记
|
||||
const dirty = ref(false)
|
||||
@@ -56,7 +56,6 @@ export function useConfig() {
|
||||
uiMaxBri,
|
||||
maxBri,
|
||||
stepsNum,
|
||||
logMaxSize,
|
||||
autoBriSleep,
|
||||
displayHdrSleep,
|
||||
compatibilityMode,
|
||||
@@ -65,14 +64,13 @@ export function useConfig() {
|
||||
sleepStartM,
|
||||
sleepEndH,
|
||||
sleepEndM,
|
||||
logLevel,
|
||||
],
|
||||
() => {
|
||||
if (!_silent) dirty.value = true
|
||||
},
|
||||
)
|
||||
// 监听高级设置字段
|
||||
watch([nowBriFile, sysMaxBriFile, inotifyEvents, debugMode], () => {
|
||||
// 监听高级设置字段 (系统管理的日志项也随「保存设置」写入)
|
||||
watch([nowBriFile, sysMaxBriFile, inotifyEvents, debugMode, logLevel, logMaxSize], () => {
|
||||
if (!_silent) dirtyAdvanced.value = true
|
||||
})
|
||||
|
||||
@@ -136,12 +134,10 @@ export function useConfig() {
|
||||
ui_max_bri: parseInt(uiMaxBri.value) || 0,
|
||||
max_bri: parseInt(maxBri.value) || 0,
|
||||
steps_num: parseInt(stepsNum.value) || 50,
|
||||
log_max_size: parseInt(logMaxSize.value) || 500,
|
||||
auto_bri_sleep: autoBriSleep.value ? 1 : 0,
|
||||
display_hdr_sleep: displayHdrSleep.value ? 1 : 0,
|
||||
compatibility_mode: compatibilityMode.value ? 1 : 0,
|
||||
sleep_time: getSleepTimeStr(),
|
||||
log_level: logLevel.value,
|
||||
})
|
||||
await runCmd(`rm -f "${FLAG_FILE}"`)
|
||||
const pidRes = await runCmd(`cat "${PID_FILE}"`)
|
||||
@@ -160,6 +156,8 @@ export function useConfig() {
|
||||
max_bri_file: sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE,
|
||||
inotify_events: inotifyEvents.value || 'c',
|
||||
debug_mode: debugMode.value ? 1 : 0,
|
||||
log_max_size: parseInt(logMaxSize.value) || 500,
|
||||
log_level: logLevel.value,
|
||||
})
|
||||
onPathsChanged?.()
|
||||
toast('高级设置已保存,需重启模块生效')
|
||||
@@ -212,6 +210,7 @@ export function useConfig() {
|
||||
sleepEndM.value = '00'
|
||||
}
|
||||
await save(toast)
|
||||
await saveAdvanced(toast)
|
||||
}
|
||||
|
||||
function saveWebUIConfig(toast, newAutoRefresh, newInterval, newZoom, newTheme, onRestart) {
|
||||
|
||||
@@ -83,9 +83,10 @@ function handleSaveWebUI() {
|
||||
<!-- === 亮度配置 === -->
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>
|
||||
亮度配置<span v-if="config.dirty.value" class="unsaved-dot" title="有未保存的更改"></span>
|
||||
</h2>
|
||||
<h2>亮度配置</h2>
|
||||
<span class="save-badge" :class="config.dirty.value ? 'unsaved' : 'saved'">
|
||||
{{ config.dirty.value ? '未保存' : '已保存' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
@@ -208,36 +209,6 @@ function handleSaveWebUI() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><FileText :size="16" /> 系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<Input
|
||||
v-model="config.logMaxSize.value"
|
||||
type="number"
|
||||
min="1"
|
||||
max="10240"
|
||||
class="config-input"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志等级</span>
|
||||
<span class="config-desc">低于此级别不写入日志</span>
|
||||
</div>
|
||||
<select v-model="config.logLevel.value" class="config-select">
|
||||
<option value="off">关闭</option>
|
||||
<option value="error">仅错误</option>
|
||||
<option value="warn">警告+</option>
|
||||
<option value="info">全部</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -253,13 +224,10 @@ function handleSaveWebUI() {
|
||||
<!-- === 高级设置 === -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header card-header-toggle" @click="advancedOpen = !advancedOpen">
|
||||
<h2>
|
||||
高级设置<span
|
||||
v-if="config.dirtyAdvanced.value"
|
||||
class="unsaved-dot"
|
||||
title="有未保存的更改"
|
||||
></span>
|
||||
</h2>
|
||||
<h2>高级设置</h2>
|
||||
<span class="save-badge" :class="config.dirtyAdvanced.value ? 'unsaved' : 'saved'">
|
||||
{{ config.dirtyAdvanced.value ? '未保存' : '已保存' }}
|
||||
</span>
|
||||
<ChevronDown :size="18" class="collapse-chevron" :class="{ open: advancedOpen }" />
|
||||
</div>
|
||||
<div class="collapsible-body" :class="{ open: advancedOpen }">
|
||||
@@ -315,6 +283,36 @@ function handleSaveWebUI() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><FileText :size="16" /> 系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<Input
|
||||
v-model="config.logMaxSize.value"
|
||||
type="number"
|
||||
min="1"
|
||||
max="10240"
|
||||
class="config-input"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志等级</span>
|
||||
<span class="config-desc">低于此级别不写入日志</span>
|
||||
</div>
|
||||
<select v-model="config.logLevel.value" class="config-select">
|
||||
<option value="off">关闭</option>
|
||||
<option value="error">仅错误</option>
|
||||
<option value="warn">警告+</option>
|
||||
<option value="info">全部</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button @click="config.saveAdvanced(showToast, () => {})">
|
||||
<Save :size="15" /> 保存设置
|
||||
|
||||
Reference in new issue
Block a user