Advertisement
Guest User

Untitled

a guest
Nov 10th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.87 KB | None | 0 0
  1. //---------------------------------------------------------------------
  2. // sa.managedobjectselector application
  3. //---------------------------------------------------------------------
  4. // Copyright (C) 2007-2014 The NOC Project
  5. // See LICENSE for details
  6. //---------------------------------------------------------------------
  7. console.debug("Defining NOC.sa.managedobjectselector.Application");
  8.  
  9. Ext.define("NOC.sa.managedobjectselector.Application", {
  10. extend: "NOC.core.ModelApplication",
  11. requires: [
  12. "NOC.sa.managedobjectselector.Model",
  13. "NOC.sa.managedobjectselector.AttributesModel",
  14. "NOC.sa.managedobjectselector.M2MField",
  15. "NOC.sa.managedobjectprofile.LookupField",
  16. "NOC.main.prefixtable.LookupField",
  17. "NOC.main.shard.LookupField",
  18. "NOC.sa.administrativedomain.LookupField",
  19. "NOC.sa.activator.LookupField",
  20. "NOC.ip.vrf.LookupField",
  21. "NOC.vc.vcdomain.LookupField",
  22. "NOC.sa.terminationgroup.LookupField",
  23. "NOC.sa.terminationgroup.LookupField"
  24. ],
  25. model: "NOC.sa.managedobjectselector.Model",
  26. search: true,
  27.  
  28. initComponent: function() {
  29. var me = this;
  30.  
  31. me.ITEM_OBJECTS = me.registerItem(
  32. "NOC.sa.managedobjectselector.ObjectsPanel"
  33. );
  34. me.objectsButton = Ext.create("Ext.button.Button", {
  35. text: "Matched Objects",
  36. glyph: NOC.glyph.list,
  37. scope: me,
  38. handler: me.onObjects
  39. });
  40. me.itemSelector = Ext.create("NOC.sa.managedobjectselector.M2MField", {
  41. name: "sources",
  42. height: 220,
  43. width: 600,
  44. fieldLabel: "Sources",
  45. buttons: ["add", "remove"],
  46. allowBlank: true
  47. });
  48. me.itemSelector.store.setPageSize(1000);
  49. Ext.apply(me, {
  50. columns: [
  51. {
  52. text: "Name",
  53. dataIndex: "name",
  54. width: 200
  55. },
  56. {
  57. text: "Enabled",
  58. dataIndex: "is_enabled",
  59. width: 50,
  60. renderer: NOC.render.Bool
  61. },
  62. {
  63. text: "Expression",
  64. dataIndex: "expression",
  65. flex: 1
  66. }
  67. ],
  68. fields: [
  69. {
  70. name: "name",
  71. xtype: "textfield",
  72. fieldLabel: "Name",
  73. allowBlank: false
  74. },
  75. {
  76. name: "description",
  77. xtype: "textarea",
  78. fieldLabel: "Description",
  79. allowBlank: true
  80. },
  81. {
  82. name: "is_enabled",
  83. xtype: "checkboxfield",
  84. boxLabel: "Is Enabled",
  85. allowBlank: false
  86. },
  87. {
  88. name: "filter_id",
  89. xtype: "numberfield",
  90. fieldLabel: "Filter by ID",
  91. allowBlank: true
  92. },
  93. {
  94. name: "filter_name",
  95. xtype: "textfield",
  96. fieldLabel: "Filter by Name (REGEXP)",
  97. allowBlank: true
  98. },
  99. {
  100. name: "filter_managed",
  101. xtype: "combobox",
  102. fieldLabel: "Filter by Is Managed",
  103. allowBlank: true,
  104. store: [
  105. [null, "-"],
  106. [true, "Is managed"],
  107. [false, "Not Managed"]
  108. ]
  109. },
  110. {
  111. name: "filter_profile",
  112. xtype: "textfield",
  113. fieldLabel: "Filter by Profile",
  114. allowBlank: true
  115. },
  116. {
  117. name: "filter_object_profile",
  118. xtype: "sa.managedobjectprofile.LookupField",
  119. fieldLabel: "Filter by Object Profile",
  120. allowBlank: true
  121. },
  122. {
  123. name: "filter_address",
  124. xtype: "textfield",
  125. fieldLabel: "Filter by Address (REGEXP)",
  126. allowBlank: true
  127. },
  128. {
  129. name: "filter_prefix",
  130. xtype: "main.prefixtable.LookupField",
  131. fieldLabel: "Filter by Prefix Table",
  132. allowBlank: true
  133. },
  134. {
  135. name: "filter_shard",
  136. xtype: "main.shard.LookupField",
  137. fieldLabel: "Filter by Shard",
  138. allowBlank: true
  139. },
  140. {
  141. name: "filter_administrative_domain",
  142. xtype: "sa.administrativedomain.LookupField",
  143. fieldLabel: "Filter by Administrative Domain",
  144. allowBlank: true
  145. },
  146. {
  147. name: "filter_activator",
  148. xtype: "sa.activator.LookupField",
  149. fieldLabel: "Filter by Activator",
  150. allowBlank: true
  151. },
  152. {
  153. name: "filter_vrf",
  154. xtype: "ip.vrf.LookupField",
  155. fieldLabel: "Filter by VRF",
  156. allowBlank: true
  157. },
  158. {
  159. name: "filter_vc_domain",
  160. xtype: "vc.vcdomain.LookupField",
  161. fieldLabel: "Filter by VC Domain",
  162. allowBlank: true
  163. },
  164. {
  165. name: "filter_termination_group",
  166. xtype: "sa.terminationgroup.LookupField",
  167. fieldLabel: "Filter by termination group",
  168. allowBlank: true
  169. },
  170. {
  171. name: "filter_service_terminator",
  172. xtype: "sa.terminationgroup.LookupField",
  173. fieldLabel: "Filter by service terminator",
  174. allowBlank: true
  175. },
  176. {
  177. name: "filter_user",
  178. xtype: "textfield",
  179. fieldLabel: "Filter by User (REGEXP)",
  180. allowBlank: true
  181. },
  182. {
  183. name: "filter_remote_path",
  184. xtype: "textfield",
  185. fieldLabel: "Filter by Remote Path (REGEXP)",
  186. allowBlank: true
  187. },
  188. {
  189. name: "filter_description",
  190. xtype: "textfield",
  191. fieldLabel: "Filter by Description (REGEXP)",
  192. allowBlank: true
  193. },
  194. {
  195. name: "filter_repo_path",
  196. xtype: "textfield",
  197. fieldLabel: "Filter by Repo Path (REGEXP)",
  198. allowBlank: true
  199. },
  200. {
  201. name: "filter_tags",
  202. xtype: "textfield",
  203. fieldLabel: "Filter By Tags",
  204. allowBlank: true
  205. },
  206. {
  207. name: "source_combine_method",
  208. xtype: "combobox",
  209. fieldLabel: "Source Combine Method",
  210. allowBlank: false,
  211. store: [
  212. ["O", "OR"],
  213. ["A", "AND"]
  214. ]
  215. },
  216. me.itemSelector
  217. ],
  218. inlines: [
  219. {
  220. title: "Filter by attributes",
  221. model: "NOC.sa.managedobjectselector.AttributesModel",
  222. columns: [
  223. {
  224. text: "Key (RE)",
  225. dataIndex: "key_re",
  226. width: 100,
  227. editor: "textfield"
  228. },
  229. {
  230. text: "Value (RE)",
  231. dataIndex: "value_re",
  232. editor: "textfield",
  233. flex: 1
  234. }
  235. ]
  236. }
  237. ],
  238. formToolbar: [
  239. me.objectsButton
  240. ]
  241. });
  242. me.callParent();
  243. },
  244. //
  245. onObjects: function() {
  246. var me = this;
  247. me.previewItem(me.ITEM_OBJECTS, me.currentRecord);
  248. }
  249. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement