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 2013/01/10 21:11:40 UTC
svn commit: r1431599 [2/2] - in /incubator/ambari/trunk/ambari-web/app:
assets/data/apps/ assets/data/wizard/stack/hdp/version01/ controllers/main/
controllers/wizard/ data/ mappers/ models/ routes/ styles/ templates/main/
templates/main/apps/ template...
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/apps/list_row.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/apps/list_row.hbs?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/apps/list_row.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/apps/list_row.hbs Thu Jan 10 20:11:39 2013
@@ -25,4 +25,4 @@
<td>{{unbound run.inputFormatted}}</td>
<td>{{unbound run.outputFormatted}}</td>
<td>{{unbound run.duration}}</td>
-<td>{{unbound run.lastUpdateTimeFormatted}} {{#if run.isRunning}}<b class='red'>*</b>{{/if}}</td>
\ No newline at end of file
+<td ><span title="{{unbound run.lastUpdateTimeFormatted}}">{{unbound run.lastUpdateTimeFormattedShort}}</span> {{#if run.isRunning}}<b class='red'>*</b>{{/if}}</td>
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs Thu Jan 10 20:11:39 2013
@@ -50,7 +50,7 @@
{{#view view.ComponentView contentBinding="component"}}
<div class="span8">
<span {{bindAttr class="view.statusClass"}}></span>
- {{component.componentName}} /
+ {{component.displayName}} /
<a href="#" {{action routeToService component.service target="controller" }}>{{component.service.displayName}}</a>
</div>
<div class="span4">
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs Thu Jan 10 20:11:39 2013
@@ -17,7 +17,6 @@
}}
{{view App.MainServiceInfoMenuView configTabBinding="view.hasConfigTab"}}
-{{#unless controller.content.isClients}}
{{#if controller.isAdmin}}
<div class="service-button">
{{#if view.hasMaintenanceControl}}
@@ -48,5 +47,4 @@
</a>
</div>
{{/if}}
-{{/unless}}
{{outlet}}
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs Thu Jan 10 20:11:39 2013
@@ -17,9 +17,7 @@
}}
<a href="#/main/services/{{unbound view.content.id}}/summary">
- {{#unless view.content.isClients}}
{{view App.MainDashboardServiceHealthView class="service-health" serviceBinding="view.content"}}
- {{/unless}}
<span>{{unbound view.content.displayName}}</span>
{{#if view.alertsCount}}
<span class="label operations-count">
Modified: incubator/ambari/trunk/ambari-web/app/utils/data_table.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/data_table.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/data_table.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/data_table.js Thu Jan 10 20:11:39 2013
@@ -34,6 +34,7 @@ jQuery.extend(jQuery.fn.dataTableExt.oSo
// @see utils/date.js
"ambari-datetime-pre": function (date_string) {
date_string = $.trim(date_string.replace(/<script[^>]*?>.*<\/script>/g, ''));
+ date_string = $(date_string).attr('title');
var date = date_string.substring(4);
var month = date.substring(1, 4);
var day = date.substring(5, 7);
@@ -299,8 +300,8 @@ jQuery.extend($.fn.dataTableExt.afnFilte
function ambariDateFilter(condition, rowValue) {
if (typeof rowValue !== 'undefined') {
- var refinedRowValue = $.trim(rowValue.replace(/<script[^>]*?>.*<\/script>/g, '').replace(' ', ''));
-
+ var refinedRowValue = $.trim(rowValue.replace(/<script[^>]*?>.*<\/script>/g, ''));
+ refinedRowValue = $(refinedRowValue).attr('title');
var nowTime = new Date().getTime();
var oneDayPast = nowTime - 86400000;
var twoDaysPast = nowTime - 172800000;
Modified: incubator/ambari/trunk/ambari-web/app/utils/date.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/date.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/date.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/date.js Thu Jan 10 20:11:39 2013
@@ -56,6 +56,30 @@ module.exports = {
return year + month + day + hours + minutes;
},
/**
+ * Convert timestamp to date-string 'DAY_OF_THE_WEEK MONTH DAY YEAR'
+ * @param timestamp
+ * @return {*}
+ */
+ dateFormatShort: function(timestamp) {
+ if (!validator.isValidInt(timestamp)) return timestamp;
+
+ var date = new Date(timestamp*1);
+ var today = new Date();
+ if (date.toDateString() === today.toDateString()) {
+ return 'Today ' + date.toLocaleTimeString();
+ }
+ return date.toDateString();
+ },
+ /**
+ * Convert date-string 'DAY_OF_THE_WEEK MONTH DAY YEAR' to the timestamp
+ * @param date_string
+ * @return {Number}
+ */
+ dateUnformatShort: function(date_string) {
+ var date = new Date(date_string);
+ return date.getTime();
+ },
+ /**
* Convert time in mseconds to 'HOURS:MINUTES:SECONDS'
* @param ms_interval
* @return string formatted date
Modified: incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/apps_view.js Thu Jan 10 20:11:39 2013
@@ -42,7 +42,7 @@ App.MainAppsView = Em.View.extend({
* List of users
*/
users: function() {
- var result = new Array();
+ var result = [];
this.get('content').forEach(function(item) {
result.push(item.get('userName'));
});
@@ -56,6 +56,10 @@ App.MainAppsView = Em.View.extend({
* jQuery collection of stars icons (in dataTables). Saved here for easy "turning off"
*/
smallStarsIcons: null,
+
+ stared: function() {
+ return this.get('controller.staredRunsLength');
+ }.property('controller.staredRunsLength'),
/**
* Count of filtered runs
*/
@@ -79,13 +83,13 @@ App.MainAppsView = Em.View.extend({
* Avg data of filtered runs
*/
filteredData: function() {
- return this.getAvgData(this.get('controller.filteredRuns'));
+ return this.getAvgData(this.get('controller.content').filterProperty('isFiltered', true));
}.property('controller.filteredRunsLength'),
/**
* Avg data of stared runs
*/
staredData: function() {
- return this.getAvgData(this.get('controller.staredRuns'));
+ return this.getAvgData(this.get('controller.content').filterProperty('isStared', true));
}.property('controller.staredRunsLength'),
setFilteredRuns: function(data) {
@@ -172,7 +176,6 @@ App.MainAppsView = Em.View.extend({
minOutput = misc.formatBandwidth(minOutput);
maxOutput = misc.formatBandwidth(maxOutput);
ret = {
- 'count': this.get('controller.staredRuns').length,
'jobs': {
'avg': avgJobs.toFixed(2),
'min': minJobs,
@@ -208,13 +211,15 @@ App.MainAppsView = Em.View.extend({
this.set('whatAvgShow', !this.get('whatAvgShow'));
$('a.icon-star.a').toggleClass('active');
},
+ /**
+ *
+ */
starClicked: function() {
var runIndex = this.get('controller.lastStarClicked');
- if (runIndex < 0) return;
if (!this.get('oTable')) return;
var rowIndex = -1;
// Get real row index
- var column = this.get('oTable').fnGetColumnData(1);
+ var column = this.get('oTable').fnGetColumnData(1); // 1 - number of column with full runId (hidden)
for (var i = 0; i < column.length; i++) {
if (runIndex == column[i]) {
rowIndex = i;
@@ -231,34 +236,31 @@ App.MainAppsView = Em.View.extend({
if (perPage !== -1) { // Change page after reDraw (if show All is selected this will not happens)
this.get('oTable').fnPageChange(Math.floor(rowIndex / perPage));
}
- var d = this.get('oTable').fnGetData();
}.observes('controller.lastStarClicked'),
/**
* Flush all starred runs
*/
clearStars: function() {
- this.get('controller').set('staredRuns', []);
+ this.get('controller').get('content').setEach('isStared', false);
this.get('controller').set('staredRunsLength', 0);
this.set('viewType', this.get('defaultViewType'));
this.set('whatAvgShow', true);
+ this.get('smallStarsIcons').removeClass('stared');
+ $('#dataTable .icon-star').removeClass('stared');
$('a.icon-star.a').removeClass('active');
},
/**
* "turn off" stars in the table
*/
resetStars: function() {
- var self = this;
- if (this.get('controller.staredRunsLength') == 0 && this.get('smallStarsIcons') != null) {
+ /*var self = this;
+ if (this.get('controller.staredRunsLength') != 0 && this.get('smallStarsIcons') != null) {
this.get('smallStarsIcons').removeClass('stared');
$('#dataTable .icon-star').removeClass('stared');
$('a.icon-star.a').removeClass('active');
this.get('starFilterViewInstance').set('value', '');
- /*$('#dataTable tbody tr').each(function(index) {
- var td = $(this).find('td:eq(0)');
- self.get('oTable').fnUpdate( td.html(), index, 0);
- });*/
this.updateStars();
- }
+ }*/
}.observes('controller.staredRunsLength'),
/**
* Update stars data in dataTable. data taken from page
@@ -292,6 +294,9 @@ App.MainAppsView = Em.View.extend({
clickViewType: function(event) {
this.set('viewType', $(event.target).data('view-type'));
},
+ /**
+ *
+ */
onChangeViewType: function(){
var viewType = this.get('viewType');
var table = this.get('oTable');
@@ -327,6 +332,7 @@ App.MainAppsView = Em.View.extend({
var smallStars = $('#dataTable .icon-star');
var self = this;
this.set('smallStarsIcons', smallStars);
+ var d = new Date();
var oTable = this.$('#dataTable').dataTable({
"sDom": '<"search-bar"f><"clear">rt<"page-bar"lip><"clear">',
"fnDrawCallback": function( oSettings ) {
@@ -374,17 +380,24 @@ App.MainAppsView = Em.View.extend({
this.set('filtered', oTable.fnSettings().fnRecordsDisplay());
// If we have some starred runs, mark them again
- var staredRuns = this.get('controller.staredRuns');
+ var staredRuns = [];
+ this.get('controller.').get('content').filterProperty('isStared', true).forEach(function(run) {
+ staredRuns.push(run.get('id'));
+ });
this.clearStars();
+ var tr = $('#dataTable').find('tr');
staredRuns.forEach(function(item) {
- $('#dataTable').find('tr').each(function() {
- if ($(this).find('td.appId:eq(0)').attr('title') == item.get('id')) {
- $(this).find('td a:eq(0) span').trigger('click');
+ tr.each(function() {
+ if ($(this).find('td.appId:eq(0)').attr('title') == item) {
+ return $(this).find('td a:eq(0) span').trigger('click');
}
});
});
this.get('oTable').fnSettings()._iDisplayLength = 10;
this.get('oTable').fnDraw(false);
+ console.log('Rendering Apps Table:');
+ console.log('Start - ', d.toLocaleTimeString());
+ console.log('End - ', (new Date()).toLocaleTimeString());
},
loaded: false,
@@ -409,7 +422,7 @@ App.MainAppsView = Em.View.extend({
}.observes('App.router.clusterController.postLoadList.runs'),
didInsertElement: function () {
- $('#dataTable').css('visibility', 'hidden');
+ $('#dataTable').css('visibility', 'hidden'); // hide table before dataTables id initialized
this.set('inserted', true);
this.onLoad();
},
@@ -431,6 +444,7 @@ App.MainAppsView = Em.View.extend({
}
});
this.get('oTable').fnFilterClear();
+ //this.get('controller').clearFilteredRuns();
this.set('viewType', this.get('defaultViewType'));
this.set('filtered',this.get('oTable').fnSettings().fnRecordsDisplay());
this.setFilteredRuns(this.get('oTable')._('tr', {"filter":"applied"}));
Modified: incubator/ambari/trunk/ambari-web/app/views/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/host.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/host.js Thu Jan 10 20:11:39 2013
@@ -237,6 +237,7 @@ App.MainHostView = Em.View.extend({
toggleAllComponents:function () {
this.set('masterComponentsChecked', this.get('allComponentsChecked'));
this.set('slaveComponentsChecked', this.get('allComponentsChecked'));
+ this.set('clientComponentsChecked', this.get('allComponentsChecked'));
}.observes('allComponentsChecked'),
masterComponentsChecked:false,
@@ -255,6 +256,14 @@ App.MainHostView = Em.View.extend({
});
}.observes('slaveComponentsChecked'),
+ clientComponentsChecked: false,
+ toggleClientComponents: function() {
+ var checked = this.get('clientComponentsChecked');
+ this.get('clientComponents').forEach(function(comp) {
+ comp.set('checkedForHostFilter', checked);
+ });
+ }.observes('clientComponentsChecked'),
+
masterComponents:function(){
var masterComponents = [];
for(var i = 0; i < this.get('parentView').get('controller.masterComponents').length; i++) {
@@ -271,6 +280,14 @@ App.MainHostView = Em.View.extend({
return slaveComponents;
}.property('parentView.controller.slaveComponents'),
+ clientComponents: function() {
+ var clientComponents = [];
+ for (var i = 0; i < this.get('parentView').get('controller.clientComponents').length; i++) {
+ clientComponents.push(this.get('parentView').get('controller.clientComponents')[i]);
+ }
+ return clientComponents;
+ }.property('parentView.controller.clientComponents'),
+
template: Ember.Handlebars.compile('<div {{bindAttr class="view.btnGroupClass"}} >'+
'<button class="btn btn-info single-btn-group" {{action "clickFilterButton" target="view"}}>' +
'Components ' +
@@ -312,6 +329,20 @@ App.MainHostView = Em.View.extend({
'{{/each}}' +
'</ul>' +
'</li>' +
+ '<li>' +
+ '<label class="checkbox">' +
+ '{{view Ember.Checkbox checkedBinding="view.clientComponentsChecked"}} Client Components:' +
+ '</label>' +
+ '<ul>' +
+ '{{#each component in clientComponents}}' +
+ '<li>' +
+ '<label class="checkbox">' +
+ '{{view Ember.Checkbox checkedBinding="component.checkedForHostFilter" }} {{unbound component.displayName}}' +
+ '</label>' +
+ '</li>' +
+ '{{/each}}' +
+ '</ul>' +
+ '</li>' +
'</li>' +
'</ul>' +
'</li>' +
@@ -370,6 +401,9 @@ App.MainHostView = Em.View.extend({
this.get('slaveComponents').forEach(function(item){
if(item.get('checkedForHostFilter')) chosenComponents.push(item.get('displayName'));
});
+ this.get('clientComponents').forEach(function(item){
+ if(item.get('checkedForHostFilter')) chosenComponents.push(item.get('displayName'));
+ });
jQuery('#components_filter').val(chosenComponents);
this.get('parentView').get('applyFilter')(this.get('parentView'), 9);
if (chosenComponents.length == 0) {
Modified: incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/host/summary.js Thu Jan 10 20:11:39 2013
@@ -94,13 +94,9 @@ App.MainHostSummaryView = Em.View.extend
var slaveComponents = [];
var masterComponents = [];
this.get('content.components').forEach(function(component){
- if(!component.get('componentName')){
- //temporary fix because of different data in hostComponents and serviceComponents
- return;
- }
if(component.get('isMaster')){
masterComponents.push(component);
- } else if(!component.get('isClient')) {
+ } else if(component.get('isSlave')) {
slaveComponents.push(component);
}
}, this);
@@ -109,7 +105,11 @@ App.MainHostSummaryView = Em.View.extend
clients: function(){
var clients = [];
this.get('content.components').forEach(function(component){
- if(component.get('isClient')) {
+ if(!component.get('componentName')){
+ //temporary fix because of different data in hostComponents and serviceComponents
+ return;
+ }
+ if(!component.get('isSlave') && !component.get('isMaster')) {
if(clients.length){
clients[clients.length-1].set('isLast', false);
}
Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js Thu Jan 10 20:11:39 2013
@@ -18,9 +18,7 @@
var App = require('app');
App.MainServiceInfoSummaryView = Em.View.extend({
- templateName:function () {
- return require(this.get('service.isClients') ? 'templates/main/service/info/client_summary' : 'templates/main/service/info/summary');
- }.property('service'),
+ templateName: require('templates/main/service/info/summary'),
attributes:null,
serviceStatus:{
hdfs:false,
Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js?rev=1431599&r1=1431598&r2=1431599&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/menu.js Thu Jan 10 20:11:39 2013
@@ -26,8 +26,6 @@ App.MainServiceMenuView = Em.CollectionV
}
return true;
});
-
- items.push(App.router.get('mainServiceController.additionalMenuItem'));
return items;
}.property('App.router.mainServiceController.content'),
@@ -70,10 +68,6 @@ App.MainServiceMenuView = Em.CollectionV
}
return 0;
}.property('App.router.clusterController.alerts'),
- clients: function(){
- var content = this.get('content');
- return this.get('content.isClients') ? "clients" : "";
- }.property("content"),
templateName:require('templates/main/service/menu_item')
})
});
\ No newline at end of file