"Cancel pipeline" button present but there are no remaining jobs

Summary

If using DAG for jobs, some finished pipelines with status blocked or passed still show the 🚫 button.

Steps to reproduce

Combine manual jobs with another set for jobs that need those.

What is the current bug behavior?

In the Build>Pipelines page some pipelines in the list have the 🚫 action.

In the Pipeline page with all the jobs there is a Cancel pipeline button in the top right corner near Delete button.

What is the expected correct behavior?

There should be no 🚫 button as there are no remaining jobs.

Relevant logs and/or screenshots

First case for a passed pipeline with just one job with status manual:

Screenshot_2024-01-13_at_18.14.02

Second case for blocked pipeline with two manual jobs and two more jobs that are waiting (status created):

Screenshot_2024-01-13_at_18.14.44

This job has not been triggered yet
This job depends on upstream jobs that need to succeed in order for this job to be triggered

For the last one even the pipeline stage status is wrongly set to Running.

Possible fixes

Jobs with needs: or dependencies: should not be considered as Running or Pending until those conditions are fulfilled.