mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-09-01 14:53:07 +08:00
feat(frontend): show UI build version on system info page
Inject the frontend package.json version at build time via Vite and render it as a dedicated "UI Version" row in System Info, alongside the existing app (backend) version returned by /system/info. When the two versions differ a warning tag is shown so users can tell at a glance that their weknora-ui image is out of sync with weknora-app (e.g. missing config fields for newer providers like SearXNG). Rename the existing version row label from "System Version" to "App Version" to distinguish it from the new UI version row in all four locales (zh-CN, en-US, ko-KR, ru-RU).
This commit is contained in:
Vendored
+3
-1
@@ -3,4 +3,6 @@
|
||||
// 这段代码告诉 TypeScript,所有以 .vue 结尾的文件都是 Vue 组件,可以通过 import 语句进行导入。这样做通常可以解决无法识别模块的问题。
|
||||
declare module '*.vue' {
|
||||
import { Component } from 'vue'; const component: Component; export default component;
|
||||
}
|
||||
}
|
||||
|
||||
declare const __FRONTEND_VERSION__: string;
|
||||
@@ -2405,8 +2405,11 @@ export default {
|
||||
sectionDescription: 'View system version information and user account configuration',
|
||||
loadingInfo: 'Loading information...',
|
||||
retry: 'Retry',
|
||||
versionLabel: 'System Version',
|
||||
versionDescription: 'Current version number of the system',
|
||||
versionLabel: 'App Version',
|
||||
versionDescription: 'Version of the application service (weknora-app)',
|
||||
frontendVersionLabel: 'UI Version',
|
||||
frontendVersionDescription: 'Build version of the UI (weknora-ui)',
|
||||
versionMismatch: 'Mismatch with app version',
|
||||
buildTimeLabel: 'Build Time',
|
||||
buildTimeDescription: 'Time when the system was built',
|
||||
goVersionLabel: 'Go Version',
|
||||
|
||||
@@ -1663,8 +1663,11 @@ export default {
|
||||
sectionDescription: "시스템 버전 정보 및 사용자 계정 설정 보기",
|
||||
loadingInfo: "정보 로딩 중...",
|
||||
retry: "재시도",
|
||||
versionLabel: "시스템 버전",
|
||||
versionDescription: "현재 시스템의 버전 번호",
|
||||
versionLabel: "앱 버전",
|
||||
versionDescription: "애플리케이션 서비스(weknora-app)의 버전 번호",
|
||||
frontendVersionLabel: "UI 버전",
|
||||
frontendVersionDescription: "UI(weknora-ui) 빌드 버전 번호",
|
||||
versionMismatch: "앱 버전과 일치하지 않음",
|
||||
buildTimeLabel: "빌드 시간",
|
||||
buildTimeDescription: "시스템이 빌드된 시간",
|
||||
goVersionLabel: "Go 버전",
|
||||
|
||||
@@ -1480,8 +1480,11 @@ export default {
|
||||
sectionDescription: 'Просмотр сведений о версии системы и конфигурации учётной записи пользователя',
|
||||
loadingInfo: 'Загрузка данных...',
|
||||
retry: 'Повторить',
|
||||
versionLabel: 'Версия системы',
|
||||
versionDescription: 'Текущий номер версии системы',
|
||||
versionLabel: 'Версия приложения',
|
||||
versionDescription: 'Версия сервиса приложения (weknora-app)',
|
||||
frontendVersionLabel: 'Версия UI',
|
||||
frontendVersionDescription: 'Версия сборки UI (weknora-ui)',
|
||||
versionMismatch: 'Не совпадает с версией приложения',
|
||||
buildTimeLabel: 'Время сборки',
|
||||
buildTimeDescription: 'Время, когда система была собрана',
|
||||
goVersionLabel: 'Версия Go',
|
||||
|
||||
@@ -1643,8 +1643,11 @@ export default {
|
||||
sectionDescription: "查看系统版本信息和用户账户配置",
|
||||
loadingInfo: "正在加载信息...",
|
||||
retry: "重试",
|
||||
versionLabel: "系统版本",
|
||||
versionDescription: "当前系统的版本号",
|
||||
versionLabel: "应用版本",
|
||||
versionDescription: "当前应用服务(weknora-app)的版本号",
|
||||
frontendVersionLabel: "UI 版本",
|
||||
frontendVersionDescription: "当前 UI 界面(weknora-ui)的构建版本号",
|
||||
versionMismatch: "与应用版本不一致",
|
||||
buildTimeLabel: "构建时间",
|
||||
buildTimeDescription: "系统构建的时间",
|
||||
goVersionLabel: "Go 版本",
|
||||
|
||||
@@ -45,6 +45,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Frontend version -->
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<label>{{ $t('system.frontendVersionLabel') }}</label>
|
||||
<p class="desc">{{ $t('system.frontendVersionDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<span class="info-value">
|
||||
{{ frontendVersion }}
|
||||
<t-tag
|
||||
v-if="systemInfo?.version && systemInfo.version !== 'unknown' && frontendVersion !== 'unknown' && systemInfo.version !== frontendVersion"
|
||||
theme="warning"
|
||||
variant="light"
|
||||
size="small"
|
||||
style="margin-left: 8px;"
|
||||
>{{ $t('system.versionMismatch') }}</t-tag>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Build time -->
|
||||
<div v-if="systemInfo?.build_time" class="setting-row">
|
||||
<div class="setting-info">
|
||||
@@ -126,6 +146,7 @@ const { t } = useI18n()
|
||||
const systemInfo = ref<SystemInfo | null>(null)
|
||||
const loading = ref(true)
|
||||
const error = ref('')
|
||||
const frontendVersion = __FRONTEND_VERSION__
|
||||
|
||||
// Methods
|
||||
const loadInfo = async () => {
|
||||
|
||||
@@ -9,6 +9,9 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
const pkg = require('./package.json') as { version?: string }
|
||||
const FRONTEND_VERSION = pkg.version ?? 'unknown'
|
||||
|
||||
function resolveVueOfficePptxEntry(): string {
|
||||
try {
|
||||
const pkgDir = dirname(require.resolve('@vue-office/pptx/package.json'))
|
||||
@@ -25,6 +28,9 @@ function resolveVueOfficePptxEntry(): string {
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
__FRONTEND_VERSION__: JSON.stringify(FRONTEND_VERSION),
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
|
||||
Reference in New Issue
Block a user