12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349 |
- /**
- * 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');
- App.WizardStep8Controller = Em.Controller.extend({
- name: 'wizardStep8Controller',
- rawContent: require('data/review_configs'),
- totalHosts: [],
- clusterInfo: [],
- services: [],
- configs: [],
- globals: [],
- configMapping: require('data/config_mapping'),
- slaveComponentConfig: null,
- isSubmitDisabled: false,
- selectedServices: function () {
- return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false);
- }.property('content.services').cacheable(),
- clearStep: function () {
- this.get('services').clear();
- this.get('configs').clear();
- this.get('globals').clear();
- this.get('clusterInfo').clear();
- },
- loadStep: function () {
- console.log("TRACE: Loading step8: Review Page");
- this.clearStep();
- this.loadGlobals();
- this.loadConfigs();
- this.setCustomConfigs();
- this.loadSlaveConfiguration();
- this.loadClusterInfo();
- this.loadServices();
- },
- loadGlobals: function () {
- var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
- if (globals.someProperty('name', 'hive_database')) {
- //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgres is not the default db
- var hiveDb = globals.findProperty('name', 'hive_database');
- if (hiveDb.value === 'New PostgreSQL Database') {
- globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_host';
- globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
- globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
- } else {
- globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_host';
- globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
- globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
- }
- }
- this.set('globals', globals);
- },
- loadConfigs: function () {
- var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property').filterProperty('value');
- var uiConfigs = this.loadUiSideConfigs();
- this.set('configs', storedConfigs.concat(uiConfigs));
- },
- loadUiSideConfigs: function () {
- var uiConfig = [];
- var configs = this.get('configMapping').filterProperty('foreignKey', null);
- configs.forEach(function (_config) {
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- uiConfig.pushObject({
- "id": "site property",
- "name": _config.name,
- "value": value,
- "filename": _config.filename
- });
- }, this);
- var dependentConfig = this.get('configMapping').filterProperty('foreignKey');
- dependentConfig.forEach(function (_config) {
- this.setConfigValue(uiConfig, _config);
- uiConfig.pushObject({
- "id": "site property",
- "name": _config.name,
- "value": _config.value,
- "filename": _config.filename
- });
- }, this);
- return uiConfig;
- },
- getRegisteredHosts: function () {
- var allHosts = this.get('content.hostsInfo');
- var hosts = [];
- for (var hostName in allHosts) {
- if (allHosts[hostName].bootStatus == 'REGISTERED') {
- allHosts[hostName].hostName = allHosts[hostName].name;
- hosts.pushObject(allHosts[hostName]);
- }
- }
- return hosts;
- },
- /**
- * Set all site property that are derived from other puppet-variable
- */
- getGlobConfigValue: function (templateName, expression) {
- var express = expression.match(/<(.*?)>/g);
- var value = expression;
- if (express == null) {
- return expression;
- }
- express.forEach(function (_express) {
- //console.log("The value of template is: " + _express);
- var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
- if (this.get('globals').someProperty('name', templateName[index])) {
- //console.log("The name of the variable is: " + this.get('content.serviceConfigProperties').findProperty('name', templateName[index]).name);
- var globValue = this.get('globals').findProperty('name', templateName[index]).value;
- value = value.replace(_express, globValue);
- } else {
- /*
- console.log("ERROR: The variable name is: " + templateName[index]);
- console.log("ERROR: mapped config from configMapping file has no corresponding variable in " +
- "content.serviceConfigProperties. Two possible reasons for the error could be: 1) The service is not selected. " +
- "and/OR 2) The service_config metadata file has no corresponding global var for the site property variable");
- */
- value = null;
- }
- }, this);
- return value;
- },
- /**
- * Set all site property that are derived from other site-properties
- */
- setConfigValue: function (uiConfig, config) {
- var fkValue = config.value.match(/<(foreignKey.*?)>/g);
- if (fkValue) {
- fkValue.forEach(function (_fkValue) {
- var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
- if (uiConfig.someProperty('name', config.foreignKey[index])) {
- var globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
- config.value = config.value.replace(_fkValue, globalValue);
- } else if (this.get('content.serviceConfigProperties').someProperty('name', config.foreignKey[index])) {
- var globalValue;
- if (this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value === '') {
- globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).defaultValue;
- } else {
- globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value;
- }
- config.value = config.value.replace(_fkValue, globalValue);
- }
- }, this);
- }
- if (fkValue = config.name.match(/<(foreignKey.*?)>/g)) {
- fkValue.forEach(function (_fkValue) {
- var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
- if (uiConfig.someProperty('name', config.foreignKey[index])) {
- var globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
- config.name = config.name.replace(_fkValue, globalValue);
- } else if (this.get('content.serviceConfigProperties').someProperty('name', config.foreignKey[index])) {
- var globalValue;
- if (this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value === '') {
- globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).defaultValue;
- } else {
- globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value;
- }
- config.name = config.name.replace(_fkValue, globalValue);
- }
- }, this);
- }
- //For properties in the configMapping file having foreignKey and templateName properties.
- var templateValue = config.value.match(/<(templateName.*?)>/g);
- if (templateValue) {
- templateValue.forEach(function (_value) {
- var index = parseInt(_value.match(/\[([\d]*)(?=\])/)[1]);
- if (this.get('globals').someProperty('name', config.templateName[index])) {
- var globalValue = this.get('globals').findProperty('name', config.templateName[index]).value;
- config.value = config.value.replace(_value, globalValue);
- }
- }, this);
- }
- },
- /**
- * override site properties with the entered key-value pair in *-site.xml
- */
- setCustomConfigs: function () {
- var site = this.get('content.serviceConfigProperties').filterProperty('id', 'conf-site');
- site.forEach(function (_site) {
- var keyValue = _site.value.split(/\n+/);
- if (keyValue) {
- keyValue.forEach(function (_keyValue) {
- console.log("The value of the keyValue is: " + _keyValue.trim());
- _keyValue = _keyValue.trim();
- var key = _keyValue.match(/(.+)=/);
- var value = _keyValue.match(/=(.*)/);
- if (key) {
- this.setSiteProperty(key[1], value[1], _site.filename);
- }
- }, this);
- }
- }, this);
- },
- /**
- * Set property of the site variable
- */
- setSiteProperty: function (key, value, filename) {
- if (this.get('configs').someProperty('name', key)) {
- this.get('configs').findProperty('name', key).value = value;
- } else {
- this.get('configs').pushObject({
- "id": "site property",
- "name": key,
- "value": value,
- "filename": filename
- });
- }
- },
- loadSlaveConfiguration: function () {
- var slaveComponentConfig = this.convertSlaveConfig(this.get('content.slaveGroupProperties'));
- this.set("slaveComponentConfig", slaveComponentConfig);
- },
- convertSlaveConfig: function (slaveContent) {
- var dest = {
- "version": "1.0",
- "components": [
- ],
- "slaveHostComponents": []
- };
- slaveContent.forEach(function (_slaveContent) {
- var newComponent = {};
- newComponent.componentName = _slaveContent.componentName;
- newComponent.serviceName = this.getServiceInfo(newComponent.componentName).name;
- newComponent.groups = [];
- var index = 2;
- _slaveContent.groups.forEach(function (_group) {
- var newGroup = {};
- newGroup.groupName = _group.name;
- newGroup.configVersion = {config: {'global': 'version1', 'core-site': 'version1'}}; // TODO : every time a new version should be generated
- if (this.getServiceInfo(_slaveContent.componentName)) {
- newGroup.configVersion.config[this.getServiceInfo(_slaveContent.componentName).domain] = 'version' + index;
- newGroup.configVersion.config[this.getServiceInfo(_slaveContent.componentName).siteName] = 'version' + index;
- }
- newGroup.siteVersion = 'version' + index;
- newGroup.hostNames = _slaveContent.hosts.filterProperty("group", newGroup.groupName).mapProperty('hostName');
- newGroup.properties = _group.properties;
- if (!Ember.empty(newGroup.hostNames)) {
- newComponent.groups.push(newGroup);
- }
- index++;
- }, this);
- dest.components.push(newComponent);
- }, this);
- var hostsInfo = this.get('content.hostsInfo');
- for (var index in hostsInfo) {
- var hostIndex = 2;
- var slaveHost = {name: null, configVersion: null, slaveComponents: []};
- dest.components.forEach(function (_component) {
- _component.groups.forEach(function (_group) {
- if (_group.hostNames.contains(hostsInfo[index].name)) {
- var slaveComponent = {};
- slaveHost.name = hostsInfo[index].name;
- slaveComponent.componentName = _component.componentName;
- slaveComponent.groupName = _group.groupName;
- slaveComponent.properties = _group.properties;
- slaveHost.slaveComponents.pushObject(slaveComponent);
- }
- }, this);
- }, this);
- hostIndex++;
- if (!Ember.none(slaveHost.name)) {
- dest.slaveHostComponents.pushObject(slaveHost);
- }
- }
- return dest;
- },
- getServiceInfo: function (componentName) {
- var serviceConfig;
- switch (componentName) {
- case 'DATANODE':
- serviceConfig = {
- name: 'HDFS',
- siteName: 'hdfs-site',
- domain: 'datanode-global'
- };
- break;
- case 'TASKTRACKER':
- serviceConfig = {
- name: 'MAPREDUCE',
- siteName: 'mapred-site',
- domain: 'tasktracker-global'
- };
- break;
- case 'HBASE_REGIONSERVER':
- serviceConfig = {
- name: 'HBASE',
- siteName: 'hbase-site',
- domain: 'regionserver-global'
- };
- break;
- default:
- serviceConfig = null;
- }
- return serviceConfig;
- },
- /**
- * Load all info about cluster to <code>clusterInfo</code> variable
- */
- loadClusterInfo: function () {
- // cluster name
- var cluster = this.rawContent.findProperty('config_name', 'cluster');
- cluster.config_value = this.get('content.cluster.name');
- console.log("STEP8: the value of content cluster name: " + this.get('content.cluster.name'));
- this.get('clusterInfo').pushObject(Ember.Object.create(cluster));
- //hosts
- var masterHosts = this.get('content.masterComponentHosts').mapProperty('hostName').uniq();
- var slaveHosts = this.get('content.slaveComponentHosts');
- var hostObj = [];
- slaveHosts.forEach(function (_hosts) {
- hostObj = hostObj.concat(_hosts.hosts);
- }, this);
- slaveHosts = hostObj.mapProperty('hostName').uniq();
- var totalHosts = masterHosts.concat(slaveHosts).uniq();
- this.set('totalHosts', totalHosts);
- var totalHostsObj = this.rawContent.findProperty('config_name', 'hosts');
- totalHostsObj.config_value = totalHosts.length;
- this.get('clusterInfo').pushObject(Ember.Object.create(totalHostsObj));
- //repo
- var repoOption = this.get('content.hosts.localRepo');
- var repoObj = this.rawContent.findProperty('config_name', 'Repo');
- if (repoOption) {
- repoObj.config_value = 'Yes';
- } else {
- repoObj.config_value = 'No';
- }
- this.get('clusterInfo').pushObject(Ember.Object.create(repoObj));
- },
- /**
- * Load all info about services to <code>services</code> variable
- */
- loadServices: function () {
- var selectedServices = this.get('selectedServices');
- this.set('services', selectedServices.mapProperty('serviceName'));
- selectedServices.forEach(function (_service) {
- console.log('INFO: step8: Name of the service from getService function: ' + _service.serviceName);
- var reviewService = this.rawContent.findProperty('config_name', 'services');
- var serviceObj = reviewService.config_value.findProperty('service_name', _service.serviceName);
- if (serviceObj) {
- switch (serviceObj.service_name) {
- case 'HDFS':
- this.loadHDFS(serviceObj);
- break;
- case 'MAPREDUCE':
- this.loadMapReduce(serviceObj);
- break;
- case 'HIVE':
- this.loadHive(serviceObj);
- break;
- case 'HBASE':
- this.loadHbase(serviceObj);
- break;
- case 'ZOOKEEPER':
- this.loadZk(serviceObj);
- break;
- case 'OOZIE':
- this.loadOozie(serviceObj);
- break;
- case 'NAGIOS':
- this.loadNagios(serviceObj);
- break;
- case 'GANGLIA':
- this.loadGanglia(serviceObj);
- break;
- case 'HCATALOG':
- break;
- default:
- }
- }
- }, this);
- },
- /**
- * load all info about HDFS service
- * @param hdfsObj
- */
- loadHDFS: function (hdfsObj) {
- hdfsObj.get('service_components').forEach(function (_component) {
- switch (_component.get('display_name')) {
- case 'NameNode':
- this.loadNnValue(_component);
- break;
- case 'SecondaryNameNode':
- this.loadSnnValue(_component);
- break;
- case 'DataNodes':
- this.loadDnValue(_component);
- break;
- default:
- }
- }, this);
- //var
- this.get('services').pushObject(hdfsObj);
- },
- loadNnValue: function (nnComponent) {
- var nnHostName = this.get('content.masterComponentHosts').findProperty('display_name', nnComponent.display_name);
- nnComponent.set('component_value', nnHostName.hostName);
- },
- loadSnnValue: function (snnComponent) {
- var snnHostName = this.get('content.masterComponentHosts').findProperty('display_name', 'SNameNode');
- snnComponent.set('component_value', snnHostName.hostName);
- },
- loadDnValue: function (dnComponent) {
- var dnHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'DataNode');
- var totalDnHosts = dnHosts.hosts.length;
- var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName', 'DATANODE').groups.length;
- var groupLabel;
- if (totalGroups == 1) {
- groupLabel = 'group';
- } else {
- groupLabel = 'groups';
- }
- dnComponent.set('component_value', totalDnHosts + ' hosts ' + '(' + totalGroups + ' ' + groupLabel + ')');
- },
- /**
- * Load all info about mapReduce service
- * @param mrObj
- */
- loadMapReduce: function (mrObj) {
- mrObj.get('service_components').forEach(function (_component) {
- switch (_component.get('display_name')) {
- case 'JobTracker':
- this.loadJtValue(_component);
- break;
- case 'TaskTrackers':
- this.loadTtValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(mrObj);
- },
- loadJtValue: function (jtComponent) {
- var jtHostName = this.get('content.masterComponentHosts').findProperty('display_name', jtComponent.display_name);
- jtComponent.set('component_value', jtHostName.hostName);
- },
- loadTtValue: function (ttComponent) {
- var ttHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'TaskTracker');
- var totalTtHosts = ttHosts.hosts.length;
- var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName', 'TASKTRACKER').groups.length;
- var groupLabel;
- if (totalGroups == 1) {
- groupLabel = 'group';
- } else {
- groupLabel = 'groups';
- }
- ttComponent.set('component_value', totalTtHosts + ' hosts ' + '(' + totalGroups + ' ' + groupLabel + ')');
- },
- /**
- * Load all info about Hive service
- * @param hiveObj
- */
- loadHive: function (hiveObj) {
- hiveObj.get('service_components').forEach(function (_component) {
- switch (_component.get('display_name')) {
- case 'Hive Metastore Server':
- this.loadHiveMetaStoreValue(_component);
- break;
- case 'Database':
- this.loadHiveDbValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(hiveObj);
- },
- loadHiveMetaStoreValue: function (metaStoreComponent) {
- var hiveHostName = this.get('content.masterComponentHosts').findProperty('display_name', 'Hive Metastore');
- metaStoreComponent.set('component_value', hiveHostName.hostName);
- },
- loadHiveDbValue: function (dbComponent) {
- var hiveDb = App.db.getServiceConfigProperties().findProperty('name', 'hive_database');
- if (hiveDb.value === 'New PostgreSQL Database') {
- dbComponent.set('component_value', 'PostgreSQL (New Database)');
- } else {
- var db = App.db.getServiceConfigProperties().findProperty('name', 'hive_existing_database');
- dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
- }
- },
- /**
- * Load all info about Hbase
- * @param hbaseObj
- */
- loadHbase: function (hbaseObj) {
- hbaseObj.service_components.forEach(function (_component) {
- switch (_component.display_name) {
- case 'Master':
- this.loadMasterValue(_component);
- break;
- case 'Region Servers':
- this.loadRegionServerValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(hbaseObj);
- },
- loadMasterValue: function (hbaseMaster) {
- var hbaseHostName = this.get('content.masterComponentHosts').findProperty('display_name', 'HBase Master');
- hbaseMaster.set('component_value', hbaseHostName.hostName);
- },
- loadRegionServerValue: function (rsComponent) {
- var rsHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'RegionServer');
- var totalRsHosts = rsHosts.hosts.length;
- var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName', 'HBASE_REGIONSERVER').groups.length;
- var groupLabel;
- if (totalGroups == 1) {
- groupLabel = 'group';
- } else {
- groupLabel = 'groups';
- }
- rsComponent.set('component_value', totalRsHosts + ' hosts ' + '(' + totalGroups + ' ' + groupLabel + ')');
- },
- /**
- * Load all info about ZooKeeper service
- * @param zkObj
- */
- loadZk: function (zkObj) {
- zkObj.get('service_components').forEach(function (_component) {
- switch (_component.get('display_name')) {
- case 'Servers':
- this.loadZkServerValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(zkObj);
- },
- loadZkServerValue: function (serverComponent) {
- var zkHostNames = this.get('content.masterComponentHosts').filterProperty('display_name', 'ZooKeeper').length;
- var hostSuffix;
- if (zkHostNames === 1) {
- hostSuffix = 'host';
- } else {
- hostSuffix = 'hosts';
- }
- serverComponent.set('component_value', zkHostNames + ' ' + hostSuffix);
- },
- /**
- * Load all info about Oozie services
- * @param oozieObj
- */
- loadOozie: function (oozieObj) {
- oozieObj.get('service_components').forEach(function (_component) {
- switch (_component.get('display_name')) {
- case 'Server':
- this.loadOozieServerValue(_component);
- break;
- case 'Database':
- // TODO: uncomment when ready to integrate with Oozie Database other than Derby
- // this.loadOozieDbValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(oozieObj);
- },
- loadOozieServerValue: function (oozieServer) {
- var oozieServerName = this.get('content.masterComponentHosts').findProperty('display_name', 'Oozie Server');
- oozieServer.set('component_value', oozieServerName.hostName);
- },
- loadOozieDbValue: function (dbComponent) {
- var oozieDb = App.db.getServiceConfigProperties().findProperty('name', 'oozie_database');
- if (oozieDb.value === 'New PostgreSQL Database') {
- dbComponent.set('component_value', 'PostgreSQL (New Database)');
- } else {
- var db = App.db.getServiceConfigProperties().findProperty('name', 'oozie_existing_database');
- dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
- }
- },
- /**
- * Load all info about Nagios service
- * @param nagiosObj
- */
- loadNagios: function (nagiosObj) {
- nagiosObj.service_components.forEach(function (_component) {
- switch (_component.display_name) {
- case 'Server':
- this.loadNagiosServerValue(_component);
- break;
- case 'Administrator':
- this.loadNagiosAdminValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(nagiosObj);
- },
- loadNagiosServerValue: function (nagiosServer) {
- var nagiosServerName = this.get('content.masterComponentHosts').findProperty('display_name', 'Nagios Server');
- nagiosServer.set('component_value', nagiosServerName.hostName);
- },
- loadNagiosAdminValue: function (nagiosAdmin) {
- var config = this.get('content.serviceConfigProperties');
- var adminLoginName = config.findProperty('name', 'nagios_web_login');
- var adminEmail = config.findProperty('name', 'nagios_contact');
- nagiosAdmin.set('component_value', adminLoginName.value + ' / (' + adminEmail.value + ')');
- },
- /**
- * Load all info about ganglia
- * @param gangliaObj
- */
- loadGanglia: function (gangliaObj) {
- gangliaObj.get('service_components').forEach(function (_component) {
- switch (_component.get('display_name')) {
- case 'Server':
- this.loadGangliaServerValue(_component);
- break;
- default:
- }
- }, this);
- this.get('services').pushObject(gangliaObj);
- },
- loadGangliaServerValue: function (gangliaServer) {
- var gangliaServerName = this.get('content.masterComponentHosts').findProperty('display_name', 'Ganglia Collector');
- gangliaServer.set('component_value', gangliaServerName.hostName);
- },
- /**
- * Onclick handler for <code>next</code> button
- */
- submit: function () {
- if (this.get('isSubmitDisabled')) {
- return;
- }
- this.set('isSubmitDisabled', true);
- if (App.testMode || !this.get('content.cluster.requestId')) {
- this.createCluster();
- this.createSelectedServices();
- this.setAmbariUIDb();
- this.createConfigurations();
- this.applyCreatedConfToServices();
- this.createComponents();
- this.registerHostsToCluster();
- this.createAllHostComponents();
- this.applyCreatedConfToSlaveGroups();
- this.ajaxQueueFinished = function(){
- console.log('everything is loaded')
- App.router.send('next');
- };
- this.doNextAjaxCall();
- } else {
- App.router.send('next');
- }
- },
- setAmbariUIDb: function () {
- var dbContent = this.get('content.slaveGroupProperties');
- var slaveComponentConfig = this.get("slaveComponentConfig");
- this.persistKeyValues(slaveComponentConfig.version, dbContent);
- this.persistKeyValues('current_version',slaveComponentConfig.version);
- },
- persistKeyValues: function (key, value) {
- var str = "{ '" + key + "' : '" + JSON.stringify(value) + "'}";
- var obj = eval("(" + str + ")");
- this.ajax({
- type: "POST",
- url: App.apiPrefix + '/persist',
- data: JSON.stringify(obj),
- beforeSend: function () {
- console.log('BeforeSend: persistKeyValues', obj);
- }
- });
- },
- clusterName: function () {
- return this.get('content.cluster.name');
- }.property('content.cluster.name'),
- /**
- * The following create* functions are called upon submitting Step 8.
- */
- createCluster: function () {
- if (this.get('content.isWizard')) {
- return false;
- }
- var clusterName = this.get('clusterName');
- var url = App.apiPrefix + '/clusters/' + clusterName;
- var stackVersion = (App.db.getSoftRepo().repoType == 'local') ? App.defaultLocalStackVersion : App.defaultStackVersion;
- this.ajax({
- type: 'POST',
- url: url,
- data: JSON.stringify({ "Clusters": {"version": stackVersion }}),
- beforeSend: function () {
- console.log("BeforeSend: createCluster for " + clusterName);
- }
- });
- },
- createSelectedServices: function () {
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services';
- var data = this.createServiceData();
- var httpMethod = 'POST';
- this.ajax({
- type: httpMethod,
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log('BeforeSend: createSelectedServices ', data);
- }
- });
- },
- createServiceData: function () {
- var services = this.get('selectedServices').mapProperty('serviceName');
- var data = [];
- services.forEach(function (_service) {
- data.pushObject({"ServiceInfo": { "service_name": _service }});
- }, this);
- return data;
- },
- createComponents: function () {
- var serviceComponents = require('data/service_components');
- var services = this.get('selectedServices').mapProperty('serviceName');
- services.forEach(function (_service) {
- var components = serviceComponents.filterProperty('service_name', _service);
- var componentsData = components.map(function (_component) {
- return { "ServiceComponentInfo": { "component_name": _component.component_name } };
- });
- // Service must be specified in terms of a query for creating multiple components at the same time.
- // See AMBARI-1018.
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services?ServiceInfo/service_name=' + _service;
- var data = {
- "components": componentsData
- }
- this.ajax({
- type: 'POST',
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log('BeforeSend: createComponents for ' + _service, componentsData);
- }
- });
- }, this);
- },
- registerHostsToCluster: function () {
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts';
- var data = this.createRegisterHostData();
- if (data.length == 0) {
- return;
- }
- this.ajax({
- type: 'POST',
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log('BeforeSend: registerHostsToCluster', data);
- }
- });
- },
- createRegisterHostData: function () {
- return this.getRegisteredHosts().map(function (host) {
- if (!host.isInstalled) {
- return {"Hosts": { "host_name": host.hostName}};
- }
- });
- },
- // TODO: review the code for add hosts / add services scenarios...
- createAllHostComponents: function () {
- var masterHosts = this.get('content.masterComponentHosts');
- var slaveHosts = this.get('content.slaveComponentHosts');
- var clients = this.get('content.clients');
- var clientHosts = slaveHosts.filterProperty('componentName', "CLIENT").objectAt(0).hosts;
- // note: masterHosts has 'component' vs slaveHosts has 'componentName'
- var masterComponents = masterHosts.mapProperty('component').uniq();
- masterComponents.forEach(function (component) {
- var hostNames = masterHosts.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
- this.registerHostsToComponent(hostNames, component);
- }, this);
- slaveHosts.forEach(function (_slave) {
- if (_slave.componentName !== 'CLIENT') {
- var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
- this.registerHostsToComponent(hostNames, _slave.componentName);
- } else {
- this.get('content.clients').forEach(function (_client) {
- if (!_client.isInstalled) {
- var hostNames = clientHosts.mapProperty('hostName').splice(0);
- switch (_client.component_name) {
- case 'HDFS_CLIENT':
- // install HDFS_CLIENT on HBASE_MASTER and HBASE_REGIONSERVER hosts
- masterHosts.filterProperty('component', 'HBASE_MASTER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
- hostNames.pushObject(_masterHost.hostName);
- }, this);
- masterHosts.filterProperty('component', 'HBASE_REGIONSERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
- hostNames.pushObject(_masterHost.hostName);
- }, this);
- break;
- case 'MAPREDUCE_CLIENT':
- // install MAPREDUCE_CLIENT on HIVE_SERVER and OOZIE_SERVER hosts
- masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
- hostNames.pushObject(_masterHost.hostName);
- }, this);
- masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
- hostNames.pushObject(_masterHost.hostName);
- }, this);
- break;
- }
- hostNames = hostNames.uniq();
- this.registerHostsToComponent(hostNames, _client.component_name);
- }
- }, this);
- }
- }, this);
- // add Ganglia Monitor (Slave) to all hosts if Ganglia service is selected
- if (this.get('selectedServices').someProperty('serviceName', 'GANGLIA')) {
- var hosts = this.getRegisteredHosts().filterProperty('isInstalled', false);
- this.registerHostsToComponent(hosts.mapProperty('hostName'), 'GANGLIA_MONITOR');
- }
- },
- registerHostsToComponent: function (hostNames, componentName) {
- if (hostNames.length == 0) {
- return;
- }
- console.log('registering ' + componentName + ' to ' + JSON.stringify(hostNames));
- // currently we are specifying the predicate as a query string.
- // this can hit a ~4000-character limit in Jetty server.
- // chunk to multiple calls if needed
- // var hostsPredicate = hostNames.map(function (hostName) {
- // return 'Hosts/host_name=' + hostName;
- // }).join('|');
- var queryStrArr = [];
- var queryStr = '';
- hostNames.forEach(function (hostName) {
- queryStr += 'Hosts/host_name=' + hostName + '|';
- if (queryStr.length > 3500) {
- queryStrArr.push(queryStr.slice(0, -1));
- queryStr = '';
- }
- });
- if (queryStr.length > 0) {
- queryStrArr.push(queryStr.slice(0, -1));
- }
- queryStrArr.forEach(function (queryStr) {
- // console.log('creating host components for ' + queryStr);
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + queryStr;
- var data = {
- "host_components": [
- {
- "HostRoles": {
- "component_name": componentName
- }
- }
- ]
- };
- this.ajax({
- type: 'POST',
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log('BeforeSend: registerHostsToComponent for ' + queryStr + ' and component ' + componentName);
- }
- });
- }, this);
- },
- createConfigurations: function () {
- var selectedServices = this.get('selectedServices');
- if (!this.get('content.isWizard')) {
- this.createConfigSiteForService(this.createGlobalSiteObj());
- this.createGlobalSitePerSlaveGroup();
- this.createConfigSiteForService(this.createCoreSiteObj());
- this.createConfigSiteForService(this.createHdfsSiteObj());
- this.createHdfsSitePerSlaveGroup('HDFS');
- }
- if (selectedServices.someProperty('serviceName', 'MAPREDUCE')) {
- this.createConfigSiteForService(this.createMrSiteObj());
- this.createMrSitePerSlaveGroup('MAPREDUCE');
- }
- if (selectedServices.someProperty('serviceName', 'HBASE')) {
- this.createConfigSiteForService(this.createHbaseSiteObj());
- this.createHbaseSitePerSlaveGroup('HBASE');
- }
- if (selectedServices.someProperty('serviceName', 'OOZIE')) {
- this.createConfigSiteForService(this.createOozieSiteObj('OOZIE'));
- }
- if (selectedServices.someProperty('serviceName', 'HIVE')) {
- this.createConfigSiteForService(this.createHiveSiteObj('HIVE'));
- }
- },
- createConfigSiteForService: function (data) {
- console.log("Inside createConfigSiteForService");
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/configurations';
- this.ajax({
- type: 'POST',
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log("BeforeSend: createConfigSiteForService for " + data.type);
- }
- });
- },
- createGlobalSiteObj: function () {
- var globalSiteProperties = {};
- this.get('globals').filterProperty('domain', 'global').forEach(function (_globalSiteObj) {
- // do not pass any globals whose name ends with _host or _hosts
- if (!/_hosts?$/.test(_globalSiteObj.name)) {
- // append "m" to JVM memory options
- var value = null;
- if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name)) {
- value = _globalSiteObj.value + "m";
- globalSiteProperties[_globalSiteObj.name] = value;
- } else {
- globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value;
- }
- console.log("STEP8: name of the global property is: " + _globalSiteObj.name);
- console.log("STEP8: value of the global property is: " + _globalSiteObj.value);
- }
- }, this);
- return {"type": "global", "tag": "version1", "properties": globalSiteProperties};
- },
- createGlobalSitePerSlaveGroup: function () {
- this.get('slaveComponentConfig.components').forEach(function (_component) {
- _component.groups.forEach(function (_group) {
- var globalSiteProperties = {};
- var properties = _group.properties;
- properties.forEach(function (_property) {
- if (!/_hosts?$/.test(_property.name)) {
- // append "m" to JVM memory options
- var value = null;
- if (/_heapsize|_newsize|_maxnewsize$/.test(_property.name)) {
- value = _property.value + "m";
- globalSiteProperties[_property.name] = value;
- } else {
- globalSiteProperties[_property.name] = _property.storeValue;
- }
- console.log("STEP8: name of the global property is: " + _property.name);
- console.log("STEP8: value of the global property is: " + _property.storeValue);
- }
- }, this);
- var config = _group.configVersion.config;
- for (var index in config) {
- if (index === 'datanode-global' || index === 'tasktracker-global' || index === 'regionserver-global') {
- var data = {"type": index, "tag": config[index], "properties": globalSiteProperties};
- this.createConfigSiteForService(data);
- }
- }
- }, this);
- }, this);
- },
- createCoreSiteObj: function () {
- var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml');
- var coreSiteProperties = {};
- // hadoop.proxyuser.oozie.hosts needs to be skipped if oozie is not selected
- var isOozieSelected = this.get('selectedServices').someProperty('serviceName', 'OOZIE');
- coreSiteObj.forEach(function (_coreSiteObj) {
- if (isOozieSelected || _coreSiteObj.name != 'hadoop.proxyuser.oozie.hosts') {
- coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
- }
- console.log("STEP*: name of the property is: " + _coreSiteObj.name);
- console.log("STEP8: value of the property is: " + _coreSiteObj.value);
- }, this);
- return {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
- },
- createHdfsSiteObj: function () {
- var hdfsSiteObj = this.get('configs').filterProperty('filename', 'hdfs-site.xml');
- var hdfsProperties = {};
- hdfsSiteObj.forEach(function (_configProperty) {
- hdfsProperties[_configProperty.name] = _configProperty.value;
- console.log("STEP*: name of the property is: " + _configProperty.name);
- console.log("STEP8: value of the property is: " + _configProperty.value);
- }, this);
- return {"type": "hdfs-site", "tag": "version1", "properties": hdfsProperties };
- },
- createHdfsSitePerSlaveGroup: function (serviceName) {
- var hdfsSite = this.createHdfsSiteObj();
- var component = this.get('slaveComponentConfig.components').findProperty('serviceName', serviceName);
- component.groups.forEach(function (_group) {
- var siteProperties = hdfsSite.properties;
- _group.properties.forEach(function (_property) {
- this.get('configMapping').forEach(function (_config) {
- if (_config.templateName.contains(_property.name)) {
- this.get('globals').findProperty('name', _property.name).value = _property.storeValue;
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- if (siteProperties[_config.name]) {
- siteProperties[_config.name] = value;
- }
- }
- }, this);
- }, this);
- var data = {"type": hdfsSite.type, "tag": _group.siteVersion, "properties": siteProperties};
- console.log("The value of globalConfig is: " + JSON.stringify(siteProperties));
- this.createConfigSiteForService(data);
- }, this);
- },
- createMrSiteObj: function () {
- var configs = this.get('configs').filterProperty('filename', 'mapred-site.xml');
- var mrProperties = {};
- configs.forEach(function (_configProperty) {
- mrProperties[_configProperty.name] = _configProperty.value;
- console.log("STEP*: name of the property is: " + _configProperty.name);
- console.log("STEP8: value of the property is: " + _configProperty.value);
- }, this);
- return {type: 'mapred-site', tag: 'version1', properties: mrProperties};
- },
- createMrSitePerSlaveGroup: function (serviceName) {
- var mrSite = this.createMrSiteObj();
- var component = this.get('slaveComponentConfig.components').findProperty('serviceName', serviceName);
- component.groups.forEach(function (_group) {
- var siteProperties = mrSite.properties;
- _group.properties.forEach(function (_property) {
- this.get('configMapping').forEach(function (_config) {
- if (_config.templateName.contains(_property.name)) {
- this.get('globals').findProperty('name', _property.name).value = _property.storeValue;
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- if (siteProperties[_config.name]) {
- siteProperties[_config.name] = value;
- }
- }
- }, this);
- }, this);
- var data = {"type": mrSite.type, "tag": _group.siteVersion, "properties": siteProperties};
- this.createConfigSiteForService(data);
- }, this);
- },
- createHbaseSiteObj: function () {
- var configs = this.get('configs').filterProperty('filename', 'hbase-site.xml');
- var hbaseProperties = {};
- configs.forEach(function (_configProperty) {
- hbaseProperties[_configProperty.name] = _configProperty.value;
- }, this);
- var masterHosts = App.db.getMasterComponentHosts();
- // TODO: should filter on "component" but that gives unexpected results
- var zkServers = masterHosts.filterProperty('display_name', 'ZooKeeper').mapProperty('hostName');
- hbaseProperties['hbase.zookeeper.quorum'] = zkServers.join(',');
- return {type: 'hbase-site', tag: 'version1', properties: hbaseProperties};
- },
- createHbaseSitePerSlaveGroup: function (serviceName) {
- var hbaseSite = this.createHbaseSiteObj();
- var component = this.get('slaveComponentConfig.components').findProperty('serviceName', serviceName);
- component.groups.forEach(function (_group) {
- var siteProperties = hbaseSite.properties;
- _group.properties.forEach(function (_property) {
- this.get('configMapping').forEach(function (_config) {
- if (_config.templateName.contains(_property.name)) {
- this.get('globals').findProperty('name', _property.name).value = _property.storeValue;
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- if (siteProperties[_config.name]) {
- siteProperties[_config.name] = value;
- }
- }
- }, this);
- }, this);
- var data = {"type": hbaseSite.type, "tag": _group.siteVersion, "properties": siteProperties};
- this.createConfigSiteForService(data);
- }, this);
- },
- createOozieSiteObj: function (serviceName) {
- var configs = this.get('configs').filterProperty('filename', 'oozie-site.xml');
- var oozieProperties = {};
- configs.forEach(function (_configProperty) {
- oozieProperties[_configProperty.name] = _configProperty.value;
- }, this);
- // var baseUrl = oozieProperties['oozie.base.url'];
- // oozieProperties = {
- // "oozie.service.JPAService.jdbc.password": " ", "oozie.db.schema.name": "oozie", "oozie.service.JPAService.jdbc.url": "jdbc:derby:/var/data/oozie/oozie-db;create=true", "oozie.service.JPAService.jdbc.driver": "org.apache.derby.jdbc.EmbeddedDriver", "oozie.service.WorkflowAppService.system.libpath": "/user/oozie/share/lib", "oozie.service.JPAService.jdbc.username": "sa", "oozie.service.SchemaService.wf.ext.schemas": "shell-action-0.1.xsd,email-action-0.1.xsd,hive-action-0.2.xsd,sqoop-action-0.2.xsd,ssh-action-0.1.xsd,distcp-action-0.1.xsd", "oozie.service.JPAService.create.db.schema": "false", "use.system.libpath.for.mapreduce.and.pig.jobs": "false", "oozie.service.ActionService.executor.ext.classes": "org.apache.oozie.action.email.EmailActionExecutor,org.apache.oozie.action.hadoop.HiveActionExecutor,org.apache.oozie.action.hadoop.ShellActionExecutor,org.apache.oozie.action.hadoop.SqoopActionExecutor,org.apache.oozie.action.hadoop.DistcpActionExecutor", "oozie.service.HadoopAccessorService.hadoop.configurations": "*=/etc/hadoop/conf"
- // };
- // oozieProperties['oozie.base.url'] = baseUrl;
- return {type: 'oozie-site', tag: 'version1', properties: oozieProperties};
- },
- createHiveSiteObj: function (serviceName) {
- var configs = this.get('configs').filterProperty('filename', 'hive-site.xml');
- var hiveProperties = {};
- configs.forEach(function (_configProperty) {
- hiveProperties[_configProperty.name] = _configProperty.value;
- }, this);
- return {type: 'hive-site', tag: 'version1', properties: hiveProperties};
- },
- applyCreatedConfToServices: function () {
- var services = this.get('selectedServices').mapProperty('serviceName');
- services.forEach(function (_service) {
- var data = this.getConfigForService(_service);
- this.applyCreatedConfToService(_service, 'PUT', data);
- }, this);
- },
- applyCreatedConfToService: function (service, httpMethod, data) {
- console.log("Inside applyCreatedConfToService");
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services/' + service;
- this.ajax({
- type: httpMethod,
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log("BeforeSend: applyCreatedConfToService for " + service);
- }
- });
- },
- applyCreatedConfToSlaveGroups: function () {
- this.get('slaveComponentConfig.components').forEach(function (_component) {
- _component.groups.forEach(function (_group) {
- var aggregatedHostNames = '';
- _group.hostNames.forEach(function (_hostName, index) {
- aggregatedHostNames += 'HostRoles/host_name=' + _hostName;
- if (index !== _group.hostNames.length-1) {
- aggregatedHostNames += '|';
- }
- }, this);
- console.log("The aggregated hostNames value is: " + aggregatedHostNames);
- this.applyCreatedConfToSlaveGroup(aggregatedHostNames, 'PUT', _group.configVersion,_group.groupName);
- }, this);
- }, this);
- },
- applyCreatedConfToSlaveGroup: function (aggregatedHostNames, httpMethod, data, groupName) {
- console.log("Inside applyCreatedConfToHost");
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/host_components?' + aggregatedHostNames;
- this.ajax({
- type: httpMethod,
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log("BeforeSend: applyCreatedConfToSlaveGroup for group: " + groupName);
- }
- });
- },
- getConfigForService: function (serviceName) {
- switch (serviceName) {
- case 'HDFS':
- return {config: {'global': 'version1', 'core-site': 'version1', 'hdfs-site': 'version1'}};
- case 'MAPREDUCE':
- return {config: {'global': 'version1', 'core-site': 'version1', 'mapred-site': 'version1'}};
- case 'HBASE':
- return {config: {'global': 'version1', 'core-site': 'version1', 'hbase-site': 'version1'}};
- case 'OOZIE':
- return {config: {'global': 'version1', 'core-site': 'version1', 'oozie-site': 'version1'}};
- default:
- return {config: {'global': 'version1'}};
- }
- },
- ajaxQueue: [],
- ajaxQueueFinished: function () {
- //do something
- },
- doNextAjaxCall: function () {
- if (this.get('ajaxBusy')) {
- return;
- }
- var queue = this.get('ajaxQueue');
- if (!queue.length) {
- this.ajaxQueueFinished();
- return;
- }
- var first = queue[0];
- this.set('ajaxQueue', queue.slice(1));
- this.set('ajaxBusy', true);
- console.log('AJAX send ' + first.url);
- $.ajax(first);
- },
- /**
- * We need to do a lot of ajax calls(about 10 or more) async in special order.
- * To do this i generate array of ajax objects and then send requests step by step.
- * All ajax objects are stored in <code>ajaxQueue</code>
- * @param params
- */
- ajax: function(params){
- if(App.testMode) return;
- var self = this;
- params = jQuery.extend({
- async: true,
- dataType: 'text',
- statusCode: require('data/statusCodes'),
- timeout: App.timeout,
- error: function (request, ajaxOptions, error) {
- console.log('Step8: In Error ');
- console.log('Step8: Error message is: ' + request.responseText);
- },
- success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep8 -> In success function");
- console.log("TRACE: STep8 -> value of the url is: " + params.url);
- console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
- }
- }, params);
- var success = params.success;
- var error = params.error;
- params.success = function () {
- if (success) {
- success();
- }
- ;
- self.set('ajaxBusy', false);
- self.doNextAjaxCall();
- }
- params.error = function () {
- if (error) {
- error();
- }
- ;
- self.set('ajaxBusy', false);
- self.doNextAjaxCall();
- }
- this.get('ajaxQueue').pushObject(params);
- }
- })
-
-
|