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

Add events tab in pipelinerun and taskrun details page #6867

Merged

Conversation

karthikjeeyar
Copy link
Contributor

@karthikjeeyar karthikjeeyar commented Oct 8, 2020

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:
image
TaskRun Details page:
image

Test cases:
Taskrun details page
image

Pipelinerun details page
image

PipelienRun Events
image
TaskRun Events
image
event-utils:
image

/kind feature
cc: @andrewballantyne @siamaksade @openshift/team-devconsole-ux

@openshift-ci-robot openshift-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. component/dev-console Related to dev-console labels Oct 8, 2020
Copy link

@bgliwa01 bgliwa01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@karthikjeeyar karthikjeeyar force-pushed the feat-events-tab branch 2 times, most recently from b45ff07 to dcc2924 Compare October 9, 2020 08:52
@debsmita1
Copy link
Contributor

it works fine now
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 9, 2020
@karthikjeeyar
Copy link
Contributor Author

/assign @andrewballantyne

@karthikjeeyar
Copy link
Contributor Author

Rebased and pushed due to conflicts from debsmita's PR.

});

it('Should contain events page', () => {
const wrapper = shallow(<PipelineRunDetailsPage {...pipelineRunDetailsPageProps} />);
Copy link
Member

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

Comment on lines 14 to 24
const PipelineRunEvents: React.FC<PipelineRunEventsProps> = ({ obj: pipelineRun, ...props }) => {
const { match } = props;
const namespace = match.params.ns;

return (
<ResourcesEventStream
filters={usePipelineRunFilters(namespace, pipelineRun)}
namespace={namespace}
/>
);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
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}
/>
)

Comment on lines +39 to +58
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);
};
Copy link
Member

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

Copy link
Contributor Author

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.

Comment on lines 14 to 20
const TaskRunEvents: React.FC<TaskRunEventsProps> = ({ obj: taskRun, ...props }) => {
const { match } = props;
const namespace = match.params.ns;
return (
<ResourcesEventStream filters={useTaskRunFilters(namespace, taskRun)} namespace={namespace} />
);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
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} />
);

@invincibleJai
Copy link
Member

/lgtm
/approve

Verified the changes , looks good

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2020
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2020
@openshift-merge-robot openshift-merge-robot merged commit b67adcc into openshift:master Oct 20, 2020
@spadgett spadgett added this to the v4.7 milestone Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/dev-console Related to dev-console kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants