fix: 优化病毒扫描样式 (#5577)

This commit is contained in:
ssongliu 2024-06-26 22:40:52 +08:00 committed by GitHub
parent eded682ecc
commit 2fafe3dcb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 33 additions and 24 deletions

View File

@ -60,11 +60,11 @@ func (f *ClamService) LoadBaseInfo() (dto.ClamBaseInfo, error) {
baseInfo.IsExist = true
baseInfo.IsActive, _ = systemctl.IsActive(clamServiceNameCentOs)
}
exist2, _ := systemctl.IsExist(clamServiceNameCentOs)
exist2, _ := systemctl.IsExist(clamServiceNameUbuntu)
if exist2 {
f.serviceName = clamServiceNameCentOs
f.serviceName = clamServiceNameUbuntu
baseInfo.IsExist = true
baseInfo.IsActive, _ = systemctl.IsActive(clamServiceNameCentOs)
baseInfo.IsActive, _ = systemctl.IsActive(clamServiceNameUbuntu)
}
if baseInfo.IsActive {
@ -246,25 +246,25 @@ func (u *ClamService) LoadFile(req dto.OperationWithName) (string, error) {
filePath := ""
switch req.Name {
case "clamd":
if u.serviceName == clamServiceNameCentOs {
if u.serviceName == clamServiceNameUbuntu {
filePath = "/etc/clamav/clamd.conf"
} else {
filePath = "/etc/clamd.d/scan.conf"
}
case "clamd-log":
if u.serviceName == clamServiceNameCentOs {
if u.serviceName == clamServiceNameUbuntu {
filePath = "/var/log/clamav/clamav.log"
} else {
filePath = "/var/log/clamd.scan"
}
case "freshclam":
if u.serviceName == clamServiceNameCentOs {
if u.serviceName == clamServiceNameUbuntu {
filePath = "/etc/clamav/freshclam.conf"
} else {
filePath = "/etc/freshclam.conf"
}
case "freshclam-log":
if u.serviceName == clamServiceNameCentOs {
if u.serviceName == clamServiceNameUbuntu {
filePath = "/var/log/clamav/freshclam.log"
} else {
filePath = "/var/log/clamav/freshclam.log"
@ -287,15 +287,15 @@ func (u *ClamService) UpdateFile(req dto.UpdateByNameAndFile) error {
service := ""
switch req.Name {
case "clamd":
if u.serviceName == clamServiceNameCentOs {
service = clamServiceNameCentOs
if u.serviceName == clamServiceNameUbuntu {
service = clamServiceNameUbuntu
filePath = "/etc/clamav/clamd.conf"
} else {
service = clamServiceNameCentOs
filePath = "/etc/clamd.d/scan.conf"
}
case "freshclam":
if u.serviceName == clamServiceNameCentOs {
if u.serviceName == clamServiceNameUbuntu {
filePath = "/etc/clamav/freshclam.conf"
} else {
filePath = "/etc/freshclam.conf"

View File

@ -1061,6 +1061,8 @@ const message = {
},
clam: {
clam: 'Virus Scan',
noClam: 'ClamAV service not detected, please refer to the official documentation for installation!',
notStart: 'ClamAV service is currently not running, please start it first!',
clamCreate: 'Create Scan Rule',
scanDate: 'Scan Date',
scanTime: 'Elapsed Time',

View File

@ -1003,6 +1003,8 @@ const message = {
},
clam: {
clam: '病毒掃描',
noClam: '未檢測到 ClamAV 服務請參考官方文檔進行安裝',
notStart: '目前沒有運行 ClamAV 服務請先啟動',
clamCreate: '創建掃描規則',
scanDate: '掃描時間',
scanTime: '耗時',

View File

@ -1005,6 +1005,8 @@ const message = {
},
clam: {
clam: '病毒扫描',
noClam: '未检测到 ClamAV 服务请参考官方文档进行安装',
notStart: '当前未 ClamAV 服务请先开启',
clamCreate: '创建扫描规则',
scanDate: '扫描时间',
scanTime: '耗时',

View File

@ -9,13 +9,17 @@
v-model:mask-show="maskShow"
/>
</template>
<template #toolbar>
<template #toolbar v-if="clamStatus.isExist">
<el-row>
<el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
<el-button type="primary" :disabled="!form.isActive" @click="onOpenDialog('add')">
<el-button type="primary" :disabled="!clamStatus.isRunning" @click="onOpenDialog('add')">
{{ $t('toolbox.clam.clamCreate') }}
</el-button>
<el-button plain :disabled="selects.length === 0 || !form.isActive" @click="onDelete(null)">
<el-button
plain
:disabled="selects.length === 0 || !clamStatus.isRunning"
@click="onDelete(null)"
>
{{ $t('commons.button.delete') }}
</el-button>
</el-col>
@ -24,8 +28,12 @@
</el-col>
</el-row>
</template>
<template #main>
<el-card v-if="!clamStatus.isRunning && maskShow" class="mask-prompt">
<span>{{ $t('toolbox.clam.notStart') }}</span>
</el-card>
<template #main v-if="clamStatus.isExist">
<ComplexTable
:class="{ mask: !clamStatus.isRunning }"
v-if="!isSettingShow"
:pagination-config="paginationConfig"
v-model:selects="selects"
@ -100,11 +108,6 @@ const paginationConfig = reactive({
});
const searchName = ref();
const form = reactive({
isActive: true,
isExist: true,
});
const opRef = ref();
const dialogRef = ref();
const operateIDs = ref();
@ -115,8 +118,7 @@ const isSettingShow = ref();
const maskShow = ref(true);
const clamStatus = ref({
isExist: false,
version: false,
isActive: true,
isRunning: true,
});
const search = async () => {
@ -142,6 +144,7 @@ const setting = () => {
};
const getStatus = (status: any) => {
clamStatus.value = status;
console.log(clamStatus.value);
search();
};

View File

@ -30,11 +30,11 @@
</div>
</el-card>
</div>
<LayoutContent :title="$t('tool.supervisor.list')" :divider="true" v-if="!data.isExist" v-loading="loading">
<LayoutContent :title="$t('toolbox.clam.clam')" :divider="true" v-if="!data.isExist" v-loading="loading">
<template #main>
<div class="app-warn">
<div>
<span v-if="!data.isExist">{{ $t('tool.supervisor.notSupport') }}</span>
<span v-if="!data.isExist">{{ $t('toolbox.clam.noClam') }}</span>
<span @click="toDoc()" v-if="!data.isExist">
<el-icon class="ml-2"><Position /></el-icon>
{{ $t('firewall.quickJump') }}
@ -69,7 +69,7 @@ const setting = () => {
};
const toDoc = async () => {
window.open('https://1panel.cn/docs/user_manual/toolbox/supervisor/', '_blank', 'noopener,noreferrer');
window.open('https://1panel.cn/docs/user_manual/toolbox/clam/', '_blank', 'noopener,noreferrer');
};
const onOperate = async (operation: string) => {