Author: yusaku
Date: Sat Jan 19 02:47:45 2013
New Revision: 1435476
URL: http://svn.apache.org/viewvc?rev=1435476&view=rev
Log:
AMBARI-1197. Refactor code for graphs. (yusaku)
Added:
incubator/ambari/trunk/ambari-web/app/classes/
incubator/ambari/trunk/ambari-web/app/classes/job_class.js
incubator/ambari/trunk/ambari-web/app/classes/run_class.js
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/global/background_operations_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
incubator/ambari/trunk/ambari-web/app/styles/apps.less
Added: incubator/ambari/trunk/ambari-web/app/classes/job_class.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/classes/job_class.js?rev=1435476&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/classes/job_class.js (added)
+++ incubator/ambari/trunk/ambari-web/app/classes/job_class.js Sat Jan 19
02:47:45 2013
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+var date = require('utils/date');
+var misc = require('utils/misc');
+
+App.Job2 = Ember.Object.extend({
+
+ id: "", //string
+ jobName: "", //string
+ workflowEntityName: "", //string
+ maps: 0, //number
+ reduces: 0, //number
+ status: "", //string
+ input: 0, //number
+ output: 0, //number
+ elapsedTime: 0, //number
+
+ duration: function() {
+ return date.timingFormat(parseInt(this.get('elapsedTime')));
+ }.property('elapsedTime'),
+
+ inputFormatted: function () {
+ return misc.formatBandwidth(this.get('input'));
+ }.property('input'),
+
+ outputFormatted: function () {
+ return misc.formatBandwidth(this.get('output'));
+ }.property('output')
+
+});
Added: incubator/ambari/trunk/ambari-web/app/classes/run_class.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/classes/run_class.js?rev=1435476&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/classes/run_class.js (added)
+++ incubator/ambari/trunk/ambari-web/app/classes/run_class.js Sat Jan 19
02:47:45 2013
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+var date = require('utils/date');
+var misc = require('utils/misc');
+
+App.Run2 = Ember.Object.extend({
+ id: null, //string
+ appName: null, //string
+ userName: null, //string
+ numJobsTotal: 0, //number
+ numJobsCompleted: 0, //number
+ startTime: 0, //number
+ elapsedTime: 0, //number
+ workflowContext: null, //string
+ input: 0, //number
+ output: 0, //number
+
+ /**
+ * Will set to true when we load all jobs related to this run
+ */
+ loadAllJobs : false,
+
+ /**
+ * runId short part
+ */
+ idFormatted: function() {
+ return this.get('id').substr(0, 20);
+ }.property('id'),
+
+ /**
+ * Run duration
+ */
+ duration: function() {
+ return date.timingFormat(this.get('elapsedTime'));
+ }.property('elapsedTime'),
+
+ /**
+ * Status of running jobs
+ */
+ isRunning: function () {
+ return !this.get('numJobsTotal') == this.get('numJobsCompleted');
+ }.property('numJobsTotal', 'numJobsCompleted'),
+
+ /**
+ * Sum of input bandwidth for all jobs with appropriate measure
+ */
+ inputFormatted: function () {
+ return misc.formatBandwidth(this.get('input'));
+ }.property('input'),
+
+ /**
+ * Sum of output bandwidth for all jobs with appropriate measure
+ */
+ outputFormatted: function () {
+ return misc.formatBandwidth(this.get('output'));
+ }.property('output'),
+
+ lastUpdateTime: function() {
+ return this.get('startTime') + this.get('elapsedTime');
+ }.property('elapsedTime', 'startTime'),
+
+ lastUpdateTimeFormatted: function() {
+ return date.dateFormat(this.get('lastUpdateTime'));
+ }.property('lastUpdateTime'),
+
+ lastUpdateTimeFormattedShort: function(){
+ return date.dateFormatShort(this.get('lastUpdateTime'));
+ }.property('lastUpdateTime'),
+
+ /**
+ * Type value based on first part of id
+ */
+ type: function() {
+ if (this.get('id').indexOf('pig_') === 0) {
+ return 'Pig';
+ }
+ if (this.get('id').indexOf('hive_') === 0) {
+ return 'Hive';
+ }
+ if (this.get('id').indexOf('mr_') === 0) {
+ return 'MapReduce';
+ }
+ return 'Undefined';
+ }.property('id')
+});
\ No newline at end of file
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/global/background_operations_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/global/background_operations_controller.js?rev=1435476&r1=1435475&r2=1435476&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/global/background_operations_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/global/background_operations_controller.js
Sat Jan 19 02:47:45 2013
@@ -160,7 +160,6 @@ App.BackgroundOperationsController = Em.
if (executeTasks[i].status == 'QUEUED' || executeTasks[i].status ==
'PENDING' || executeTasks[i].status == 'IN_PROGRESS') {
var url = App.testMode ?
'/data/background_operations/list_on_start.json' :
App.apiPrefix + '/clusters/' + App.router.getClusterName() +
'/requests/' + executeTasks[i].request_id + '/tasks/' + executeTasks[i].id;
- var j = i;
$.ajax({
type: "GET",
url: url,
@@ -168,7 +167,11 @@ App.BackgroundOperationsController = Em.
timeout: App.timeout,
success: function (data) {
if (data) {
- executeTasks[j] = data.Tasks;
+ for(var i = 0;i < executeTasks.length; i++){
+ if(data.Tasks.id == executeTasks[i].id){
+ executeTasks[i] = data.Tasks;
+ }
+ }
}
},
error: function () {
@@ -179,7 +182,6 @@ App.BackgroundOperationsController = Em.
});
}
}
- ;
var currentTasks;
currentTasks = runningTasks.concat(executeTasks);
currentTasks = currentTasks.sort(function (a, b) {
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js?rev=1435476&r1=1435475&r2=1435476&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
Sat Jan 19 02:47:45 2013
@@ -21,6 +21,10 @@ var App = require('app');
App.WizardStep10Controller = Em.Controller.extend({
clusterInfo: [],
+ /**
+ * check if were added regionservers then NAGIOS services should be restarted
+ * to update number of regionservers in NAGIOS
+ */
isNagiosRestartRequired: function() {
return this.get('content.controllerName') !== 'installerController' &&
App.Service.find('NAGIOS').get('isLoaded');
}.property(),
Modified: incubator/ambari/trunk/ambari-web/app/styles/apps.less
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/apps.less?rev=1435476&r1=1435475&r2=1435476&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/apps.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/apps.less Sat Jan 19 02:47:45
2013
@@ -21,9 +21,13 @@
td .red {
color: red;
}
- .table thead th{
- vertical-align: top;
- padding-right: 4px;
+ .table {
+ thead {
+ th{
+ padding-left: 0 !important;
+ vertical-align: top;
+ }
+ }
}
.avg-table {
table-layout: fixed;
@@ -41,6 +45,7 @@
#dataTable {
table-layout: fixed;
td {
+ padding-right: 4px;
word-wrap: break-word;
}
}
@@ -48,9 +53,6 @@
.dropdown-menu label.checkbox {
margin-left: 10px;
}
- .dropdown-menu label.checkbox {
- margin-left: 10px;
- }
.icon-star{
color: gray;
&.stared {