]> git.proxmox.com Git - pve-manager.git/commitdiff
add nice ha group selector
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Apr 2015 14:36:26 +0000 (16:36 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Apr 2015 14:36:26 +0000 (16:36 +0200)
www/manager/Makefile
www/manager/ha/GroupSelector.js [new file with mode: 0644]
www/manager/ha/Groups.js
www/manager/ha/ResourceEdit.js

index c814990f306acd10e341e2a05d35f8c4f51e4398..4c7668467ba8a0f42ce5c2ff791627d0180df715 100644 (file)
@@ -166,6 +166,7 @@ JSSRC=                                                      \
        storage/ZFSEdit.js                              \
        storage/ZFSPoolEdit.js                          \
        ha/StatusView.js                                \
+       ha/GroupSelector.js                             \
        ha/ResourceEdit.js                              \
        ha/Resources.js                                 \
        ha/GroupEdit.js                                 \
diff --git a/www/manager/ha/GroupSelector.js b/www/manager/ha/GroupSelector.js
new file mode 100644 (file)
index 0000000..01e97b4
--- /dev/null
@@ -0,0 +1,63 @@
+Ext.define('PVE.ha.GroupSelector', {
+    extend: 'PVE.form.ComboGrid',
+    alias: ['widget.pveHAGroupSelector'],
+
+    initComponent: function() {
+       var me = this;
+
+       var store = new Ext.data.Store({
+           model: 'pve-ha-groups',
+           sorters: { 
+               property: 'group', 
+               order: 'DESC' 
+           }
+       });
+
+       Ext.apply(me, {
+           store: store,
+           autoSelect: false,
+           valueField: 'group',
+           displayField: 'group',
+            listConfig: {
+               columns: [
+                   {
+                       header: gettext('Group'),
+                       width: 100,
+                       sortable: true,
+                       dataIndex: 'group'
+                   },
+                   {
+                       header: gettext('Nodes'),
+                       width: 100,
+                       sortable: false,
+                       dataIndex: 'nodes'
+                   },
+                   {
+                       header: gettext('Comment'),
+                       flex: 1,
+                       dataIndex: 'comment'
+                   }
+               ]
+           }
+       });
+
+        me.callParent();
+
+       store.load();
+    }
+
+}, function() {
+
+    Ext.define('pve-ha-groups', {
+       extend: 'Ext.data.Model',
+       fields: [ 
+           'group', 'type', 'restricted', 'digest', 'nofailback',
+           'nodes', 'comment'
+       ],
+       proxy: {
+            type: 'pve',
+           url: "/api2/json/cluster/ha/groups"
+       },
+       idProperty: 'group'
+    });
+});
index ca6287494b6c142bb4e80882a4ededff8080800c..786327e92755139588927306cc877459aaaa4754 100644 (file)
@@ -7,10 +7,6 @@ Ext.define('PVE.ha.GroupsView', {
 
        var store = new Ext.data.Store({
            model: 'pve-ha-groups',
-           proxy: {
-                type: 'pve',
-               url: "/api2/json/cluster/ha/groups"
-           },
            sorters: { 
                property: 'group', 
                order: 'DESC' 
@@ -120,15 +116,4 @@ Ext.define('PVE.ha.GroupsView', {
 
        me.callParent();
     }
-}, function() {
-
-    Ext.define('pve-ha-groups', {
-       extend: 'Ext.data.Model',
-       fields: [ 
-           'group', 'type', 'restricted', 'digest', 'nofailback',
-           'nodes', 'comment'
-       ],
-       idProperty: 'group'
-    });
-
 });
index b7534df01159856ac9a3a0884756ad6ef4659683..8c5736044b0fa34b309000b6ad891ae64d586ff5 100644 (file)
@@ -11,7 +11,13 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
        if (me.create) {
            values.type = 'vm';
            values.sid = values.vmid;
-           delete values['delete']; // ignore
+       }
+       
+       if (values.group === '') {
+           if (!me.create) {
+               values['delete'] = values['delete'] ? ',group' : 'group';
+           }
+           delete values.group;
        }
 
        delete values.vmid;
@@ -42,10 +48,9 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 
        me.column2 = [
            {
-               xtype: 'pvetextfield', // fixme: group selector
+               xtype: 'pveHAGroupSelector',
                name: 'group',
                value: '',
-               deleteEmpty: true,
                fieldLabel: gettext('Group')
            },
            {