/** * 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 stringUtils = require('utils/string_utils'); App.WizardStep8Controller = Em.Controller.extend({ name: 'wizardStep8Controller', /** * List of raw data about cluster that should be displayed * @type {Array} */ rawContent: [ { config_name: 'Admin', display_name: 'Admin Name', config_value: '' }, { config_name: 'cluster', display_name: 'Cluster Name', config_value: '' }, { config_name: 'hosts', display_name: 'Total Hosts', config_value: '' }, { config_name: 'Repo', display_name: 'Local Repository', config_value: '' } ], /** * List of data about cluster (based on formatted rawContent) * @type {Object[]} */ clusterInfo: [], /** * List of services with components assigned to hosts * @type {Object[]} */ services: [], /** * @type {Object[]} */ configs: [], /** * @type {Object[]} */ globals: [], /** * All configs * @type {Array} */ configMapping: function () { return App.config.get('configMapping').all(true); }.property('App.config.configMapping'), /** * */ slaveComponentConfig: null, /** * Should Submit button be disabled * @type {bool} */ isSubmitDisabled: false, /** * Should Back button be disabled * @type {bool} */ isBackBtnDisabled: false, /** * Is error appears while ajaxQueue executes * @type {bool} */ hasErrorOccurred: false, /** * Are services installed * Used to hide Deploy Progress Bar * @type {bool} */ servicesInstalled: false, /** * List of service config tags * @type {Object[]} */ serviceConfigTags: [], /** * Ajax-requests queue * @type {App.ajaxQueue} */ ajaxRequestsQueue: null, /** * Is cluster security enabled * @type {bool} */ securityEnabled: function () { return App.router.get('mainAdminSecurityController.securityEnabled'); }.property('App.router.mainAdminSecurityController.securityEnabled'), /** * During page save time, we set the host overrides to the server. * The new host -> site:tag map is stored below. This will be * useful during save, to update the host's host components. Also, * it will be useful in deletion of overrides. * * Example: * { * 'hostname1': { * 'global': { * 'tagName': 'tag3187261938_hostname1', * 'map': { * 'hadoop_heapsize': '2048m' * } * } * } * } * * @see loadedHostToOverrideSiteToTagMap */ savedHostToOverrideSiteToTagMap: {}, /** * Selected config group * @type {Object} */ selectedConfigGroup: null, /** * List of config groups * @type {Object[]} */ configGroups: [], /** * List of selected but not installed services * @type {Object[]} */ selectedServices: function () { return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false); }.property('content.services').cacheable(), /** * List of installed and selected services * @type {Object[]} */ installedServices: function () { return this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled'); }.property('content.services').cacheable(), /** * Ajax-requests count * @type {number} */ ajaxQueueLength: 0, /** * Current cluster name * @type {string} */ clusterName: function () { return this.get('content.cluster.name'); }.property('content.cluster.name'), /** * List of existing cluster names * @type {string[]} */ clusterNames: [], /** * Clear current step data * @method clearStep */ clearStep: function () { this.get('services').clear(); this.get('configs').clear(); this.get('globals').clear(); this.get('clusterInfo').clear(); this.get('serviceConfigTags').clear(); this.set('servicesInstalled', false); this.set('ajaxQueueLength', 0); this.set('ajaxRequestsQueue', App.ajaxQueue.create()); this.set('ajaxRequestsQueue.finishedCallback', this.ajaxQueueFinished); }, /** * Load current step data * @method loadStep */ loadStep: function () { console.log("TRACE: Loading step8: Review Page"); if (this.get('content.controllerName') != 'installerController') { App.router.get('mainAdminSecurityController').setSecurityStatus(); } this.clearStep(); if (this.get('content.serviceConfigProperties')) { this.formatProperties(); this.loadGlobals(); this.loadConfigs(); } this.loadClusterInfo(); this.loadServices(); this.set('isSubmitDisabled', false); this.set('isBackBtnDisabled', false); }, /** * replace whitespace character with coma between directories * @method formatProperties */ formatProperties: function () { this.get('content.serviceConfigProperties').forEach(function (_configProperty) { _configProperty.value = App.config.trimProperty(_configProperty, false); }); }, /** * Load global configs and remove some of them: *