feat: Certificate list supports search by name and hides specified co… (#8410)

Refs https://github.com/1Panel-dev/1Panel/issues/7550
This commit is contained in:
ChengPlay
2025-04-16 09:38:19 +00:00
committed by GitHub
parent 9ffc601cf0
commit b520b748c6
6 changed files with 38 additions and 22 deletions
+1
View File
@@ -5,6 +5,7 @@ import "github.com/1Panel-dev/1Panel/agent/app/dto"
type WebsiteSSLSearch struct {
dto.PageInfo
AcmeAccountID string `json:"acmeAccountID"`
Domain string `json:"domain"`
}
type WebsiteSSLCreate struct {
+6
View File
@@ -16,6 +16,7 @@ type ISSLRepo interface {
WithByAcmeAccountId(acmeAccountId uint) DBOption
WithByDnsAccountId(dnsAccountId uint) DBOption
WithByCAID(caID uint) DBOption
WithByDomain(domain string) DBOption
Page(page, size int, opts ...DBOption) (int64, []model.WebsiteSSL, error)
GetFirst(opts ...DBOption) (*model.WebsiteSSL, error)
List(opts ...DBOption) ([]model.WebsiteSSL, error)
@@ -51,6 +52,11 @@ func (w WebsiteSSLRepo) WithByCAID(caID uint) DBOption {
return db.Where("ca_id = ?", caID)
}
}
func (w WebsiteSSLRepo) WithByDomain(domain string) DBOption {
return func(db *gorm.DB) *gorm.DB {
return db.Where("primary_domain Like ? or domains Like ?", "%"+domain+"%", "%"+domain+"%")
}
}
func (w WebsiteSSLRepo) Page(page, size int, opts ...DBOption) (int64, []model.WebsiteSSL, error) {
var sslList []model.WebsiteSSL
+1 -1
View File
@@ -935,7 +935,7 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
t.Log(i18n.GetMsgByKey("AppStoreIsSyncing"))
return nil
}
t.Log(i18n.GetMsgByKey("AppStoreIsLastVersion"))
t.Log(i18n.GetMsgByKey("AppStoreIsUpToDate"))
return nil
}
list := &dto.AppList{}
+6 -1
View File
@@ -56,8 +56,13 @@ func NewIWebsiteSSLService() IWebsiteSSLService {
func (w WebsiteSSLService) Page(search request.WebsiteSSLSearch) (int64, []response.WebsiteSSLDTO, error) {
var (
result []response.WebsiteSSLDTO
opts []repo.DBOption
)
total, sslList, err := websiteSSLRepo.Page(search.Page, search.PageSize, repo.WithOrderBy("created_at desc"))
opts = append(opts, repo.WithOrderBy("created_at desc"))
if search.Domain != "" {
opts = append(opts, websiteSSLRepo.WithByDomain(search.Domain))
}
total, sslList, err := websiteSSLRepo.Page(search.Page, search.PageSize, opts...)
if err != nil {
return 0, nil, err
}
-1
View File
@@ -82,7 +82,6 @@ PullImageStart: "开始拉取镜像 {{ .name }}"
PullImageSuccess: "镜像拉取成功"
UpgradeAppStart: "开始升级应用 {{ .name }}"
UpgradeAppSuccess: "应用 {{ .name }} 升级成功"
AppStoreIsLastVersion: "应用商店已经是最新版本"
AppStoreSyncSuccess: "应用商店同步成功"
SyncAppDetail: "同步应用配置"
AppVersionNotMatch: "{{ .name }} 应用需要更高的 1Panel 版本,跳过同步"
+24 -19
View File
@@ -23,7 +23,15 @@
</el-button>
</template>
<template #rightToolBar>
<TableSearch @search="search()" v-model:searchName="req.domain" />
<TableRefresh @search="search()" />
<fu-table-column-select
:columns="columns"
trigger="hover"
:title="$t('commons.table.selectColumn')"
popper-class="popper-class"
:only-icon="true"
/>
</template>
<template #main>
<ComplexTable
@@ -32,41 +40,33 @@
@search="search()"
v-model:selects="selects"
v-loading="loading"
:columns="columns"
localKey="sslColumn"
>
<el-table-column type="selection" width="30" />
<el-table-column
:label="$t('website.domain')"
fix
show-overflow-tooltip
prop="primaryDomain"
min-width="150px"
></el-table-column>
<el-table-column
:label="$t('website.otherDomains')"
fix
show-overflow-tooltip
prop="domains"
min-width="90px"
></el-table-column>
<el-table-column
:label="$t('ssl.applyType')"
fix
show-overflow-tooltip
prop="provider"
min-width="110px"
>
<el-table-column :label="$t('ssl.applyType')" show-overflow-tooltip prop="provider" width="90px">
<template #default="{ row }">{{ getProvider(row.provider) }}</template>
</el-table-column>
<el-table-column
:label="$t('ssl.acmeAccount')"
fix
show-overflow-tooltip
prop="acmeAccount.email"
min-width="110px"
width="150px"
></el-table-column>
<el-table-column
:label="$t('commons.table.status')"
fix
show-overflow-tooltip
prop="status"
width="100px"
@@ -94,7 +94,7 @@
</div>
</template>
</el-table-column>
<el-table-column :label="$t('commons.button.log')" width="100px">
<el-table-column :label="$t('commons.button.log')" width="80px">
<template #default="{ row }">
<el-button @click="openSSLLog(row)" link type="primary" v-if="row.provider != 'manual'">
{{ $t('website.check') }}
@@ -103,11 +103,11 @@
</el-table-column>
<el-table-column
:label="$t('website.brand')"
fix
show-overflow-tooltip
prop="organization"
width="150px"
></el-table-column>
<el-table-column :label="$t('website.remark')" fix prop="description" min-width="100px">
<el-table-column :label="$t('website.remark')" prop="description" width="100px">
<template #default="{ row }">
<fu-read-write-switch>
<template #read>
@@ -119,7 +119,7 @@
</fu-read-write-switch>
</template>
</el-table-column>
<el-table-column :label="$t('ssl.autoRenew')" fix min-width="100px">
<el-table-column :label="$t('ssl.autoRenew')" width="100px">
<template #default="{ row }">
<el-switch
:disabled="row.provider === 'dnsManual' || row.provider === 'manual'"
@@ -133,7 +133,7 @@
:label="$t('website.expireDate')"
:formatter="dateFormat"
show-overflow-tooltip
width="200px"
width="180px"
/>
<fu-table-operations
:ellipsis="3"
@@ -198,6 +198,10 @@ const logRef = ref();
const caRef = ref();
const obtainRef = ref();
let selects = ref<any>([]);
const columns = ref([]);
const req = reactive({
domain: '',
});
const routerButton = [
{
@@ -286,12 +290,13 @@ const mobile = computed(() => {
});
const search = () => {
const req = {
const request = {
page: paginationConfig.currentPage,
pageSize: paginationConfig.pageSize,
domain: req.domain,
};
loading.value = true;
searchSSL(req)
searchSSL(request)
.then((res) => {
data.value = res.data.items || [];
paginationConfig.total = res.data.total;