Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): incorrect namespace displayed in UI #164

Conversation

viniciusartur
Copy link
Contributor

@viniciusartur viniciusartur commented Dec 27, 2024

This PR addresses the issue #163 where an incorrect namespace is being displayed in the Web UI.

I have tested that:

  • Web UI now shows the correct namespace
  • Web UI query the right namespace
  • query functionality works as expected
  • shell functionality works as expected

Detailed tests:

❯ kubectl config set-context --current --namespace=test
Context "default" modified.

❯ kubectl config get-contexts
CURRENT   NAME      CLUSTER   AUTHINFO   NAMESPACE
*         default   default   default    test

❯ kubectl get deployments --namespace default
No resources found in default namespace.

❯ kubectl get deployments --namespace test
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
test2   1/1     1            1           47m

❯ ./dist/cyphernetes web

❯ curl -s 'http://localhost:8080/api/context' 
{"context":"default","namespace":"test"}%  

❯ curl -s 'http://localhost:8080/api/query' -d '{"query":"MATCH (d:deployment) RETURN d.name"}' | jq -r .result
{"d":[{"name":"test2"}]}

❯ ./dist/cyphernetes web --namespace default

❯ curl -s 'http://localhost:8080/api/context' 
{"context":"default","namespace":"default"}% 

❯ curl -s 'http://localhost:8080/api/query' -d '{"query":"MATCH (d:deployment) RETURN d.name"}' | jq -r .result
{"d":[]}

❯ ./dist/cyphernetes query "MATCH (d:deployment) RETURN d.name" 
...
"d": [
    {
      "name": "test2"
    }

❯ ./dist/cyphernetes query --namespace default "MATCH (d:deployment) RETURN d.name" 
...
{
  "d": []
}

❯ ./dist/cyphernetes shell
...
(default) test » MATCH (d:deployment) RETURN d.name;
...
  "d": [
    {
      "name": "test2"

❯ ./dist/cyphernetes shell --namespace default
...
(default) default » MATCH (d:deployment) RETURN d.name;

{
  "d": []
}

@naorpeled
Copy link
Collaborator

LGTM 🔥

@viniciusartur amazing work, thanks for your contribution 😎

@AvitalTamir
Copy link
Owner

@viniciusartur thank you! 🙏

@AvitalTamir
Copy link
Owner

@naorpeled feel free to merge, you got this.

@naorpeled naorpeled merged commit 8ae15e4 into AvitalTamir:main Dec 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants