backstage-plugin-gitlab
                                
                                
                                
                                    backstage-plugin-gitlab copied to clipboard
                            
                            
                            
                        Bug in the IssuesTable component
In line 68 of the IssuesTable.tsx file a check is made to assign the variable projectId the value of project_id (if it was passed as a parameter to the component), otherwise the value of the id attribute of the projectDetails object is passed.
const { value, loading, error } = useAsync(async (): Promise<{
    data: IssueObject[];
    projectName: string;
    }> => {
        let projectDetails: any = await GitlabCIAPI.getProjectDetails(project_slug);
        let projectId = project_id ? project_id : projectDetails?.id; // Line 68
        let projectName = await GitlabCIAPI.getProjectName(projectId);
        const gitlabIssuesObject = await GitlabCIAPI.getIssuesSummary(project_id); // Line 70 - The error occurs here
        const data = gitlabIssuesObject?.getIssuesData;
        let renderData: any = { data, projectName };
        
        return renderData;
}, []);
The error occurs when the project_id parameter is not passed to the component and on line 70 the request is made by passing an undefined value. This happens when the catalog-info.yaml file has only the gitlab.com/project-slug annotation.
The solution is simple: just pass the variable projectId (not project_id) when calling the API, as is done in other components such as PipelinesTable.tsx.
Hey! @PedroHPAlmeida
Is this why issues are not loading into the UI? I noticed in the API request it returns a 404 when trying to fetch issues.
I can take a look at this potentially if I have some time seeing as it has been open for a while.
That's right, @Parsifal-M! By cloning the plugin into my project, and making the changes I suggested, the problem was solved.
Hey @PedroHPAlmeida :wave:
Thanks for the heads up! I've raised a PR for this, hopefully, we can get it fixed.
Cheers!
Hi @PedroHPAlmeida and @Parsifal-M I suggest you to switch to the new official backstage-plugin-gitlab: https://github.com/immobiliare/backstage-plugin-gitlab ;)
Hi @PedroHPAlmeida and @Parsifal-M I suggest you to switch to the new official
backstage-plugin-gitlab: https://github.com/immobiliare/backstage-plugin-gitlab ;)
Ah, thanks for the heads up. :+1: