stack_config_property.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.StackConfigProperty = DS.Model.extend({
  20. /**
  21. * id is consist of property <code>name<code>+<code>fileName<code>
  22. */
  23. id: DS.attr('string'),
  24. /**
  25. * name of property that is taken from stack
  26. * @property {string}
  27. */
  28. name: DS.attr('string'),
  29. /**
  30. * display name of property that is taken from ui or
  31. * if UI has no info about property this can be formatted or plain name of property
  32. * @property {string}
  33. */
  34. displayName: DS.attr('string'),
  35. /**
  36. * filename of property that is taken from stack
  37. * ex: "hdfs-site.xml"
  38. * @property {string}
  39. */
  40. fileName: DS.attr('string'),
  41. /**
  42. * same as fileName
  43. * @property {string}
  44. */
  45. filename: function() {
  46. return this.get('fileName');
  47. }.property('fileName'),
  48. /**
  49. * description of config property meaning
  50. * @property {string}
  51. */
  52. description: DS.attr('string'),
  53. /**
  54. * defaultValue value of property is taken from stack before cluster is created
  55. * after cluster created is taken from cluster properties value
  56. * @property {string}
  57. */
  58. recommendedValue: DS.attr('string'),
  59. /**
  60. * defines if property support usage <code>isFinal<code> flag
  61. * @property {boolean}
  62. */
  63. supportsFinal: DS.attr('boolean', {defaultValue: true}),
  64. /**
  65. * defines the recommended value of <code>isFinal<code> value
  66. * @property {boolean}
  67. */
  68. recommendedIsFinal: DS.attr('boolean', {defaultValue: false}),
  69. /**
  70. * type of property
  71. * @property {string[]}
  72. */
  73. type: DS.attr('array', {defaultValue: []}),
  74. /**
  75. * service name
  76. * @property {string}
  77. */
  78. serviceName: DS.attr('string', {defaultValue: 'MISC'}),
  79. /**
  80. * stack name
  81. * @property {string}
  82. */
  83. stackName: DS.attr('string'),
  84. /**
  85. * stack version
  86. * @property {string}
  87. */
  88. stackVersion: DS.attr('string'),
  89. /**
  90. * describe widget details
  91. * @property {object}
  92. */
  93. widget: DS.attr('object', {defaultValue: null}),
  94. /**
  95. * this property contains array of properties which value
  96. * is dependent from current property
  97. * @property {array}
  98. */
  99. propertyDependedBy: DS.attr('array', {defaultValue: []}),
  100. /**
  101. * this property contains list of file type and name of properties
  102. * which values depends on current property
  103. * @property {object[]}
  104. */
  105. propertyDependsOn: DS.attr('array', {defaultValue: []}),
  106. /**
  107. * info for displaying property
  108. * example:
  109. * {
  110. * "type": "value-list",
  111. * "entries": ["true", "false"],
  112. * "entry_labels": ["Active", "Inactive"],
  113. * "entries_editable": "false",
  114. * "selection_cardinality": "1"
  115. * },
  116. * OR
  117. * {
  118. * "type": "int",
  119. * "minimum": "512",
  120. * "maximum": "10240",
  121. * "unit": "MB"
  122. * },
  123. * OR
  124. * {
  125. * "type": "value-list",
  126. * "entries": ["New_MySQL_Database", "Existing_MySQL_Database", "Existing_PostgreSQL_Database", "Existing_Oracle_Database"],
  127. * "entry_labels": ["New MySQL Database", "Existing MySQL Database", "Existing PostgreSQL Database", "Existing Oracle Database"],
  128. * "entry_descriptions": ["d1", "d2", "d3", "d4"],
  129. * "entries_editable": "false",
  130. * "selection_cardinality": "1" // 0+, 1+, etc.
  131. * }
  132. * @property {object}
  133. */
  134. valueAttributes: DS.attr('object', {defaultValue: null}),
  135. /**
  136. * sub section to which belongs this property
  137. * @property {App.SubSection}
  138. */
  139. subSection: DS.belongsTo('App.SubSection'),
  140. /******************************* UI properties ****************************************/
  141. /**
  142. * defines what kind of value this property contains
  143. * ex: string, digits, number, directories, custom
  144. * @property {string}
  145. */
  146. displayType: DS.attr('string', {defaultValue: 'string'}),
  147. /**
  148. * defines category name of property
  149. * used for advanced tab
  150. * @property {string}
  151. */
  152. category: DS.attr('string'),
  153. /**
  154. * config property value same as default
  155. * @property {string}
  156. */
  157. value: DS.attr('string'),
  158. /**
  159. * config property isFinal value same as recommendedIsFinal
  160. * @property {boolean}
  161. */
  162. isFinal: DS.attr('boolean', {defaultValue: false}),
  163. /**
  164. * @type {boolean}
  165. */
  166. index: DS.attr('number', {defaultValue: null})
  167. });
  168. App.StackConfigProperty.FIXTURES = [];