step3_controller.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.WidgetWizardStep3Controller = Em.Controller.extend({
  20. name: "widgetWizardStep3Controller",
  21. /**
  22. * @type {Array}
  23. */
  24. scopes: [
  25. Em.Object.create({
  26. name: 'User',
  27. checked: true
  28. }),
  29. Em.Object.create({
  30. name: 'Cluster',
  31. checked: false
  32. })
  33. ],
  34. /**
  35. * @type {string}
  36. */
  37. widgetName: '',
  38. /**
  39. * @type {string}
  40. */
  41. widgetAuthor: '',
  42. /**
  43. * @type {string}
  44. */
  45. widgetScope: function () {
  46. return this.get('scopes').findProperty('checked');
  47. }.property('scopes.@each.checked'),
  48. /**
  49. * @type {string}
  50. */
  51. widgetDescription: '',
  52. /**
  53. * actual values of properties in API format
  54. * @type {object}
  55. */
  56. widgetProperties: {},
  57. /**
  58. * @type {Array}
  59. */
  60. widgetValues: [],
  61. /**
  62. * @type {Array}
  63. */
  64. widgetMetrics: [],
  65. /**
  66. * restore widget data set on 2nd step
  67. */
  68. initPreviewData: function () {
  69. this.set('widgetProperties', this.get('content.widgetProperties'));
  70. this.set('widgetValues', this.get('content.widgetValues'));
  71. this.set('widgetMetrics', this.get('content.widgetMetrics'));
  72. this.set('widgetAuthor', App.router.get('loginName'));
  73. this.set('widgetName', '');
  74. this.set('widgetDescription', '');
  75. },
  76. //TODO: Following computed propert needs to be implemented. Next button should be enabled when there is no validation error and all required fields are filled
  77. isSubmitDisabled: function () {
  78. return !this.get('widgetName');
  79. }.property('widgetName')
  80. });