Skip to content

Commit 6975525

Browse files
committed
feat: 添加预发布版本提醒和检测功能
1 parent 90cb5a1 commit 6975525

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

dashboard/src/i18n/locales/en-US/core/header.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"dev": "🧐 Development (master branch)"
2626
},
2727
"updateToLatest": "Update to Latest Version",
28+
"preRelease": "Pre-release",
29+
"preReleaseWarning": {
30+
"title": "Pre-release Version Notice",
31+
"description": "Versions marked as pre-release may contain unknown issues or bugs and are not recommended for production use. If you encounter any problems, please visit ",
32+
"issueLink": "GitHub Issues"
33+
},
2834
"tip": "💡 TIP: Switching to an older version or a specific version will not re-download the dashboard files, which may cause some data display errors. You can find the corresponding dashboard files dist.zip at",
2935
"tipLink": "here",
3036
"tipContinue": ", extract and replace the data/dist folder. Of course, the frontend source code is in the dashboard directory, you can also build it yourself using npm install and npm build.",

dashboard/src/i18n/locales/zh-CN/core/header.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"dev": "🧐 开发版(master 分支)"
2626
},
2727
"updateToLatest": "更新到最新版本",
28+
"preRelease": "预发布",
29+
"preReleaseWarning": {
30+
"title": "预发布版本提醒",
31+
"description": "标有预发布标签的版本可能存在未知问题或 Bug,不建议在生产环境使用。如发现问题,请提交至 ",
32+
"issueLink": "GitHub Issues"
33+
},
2834
"tip": "💡 TIP: 跳到旧版本或者切换到某个版本不会重新下载管理面板文件,这可能会造成部分数据显示错误。您可在",
2935
"tipLink": "此处",
3036
"tipContinue": "找到对应的面板文件 dist.zip,解压后替换 data/dist 文件夹即可。当然,前端源代码在 dashboard 目录下,你也可以自己使用 npm install 和 npm build 构建。",

dashboard/src/layouts/full/vertical-header/VerticalHeader.vue

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ const open = (link: string) => {
7676
window.open(link, '_blank');
7777
};
7878
79+
// 检测是否为预发布版本
80+
const isPreRelease = (version: string) => {
81+
const preReleaseKeywords = ['alpha', 'beta', 'rc', 'pre', 'preview', 'dev'];
82+
const lowerVersion = version.toLowerCase();
83+
return preReleaseKeywords.some(keyword => lowerVersion.includes(keyword));
84+
};
85+
7986
// 账户修改
8087
function accountEdit() {
8188
accountEditStatus.value.loading = true;
@@ -305,7 +312,7 @@ commonStore.getStartTime();
305312
</v-btn>
306313

307314
<!-- 更新对话框 -->
308-
<v-dialog v-model="updateStatusDialog" :width="$vuetify.display.smAndDown ? '100%' : '1000'" :fullscreen="$vuetify.display.xs">
315+
<v-dialog v-model="updateStatusDialog" :width="$vuetify.display.smAndDown ? '100%' : '1200'" :fullscreen="$vuetify.display.xs">
309316
<template v-slot:activator="{ props }">
310317
<v-btn size="small" @click="checkUpdate(); getReleases(); getDevCommits();" class="action-btn"
311318
color="var(--v-theme-surface)" variant="flat" rounded="sm" v-bind="props">
@@ -357,11 +364,44 @@ commonStore.getStartTime();
357364
href="https://containrrr.dev/watchtower/usage-overview/">{{ t('core.header.updateDialog.dockerTipLink') }}</a> {{ t('core.header.updateDialog.dockerTipContinue') }}</small>
358365
</div>
359366

367+
<v-alert
368+
v-if="releases.some(item => isPreRelease(item.tag_name))"
369+
type="warning"
370+
variant="tonal"
371+
border="start"
372+
>
373+
<template v-slot:prepend>
374+
<v-icon>mdi-alert-circle-outline</v-icon>
375+
</template>
376+
<div class="text-body-2">
377+
<strong>{{ t('core.header.updateDialog.preReleaseWarning.title') }}</strong>
378+
<br>
379+
{{ t('core.header.updateDialog.preReleaseWarning.description') }}
380+
<a href="https://github.com/Soulter/AstrBot/issues" target="_blank" class="text-decoration-none">
381+
{{ t('core.header.updateDialog.preReleaseWarning.issueLink') }}
382+
</a>
383+
</div>
384+
</v-alert>
385+
360386
<v-data-table :headers="releasesHeader" :items="releases" item-key="name">
387+
<template v-slot:item.tag_name="{ item }: { item: { tag_name: string } }">
388+
<div class="d-flex align-center">
389+
<span>{{ item.tag_name }}</span>
390+
<v-chip
391+
v-if="isPreRelease(item.tag_name)"
392+
size="x-small"
393+
color="warning"
394+
variant="tonal"
395+
class="ml-2"
396+
>
397+
{{ t('core.header.updateDialog.preRelease') }}
398+
</v-chip>
399+
</div>
400+
</template>
361401
<template v-slot:item.body="{ item }: { item: { body: string } }">
362402
<v-tooltip :text="item.body">
363403
<template v-slot:activator="{ props }">
364-
<v-btn v-bind="props" rounded="xl" variant="tonal" color="primary" size="small">{{ t('core.header.updateDialog.table.view') }}</v-btn>
404+
<v-btn v-bind="props" rounded="xl" variant="tonal" color="primary" size="x-small">{{ t('core.header.updateDialog.table.view') }}</v-btn>
365405
</template>
366406
</v-tooltip>
367407
</template>

0 commit comments

Comments
 (0)