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

MenuItems that infer from entity type config #2833

Closed
2 tasks done
Tracked by #2272
sleidig opened this issue Feb 3, 2025 · 4 comments · Fixed by #2875
Closed
2 tasks done
Tracked by #2272

MenuItems that infer from entity type config #2833

sleidig opened this issue Feb 3, 2025 · 4 comments · Fixed by #2875
Assignees
Labels
Client: by X released on @master managed by CI (semantic-release) released managed by CI (semantic-release)

Comments

@sleidig
Copy link
Member

sleidig commented Feb 3, 2025

extend MenuItem interface and NavigationComponent to support an alternative menu item that configures the Entity Type and uses the label, icon and route of that type for the menu entry dynamically instead of configuring it explicitly (which duplicates the information and doesn't update when the user changes the label/icon of the entity).

  • implement new interface
  • implement generator from EntityMenuItem to normal MenuItem objects for the component

Maybe something like this:

/**
 * A simple object defining details of an entry in the main navigation.
 */
export interface MenuItem {
  /**
   * The text to be displayed in the menu.
   */
  label: string;

  /**
   * The icon to be displayed left of the label.
   */
  icon?: string;

  /**
   * The url fragment to which the item will route to (e.g. '/dashboard')
   */
  link?: string;

  subMenu?: MenuItem[];
}

/**
 * A alternative MenuItem details of an entry in the main navigation.
 * If a base MenuItem property (like "label") is defined, it overwrites the inferred value from the Entity type.
 */
export interface EntityMenuItem extends MenuItem {

  /**
   * The entity type to whose list this item should link.
   */
  entityType: string;
}

function getMenuItem(item: EntityMenuItem): MenuItem {
  // parse ... by looking up the entityType from EntityRegistry and then using its config:
  // link = entityType.route
  // icon = entityType.icon
  // label = entityType.labelPlural
}
@github-project-automation github-project-automation bot moved this to Triage / Analysis in All Tasks & Issues Feb 3, 2025
@sleidig sleidig moved this from Triage / Analysis to Planned (current "sprint") in All Tasks & Issues Feb 3, 2025
@sleidig
Copy link
Member Author

sleidig commented Feb 4, 2025

  constructor(entityRegistry: EntityRegistry) {
    const entityTypeObject = entityRegistry.get("Child");
    entityTypeObject
  }
  
  generateMenuItem(entityType: string): MenuItem {
    
  }

@sleidig sleidig assigned sadaf895 and unassigned Abhinegi2 and sadaf895 Feb 4, 2025
@sleidig sleidig moved this from Planned (current "sprint") to Todo (ready for work) in All Tasks & Issues Feb 7, 2025
@Abhinegi2 Abhinegi2 self-assigned this Feb 24, 2025
@Abhinegi2 Abhinegi2 moved this from Todo (ready for work) to In Progress in All Tasks & Issues Feb 24, 2025
@Abhinegi2 Abhinegi2 moved this from In Progress to Planned (current "sprint") in All Tasks & Issues Feb 24, 2025
@Abhinegi2 Abhinegi2 moved this from Planned (current "sprint") to In Progress in All Tasks & Issues Feb 24, 2025
@Abhinegi2 Abhinegi2 moved this from In Progress to Functional Review in All Tasks & Issues Feb 24, 2025
@Abhinegi2
Copy link
Contributor

@george-neha, could you test the following on (https://pr-2875.aam-digital.net/)?

  • Navigate to Children → Edit Data Structure → General Settings.
    • Try changing the Label (Plural) and Icon, then save the changes.
    • Verify that the Name and Icon are updated accordingly in the left sidebar menu.

@george-neha george-neha moved this from Functional Review to Technical Review in All Tasks & Issues Feb 24, 2025
@sleidig sleidig moved this from Technical Review to In Progress in All Tasks & Issues Feb 24, 2025
@Abhinegi2 Abhinegi2 moved this from In Progress to Technical Review in All Tasks & Issues Feb 25, 2025
@sleidig sleidig moved this from Technical Review to Done in All Tasks & Issues Feb 27, 2025
sleidig added a commit that referenced this issue Feb 27, 2025
@aam-digital-ci
Copy link
Collaborator

🎉 This issue has been resolved in version 3.47.0-master.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released on @master managed by CI (semantic-release) label Feb 27, 2025
@aam-digital-ci
Copy link
Collaborator

🎉 This issue has been resolved in version 3.47.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released managed by CI (semantic-release) label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client: by X released on @master managed by CI (semantic-release) released managed by CI (semantic-release)
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants