fix: 设置页说明改为悬停提示,并让内容铺满可用宽度

This commit is contained in:
2026-11-09 12:37:43 +08:00
parent e91dd0e604
commit 373408042e
11 changed files with 387 additions and 129 deletions
+19
View File
@@ -0,0 +1,19 @@
<template>
<n-tooltip v-if="text" trigger="hover" placement="top-start">
<template #trigger>
<button type="button" class="hint-tip" :aria-label="text">
<n-icon :component="Info20Regular" />
</button>
</template>
<span class="hint-tip-text">{{ text }}</span>
</n-tooltip>
</template>
<script setup lang="ts">
import { Info20Regular } from "@vicons/fluent";
import { NIcon, NTooltip } from "naive-ui";
defineProps<{
text?: string;
}>();
</script>
@@ -8,10 +8,12 @@
@update:show="(value: boolean) => emit('update:show', value)"
>
<n-form v-if="draft && plugin" class="inline-form host-adapter-form" label-placement="left" label-width="auto" :show-feedback="false">
<p v-if="localized(plugin.description)" class="settings-field-hint host-hint">{{ localized(plugin.description) }}</p>
<div class="host-form-rows">
<n-form-item :label="t('host.adapter.name')" required>
<n-input v-model:value="draft.name" />
<div class="settings-control-line">
<n-input v-model:value="draft.name" />
<hint-tip :text="localized(plugin.description)" />
</div>
</n-form-item>
<n-form-item :label="t('host.adapter.priority')">
<n-input-number v-model:value="draft.priority" :min="-1000" :max="1000" :show-button="false" />
@@ -77,6 +79,7 @@ import { Eye20Regular, Play20Regular } from "@vicons/fluent";
import { NButton, NForm, NFormItem, NIcon, NInput, NInputNumber, NModal, NSwitch, useMessage } from "naive-ui";
import { computed, ref, watch } from "vue";
import HintTip from "../../../components/HintTip.vue";
import { t } from "../../../i18n";
import { showError } from "../../../utils/message";
import { createDraft, draftBody, type AdapterDraft } from "../adapterForm";
@@ -18,7 +18,6 @@
:data="adapters"
:pagination="false"
:row-key="(row: UpstreamAdapter) => String(row.id)"
:scroll-x="640"
>
<template #empty>
<n-empty :description="t('host.adapter.empty')" />
@@ -113,7 +112,7 @@ const columns = computed<DataTableColumns<UpstreamAdapter>>(() => [
{
title: t("common.actions"),
key: "actions",
width: 140,
width: 132,
render: (row) =>
h("div", { class: "host-table-actions" }, [
h(NButton, { size: "small", quaternary: true, type: "primary", onClick: () => openEdit(row) }, () => t("common.edit")),
@@ -33,7 +33,7 @@
<span class="host-value-text">{{ uptimeText }}</span>
</n-form-item>
<n-form-item :label="t('host.agent.token')" :show-feedback="false">
<div class="host-value-line host-value-wrap">
<div class="host-value-line">
<code v-if="agent?.token_prefix" class="host-value-code">{{ agent.token_prefix }}…</code>
<span v-else class="host-muted">{{ t("host.agent.tokenNone") }}</span>
<span v-if="tokenCreatedText" class="host-muted">{{ tokenCreatedText }}</span>
@@ -8,15 +8,22 @@
<span class="host-value-text">{{ statusLine }}</span>
</n-form-item>
<n-form-item :label="t('host.dns.servers')" :show-feedback="false">
<n-dynamic-input
v-model:value="servers"
class="host-dynamic-list"
:min="1"
:max="MAX_SERVERS"
:disabled="!canConfigure"
:placeholder="t('host.dns.serverPlaceholder')"
@update:value="dirty = true"
/>
<div class="host-inline-field">
<n-dynamic-input
v-model:value="servers"
class="host-dynamic-list"
:min="1"
:max="MAX_SERVERS"
:disabled="!canConfigure"
:placeholder="t('host.dns.serverPlaceholder')"
@update:value="dirty = true"
/>
<div class="host-inline-side">
<n-button type="primary" size="small" :loading="applying" :disabled="!canConfigure" @click="apply">
{{ t("host.dns.apply") }}
</n-button>
</div>
</div>
</n-form-item>
<n-form-item :label="t('host.dns.search')" :show-feedback="false">
<n-dynamic-input
@@ -30,11 +37,6 @@
/>
</n-form-item>
</div>
<div class="settings-inline-actions">
<n-button type="primary" :loading="applying" :disabled="!canConfigure" @click="apply">
{{ t("host.dns.apply") }}
</n-button>
</div>
</section>
</template>
@@ -16,22 +16,24 @@
{{ t("host.ntp.conflicts", { names: ntp.conflicts.join(t("common.listSeparator")) }) }}
</p>
<n-form-item :label="t('host.ntp.servers')" :show-feedback="false">
<n-dynamic-input
v-model:value="servers"
class="host-dynamic-list"
:min="1"
:max="MAX_SERVERS"
:disabled="!canConfigure"
:placeholder="t('host.ntp.serverPlaceholder')"
@update:value="dirty = true"
/>
<div class="host-inline-field">
<n-dynamic-input
v-model:value="servers"
class="host-dynamic-list"
:min="1"
:max="MAX_SERVERS"
:disabled="!canConfigure"
:placeholder="t('host.ntp.serverPlaceholder')"
@update:value="dirty = true"
/>
<div class="host-inline-side">
<hint-tip :text="readonlyReason" />
<n-button type="primary" size="small" :loading="applying" :disabled="!canConfigure" @click="apply">
{{ t("host.ntp.apply") }}
</n-button>
</div>
</div>
</n-form-item>
<p v-if="readonlyReason" class="settings-field-hint host-hint">{{ readonlyReason }}</p>
</div>
<div class="settings-inline-actions">
<n-button type="primary" :loading="applying" :disabled="!canConfigure" @click="apply">
{{ t("host.ntp.apply") }}
</n-button>
</div>
</section>
</template>
@@ -41,6 +43,7 @@ import { Warning20Regular } from "@vicons/fluent";
import { NButton, NDynamicInput, NFormItem, NIcon, NTag, useMessage } from "naive-ui";
import { computed, ref, watch } from "vue";
import HintTip from "../../../components/HintTip.vue";
import { t } from "../../../i18n";
import { showError } from "../../../utils/message";
import { applyNtpServers } from "../api";
@@ -12,9 +12,9 @@
<div class="settings-switch-row">
<span>{{ t("host.timeSync.requireOnlineTime") }}</span>
<n-switch v-model:value="form.require_online_time" />
<hint-tip :text="t('host.timeSync.requireOnlineTimeHint')" />
</div>
</div>
<p class="settings-field-hint host-hint">{{ t("host.timeSync.requireOnlineTimeHint") }}</p>
<n-form-item :label="t('host.timeSync.mode')" :show-feedback="false">
<n-select v-model:value="form.sync_mode" :options="modeOptions" />
@@ -28,7 +28,7 @@
/>
</n-form-item>
<n-form-item :label="t('host.timeSync.detection')" :show-feedback="false">
<div class="host-value-line host-value-wrap">
<div class="host-inline-field">
<span class="host-value-text">{{ detectionText }}</span>
<span v-if="detectionMeta" class="host-muted">{{ detectionMeta }}</span>
<n-button size="small" :loading="detecting" @click="detect">
@@ -65,34 +65,37 @@
<div class="settings-switch-row">
<span>{{ t("host.timeSync.stopNtp") }}</span>
<n-switch v-model:value="form.stop_ntp_in_direct" :disabled="!form.stop_ntp_in_direct && !canStopNtp" />
<hint-tip :text="canStopNtp ? t('host.timeSync.stopNtpHint') : t('host.timeSync.stopNtpUnsupported')" />
<span v-if="ntpStateText" class="host-value-text">{{ ntpStateText }}</span>
</div>
</div>
<p class="settings-field-hint host-hint">
{{ canStopNtp ? t("host.timeSync.stopNtpHint") : t("host.timeSync.stopNtpUnsupported") }}
</p>
<p v-if="ntpStateText" class="settings-field-hint host-hint">{{ ntpStateText }}</p>
</template>
<n-form-item :label="t('host.timeSync.sources')" :show-feedback="false">
<n-dynamic-input
v-model:value="form.time_sources"
class="host-dynamic-list"
:min="1"
:max="MAX_SOURCES"
:placeholder="t('host.timeSync.sourcePlaceholder')"
/>
<div class="host-inline-field">
<n-dynamic-input
v-model:value="form.time_sources"
class="host-dynamic-list"
:min="1"
:max="MAX_SOURCES"
:placeholder="t('host.timeSync.sourcePlaceholder')"
/>
<div class="host-inline-side">
<hint-tip :text="t('host.timeSync.sourcesHint')" />
<div class="host-inline-buttons">
<n-button size="small" :disabled="!settings?.default_time_sources?.length" @click="restoreDefaultSources">
<template #icon><n-icon :component="ArrowCounterclockwise20Regular" /></template>
{{ t("host.common.restoreDefault") }}
</n-button>
<n-button size="small" :loading="checking" @click="checkSources">
<template #icon><n-icon :component="Clock20Regular" /></template>
{{ t("host.common.check") }}
</n-button>
<n-button size="small" type="primary" :loading="saving" @click="save">{{ t("common.save") }}</n-button>
</div>
</div>
</div>
</n-form-item>
<p class="settings-field-hint host-hint">{{ t("host.timeSync.sourcesHint") }}</p>
<div class="host-button-row">
<n-button size="small" :disabled="!settings?.default_time_sources?.length" @click="restoreDefaultSources">
<template #icon><n-icon :component="ArrowCounterclockwise20Regular" /></template>
{{ t("host.common.restoreDefault") }}
</n-button>
<n-button size="small" :loading="checking" @click="checkSources">
<template #icon><n-icon :component="Clock20Regular" /></template>
{{ t("host.common.check") }}
</n-button>
</div>
<div v-if="checkSamples.length" class="host-source-results">
<div v-for="sample in checkSamples" :key="sample.url" class="host-source-result">
<span class="host-result-dot" :class="sample.ok ? 'is-ok' : 'is-failed'" />
@@ -111,9 +114,6 @@
<div class="host-source-summary">{{ checkSummary }}</div>
</div>
</div>
<div class="settings-inline-actions">
<n-button type="primary" :loading="saving" @click="save">{{ t("common.save") }}</n-button>
</div>
</section>
</template>
@@ -122,6 +122,7 @@ import { ArrowCounterclockwise20Regular, Clock20Regular, Play20Regular, Search20
import { NButton, NDynamicInput, NFormItem, NIcon, NSelect, NSwitch, useMessage } from "naive-ui";
import { computed, reactive, ref, watch } from "vue";
import HintTip from "../../../components/HintTip.vue";
import { formatDateTime, t } from "../../../i18n";
import { showError } from "../../../utils/message";
import { createDraft, draftBody, type AdapterDraft } from "../adapterForm";
@@ -6,9 +6,11 @@
</div>
<div class="host-form-rows">
<n-form-item :label="t('host.flow.leadMs')">
<n-input-number v-model:value="flow.lead_ms" :min="0" :max="10000" :step="100" :show-button="false" />
<div class="settings-control-line">
<n-input-number v-model:value="flow.lead_ms" :min="0" :max="10000" :step="100" :show-button="false" />
<hint-tip :text="t('host.flow.leadMsHint')" />
</div>
</n-form-item>
<p class="settings-field-hint host-hint">{{ t("host.flow.leadMsHint") }}</p>
<n-form-item :label="t('host.flow.timezone')">
<n-select v-model:value="flow.timezone" filterable :options="timezones" />
</n-form-item>
@@ -21,13 +23,15 @@
<section class="host-editor-section">
<div class="host-editor-section-head">
<div class="host-editor-section-title">{{ t("host.flow.vars") }}</div>
<div class="host-editor-section-title">
{{ t("host.flow.vars") }}
<hint-tip :text="t('host.flow.varsHint')" />
</div>
<n-button size="small" @click="addVar">
<template #icon><n-icon :component="Add20Regular" /></template>
{{ t("host.flow.addVar") }}
</n-button>
</div>
<p class="settings-field-hint host-hint">{{ t("host.flow.varsHint") }}</p>
<div v-if="flow.vars.length" class="host-var-table">
<div class="host-var-row host-table-head">
<span>{{ t("host.flow.varKey") }}</span>
@@ -58,13 +62,15 @@
<section class="host-editor-section">
<div class="host-editor-section-head">
<div class="host-editor-section-title">{{ t("host.flow.steps") }}</div>
<div class="host-editor-section-title">
{{ t("host.flow.steps") }}
<hint-tip :text="t('host.flow.stepsHint')" />
</div>
<n-button size="small" :disabled="flow.steps.length >= MAX_FLOW_STEPS" @click="addStep">
<template #icon><n-icon :component="Add20Regular" /></template>
{{ t("host.flow.addStep") }}
</n-button>
</div>
<p class="settings-field-hint host-hint">{{ t("host.flow.stepsHint") }}</p>
<div v-for="(step, index) in flow.steps" :key="stepId(step)" class="host-flow-step">
<div class="host-flow-step-head">
<button type="button" class="host-flow-step-toggle" @click="toggleStep(step)">
@@ -203,10 +209,12 @@
<section class="host-editor-section">
<div class="host-editor-section-head">
<div class="host-editor-section-title">{{ t("host.flow.detect") }}</div>
<div class="host-editor-section-title">
{{ t("host.flow.detect") }}
<hint-tip :text="t('host.flow.detectHint')" />
</div>
<n-switch v-model:value="draft.detectEnabled" />
</div>
<p class="settings-field-hint host-hint">{{ t("host.flow.detectHint") }}</p>
<div v-if="draft.detectEnabled" class="host-form-rows">
<n-form-item :label="t('host.flow.request')">
<div class="host-inline-control">
@@ -261,6 +269,7 @@ import {
} from "naive-ui";
import { computed, ref } from "vue";
import HintTip from "../../../components/HintTip.vue";
import { t } from "../../../i18n";
import {
defaultStep,
@@ -7,7 +7,10 @@
</template>
<div class="host-placeholder-panel">
<div v-if="filters.length" class="host-placeholder-group">
<div class="host-placeholder-group-title">{{ t("host.flow.placeholderFilters") }}</div>
<div class="host-placeholder-group-title">
{{ t("host.flow.placeholderFilters") }}
<hint-tip :text="t('host.flow.placeholderFiltersHint')" />
</div>
<div class="host-placeholder-filters">
<n-tag
v-for="filter in filters"
@@ -20,7 +23,7 @@
{{ filter }}
</n-tag>
</div>
<div class="host-placeholder-hint">{{ chain.length ? chainPreview : t("host.flow.placeholderFiltersHint") }}</div>
<div v-if="chain.length" class="host-placeholder-hint">{{ chainPreview }}</div>
</div>
<div v-for="group in groups" :key="group.key" class="host-placeholder-group">
<div class="host-placeholder-group-title">{{ group.title }}</div>
@@ -38,6 +41,7 @@ import { BracesVariable20Regular } from "@vicons/fluent";
import { NButton, NIcon, NPopover, NTag } from "naive-ui";
import { computed, ref } from "vue";
import HintTip from "../../../components/HintTip.vue";
import { t } from "../../../i18n";
import { localized } from "../format";
import type { PlaceholderSpec } from "../types";
+229 -30
View File
@@ -2006,28 +2006,39 @@ a {
}
.settings-section {
width: min(760px, 100%);
width: auto;
max-width: none;
min-width: 0;
margin: 0 auto;
margin: 0;
padding: 22px 24px;
}
.settings-section-compact {
width: min(680px, 100%);
width: auto;
}
.settings-section-head {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 20px;
padding-bottom: 14px;
border-bottom: 1px solid var(--border-color);
}
.settings-section-title {
display: inline-flex;
align-items: center;
gap: 6px;
margin: 0;
font-size: 16px;
font-weight: 700;
}
.settings-section-head > .n-button {
margin-left: auto;
}
.settings-section-head p {
margin: 6px 0 0;
color: var(--muted-color);
@@ -2042,7 +2053,67 @@ a {
.settings-basic-fields {
display: grid;
gap: 14px;
max-width: 560px;
}
.settings-form .n-form-item--left-labelled .n-form-item-label {
width: 15em !important;
}
.settings-form .n-form-item-blank > .n-input,
.settings-form .n-form-item-blank > .n-input-number,
.settings-form .n-form-item-blank > .n-select,
.settings-form .n-form-item-blank > .settings-duration-control {
width: min(100%, 420px);
max-width: 420px;
}
.settings-control-line {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
min-width: 0;
}
.settings-control-line > .n-input,
.settings-control-line > .n-input-number,
.settings-control-line > .n-select,
.settings-control-line > .settings-duration-control {
flex: 0 1 420px;
width: min(100%, 420px);
max-width: 420px;
}
.hint-tip {
width: 22px;
height: 22px;
display: inline-flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
padding: 0;
border: 0;
border-radius: 50%;
background: transparent;
color: var(--muted-color);
cursor: help;
}
.hint-tip:hover,
.hint-tip:focus-visible {
color: var(--primary-color);
outline: none;
}
.hint-tip .n-icon {
font-size: 16px;
}
.hint-tip-text {
display: block;
max-width: 320px;
line-height: 1.5;
white-space: normal;
}
.settings-duration-control {
@@ -2074,21 +2145,31 @@ a {
.settings-switch-row {
min-height: 34px;
display: flex;
display: grid;
grid-template-columns: 15em auto auto minmax(0, 1fr);
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 6px 0;
border-bottom: 1px solid var(--border-color);
justify-content: start;
column-gap: 10px;
padding: 0;
border-bottom: 0;
}
.settings-switch-row:last-child {
border-bottom: 0;
}
.settings-switch-row span {
.settings-switch-row > span:first-child {
min-width: 0;
min-height: 34px;
display: inline-flex;
align-items: center;
justify-content: flex-end;
font-size: 14px;
text-align: right;
}
.settings-switch-row > span:first-child::after {
content: ":";
}
.settings-check-form-item {
@@ -2204,23 +2285,27 @@ a {
.settings-backup-panel {
display: flex;
align-items: center;
gap: 8px;
padding-left: 15em;
}
.settings-backup-panel .n-button:not(.n-button--circle) {
width: min(220px, 100%);
width: auto;
justify-content: center;
}
.settings-footer {
flex: 0 0 auto;
padding: 12px 18px;
padding: 12px 24px;
border-top: 1px solid var(--border-color);
background: var(--panel-bg);
}
.settings-footer .form-actions {
width: min(680px, 100%);
margin: 0 auto;
width: auto;
margin: 0;
justify-content: flex-start;
padding-left: 15em;
}
.token-toolbar {
@@ -3560,15 +3645,31 @@ a {
margin: 12px 16px 0;
}
.settings-form .settings-switch-row,
.host-settings-panel .settings-switch-row {
grid-template-columns: minmax(0, 1fr) auto;
grid-template-columns: minmax(0, 1fr) auto auto;
}
.settings-form .settings-switch-row > span:first-child,
.host-settings-panel .settings-switch-row span {
justify-content: flex-start;
text-align: left;
}
.settings-footer .form-actions,
.settings-backup-panel {
padding-left: 0;
}
.settings-control-line {
flex-wrap: wrap;
}
.host-inline-field,
.host-inline-buttons {
flex-wrap: wrap;
}
.auth-announcement-ticker {
position: static;
width: min(100%, calc(max(100vw, var(--app-min-width)) - 48px));
@@ -3759,7 +3860,8 @@ a {
}
.host-agent-float.is-open {
width: min(360px, calc(100% - 24px));
width: max-content;
max-width: min(720px, calc(100% - 24px));
}
.host-agent-float-toggle {
@@ -3820,10 +3922,19 @@ a {
padding-top: 8px;
}
.host-agent-float .n-form-item--left-labelled {
grid-template-columns: 4.5em max-content;
}
.host-agent-float .n-form-item--left-labelled .n-form-item-label {
width: 4.5em !important;
}
.host-agent-float .n-form-item-blank {
width: max-content;
min-width: max-content;
}
.host-agent-float .host-form-rows .n-input,
.host-agent-float .settings-inline-actions,
.host-agent-float .host-hint {
@@ -3832,10 +3943,24 @@ a {
margin-left: 0;
}
.host-agent-float .host-value-line {
flex-wrap: nowrap;
}
.host-agent-float .host-value-text,
.host-agent-float .host-value-code,
.host-agent-float .host-muted {
white-space: nowrap;
}
.host-settings-main {
padding: 4px 28px 28px;
}
.host-time-group {
width: min(680px, 100%);
margin: 0 auto;
padding: 6px 24px 22px;
width: auto;
margin: 0;
padding: 6px 0 8px;
}
.host-time-group-title {
@@ -3862,8 +3987,12 @@ a {
font-size: 14px;
}
.host-settings-section {
width: min(680px, 100%);
.host-settings-panel .host-settings-section {
width: auto;
max-width: none;
margin: 0;
padding-right: 0;
padding-left: 0;
}
.host-settings-section .settings-section-head {
@@ -3871,16 +4000,64 @@ a {
}
.host-settings-section .settings-inline-actions {
width: min(420px, calc(100% - 12em - 10px));
width: auto;
margin-top: 4px;
margin-left: calc(12em + 10px);
justify-content: flex-end;
margin-left: 0;
justify-content: flex-start;
}
.host-form-rows .n-dynamic-input,
.host-form-rows .n-select,
.host-form-rows .n-input {
width: min(100%, 420px);
width: min(100%, 520px);
}
.host-inline-field {
width: 100%;
min-width: 0;
display: flex;
align-items: flex-start;
gap: 12px;
}
.host-inline-field > .host-dynamic-list,
.host-inline-field > .n-dynamic-input,
.host-inline-field > .n-select {
flex: 0 1 520px;
width: min(100%, 520px);
min-width: 240px;
}
.host-inline-field > .host-value-text {
flex: 0 0 auto;
white-space: nowrap;
}
.host-inline-side,
.host-inline-field > .host-aside {
flex: 0 0 auto;
min-width: 0;
display: flex;
flex-wrap: nowrap;
align-items: center;
gap: 8px;
min-height: 34px;
}
.host-inline-field > .host-muted {
white-space: nowrap;
}
.host-aside {
color: var(--muted-color);
font-size: 13px;
line-height: 1.45;
}
.host-inline-buttons {
display: inline-flex;
align-items: center;
gap: 8px;
}
.host-settings-panel .settings-switch-list {
@@ -3889,15 +4066,16 @@ a {
.host-settings-panel .settings-switch-row {
display: grid;
grid-template-columns: 12em minmax(0, 1fr);
grid-template-columns: 12em auto auto minmax(0, 1fr);
column-gap: 10px;
align-items: center;
justify-content: start;
min-height: 34px;
padding: 0;
border-bottom: 0;
}
.host-settings-panel .settings-switch-row span {
.host-settings-panel .settings-switch-row > span:first-child {
min-height: 34px;
display: inline-flex;
align-items: center;
@@ -3905,16 +4083,27 @@ a {
text-align: right;
}
.host-settings-panel .settings-switch-row span::after {
.host-settings-panel .settings-switch-row > .host-value-text {
justify-content: flex-start;
white-space: nowrap;
}
.host-settings-panel .settings-switch-row > span:first-child::after {
content: ":";
}
.host-settings-panel .settings-switch-row .host-aside {
justify-content: flex-start;
text-align: left;
white-space: normal;
}
.host-settings-panel .settings-switch-row .n-switch {
justify-self: start;
}
.host-settings-panel .host-hint {
margin-left: calc(12em + 10px);
margin: 0;
}
.host-section-head {
@@ -3947,10 +4136,14 @@ a {
}
@media (min-width: 561px) {
.host-settings-panel .n-form-item--left-labelled .n-form-item-label {
.host-settings-main .n-form-item--left-labelled .n-form-item-label {
width: 12em !important;
}
.host-agent-float .n-form-item--left-labelled .n-form-item-label {
width: 4.5em !important;
}
.host-adapter-form .n-form-item--left-labelled .n-form-item-label {
width: 7.5em !important;
}
@@ -4218,6 +4411,9 @@ a {
}
.host-editor-section-title {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 14px;
font-weight: 700;
}
@@ -4386,6 +4582,9 @@ a {
}
.host-placeholder-group-title {
display: inline-flex;
align-items: center;
gap: 4px;
font-weight: 600;
}
+47 -28
View File
@@ -5,8 +5,10 @@
<n-tab-pane name="basic" :tab="t('settings.basic')" display-directive="show">
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.basic") }}</h2>
<p>{{ t("settings.basicDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.basic") }}
<hint-tip :text="t('settings.basicDesc')" />
</h2>
</div>
<div class="settings-fields settings-basic-fields">
<n-form-item :label="t('field.platformName')" path="app_name">
@@ -16,18 +18,23 @@
<n-select v-model:value="form.default_locale" :options="localeSelectOptions" placeholder="" />
</n-form-item>
<n-form-item :label="t('field.sessionTokenExpireHours')" path="session_token_expire_hours">
<n-input-number v-model:value="form.session_token_expire_hours" :min="0" :max="8760" :show-button="false" />
<div class="settings-control-line">
<n-input-number v-model:value="form.session_token_expire_hours" :min="0" :max="8760" :show-button="false" />
<hint-tip :text="t('settings.sessionExpireHelp')" />
</div>
</n-form-item>
</div>
<p class="settings-field-hint">{{ t("settings.sessionExpireHelp") }}</p>
</section>
</n-tab-pane>
<n-tab-pane name="navigation" :tab="t('settings.navigation')" display-directive="show" class="navigation-settings-pane">
<section class="settings-section navigation-settings-section">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.navigation") }}</h2>
<p>{{ t("settings.navigationDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.navigation") }}
<hint-tip :text="t('settings.navigationDesc')" />
</h2>
<n-button @click="resetNavigationOrder">{{ t("settings.restoreDefaultNavigation") }}</n-button>
</div>
<n-scrollbar class="navigation-order-scroll" trigger="none">
<div class="navigation-order-list">
@@ -80,17 +87,16 @@
</div>
</div>
</n-scrollbar>
<div class="settings-inline-actions">
<n-button @click="resetNavigationOrder">{{ t("settings.restoreDefaultNavigation") }}</n-button>
</div>
</section>
</n-tab-pane>
<n-tab-pane name="registration" :tab="t('settings.registration')" display-directive="show">
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.registration") }}</h2>
<p>{{ t("settings.registrationDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.registration") }}
<hint-tip :text="t('settings.registrationDesc')" />
</h2>
</div>
<div class="settings-switch-list">
<div class="settings-switch-row">
@@ -116,8 +122,10 @@
<n-tab-pane name="api" :tab="t('settings.api')" display-directive="show">
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.api") }}</h2>
<p>{{ t("settings.apiDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.api") }}
<hint-tip :text="t('settings.apiDesc')" />
</h2>
</div>
<div class="settings-switch-list">
<div class="settings-switch-row">
@@ -135,32 +143,40 @@
<n-tab-pane name="docker" :tab="t('settings.docker')" display-directive="show">
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.docker") }}</h2>
<p>{{ t("settings.dockerDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.docker") }}
<hint-tip :text="t('settings.dockerDesc')" />
</h2>
</div>
<n-form-item :label="t('field.dockerConnectionMode')" path="docker_connection_mode">
<n-select v-model:value="form.docker_connection_mode" :options="dockerConnectionModeOptions" placeholder="" />
</n-form-item>
<n-form-item :label="t('field.dockerHost')" path="docker_host">
<n-input
v-model:value="form.docker_host"
:disabled="form.docker_connection_mode === 'auto'"
:placeholder="t('settings.dockerHostPlaceholder')"
/>
<div class="settings-control-line">
<n-input
v-model:value="form.docker_host"
:disabled="form.docker_connection_mode === 'auto'"
:placeholder="t('settings.dockerHostPlaceholder')"
/>
<hint-tip :text="t('settings.dockerHostHelp')" />
</div>
</n-form-item>
<p class="settings-field-hint">{{ t("settings.dockerHostHelp") }}</p>
<n-form-item :label="t('field.containerJobRetentionHours')" path="container_job_retention_hours">
<n-input-number v-model:value="form.container_job_retention_hours" :min="1" :max="8760" :show-button="false" />
<div class="settings-control-line">
<n-input-number v-model:value="form.container_job_retention_hours" :min="1" :max="8760" :show-button="false" />
<hint-tip :text="t('settings.containerJobRetentionHelp')" />
</div>
</n-form-item>
<p class="settings-field-hint">{{ t("settings.containerJobRetentionHelp") }}</p>
</section>
</n-tab-pane>
<n-tab-pane name="audit" :tab="t('settings.audit')" display-directive="show">
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.audit") }}</h2>
<p>{{ t("settings.auditDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.audit") }}
<hint-tip :text="t('settings.auditDesc')" />
</h2>
</div>
<n-form-item :label="t('field.logRetention')" path="log_retention_days">
<n-select v-model:value="form.log_retention_days" :options="retentionOptions" placeholder="" />
@@ -171,8 +187,10 @@
<n-tab-pane name="dataJobs" :tab="t('settings.dataJobs')" display-directive="show">
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.dataJobs") }}</h2>
<p>{{ t("settings.dataJobsDesc") }}</p>
<h2 class="settings-section-title">
{{ t("settings.dataJobs") }}
<hint-tip :text="t('settings.dataJobsDesc')" />
</h2>
</div>
<n-form-item :label="t('field.dataJobMaxWorkers')" path="data_job_max_workers">
<n-input-number v-model:value="form.data_job_max_workers" :min="1" :max="16" :show-button="false" />
@@ -199,13 +217,13 @@
<section class="settings-section settings-section-compact">
<div class="settings-section-head">
<h2 class="settings-section-title">{{ t("settings.backup") }}</h2>
<p>{{ t("settings.backupDesc") }}</p>
</div>
<div class="settings-backup-panel">
<permission-button permission="action:setting:operate" type="primary" :loading="backingUp" @click="downloadBackup">
<template #icon><n-icon :component="Archive20Regular" /></template>
{{ t("settings.backupData") }}
</permission-button>
<hint-tip :text="t('settings.backupDesc')" />
</div>
</section>
</n-tab-pane>
@@ -245,6 +263,7 @@ import { computed, defineAsyncComponent, onMounted, reactive, ref } from "vue";
import { backupData, getSystemSettings, updateSystemSettings } from "../api/settings";
import type { SystemSettings } from "../api/types";
import HintTip from "../components/HintTip.vue";
import PermissionButton from "../components/PermissionButton.vue";
import { ensureLocaleNames, localeOptions, t } from "../i18n";
import { canUseHost } from "../modules/host/enabled";