hawtio / hawtio-core-navigation

The main navigation component for hawtio
Apache License 2.0
1 stars 7 forks source link

showing the applicable sub tabs breaks if the baseuri is defined #10

Open jstrachan opened 9 years ago

jstrachan commented 9 years ago

e.g. hosting the hawtio-kubernetes page at http://172.28.128.80:8080/api/v1/proxy/namespaces/default/services/fabric8/

then if you click on a pod / controller / service the sub tab turns into "Attributes / Operations / Charts"

I guess its that the URL is something like:

http://172.28.128.80:8080/api/v1/proxy/namespaces/default/services/fabric8/kubernetes/namespace/default/pods/fabric8-9e1v6

rather than http://172.28.128.80:8080/kubernetes/namespace/default/pods/fabric8-9e1v6

so some code might be checking that the URI starts with "/kubernetes" when it needs to remove the baseuri from the current url first?

gashcrumb commented 9 years ago

You'd need to update the <base href=''/> tag in index.html appropriately for this to work.

jstrachan commented 9 years ago

is set already ;)

jstrachan commented 9 years ago

I can write instructions of how to reproduce it shortly - basically when running the fabric8 console inside vanilla kubernetes -e.g. vagrant up in this folder: https://github.com/fabric8io/fabric8-installer/tree/master/vagrant/kubernetes/latest

then if you run this

kubectl create -f kubernetes.json

with the attached files, you should have the console running. You can then try it out at: http://172.28.128.80:8080/api/v1/proxy/namespaces/default/services/fabric8/

replicationController:

{"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"fabric8","namespace":"default","selfLink":"/api/v1/namespaces/default/replicationcontrollers/fabric8","uid":"e617cccb-2a2d-11e5-a26c-080027bdffff","resourceVersion":"1911","generation":1,"creationTimestamp":"2015-07-14T13:40:32Z","labels":{"component":"console","provider":"fabric8"}},"spec":{"replicas":1,"selector":{"component":"console","provider":"fabric8"},"template":{"metadata":{"creationTimestamp":null,"labels":{"component":"console","provider":"fabric8"}},"spec":{"containers":[{"name":"fabric8-container","image":"fabric8/fabric8-console","ports":[{"name":"http","containerPort":9090,"protocol":"TCP"}],"env":[{"name":"OAUTH_PROVIDER","value":"basic"},{"name":"OAUTH_AUTHORIZE_URI","value":"https://fabric8.vagrant.f8:8443/oauth/authorize"},{"name":"GOOGLE_OAUTH_CLIENT_SECRET","value":"null"},{"name":"GOOGLE_OAUTH_REDIRECT_URI","value":"https://fabric8.vagrant.f8"},{"name":"OAUTH_CLIENT_ID","value":"fabric8"},{"name":"GOOGLE_OAUTH_AUTHENTICATION_URI","value":"https://accounts.google.com/o/oauth2/auth"},{"name":"GOOGLE_OAUTH_TOKEN_URL","value":"https://www.googleapis.com/oauth2/v3/token"},{"name":"GOOGLE_OAUTH_CLIENT_ID","value":"null"},{"name":"GOOGLE_OAUTH_SCOPE","value":"profile"},{"name":"KUBERNETES_NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}}],"resources":{},"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent","securityContext":{}}],"restartPolicy":"Always","dnsPolicy":"ClusterFirst"}}},"status":{"replicas":0}}

service:

{"kind":"Service","apiVersion":"v1","metadata":{"name":"fabric8","namespace":"default","selfLink":"/api/v1/namespaces/default/services/fabric8","uid":"e6071459-2a2d-11e5-a26c-080027bdffff","resourceVersion":"1906","creationTimestamp":"2015-07-14T13:40:32Z","labels":{"component":"console","provider":"fabric8"}},"spec":{"ports":[{"protocol":"TCP","port":80,"targetPort":9090,"nodePort":0}],"selector":{"component":"console","provider":"fabric8"},"clusterIP":"10.254.46.217","type":"ClusterIP","sessionAffinity":"None"},"status":{"loadBalancer":{}}}
jstrachan commented 9 years ago

BTW whats wacky is - its totally fine for apps/services/controllers/pods pages; its only the page for 1 service/pod/controller; so might not be a bug in core-navigation and could be a bug in hawtio-kubernetes

gashcrumb commented 9 years ago

Yeah, checking it out now against my running instance, the 'pod', 'service', and 'replicationController' detail pages are at different URIs than the list pages, i.e. /kubernetes/pods vs /kuberenetes/namespace/default/pod/foo. So could be we'd want to enhance the isSelected() handler on those sub-tabs a bit so that they're also selected still when you're looking at a detail page.

That being said, if the sub-tabs revert to the JMX plugin's sub-tabs, then the wrong main tab is being chosen when we draw the sub-tabs it sounds like.

jstrachan commented 9 years ago

doh thanks! lemme try fix up hawtio-kubernetes a bit more...

jstrachan commented 9 years ago

I had a look a the core navigation stuff in hawtio-kubernetes and wasn't sure what was required ;). I was hoping we could just assume that the Kubernetes tab was selected if /kubernetes was at the start of the URL? or at least /kubernetes/namespace or /kubernetes/apps etc

gashcrumb commented 9 years ago

yeah, normally we do, haven't quite grok'ed why that's not the case here...

abkieling commented 7 years ago

@jstrachan is this issue still happening? Let me know if this issue can be closed.