step1_controller.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.KerberosWizardStep1Controller = Em.Controller.extend({
  20. name: "kerberosWizardStep1Controller",
  21. selectedItem: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
  22. isSubmitDisabled: function() {
  23. return this.get('selectedOption.preConditions').someProperty('checked',false);
  24. }.property('selectedOption', 'selectedOption.preConditions.@each.checked'),
  25. options: [
  26. Em.Object.create({
  27. displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
  28. value: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
  29. preConditions: [
  30. Em.Object.create({
  31. displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc.condition.1'),
  32. checked: false
  33. }),
  34. Em.Object.create({
  35. displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc.condition.2'),
  36. checked: false
  37. })
  38. ]
  39. }),
  40. Em.Object.create({
  41. displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.ad'),
  42. value: Em.I18n.t('admin.kerberos.wizard.step1.option.ad'),
  43. preConditions: [
  44. Em.Object.create({
  45. displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.1'),
  46. checked: false
  47. }),
  48. Em.Object.create({
  49. displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.2'),
  50. checked: false
  51. })
  52. ]
  53. })
  54. ],
  55. /**
  56. * precondition for the selected KDC option
  57. */
  58. selectedOption: function () {
  59. var options = this.get('options');
  60. var selectedItem = this.get('selectedItem');
  61. return options.findProperty('value', selectedItem);
  62. }.property('selectedItem'),
  63. loadStep: function () {
  64. this.set('selectedItem', Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'));
  65. },
  66. next: function () {
  67. if (!this.get('isSubmitDisabled')) {
  68. App.router.send('next');
  69. }
  70. }
  71. });