object_manager_attribute.rb 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. FactoryBot.define do
  2. factory :object_manager_attribute, class: ObjectManager::Attribute do
  3. object_lookup_id { ObjectLookup.by_name('Ticket') }
  4. sequence(:name) { |n| "internal_name#{n}" }
  5. sequence(:display) { |n| "Display Name #{n}" }
  6. data_option_new { {} }
  7. editable { true }
  8. active { true }
  9. add_attribute(:to_create) { true }
  10. to_migrate { true }
  11. to_delete { false }
  12. to_config { false }
  13. position { 15 }
  14. updated_by_id { 1 }
  15. created_by_id { 1 }
  16. screens do
  17. {
  18. 'create_top' => {
  19. '-all-' => {
  20. 'null' => false
  21. }
  22. },
  23. 'edit' => {}
  24. }
  25. end
  26. end
  27. factory :object_manager_attribute_text, parent: :object_manager_attribute do
  28. data_type { 'input' }
  29. data_option do
  30. {
  31. 'type' => 'text',
  32. 'maxlength' => 200,
  33. 'null' => true,
  34. 'translate' => false,
  35. 'default' => '',
  36. 'options' => {},
  37. 'relation' => '',
  38. }
  39. end
  40. end
  41. factory :object_manager_attribute_integer, parent: :object_manager_attribute do
  42. data_type { 'integer' }
  43. data_option do
  44. {
  45. 'default' => 0,
  46. 'min' => 0,
  47. 'max' => 9999,
  48. }
  49. end
  50. end
  51. factory :object_manager_attribute_date, parent: :object_manager_attribute do
  52. name { 'date_attribute' }
  53. data_type { 'date' }
  54. data_option do
  55. {
  56. 'diff' => 24,
  57. 'null' => true,
  58. }
  59. end
  60. end
  61. factory :object_manager_attribute_datetime, parent: :object_manager_attribute do
  62. name { 'datetime_attribute' }
  63. data_type { 'datetime' }
  64. data_option do
  65. {
  66. 'future' => true,
  67. 'past' => true,
  68. 'diff' => 24,
  69. 'null' => true,
  70. }
  71. end
  72. end
  73. factory :object_manager_attribute_select, parent: :object_manager_attribute do
  74. data_type { 'select' }
  75. data_option do
  76. {
  77. 'default' => '',
  78. 'options' => {
  79. 'key_1' => 'value_1',
  80. 'key_2' => 'value_2',
  81. 'key_3' => 'value_3',
  82. },
  83. 'relation' => '',
  84. 'nulloption' => true,
  85. 'multiple' => false,
  86. 'null' => true,
  87. 'translate' => true,
  88. 'maxlength' => 255
  89. }
  90. end
  91. end
  92. factory :object_manager_attribute_tree_select, parent: :object_manager_attribute do
  93. data_type { 'tree_select' }
  94. data_option do
  95. {
  96. 'options' => [
  97. {
  98. 'name' => 'Incident',
  99. 'value' => 'Incident',
  100. 'children' => [
  101. {
  102. 'name' => 'Hardware',
  103. 'value' => 'Incident::Hardware',
  104. 'children' => [
  105. {
  106. 'name' => 'Monitor',
  107. 'value' => 'Incident::Hardware::Monitor'
  108. },
  109. {
  110. 'name' => 'Mouse',
  111. 'value' => 'Incident::Hardware::Mouse'
  112. },
  113. {
  114. 'name' => 'Keyboard',
  115. 'value' => 'Incident::Hardware::Keyboard'
  116. }
  117. ]
  118. },
  119. {
  120. 'name' => 'Softwareproblem',
  121. 'value' => 'Incident::Softwareproblem',
  122. 'children' => [
  123. {
  124. 'name' => 'CRM',
  125. 'value' => 'Incident::Softwareproblem::CRM'
  126. },
  127. {
  128. 'name' => 'EDI',
  129. 'value' => 'Incident::Softwareproblem::EDI'
  130. },
  131. {
  132. 'name' => 'SAP',
  133. 'value' => 'Incident::Softwareproblem::SAP',
  134. 'children' => [
  135. {
  136. 'name' => 'Authentication',
  137. 'value' => 'Incident::Softwareproblem::SAP::Authentication'
  138. },
  139. {
  140. 'name' => 'Not reachable',
  141. 'value' => 'Incident::Softwareproblem::SAP::Not reachable'
  142. }
  143. ]
  144. },
  145. {
  146. 'name' => 'MS Office',
  147. 'value' => 'Incident::Softwareproblem::MS Office',
  148. 'children' => [
  149. {
  150. 'name' => 'Excel',
  151. 'value' => 'Incident::Softwareproblem::MS Office::Excel'
  152. },
  153. {
  154. 'name' => 'PowerPoint',
  155. 'value' => 'Incident::Softwareproblem::MS Office::PowerPoint'
  156. },
  157. {
  158. 'name' => 'Word',
  159. 'value' => 'Incident::Softwareproblem::MS Office::Word'
  160. },
  161. {
  162. 'name' => 'Outlook',
  163. 'value' => 'Incident::Softwareproblem::MS Office::Outlook'
  164. }
  165. ]
  166. }
  167. ]
  168. }
  169. ]
  170. },
  171. {
  172. 'name' => 'Service request',
  173. 'value' => 'Service request',
  174. 'children' => [
  175. {
  176. 'name' => 'New software requirement',
  177. 'value' => 'Service request::New software requirement'
  178. },
  179. {
  180. 'name' => 'New hardware',
  181. 'value' => 'Service request::New hardware'
  182. },
  183. {
  184. 'name' => 'Consulting',
  185. 'value' => 'Service request::Consulting'
  186. }
  187. ]
  188. },
  189. {
  190. 'name' => 'Change request',
  191. 'value' => 'Change request'
  192. }
  193. ],
  194. 'default' => '',
  195. 'null' => true,
  196. 'relation' => '',
  197. 'maxlength' => 255,
  198. 'nulloption' => true,
  199. }
  200. end
  201. end
  202. factory :required_screen, class: Hash do
  203. create_middle do
  204. {
  205. 'ticket.customer' => {
  206. shown: true,
  207. required: true,
  208. item_class: 'column'
  209. },
  210. 'ticket.agent' => {
  211. shown: true,
  212. required: true,
  213. item_class: 'column'
  214. },
  215. 'admin.organization' => {
  216. shown: true,
  217. required: true,
  218. },
  219. 'admin.group' => {
  220. shown: true,
  221. required: true,
  222. item_class: 'column'
  223. },
  224. }
  225. end
  226. edit do
  227. {
  228. 'ticket.customer' => {
  229. shown: true,
  230. required: true
  231. },
  232. 'ticket.agent' => {
  233. shown: true,
  234. required: true
  235. },
  236. 'admin.organization' => {
  237. shown: true,
  238. required: true,
  239. },
  240. 'admin.group' => {
  241. shown: true,
  242. required: true,
  243. item_class: 'column'
  244. },
  245. }
  246. end
  247. end
  248. end