Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions frontend/src/views/container/image/prune/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ const acceptParams = async (): Promise<void> => {
unUsedList.value = [];
for (const item of list) {
if (
(
!item.tags ||
(!item.tags ||
item.tags.length === 0 ||
(item.tags.length === 1 && item.tags[0].indexOf('<none>') !== -1)
) && !item.isUsed
(item.tags.length === 1 && item.tags[0].indexOf('<none>') !== -1)) &&
!item.isUsed
) {
unTagList.value.push(item);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is clean and well-formatted, but there might be some improvements to readability and maintainability.

  1. Redundant Logic: The condition if (item.tags?.length === 0 || (item.tags.length === 1 && item.tags[0].indexOf('<none>') !== -1) can be simplified using optional chaining (?.) and logical OR (||).

  2. Comment Clarification: It's beneficial to add comments to explain the logic behind each condition when it's complex or not immediately clear.

  3. Code Style Consistency: Ensure that there are consistent spacing and indentation throughout the codebase for better readability.

Here are the suggested changes:

for (const item of list) {
    if (
        (!item.tags?.length || 
         (item.tags?.length === 1 && item.tags[0]?.indexOf('<none>') !== -1))
        && !item.isUsed
    ) {
        unTagList.value.push(item);
    }
}

With these adjustments, the code remains efficient and easy to understand. If you have more queries or need further assistance with optimizations, feel free to ask!

Expand Down
Loading