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: Info panel not showing when some apps miss infoPanel config #2627

Open
wants to merge 6 commits into
base: alpha
Choose a base branch
from

Conversation

vardhan0604
Copy link
Contributor

New Pull Request Checklist

Issue Description

Closes: #2623

Approach

TODOs before merging

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)

Copy link

parse-github-assistant bot commented Nov 3, 2024

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

Copy link

uffizzi-cloud bot commented Nov 3, 2024

Uffizzi Ephemeral Environment deployment-57881

⌚ Updated Nov 03, 2024, 21:35 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2627

📄 View Application Logs etc.

What is Uffizzi? Learn more

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Show panel" button doesn't appear, when having a second app in dashboard config. Before this PR, a workaround was to add an empty panel "infoPanel": [],, but that doesn't work anymore either. Could you please verify the fix with the following configs:

1 app w/ panel:

{
  "apps": [
    {
      "serverURL": "https://app1.example.com",
      "appId": "appId1",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    }
  ]
}

2 apps, 1 w/ panel, 1 w/o panel:

{
  "apps": [
    {
      "serverURL": "https://app1.example.com",
      "appId": "appId1",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://app2.example.com",
      "appId": "appId2",
      "masterKey": "masterKey",
      "appName": "app2"
    }
  ]
}

2 apps, 1 w/ panel, 1 w/ empty panel:

{
  "apps": [
    {
      "serverURL": "https://app1.example.com",
      "appId": "appId1",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://app2.example.com",
      "appId": "appId2",
      "masterKey": "masterKey",
      "appName": "app2",
      "infoPanel": []
    }
  ]
}

2 apps, 2 w/ panel in same class:

{
  "apps": [
    {
      "serverURL": "https://app1.example.com",
      "appId": "appId1",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://app2.example.com",
      "appId": "appId2",
      "masterKey": "masterKey",
      "appName": "app2",
      "infoPanel": [
       {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    }
  ]
}

2 apps, 2 w/ panel in different classes:

{
  "apps": [
    {
      "serverURL": "https://app1.example.com",
      "appId": "appId1",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://app2.example.com",
      "appId": "appId2",
      "masterKey": "masterKey",
      "appName": "app2",
      "infoPanel": [
        {
          "title": "Installation Details",
          "classes": ["_Installation"],
          "cloudCodeFunction": "installation"
        }
      ]
    }
  ]
}

@vardhan0604
Copy link
Contributor Author

@mtrezza, it’s working locally for me, but I'm not sure why it’s not working for you. I’ve pushed everything.
This is my config i used in this demo

{
  "apps": [
    {
      "serverURL": "http://localhost:1337/parse",
      "appId": "1234",
      "masterKey": "12345",
      "appName": "MyApp",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        },
        {
          "title": "Purchase Details",
          "classes": ["Purchase"],
          "cloudCodeFunction": "purchase"
        },
        {
          "title": "systumm h ladle",
          "classes": ["systum"],
          "cloudCodeFunction": "systum"
        }
      ]
    },
    {
      "serverURL": "https://app2.example.com",
      "appId": "appId2",
      "masterKey": "masterKey",
      "appName": "app2"
    }
  ]
}

Screen.Recording.2024-11-07.005039.mp4

@mtrezza
Copy link
Member

mtrezza commented Nov 7, 2024

Did you try out all the configs from my previous comment? Some do not seem to work.

@vardhan0604
Copy link
Contributor Author

Did you try out all the configs from my previous comment? Some do not seem to work.

Yes @mtrezza , I tried all the configurations, and they seem to be working on my end. Could you let me know which specific ones aren’t working for you?

@mtrezza mtrezza closed this Dec 15, 2024
@mtrezza mtrezza reopened this Dec 15, 2024
Copy link

uffizzi-cloud bot commented Dec 15, 2024

Uffizzi Ephemeral Environment deployment-59113

⌚ Updated Dec 15, 2024, 22:39 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2627

📄 View Application Logs etc.

What is Uffizzi? Learn more

@mtrezza
Copy link
Member

mtrezza commented Dec 16, 2024

Tested it out and from the pattern I guess the issue is with how you identify an app. The tests were actually done by adding the same app twice, hence both have the same app ID, same server URL, etc. I've added the corrected configs and results below. I haven't looked at the code, but I guess you identify by app ID, hence they overwrite each other. At first I thought it was a testing mistake on my side. But then I tested the same with scripts and they work fine, even if there are 2 apps with the same app ID. I'd suggest you take a look at the script logic.

1 app w/ panel:

{
  "apps": [
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    }
  ]
}

alpha: OK
PR: OK

2 apps, 1 w/ panel, 1 w/o panel:

{
  "apps": [
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://example.com",
      "appId": "appId2",
      "masterKey": "masterKey",
      "appName": "app2"
    }
  ]
}

alpha: NOK:

  • app1: no panel button

PR: OK

2 apps, 1 w/ panel, 1 w/ empty panel:

{
  "apps": [
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app2",
      "infoPanel": []
    }
  ]
}

alpha: OK
PR: NOK:

  • app1: no panel button

2 apps, 2 w/ panel in same class:

{
  "apps": [
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user1"
        }
      ]
    },
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app2",
      "infoPanel": [
       {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user2"
        }
      ]
    }
  ]
}

alpha: NOK:

  • app2: Cloud Function user1 is called instead of user2

PR: NOK:

  • app1: Cloud Function user2 is called instead of user1

2 apps, 2 w/ panel in different classes:

{
  "apps": [
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app1",
      "infoPanel": [
        {
          "title": "User Details",
          "classes": ["_User"],
          "cloudCodeFunction": "user"
        }
      ]
    },
    {
      "serverURL": "https://example.com",
      "appId": "appId",
      "masterKey": "masterKey",
      "appName": "app2",
      "infoPanel": [
        {
          "title": "Installation Details",
          "classes": ["_Installation"],
          "cloudCodeFunction": "installation"
        }
      ]
    }
  ]
}

alpha: NOK:

  • app2: Cloud Function user1 is called instead of user2
  • app1: panel button is visible also in _Installation class
  • app2: panel button is visible also in _User class

PR: NOK:

  • app1: panel button is visible in _Installation class instead of _User class

unknown added 2 commits December 20, 2024 15:38
@vardhan0604
Copy link
Contributor Author

Hey @mtrezza, can you please review the changes?

@mtrezza
Copy link
Member

mtrezza commented Dec 20, 2024

@vardhan0604 is the fix just adding the app name as an additional identifier? Is that also how scripts identify the app? If so, what if it's the same app name and app ID, but a different URL - would it make sense to add the URL to it?

Maybe a more robust solution would be to hash the app config object, which will create a unique ID assuming that an app config will never be completely the same as the other one. But I'm not sure how reliably that would work given that objects don't have a defined key order, which may produce different hash values every time it's calculated.

What do you think?

@vardhan0604
Copy link
Contributor Author

Hey @mtrezza , regarding how scripts identify the app, I tried understanding the codebase more. Apparently, in the AppsManager—where all the context related to each app is stored—it uses either the appName or the slugName (essentially the appName without special characters) to retrieve the app info.

I also noticed that if we have two apps with the same name, we cannot see the other app here.
image

Should we then assume that appName is a unique identifier for each app?

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.

Info panel not showing when some apps miss infoPanel config
2 participants