mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-19 08:45:27 +01:00
Merge pull request #8576 from ywk253100/190806_repo_size
Fixes #8281, only show one tag in the task list to decrease the length of string
This commit is contained in:
commit
53dfd6a5e3
@ -17,7 +17,6 @@ package flow
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/goharbor/harbor/src/common/utils/log"
|
||||
@ -331,15 +330,16 @@ func getResourceName(res *model.Resource) string {
|
||||
if meta == nil {
|
||||
return ""
|
||||
}
|
||||
repositoryName := meta.Repository.Name
|
||||
if len(meta.Vtags) == 0 {
|
||||
return meta.Repository.Name
|
||||
return repositoryName
|
||||
}
|
||||
|
||||
if len(meta.Vtags) <= 5 {
|
||||
return meta.Repository.Name + ":[" + strings.Join(meta.Vtags, ",") + "]"
|
||||
if len(meta.Vtags) == 1 {
|
||||
return repositoryName + ":[" + meta.Vtags[0] + "]"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s:[%s ... %d in total]", meta.GetResourceName(), strings.Join(meta.Vtags[:5], ","), len(meta.Vtags))
|
||||
return fmt.Sprintf("%s:[%s ... %d in total]", repositoryName, meta.Vtags[0], len(meta.Vtags))
|
||||
}
|
||||
|
||||
// repository:c namespace:n -> n/c
|
||||
|
Loading…
Reference in New Issue
Block a user