fix: Firewall remove status filtering (#11868)

This commit is contained in:
ssongliu
2026-02-11 14:02:34 +08:00
committed by GitHub
parent 39691698c9
commit 79ff565995
9 changed files with 3 additions and 32 deletions
+2 -16
View File
@@ -112,29 +112,15 @@ func (u *FirewallService) SearchWithPage(req dto.RuleSearch) (int64, interface{}
}
}
var datasFilterStatus []fireClient.FireInfo
if len(req.Status) != 0 {
for _, data := range datas {
if req.Status == "free" && len(data.UsedStatus) == 0 {
datasFilterStatus = append(datasFilterStatus, data)
}
if req.Status == "used" && len(data.UsedStatus) != 0 {
datasFilterStatus = append(datasFilterStatus, data)
}
}
} else {
datasFilterStatus = datas
}
var datasFilterStrategy []fireClient.FireInfo
if len(req.Strategy) != 0 {
for _, data := range datasFilterStatus {
for _, data := range datas {
if req.Strategy == data.Strategy {
datasFilterStrategy = append(datasFilterStrategy, data)
}
}
} else {
datasFilterStrategy = datasFilterStatus
datasFilterStrategy = datas
}
total, start, end := len(datasFilterStrategy), (req.Page-1)*req.PageSize, req.Page*req.PageSize
-1
View File
@@ -74,7 +74,6 @@ export namespace Host {
pingStatus: string;
}
export interface RuleSearch extends ReqPage {
status: string;
strategy: string;
info: string;
type: string;
@@ -109,7 +109,6 @@ const acceptParams = async (fireName: string): Promise<void> => {
const loadCurrentData = async (fireName: string) => {
const res = await searchFireRule({
type: 'forward',
status: '',
strategy: '',
info: '',
page: 1,
@@ -111,7 +111,6 @@ const loading = ref();
const activeTag = ref('forward');
const selects = ref<any>([]);
const searchName = ref();
const searchStatus = ref('');
const searchStrategy = ref('');
const maskShow = ref(true);
@@ -141,7 +140,6 @@ const search = async () => {
}
let params = {
type: activeTag.value,
status: searchStatus.value,
strategy: searchStrategy.value,
info: searchName.value,
page: paginationConfig.currentPage,
@@ -103,7 +103,6 @@ const acceptParams = async (): Promise<void> => {
const loadCurrentData = async () => {
const res = await searchFireRule({
type: 'address',
status: '',
strategy: '',
info: '',
page: 1,
@@ -163,7 +163,6 @@ const search = async () => {
}
let params = {
type: activeTag.value,
status: '',
strategy: searchStrategy.value,
info: searchName.value,
page: paginationConfig.currentPage,
@@ -106,7 +106,6 @@ const acceptParams = async (): Promise<void> => {
const loadCurrentData = async () => {
const res = await searchFireRule({
type: 'port',
status: '',
strategy: '',
info: '',
page: 1,
@@ -59,12 +59,6 @@
</el-button-group>
</template>
<template #rightToolBar>
<el-select v-model="searchStatus" @change="search()" clearable class="p-w-200">
<template #prefix>{{ $t('commons.table.status') }}</template>
<el-option :label="$t('commons.table.all')" value=""></el-option>
<el-option :label="$t('firewall.unUsed')" value="free"></el-option>
<el-option :label="$t('firewall.used')" value="used"></el-option>
</el-select>
<el-select v-model="searchStrategy" @change="search()" clearable class="p-w-200">
<template #prefix>{{ $t('firewall.strategy') }}</template>
<el-option :label="$t('commons.table.all')" value=""></el-option>
@@ -181,7 +175,6 @@ const loading = ref();
const activeTag = ref('port');
const selects = ref<any>([]);
const searchName = ref();
const searchStatus = ref('');
const searchStrategy = ref('');
const maskShow = ref(true);
@@ -253,7 +246,6 @@ const search = async () => {
}
let params = {
type: activeTag.value,
status: searchStatus.value,
strategy: searchStrategy.value,
info: searchName.value,
page: paginationConfig.currentPage,
@@ -54,7 +54,7 @@
</div>
<NoSuchService v-else name="Firewalld / Ufw / iptables" />
<LayoutContent :divider="true" v-if="baseInfo.isExist && !baseInfo.isInit">
<LayoutContent :divider="true" v-if="baseInfo.isExist && baseInfo.isActive && !baseInfo.isInit">
<template #main>
<div class="app-warn">
<div class="flex flex-col gap-2 items-center justify-center w-full sm:flex-row">