1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-17 19:24:44 +08:00

fix: 防火墙空状态页面样式优化 (#625)

This commit is contained in:
ssongliu 2023-04-14 15:08:51 +08:00 committed by GitHub
parent 975663f0ff
commit 4c8fc1defa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 254 additions and 189 deletions

View File

@ -161,27 +161,3 @@ onMounted(() => {
onCheck(); onCheck();
}); });
</script> </script>
<style lang="scss">
.app-warn {
text-align: center;
margin-top: 100px;
span:first-child {
color: #bbbfc4;
}
span:nth-child(2) {
color: $primary-color;
cursor: pointer;
}
span:nth-child(2):hover {
color: #74a4f3;
}
img {
width: 300px;
height: 300px;
}
}
</style>

View File

@ -1227,6 +1227,8 @@ const message = {
'This certificate has been associated with the following websites, and the renewal will be applied to these websites simultaneously', 'This certificate has been associated with the following websites, and the renewal will be applied to these websites simultaneously',
}, },
firewall: { firewall: {
notSupport:
'No system firewall detected (firewalld or ufw). Please refer to the official documentation for installation.',
ccDeny: 'CC Protection', ccDeny: 'CC Protection',
ipWhiteList: 'IP Whitelist', ipWhiteList: 'IP Whitelist',
ipBlockList: 'IP Blacklist', ipBlockList: 'IP Blacklist',

View File

@ -1220,6 +1220,7 @@ const message = {
createAcme: '创建账户', createAcme: '创建账户',
}, },
firewall: { firewall: {
notSupport: '未检测到系统防火墙firewalld 或者 ufw请参考官方文档进行安装',
ccDeny: 'CC 防护', ccDeny: 'CC 防护',
ipWhiteList: 'IP 白名单', ipWhiteList: 'IP 白名单',
ipBlockList: 'IP 黑名单', ipBlockList: 'IP 黑名单',

View File

@ -302,3 +302,25 @@
.table-link:hover { .table-link:hover {
opacity: 0.6; opacity: 0.6;
} }
.app-warn {
text-align: center;
margin-top: 100px;
span:first-child {
color: #bbbfc4;
}
span:nth-child(2) {
color: $primary-color;
cursor: pointer;
}
span:nth-child(2):hover {
color: #74a4f3;
}
img {
width: 300px;
height: 300px;
}
}

View File

@ -2,13 +2,16 @@
<div v-loading="loading" style="position: relative"> <div v-loading="loading" style="position: relative">
<FireRouter /> <FireRouter />
<FireStatus <FireStatus
v-show="fireName !== '-'"
ref="fireStatuRef" ref="fireStatuRef"
@search="search" @search="search"
v-model:loading="loading" v-model:loading="loading"
v-model:name="fireName"
v-model:mask-show="maskShow" v-model:mask-show="maskShow"
v-model:status="fireStatus" v-model:status="fireStatus"
/> />
<div v-if="fireName !== '-'">
<el-card v-if="fireStatus != 'running' && maskShow" class="mask-prompt"> <el-card v-if="fireStatus != 'running' && maskShow" class="mask-prompt">
<span>{{ $t('firewall.firewallNotStart') }}</span> <span>{{ $t('firewall.firewallNotStart') }}</span>
</el-card> </el-card>
@ -79,6 +82,29 @@
</ComplexTable> </ComplexTable>
</template> </template>
</LayoutContent> </LayoutContent>
</div>
<div v-else>
<LayoutContent :title="$t('firewall.firewall')" :divider="true">
<template #main>
<div class="app-warn">
<div>
<span>{{ $t('firewall.notSupport') }}</span>
<el-link
style="font-size: 12px; margin-left: 5px"
@click="toDoc"
icon="Position"
type="primary"
>
{{ $t('firewall.quickJump') }}
</el-link>
<div>
<img src="@/assets/images/no_app.svg" />
</div>
</div>
</div>
</template>
</LayoutContent>
</div>
<OperatrDialog @search="search" ref="dialogRef" /> <OperatrDialog @search="search" ref="dialogRef" />
</div> </div>
@ -102,6 +128,7 @@ const loading = ref();
const activeTag = ref('address'); const activeTag = ref('address');
const selects = ref<any>([]); const selects = ref<any>([]);
const searchName = ref(); const searchName = ref();
const fireName = ref();
const maskShow = ref(true); const maskShow = ref(true);
const fireStatus = ref('running'); const fireStatus = ref('running');
@ -153,6 +180,10 @@ const onOpenDialog = async (
dialogRef.value!.acceptParams(params); dialogRef.value!.acceptParams(params);
}; };
const toDoc = () => {
window.open('https://1panel.cn/docs/user_manual/hosts/firewall/', '_blank');
};
const onChangeStatus = async (row: Host.RuleInfo, status: string) => { const onChangeStatus = async (row: Host.RuleInfo, status: string) => {
let operation = let operation =
status === 'accept' status === 'accept'
@ -244,7 +275,9 @@ const buttons = [
]; ];
onMounted(() => { onMounted(() => {
if (fireName.value !== '-') {
loading.value = true; loading.value = true;
fireStatuRef.value.acceptParams(); fireStatuRef.value.acceptParams();
}
}); });
</script> </script>

View File

@ -3,6 +3,7 @@
<FireRouter /> <FireRouter />
<FireStatus <FireStatus
v-show="fireName !== '-'"
ref="fireStatuRef" ref="fireStatuRef"
@search="search" @search="search"
v-model:loading="loading" v-model:loading="loading"
@ -10,7 +11,7 @@
v-model:status="fireStatus" v-model:status="fireStatus"
v-model:name="fireName" v-model:name="fireName"
/> />
<div v-if="fireName !== '-'">
<el-card v-if="fireStatus != 'running' && maskShow" class="mask-prompt"> <el-card v-if="fireStatus != 'running' && maskShow" class="mask-prompt">
<span>{{ $t('firewall.firewallNotStart') }}</span> <span>{{ $t('firewall.firewallNotStart') }}</span>
</el-card> </el-card>
@ -73,7 +74,9 @@
<template #default="{ row }"> <template #default="{ row }">
<el-tag type="info" v-if="row.isUsed"> <el-tag type="info" v-if="row.isUsed">
{{ {{
row.appName ? $t('firewall.used') + ' ( ' + row.appName + ' )' : $t('firewall.used') row.appName
? $t('firewall.used') + ' ( ' + row.appName + ' )'
: $t('firewall.used')
}} }}
</el-tag> </el-tag>
<el-tag type="success" v-else>{{ $t('firewall.unUsed') }}</el-tag> <el-tag type="success" v-else>{{ $t('firewall.unUsed') }}</el-tag>
@ -111,6 +114,29 @@
</ComplexTable> </ComplexTable>
</template> </template>
</LayoutContent> </LayoutContent>
</div>
<div v-else>
<LayoutContent :title="$t('firewall.firewall')" :divider="true">
<template #main>
<div class="app-warn">
<div>
<span>{{ $t('firewall.notSupport') }}</span>
<el-link
style="font-size: 12px; margin-left: 5px"
@click="toDoc"
icon="Position"
type="primary"
>
{{ $t('firewall.quickJump') }}
</el-link>
<div>
<img src="@/assets/images/no_app.svg" />
</div>
</div>
</div>
</template>
</LayoutContent>
</div>
<OperatrDialog @search="search" ref="dialogRef" /> <OperatrDialog @search="search" ref="dialogRef" />
</div> </div>
@ -192,6 +218,9 @@ const onOpenDialog = async (
const quickJump = () => { const quickJump = () => {
router.push({ name: 'ContainerSetting' }); router.push({ name: 'ContainerSetting' });
}; };
const toDoc = () => {
window.open('https://1panel.cn/docs/user_manual/hosts/firewall/', '_blank');
};
const onChangeStatus = async (row: Host.RuleInfo, status: string) => { const onChangeStatus = async (row: Host.RuleInfo, status: string) => {
let operation = let operation =
@ -300,7 +329,9 @@ const buttons = [
]; ];
onMounted(() => { onMounted(() => {
if (fireName.value !== '-') {
loading.value = true; loading.value = true;
fireStatuRef.value.acceptParams(); fireStatuRef.value.acceptParams();
}
}); });
</script> </script>

View File

@ -91,7 +91,7 @@ const onOperate = async (operation: string) => {
loadBaseInfo(true); loadBaseInfo(true);
}) })
.catch(() => { .catch(() => {
emit('update:loading', false); loadBaseInfo(true);
}); });
}) })
.catch(() => { .catch(() => {