PageRenderTime 49ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/scalr-2/tags/scalr-2.1.0/app/templates/en_US/environment_edit.tpl

http://scalr.googlecode.com/
Smarty Template | 475 lines | 465 code | 10 blank | 0 comment | 26 complexity | 0ecee5539792a5880264c0be438bb5f2 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, GPL-3.0
  1. {include file="inc/header.tpl" noheader=1}
  2. <script type="text/javascript" src="/js/ui-ng/data.js"></script>
  3. <div id="form-environment-edit-view"></div>
  4. <script type="text/javascript">
  5. var title = '{$env->name}';
  6. var id = '{$env->id}';
  7. var params = eval({$envParams});
  8. var timezones = eval({$timezones});
  9. {literal}
  10. Ext.onReady(function () {
  11. Ext.override(Ext.form.Field, {
  12. getName: function () {
  13. return this.name || this.id || '';
  14. }
  15. });
  16. var form = new Ext.form.FormPanel({
  17. renderTo: "form-environment-edit-view",
  18. title: title,
  19. frame: true,
  20. fileUpload: true,
  21. labelWidth: 200,
  22. items: [
  23. {
  24. xtype: 'fieldset',
  25. title: 'API settings',
  26. labelWidth: 200,
  27. items: [{
  28. xtype: 'compositefield',
  29. hideLabel: true,
  30. items: [ {
  31. xtype:'checkbox',
  32. name:'api.enabled',
  33. value:1,
  34. checked:params['api.enabled']
  35. }, {
  36. xtype:'displayfield',
  37. cls: 'x-form-check-wrap',
  38. value:'Enable API for this environment'
  39. }]
  40. }, {
  41. xtype: 'textfield',
  42. name: 'api.keyid',
  43. fieldLabel: 'API Key ID',
  44. allowBlank: false,
  45. readOnly:true,
  46. width: 295,
  47. value: params['api.keyid']
  48. }, {
  49. xtype: 'textarea',
  50. name: 'api.access_key',
  51. fieldLabel: 'API Access Key',
  52. allowBlank: false,
  53. readOnly:true,
  54. width: 295,
  55. height:100,
  56. value: params['api.access_key']
  57. }, {
  58. xtype: 'compositefield',
  59. hideLabel: true,
  60. items: [ {
  61. xtype:'displayfield',
  62. cls: 'x-form-check-wrap',
  63. value:'<br />Allow access to the API only from the following IPs (coma separated).<br />Example: 67.45.3.7, 67.46.*.*, 91.*.*.*'
  64. }]
  65. }, {
  66. xtype:'textarea',
  67. hideLabel: true,
  68. name:'api.allowed_ips',
  69. width:500,
  70. height:100,
  71. value:params['api.allowed_ips']
  72. }]
  73. },
  74. {
  75. xtype: 'fieldset',
  76. title: 'System settings',
  77. labelWidth: 200,
  78. items: [{
  79. xtype: 'compositefield',
  80. hideLabel: true,
  81. items: [{
  82. xtype:'displayfield',
  83. cls: 'x-form-check-wrap',
  84. value:'Automatically abort instance synchronization if it does not complete in'
  85. }, {
  86. xtype: 'textfield',
  87. name: 'sync_timeout',
  88. allowBlank: false,
  89. width: 50,
  90. value: params['sync_timeout']
  91. }, {
  92. xtype: 'displayfield',
  93. cls: 'x-form-check-wrap',
  94. value: 'minutes.'
  95. }]
  96. }, {
  97. xtype: 'compositefield',
  98. fieldLabel: 'Instances limit',
  99. items: [{
  100. xtype: 'textfield',
  101. name: 'client_max_instances',
  102. allowBlank: false,
  103. width: 50,
  104. value: params['client_max_instances']
  105. }, {
  106. html: '<img src="/images/ui-ng/icons/info_icon_16x16.png" style="padding: 2px; cursor: help;" id="feev-client-max-instances">'
  107. }]
  108. }, {
  109. xtype: 'compositefield',
  110. fieldLabel: 'Elastic IPs limit',
  111. items: [{
  112. xtype: 'textfield',
  113. name: 'client_max_eips',
  114. allowBlank: false,
  115. width: 50,
  116. value: params['client_max_eips']
  117. }, {
  118. html: '<img src="/images/ui-ng/icons/info_icon_16x16.png" style="padding: 2px; cursor: help;" id="feev-client-max-eips">'
  119. }]
  120. }]
  121. }, {
  122. xtype: 'fieldset',
  123. title: 'Date & Time settings',
  124. items: [{
  125. xtype: 'combo',
  126. fieldLabel: 'Timezone',
  127. store: timezones,
  128. allowBlank: false,
  129. editable: true,
  130. name: 'timezone',
  131. value: params['timezone'],
  132. typeAhead: true,
  133. forceSelection: true,
  134. mode: 'local',
  135. triggerAction: 'all',
  136. selectOnFocus: false,
  137. width: 300
  138. }]
  139. }, {
  140. xtype: 'tabpanel',
  141. activeTab: 0,
  142. deferredRender: false,
  143. defaults: {
  144. style: 'padding:10px',
  145. autoHeight: true
  146. },
  147. items: [{
  148. title: 'AWS EC2',
  149. layout: 'form',
  150. items: [{
  151. xtype: 'checkbox',
  152. name: 'ec2.is_enabled',
  153. checked: params['ec2.is_enabled'],
  154. hideLabel: true,
  155. boxLabel: 'Enable platform',
  156. listeners: {
  157. 'check': function (checkbox, checked) {
  158. if (checked) {
  159. form.getForm().findField('ec2.account_id').enable();
  160. form.getForm().findField('ec2.access_key').enable();
  161. form.getForm().findField('ec2.secret_key').enable();
  162. form.getForm().findField('ec2.certificate').enable();
  163. form.getForm().findField('ec2.private_key').enable();
  164. if (form.getForm().findField('rds.is_enabled').checked)
  165. form.getForm().findField('rds.the_same_as_ec2').enable();
  166. } else {
  167. form.getForm().findField('ec2.account_id').disable();
  168. form.getForm().findField('ec2.access_key').disable();
  169. form.getForm().findField('ec2.secret_key').disable();
  170. form.getForm().findField('ec2.certificate').disable();
  171. form.getForm().findField('ec2.private_key').disable();
  172. form.getForm().findField('rds.the_same_as_ec2').setValue(false);
  173. form.getForm().findField('rds.the_same_as_ec2').disable();
  174. }
  175. }
  176. }
  177. }, {
  178. xtype: 'textfield',
  179. fieldLabel: 'Account ID',
  180. width: 320,
  181. name: 'ec2.account_id',
  182. value: params['ec2.account_id'],
  183. disabled: !params['ec2.is_enabled']
  184. }, {
  185. xtype: 'textfield',
  186. fieldLabel: 'Access Key',
  187. width: 320,
  188. name: 'ec2.access_key',
  189. value: params['ec2.access_key'],
  190. disabled: !params['ec2.is_enabled']
  191. }, {
  192. xtype: 'textfield',
  193. fieldLabel: 'Secret Key',
  194. width: 320,
  195. name: 'ec2.secret_key',
  196. value: params['ec2.secret_key'],
  197. disabled: !params['ec2.is_enabled']
  198. }, {
  199. xtype: 'textfield',
  200. inputType: 'file',
  201. fieldLabel: 'X.509 Certificate file',
  202. name: 'ec2.certificate',
  203. disabled: !params['ec2.is_enabled']
  204. }, {
  205. xtype: 'textfield',
  206. inputType: 'file',
  207. fieldLabel: 'X.509 Private Key file',
  208. name: 'ec2.private_key',
  209. disabled: !params['ec2.is_enabled']
  210. }]
  211. }, {
  212. title: 'AWS RDS',
  213. layout: 'form',
  214. items: [{
  215. xtype: 'checkbox',
  216. name: 'rds.is_enabled',
  217. checked: params['rds.is_enabled'] && params['ec2.is_enabled'],
  218. hideLabel: true,
  219. boxLabel: 'Enable platform',
  220. listeners: {
  221. 'check': function (checkbox, checked) {
  222. if (checked && form.getForm().findField('ec2.is_enabled').checked)
  223. form.getForm().findField('rds.the_same_as_ec2').enable();
  224. else
  225. form.getForm().findField('rds.the_same_as_ec2').disable();
  226. if (checked && !form.getForm().findField('rds.the_same_as_ec2').checked) {
  227. form.getForm().findField('rds.account_id').enable();
  228. form.getForm().findField('rds.access_key').enable();
  229. form.getForm().findField('rds.secret_key').enable();
  230. form.getForm().findField('rds.certificate').enable();
  231. form.getForm().findField('rds.private_key').enable();
  232. } else {
  233. form.getForm().findField('rds.account_id').disable();
  234. form.getForm().findField('rds.access_key').disable();
  235. form.getForm().findField('rds.secret_key').disable();
  236. form.getForm().findField('rds.certificate').disable();
  237. form.getForm().findField('rds.private_key').disable();
  238. }
  239. }
  240. }
  241. }, {
  242. xtype: 'checkbox',
  243. name: 'rds.the_same_as_ec2',
  244. checked: params['rds.the_same_as_ec2'],
  245. hideLabel: true,
  246. boxLabel: 'Use the same as EC2',
  247. disabled: !params['rds.is_enabled'],
  248. listeners: {
  249. 'check': function (checkbox, checked) {
  250. if (! checked) {
  251. form.getForm().findField('rds.account_id').enable();
  252. form.getForm().findField('rds.access_key').enable();
  253. form.getForm().findField('rds.secret_key').enable();
  254. form.getForm().findField('rds.certificate').enable();
  255. form.getForm().findField('rds.private_key').enable();
  256. } else {
  257. form.getForm().findField('rds.account_id').disable();
  258. form.getForm().findField('rds.access_key').disable();
  259. form.getForm().findField('rds.secret_key').disable();
  260. form.getForm().findField('rds.certificate').disable();
  261. form.getForm().findField('rds.private_key').disable();
  262. }
  263. }
  264. }
  265. }, {
  266. xtype: 'textfield',
  267. fieldLabel: 'Account ID',
  268. width: 320,
  269. name: 'rds.account_id',
  270. value: params['rds.account_id'],
  271. disabled: !params['rds.is_enabled'] || params['rds.the_same_as_ec2']
  272. }, {
  273. xtype: 'textfield',
  274. fieldLabel: 'Access Key',
  275. width: 320,
  276. name: 'rds.access_key',
  277. value: params['rds.access_key'],
  278. disabled: !params['rds.is_enabled'] || params['rds.the_same_as_ec2']
  279. }, {
  280. xtype: 'textfield',
  281. fieldLabel: 'Secret Key',
  282. width: 320,
  283. name: 'rds.secret_key',
  284. value: params['rds.secret_key'],
  285. disabled: !params['rds.is_enabled'] || params['rds.the_same_as_ec2']
  286. }, {
  287. xtype: 'textfield',
  288. inputType: 'file',
  289. fieldLabel: 'X.509 Certificate file',
  290. name: 'rds.certificate',
  291. disabled: !params['rds.is_enabled'] || params['rds.the_same_as_ec2']
  292. }, {
  293. xtype: 'textfield',
  294. inputType: 'file',
  295. fieldLabel: 'X.509 Private Key file',
  296. name: 'rds.private_key',
  297. disabled: !params['rds.is_enabled'] || params['rds.the_same_as_ec2']
  298. }]
  299. }, /*{
  300. title: 'Rackspace',
  301. layout: 'form',
  302. items: [{
  303. xtype: 'checkbox',
  304. name: 'rackspace.is_enabled',
  305. checked: params['rackspace.is_enabled'],
  306. hideLabel: true,
  307. boxLabel: 'Enable platform',
  308. listeners: {
  309. 'check': function (checkbox, checked) {
  310. if (checked) {
  311. form.getForm().findField('rackspace.username').enable();
  312. form.getForm().findField('rackspace.api_key').enable();
  313. } else {
  314. form.getForm().findField('rackspace.username').disable();
  315. form.getForm().findField('rackspace.api_key').disable();
  316. }
  317. }
  318. }
  319. }, {
  320. xtype: 'textfield',
  321. fieldLabel: 'Username',
  322. name: 'rackspace.username',
  323. value: params['rackspace.username'],
  324. disabled: !params['rackspace.is_enabled']
  325. }, {
  326. xtype: 'textfield',
  327. fieldLabel: 'API Key',
  328. name: 'rackspace.api_key',
  329. value: params['rackspace.api_key'],
  330. disabled: !params['rackspace.is_enabled']
  331. }]
  332. },*/ {
  333. title: 'Eucalyptus',
  334. layout: 'form',
  335. items: [{
  336. xtype: 'checkbox',
  337. name: 'eucalyptus.is_enabled',
  338. checked: params['eucalyptus.is_enabled'],
  339. hideLabel: true,
  340. boxLabel: 'Enable platform',
  341. listeners: {
  342. 'check': function (checkbox, checked) {
  343. if (checked) {
  344. form.getForm().findField('eucalyptus.account_id').enable();
  345. form.getForm().findField('eucalyptus.access_key').enable();
  346. form.getForm().findField('eucalyptus.ec2_url').enable();
  347. form.getForm().findField('eucalyptus.s3_url').enable();
  348. form.getForm().findField('eucalyptus.secret_key').enable();
  349. form.getForm().findField('eucalyptus.certificate').enable();
  350. form.getForm().findField('eucalyptus.cloud_certificate').enable();
  351. form.getForm().findField('eucalyptus.private_key').enable();
  352. } else {
  353. form.getForm().findField('eucalyptus.account_id').disable();
  354. form.getForm().findField('eucalyptus.access_key').disable();
  355. form.getForm().findField('eucalyptus.ec2_url').disable();
  356. form.getForm().findField('eucalyptus.s3_url').disable();
  357. form.getForm().findField('eucalyptus.secret_key').disable();
  358. form.getForm().findField('eucalyptus.certificate').disable();
  359. form.getForm().findField('eucalyptus.cloud_certificate').disable();
  360. form.getForm().findField('eucalyptus.private_key').disable();
  361. }
  362. }
  363. }
  364. }, {
  365. xtype: 'textfield',
  366. fieldLabel: 'Account ID',
  367. width:320,
  368. name: 'eucalyptus.account_id',
  369. value: params['eucalyptus.account_id'],
  370. disabled: !params['eucalyptus.is_enabled']
  371. }, {
  372. xtype: 'textfield',
  373. fieldLabel: 'Access Key',
  374. width:320,
  375. name: 'eucalyptus.access_key',
  376. value: params['eucalyptus.access_key'],
  377. disabled: !params['eucalyptus.is_enabled']
  378. }, {
  379. xtype: 'textfield',
  380. fieldLabel: 'Secret Key',
  381. name: 'eucalyptus.secret_key',
  382. width:320,
  383. value: params['eucalyptus.secret_key'],
  384. disabled: !params['eucalyptus.is_enabled']
  385. }, {
  386. xtype: 'textfield',
  387. width:320,
  388. fieldLabel: 'EC2 URL (eg. http://192.168.1.1:8773/services/Eucalyptus)',
  389. name: 'eucalyptus.ec2_url',
  390. value: params['eucalyptus.ec2_url'],
  391. disabled: !params['eucalyptus.is_enabled']
  392. }, {
  393. xtype: 'textfield',
  394. fieldLabel: 'S3 URL (eg. http://192.168.1.1:8773/services/Walrus)',
  395. width:320,
  396. name: 'eucalyptus.s3_url',
  397. value: params['eucalyptus.s3_url'],
  398. disabled: !params['eucalyptus.is_enabled']
  399. }, {
  400. xtype: 'textfield',
  401. inputType: 'file',
  402. fieldLabel: 'X.509 Certificate file',
  403. name: 'eucalyptus.certificate',
  404. disabled: !params['eucalyptus.is_enabled']
  405. }, {
  406. xtype: 'textfield',
  407. inputType: 'file',
  408. fieldLabel: 'X.509 Private Key file',
  409. name: 'eucalyptus.private_key',
  410. disabled: !params['eucalyptus.is_enabled']
  411. }, {
  412. xtype: 'textfield',
  413. inputType: 'file',
  414. fieldLabel: 'X.509 Cloud certificate file',
  415. name: 'eucalyptus.cloud_certificate',
  416. disabled: !params['eucalyptus.is_enabled']
  417. }]
  418. }]
  419. }],
  420. buttonAlign: 'center',
  421. buttons: [{
  422. type: 'submit',
  423. text: 'Save',
  424. handler: function() {
  425. if (form.getForm().isValid()) {
  426. form.getForm().submit({
  427. url: '/environment_edit.php',
  428. params: {
  429. env_id: id
  430. },
  431. success: function(form, action) {
  432. document.location.href = '/environments.php';
  433. },
  434. failure: Scalr.data.ExceptionFormReporter
  435. });
  436. }
  437. }
  438. }, {
  439. type: 'reset',
  440. text: 'Cancel',
  441. handler: function() {
  442. document.location.href = '/environments.php';
  443. }
  444. }]
  445. });
  446. form.getForm().getEl().select('input').each(function(el) {
  447. el.dom.name = 'var[' + el.dom.name + ']';
  448. });
  449. form.getForm().getEl().select('textarea').each(function(el) {
  450. el.dom.name = 'var[' + el.dom.name + ']';
  451. });
  452. new Ext.ToolTip({
  453. target: 'feev-client-max-instances',
  454. dismissDelay: 0,
  455. html: "You need to ask Amazon (aws@amazon.com) to increase instances limit for you before increasing this value."
  456. });
  457. new Ext.ToolTip({
  458. target: 'feev-client-max-eips',
  459. dismissDelay: 0,
  460. html: "By default, every AWS account can allocate maximum 5 Elastic IPs. If you're already using Elastic IPs outside Scalr, make sure to substract this amount, otherwise IPs will be reassigned to Scalr instances without any prompt."
  461. });
  462. });
  463. {/literal}
  464. </script>
  465. {include file="inc/footer.tpl"}