From 26a8a6bc8bafca2b25b20e55d4d9900dde99a448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 17 Dec 2025 16:10:03 +0100 Subject: [PATCH] random stuff --- .../static/src/demo/demo_client_action.js | 16 ++++ .../static/src/demo/demo_client_action.xml | 94 +++++++++++++++++++ addons/web_client/static/src/menu_plugin.js | 15 --- addons/web_client/static/src/web_client.js | 15 +-- addons/web_client/static/src/web_client.xml | 86 +---------------- .../src/notification/notification_plugin.js | 18 ++++ .../static/src/overlay/overlay_container.xml | 4 +- 7 files changed, 134 insertions(+), 114 deletions(-) create mode 100644 addons/web_client/static/src/demo/demo_client_action.js create mode 100644 addons/web_client/static/src/demo/demo_client_action.xml diff --git a/addons/web_client/static/src/demo/demo_client_action.js b/addons/web_client/static/src/demo/demo_client_action.js new file mode 100644 index 0000000000000..ab10dcd615ea8 --- /dev/null +++ b/addons/web_client/static/src/demo/demo_client_action.js @@ -0,0 +1,16 @@ +import { Component } from "@odoo/owl"; +import { notify } from "@web_core/notification/notification_plugin"; + +export class DemoClientAction extends Component { + static template = "web_client.DemoClientAction"; + + async notify() { + const rnd = Math.random().toString(36).substring(2, 10); + /** @type {any} */ + const types = ["danger", "info", "success", "warning"]; + await notify(rnd, { + title: "Notification", + type: types[Math.floor(Math.random() * types.length)], + }); + } +} diff --git a/addons/web_client/static/src/demo/demo_client_action.xml b/addons/web_client/static/src/demo/demo_client_action.xml new file mode 100644 index 0000000000000..bd594c43916ca --- /dev/null +++ b/addons/web_client/static/src/demo/demo_client_action.xml @@ -0,0 +1,94 @@ + + + + +
+

Demo Client Action!

+ +

This is the content of the page. Scroll down to see more.

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+

...more content...

+
+
+ +
diff --git a/addons/web_client/static/src/menu_plugin.js b/addons/web_client/static/src/menu_plugin.js index fcbd48ca3d5f7..6650f3726c348 100644 --- a/addons/web_client/static/src/menu_plugin.js +++ b/addons/web_client/static/src/menu_plugin.js @@ -39,21 +39,6 @@ import { serviceRegistry } from "@web_core/services"; */ class MenuItem { - /** @type {number | null} */ - actionId; - /** @type {number} */ - id; - /** @type {MenuItem[]} */ - menuItems; - /** @type {string} */ - name; - /** @type {string | null} */ - path; - /** @type {string | null} */ - resModel; - /** @type {string} */ - xmlId; - /** * @param {MenuItemData} menuItemData * @param {MenuDataMap} dataMap diff --git a/addons/web_client/static/src/web_client.js b/addons/web_client/static/src/web_client.js index 1d84b9d1c95ef..e363801046f2a 100644 --- a/addons/web_client/static/src/web_client.js +++ b/addons/web_client/static/src/web_client.js @@ -2,12 +2,12 @@ import { Component, onWillStart } from "@odoo/owl"; import { ORM } from "@web_core/orm"; import { OverlayContainer } from "@web_core/overlay/overlay_container"; import { protectedPlugin } from "@web_core/plugin_protection"; +import { DemoClientAction } from "./demo/demo_client_action"; import { Navbar } from "./navbar"; -import { notify } from "@web_core/notification/notification_plugin"; export class WebClient extends Component { static template = "web_client.WebClient"; - static components = { Navbar, OverlayContainer }; + static components = { Navbar, OverlayContainer, DemoClientAction }; orm = protectedPlugin(ORM); @@ -18,15 +18,4 @@ export class WebClient extends Component { }); }); } - - async notify() { - const rnd = Math.random().toString(36).substring(2, 10); - /** @type {any} */ - const types = ["danger", "info", "success", "warning"]; - await notify(rnd, { - title: "Notification", - type: types[Math.floor(Math.random() * types.length)], - }); - console.log("Notification closed"); - } } diff --git a/addons/web_client/static/src/web_client.xml b/addons/web_client/static/src/web_client.xml index 2bccd92aec667..e1e5cd1ab12fd 100644 --- a/addons/web_client/static/src/web_client.xml +++ b/addons/web_client/static/src/web_client.xml @@ -4,91 +4,7 @@
-

Welcome to the page!

- -

This is the content of the page. Scroll down to see more.

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

-

...more content...

+
diff --git a/addons/web_core/static/src/notification/notification_plugin.js b/addons/web_core/static/src/notification/notification_plugin.js index 7ecd0697526a7..77d0083874a57 100644 --- a/addons/web_core/static/src/notification/notification_plugin.js +++ b/addons/web_core/static/src/notification/notification_plugin.js @@ -1,8 +1,26 @@ +/** + * ----------------------------------------------------------------------------- + * Notification Plugin + * ----------------------------------------------------------------------------- + * + * This file defines the `NotificationPlugin`, a service-level plugin responsible + * for managing application notifications. It integrates with the overlay system + * to display notifications, maintains a reactive collection of active entries, + * and supports configurable types, durations, titles, and action buttons. + * + * A standalone `notify` function is also provided as a convenience wrapper + * around the service, allowing callers to trigger notifications without + * directly accessing the plugin instance. + * ----------------------------------------------------------------------------- + */ + import { computed, plugin, Plugin, signal } from "@odoo/owl"; import { NotificationContainer } from "@web_core/notification/notification_container"; import { OverlayPlugin } from "@web_core/overlay/overlay_plugin"; import { service, serviceRegistry } from "@web_core/services"; + + /** * @type {NotificationPlugin["push"]} */ diff --git a/addons/web_core/static/src/overlay/overlay_container.xml b/addons/web_core/static/src/overlay/overlay_container.xml index 4396e81331512..ca7ca1540857a 100644 --- a/addons/web_core/static/src/overlay/overlay_container.xml +++ b/addons/web_core/static/src/overlay/overlay_container.xml @@ -3,7 +3,9 @@
- +
+ +