[pve-devel] [PATCH pve-manager] Overrides Ext.Msg.alert() to always display an Error Icon

Emmanuel Kasper e.kasper at proxmox.com
Thu Apr 7 13:26:23 CEST 2016


---
 www/manager6/Toolkit.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js
index 91a4fa6..a8089aa 100644
--- a/www/manager6/Toolkit.js
+++ b/www/manager6/Toolkit.js
@@ -137,6 +137,28 @@ Ext.define('PVE.Datepicker', {
     hideMode: 'visibility'
 });
 
+// force alert boxes to be rendered with an Error Icon
+// since Ext.Msg is an object and not a prototype, we need to override it
+// after the framework has been initiated
+Ext.onReady(function() {
+    Ext.override(Ext.Msg, {
+	alert: function(title, message, fn, scope) {
+	    if (Ext.isString(title)) {
+		var config = {
+		    title: title,
+		    message: message,
+		    icon: this.ERROR,
+		    buttons: this.OK,
+		    fn: fn,
+		    scope : scope,
+		    minWidth: this.minWidth
+		};
+	    return this.show(config);
+	    }
+	}
+    });
+});
+
 Ext.define('Ext.ux.IFrame', {
     extend: 'Ext.Component',
 
-- 
2.1.4





More information about the pve-devel mailing list