You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. /** @odoo-module */
  2. import { patch } from '@web/core/utils/patch';
  3. import { NavBar } from '@web/webclient/navbar/navbar';
  4. import { AppsMenu } from "@muk_web_theme/webclient/appsmenu/appsmenu";
  5. import { AppsSearch } from "@muk_web_theme/webclient/appssearch/appssearch";
  6. import { AppsBar } from '@muk_web_theme/webclient/appsbar/appsbar';
  7. patch(NavBar.prototype, 'muk_web_theme.NavBar', {
  8. getAppsMenuItems(apps) {
  9. return apps.map((menu) => {
  10. const appsMenuItem = {
  11. id: menu.id,
  12. name: menu.name,
  13. xmlid: menu.xmlid,
  14. appID: menu.appID,
  15. actionID: menu.actionID,
  16. href: this.getMenuItemHref(menu),
  17. action: () => this.menuService.selectMenu(menu),
  18. };
  19. if (menu.webIconData) {
  20. const prefix = (
  21. menu.webIconData.startsWith('P') ?
  22. 'data:image/svg+xml;base64,' :
  23. 'data:image/png;base64,'
  24. );
  25. appsMenuItem.webIconData = (
  26. menu.webIconData.startsWith('data:image') ?
  27. menu.webIconData :
  28. prefix + menu.webIconData.replace(/\s/g, '')
  29. );
  30. }
  31. return appsMenuItem;
  32. });
  33. },
  34. });
  35. patch(NavBar, 'muk_web_theme.NavBar', {
  36. components: {
  37. ...NavBar.components,
  38. AppsMenu,
  39. AppsSearch,
  40. AppsBar,
  41. },
  42. });