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

fix: catalog entity tabs order #2425

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

its-mitesh-kumar
Copy link

@its-mitesh-kumar its-mitesh-kumar commented Feb 20, 2025

Fixing RHIDP-5803
Description : With the fix user will be able to order entity tabs by providing priority and also they can hide any default tab by providing -ve value as priority

entity-tabs-order_Z5zxRutJ.mp4

For testing add below config in app-config.yaml

dynamicPlugins:
  rootDirectory: dynamic-plugins-root
  frontend:
    roadiehq.backstage-plugin-github-pull-requests:
      mountPoints:
        - mountPoint: entity.page.overview/cards
          importName: EntityGithubPullRequestsOverviewCard
          config:
            layout:
              gridColumnEnd:
                lg: "span 4"
                md: "span 6"
                xs: "span 12"
            if:
              allOf:
                - isGithubPullRequestsAvailable
        - mountPoint: entity.page.pull-requests/cards
          importName: EntityGithubPullRequestsContent
          config:
            layout:
              gridColumn: "1 / -1"
            if:
              allOf:
                - isGithubPullRequestsAvailable

    entity-tabs-customization:
      entityTabs:
        - path: "/pr"
          title: "Changed Pull/Merge Requests"
          priority: 1
          mountPoint: "entity.page.pull-requests"
        - path: "/"
          title: "Changed Overview"
          mountPoint: "entity.page.overview"
          priority: 6
        - path: "/api"
          title: "My Api"
          mountPoint: "entity.page.api"
          priority: -7
        - path: "/dependencies"
          title: "Ghor Dependecy"
          mountPoint: "entity.page.dependencies"
          priority: 5

Try to play with priority

  1. -ve priority tabs will be not visible
  2. Higher priority tabs will be shown first

Copy link

openshift-ci bot commented Feb 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign gustavolira for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@its-mitesh-kumar its-mitesh-kumar changed the title fixing entity tabs order fix : Catalog entity tabs order Feb 20, 2025
Signed-off-by: its-mitesh-kumar <[email protected]>
@its-mitesh-kumar
Copy link
Author

cc @debsmita1 @christoph-jerolimov

@its-mitesh-kumar its-mitesh-kumar changed the title fix : Catalog entity tabs order fix: Catalog entity tabs order Feb 20, 2025
@its-mitesh-kumar its-mitesh-kumar changed the title fix: Catalog entity tabs order fix: catalog entity tabs order Feb 20, 2025
Signed-off-by: its-mitesh-kumar <[email protected]>
Copy link
Contributor

@@ -13,3 +16,20 @@ export const hasAnnotation = (keys: string) => (entity: Entity) =>

export const hasLinks = (entity: Entity) =>
Boolean(entity.metadata.links?.length);

export const mergeTabs = (
Copy link
Member

Choose a reason for hiding this comment

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

Is this function used elsewhere in the app? I think hasLinks and isType have been put in this file because they're conditional functions that are leveraged by the config mapping.

Copy link
Author

@its-mitesh-kumar its-mitesh-kumar Feb 24, 2025

Choose a reason for hiding this comment

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

No, this function is not used anywhere else. I moved it to utils to improve readability and keep the component cleaner and more maintainable. Let me know if you want it to move to component or some other new file .
@gashcrumb @debsmita1

Copy link
Member

Choose a reason for hiding this comment

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

you could create utils.tsx under EntityPage and move the merge util there

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Copy link

openshift-ci bot commented Feb 25, 2025

@its-mitesh-kumar: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-tests c21c25e link true /test e2e-tests

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants