Code coverage report for app/controllers/main/admin/kerberos/step1_controller.js

Statements: 42.86% (6 / 14)      Branches: 50% (2 / 4)      Functions: 33.33% (3 / 9)      Lines: 42.86% (6 / 14)      Ignored: none     

All files » app/controllers/main/admin/kerberos/ » step1_controller.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124    1                                     1   1                               1                                                                                                                                                             2 1        
'use strict';
 
;require.register("controllers/main/admin/kerberos/step1_controller", function (exports, require, module) {
  /**
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
 
  var App = require('app');
 
  var PreCondition = Ember.Object.extend({
    displayText: null,
    checked: false,
    visibilityCriteria: function visibilityCriteria() {
      return true;
    },
 
    hidden: function () {
      return !this.get('visibilityCriteria')();
    }.property('visibilityCriteria'),
 
    satisfied: function () {
      return this.get('checked') || this.get('hidden');
    }.property('checked', 'hidden')
  });
 
  App.KerberosWizardStep1Controller = Em.Controller.extend({
    name: "kerberosWizardStep1Controller",
 
    selectedItem: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
 
    isSubmitDisabled: Em.computed.someBy('selectedOption.preConditions', 'satisfied', false),
 
    options: Em.A([Em.Object.create({
      displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
      value: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
      preConditions: [PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc.condition.1')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc.condition.2')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc.condition.3')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc.condition.4'),
        visibilityCriteria: function visibilityCriteria() {
          return App.Service.find().someProperty('serviceName', 'ONEFS');
        }
      })]
    }), Em.Object.create({
      displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.ad'),
      value: Em.I18n.t('admin.kerberos.wizard.step1.option.ad'),
      preConditions: [PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.1')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.2')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.3')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.4')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ad.condition.5')
      })]
    }), Em.Object.create({
      displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa'),
      value: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa'),
      preConditions: [PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.1')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.2')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.3')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.4')
      })]
    }), Em.Object.create({
      displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.manual'),
      value: Em.I18n.t('admin.kerberos.wizard.step1.option.manual'),
      preConditions: [PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.manual.condition.1')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.manual.condition.2')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.manual.condition.3')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.manual.condition.4')
      }), PreCondition.create({
        displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.manual.condition.5')
      })]
    })]),
 
    /**
     * precondition for the selected KDC option
     * whenever the KDC type is changed, all checkboxes for the precondition should be unchecked
     */
    selectedOption: function () {
      var options = this.get('options');
      options.forEach(function (option) {
        option.preConditions.setEach('checked', false);
      });
      return this.get('options').findProperty('value', this.get('selectedItem'));
    }.property('selectedItem'),
 
    loadStep: function loadStep() {},
 
    submit: function submit() {
      if (!this.get('isSubmitDisabled')) {
        App.router.send('next');
      }
    }
  });
});