Permalink
Browse files

AMBARI-1059. Refactor cluster management. (yusaku)

  • Loading branch information...
1 parent 5ed4c1c commit c357ac4960385fd55240887a6b9b8c0f76d35672 Yusaku Sako committed Dec 9, 2012
Showing with 583 additions and 568 deletions.
  1. +1 −0 ambari-web/app/controllers.js
  2. +11 −7 ambari-web/app/controllers/global/cluster_controller.js
  3. +1 −1 ambari-web/app/controllers/global/update_controller.js
  4. +41 −202 ambari-web/app/controllers/installer.js
  5. +1 −1 ambari-web/app/controllers/main/charts/heatmap.js
  6. +3 −111 ambari-web/app/controllers/main/host/add_controller.js
  7. +3 −112 ambari-web/app/controllers/main/service/add_controller.js
  8. +199 −0 ambari-web/app/controllers/wizard.js
  9. +41 −32 ambari-web/app/controllers/wizard/step3_controller.js
  10. +1 −1 ambari-web/app/controllers/wizard/step5_controller.js
  11. +2 −1 ambari-web/app/controllers/wizard/step6_controller.js
  12. +8 −0 ambari-web/app/controllers/wizard/step8_controller.js
  13. +1 −1 ambari-web/app/controllers/wizard/step9_controller.js
  14. 0 ambari-web/app/data/{mock → }/services.js
  15. +1 −0 ambari-web/app/initialize.js
  16. +20 −5 ambari-web/app/mappers/alerts_mapper.js
  17. +1 −2 ambari-web/app/messages.js
  18. +26 −4 ambari-web/app/models/hosts.js
  19. +2 −1 ambari-web/app/router.js
  20. +6 −0 ambari-web/app/routes/add_host_routes.js
  21. +6 −0 ambari-web/app/routes/add_service_routes.js
  22. +9 −1 ambari-web/app/routes/installer.js
  23. +4 −4 ambari-web/app/routes/main.js
  24. +22 −0 ambari-web/app/styles/application.less
  25. +18 −0 ambari-web/app/styles/apps.less
  26. +1 −1 ambari-web/app/templates/main/charts/heatmap.hbs
  27. +3 −1 ambari-web/app/templates/main/charts/heatmap/heatmap_host.hbs
  28. +0 −3 ambari-web/app/templates/main/charts/heatmap/heatmap_rack.hbs
  29. +1 −1 ambari-web/app/templates/main/charts/linear_time.hbs
  30. +1 −1 ambari-web/app/templates/main/dashboard.hbs
  31. +5 −0 ambari-web/app/templates/main/dashboard/service/hbase.hbs
  32. +5 −0 ambari-web/app/templates/main/dashboard/service/hdfs.hbs
  33. +5 −0 ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
  34. +3 −3 ambari-web/app/templates/main/host.hbs
  35. +0 −49 ambari-web/app/templates/main/service/info/client_summary.hbs
  36. +15 −9 ambari-web/app/templates/main/service/info/summary.hbs
  37. +1 −1 ambari-web/app/templates/wizard/step3.hbs
  38. +2 −0 ambari-web/app/templates/wizard/step4.hbs
  39. +1 −1 ambari-web/app/templates/wizard/step8.hbs
  40. +10 −1 ambari-web/app/utils/graph.js
  41. +26 −3 ambari-web/app/views/common/chart/linear_time.js
  42. +1 −0 ambari-web/app/views/main/admin/user/create.js
  43. +1 −1 ambari-web/app/views/main/dashboard.js
  44. +2 −2 ambari-web/app/views/main/dashboard/service.js
  45. +3 −0 ambari-web/app/views/main/dashboard/service/hbase.js
  46. +3 −0 ambari-web/app/views/main/dashboard/service/hdfs.js
  47. +3 −0 ambari-web/app/views/main/dashboard/service/mapreduce.js
  48. +10 −1 ambari-web/app/views/main/service/info/summary.js
  49. +1 −1 ambari-web/app/views/main/service/menu.js
  50. +6 −1 ambari-web/app/views/wizard/step1_view.js
  51. +1 −1 ambari-web/app/views/wizard/step3_view.js
  52. +43 −1 ambari-web/app/views/wizard/step8_view.js
  53. +2 −0 ambari-web/vendor/scripts/spin.min.js
@@ -21,6 +21,7 @@
require('controllers/application');
require('controllers/login_controller');
+require('controllers/wizard');
require('controllers/installer');
require('controllers/global/background_operations_controller');
require('controllers/main');
@@ -141,7 +141,7 @@ App.ClusterController = Em.Controller.extend({
}
return null;
}
- }.property('App.router.updateController.isUpdated', 'dataLoadList.hosts'),
+ }.property('App.router.updateController.isUpdated'),
isNagiosInstalled:function () {
if (App.testMode) {
@@ -157,7 +157,8 @@ App.ClusterController = Em.Controller.extend({
* Sorted list of alerts.
* Changes whenever alerts are loaded.
*/
- alerts:function () {
+ alerts:[],
+ updateAlerts: function(){
var alerts = App.Alert.find();
var alertsArray = alerts.toArray();
var sortedArray = alertsArray.sort(function (left, right) {
@@ -171,9 +172,8 @@ App.ClusterController = Em.Controller.extend({
}
return statusDiff;
});
- return sortedArray;
- }.property('dataLoadList.alerts'),
-
+ this.set('alerts', sortedArray);
+ },
loadRuns:function () {
if (this.get('postLoadList.runs')) {
return;
@@ -197,6 +197,9 @@ App.ClusterController = Em.Controller.extend({
* property, which will trigger the alerts property.
*/
loadAlerts:function () {
+ if(App.router.get('updateController.isUpdated')){
+ return;
+ }
var nagiosUrl = this.get('nagiosUrl');
if (nagiosUrl) {
var lastSlash = nagiosUrl.lastIndexOf('/');
@@ -209,10 +212,11 @@ App.ClusterController = Em.Controller.extend({
jsonp:"jsonp",
context:this,
complete:function (jqXHR, textStatus) {
- this.updateLoadStatus('alerts')
+ this.updateLoadStatus('alerts');
+ this.updateAlerts();
},
error: function(jqXHR, testStatus, error) {
- this.showMessage(Em.I18n.t('nagios.alerts.unavailable'));
+ // this.showMessage(Em.I18n.t('nagios.alerts.unavailable'));
console.log('Nagios $.ajax() response:', error);
}
};
@@ -89,7 +89,7 @@ App.UpdateController = Em.Controller.extend({
updateServiceMetric:function(callback){
var self = this;
self.set('isUpdated', false);
- var servicesUrl = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*');
+ var servicesUrl = this.getUrl('/data/dashboard/services.json', '/services?ServiceInfo/service_name!=MISCELLANEOUS&ServiceInfo/service_name!=DASHBOARD&fields=*,components/host_components/*,components/ServiceComponentInfo');
var callback = callback || function(jqXHR, textStatus){
self.set('isUpdated', true);
};
@@ -19,205 +19,12 @@
var App = require('app');
-App.InstallerController = Em.Controller.extend({
+App.InstallerController = App.WizardController.extend({
name: 'installerController',
- isStepDisabled: [],
-
totalSteps: 10,
- init: function () {
- this.clusters = App.Cluster.find();
- 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
- }));
- }
- // window.onbeforeunload = function () {
- // return "You have not saved your document yet. If you continue, your work will not be saved."
- //}
- },
-
- 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'),
-
- setLowerStepsDisable: function (stepNo) {
- for (var i = 1; i < stepNo; i++) {
- var step = this.get('isStepDisabled').findProperty('step', i);
- step.set('value', true);
- }
- },
-
- prevInstallStatus: function () {
- console.log('Inside the prevInstallStep function: The name is ' + App.router.get('loginController.loginName'));
- var result = App.db.isCompleted()
- if (result == '1') {
- return true;
- }
- }.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').getWizardCurrentStep('installer');
- }.property(),
-
- /**
- * Set current step to new value.
- * Method moved from App.router.setInstallerCurrentStep
- * @param currentStep
- * @param completed
- */
- setCurrentStep: function (currentStep, completed) {
- App.db.setWizardCurrentStep('installer', currentStep, completed);
- this.set('currentStep', currentStep);
- },
-
- clusters: null,
-
- 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'),
-
- isStep8: function () {
- return this.get('currentStep') == 8;
- }.property('currentStep'),
-
- isStep9: function () {
- return this.get('currentStep') == 9;
- }.property('currentStep'),
-
- isStep10: function () {
- return this.get('currentStep') == 10;
- }.property('currentStep'),
-
- gotoStep1: function () {
- if (this.get('isStepDisabled').findProperty('step', 1).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep1');
- }
-
- },
-
- gotoStep2: function () {
- if (this.get('isStepDisabled').findProperty('step', 2).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep2');
- }
-
- },
-
- gotoStep3: function () {
- if (this.get('isStepDisabled').findProperty('step', 3).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep3');
- }
-
- },
-
- gotoStep4: function () {
-
- if (this.get('isStepDisabled').findProperty('step', 4).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep4');
- }
- },
-
- gotoStep5: function () {
- if (this.get('isStepDisabled').findProperty('step', 5).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep5');
- }
- },
-
- gotoStep6: function () {
- if (this.get('isStepDisabled').findProperty('step', 6).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep6');
- }
-
- },
-
- gotoStep7: function () {
- if (this.get('isStepDisabled').findProperty('step', 7).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep7');
- }
- },
-
- gotoStep8: function () {
- if (this.get('isStepDisabled').findProperty('step', 8).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep8');
- }
- },
-
- gotoStep9: function () {
- if (this.get('isStepDisabled').findProperty('step', 9).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep9');
- }
- },
-
- gotoStep10: function () {
- if (this.get('isStepDisabled').findProperty('step', 10).get('value') === true) {
- return;
- } else {
- App.router.send('gotoStep10');
- }
- },
-
content: Em.Object.create({
cluster: null,
hosts: null,
@@ -691,10 +498,11 @@ App.InstallerController = Em.Controller.extend({
* Generate serviceComponents as pr the stack definition and save it to localdata
* called form stepController step4WizardController
*/
- loadComponents: function (stepController) {
+ loadServiceComponents : function (stepController, displayOrderConfig, apiUrl) {
var self = this;
var method = 'GET';
- var url = (App.testMode) ? '/data/wizard/stack/hdp/version0.1.json' : App.apiPrefix + '/stacks/HDP/version/1.2.0'; // TODO: get this url from the stack selected by the user in Install Options page
+ var testUrl = '/data/wizard/stack/hdp/version/1.2.0.json';
+ var url = (App.testMode) ? testUrl : App.apiPrefix + apiUrl;
$.ajax({
type: method,
url: url,
@@ -703,14 +511,45 @@ App.InstallerController = Em.Controller.extend({
timeout: App.timeout,
success: function (data) {
var jsonData = jQuery.parseJSON(data);
- console.log("TRACE: STep5 -> In success function for the getServiceComponents call");
- console.log("TRACE: STep5 -> value of the url is: " + url);
- var serviceComponents = [];
- jsonData.services.forEach(function (_service) {
+ console.log("TRACE: getService ajax call -> In success function for the getServiceComponents call");
+ console.log("TRACE: jsonData.services : " + jsonData.services);
+
+ // Creating Model
+ var Service = Ember.Object.extend({
+ serviceName: null,
+ displayName: null,
+ isDisabled: true,
+ isSelected: true,
+ description:null,
+ version:null
+ });
+
+ var data = [];
+
+ // loop through all the service components
+ for (var i = 0 ; i < displayOrderConfig.length ; i++) {
+ var entry = jsonData.services.filterProperty("name",displayOrderConfig[i].serviceName)[0];
- }, this);
- stepController.set('components', jsonData.services);
+ // dont show the service whose isHidden is true
+ if ( displayOrderConfig[i].isHidden ) {
+ continue;
+ }
+
+ var myService = Service.create({
+ serviceName: entry.name,
+ displayName: displayOrderConfig[i].displayName,
+ isDisabled: i === 0 ,
+ isSelected: true,
+ description: entry.comment,
+ version: entry.version
+ });
+
+ data.push(myService);
+ }
+
+ stepController.set('serviceComponents', data);
console.log('TRACE: service components: ' + JSON.stringify(stepController.get('components')));
+
},
error: function (request, ajaxOptions, error) {
@@ -32,7 +32,7 @@ App.MainChartsHeatmapController = Em.Controller.extend({
* @param event
*/
routeHostDetail: function(event){
- App.router.transitionTo('main.hostDetails.summary', event.context)
+ App.router.transitionTo('main.hosts.hostDetails.summary', event.context)
},
showHeatMapMetric: function (event) {
var metricItem = event.context;
Oops, something went wrong. Retry.

0 comments on commit c357ac4

Please sign in to comment.