Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
sync dev (#85)
Browse files Browse the repository at this point in the history
* feat(colors): add icon colors (#84)

* fix(helm): new image version

---------

Co-authored-by: ullberg-github-app <ullberg-github-app[bot]@users.noreply.github.com>
  • Loading branch information
ullbergm and ullberg-github-app[bot] authored Jun 9, 2024
1 parent f05ec6c commit 2c2ec18
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions charts/hajimari/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ spec:
type: string
icon:
type: string
iconColor:
type: string
url:
type: string
info:
Expand Down
2 changes: 1 addition & 1 deletion charts/hajimari/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ image:
# -- image pull policy
pullPolicy: IfNotPresent
# -- image tag
tag: v0.4.3
tag: v0.4.4

# -- environment variables.
# @default -- See below
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/AppList/AppGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
{#if app.icon.includes("//")}
<img src={app.icon} alt="app icon for {app.name}" />
{:else if app.icon.includes(":") || !app.icon}
<Icon icon={app.icon ? app.icon : defaultIcon} />
<Icon icon={app.icon ? app.icon : defaultIcon} color="{app.iconColor}" />
{:else}
<!-- support old icon format to ease transition -->
<Icon icon="mdi:{app.icon ? app.icon : defaultIcon}" />
<Icon icon="mdi:{app.icon ? app.icon : defaultIcon}" color="{app.iconColor}" />
{/if}
</a>
{#if app.replicas.total > 0 && showStatus}
Expand Down
2 changes: 2 additions & 0 deletions internal/annotations/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package annotations
const (
// HajimariIconAnnotation const used for hajimari icon
HajimariIconAnnotation = "hajimari.io/icon"
// HajimariIconColorAnnotation const used for hajimari icon color
HajimariIconColorAnnotation = "hajimari.io/iconColor"
// HajimariEnableAnnotation const used for checking whether an ingress is exposed to hajimari
HajimariEnableAnnotation = "hajimari.io/enable"
// HajimariAppNameAnnotation const used for overriding the name of the app
Expand Down
1 change: 1 addition & 0 deletions internal/hajimari/crdapps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func appsToHajimariApps(apps []unstructured.Unstructured) (appGroups []models.Ap
appGroups[i].Apps = append(appGroups[i].Apps, models.App{
Name: wrapper.GetName(),
Icon: wrapper.GetAnnotationValue(annotations.HajimariIconAnnotation),
IconColor: wrapper.GetIconColor(),
URL: wrapper.GetURL(),
TargetBlank: wrapper.GetTargetBlank(),
Info: wrapper.GetInfo(),
Expand Down
2 changes: 2 additions & 0 deletions internal/hajimari/ingressapps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func convertIngressesToHajimariApps(ingresses []v1.Ingress, rsg util.ReplicaStat
appGroups[i].Apps = append(appGroups[i].Apps, models.App{
Name: wrapper.GetName(),
Icon: wrapper.GetAnnotationValue(annotations.HajimariIconAnnotation),
IconColor: wrapper.GetIconColor(),
URL: wrapper.GetURL(),
Info: wrapper.GetInfo(),
TargetBlank: wrapper.GetTargetBlank(),
Expand All @@ -102,6 +103,7 @@ func convertIngressesToHajimariApps(ingresses []v1.Ingress, rsg util.ReplicaStat
appGroups[i].Apps = append(appGroups[i].Apps, models.App{
Name: wrapper.GetName(),
Icon: wrapper.GetAnnotationValue(annotations.HajimariIconAnnotation),
IconColor: wrapper.GetIconColor(),
URL: wrapper.GetURL(),
TargetBlank: wrapper.GetTargetBlank(),
Info: wrapper.GetInfo(),
Expand Down
1 change: 1 addition & 0 deletions internal/kube/types/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type ApplicationSpec struct {
Name string `json:"name"`
Group string `json:"group,omitempty"`
Icon string `json:"icon,omitempty"`
IconColor string `json:"icon,omitempty"`
URL string `json:"url"`
Info string `json:"info,omitempty"`
TargetBlank bool `json:"targetBlank,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions internal/kube/wrappers/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func (aw *AppWrapper) GetAnnotationValue(annotationKey string) string {
return aw.app.Spec.Icon
}

// GetIconColor func extracts icon color of the app wrapped by the object
func (aw *AppWrapper) GetIconColor() string {
return aw.app.Spec.IconColor
}

// GetTargetBlank func extracts open in new window feature gate from the app
// @default false
func (aw *AppWrapper) GetTargetBlank() bool {
Expand Down
8 changes: 8 additions & 0 deletions internal/kube/wrappers/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ func (iw *IngressWrapper) GetLocation() int {
}
return defaultLocation
}

// GetIconColor func extracts icon color of the ingress wrapped by the object
func (iw *IngressWrapper) GetIconColor() string {
if iconColorFromAnnotation := iw.GetAnnotationValue(annotations.HajimariIconColorAnnotation); iconColorFromAnnotation != "" {
return iconColorFromAnnotation
}
return ""
}
1 change: 1 addition & 0 deletions internal/models/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package models
type App struct {
Name string `json:"name"`
Icon string `json:"icon"`
IconColor string `json:"iconColor"`
URL string `json:"url"`
Info string `json:"info"`
TargetBlank bool `json:"targetBlank"`
Expand Down

0 comments on commit 2c2ec18

Please sign in to comment.