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.

88 lines
3.2 KiB

  1. /** @odoo-module **/
  2. /**********************************************************************************
  3. *
  4. * Copyright (c) 2017-today MuK IT GmbH.
  5. *
  6. * This file is part of MuK REST for Odoo
  7. * (see https://mukit.at).
  8. *
  9. * MuK Proprietary License v1.0
  10. *
  11. * This software and associated files (the "Software") may only be used
  12. * (executed, modified, executed after modifications) if you have
  13. * purchased a valid license from MuK IT GmbH.
  14. *
  15. * The above permissions are granted for a single database per purchased
  16. * license. Furthermore, with a valid license it is permitted to use the
  17. * software on other databases as long as the usage is limited to a testing
  18. * or development environment.
  19. *
  20. * You may develop modules based on the Software or that use the Software
  21. * as a library (typically by depending on it, importing it and using its
  22. * resources), but without copying any source code or material from the
  23. * Software. You may distribute those modules under the license of your
  24. * choice, provided that this license is compatible with the terms of the
  25. * MuK Proprietary License (For example: LGPL, MIT, or proprietary licenses
  26. * similar to this one).
  27. *
  28. * It is forbidden to publish, distribute, sublicense, or sell copies of
  29. * the Software or modified copies of the Software.
  30. *
  31. * The above copyright notice and this permission notice must be included
  32. * in all copies or substantial portions of the Software.
  33. *
  34. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  35. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  37. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  39. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  40. * DEALINGS IN THE SOFTWARE.
  41. *
  42. **********************************************************************************/
  43. import { patch } from '@web/core/utils/patch';
  44. import { NavBar } from '@web/webclient/navbar/navbar';
  45. import { AppsMenu } from "@muk_web_theme/webclient/appsmenu/appsmenu";
  46. import { AppsSearch } from "@muk_web_theme/webclient/appssearch/appssearch";
  47. import { AppsBar } from '@muk_web_theme/webclient/appsbar/appsbar';
  48. patch(NavBar.prototype, 'muk_web_theme.NavBar', {
  49. getAppsMenuItems(apps) {
  50. return apps.map((menu) => {
  51. const appsMenuItem = {
  52. id: menu.id,
  53. name: menu.name,
  54. xmlid: menu.xmlid,
  55. appID: menu.appID,
  56. actionID: menu.actionID,
  57. href: this.getMenuItemHref(menu),
  58. action: () => this.menuService.selectMenu(menu),
  59. };
  60. if (menu.webIconData) {
  61. const prefix = (
  62. menu.webIconData.startsWith('P') ?
  63. 'data:image/svg+xml;base64,' :
  64. 'data:image/png;base64,'
  65. );
  66. appsMenuItem.webIconData = (
  67. menu.webIconData.startsWith('data:image') ?
  68. menu.webIconData :
  69. prefix + menu.webIconData.replace(/\s/g, '')
  70. );
  71. }
  72. return appsMenuItem;
  73. });
  74. },
  75. });
  76. patch(NavBar, 'muk_web_theme.NavBar', {
  77. components: {
  78. ...NavBar.components,
  79. AppsMenu,
  80. AppsSearch,
  81. AppsBar,
  82. },
  83. });