diff --git a/src/app_viewmodel.go b/src/app_viewmodel.go index 4e7fa58..e612a34 100644 --- a/src/app_viewmodel.go +++ b/src/app_viewmodel.go @@ -4,6 +4,7 @@ import ( "encoding/json" "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" + "github.com/thoas/go-funk" "net/http" "strings" ) @@ -107,8 +108,18 @@ func CreateUpdateDeleteApp(c *gin.Context) { func GetAppsController(c *gin.Context) { username := c.MustGet("username").(string) - apps := GetApps(username) - c.JSON(http.StatusOK, apps) + + appsvm := funk.Map(GetApps(username), func(a AppModel) AppViewModel { return AppViewModel{AppModel: &a} }).([]AppViewModel) + for i := range appsvm { + a := &appsvm[i] + a.Status = statusString(a) + a.ServiceDisplayName = a.ServiceName() + } + vm := &AppsViewModel{ + Username: username, + Apps: appsvm, + } + c.JSON(http.StatusOK, vm) } func GetUsername(c *gin.Context) { diff --git a/src/k8s_client.go b/src/k8s_client.go index 6c772b7..7775ff1 100644 --- a/src/k8s_client.go +++ b/src/k8s_client.go @@ -278,10 +278,10 @@ func (c *K8sClient) UpdateIngress(a *AppModel) { label := map[string]string{k: v} ingress := &netv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ - Name: a.IngressName(), - Labels: label, + Name: a.IngressName(), + Labels: label, Annotations: map[string]string{ - //"traefik.ingress.kubernetes.io/router.middlewares": "default-strip-prefix-1@kubernetescrd", + "traefik.ingress.kubernetes.io/router.middlewares": "default-strip-prefix-1@kubernetescrd", }, }, Spec: netv1.IngressSpec{ diff --git a/template/app_view.html b/template/app_view.html index 69149ef..53e6c9d 100644 --- a/template/app_view.html +++ b/template/app_view.html @@ -81,7 +81,7 @@