1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-02-08 01:20:07 +08:00

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

View File

@ -1061,6 +1061,8 @@ const message = {
}, },
clam: { clam: {
clam: 'Virus Scan', 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', clamCreate: 'Create Scan Rule',
scanDate: 'Scan Date', scanDate: 'Scan Date',
scanTime: 'Elapsed Time', scanTime: 'Elapsed Time',

View File

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

View File

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

View File

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

View File

@ -30,11 +30,11 @@
</div> </div>
</el-card> </el-card>
</div> </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> <template #main>
<div class="app-warn"> <div class="app-warn">
<div> <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"> <span @click="toDoc()" v-if="!data.isExist">
<el-icon class="ml-2"><Position /></el-icon> <el-icon class="ml-2"><Position /></el-icon>
{{ $t('firewall.quickJump') }} {{ $t('firewall.quickJump') }}
@ -69,7 +69,7 @@ const setting = () => {
}; };
const toDoc = async () => { 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) => { const onOperate = async (operation: string) => {