[pve-devel] [RFC manager 17/28] use HelpButton from widget toolkit

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 11 16:26:06 CET 2017


Proxmox.button.Help renamed the css class for the button styling, as
this class is only used rarely and the widget toolkit does not
provides a (shared) css file itself, just rename it here too.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/css/ext6-pve.css              |  2 +-
 www/manager6/Makefile             |  1 -
 www/manager6/Workspace.js         |  2 +-
 www/manager6/button/HelpButton.js | 78 ---------------------------------------
 www/manager6/panel/ConfigPanel.js |  2 +-
 www/manager6/qemu/Clone.js        |  2 +-
 www/manager6/window/Backup.js     |  2 +-
 www/manager6/window/Migrate.js    |  6 +--
 www/manager6/window/Settings.js   |  4 +-
 www/manager6/window/Wizard.js     |  2 +-
 10 files changed, 11 insertions(+), 90 deletions(-)
 delete mode 100644 www/manager6/button/HelpButton.js

diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css
index 4d0faf3a..3d8d33b2 100644
--- a/www/css/ext6-pve.css
+++ b/www/css/ext6-pve.css
@@ -366,7 +366,7 @@
     top: 2px;
 }
 
-.pve-inline-button .x-btn-inner {
+.proxmox-inline-button .x-btn-inner {
     color: black;
 }
 
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 23a9f79f..e987ec44 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -9,7 +9,6 @@ JSSRC= 				                 	\
 	menu/MenuItem.js				\
 	button/ConsoleButton.js				\
 	button/Split.js					\
-	button/HelpButton.js				\
 	controller/StorageEdit.js			\
 	qemu/SendKeyMenu.js				\
 	qemu/CmdMenu.js					\
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index fa27fae9..2046cc66 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -323,7 +323,7 @@ Ext.define('PVE.StdWorkspace', {
 			    }
 			},
 			{
-			    xtype: 'pveHelpButton',
+			    xtype: 'proxmoxHelpButton',
 			    hidden: false,
 			    baseCls: 'x-btn',
 			    iconCls: 'fa fa-book x-btn-icon-el-default-toolbar-small ',
diff --git a/www/manager6/button/HelpButton.js b/www/manager6/button/HelpButton.js
deleted file mode 100644
index 048a7d39..00000000
--- a/www/manager6/button/HelpButton.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* help button pointing to an online documentation
-   for components contained in a modal window
-*/
-/*global
-  pveOnlineHelpInfo
-*/
-Ext.define('PVE.button.Help', {
-    extend: 'Ext.button.Button',
-    alias: 'widget.pveHelpButton',
-    text: gettext('Help'),
-    // make help button less flashy by styling it like toolbar buttons
-    iconCls: ' x-btn-icon-el-default-toolbar-small fa fa-question-circle',
-    cls: 'x-btn-default-toolbar-small pve-inline-button',
-    hidden: true,
-    listenToGlobalEvent: true,
-    controller: {
-	xclass: 'Ext.app.ViewController',
-	listen: {
-	    global: {
-		pveShowHelp: 'onPveShowHelp',
-		pveHideHelp: 'onPveHideHelp'
-	    }
-	},
-	onPveShowHelp: function(helpLink) {
-	    var me = this.getView();
-	    if (me.listenToGlobalEvent === true) {
-		me.setOnlineHelp(helpLink);
-		me.show();
-	    }
-	},
-	onPveHideHelp: function() {
-	    var me = this.getView();
-	    if (me.listenToGlobalEvent === true) {
-		me.hide();
-	    }
-	}
-    },
-
-    // this sets the link and
-    // sets the tooltip text
-    setOnlineHelp:function(blockid) {
-	var me = this;
-
-	var info = pveOnlineHelpInfo[blockid];
-	if (info) {
-	    me.onlineHelp = blockid;
-	    var title = info.title;
-	    if (info.subtitle) {
-		title += ' - ' + info.subtitle;
-	    }
-	    me.setTooltip(title);
-	}
-    },
-
-    // helper to set the onlineHelp via a config object
-    setHelpConfig: function(config) {
-	var me = this;
-	me.setOnlineHelp(config.onlineHelp);
-    },
-
-    handler: function() {
-	var me = this;
-	var docsURI;
-
-	if (me.onlineHelp) {
-	    var info = pveOnlineHelpInfo[me.onlineHelp];
-	    if (info) {
-		docsURI = window.location.origin + info.link;
-	    }
-	}
-
-	if (docsURI) {
-	    window.open(docsURI);
-	} else {
-	    Ext.Msg.alert(gettext('Help'), gettext('No Help available'));
-	}
-    }
-});
diff --git a/www/manager6/panel/ConfigPanel.js b/www/manager6/panel/ConfigPanel.js
index c659af21..e3c71eef 100644
--- a/www/manager6/panel/ConfigPanel.js
+++ b/www/manager6/panel/ConfigPanel.js
@@ -190,7 +190,7 @@ Ext.define('PVE.panel.Config', {
 	    baseCls: 'x-panel-header-text'
 	});
 
-	me.helpButton = Ext.create('PVE.button.Help', {
+	me.helpButton = Ext.create('Proxmox.button.Help', {
 	    hidden: false,
 	    listenToGlobalEvent: false,
 	    onlineHelp: me.onlineHelp || undefined
diff --git a/www/manager6/qemu/Clone.js b/www/manager6/qemu/Clone.js
index 413e38ad..6847f237 100644
--- a/www/manager6/qemu/Clone.js
+++ b/www/manager6/qemu/Clone.js
@@ -273,7 +273,7 @@ Ext.define('PVE.window.Clone', {
 	    border: false,
 	    layout: 'fit',
 	    buttons: [ {
-		xtype: 'pveHelpButton',
+		xtype: 'proxmoxHelpButton',
 		listenToGlobalEvent: false,
 		hidden: false,
 		onlineHelp: me.onlineHelp
diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index 57bdd2ab..a7ca208a 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -107,7 +107,7 @@ Ext.define('PVE.window.Backup', {
 	    }
 	});
 
-	var helpBtn = Ext.create('PVE.button.Help', {
+	var helpBtn = Ext.create('Proxmox.button.Help', {
 	    onlineHelp: 'chapter_vzdump',
 	    listenToGlobalEvent: false,
 	    hidden: false
diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index 34930743..09b1efd2 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -92,8 +92,8 @@ Ext.define('PVE.window.Migrate', {
     ],
     buttons: [
 	{
-	    xtype: 'pveHelpButton',
-	    reference: 'pveHelpButton',
+	    xtype: 'proxmoxHelpButton',
+	    reference: 'proxmoxHelpButton',
 	    onlineHelp: 'pct_migration',
 	    listenToGlobalEvent: false,
 	    hidden: false
@@ -127,7 +127,7 @@ Ext.define('PVE.window.Migrate', {
 	me.liveMode = 'restart';
 
 	if (me.vmtype === 'qemu') {
-	    me.lookup('pveHelpButton').setHelpConfig({
+	    me.lookup('proxmoxHelpButton').setHelpConfig({
 		onlineHelp: 'qm_migration'
 	    });
 	    title = gettext('Migrate') + (' VM ') + me.vmid;
diff --git a/www/manager6/window/Settings.js b/www/manager6/window/Settings.js
index 953e6604..6a1001ab 100644
--- a/www/manager6/window/Settings.js
+++ b/www/manager6/window/Settings.js
@@ -161,7 +161,7 @@ Ext.define('PVE.window.Settings', {
 		},
 		{
 		    xtype: 'button',
-		    cls: 'x-btn-default-toolbar-small pve-inline-button',
+		    cls: 'x-btn-default-toolbar-small proxmox-inline-button',
 		    text: gettext('Clear User name'),
 		    width: 'auto',
 		    name: 'clear-username'
@@ -178,7 +178,7 @@ Ext.define('PVE.window.Settings', {
 		},
 		{
 		    xtype: 'button',
-		    cls: 'x-btn-default-toolbar-small pve-inline-button',
+		    cls: 'x-btn-default-toolbar-small proxmox-inline-button',
 		    text: gettext('Reset Layout'),
 		    width: 'auto',
 		    name: 'reset'
diff --git a/www/manager6/window/Wizard.js b/www/manager6/window/Wizard.js
index 6b7eeb3e..d7c07402 100644
--- a/www/manager6/window/Wizard.js
+++ b/www/manager6/window/Wizard.js
@@ -68,7 +68,7 @@ Ext.define('PVE.window.Wizard', {
 	    margins: '0 5 5 5',
 	    items: [  
 		{
-		    xtype: 'pveHelpButton',
+		    xtype: 'proxmoxHelpButton',
 		    itemId: 'help'
 		},
 		'->', 
-- 
2.11.0





More information about the pve-devel mailing list