[pve-devel] [PATCH manager 2/5] dc/Cluster: allow cluster create over WebUI

Dominik Csapak d.csapak at proxmox.com
Tue Apr 3 10:16:23 CEST 2018


The window always allows me to click on create,
it would be better to only allow this if all necessary fields are filled
otherwise: great :)

On 03/27/2018 03:45 PM, Thomas Lamprecht wrote:
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>   www/manager6/Makefile          |  1 +
>   www/manager6/dc/Cluster.js     | 23 +++++++++++++++++++++++
>   www/manager6/dc/ClusterEdit.js | 31 +++++++++++++++++++++++++++++++
>   3 files changed, 55 insertions(+)
>   create mode 100644 www/manager6/dc/ClusterEdit.js
> 
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 1f143061..d71803ee 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -193,6 +193,7 @@ JSSRC= 				                 	\
>   	dc/Config.js					\
>   	dc/NodeView.js					\
>   	dc/Cluster.js					\
> +	dc/ClusterEdit.js				\
>   	Workspace.js
>   
>   lint: ${JSSRC}
> diff --git a/www/manager6/dc/Cluster.js b/www/manager6/dc/Cluster.js
> index e0c5663a..97f7496d 100644
> --- a/www/manager6/dc/Cluster.js
> +++ b/www/manager6/dc/Cluster.js
> @@ -89,7 +89,30 @@ Ext.define('PVE.ClusterAdministration', {
>   			fp: nodeinfo.pve_fp
>   		    });
>   		},
> +
> +		onCreate: function() {
> +		    var view = this.getView();
> +		    view.store.stopUpdate();
> +		    var win = Ext.create('PVE.ClusterCreateWindow', {
> +			autoShow: true,
> +			listeners: {
> +			    destroy: function() {
> +				view.store.startUpdate();
> +			    }
> +			}
> +		    });
> +		}
>   	    },
> +	    tbar: [
> +		{
> +		    text: gettext('Create Cluster'),
> +		    reference: 'createButton',
> +		    handler: 'onCreate',
> +		    bind: {
> +			disabled: '{isInCluster}'
> +		    }
> +		}
> +	    ],
>   	    layout: 'hbox',
>   	    bodyPadding: 5,
>   	    items: [
> diff --git a/www/manager6/dc/ClusterEdit.js b/www/manager6/dc/ClusterEdit.js
> new file mode 100644
> index 00000000..0c44ec44
> --- /dev/null
> +++ b/www/manager6/dc/ClusterEdit.js
> @@ -0,0 +1,31 @@
> +/*jslint confusion: true*/
> +Ext.define('PVE.ClusterCreateWindow', {
> +    extend: 'Proxmox.window.Edit',
> +    xtype: 'pveClusterCreateWindow',
> +
> +    title: gettext('Create Cluster'),
> +    width: 600,
> +
> +    method: 'POST',
> +    url: '/cluster/config',
> +
> +    isCreate: true,
> +    subject: gettext('Cluster'),
> +    showTaskViewer: true,
> +
> +    items: [
> +	{
> +	    xtype: 'textfield',
> +	    fieldLabel: gettext('Cluster Name'),
> +	    name: 'clustername'
> +	},
> +	{
> +	    xtype: 'proxmoxtextfield',
> +	    fieldLabel: gettext('Ring 0 Address'),
> +	    emptyText: gettext("Optional, defaults to IP resolved by node's hostname"),
> +	    name: 'ring0_addr',
> +	    skipEmptyText: true
> +	}
> +	// TODO: for advanced options: ring1_addr
> +    ]
> +});
> 





More information about the pve-devel mailing list