Skip to content

Commit

Permalink
chore: remove workspace dependency from ComponentLatestBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroPP committed Feb 4, 2025
1 parent e3ccfec commit a183e08
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ import {
import { useLatestSuccessfulBuildPipelineRunForComponent } from '../../../../hooks/usePipelineRuns';
import { useTaskRuns } from '../../../../hooks/useTaskRuns';
import { HttpError } from '../../../../k8s/error';
import { COMMIT_DETAILS_PATH } from '../../../../routes/paths';
import ErrorEmptyState from '../../../../shared/components/empty-state/ErrorEmptyState';
import { Timestamp } from '../../../../shared/components/timestamp/Timestamp';
import { ComponentKind } from '../../../../types';
import { getCommitsFromPLRs } from '../../../../utils/commits-utils';
import { getLastestImage } from '../../../../utils/component-utils';
import CommitLabel from '../../../Commits/commit-label/CommitLabel';
import { useBuildLogViewerModal } from '../../../LogViewer/BuildLogViewer';
import { useNamespace } from '../../../Namespace/useNamespaceInfo';
import ScanDescriptionListGroup from '../../../PipelineRun/PipelineRunDetailsView/tabs/ScanDescriptionListGroup';
import { useWorkspaceInfo } from '../../../Workspace/useWorkspaceInfo';

type ComponentLatestBuildProps = {
component: ComponentKind;
Expand All @@ -32,7 +33,7 @@ type ComponentLatestBuildProps = {
const ComponentLatestBuild: React.FC<React.PropsWithChildren<ComponentLatestBuildProps>> = ({
component,
}) => {
const { namespace, workspace } = useWorkspaceInfo();
const namespace = useNamespace();
const [pipelineRun, pipelineRunLoaded, error] = useLatestSuccessfulBuildPipelineRunForComponent(
namespace,
component.metadata.name,
Expand Down Expand Up @@ -101,7 +102,11 @@ const ComponentLatestBuild: React.FC<React.PropsWithChildren<ComponentLatestBuil
{commit ? (
<>
<Link
to={`/workspaces/${workspace}/applications/${commit.application}/commit/${commit.sha}`}
to={COMMIT_DETAILS_PATH.createPath({
workspaceName: namespace,
applicationName: commit.application,
commitSha: commit.sha,
})}
>
{commit.isPullRequest ? `#${commit.pullRequestNumber}` : ''} {commit.shaTitle}
</Link>
Expand Down

0 comments on commit a183e08

Please sign in to comment.