GroupEdit.js 1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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, {
22
            subject: gettext('Group'),
23 24 25 26
            url: url,
            method: method,
            items: [
                {
27 28
		    xtype: me.create ? 'pvetextfield' : 'displayfield',
		    fieldLabel: gettext('Name'),
29 30 31 32 33
		    name: 'groupid',
		    value: me.groupid,
		    allowBlank: false
		},
                {
34
		    xtype: 'textfield',
35
		    fieldLabel: gettext('Comment'),
36
		    name: 'comment',
37
		    allowBlank: true
38 39 40 41 42 43 44 45 46 47 48
		}
            ]
        });

        me.callParent();

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