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

Bug 1921762: Fix knative serving and eventing breadcrumbs #7885

Merged

Conversation

debsmita1
Copy link
Contributor

@debsmita1 debsmita1 commented Jan 20, 2021

Fixes:
https://issues.redhat.com/browse/ODC-5341

Solution description:

GIF & Screenshot:
breadcrumbs

when no subscriber is associated with Trigger
nosubscriberassociatedwithtrigger

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@debsmita1
Copy link
Contributor Author

/cc @invincibleJai
/cc @sahil143
/assign @christianvogt

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

@debsmita1 This implementation will only work for the static model. In case of dynamic models eventsources/channels this will fail. I created plugin extension to handle the breadcrumbs for detail page which covers the dynamic event sources as well. I raised a PR against your PR debsmita1#6.

Plugin Extension:

namespace ExtensionProperties {
  export interface DetailPageBreadCrumbs {
    /**
     * array of models(kindObj) against which bread crumb is formed
     */
    getModels: () => K8sKind[] | K8sKind;
    /**
     * returns breadcrumb for the given kindref
     */
    useBreadcrumbs: (kind: string, urlMatch: match<any>) => any;
  }
}

export interface DetailPageBreadCrumbs
  extends Extension<ExtensionProperties.DetailPageBreadCrumbs> {
  type: 'DetailPageBreadCrumbs';
}

export const isDetailPageBreadCrumbs = (e: Extension): e is DetailPageBreadCrumbs => {
  return e.type === 'DetailPageBreadCrumbs';
};

cc @christianvogt @invincibleJai Please take a look.

@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/sdk Related to console-plugin-sdk labels Jan 21, 2021
@jerolimov
Copy link
Member

/retest

@debsmita1 debsmita1 changed the title fix knative serving and eventing breadcrumbs WIP: fix knative serving and eventing breadcrumbs Jan 22, 2021
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 22, 2021
@openshift-ci-robot openshift-ci-robot added the component/shared Related to console-shared label Jan 22, 2021
@debsmita1 debsmita1 changed the title WIP: fix knative serving and eventing breadcrumbs Fix knative serving and eventing breadcrumbs Jan 22, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 22, 2021
@invincibleJai
Copy link
Member

/retest

@invincibleJai
Copy link
Member

invincibleJai commented Jan 25, 2021

I verified the PR , it works as expected however Ci jobs are failing. tried retest

import { K8sKind } from '@console/internal/module/k8s';
import { useActivePerspective } from '@console/shared/src/hooks/useActivePerspective';
import { serverlessTab } from '../utils/serverless-tab-utils';
import { useTabbedTableBreadcrumbsFor } from '@console/shared';
Copy link
Member

Choose a reason for hiding this comment

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

nit: sort imports

@@ -49,53 +81,70 @@ export const DetailsPage = withFallback<DetailsPageProps>(({ pages = [], ...prop
})),
[resourcePageExtensions, props],
);

const kindObj = props.kindObj ? props.kindObj : modelFor(props.kind);
Copy link
Member

Choose a reason for hiding this comment

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

can we have

Suggested change
const kindObj = props.kindObj ? props.kindObj : modelFor(props.kind);
const kindObj = props.kindObj ?? modelFor(props.kind);

@debsmita1
Copy link
Contributor Author

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 27, 2021
@invincibleJai
Copy link
Member

/lgtm

Thanks , verified works as expected!!

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2021
@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. label Jan 28, 2021
@openshift-ci-robot
Copy link
Contributor

@debsmita1: This pull request references Bugzilla bug 1921762, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jan 28, 2021
@karthikjeeyar
Copy link
Contributor

Works as expected.
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 29, 2021
@karthikjeeyar
Copy link
Contributor

/retest

@spadgett
Copy link
Member

/override ci/prow/ceph-storage-plugin

The ceph-storage-plugin job should only have run on PRs with changes to frontend/packages/ceph-storage-plugin. It failed due to an unrelated CI config change. Overriding status on this PR.

@openshift-ci-robot
Copy link
Contributor

@spadgett: Overrode contexts on behalf of spadgett: ci/prow/ceph-storage-plugin

In response to this:

/override ci/prow/ceph-storage-plugin

The ceph-storage-plugin job should only have run on PRs with changes to frontend/packages/ceph-storage-plugin. It failed due to an unrelated CI config change. Overriding status on this PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

const kindObj = props.kindObj ?? modelFor(props.kind);
const resolvedBreadcrumbExtension = useBreadCrumbsForDetailPage(kindObj);
const onBreadcrumbsResolved = React.useCallback((breadcrumbs) => {
setPluginBreadcrumbs(breadcrumbs ? () => breadcrumbs : undefined);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you setting pluginBreadcrumbs with () => breadcrumbs when you're sending it to breadcrumbs prop of PageHeading? The type of breadcrumbs prop is { name: string; path: string }[];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

export * from './useEventSourceStatus';
import { getExecutableCodeRef } from '@console/dynamic-plugin-sdk/src/coderefs/coderef-utils';

export const eventSourceBreadcrumbsProvider = getExecutableCodeRef(() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think it's a good idea to replace index.ts with coderef hook exports here. This can be confusing as general imports would expect to work from /hooks directly which will not happen. Also this leads to changing older imports from the hooks folder which is not right. Better to create a new file or something that has all coderefs like these and then import from that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved these to src/providers

@@ -5,7 +5,7 @@ import { CatalogItem, CatalogExtensionHook } from '@console/plugin-sdk';
import { K8sKind, referenceForModel } from '@console/internal/module/k8s';
import { getEventSourceIcon } from '../utils/get-knative-icon';
import { getEventSourceCatalogProviderData } from './event-source-data';
import { useEventSourceModelsWithAccess } from '../hooks';
import { useEventSourceModelsWithAccess } from '../hooks/useEventSourceModelsWithAccess';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not change older imports. See my comment above.

@@ -11,7 +11,7 @@ import { QUERY_PROPERTIES } from '@console/dev-console/src/const';
import ConnectedEventSource from './EventSource';
import EventSourceAlert from './EventSourceAlert';
import { CamelKameletBindingModel } from '../../models';
import { useEventSourceStatus } from '../../hooks';
import { useEventSourceStatus } from '../../hooks/useEventSourceStatus';
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

const pages = [navFactory.details(SubscriptionDetails), navFactory.editYaml()];
const commonActions = Kebab.factory.common.map((action) => action);
const menuActionsCreator = [
...Kebab.getExtensionsActionsForKind(EventingSubscriptionModel),
...commonActions,
];
const breadcrumbsFor = useTabbedTableBreadcrumbsFor(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const breadcrumbsFor = useTabbedTableBreadcrumbsFor(
const breadcrumbs = useTabbedTableBreadcrumbsFor(

return (
<DetailsPage
{...props}
breadcrumbsFor={() => breadcrumbsFor}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
breadcrumbsFor={() => breadcrumbsFor}
breadcrumbsFor={() => breadcrumbs}


const TriggerDetailsPage: React.FC<React.ComponentProps<typeof DetailsPage>> = (props) => {
const { kindObj, match } = props;
const breadcrumbsFor = useTabbedTableBreadcrumbsFor(
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Similar suggestion for all such usages.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 1, 2021
Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

@debsmita1 everything looks good. just one nit.
verified locally as well. works as expected.

Comment on lines 122 to 125
breadcrumbsFor={
props.breadcrumbsFor
? props.breadcrumbsFor
: !pluginBreadcrumbs
? breadcrumbsForDetailsPage(props.kindObj, props.match)
: undefined
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
breadcrumbsFor={
props.breadcrumbsFor
? props.breadcrumbsFor
: !pluginBreadcrumbs
? breadcrumbsForDetailsPage(props.kindObj, props.match)
: undefined
}
breadcrumbsFor={
props.breadcrumbsFor
?? (!pluginBreadcrumbs
? breadcrumbsForDetailsPage(props.kindObj, props.match)
: undefined)
}

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 2, 2021
Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: debsmita1, invincibleJai, karthikjeeyar, rohitkrai03, sahil143

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 Feb 2, 2021
@openshift-merge-robot openshift-merge-robot merged commit 8cc6f80 into openshift:master Feb 2, 2021
@openshift-ci-robot
Copy link
Contributor

@debsmita1: All pull requests linked via external trackers have merged:

Bugzilla bug 1921762 has been moved to the MODIFIED state.

In response to this:

Bug 1921762: Fix knative serving and eventing breadcrumbs

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.7 milestone Feb 5, 2021
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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality component/knative Related to knative-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared kind/bug Categorizes issue or PR as related to a bug. 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

10 participants