feat: 添加 Docker 环境轮询监听支持并优化渲染设置卡片样式
This commit is contained in:
@@ -530,14 +530,18 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.switch-group {
|
.switch-group {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.switch-row {
|
.rendering-settings-card .switch-group {
|
||||||
width: 100%;
|
margin-bottom: 24px;
|
||||||
display: flex;
|
}
|
||||||
|
|
||||||
|
.switch-row {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
|||||||
@@ -404,11 +404,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else-if="activeSection === 'rendering'">
|
<template v-else-if="activeSection === 'rendering'">
|
||||||
<section class="settings-card">
|
<section class="settings-card rendering-settings-card">
|
||||||
<div class="card-head">
|
<div class="card-head">
|
||||||
<div>
|
<div>
|
||||||
<h4>ONLYOFFICE 服务配置</h4>
|
<h4>ONLYOFFICE 服务配置</h4>
|
||||||
<p>维护文件渲染开关、文档服务对外地址和 JWT 密钥。后端回调地址继续由部署配置管理。</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ const SECTION_DEFINITIONS = [
|
|||||||
{
|
{
|
||||||
id: 'rendering',
|
id: 'rendering',
|
||||||
label: '文件渲染',
|
label: '文件渲染',
|
||||||
title: 'ONLYOFFICE 文件渲染配置',
|
title: '文件渲染',
|
||||||
desc: '文档预览服务与访问密钥',
|
desc: '文档预览服务与访问密钥',
|
||||||
longDesc: '集中管理 ONLYOFFICE 文件渲染开关、文档服务地址和 JWT 密钥。服务端内部回调地址继续由部署配置维护。',
|
longDesc: '维护文件渲染开关、文档服务对外地址和 JWT 密钥,后端回调地址继续由部署配置管理。',
|
||||||
actionLabel: '保存文件渲染配置'
|
actionLabel: '保存文件渲染配置'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
30
web/tests/settings-rendering-section.test.mjs
Normal file
30
web/tests/settings-rendering-section.test.mjs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import { readFileSync } from 'node:fs'
|
||||||
|
|
||||||
|
const settingsScript = readFileSync(new URL('../src/views/scripts/SettingsView.js', import.meta.url), 'utf8')
|
||||||
|
const settingsView = readFileSync(new URL('../src/views/SettingsView.vue', import.meta.url), 'utf8')
|
||||||
|
const settingsStyles = readFileSync(new URL('../src/assets/styles/views/settings-view.css', import.meta.url), 'utf8')
|
||||||
|
|
||||||
|
function testRenderingSectionUsesConciseToolbarTitle() {
|
||||||
|
assert.match(settingsScript, /title:\s*'文件渲染'/)
|
||||||
|
assert.doesNotMatch(settingsScript, /title:\s*'ONLYOFFICE 文件渲染配置'/)
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRenderingCardRemovesDuplicatedDescription() {
|
||||||
|
assert.match(settingsView, /<h4>ONLYOFFICE 服务配置<\/h4>/)
|
||||||
|
assert.doesNotMatch(settingsView, /维护文件渲染开关、文档服务对外地址和 JWT 密钥。后端回调地址继续由部署配置管理。/)
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRenderingSectionAddsSpacingBetweenSwitchAndInputs() {
|
||||||
|
assert.match(settingsView, /<section class="settings-card rendering-settings-card">/)
|
||||||
|
assert.match(settingsStyles, /\.rendering-settings-card \.switch-group \{\s*margin-bottom: 24px;\s*\}/)
|
||||||
|
}
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
testRenderingSectionUsesConciseToolbarTitle()
|
||||||
|
testRenderingCardRemovesDuplicatedDescription()
|
||||||
|
testRenderingSectionAddsSpacingBetweenSwitchAndInputs()
|
||||||
|
console.log('settings rendering section tests passed')
|
||||||
|
}
|
||||||
|
|
||||||
|
run()
|
||||||
@@ -8,12 +8,13 @@ import { fileURLToPath } from 'node:url'
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
const rootDir = path.resolve(__dirname, '..')
|
const rootDir = path.resolve(__dirname, '..')
|
||||||
const envFile = path.join(rootDir, '.env')
|
const envFile = path.join(rootDir, '.env')
|
||||||
const envExampleFile = path.join(rootDir, '.env.example')
|
const envExampleFile = path.join(rootDir, '.env.example')
|
||||||
const adminSecretDir = path.join(rootDir, 'server', '.secrets')
|
const preferPollingWatcher = fs.existsSync('/.dockerenv') || process.env.VITE_USE_POLLING === 'true'
|
||||||
const adminSecretFile = path.join(adminSecretDir, 'admin.json')
|
const adminSecretDir = path.join(rootDir, 'server', '.secrets')
|
||||||
|
const adminSecretFile = path.join(adminSecretDir, 'admin.json')
|
||||||
const adminScryptOptions = { N: 16384, r: 8, p: 1 }
|
const adminScryptOptions = { N: 16384, r: 8, p: 1 }
|
||||||
const adminScryptKeyLength = 64
|
const adminScryptKeyLength = 64
|
||||||
let backendStartPromise = null
|
let backendStartPromise = null
|
||||||
@@ -1022,11 +1023,18 @@ function localSetupPlugin() {
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
envDir: '..',
|
envDir: '..',
|
||||||
server: {
|
server: {
|
||||||
watch: {
|
watch: {
|
||||||
ignored: [
|
...(preferPollingWatcher
|
||||||
envFile,
|
? {
|
||||||
envExampleFile,
|
// Docker bind mounts can miss fs events for Vue SFCs, which leaves Vite serving stale templates.
|
||||||
|
usePolling: true,
|
||||||
|
interval: 250
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
ignored: [
|
||||||
|
envFile,
|
||||||
|
envExampleFile,
|
||||||
path.join(rootDir, 'server', 'logs', '**')
|
path.join(rootDir, 'server', 'logs', '**')
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user