kappnav / issues

kAppNav global issues
0 stars 0 forks source link

enable action using annotation #88

Closed cvignola closed 4 years ago

cvignola commented 4 years ago

so that an action like this:

"url-pattern":"${resource.$.metadata.annotations['image.opencontainers.org/source']}",

can be enabled using the same annotation (image.opencontainers.org/source)

cvignola commented 4 years ago

At first I thought this was just a good idea. Since then I discovered it's a bug. Kabanero apps still use the older version of Appsody and will continue to for awhile. The older version puts the appsody enablement label on the resources, but does not generate the full set of annotations. The new appsody actions (for deployment and service kinds) are enabled by the appsody enablement label, but depend on the future annotations. The result is action menu items that do not work.

The fix is to make the action enabled by the annotation on which it depends.

e.g. change this (in kappnav.actions.deployment.yaml) :

      { 
        "name":"projcode", 
        "text":"View Project Code", 
        "text.nls":"action.url.deployment.projcode.text", 
        "description":"View project source code.", 
        "description.nls":"action.url.deployment.projcode.desc", 
        "url-pattern":"${resource.$.metadata.annotations['image.opencontainers.org/source']}",
        "open-window": "tab", 
        "menu-item": "true",
        "enablement-label": "stack.appsody.dev/id"
      }

to this:

      { 
        "name":"projcode", 
        "text":"View Project Code", 
        "text.nls":"action.url.deployment.projcode.text", 
        "description":"View project source code.", 
        "description.nls":"action.url.deployment.projcode.desc", 
        "url-pattern":"${resource.$.metadata.annotations['image.opencontainers.org/source']}",
        "open-window": "tab", 
        "menu-item": "true",
        "enablement-annotation": "image.opencontainers.org/source"
      }
cvignola commented 4 years ago

delivered in release 0.1.4