hajimari icon indicating copy to clipboard operation
hajimari copied to clipboard

Duplicated application groups

Open angelnu opened this issue 2 years ago • 4 comments

Describe the bug Application groups injected via ingress annotations and customApps are not merged. This results in the group appearing twice:

image

I checked the that they written exactly the same: Admin

To Reproduce Steps to reproduce the behavior:

  1. Add following annotation
        hajimari.io/enable: "true"
        hajimari.io/icon: logos:kubernetes
        hajimari.io/info: Kubernetes dashboard
        hajimari.io/group: Admin
    
  2. Add following custom app
            customApps:
            - group: Admin
              apps:
                - name: Test
                  url: 'https://example.com'
                  icon: 'mdi:test-tube'
                  info: This is a test app
    
  3. See the duplication

Expected behavior

Both apps showing in the same group

Screenshots

See above

Desktop (please complete the following information):

  • OS: Windows
  • Browser Frirefox
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version 105.0.3

Additional context NA

angelnu avatar Oct 23 '22 15:10 angelnu

I saw this when the case was different in the annotation and the custom app, not sure if there are other cases where it happens as well.

ullbergm avatar Oct 30 '22 03:10 ullbergm

@ullbergm - that was my thought as I had problems with the case before. But I double-checked including seeing if there were any extra leading/trailing spaces and there are none I can see.

Did the de-duplication work for you when the cases match between the ingress and custom app?

angelnu avatar Oct 30 '22 10:10 angelnu

It did.

I think the problem is that when customApps are loaded from the config the group name is turned in to lower-case but that is not happening with ingressApps: https://github.com/toboshii/hajimari/blob/main/internal/hajimari/customapps/customapps.go#L30 vs https://github.com/toboshii/hajimari/blob/main/internal/kube/wrappers/ingress.go#L61

@toboshii The current fix I put in is to normalize the group names when loaded from the config/kubernetes api. The drawback is that if the theme changes in the future then we may want to retain the case of the group names.

Incidentally, there is also an issue if you have extra spaces like @angelnu said which is fixed with a strings.TrimSpace() when loading/comparing the objects.

edit: changed my mind

ullbergm avatar Oct 30 '22 11:10 ullbergm

Thanks @ullbergm - I can confirm that after removing the capital case (Admin -> admin) then both groups are merged as expected.

angelnu avatar Oct 30 '22 14:10 angelnu