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
Add events tab in pipelinerun and taskrun details page #6867
Add events tab in pipelinerun and taskrun details page #6867
Conversation
frontend/packages/dev-console/src/components/pipelineruns/events/PipelineRunEvents.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/events/__tests__/event-utils.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
frontend/packages/dev-console/src/components/pipelineruns/events/event-utils.ts
Outdated
Show resolved
Hide resolved
b45ff07
to
dcc2924
Compare
it works fine now |
/assign @andrewballantyne |
dcc2924
to
8300c69
Compare
8300c69
to
21cb654
Compare
Rebased and pushed due to conflicts from debsmita's PR. |
}); | ||
|
||
it('Should contain events page', () => { | ||
const wrapper = shallow(<PipelineRunDetailsPage {...pipelineRunDetailsPageProps} />); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : as wrapper is not changing, shall we have it in beforeEach block
const PipelineRunEvents: React.FC<PipelineRunEventsProps> = ({ obj: pipelineRun, ...props }) => { | ||
const { match } = props; | ||
const namespace = match.params.ns; | ||
|
||
return ( | ||
<ResourcesEventStream | ||
filters={usePipelineRunFilters(namespace, pipelineRun)} | ||
namespace={namespace} | ||
/> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
const PipelineRunEvents: React.FC<PipelineRunEventsProps> = ({ obj: pipelineRun, ...props }) => { | |
const { match } = props; | |
const namespace = match.params.ns; | |
return ( | |
<ResourcesEventStream | |
filters={usePipelineRunFilters(namespace, pipelineRun)} | |
namespace={namespace} | |
/> | |
); | |
}; | |
const PipelineRunEvents: React.FC<PipelineRunEventsProps> = ({ obj: pipelineRun, match: { params }}) => ( | |
<ResourcesEventStream | |
filters={usePipelineRunFilters(namespace, pipelineRun)} | |
namespace={params.ns} | |
/> | |
) |
export const usePipelineRunRelatedResources = ( | ||
namespace: string, | ||
pipelineRunName: string, | ||
): WatchK8sResults<ResourcesType> => { | ||
const plrRelatedResources: WatchK8sResources<ResourcesType> = React.useMemo(() => { | ||
return { | ||
taskruns: { | ||
kind: referenceForModel(TaskRunModel), | ||
namespace, | ||
selector: { | ||
matchLabels: { [TektonResourceLabel.pipelinerun]: pipelineRunName }, | ||
}, | ||
isList: true, | ||
optional: true, | ||
}, | ||
pods: getPodsByLabels(namespace, { [TektonResourceLabel.pipelinerun]: pipelineRunName }), | ||
}; | ||
}, [namespace, pipelineRunName]); | ||
return useK8sWatchResources<ResourcesType>(plrRelatedResources); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of having 2 separate hooks usePipelineRunRelatedResources
, usePipelineRunFilters
can we have
const plrRelatedResources: WatchK8sResources<ResourcesType> = React.useMemo(() => {
return {
taskruns: {
kind: referenceForModel(TaskRunModel),
namespace,
selector: {
matchLabels: { [TektonResourceLabel.pipelinerun]: pipelineRunName },
},
isList: true,
optional: true,
},
pods: getPodsByLabels(namespace, { [TektonResourceLabel.pipelinerun]: pipelineRunName }),
};
}, [namespace, pipelineRunName])
and use useK8sWatchResources<ResourcesType>(plrRelatedResources);
in hook usePipelineRunFilters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Reason I decoupled this usePipelineRunRelatedResources
hook from usePipelineRunFilters
is, the usePipelineRunFilters
returns an array filter functions specific to the ResourcesEventStream
component. So, later if we need the taskRuns
and Pods
associated to a pipelineRun for some other usecase, then we call this common hook usePipelineRunRelatedResources
.
const TaskRunEvents: React.FC<TaskRunEventsProps> = ({ obj: taskRun, ...props }) => { | ||
const { match } = props; | ||
const namespace = match.params.ns; | ||
return ( | ||
<ResourcesEventStream filters={useTaskRunFilters(namespace, taskRun)} namespace={namespace} /> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
const TaskRunEvents: React.FC<TaskRunEventsProps> = ({ obj: taskRun, ...props }) => { | |
const { match } = props; | |
const namespace = match.params.ns; | |
return ( | |
<ResourcesEventStream filters={useTaskRunFilters(namespace, taskRun)} namespace={namespace} /> | |
); | |
}; | |
const TaskRunEvents: React.FC<TaskRunEventsProps> = ({ obj: taskRun, match: { params }) => ( | |
<ResourcesEventStream filters={useTaskRunFilters(params.ns, taskRun)} namespace={params.ns} /> | |
); |
21cb654
to
c1cd307
Compare
/lgtm Verified the changes , looks good |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bgliwa01, debsmita1, invincibleJai, karthikjeeyar The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes: https://issues.redhat.com/browse/ODC-4802
Description:
Add Events tab to the pipelinerun details page and in taskrun details page.
Screenshots:
PipelineRun Details page:
TaskRun Details page:
Test cases:
Taskrun details page
Pipelinerun details page
PipelienRun Events
TaskRun Events
event-utils:
/kind feature
cc: @andrewballantyne @siamaksade @openshift/team-devconsole-ux