Ericsson / CodeCompass

CodeCompass is a software comprehension tool for large scale software written in C/C++ and Java
https://codecompass.net
GNU General Public License v3.0
517 stars 101 forks source link

Fix default workspace ID for new frontend #604

Closed mcserep closed 1 year ago

mcserep commented 1 year ago

The default workspace ID in the `AppContextController˙ is CodeCompass. This means the new frontend will try retrieve the relevant project information for the CodeCompass project. If no project named CodeCompass exists, this fails, and the project selection page fails to load.

https://github.com/Ericsson/CodeCompass/blob/a438d393d4778bc706afed1f68e76585dc7489b0/webgui-new/src/global-context/app-context.tsx#L109

The default value should be empty and the program should handle it properly.

mdeme01 commented 1 year ago

It was meant as a fall-back value. The project page will only fail to load if you delete the 'workspaceId' from the URL, otherwise it will correctly load if you click on a project on the index page, regardless of what the initial value is. Now if you navigate to the project page manually, without clicking a project, the app will load CodeCompass, hence the initial value. However, I agree that it should be empty, as this project might not exist, and the user shouldn't navigate manually.

Currently, if the project page fails to load, a loading spinner is shown. Instead of this, I could add a message like 'No project found', and a link to navigate back to the index page, where the user can select a project again.

mcserep commented 1 year ago

Unfortunately it does not work like you described it. The project selector page does not load, only the spinner is shown.

With the brower's devtool I noticed it tried to load the ProjectService for CodeCompass, which was not a parsed project on my notebook, so it failed. I did not select any project, because even the project selection page was not loading.

But maybe the source of the bug is then, that it calls ProjectService prior to selecting a project?

Message ID: @.***>

mdeme01 commented 1 year ago

Yes, the problem was that the initial value for the workspaceId was CodeCompass, and it tried to call the service related to it, which did not exist in your case. I set the initial value to an empty string, and as long as it is empty, the project page will contain a link back to the index page where you can select one of your parsed projects.

(The other problem was that the spinner was rendered instead of the whole app, not just the project page.)

I fixed this here. I will create a PR as soon as I fixed most of the issues.