[REF] web, *: remove unused blockUI and unblockUI from legacy misc

Since [1], these two functions are no longer used.
We can now remove the entire file.

Follow-up of [2]

[1] https://github.com/odoo/enterprise/pull/45869
[2] https://github.com/odoo/odoo/pull/132072

Task ID: 3439226

Part-of: odoo/odoo#132295
This commit is contained in:
Adrien Dieudonné
2023-08-24 21:59:42 +02:00
parent 3de718c2e0
commit 2511323d87
5 changed files with 1 additions and 107 deletions
@@ -179,7 +179,6 @@
'web/static/src/legacy/backend_utils.js',
'web/static/src/legacy/utils.js',
'web/static/src/legacy/js/core/dates.js',
'web/static/src/legacy/js/core/misc.js',
'web/static/src/legacy/js/services/session.js',
'web/static/src/legacy/js/widgets/date_picker.js',
'web/static/src/legacy/js/env.js',
-1
View File
@@ -230,7 +230,6 @@
'web/static/src/legacy/backend_utils.js',
'web/static/src/legacy/utils.js',
'web/static/src/legacy/js/core/dates.js',
'web/static/src/legacy/js/core/misc.js',
'web/static/src/legacy/js/services/session.js',
'web/static/src/legacy/js/widgets/date_picker.js',
'web/static/src/legacy/js/env.js',
-2
View File
@@ -170,7 +170,6 @@ This module provides the core of the Odoo Web Client.
'web/static/src/legacy/backend_utils.js',
'web/static/src/legacy/utils.js',
'web/static/src/legacy/js/core/dates.js',
'web/static/src/legacy/js/core/misc.js',
'web/static/src/legacy/js/services/session.js',
'web/static/src/legacy/js/widgets/date_picker.js',
'web/static/src/legacy/js/env.js',
@@ -307,7 +306,6 @@ This module provides the core of the Odoo Web Client.
'web/static/src/legacy/utils.js',
'web/static/src/legacy/js/core/dates.js',
'web/static/src/legacy/js/core/misc.js',
'web/static/src/legacy/js/owl_compatibility.js',
'web/static/src/legacy/js/services/session.js',
'web/static/src/legacy/js/public/public_env.js',
@@ -1,98 +0,0 @@
/** @odoo-module **/
import { _t } from "@web/core/l10n/translation";
import Widget from "@web/legacy/js/core/widget";
var messages_by_seconds = function() {
return [
[0, _t("Loading...")],
[20, _t("Still loading...")],
[60, _t("Still loading...<br />Please be patient.")],
[120, _t("Don't leave yet,<br />it's still loading...")],
[300, _t("You may not believe it,<br />but the application is actually loading...")],
[420, _t("Take a minute to get a coffee,<br />because it's loading...")],
[3600, _t("Maybe you should consider reloading the application by pressing F5...")]
];
};
var Throbber = Widget.extend({
template: "Throbber",
start: function() {
this.start_time = new Date().getTime();
this.act_message();
},
act_message: function() {
var self = this;
setTimeout(function() {
if (self.isDestroyed())
return;
var seconds = (new Date().getTime() - self.start_time) / 1000;
var mes;
messages_by_seconds().forEach((el) => {
if (seconds >= el[0])
mes = el[1];
});
self.$(".oe_throbber_message").html(mes);
self.act_message();
}, 1000);
},
});
/** Setup blockui */
if ($.blockUI) {
$.blockUI.defaults.baseZ = 1100;
$.blockUI.defaults.message = '<div class="openerp oe_blockui_spin_container" style="background-color: transparent;">';
$.blockUI.defaults.css.border = '0';
$.blockUI.defaults.css["background-color"] = '';
}
/**
* Remove the "accesskey" attributes to avoid the use of the access keys
* while the blockUI is enable.
*/
function blockAccessKeys() {
var elementWithAccessKey = [];
elementWithAccessKey = document.querySelectorAll('[accesskey]');
elementWithAccessKey.forEach((elem) => {
elem.setAttribute("data-accesskey",elem.getAttribute('accesskey'));
elem.removeAttribute('accesskey');
});
}
function unblockAccessKeys() {
var elementWithDataAccessKey = [];
elementWithDataAccessKey = document.querySelectorAll('[data-accesskey]');
elementWithDataAccessKey.forEach((elem) => {
elem.setAttribute('accesskey', elem.getAttribute('data-accesskey'));
elem.removeAttribute('data-accesskey');
});
}
var throbbers = [];
export function blockUI() {
var tmp = $.blockUI.apply($, arguments);
var throbber = new Throbber();
throbbers.push(throbber);
throbber.appendTo($(".oe_blockui_spin_container"));
$(document.body).addClass('o_ui_blocked');
blockAccessKeys();
return tmp;
}
export function unblockUI() {
throbbers.forEach((throbber) => {
throbber.destroy();
});
throbbers = [];
$(document.body).removeClass('o_ui_blocked');
unblockAccessKeys();
return $.unblockUI.apply($, arguments);
}
export default {
blockUI: blockUI,
unblockUI: unblockUI,
};
+1 -5
View File
@@ -5,9 +5,5 @@
*/
import commonEnv from '@web/legacy/js/common_env';
import { blockUI, unblockUI } from "@web/legacy/js/core/misc";
const env = commonEnv;
env.services = Object.assign(env.services, { blockUI, unblockUI });
export default env;
export default commonEnv;