]> git.proxmox.com Git - pve-manager.git/blob - www/manager/dc/GroupView.js
add more gettext markers
[pve-manager.git] / www / manager / dc / GroupView.js
1 Ext.define('PVE.dc.GroupView', {
2 extend: 'Ext.grid.GridPanel',
3
4 alias: ['widget.pveGroupView'],
5
6 initComponent : function() {
7 var me = this;
8
9 var store = new Ext.data.Store({
10 model: 'pve-groups',
11 proxy: {
12 type: 'pve',
13 url: "/api2/json/access/groups"
14 },
15 sorters: {
16 property: 'groupid',
17 order: 'DESC'
18 }
19 });
20
21 var reload = function() {
22 store.load();
23 };
24
25 var sm = Ext.create('Ext.selection.RowModel', {});
26
27 var remove_btn = new PVE.button.Button({
28 text: gettext('Remove'),
29 disabled: true,
30 selModel: sm,
31 confirmMsg: function (rec) {
32 return Ext.String.format(gettext('Are you sure you want to remove entry {0}'),
33 "'" + rec.data.groupid + "'");
34 },
35 handler: function(btn, event, rec) {
36 PVE.Utils.API2Request({
37 url: '/access/groups/' + rec.data.groupid,
38 method: 'DELETE',
39 waitMsgTarget: me,
40 callback: function() {
41 reload();
42 },
43 failure: function (response, opts) {
44 Ext.Msg.alert(gettext('Error'),response.htmlStatus);
45 }
46 });
47 }
48 });
49
50 var tbar = [
51 {
52 text: gettext('Create'),
53 handler: function() {
54 var win = Ext.create('PVE.dc.GroupEdit', {
55 });
56 win.on('destroy', reload);
57 win.show();
58 }
59 },
60 remove_btn
61 ];
62
63 Ext.apply(me, {
64 store: store,
65 selModel: sm,
66 stateful: false,
67 tbar: tbar,
68 viewConfig: {
69 trackOver: false
70 },
71 columns: [
72 {
73 header: gettext('Name'),
74 width: 200,
75 sortable: true,
76 dataIndex: 'groupid'
77 },
78 {
79 header: gettext('Comment'),
80 sortable: false,
81 dataIndex: 'comment',
82 flex: 1
83 }
84 ],
85 listeners: {
86 show: reload
87 }
88 });
89
90 me.callParent();
91 }
92 }, function() {
93
94 Ext.define('pve-groups', {
95 extend: 'Ext.data.Model',
96 fields: [ 'groupid', 'comment' ],
97 idProperty: 'groupid'
98 });
99
100 });