step12_controller.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. App.WizardStep12Controller = App.MainServiceInfoConfigsController.extend({
  19. modifiedConfigs: [],
  20. afterLoad: function () {
  21. if (this.get('dataIsLoaded')) {
  22. this.get('stepConfigs').objectAt(0).get('configs').filterProperty('isEditable', false).setEach('isEditable', true);
  23. this.get('stepConfigs').objectAt(0).get('configs').filterProperty('displayType', 'masterHost').setEach('isVisible', false);
  24. }
  25. }.observes('dataIsLoaded'),
  26. addHostNamesToGlobalConfig: function () {
  27. var hostComponents = [];
  28. this.get('content.masterComponentHosts').forEach(function (component) {
  29. hostComponents.push(Ember.Object.create({
  30. componentName: component.component,
  31. host: {hostName: component.hostName}
  32. }))
  33. });
  34. this.set('content.hostComponents', hostComponents);
  35. this._super();
  36. },
  37. submit: function () {
  38. if (this.get('isSubmitDisabled')) {
  39. return false;
  40. }
  41. var self = this;
  42. this.get('modifiedConfigs').clear();
  43. this.get('stepConfigs').objectAt(0).get('configs').forEach(function (config) {
  44. if (config.get('defaultValue') !== config.get('value')) {
  45. self.get('modifiedConfigs').push({
  46. name: config.get('displayName'),
  47. oldValue: config.get('defaultValue'),
  48. value: config.get('value'),
  49. unit: config.get('unit') || false
  50. });
  51. }
  52. });
  53. App.router.send('next');
  54. }
  55. });