step5_view.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.WizardStep5View = Em.View.extend({
  20. templateName: require('templates/wizard/step5'),
  21. didInsertElement: function () {
  22. var controller = this.get('controller');
  23. controller.loadStep();
  24. if (controller.lastZooKeeper()) {
  25. if (controller.get("selectedServicesMasters").filterProperty("display_name", "ZooKeeper").length < controller.get("hosts.length")) {
  26. controller.lastZooKeeper().set('showAddControl', true);
  27. } else {
  28. controller.lastZooKeeper().set('showRemoveControl', false);
  29. }
  30. }
  31. }
  32. });
  33. App.SelectHostView = Em.Select.extend({
  34. content: [],
  35. zId: null,
  36. selectedHost: null,
  37. serviceName: null,
  38. change: function () {
  39. this.get('controller').assignHostToMaster(this.get("serviceName"), this.get("value"), this.get("zId"));
  40. },
  41. didInsertElement: function () {
  42. this.set("value", this.get("selectedHost"));
  43. }
  44. });
  45. App.AddControlView = Em.View.extend({
  46. componentName: null,
  47. tagName: "span",
  48. classNames: ["badge", "badge-important"],
  49. template: Ember.Handlebars.compile('+'),
  50. click: function () {
  51. this.get('controller').addZookeepers();
  52. }
  53. });
  54. App.RemoveControlView = Em.View.extend({
  55. zId: null,
  56. tagName: "span",
  57. classNames: ["badge", "badge-important"],
  58. template: Ember.Handlebars.compile('-'),
  59. click: function () {
  60. this.get('controller').removeZookeepers(this.get("zId"));
  61. }
  62. });