diff --git a/addons/base/__openerp__.py b/addons/base/__openerp__.py index 3195ac4d7e0..7fa373d1ba0 100644 --- a/addons/base/__openerp__.py +++ b/addons/base/__openerp__.py @@ -10,6 +10,7 @@ "static/lib/jquery.validate/jquery.validate.js", "static/lib/jquery.ba-bbq/jquery.ba-bbq.js", "static/lib/jquery.contextmenu/jquery.contextmenu.r2.packed.js", + "static/lib/jquery.blockui/jquery.blockUI.js", "static/lib/jquery.superfish/js/hoverIntent.js", "static/lib/jquery.superfish/js/superfish.js", "static/lib/jquery.ui/js/jquery-ui-1.8.9.custom.min.js", diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py index 51b7618a03b..25763a42537 100644 --- a/addons/base/controllers/main.py +++ b/addons/base/controllers/main.py @@ -162,7 +162,11 @@ class Database(openerpweb.Controller): r = cherrypy.config['openerp.dbfilter'].replace('%h', h).replace('%d', d) dbs = [i for i in dbs if re.match(r, i)] return {"db_list": dbs} - + + @openerpweb.jsonrequest + def progress(self, req, password, id): + return req.session.proxy('db').get_progress(password, id) + @openerpweb.jsonrequest def create_db(self, req, fields): diff --git a/addons/base/static/src/js/chrome.js b/addons/base/static/src/js/chrome.js index 1011a029570..558d4322f53 100644 --- a/addons/base/static/src/js/chrome.js +++ b/addons/base/static/src/js/chrome.js @@ -724,6 +724,28 @@ openerp.base.Database = openerp.base.Controller.extend({ }); return result; }, + wait_for_newdb: function (db_creation_id, password) { + var self = this; + self.rpc('/base/database/progress', { + id: db_creation_id, + password: password + }, function (result) { + var progress = result[0]; + // I'd display a progress bar, but turns out the progress status + // the server report kind-of blows goats: it's at 0 for ~75% of + // the installation, then jumps to 75%, then jumps down to either + // 0 or ~40%, then back up to 75%, then terminates. Let's keep that + // mess hidden behind a not-very-useful but not overly weird + // message instead. + if (progress < 1) { + setTimeout(function () { + self.wait_for_newdb(db_creation_id, password); + }, 500); + return; + } + $.unblockUI(); + }); + }, do_db_create: function() { var self = this; self.$option_id.html(QWeb.render("CreateDB", self)); @@ -731,11 +753,15 @@ openerp.base.Database = openerp.base.Controller.extend({ self.$option_id.find("form[name=create_db_form]").validate({ submitHandler: function (form) { var fields = $(form).serializeArray(); + $.blockUI(); self.rpc("/base/database/create_db", {'fields': fields}, function(result) { if (!result.error) { self.db_list.push(self.to_object(fields)['db_name']); self.db_list.sort(); + self.wait_for_newdb( + result, self.to_object(fields)['super_admin_pwd']); } else { + $.unblockUI(); $('