Skip to content

Commit

Permalink
Merge pull request #37 from lokanandaprabhu/feature/link-total-pipeli…
Browse files Browse the repository at this point in the history
…neruns

fix: Added link to total runs in list page to redirect to plr tab
  • Loading branch information
openshift-merge-bot[bot] authored Dec 19, 2023
2 parents 6982f8b + f8b4d29 commit 1e9a55c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import * as React from 'react';
import { Link } from 'react-router-dom-v5-compat';
import { SummaryProps, getReferenceForModel, listPageTableColumnClasses as tableColumnClasses } from '../utils';
import { ResourceLink, RowProps, useActiveNamespace } from '@openshift-console/dynamic-plugin-sdk';
import { formatTime, formatTimeLastRunTime } from '../dateTime';
import { ALL_NAMESPACES_KEY } from '../../../consts';
import { PipelineModel } from '../../../models';


const pipelineReference = getReferenceForModel(PipelineModel);

const PipelineRunsForPipelinesRow: React.FC<RowProps<SummaryProps>> = ({
obj,
}) => {
const [activeNamespace] = useActiveNamespace();

const [namespace, name] = obj.group_value.split('/')

return (
<>
<td className={tableColumnClasses[0]}>
<ResourceLink
kind={pipelineReference}
name={obj?.group_value.split('/')[1]}
namespace={obj?.group_value.split('/')[0]}
kind={pipelineReference}
name={name}
namespace={namespace}
/>
</td>
{activeNamespace === ALL_NAMESPACES_KEY &&
<td className={tableColumnClasses[1]}>
<ResourceLink kind="Namespace" name={obj?.group_value.split('/')[0]} />
<ResourceLink kind="Namespace" name={name} />
</td>}
<td className={tableColumnClasses[2]}>
{obj.total}
<Link to={`/k8s/ns/${namespace}/${pipelineReference}/${name}/Runs`}>
{obj.total}
</Link>
</td>
<td className={tableColumnClasses[3]}>{formatTime(obj.total_duration)}</td>
<td className={tableColumnClasses[4]}>{formatTime(obj.avg_duration)}</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { Link } from 'react-router-dom-v5-compat';
import { ResourceLink, RowProps, useActiveNamespace } from '@openshift-console/dynamic-plugin-sdk';
import { SummaryProps, getReferenceForModel, listPageTableColumnClasses as tableColumnClasses } from '../utils';
import { formatTime, formatTimeLastRunTime } from '../dateTime';
Expand All @@ -11,21 +12,25 @@ const PipelineRunsForRepositoriesRow: React.FC<RowProps<SummaryProps>> = ({
obj,
}) => {
const [activeNamespace] = useActiveNamespace();
const [namespace, name] = obj.group_value.split('/')

return (
<>
<td className={tableColumnClasses[0]}>
<ResourceLink
kind={repositoryReference}
name={obj?.group_value.split('/')[1]}
namespace={obj?.group_value.split('/')[0]}
/></td>
<ResourceLink
kind={repositoryReference}
name={name}
namespace={namespace}
/>
</td>
{activeNamespace === ALL_NAMESPACES_KEY &&
<td className={tableColumnClasses[1]}>
<ResourceLink kind="Namespace" name={obj?.group_value.split('/')[0]} />
<ResourceLink kind="Namespace" name={name} />
</td>}
<td className={tableColumnClasses[2]}>
{obj.total}
<Link to={`/k8s/ns/${namespace}/${repositoryReference}/${name}/Runs`}>
{obj.total}
</Link>
</td>
<td className={tableColumnClasses[3]}>{formatTime(obj.total_duration)}</td>
<td className={tableColumnClasses[4]}>{formatTime(obj.avg_duration)}</td>
Expand Down

0 comments on commit 1e9a55c

Please sign in to comment.