diff --git a/backend/app/dto/image.go b/backend/app/dto/image.go
index 9770e3879..892e0a24f 100644
--- a/backend/app/dto/image.go
+++ b/backend/app/dto/image.go
@@ -5,6 +5,7 @@ import "time"
type ImageInfo struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
+ IsUsed bool `json:"isUsed"`
Tags []string `json:"tags"`
Size string `json:"size"`
}
diff --git a/backend/app/service/image.go b/backend/app/service/image.go
index 523f4e9bc..208c6b61a 100644
--- a/backend/app/service/image.go
+++ b/backend/app/service/image.go
@@ -53,6 +53,7 @@ func (u *ImageService) Page(req dto.SearchWithPage) (int64, interface{}, error)
if err != nil {
return 0, nil, err
}
+ containers, _ := client.ContainerList(context.Background(), types.ContainerListOptions{All: true})
if len(req.Info) != 0 {
length, count := len(list), 0
for count < length {
@@ -77,6 +78,7 @@ func (u *ImageService) Page(req dto.SearchWithPage) (int64, interface{}, error)
records = append(records, dto.ImageInfo{
ID: image.ID,
Tags: image.RepoTags,
+ IsUsed: checkUsed(image.ID, containers),
CreatedAt: time.Unix(image.Created, 0),
Size: size,
})
@@ -415,3 +417,12 @@ func formatFileSize(fileSize int64) (size string) {
return fmt.Sprintf("%.2fEB", float64(fileSize)/float64(1024*1024*1024*1024*1024))
}
}
+
+func checkUsed(imageID string, containers []types.Container) bool {
+ for _, container := range containers {
+ if container.ImageID == imageID {
+ return true
+ }
+ }
+ return false
+}
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 34cc23d5c..8c4cad3c8 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -224,6 +224,8 @@ const message = {
rebuilding: 'ReBuilding',
deny: 'Denied',
accept: 'Accepted',
+ used: 'Used',
+ unUsed: 'Unused',
},
units: {
second: 'Second',
@@ -493,9 +495,9 @@ const message = {
containerPruneHelper3: 'This operation cannot be rolled back. Do you want to continue?',
imagePrune: 'Image prune',
imagePruneSome: 'Clean unlabeled',
- imagePruneSomeHelper: 'Remove all unused and unlabeled container images。',
+ imagePruneSomeHelper: 'Clean the images with the tag "none" that are not used by any containers.',
imagePruneAll: 'Clean unused',
- imagePruneAllHelper: 'Remove all unused images, not just unlabeled',
+ imagePruneAllHelper: 'Clean the images that are not used by any containers.',
networkPrune: 'Network prune',
networkPruneHelper: 'Remove all unused networks. Do you want to continue?',
volumePrune: 'Volume prune',
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index 800cdf236..8bd066b6c 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -222,6 +222,8 @@ const message = {
rebuilding: '重建中',
deny: '已屏蔽',
accept: '已放行',
+ used: '已使用',
+ unUsed: '未使用',
},
units: {
second: '秒',
@@ -481,9 +483,9 @@ const message = {
containerPruneHelper3: '該操作無法回滾,是否繼續?',
imagePrune: '清理鏡像',
imagePruneSome: '未標簽鏡像',
- imagePruneSomeHelper: '清理標簽為 none 且未被任何容器使用的鏡像。',
+ imagePruneSomeHelper: '清理下列標簽為 none 且未被任何容器使用的鏡像。',
imagePruneAll: '未使用鏡像',
- imagePruneAllHelper: '清理所有未被任何容器使用的鏡像。',
+ imagePruneAllHelper: '清理下列未被任何容器使用的鏡像。',
networkPrune: '清理網絡',
networkPruneHelper: '清理網絡 將刪除所有未被使用的網絡,該操作無法回滾,是否繼續?',
volumePrune: '清理存儲卷',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index c5a2c28fd..d80a24619 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -222,6 +222,8 @@ const message = {
rebuilding: '重建中',
deny: '已屏蔽',
accept: '已放行',
+ used: '已使用',
+ unUsed: '未使用',
},
units: {
second: '秒',
@@ -481,9 +483,9 @@ const message = {
containerPruneHelper3: '该操作无法回滚,是否继续?',
imagePrune: '清理镜像',
imagePruneSome: '未标签镜像',
- imagePruneSomeHelper: '清理标签为 none 且未被任何容器使用的镜像。',
+ imagePruneSomeHelper: '清理下列标签为 none 且未被任何容器使用的镜像。',
imagePruneAll: '未使用镜像',
- imagePruneAllHelper: '清理所有未被任何容器使用的镜像。',
+ imagePruneAllHelper: '清理下列未被任何容器使用的镜像。',
networkPrune: '清理网络',
networkPruneHelper: '清理网络 将删除所有未被使用的网络,该操作无法回滚,是否继续?',
volumePrune: '清理存储卷',
diff --git a/frontend/src/views/container/image/index.vue b/frontend/src/views/container/image/index.vue
index 01820dde8..e40af65d7 100644
--- a/frontend/src/views/container/image/index.vue
+++ b/frontend/src/views/container/image/index.vue
@@ -46,6 +46,16 @@
{{ row.id.replaceAll('sha256:', '').substring(0, 12) }}
+
+
+
+ {{ $t('commons.status.used') }}
+
+
+ {{ $t('commons.status.unUsed') }}
+
+
+
{
};
const onOpenPrune = () => {
- dialogPruneRef.value!.acceptParams();
+ dialogPruneRef.value!.acceptParams({ list: data.value });
};
const onOpenload = () => {
diff --git a/frontend/src/views/container/image/prune/index.vue b/frontend/src/views/container/image/prune/index.vue
index 522a078cd..c787bdbb0 100644
--- a/frontend/src/views/container/image/prune/index.vue
+++ b/frontend/src/views/container/image/prune/index.vue
@@ -11,10 +11,22 @@
{{ $t('container.imagePruneSome') }}
{{ $t('container.imagePruneAll') }}
-
- {{ withTagAll ? $t('container.imagePruneAllHelper') : $t('container.imagePruneSomeHelper') }}
-
+
+ {{ withTagAll ? $t('container.imagePruneAllHelper') : $t('container.imagePruneSomeHelper') }}
+
+
+
+ -
+ {{ item.tags[0] }}
+
+
+
+
+
+ - {{ item.tags.join(', ') }}
+
+