]> git.proxmox.com Git - pmg-gui.git/blame - js/ObjectGroupConfiguration.js
rename WhoConfiguration.js to ObjectGroupConfiguration.js
[pmg-gui.git] / js / ObjectGroupConfiguration.js
CommitLineData
c790d2ab 1Ext.define('PMG.ObjectGroupConfiguration', {
56b0691b 2 extend: 'Ext.panel.Panel',
56b0691b 3
c790d2ab
DM
4 ogclass: undefined, // who, when, what
5 otype_list: [],
6
56b0691b
DM
7 layout: { type: 'hbox', align: 'stretch' },
8 border: false,
9
10 initComponent : function() {
11 var me = this;
12
c790d2ab
DM
13 if (me.ogclass === undefined) {
14 throw "undefined object group class"
15 }
16
17 if (!(me.title = PMG.Utils.oclass_text[me.ogclass])) {
18 throw "unknown object group class";
19 }
20
a43acf2e 21 var left = Ext.create('PMG.ObjectGroupList', {
56b0691b
DM
22 width: 250,
23 ogclass: me.ogclass,
a43acf2e 24 subject: me.title,
56b0691b
DM
25 border: false
26 });
27
3eba771a 28 var right = Ext.create('PMG.ObjectGroup', {
c790d2ab 29 otype_list: me.otype_list,
56b0691b 30 border: false,
8bc42ab3
DM
31 flex: 1,
32 listeners: {
33 dblclickOGInfo: function(w, e, t, ogdata) {
34 // test if the correct groups is selected (just to be sure)
35 var rec = left.selModel.getSelection()[0];
36 if (rec && rec.data && rec.data.id === ogdata.id) {
37 left.run_editor();
38 return;
39 }
40 }
41 }
56b0691b
DM
42 });
43
44 me.mon(left.selModel, "selectionchange", function() {
45 var rec = left.selModel.getSelection()[0];
46 if (!(rec && rec.data && rec.data.id)) {
47 return;
48 }
8bc42ab3 49 right.setObjectInfo(rec.data);
c790d2ab 50 var baseurl = '/config/ruledb/' + me.ogclass + '/' + rec.data.id;
56b0691b
DM
51 right.setBaseUrl(baseurl);
52 });
53
54 me.items = [ left, { xtype: 'splitter' }, right ];
55
56 me.callParent();
57 }
58});
c790d2ab
DM
59
60Ext.define('PMG.WhoConfiguration', {
61 extend: 'PMG.ObjectGroupConfiguration',
62 alias: 'widget.pmgWhoConfiguration',
63
64 ogclass: 'who',
65 otype_list: [1000, 1001, 1002, 1003, 1004]
66});
67
68Ext.define('PMG.WhenConfiguration', {
69 extend: 'PMG.ObjectGroupConfiguration',
70 alias: 'widget.pmgWhenConfiguration',
71
72 ogclass: 'when',
73 otype_list: []
74});
75
76Ext.define('PMG.WhatConfiguration', {
77 extend: 'PMG.ObjectGroupConfiguration',
78 alias: 'widget.pmgWhatConfiguration',
79
80 ogclass: 'what',
81 otype_list: []
82});
83
84Ext.define('PMG.ActionConfiguration', {
85 extend: 'PMG.ObjectGroupConfiguration',
86 alias: 'widget.pmgActionConfiguration',
87
88 ogclass: 'action',
89 otype_list: []
90});
91