You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/11/07 05:00:25 UTC
svn commit: r1406442 [1/4] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-web/ ambari-web/app/ ambari-web/app/assets/data/apps/
ambari-web/app/controllers/ ambari-web/app/controllers/installer/
ambari-web/app/controllers/main/ ambari-web/app/con...
Author: yusaku
Date: Wed Nov 7 04:00:21 2012
New Revision: 1406442
URL: http://svn.apache.org/viewvc?rev=1406442&view=rev
Log:
AMBARI-977. Refactor Wizard and Cluster Management code. (yusaku)
Added:
incubator/ambari/branches/AMBARI-666/ambari-web/app/assets/data/apps/
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/item_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_1.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_2.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_3.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_4.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_5.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_6.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_7.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_8.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9PolledData/pollData_9.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/apps/list_row.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/add.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/background_operations_popup.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/menu_item.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/jquery.unique.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/quick_view_link_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/runs/item_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/runs/jobs/bar_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/runs/jobs/dag_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/runs/jobs/menu_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/runs/jobs_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/runs_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/add_view.js
Removed:
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step2_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step3_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9_pollData_1.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/mock/step9_pollData_2.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step2.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step2ManualInstallPopup.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step3.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step3HostLogPopup.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step2_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step3_view.js
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step3_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step5_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step6_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step9_controller.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/config_properties.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/service_components.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/data/statusCodes.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/models/host.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/models/job.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/models/service_config.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/apps.less
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/apps.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hbase.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hdfs.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/item.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step3.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step4.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step5.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/wizard/step9.hbs
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/data_table.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/date.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/db.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host/summary.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/metrics/mapreduce/rpc.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/item.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/menu.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step1_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step2_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step3_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step5_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/app/views/wizard/step9_view.js
incubator/ambari/branches/AMBARI-666/ambari-web/pom.xml
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step1_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step2_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step3_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step4_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step5_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step6_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step7_test.js
incubator/ambari/branches/AMBARI-666/ambari-web/test/installer/step9_test.js
Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Nov 7 04:00:21 2012
@@ -362,6 +362,8 @@ AMBARI-666 branch (unreleased changes)
IMPROVEMENTS
+ AMBARI-977. Refactor Wizard and Cluster Management code. (yusaku)
+
AMBARI-941. More refactoring of Wizards in Ambari Web. (yusaku)
AMBARI-919. Partial refactoring and consolidation of code for various
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers.js Wed Nov 7 04:00:21 2012
@@ -22,8 +22,6 @@
require('controllers/application');
require('controllers/login_controller');
require('controllers/installer');
-require('controllers/installer/step2_controller');
-require('controllers/installer/step3_controller');
require('controllers/main');
require('controllers/main/admin');
require('controllers/main/admin/item');
@@ -37,6 +35,7 @@ require('controllers/main/service/info/s
require('controllers/main/service/info/metrics');
require('controllers/main/service/info/configs');
require('controllers/main/service/info/audit');
+require('controllers/main/service/add_controller');
require('controllers/main/alert');
require('controllers/main/host');
require('controllers/main/host/details');
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer.js Wed Nov 7 04:00:21 2012
@@ -63,6 +63,12 @@ App.InstallerController = Em.Controller.
}
}.property('App.router.loginController.loginName'),
+ /**
+ * Set current step to new value.
+ * Method moved from App.router.setInstallerCurrentStep
+ * @param currentStep
+ * @param completed
+ */
currentStep: function () {
return App.get('router').getInstallerCurrentStep();
}.property(),
@@ -210,7 +216,7 @@ App.InstallerController = Em.Controller.
slaveComponentHosts: null,
hostSlaveComponents: null,
masterComponentHosts: null,
- hostToMasterComponent : null,
+ hostToMasterComponent: null,
serviceConfigProperties: null
}),
@@ -231,7 +237,7 @@ App.InstallerController = Em.Controller.
/**
- * Save all info about claster to model
+ * Save all info about cluster to model
* @param stepController Step1WizardController
*/
saveClusterInfo: function (stepController) {
@@ -239,25 +245,33 @@ App.InstallerController = Em.Controller.
var clusterStatus = {
status: cluster.status,
isCompleted: cluster.isCompleted
- }
+ };
App.db.setClusterName(cluster.name);
App.db.setClusterStatus(clusterStatus);
console.log("InstallerController:saveClusterInfo: saved data ", cluster);
//probably next line is extra work - need to check it
- this.set('content.cluster', cluster);
+ //this.set('content.cluster', cluster);
+ },
+
+ /**
+ * save status of the cluster. This is called from step8 and step9 to persist install and start requestId
+ * @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
+ */
+ saveClusterStatus: function (clusterStatus) {
+ this.set('content.cluster', clusterStatus);
+ App.db.setClusterStatus(clusterStatus);
},
/**
* Temporary function for wizardStep9, before back-end integration
*/
setInfoForStep9: function () {
- App.db.setClusterStatus({status: 'pending', isCompleted: false});
var hostInfo = App.db.getHosts();
for (var index in hostInfo) {
hostInfo[index].status = "pending";
- hostInfo[index].message = 'Information';
+ hostInfo[index].message = 'Waiting';
hostInfo[index].progress = '0';
}
App.db.setHosts(hostInfo);
@@ -368,7 +382,7 @@ App.InstallerController = Em.Controller.
*/
saveConfirmedHosts: function (stepController) {
var hostInfo = {};
- stepController.get('content').forEach(function (_host) {
+ stepController.get('content.hostsInfo').forEach(function (_host) {
hostInfo[_host.name] = {
name: _host.name,
cpu: _host.cpu,
@@ -461,11 +475,13 @@ App.InstallerController = Em.Controller.
*/
saveMasterComponentHosts: function (stepController) {
var obj = stepController.get('selectedServicesMasters');
+ console.log("installerController.selectedServicesMasters: saved hosts ", stepController.get('selectedServicesMasters'));
var masterComponentHosts = [];
obj.forEach(function (_component) {
masterComponentHosts.push({
- component: _component.component_name,
- hostName: _component.selectedHost
+ display_name: _component.get('display_name'),
+ component: _component.get('component_name'),
+ hostName: _component.get('selectedHost')
});
});
@@ -598,7 +614,8 @@ App.InstallerController = Em.Controller.
_content.get('configs').forEach(function (_configProperties) {
var configProperty = {
name: _configProperties.get('name'),
- value: _configProperties.get('value')
+ value: _configProperties.get('value'),
+ service: _configProperties.get('serviceName')
};
serviceConfigProperties.push(configProperty);
}, this);
@@ -621,7 +638,7 @@ App.InstallerController = Em.Controller.
/**
* Load information about hosts with clients components
*/
- loadClients: function(){
+ loadClients: function () {
var clients = App.db.getClientsForSelectedServices();
this.set('content.clients', clients);
console.log("InstallerController.loadClients: loaded list ", clients);
@@ -631,11 +648,11 @@ App.InstallerController = Em.Controller.
* Generate clients list for selected services and save it to model
* @param stepController step4WizardController
*/
- saveClients: function(stepController){
+ saveClients: function (stepController) {
var clients = [];
var serviceComponents = require('data/service_components');
- stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
+ stepController.get('content').filterProperty('isSelected', true).forEach(function (_service) {
var client = serviceComponents.filterProperty('service_name', _service.serviceName).findProperty('isClient', true);
if (client) {
clients.pushObject({
@@ -653,55 +670,94 @@ App.InstallerController = Em.Controller.
/**
* Load HostToMasterComponent array
*/
- loadHostToMasterComponent: function(){
+ loadHostToMasterComponent: function () {
var list = App.db.getHostToMasterComponent();
this.set('content.hostToMasterComponent', list);
console.log("AddHostController.loadHostToMasterComponent: loaded list ", list);
},
/**
- * List of statuses, what data is currently loaded
- */
- isStepLoaded: {},
-
- /**
- * Call specified function only once
- */
- callLoadFuncOnce: function (name) {
- if (!this.isStepLoaded[name]) {
- this[name]();
- this.isStepLoaded[name] = true;
- }
- },
-
- /**
* Load data for all steps until <code>current step</code>
*/
loadAllPriorSteps: function () {
var step = this.get('currentStep');
switch (step) {
case '9':
- //need to call it every time since we preload data in setInfoForStep9
- this.loadClusterInfo();
case '8':
- this.loadClusterInfo();
case '7':
- this.callLoadFuncOnce('loadServiceConfigProperties');
+ this.loadServiceConfigProperties();
case '6':
- this.callLoadFuncOnce('loadMasterComponentHosts');
- this.callLoadFuncOnce('loadSlaveComponentHosts');
- this.callLoadFuncOnce('loadClients');
- this.callLoadFuncOnce('loadHostToMasterComponent');
+ this.loadClients();
case '5':
- this.callLoadFuncOnce('loadConfirmedHosts');
+ this.loadMasterComponentHosts();
+ this.loadSlaveComponentHosts();
+ this.loadHostToMasterComponent();
+ this.loadConfirmedHosts();
case '4':
- this.callLoadFuncOnce('loadServices');
+ this.loadServices();
+ this.loadClients();
case '3':
+ this.loadConfirmedHosts();
case '2':
- this.callLoadFuncOnce('loadInstallOptions');
+ this.loadInstallOptions();
case '1':
- this.callLoadFuncOnce('loadClusterInfo');
+ this.loadClusterInfo();
}
+ },
+
+ /**
+ * Generate clients list for selected services and save it to model
+ * @param stepController step8WizardController or step9WizardController
+ */
+ installServices: function () {
+ var self = this;
+ var clusterName = this.get('content.cluster.name');
+ var url = '/api/clusters/' + clusterName + '/services?state=INIT';
+ var data = '{"ServiceInfo": {"state": "INSTALLED"}}';
+ $.ajax({
+ type: 'PUT',
+ url: url,
+ data: data,
+ async: false,
+ dataType: 'text',
+ timeout: 5000,
+ success: function (data) {
+ var jsonData = jQuery.parseJSON(data);
+ console.log("TRACE: STep8 -> In success function for the installService call");
+ console.log("TRACE: STep8 -> value of the url is: " + url);
+ if (jsonData) {
+ var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
+ console.log('requestId is: ' + requestId);
+ var clusterStatus = {
+ status: 'PENDING',
+ requestId: requestId,
+ isInstallError: false,
+ isCompleted: false
+ };
+ self.saveClusterStatus(clusterStatus);
+ } else {
+ console.log('ERROR: Error occurred in parsing JSON data');
+ }
+ },
+
+ error: function (request, ajaxOptions, error) {
+ console.log("TRACE: STep8 -> In error function for the installService call");
+ console.log("TRACE: STep8 -> value of the url is: " + url);
+ console.log("TRACE: STep8 -> error code status is: " + request.status);
+ console.log('Step8: Error message is: ' + request.responseText);
+ var clusterStatus = {
+ status: 'PENDING',
+ isInstallError: true,
+ isCompleted: false
+ };
+ self.saveClusterStatus(clusterStatus);
+ },
+
+ statusCode: require('data/statusCodes')
+ });
+
}
+
+
});
\ No newline at end of file
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/item_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/item_controller.js?rev=1406442&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/item_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/item_controller.js Wed Nov 7 04:00:21 2012
@@ -0,0 +1,24 @@
+/**
+ * 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.MainAppsRunsItemController = Em.Controller.extend({
+ name:'mainAppsRunsItemController',
+ content: null
+})
\ No newline at end of file
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js?rev=1406442&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js Wed Nov 7 04:00:21 2012
@@ -0,0 +1,29 @@
+/**
+ * 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.MainAppsRunsJobsBarController = Em.ArrayController.extend({
+ name:'mainAppsRunsJobsBarController',
+ job: null,
+ activeJobId: null,
+ selectJob: function(event) {
+ this.set('job', event.context);
+ this.set('activeJobId', event.context.get('jobId'));
+ }
+})
\ No newline at end of file
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js?rev=1406442&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js Wed Nov 7 04:00:21 2012
@@ -0,0 +1,23 @@
+/**
+ * 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.MainJobsAppsRunsDagController = Em.ArrayController.extend({
+ name:'mainJobsAppsRunsDagController'
+})
\ No newline at end of file
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs_controller.js?rev=1406442&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs/jobs_controller.js Wed Nov 7 04:00:21 2012
@@ -0,0 +1,24 @@
+/**
+ * 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.MainAppsRunsJobsController = Em.ArrayController.extend({
+ name:'mainAppsRunsJobsController',
+ content: null
+})
\ No newline at end of file
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs_controller.js?rev=1406442&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps/runs_controller.js Wed Nov 7 04:00:21 2012
@@ -0,0 +1,30 @@
+/**
+ * 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.MainAppsRunsController = Em.ArrayController.extend({
+ name:'mainAppsRunsController',
+ content:null,
+ routeHome:function(){
+ App.router.get('mainAppsController').get('routeHome')();
+ },
+ routeApps: function(){
+ App.router.transitionTo('main.apps');
+ }
+})
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps_controller.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/apps_controller.js Wed Nov 7 04:00:21 2012
@@ -17,6 +17,7 @@
*/
var App = require('app');
+require('utils/jquery.unique');
App.MainAppsController = Em.ArrayController.extend({
name:'mainAppsController',
@@ -28,5 +29,10 @@ App.MainAppsController = Em.ArrayControl
$.each(view._childViews, function () {
this.set('active', this.get('content.routing') == 'dashboard' ? "active" : "");
});
- }
+ },
+ /**
+ * Row, which is expanded at the moment, will update this property.
+ * Used to collapse rows, which are not used at the moment
+ */
+ expandedRowId : null
})
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host.js Wed Nov 7 04:00:21 2012
@@ -42,11 +42,12 @@ App.MainHostController = Em.ArrayControl
}.property('sortingAsc'),
isDisabled:true,
- checkRemoved: function(host_id) {
+ checkRemoved:function (host_id) {
var hosts = this.get('content');
var selectedHosts = hosts.filterProperty('id', host_id);
this.get('fullContent').removeObjects(selectedHosts);
},
+
masterComponents:function () {
var components = [];
this.get('componentsForFilter').forEach(function (component) {
@@ -114,11 +115,9 @@ App.MainHostController = Em.ArrayControl
filterByComponentsIds:function () {
var componentsIds = this.checkedComponentsIds();
this.set('filters.components', componentsIds);
- this.get('componentsForFilter').forEach(function(component) {
- if (componentsIds.indexOf(component.get('id')) != -1){
- component.set('isChecked', false);
- } else component.set('isChecked', true);
- });
+
+// component.set('isChecked', component.get('id') != -1);
+
this.changeContent();
},
@@ -170,15 +169,16 @@ App.MainHostController = Em.ArrayControl
this.get('fullContent').forEach(function (item) {
if (filters.length) {
var inFilters = false;
- item.get('components').forEach(function(component) {
- if (filters.indexOf(component.get('id')) == -1){
+ item.get('components').forEach(function (component) {
+ if (filters.indexOf(component.get('id')) != -1) {
inFilters = true;
}
});
+
+
if (inFilters) {
items.push(item);
}
-
} else {
items.push(item);
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/add_controller.js Wed Nov 7 04:00:21 2012
@@ -47,13 +47,6 @@ App.AddHostController = Em.Controller.ex
}),
/**
- * List of statuses, what data is currently loaded
- */
- isStepLoaded: {
-
- },
-
- /**
* Used for hiding back button in wizard
*/
hideBackButton: true,
@@ -93,6 +86,8 @@ App.AddHostController = Em.Controller.ex
return App.get('router').getWizardCurrentStep('addHost');
}.property(),
+ clusters: null,
+
/**
* Set current step to new value.
* Method moved from App.router.setInstallerCurrentStep
@@ -224,14 +219,22 @@ App.AddHostController = Em.Controller.ex
},
/**
+ * save status of the cluster. This is called from step8 and step9 to persist install and start requestId
+ * @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
+ */
+ saveClusterStatus: function (clusterStatus) {
+ this.set('content.cluster', clusterStatus);
+ App.db.setClusterStatus(clusterStatus);
+ },
+
+ /**
* Temporary function for wizardStep9, before back-end integration
*/
setInfoForStep9: function () {
- App.db.setClusterStatus({status: 'pending', isCompleted: false});
var hostInfo = App.db.getHosts();
for (var index in hostInfo) {
hostInfo[index].status = "pending";
- hostInfo[index].message = 'Information';
+ hostInfo[index].message = 'Waiting';
hostInfo[index].progress = '0';
}
App.db.setHosts(hostInfo);
@@ -342,7 +345,7 @@ App.AddHostController = Em.Controller.ex
*/
saveConfirmedHosts: function (stepController) {
var hostInfo = {};
- stepController.get('content').forEach(function (_host) {
+ stepController.get('content.hostsInfo').forEach(function (_host) {
hostInfo[_host.name] = {
name: _host.name,
cpu: _host.cpu,
@@ -438,6 +441,7 @@ App.AddHostController = Em.Controller.ex
var masterComponentHosts = [];
obj.forEach(function (_component) {
masterComponentHosts.push({
+ display_name: _component.display_name,
component: _component.component_name,
hostName: _component.selectedHost
});
@@ -633,17 +637,6 @@ App.AddHostController = Em.Controller.ex
console.log("AddHostController.loadHostToMasterComponent: loaded list ", list);
},
-
- /**
- * Call specified function only once
- */
- callLoadFuncOnce: function (name) {
- if (!this.isStepLoaded[name]) {
- this[name]();
- this.isStepLoaded[name] = true;
- }
- },
-
/**
* Load data for all steps until <code>current step</code>
*/
@@ -651,30 +644,82 @@ App.AddHostController = Em.Controller.ex
var step = this.get('currentStep');
switch (step) {
case '8':
- //need to call it every time since we preload data in setInfoForStep9
- this.loadClusterInfo();
case '7':
- this.loadClusterInfo();
case '6':
- this.callLoadFuncOnce('loadServiceConfigProperties');
+ this.loadServiceConfigProperties();
case '5':
- this.callLoadFuncOnce('loadMasterComponentHosts');
- this.callLoadFuncOnce('loadSlaveComponentHosts');
- this.callLoadFuncOnce('loadClients');
- this.callLoadFuncOnce('loadHostToMasterComponent');
+ this.loadClients();
case '4':
- this.callLoadFuncOnce('loadConfirmedHosts');
+ this.loadMasterComponentHosts();
+ this.loadSlaveComponentHosts();
+ this.loadHostToMasterComponent();
+ this.loadConfirmedHosts();
case '3':
- this.callLoadFuncOnce('loadServices');
+ this.loadClients();
+ this.loadServices();
case '2':
+ this.loadConfirmedHosts();
case '1':
- this.callLoadFuncOnce('loadInstallOptions');
+ this.loadInstallOptions();
case '0':
- this.callLoadFuncOnce('loadClusterInfo');
+ this.loadClusterInfo();
}
},
/**
+ * Generate clients list for selected services and save it to model
+ * @param stepController step8WizardController or step9WizardController
+ */
+ installServices: function () {
+ var self = this;
+ var clusterName = this.get('content.cluster.name');
+ var url = '/api/clusters/' + clusterName + '/services?state=INIT';
+ var data = '{"ServiceInfo": {"state": "INSTALLED"}}';
+ $.ajax({
+ type: 'PUT',
+ url: url,
+ data: data,
+ async: false,
+ dataType: 'text',
+ timeout: 5000,
+ success: function (data) {
+ var jsonData = jQuery.parseJSON(data);
+ console.log("TRACE: STep8 -> In success function for the installService call");
+ console.log("TRACE: STep8 -> value of the url is: " + url);
+ if (jsonData) {
+ var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
+ console.log('requestId is: ' + requestId);
+ var clusterStatus = {
+ status: 'PENDING',
+ requestId: requestId,
+ isInstallError: false,
+ isCompleted: false
+ };
+ self.saveClusterStatus(clusterStatus);
+ } else {
+ console.log('ERROR: Error occurred in parsing JSON data');
+ }
+ },
+
+ error: function (request, ajaxOptions, error) {
+ console.log("TRACE: STep8 -> In error function for the installService call");
+ console.log("TRACE: STep8 -> value of the url is: " + url);
+ console.log("TRACE: STep8 -> error code status is: " + request.status);
+ console.log('Step8: Error message is: ' + request.responseText);
+ var clusterStatus = {
+ status: 'PENDING',
+ isInstallError: true,
+ isCompleted: false
+ };
+ self.saveClusterStatus(clusterStatus);
+ },
+
+ statusCode: require('data/statusCodes')
+ });
+
+ },
+
+ /**
* Remove all loaded data.
* Created as copy for App.router.clearAllSteps
*/
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/host/details.js Wed Nov 7 04:00:21 2012
@@ -33,6 +33,13 @@ App.MainHostDetailsController = Em.Contr
this._super();
this.startCheckOperationsLifeTime();
},
+ routeHome:function () {
+ App.router.transitionTo('main.dashboard');
+ var view = Ember.View.views['main_menu'];
+ $.each(view._childViews, function () {
+ this.set('active', this.get('content.routing') == 'dashboard' ? "active" : "");
+ });
+ },
setBack: function(isFromHosts){
this.set('isFromHosts', isFromHosts);
@@ -95,7 +102,14 @@ App.MainHostDetailsController = Em.Contr
secondary: 'No',
onPrimary: function() {
var component = event.context;
- component.set('workStatus', true);
+ component.set('workStatus', "STARTING");
+ self.componentIndicatorBlink(component);
+ self.setComponentButtonStatus(component,"disabled");
+ //TODO: here must be call to server side
+ setTimeout(function(){
+ self.setComponentButtonStatus(component,"enabled");
+ component.set('workStatus', "STARTED");
+ },10000);
var backgroundOperations = self.get('backgroundOperations');
backgroundOperations.pushObject({
"hostName": self.get('content.hostName'),
@@ -109,7 +123,7 @@ App.MainHostDetailsController = Em.Contr
"logs":{"exitcode":"404", "stdout":27, "stderror":501}
});
self.showBackgroundOperationsPopup();
- var stopped = self.get('content.components').filterProperty('workStatus', false);
+ var stopped = self.get('content.components').filterProperty('workStatus', "STOPPING");
if (stopped.length == 0)
self.set('isStarting', true);
this.hide();
@@ -128,7 +142,14 @@ App.MainHostDetailsController = Em.Contr
secondary: 'No',
onPrimary: function() {
var component = event.context;
- component.set('workStatus', false);
+ component.set('workStatus', "STOPPING");
+ self.componentIndicatorBlink(component);
+ self.setComponentButtonStatus(component,"disabled");
+ //TODO: here must be call to server side
+ setTimeout(function(){
+ self.setComponentButtonStatus(component,"enabled");
+ component.set('workStatus', "STOPPED");
+ },10000);
var backgroundOperations = self.get('backgroundOperations');
backgroundOperations.pushObject({
"hostName": self.get('content.hostName'),
@@ -142,7 +163,7 @@ App.MainHostDetailsController = Em.Contr
"logs":{"exitcode":"404", "stdout":15, "stderror":501}
});
self.showBackgroundOperationsPopup();
- var started = self.get('content.components').filterProperty('workStatus', true);
+ var started = self.get('content.components').filterProperty('workStatus', "STARTING");
if (started.length == 0)
self.set('isStarting', false);
this.hide();
@@ -153,6 +174,21 @@ App.MainHostDetailsController = Em.Contr
});
},
+ setComponentButtonStatus: function(component,status){
+ if(status=="disabled"){
+ $("#component-button-" + component.get("id") ).addClass("disabled");
+ }else{
+ $("#component-button-" + component.get("id") ).removeClass("disabled");
+ }
+ },
+ componentIndicatorBlink: function(component){
+ var self=this;
+ $("#component-button-"+component.get("id")).find(".components-health").effect("pulsate", { times:1 }, "slow", function () {
+ if(component.get('workStatus')==="STOPPING" || component.get('workStatus')==="STARTING")
+ self.componentIndicatorBlink(component);
+ });
+ },
+
decommission: function(event){
var self = this;
App.ModalPopup.show({
@@ -222,7 +258,7 @@ App.MainHostDetailsController = Em.Contr
primary: 'Yes',
secondary: 'No',
onPrimary: function() {
- self.get('content.components').setEach('workStatus', true);
+ self.get('content.components').setEach('workStatus', "STARTING");
self.set('isStarting', !self.get('isStarting'));
this.hide();
},
@@ -239,7 +275,7 @@ App.MainHostDetailsController = Em.Contr
primary: 'Yes',
secondary: 'No',
onPrimary: function() {
- self.get('content.components').setEach('workStatus', false);
+ self.get('content.components').setEach('workStatus', "STOPPING");
self.set('isStarting', !self.get('isStarting'));
this.hide();
},
@@ -258,7 +294,7 @@ App.MainHostDetailsController = Em.Contr
components.forEach(function(cInstance){
var cName = cInstance.get('componentName');
if(slaveComponents.contains(cName)) {
- if(cInstance.get('workStatus') &&
+ if(cInstance.get('workStatus')==="STOPPED" &&
!cInstance.get('decommissioned')){
workingComponents.push(cName);
}
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js?rev=1406442&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/add_controller.js Wed Nov 7 04:00:21 2012
@@ -0,0 +1,720 @@
+/**
+ * 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.AddServiceController = Em.Controller.extend({
+
+ name: 'addServiceController',
+
+ /**
+ * All wizards data will be stored in this variable
+ *
+ * cluster - cluster name
+ * hosts - hosts, ssh key, repo info, etc.
+ * services - services list
+ * hostsInfo - list of selected hosts
+ * slaveComponentHosts, hostSlaveComponents - info about slave hosts
+ * masterComponentHosts - info about master hosts
+ * config??? - to be described later
+ */
+ content: Em.Object.create({
+ cluster: null,
+ hosts: null,
+ services: null,
+ hostsInfo: null,
+ slaveComponentHosts: null,
+ hostSlaveComponents: null,
+ masterComponentHosts: null,
+ hostToMasterComponent : null,
+ serviceConfigProperties: null
+ }),
+
+ /**
+ * Used for hiding back button in wizard
+ */
+ hideBackButton: true,
+
+ isStepDisabled: [],
+
+ totalSteps: 9,
+
+ init: function () {
+ this.isStepDisabled.pushObject(Ember.Object.create({
+ step: 1,
+ value: false
+ }));
+ for (var i = 2; i <= this.totalSteps; i++) {
+ this.isStepDisabled.pushObject(Ember.Object.create({
+ step: i,
+ value: true
+ }));
+ }
+ },
+
+ setStepsEnable: function () {
+ for (var i = 2; i <= this.totalSteps; i++) {
+ var step = this.get('isStepDisabled').findProperty('step', i);
+ if (i <= this.get('currentStep')) {
+ step.set('value', false);
+ } else {
+ step.set('value', true);
+ }
+ }
+ }.observes('currentStep'),
+
+ /**
+ * Return current step of Add Host Wizard
+ */
+ currentStep: function () {
+ return App.get('router').getWizardCurrentStep('addService');
+ }.property(),
+
+ clusters: null,
+
+ /**
+ * Set current step to new value.
+ * Method moved from App.router.setInstallerCurrentStep
+ * @param currentStep
+ * @param completed
+ */
+ setCurrentStep: function (currentStep, completed) {
+ App.db.setWizardCurrentStep('addService', currentStep, completed);
+ this.set('currentStep', currentStep);
+ },
+
+ isStep1: function () {
+ return this.get('currentStep') == 1;
+ }.property('currentStep'),
+
+ isStep2: function () {
+ return this.get('currentStep') == 2;
+ }.property('currentStep'),
+
+ isStep3: function () {
+ return this.get('currentStep') == 3;
+ }.property('currentStep'),
+
+ isStep4: function () {
+ return this.get('currentStep') == 4;
+ }.property('currentStep'),
+
+ isStep5: function () {
+ return this.get('currentStep') == 5;
+ }.property('currentStep'),
+
+ isStep6: function () {
+ return this.get('currentStep') == 6;
+ }.property('currentStep'),
+
+ isStep7: function () {
+ return this.get('currentStep') == 7;
+ }.property('currentStep'),
+
+ gotoStep: function (step) {
+ if (this.get('isStepDisabled').findProperty('step', step).get('value') === false) {
+ App.router.send('gotoStep' + step);
+ }
+ },
+
+ gotoStep1: function () {
+ this.gotoStep(1);
+ },
+
+ gotoStep2: function () {
+ this.gotoStep(2);
+ },
+
+ gotoStep3: function () {
+ this.gotoStep(3);
+ },
+
+ gotoStep4: function () {
+ this.gotoStep(4);
+ },
+
+ gotoStep5: function () {
+ this.gotoStep(5);
+ },
+
+ gotoStep6: function () {
+ this.gotoStep(6);
+ },
+
+ gotoStep7: function () {
+ this.gotoStep(7);
+ },
+
+
+ /**
+ * Load clusterInfo(step1) to model
+ */
+ loadClusterInfo: function(){
+ var cStatus = App.db.getClusterStatus() || {status: "", isCompleted: false};
+ var cluster = {
+ name: App.db.getClusterName() || "",
+ status: cStatus.status,
+ isCompleted: cStatus.isCompleted
+ };
+ this.set('content.cluster', cluster);
+ console.log("AddServiceController:loadClusterInfo: loaded data ", cluster);
+ },
+
+ /**
+ * Save all info about claster to model
+ * @param stepController Step1WizardController
+ */
+ saveClusterInfo: function (stepController) {
+ var cluster = stepController.get('content.cluster');
+ var clusterStatus = {
+ status: cluster.status,
+ isCompleted: cluster.isCompleted
+ }
+ App.db.setClusterName(cluster.name);
+ App.db.setClusterStatus(clusterStatus);
+
+ console.log("AddServiceController:saveClusterInfo: saved data ", cluster);
+
+ //probably next line is extra work - need to check it
+ this.set('content.cluster', cluster);
+ },
+
+ /**
+ * save status of the cluster. This is called from step8 and step9 to persist install and start requestId
+ * @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
+ */
+ saveClusterStatus: function (clusterStatus) {
+ this.set('content.cluster', clusterStatus);
+ App.db.setClusterStatus(clusterStatus);
+ },
+
+ /**
+ * Temporary function for wizardStep9, before back-end integration
+ */
+ setInfoForStep9: function () {
+ var hostInfo = App.db.getHosts();
+ for (var index in hostInfo) {
+ hostInfo[index].status = "pending";
+ hostInfo[index].message = 'Information';
+ hostInfo[index].progress = '0';
+ }
+ App.db.setHosts(hostInfo);
+ },
+
+ /**
+ * Load all data for <code>Specify Host(install step2)</code> step
+ * Data Example:
+ * {
+ * hostNames: '',
+ * manualInstall: false,
+ * sshKey: '',
+ * passphrase: '',
+ * confirmPassphrase: '',
+ * localRepo: false,
+ * localRepoPath: ''
+ * }
+ */
+ loadInstallOptions: function () {
+
+ if (!this.content.hosts) {
+ this.content.hosts = Em.Object.create();
+ }
+
+ //TODO : rewire it as model. or not :)
+ var hostsInfo = Em.Object.create();
+
+ hostsInfo.hostNames = App.db.getAllHostNames() || ''; //empty string if undefined
+
+ //TODO : should we check installType for add host wizard????
+ var installType = App.db.getInstallType();
+ //false if installType not equals 'manual'
+ hostsInfo.manualInstall = installType && installType.installType === 'manual' || false;
+
+ var softRepo = App.db.getSoftRepo();
+ if (softRepo && softRepo.repoType === 'local') {
+ hostsInfo.localRepo = true;
+ hostsInfo.localRepopath = softRepo.repoPath;
+ } else {
+ hostsInfo.localRepo = false;
+ hostsInfo.localRepoPath = '';
+ }
+
+ hostsInfo.sshKey = 'random';
+ hostsInfo.passphrase = '';
+ hostsInfo.confirmPassphrase = '';
+
+ this.set('content.hosts', hostsInfo);
+ console.log("AddServiceController:loadHosts: loaded data ", hostsInfo);
+ },
+
+ /**
+ * Save data, which user filled, to main controller
+ * @param stepController App.WizardStep2Controller
+ */
+ saveHosts: function (stepController) {
+ //TODO: put data to content.hosts and only then save it)
+
+ //App.db.setBootStatus(false);
+ App.db.setAllHostNames(stepController.get('hostNames'));
+ App.db.setHosts(stepController.getHostInfo());
+ if (stepController.get('manualInstall') === false) {
+ App.db.setInstallType({installType: 'ambari' });
+ } else {
+ App.db.setInstallType({installType: 'manual' });
+ }
+ if (stepController.get('localRepo') === false) {
+ App.db.setSoftRepo({ 'repoType': 'remote', 'repoPath': null});
+ } else {
+ App.db.setSoftRepo({ 'repoType': 'local', 'repoPath': stepController.get('localRepoPath') });
+ }
+ },
+
+ /**
+ * Return hosts, which were add at <code>Specify Host(step2)</code> step
+ * @paramm isNew whether return all hosts or only new ones
+ */
+ getHostList: function (isNew) {
+ var hosts = [];
+ var hostArray = App.db.getHosts()
+ console.log('in AddServiceController.getHostList: host names is ', hostArray);
+
+ for (var i in hostArray) {
+ var hostInfo = App.HostInfo.create({
+ name: hostArray[i].name,
+ bootStatus: hostArray[i].bootStatus
+ });
+
+ hosts.pushObject(hostInfo);
+ }
+
+ console.log('TRACE: pushing ' + hosts);
+ return hosts;
+ },
+
+ /**
+ * Remove host from model. Used at <code>Confirm hosts(step2)</code> step
+ * @param hosts Array of hosts, which we want to delete
+ */
+ removeHosts: function (hosts) {
+ //todo Replace this code with real logic
+ App.db.removeHosts(hosts);
+ },
+
+ /**
+ * Save data, which user filled, to main controller
+ * @param stepController App.WizardStep3Controller
+ */
+ saveConfirmedHosts: function (stepController) {
+ var hostInfo = {};
+ stepController.get('content').forEach(function (_host) {
+ hostInfo[_host.name] = {
+ name: _host.name,
+ cpu: _host.cpu,
+ memory: _host.memory,
+ bootStatus: _host.bootStatus
+ };
+ });
+ console.log('AddServiceController:saveConfirmedHosts: save hosts ', hostInfo);
+ App.db.setHosts(hostInfo);
+ this.set('content.hostsInfo', hostInfo);
+ },
+
+ /**
+ * Load confirmed hosts.
+ * Will be used at <code>Assign Masters(step5)</code> step
+ */
+ loadConfirmedHosts: function(){
+ var hosts=App.db.getHosts();
+
+ hosts = {
+ "192.168.1.1":{"name":"192.168.1.1","cpu":"2","memory":"2","bootStatus":"pending"},
+ "192.168.1.2":{"name":"192.168.1.2","cpu":"2","memory":"2","bootStatus":"success"},
+ "192.168.1.3":{"name":"192.168.1.3","cpu":"2","memory":"2","bootStatus":"pending"},
+ "192.168.1.4":{"name":"192.168.1.4","cpu":"2","memory":"2","bootStatus":"pending"},
+ "192.168.1.5":{"name":"192.168.1.5","cpu":"2","memory":"2","bootStatus":"success"},
+ "192.168.1.6":{"name":"192.168.1.6","cpu":"2","memory":"2","bootStatus":"pending"},
+ "192.168.1.7":{"name":"192.168.1.7","cpu":"2","memory":"2","bootStatus":"success"},
+ "192.168.1.8":{"name":"192.168.1.8","cpu":"2","memory":"2","bootStatus":"success"},
+ "192.168.1.9":{"name":"192.168.1.9","cpu":"2","memory":"2","bootStatus":"success"},
+ "192.168.1.10":{"name":"192.168.1.10","cpu":"2","memory":"2","bootStatus":"pending"},
+ "192.168.1.11":{"name":"192.168.1.11","cpu":"2","memory":"2","bootStatus":"success"},
+ "192.168.1.12":{"name":"192.168.1.12","cpu":"2","memory":"2","bootStatus":"pending"},
+ "192.168.1.13":{"name":"192.168.1.13","cpu":"2","memory":"2","bootStatus":"success"}
+ };
+
+ this.set('content.hostsInfo', hosts);
+ },
+
+ /**
+ * Save data after installation to main controller
+ * @param stepController App.WizardStep9Controller
+ */
+ saveInstalledHosts: function (stepController) {
+ var hosts = stepController.get('hosts');
+ var hostInfo = App.db.getHosts();
+
+ for (var index in hostInfo) {
+ hostInfo[index].status = "pending";
+ var host = hosts.findProperty('name', hostInfo[index].name);
+ if (host) {
+ hostInfo[index].status = host.status;
+ hostInfo[index].message = host.message;
+ hostInfo[index].progress = host.progress;
+ }
+ }
+ App.db.setHosts(hostInfo);
+ console.log('AddServiceController:saveInstalledHosts: save hosts ', hostInfo);
+ },
+
+ /**
+ * Remove all data for hosts
+ */
+ clearHosts: function () {
+ var hosts = this.get('content').get('hosts');
+ if (hosts) {
+ hosts.hostNames = '';
+ hosts.manualInstall = false;
+ hosts.localRepo = '';
+ hosts.localRepopath = '';
+ hosts.sshKey = '';
+ hosts.passphrase = '';
+ hosts.confirmPassphrase = '';
+ }
+ },
+
+ /**
+ * Load services data. Will be used at <code>Select services(step4)</code> step
+ */
+ loadServices: function () {
+ var servicesInfo = App.db.getService();
+ servicesInfo.forEach(function (item, index) {
+ servicesInfo[index] = Em.Object.create(item);
+ });
+ this.set('content.services', servicesInfo);
+ console.log('AddServiceController.loadServices: loaded data ', servicesInfo);
+ console.log('selected services ', servicesInfo.filterProperty('isSelected', true).mapProperty('serviceName'));
+ },
+
+ /**
+ * Save data to model
+ * @param stepController App.WizardStep4Controller
+ */
+ saveServices: function (stepController) {
+ var serviceNames = [];
+ // we can also do it without stepController since all data,
+ // changed at page, automatically changes in model(this.content.services)
+ App.db.setService(stepController.get('content'));
+ stepController.filterProperty('isSelected', true).forEach(function (item) {
+ serviceNames.push(item.serviceName);
+ });
+ App.db.setSelectedServiceNames(serviceNames);
+ console.log('AddServiceController.saveServices: saved data ', serviceNames);
+ },
+
+ /**
+ * Save Master Component Hosts data to Main Controller
+ * @param stepController App.WizardStep5Controller
+ */
+ saveMasterComponentHosts: function (stepController) {
+ var obj = stepController.get('selectedServicesMasters');
+ var masterComponentHosts = [];
+ obj.forEach(function (_component) {
+ masterComponentHosts.push({
+ display_name: _component.display_name,
+ component: _component.component_name,
+ hostName: _component.selectedHost
+ });
+ });
+
+ console.log("AddServiceController.saveComponentHosts: saved hosts ", masterComponentHosts);
+ App.db.setMasterComponentHosts(masterComponentHosts);
+ this.set('content.masterComponentHosts', masterComponentHosts);
+
+ var hosts = masterComponentHosts.mapProperty('hostName').uniq();
+ var hostsMasterServicesMapping = [];
+ hosts.forEach(function (_host) {
+ var componentsOnHost = masterComponentHosts.filterProperty('hostName', _host).mapProperty('component');
+ hostsMasterServicesMapping.push({
+ hostname: _host,
+ components: componentsOnHost
+ });
+ }, this);
+ console.log("AddServiceController.setHostToMasterComponent: saved hosts ", hostsMasterServicesMapping);
+ App.db.setHostToMasterComponent(hostsMasterServicesMapping);
+ this.set('content.hostToMasterComponent', hostsMasterServicesMapping);
+ },
+
+ /**
+ * Load master component hosts data for using in required step controllers
+ */
+ loadMasterComponentHosts: function () {
+ var masterComponentHosts = App.db.getMasterComponentHosts();
+ this.set("content.masterComponentHosts", masterComponentHosts);
+ console.log("AddServiceController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
+
+ var hostsMasterServicesMapping = App.db.getHostToMasterComponent();
+ this.set("content.hostToMasterComponent", hostsMasterServicesMapping);
+ console.log("AddServiceController.loadHostToMasterComponent: loaded hosts ", hostsMasterServicesMapping);
+ },
+
+ /**
+ * Save slaveHostComponents to main controller
+ * @param stepController
+ */
+ saveSlaveComponentHosts: function (stepController) {
+
+ var hosts = stepController.get('hosts');
+ var isMrSelected = stepController.get('isMrSelected');
+ var isHbSelected = stepController.get('isHbSelected');
+
+ App.db.setHostSlaveComponents(hosts);
+ this.set('content.hostSlaveComponents', hosts);
+
+ var dataNodeHosts = [];
+ var taskTrackerHosts = [];
+ var regionServerHosts = [];
+ var clientHosts = [];
+
+ hosts.forEach(function (host) {
+ if (host.get('isDataNode')) {
+ dataNodeHosts.push({
+ hostname: host.hostname,
+ group: 'Default'
+ });
+ }
+ if (isMrSelected && host.get('isTaskTracker')) {
+ taskTrackerHosts.push({
+ hostname: host.hostname,
+ group: 'Default'
+ });
+ }
+ if (isHbSelected && host.get('isRegionServer')) {
+ regionServerHosts.push({
+ hostname: host.hostname,
+ group: 'Default'
+ });
+ }
+ if (host.get('isClient')) {
+ clientHosts.pushObject({
+ hostname: host.hostname,
+ group: 'Default'
+ });
+ }
+ }, this);
+
+ var slaveComponentHosts = [];
+ slaveComponentHosts.push({
+ componentName: 'DATANODE',
+ displayName: 'DataNode',
+ hosts: dataNodeHosts
+ });
+ if (isMrSelected) {
+ slaveComponentHosts.push({
+ componentName: 'TASKTRACKER',
+ displayName: 'TaskTracker',
+ hosts: taskTrackerHosts
+ });
+ }
+ if (isHbSelected) {
+ slaveComponentHosts.push({
+ componentName: 'HBASE_REGIONSERVER',
+ displayName: 'RegionServer',
+ hosts: regionServerHosts
+ });
+ }
+ slaveComponentHosts.pushObject({
+ componentName: 'CLIENT',
+ displayName: 'client',
+ hosts: clientHosts
+ });
+
+ App.db.setSlaveComponentHosts(slaveComponentHosts);
+ this.set('content.slaveComponentHosts', slaveComponentHosts);
+ },
+
+ /**
+ * Load master component hosts data for using in required step controllers
+ */
+ loadSlaveComponentHosts: function () {
+ var slaveComponentHosts = App.db.getSlaveComponentHosts();
+ this.set("content.slaveComponentHosts", slaveComponentHosts);
+ console.log("AddServiceController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
+
+ var hostSlaveComponents = App.db.getHostSlaveComponents();
+ this.set('content.hostSlaveComponents', hostSlaveComponents);
+ console.log("AddServiceController.loadSlaveComponentHosts: loaded hosts ", hostSlaveComponents);
+ },
+
+ /**
+ * Save config properties
+ * @param stepController Step7WizardController
+ */
+ saveServiceConfigProperties: function (stepController) {
+ var serviceConfigProperties = [];
+ stepController.get('stepConfigs').forEach(function (_content) {
+ _content.get('configs').forEach(function (_configProperties) {
+ var configProperty = {
+ name: _configProperties.get('name'),
+ value: _configProperties.get('value')
+ };
+ serviceConfigProperties.push(configProperty);
+ }, this);
+
+ }, this);
+
+ App.db.setServiceConfigProperties(serviceConfigProperties);
+ this.set('content.serviceConfigProperties', serviceConfigProperties);
+ },
+
+ /**
+ * Load serviceConfigProperties to model
+ */
+ loadServiceConfigProperties: function () {
+ var serviceConfigProperties = App.db.getServiceConfigProperties();
+ this.set('content.serviceConfigProperties', serviceConfigProperties);
+ console.log("AddServiceController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
+ },
+
+ /**
+ * Load information about hosts with clients components
+ */
+ loadClients: function(){
+ var clients = App.db.getClientsForSelectedServices();
+ this.set('content.clients', clients);
+ console.log("AddServiceController.loadClients: loaded list ", clients);
+ },
+
+ /**
+ * Generate clients list for selected services and save it to model
+ * @param stepController step4WizardController
+ */
+ saveClients: function(stepController){
+ var clients = [];
+ var serviceComponents = require('data/service_components');
+
+ stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
+ var client = serviceComponents.filterProperty('service_name', _service.serviceName).findProperty('isClient', true);
+ if (client) {
+ clients.pushObject({
+ component_name: client.component_name,
+ display_name: client.display_name
+ });
+ }
+ }, this);
+
+ App.db.setClientsForSelectedServices(clients);
+ this.set('content.clients', clients);
+ console.log("AddServiceController.saveClients: saved list ", clients);
+ },
+
+ /**
+ * Load HostToMasterComponent array
+ */
+ loadHostToMasterComponent: function(){
+ var list = App.db.getHostToMasterComponent();
+ this.set('content.hostToMasterComponent', list);
+ console.log("AddServiceController.loadHostToMasterComponent: loaded list ", list);
+ },
+
+ /**
+ * Load data for all steps until <code>current step</code>
+ */
+ loadAllPriorSteps: function () {
+ var step = this.get('currentStep');
+ switch (step) {
+ case '6':
+ case '5':
+ this.loadClusterInfo();
+ case '4':
+ this.loadServiceConfigProperties();
+ case '3':
+ this.loadClients();
+ case '2':
+ this.loadMasterComponentHosts();
+ this.loadSlaveComponentHosts();
+ this.loadHostToMasterComponent();
+ this.loadConfirmedHosts();
+ case '1':
+ this.loadServices();
+ }
+ },
+
+ /**
+ * Generate clients list for selected services and save it to model
+ * @param stepController step8WizardController or step9WizardController
+ */
+ installServices: function () {
+ var self = this;
+ var clusterName = this.get('content.cluster.name');
+ var url = '/api/clusters/' + clusterName + '/services?state=INIT';
+ var data = '{"ServiceInfo": {"state": "INSTALLED"}}';
+ $.ajax({
+ type: 'PUT',
+ url: url,
+ data: data,
+ async: false,
+ dataType: 'text',
+ timeout: 5000,
+ success: function (data) {
+ var jsonData = jQuery.parseJSON(data);
+ console.log("TRACE: STep8 -> In success function for the installService call");
+ console.log("TRACE: STep8 -> value of the url is: " + url);
+ if (jsonData) {
+ var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
+ console.log('requestId is: ' + requestId);
+ var clusterStatus = {
+ status: 'PENDING',
+ requestId: requestId,
+ isInstallError: false,
+ isCompleted: false
+ };
+ self.saveClusterStatus(clusterStatus);
+ } else {
+ console.log('ERROR: Error occurred in parsing JSON data');
+ }
+ },
+
+ error: function (request, ajaxOptions, error) {
+ console.log("TRACE: STep8 -> In error function for the installService call");
+ console.log("TRACE: STep8 -> value of the url is: " + url);
+ console.log("TRACE: STep8 -> error code status is: " + request.status);
+ console.log('Step8: Error message is: ' + request.responseText);
+ var clusterStatus = {
+ status: 'PENDING',
+ isInstallError: true,
+ isCompleted: false
+ };
+ self.saveClusterStatus(clusterStatus);
+ },
+
+ statusCode: require('data/statusCodes')
+ });
+
+ },
+
+ /**
+ * Remove all loaded data.
+ * Created as copy for App.router.clearAllSteps
+ */
+ clearAllSteps: function () {
+ this.clearHosts();
+ //todo it)
+ }
+
+});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/main/service/item.js Wed Nov 7 04:00:21 2012
@@ -20,44 +20,188 @@ var App = require('app');
App.MainServiceItemController = Em.Controller.extend({
name: 'mainServiceItemController',
- content: App.Service.find(1),
- showRebalancer: function() {
- if(this.content.get('serviceName') == 'hdfs') {
- return true;
- } else {
- return false;
+ backgroundOperations: [],
+ taskId: 0,
+ intervalId: false,
+ checkOperationsInterval: 5000,
+ init: function(){
+ this._super();
+ this.startCheckOperationsLifeTime();
+ },
+ startCheckOperationsLifeTime: function () {
+ this.intervalId = setInterval(this.checkOperationsLifeTime, this.get('checkOperationsInterval'));
+ },
+ stopCheckOperationsLifeTime:function () {
+ if(this.intervalId) {
+ clearInterval(this.intervalId);
}
- }.property('content'),
- startConfirmPopup: function (event) {
+ this.intervalId = false;
+ },
+
+ checkOperationsLifeTime: function () {
+ var self = App.router.get('mainServiceItemController');
+ var backgroundOperations = self.get('backgroundOperations');
+ var time = new Date().getTime();
+ if(backgroundOperations.length){
+ backgroundOperations.forEach(function (operation) {
+ if (time - operation.startTime >= 60*1000){
+ backgroundOperations.removeObject(operation);
+ }
+ })
+ }
+ },
+ createBackgroundOperation: function (role, command) {
+ var newTaskId = this.get('taskId') + 1;
+ this.set('taskId', newTaskId);
+ var operation = Em.Object.create({
+ taskId: newTaskId,
+ stageId: null,
+ serviceName: this.content.get('serviceName'),
+ role: role,
+ command: command,
+ status: null,
+ exitcode: 404,
+ stderror: 27,
+ stdout: 501,
+ startTime: new Date().getTime(),
+ attemptCount: null
+ })
+
+ return operation;
+ },
+ startService: function (event) {
+ var self = this;
+ App.ModalPopup.show({
+ header: Em.I18n.t('services.service.confirmation.header'),
+ body: Em.I18n.t('services.service.confirmation.body'),
+ primary: 'Yes',
+ secondary: 'No',
+ onPrimary: function() {
+ self.content.set('workStatus', true);
+ var newOperation = self.createBackgroundOperation('Service', 'Start');
+ newOperation.detail = "Another detail info";
+ self.addBackgroundOperation(newOperation);
+ this.hide();
+ },
+ onSecondary: function() {
+ this.hide();
+ }
+ });
+ },
+ stopService: function (event) {
+ var self = this;
+ App.ModalPopup.show({
+ header: Em.I18n.t('services.service.confirmation.header'),
+ body: Em.I18n.t('services.service.confirmation.body'),
+ primary: 'Yes',
+ secondary: 'No',
+ onPrimary: function() {
+ self.content.set('workStatus', false);
+ var newOperation = self.createBackgroundOperation('Service', 'Stop');
+ newOperation.detail = "Another detail info";
+ self.addBackgroundOperation(newOperation);
+ this.hide();
+ },
+ onSecondary: function() {
+ this.hide();
+ }
+ });
+ },
+ runRebalancer: function (event) {
+ var self = this;
App.ModalPopup.show({
- header: Em.I18n.t('services.service.start.popup.header'),
- body: Em.I18n.t('services.service.start.popup.body'),
+ header: Em.I18n.t('services.service.confirmation.header'),
+ body: Em.I18n.t('services.service.confirmation.body'),
primary: 'Yes',
secondary: 'No',
onPrimary: function() {
- alert('do');
+ self.content.set('runRebalancer', true);
+ var newOperation = self.createBackgroundOperation('Service', 'Run Rebalancer');
+ newOperation.detail = "Some detail info";
+ self.addBackgroundOperation(newOperation);
this.hide();
},
onSecondary: function() {
- alert('not do');
this.hide();
}
});
},
- stopConfirmPopup: function (event) {
+ runCompaction: function (event) {
+ var self = this;
App.ModalPopup.show({
- header: Em.I18n.t('services.service.stop.popup.header'),
- body: Em.I18n.t('services.service.stop.popup.body'),
+ header: Em.I18n.t('services.service.confirmation.header'),
+ body: Em.I18n.t('services.service.confirmation.body'),
primary: 'Yes',
secondary: 'No',
onPrimary: function() {
- alert('do');
+ self.content.set('runCompaction', true);
+ var newOperation = self.createBackgroundOperation('Service', 'Run Compaction');
+ self.addBackgroundOperation(newOperation);
this.hide();
},
onSecondary: function() {
- alert('not do');
this.hide();
}
});
+ },
+ runSmokeTest: function (event) {
+ var self = this;
+ App.ModalPopup.show({
+ header: Em.I18n.t('services.service.confirmation.header'),
+ body: Em.I18n.t('services.service.confirmation.body'),
+ primary: 'Yes',
+ secondary: 'No',
+ onPrimary: function() {
+ self.content.set('runSmokeTest', true);
+ var newOperation = self.createBackgroundOperation('Service', 'Run Smoke Test');
+ self.addBackgroundOperation(newOperation);
+ this.hide();
+ },
+ onSecondary: function() {
+ this.hide();
+ }
+ });
+ },
+ doAction: function (event) {
+ var methodName = event.context;
+ switch (methodName) {
+ case 'runRebalancer':
+ this.runRebalancer();
+ break;
+ case 'runCompaction':
+ this.runCompaction();
+ break;
+ case 'runSmokeTest':
+ this.runSmokeTest();
+ break;
+ }
+ },
+ serviceOperations: function(){
+ var serviceName = this.get('content.serviceName');
+ return this.get('backgroundOperations').filterProperty('serviceName', serviceName);
+ }.property('backgroundOperations.length', 'content'),
+ serviceOperationsCount: function() {
+ return this.get('serviceOperations.length');
+ }.property('serviceOperations'),
+ showBackgroundOperationsPopup: function(){
+ console.log(this.get('backgroundOperations'));
+ App.ModalPopup.show({
+ headerClass: Ember.View.extend({
+ controllerBinding: 'App.router.mainServiceItemController',
+ template:Ember.Handlebars.compile('{{serviceOperationsCount}} Background Operations Running')
+ }),
+ bodyClass: Ember.View.extend({
+ controllerBinding: 'App.router.mainServiceItemController',
+ templateName: require('templates/main/service/background_operations_popup')
+ }),
+ onPrimary: function() {
+ this.hide();
+ }
+ });
+ },
+ addBackgroundOperation: function (operation) {
+ var backgroundOperations = this.get('backgroundOperations');
+ backgroundOperations.pushObject(operation);
+ this.showBackgroundOperationsPopup();
}
})
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step1_controller.js Wed Nov 7 04:00:21 2012
@@ -25,8 +25,24 @@ App.WizardStep1Controller = Em.Controlle
return this.get('content.cluster.name');
}.property('content.cluster.name'),
+
hasSubmitted : false,
+ clearStep: function() {
+ this.set('content.cluster.name','');
+ },
+
+ loadStep: function () {
+ var clusterName;
+ console.log('The value of the cluster name is: ' + App.db.getClusterName());
+ if (App.db.getClusterName() !== undefined) {
+ this.set('clusterName', App.db.getClusterName());
+ } else {
+ this.set('clusterNameError','');
+ this.set('invalidClusterName',true);
+ }
+ },
+
invalidClusterName : function(){
if(!this.get('hasSubmitted')){
return false;
@@ -59,6 +75,8 @@ App.WizardStep1Controller = Em.Controlle
submit: function () {
this.set('hasSubmitted', true);
if (!this.get('invalidClusterName')) {
+ this.set('content.cluster',{name: this.get('clusterName'), status: 'PENDING', isCompleted: false});
+ // App.router.get('installerController').saveClusterStatus({status: 'PENDING', isCompleted: false});
App.router.send('next');
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js?rev=1406442&r1=1406441&r2=1406442&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/wizard/step2_controller.js Wed Nov 7 04:00:21 2012
@@ -35,6 +35,7 @@ App.WizardStep2Controller = Em.Controlle
return this.get('content.localRepo');
}.property('content.localRepo'),
+
localRepoPath: function () {
return this.get('content.localRepoPath');
}.property('content.localRepoPath'),