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

Bug in the IssuesTable component #208

Open
PedroHPAlmeida opened this issue Oct 21, 2022 · 5 comments
Open

Bug in the IssuesTable component #208

PedroHPAlmeida opened this issue Oct 21, 2022 · 5 comments

Comments

@PedroHPAlmeida
Copy link

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.

@Parsifal-M
Copy link

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.

@PedroHPAlmeida
Copy link
Author

That's right, @Parsifal-M!
By cloning the plugin into my project, and making the changes I suggested, the problem was solved.

@Parsifal-M
Copy link

Hey @PedroHPAlmeida 👋

Thanks for the heads up! I've raised a PR for this, hopefully, we can get it fixed.

Cheers!

@JellyBellyDev
Copy link

Hi @PedroHPAlmeida and @Parsifal-M I suggest you to switch to the new official backstage-plugin-gitlab: https://github.com/immobiliare/backstage-plugin-gitlab ;)

@Parsifal-M
Copy link

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. 👍

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 a pull request may close this issue.

3 participants