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

MenuItemModel lacks text and link properties #3748

Closed
otuoma opened this issue Dec 16, 2024 · 3 comments
Closed

MenuItemModel lacks text and link properties #3748

otuoma opened this issue Dec 16, 2024 · 3 comments
Assignees

Comments

@otuoma
Copy link

otuoma commented Dec 16, 2024

Describe the bug

In strongly typed typescript setups, using the properties 'link' and 'text' on instances of MenuItemModel fails with the following error

  Object literal may only specify known properties, and 'text' does not exist in type 'MenuItemModel'.

To Reproduce

Steps to reproduce the behavior:

  1. Use with the example below
@Component({
  selector: 'ds-navbar',
  styleUrls: ['./navbar.component.scss'],
  templateUrl: './navbar.component.html',
  animations: [slideMobileNav]
})
export class NavbarComponent extends BaseComponent implements OnInit {
  scholarsMenu: MenuSection = {
    id: 'scholars_menu',
    visible: true,
    active: false,
    model: { type: MenuItemType.LINK, disabled: false, text: 'Scholar Profiles', link: '/communities/fb79-513', },
    index: 0,
    shouldPersistOnRouteChange: true,
  };

  ngOnInit() {
    super.ngOnInit();
    this.menuService.addSection(this.menuID, this.scholarsMenu);
  }
}

Expected behavior

All properties should be defined on the model interface

Related work

I have created a PR #3750

@otuoma otuoma added bug needs triage New issue needs triage and/or scheduling labels Dec 16, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Triage in DSpace Backlog Dec 16, 2024
@tdonohue tdonohue added code task and removed needs triage New issue needs triage and/or scheduling labels Dec 16, 2024
@tdonohue tdonohue moved this to 📋 To Do in DSpace 9.0 Release Dec 16, 2024
@tdonohue tdonohue moved this from 📋 To Do to 🏗 In Progress in DSpace 9.0 Release Dec 16, 2024
@otuoma
Copy link
Author

otuoma commented Dec 17, 2024

Sorry @tdonohue, it's my first PR here. What am I supposed do at this stage?

@tdonohue
Copy link
Member

@otuoma : At this stage, your PR has made it onto our Project Board (https://github.com/orgs/DSpace/projects/31) and is waiting on a volunteer to review it. So, there's nothing for you to do but be patient. Please do keep in mind though that we have a backlog of reviews currently (and it's the end of the year) so, unfortunately, it may be a while until a volunteer is able to review your work.

If you wanted to try to speed up the process, you are also allowed to ask a different developer if they would be willing to trade reviews (where you would review/test one of their PRs in exchange for them reviewing/testing yours). See https://wiki.lyrasis.org/display/DSPACE/Trading+reviews+on+Pull+Requests

@tdonohue
Copy link
Member

As noted in the PR (see this comment), we discovered this was not a bug. Instead, the issue was caused by slightly incorrect code.

In order to specify a MenuItemType.LINK you MUST use LinkMenuItemModel like this:

model: { type: MenuItemType.LINK, disabled: false, text: 'Scholar Profiles', link: '/communities/fb79-513', } as LinkMenuItemModel,

The above code example (in the issue description) had accidentally left off the as LinkMenuItemModel, which is why the error was occurring.

@tdonohue tdonohue closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in DSpace 9.0 Release Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants