add display fields

Signed-off-by: LiHui <andrewli@kubesphere.io>
This commit is contained in:
LiHui
2021-09-22 15:31:42 +08:00
parent 4eb5401f76
commit ad69b08a75
4 changed files with 51 additions and 5 deletions

View File

@@ -16,7 +16,11 @@ limitations under the License.
package helmrepoindex
import "time"
import (
"time"
"kubesphere.io/api/application/v1alpha1"
)
type VersionInterface interface {
GetName() string
@@ -28,8 +32,10 @@ type VersionInterface interface {
GetIcon() string
GetHome() string
GetSources() string
GetRawSources() []string
GetKeywords() string
GetMaintainers() string
GetRawMaintainers() []*v1alpha1.Maintainer
GetScreenshots() string
GetPackageName() string
GetCreateTime() time.Time

View File

@@ -23,6 +23,8 @@ import (
"strings"
"time"
"kubesphere.io/api/application/v1alpha1"
"helm.sh/helm/v3/pkg/repo"
"k8s.io/klog"
@@ -64,10 +66,27 @@ func (h HelmVersionWrapper) GetSources() string {
return string(s)
}
func (h HelmVersionWrapper) GetRawSources() []string {
return h.Sources
}
func (h HelmVersionWrapper) GetKeywords() string {
return strings.Join(h.ChartVersion.Keywords, ",")
}
func (h HelmVersionWrapper) GetRawMaintainers() []*v1alpha1.Maintainer {
mt := make([]*v1alpha1.Maintainer, 0, len(h.Maintainers))
for _, value := range h.Maintainers {
mt = append(mt, &v1alpha1.Maintainer{
URL: value.URL,
Name: value.Name,
Email: value.Email,
})
}
return mt
}
func (h HelmVersionWrapper) GetMaintainers() string {
if len(h.ChartVersion.Maintainers) == 0 {
return ""