Pman.Tab.XtupleMetric.bjs
[Pman.Xtuple] / Pman.Tab.XtupleMetric.bjs
1 {
2     "id": "roo-file-374",
3     "name": "Pman.Tab.XtupleMetric",
4     "parent": "Pman.Tab.Admin",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleMetric.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
11             },
12             "background": true,
13             "fitContainer": true,
14             "fitToframe": true,
15             "region": "center",
16             "tableName": "metric",
17             "title": "Metric",
18             "xtype": "GridPanel",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "listeners": {
23                         "|render": "function() \n{\n    _this.grid = this; \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
24                         "afteredit": "function (e)\n{\n    if(e.originalValue == e.value || !e.value.length){\n        return false;\n    }\n    \n    e.record.commit();\n}"
25                     },
26                     "*prop": "grid",
27                     "autoExpandColumn": "metric_value",
28                     "clicksToEdit": 1,
29                     "loadMask": true,
30                     "xtype": "EditorGrid",
31                     "|xns": "Roo.grid",
32                     "items": [
33                         {
34                             "listeners": {
35                                 "beforeload": "function (_self, o){\n    o.params = o.params || {};\n    \n    var s = _this.searchBox.getValue();\n    \n    if(!s || !s.length){\n        return;\n    }\n    \n    o.params['search[name]'] = s;\n}\n",
36                                 "update": "function (_self, record, operation)\n{\n    if (operation != Roo.data.Record.COMMIT) {\n        return;\n    }\n\n    if (!record.data.metric_name.length || !record.data.metric_value.length) {\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Metric',\n        method : 'POST',\n        params : record.data,\n        success : function(res) {\n            _this.grid.footer.onClick('refresh');\n        }\n    });\n    \n}"
37                             },
38                             "*prop": "dataSource",
39                             "remoteSort": true,
40                             "xtype": "Store",
41                             "|sortInfo": "{ field : 'metric_name', direction: 'ASC' }",
42                             "|xns": "Roo.data",
43                             "items": [
44                                 {
45                                     "*prop": "proxy",
46                                     "method": "GET",
47                                     "timeout": 90000,
48                                     "xtype": "HttpProxy",
49                                     "|url": "baseURL + '/Xtuple/Roo/Metric.php'",
50                                     "|xns": "Roo.data"
51                                 },
52                                 {
53                                     "*prop": "reader",
54                                     "id": "metric_id",
55                                     "root": "data",
56                                     "totalProperty": "total",
57                                     "xtype": "JsonReader",
58                                     "|fields": "[\n    {\n        'name': 'metric_id',\n        'type': 'int'\n    },\n    {\n        'name': 'metric_name',\n        'type': 'string'\n    },\n    {\n        'name': 'metric_value',\n        'type': 'string'\n    },\n    {\n        'name': 'metric_module',\n        'type': 'string'\n    }\n]",
59                                     "|xns": "Roo.data"
60                                 }
61                             ]
62                         },
63                         {
64                             "|xns": "Roo",
65                             "xtype": "Toolbar",
66                             "*prop": "toolbar",
67                             "items": [
68                                 {
69                                     "listeners": {
70                                         "specialkey": "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}",
71                                         "render": "function (_self)\n{\n    _this.searchBox = _self;\n}"
72                                     },
73                                     "xtype": "TextField",
74                                     "|xns": "Roo.form"
75                                 },
76                                 {
77                                     "listeners": {
78                                         "click": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
79                                     },
80                                     "cls": "x-btn-icon",
81                                     "xtype": "Button",
82                                     "|icon": "rootURL + '/Pman/templates/images/search.gif'",
83                                     "|xns": "Roo.Toolbar"
84                                 },
85                                 {
86                                     "listeners": {
87                                         "click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\r\n}"
88                                     },
89                                     "cls": "x-btn-icon",
90                                     "xtype": "Button",
91                                     "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
92                                     "|xns": "Roo.Toolbar"
93                                 },
94                                 {
95                                     "|xns": "Roo.Toolbar",
96                                     "xtype": "Fill"
97                                 },
98                                 {
99                                     "listeners": {
100                                         "|click": "function()\n{\n    \n    var nr = _this.grid.ds.reader.newRow({\n        metric_id : 0,\n        metric_name : '',\n        metric_value : '',\n        metric_module : ''\n    });\n    \n    _this.grid.stopEditing();\n    _this.grid.ds.insert(0, nr); \n    _this.grid.startEditing(0, 0);\n}\n"
101                                     },
102                                     "cls": "x-btn-text-icon",
103                                     "text": "Add",
104                                     "xtype": "Button",
105                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
106                                     "|xns": "Roo.Toolbar"
107                                 }
108                             ]
109                         },
110                         {
111                             "*prop": "footer",
112                             "displayInfo": true,
113                             "emptyMsg": "No Metric found",
114                             "pageSize": 50,
115                             "xtype": "PagingToolbar",
116                             "|xns": "Roo"
117                         },
118                         {
119                             "*prop": "colModel[]",
120                             "dataIndex": "metric_name",
121                             "header": "Name",
122                             "width": 250,
123                             "xtype": "ColumnModel",
124                             "|renderer": "function(v) { return String.format('{0}', v); }",
125                             "|xns": "Roo.grid",
126                             "items": [
127                                 {
128                                     "|xns": "Roo.grid",
129                                     "xtype": "GridEditor",
130                                     "*prop": "editor",
131                                     "items": [
132                                         {
133                                             "*prop": "field",
134                                             "allowBlank": false,
135                                             "xtype": "TextField",
136                                             "|xns": "Roo.form"
137                                         }
138                                     ]
139                                 }
140                             ]
141                         },
142                         {
143                             "*prop": "colModel[]",
144                             "dataIndex": "metric_value",
145                             "header": "Value",
146                             "width": 150,
147                             "xtype": "ColumnModel",
148                             "|renderer": "function(v) { return String.format('{0}', v); }",
149                             "|xns": "Roo.grid",
150                             "items": [
151                                 {
152                                     "|xns": "Roo.grid",
153                                     "xtype": "GridEditor",
154                                     "*prop": "editor",
155                                     "items": [
156                                         {
157                                             "*prop": "field",
158                                             "allowBlank": false,
159                                             "xtype": "TextField",
160                                             "|xns": "Roo.form"
161                                         }
162                                     ]
163                                 }
164                             ]
165                         },
166                         {
167                             "*prop": "colModel[]",
168                             "dataIndex": "metric_module",
169                             "header": "Module",
170                             "width": 100,
171                             "xtype": "ColumnModel",
172                             "|renderer": "function(v) { return String.format('{0}', v); }",
173                             "|xns": "Roo.grid",
174                             "items": [
175                                 {
176                                     "|xns": "Roo.grid",
177                                     "xtype": "GridEditor",
178                                     "*prop": "editor",
179                                     "items": [
180                                         {
181                                             "*prop": "field",
182                                             "allowBlank": false,
183                                             "xtype": "TextField",
184                                             "|xns": "Roo.form"
185                                         }
186                                     ]
187                                 }
188                             ]
189                         }
190                     ]
191                 }
192             ]
193         }
194     ],
195     "permname": "",
196     "modOrder": "900"
197 }