GroupEdit.js 1.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
Ext.define('PVE.dc.GroupEdit', {
    extend: 'PVE.window.Edit',
    alias: ['widget.pveDcGroupEdit'],

    initComponent : function() {
        var me = this;

        me.create = !me.groupid;

        var url;
        var method;

        if (me.create) {
            url = '/api2/extjs/access/groups';
            method = 'POST';
        } else {
            url = '/api2/extjs/access/groups/' + me.groupid;
            method = 'PUT';
        }

        Ext.applyIf(me, {
            title: me.create ? "Create Group" :  "Edit Group '" + me.groupid + "'",
            url: url,
            method: method,
            items: [
                {
		    xtype: 'pvetextfield',
		    fieldLabel: 'GroupID',
		    name: 'groupid',
		    value: me.groupid,
		    allowBlank: false
		},
                {
		    xtype: 'pvetextfield',
		    fieldLabel: 'Comment',
		    name: 'comment',
		    value: me.groupid,
		    allowBlank: false
		}
            ]
        });

        me.callParent();

        if (!me.create) {
            me.load();
        }
    }
});