feat: 容器列表增加过滤应用商店容器功能 (#3469)

pull/3472/head
zhengkunwang 11 months ago committed by GitHub
parent 9716e3754e
commit 14e2ced3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,11 +4,12 @@ import "time"
type PageContainer struct {
PageInfo
Name string `json:"name"`
State string `json:"state" validate:"required,oneof=all created running paused restarting removing exited dead"`
OrderBy string `json:"orderBy"`
Order string `json:"order"`
Filters string `json:"filters"`
Name string `json:"name"`
State string `json:"state" validate:"required,oneof=all created running paused restarting removing exited dead"`
OrderBy string `json:"orderBy"`
Order string `json:"order"`
Filters string `json:"filters"`
ExcludeAppStore bool `json:"excludeAppStore"`
}
type InspectReq struct {

@ -89,10 +89,21 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro
options.Filters = filters.NewArgs()
options.Filters.Add("label", req.Filters)
}
list, err = client.ContainerList(context.Background(), options)
containers, err := client.ContainerList(context.Background(), options)
if err != nil {
return 0, nil, err
}
if req.ExcludeAppStore {
for _, item := range containers {
if created, ok := item.Labels[composeCreatedBy]; ok && created == "Apps" {
continue
}
list = append(list, item)
}
} else {
list = containers
}
if len(req.Name) != 0 {
length, count := len(list), 0
for count < length {

@ -758,6 +758,7 @@ const message = {
'Saving the Socket Path setting may result in Docker service being unavailable. Do you want to continue?',
sockPathErr: 'Please select or enter the correct Docker sock file path',
related: 'Related resources',
includeAppstore: 'Show app store container',
},
cronjob: {
create: 'Create Cronjob',

@ -729,6 +729,7 @@ const message = {
sockPathMsg: ' Socket Docker ',
sockPathErr: ' Docker sock ',
related: '',
includeAppstore: '',
},
cronjob: {
create: '',

@ -730,6 +730,7 @@ const message = {
sockPathMsg: ' Socket Docker ',
sockPathErr: ' Docker sock ',
related: '',
includeAppstore: '',
},
cronjob: {
create: '',

@ -6,6 +6,15 @@
<span>{{ $t('container.startIn') }}</span>
</el-card>
<LayoutContent :title="$t('container.container')" :class="{ mask: dockerStatus != 'Running' }">
<template #rightButton>
<div class="flex justify-end">
<div class="mr-10">
<el-checkbox v-model="includeAppStore" @change="search()">
{{ $t('container.includeAppstore') }}
</el-checkbox>
</div>
</div>
</template>
<template #toolbar>
<el-row>
<el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
@ -347,6 +356,7 @@ const searchState = ref('all');
const dialogUpgradeRef = ref();
const dialogPortJumpRef = ref();
const opRef = ref();
const includeAppStore = ref(true);
const dockerStatus = ref('Running');
const loadStatus = async () => {
@ -410,6 +420,7 @@ const search = async (column?: any) => {
filters: filterItem,
orderBy: paginationConfig.orderBy,
order: paginationConfig.order,
excludeAppStore: !includeAppStore.value,
};
loading.value = true;
loadStats();

Loading…
Cancel
Save