mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-07 22:16:16 +08:00
feat: The certificate list supports sorting by expiration date. (#10372)
Refs https://github.com/1Panel-dev/1Panel/issues/10371
This commit is contained in:
parent
0ba83d1353
commit
7e8581a7de
3 changed files with 19 additions and 1 deletions
|
@ -6,6 +6,8 @@ type WebsiteSSLSearch struct {
|
|||
dto.PageInfo
|
||||
AcmeAccountID string `json:"acmeAccountID"`
|
||||
Domain string `json:"domain"`
|
||||
OrderBy string `json:"orderBy" validate:"required,oneof=expire_date"`
|
||||
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
||||
}
|
||||
|
||||
type WebsiteSSLCreate struct {
|
||||
|
|
|
@ -59,7 +59,11 @@ func (w WebsiteSSLService) Page(search request.WebsiteSSLSearch) (int64, []respo
|
|||
result []response.WebsiteSSLDTO
|
||||
opts []repo.DBOption
|
||||
)
|
||||
opts = append(opts, repo.WithOrderBy("created_at desc"))
|
||||
if search.OrderBy != "" && search.Order != "null" {
|
||||
opts = append(opts, repo.WithOrderRuleBy(search.OrderBy, search.Order))
|
||||
} else {
|
||||
opts = append(opts, repo.WithOrderBy("created_at desc"))
|
||||
}
|
||||
if search.Domain != "" {
|
||||
opts = append(opts, websiteSSLRepo.WithByDomain(search.Domain))
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
:columns="columns"
|
||||
localKey="sslColumn"
|
||||
:height-diff="260"
|
||||
@sort-change="changeSort"
|
||||
>
|
||||
<el-table-column type="selection" width="30" />
|
||||
<el-table-column
|
||||
|
@ -144,6 +145,7 @@
|
|||
:formatter="dateFormat"
|
||||
show-overflow-tooltip
|
||||
width="180px"
|
||||
sortable
|
||||
/>
|
||||
<fu-table-operations
|
||||
:ellipsis="3"
|
||||
|
@ -211,6 +213,8 @@ let selects = ref<any>([]);
|
|||
const columns = ref([]);
|
||||
const req = reactive({
|
||||
domain: '',
|
||||
orderBy: 'expire_date',
|
||||
order: 'ascending',
|
||||
});
|
||||
|
||||
const routerButton = [
|
||||
|
@ -302,11 +306,19 @@ const mobile = computed(() => {
|
|||
return globalStore.isMobile();
|
||||
});
|
||||
|
||||
const changeSort = ({ order }) => {
|
||||
req.orderBy = 'expire_date';
|
||||
req.order = order;
|
||||
search();
|
||||
};
|
||||
|
||||
const search = () => {
|
||||
const request = {
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
domain: req.domain,
|
||||
orderBy: req.orderBy,
|
||||
order: req.order,
|
||||
};
|
||||
loading.value = true;
|
||||
searchSSL(request)
|
||||
|
|
Loading…
Add table
Reference in a new issue