Return-Path: X-Original-To: apmail-incubator-ambari-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ambari-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CB7A3EB64 for ; Fri, 11 Jan 2013 23:41:37 +0000 (UTC) Received: (qmail 96718 invoked by uid 500); 11 Jan 2013 23:41:37 -0000 Delivered-To: apmail-incubator-ambari-commits-archive@incubator.apache.org Received: (qmail 96694 invoked by uid 500); 11 Jan 2013 23:41:37 -0000 Mailing-List: contact ambari-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@incubator.apache.org Delivered-To: mailing list ambari-commits@incubator.apache.org Received: (qmail 96685 invoked by uid 99); 11 Jan 2013 23:41:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2013 23:41:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2013 23:41:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3116D23889F7; Fri, 11 Jan 2013 23:41:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1432332 [3/3] - in /incubator/ambari/branches/branch-1.2: ./ ambari-agent/ ambari-agent/src/main/puppet/modules/hdp-mysql/files/ ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/ ambari-agent/src/main/python/ambari_agent/ ambari-ag... Date: Fri, 11 Jan 2013 23:41:09 -0000 To: ambari-commits@incubator.apache.org From: mahadev@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130111234114.3116D23889F7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step2.hbs URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step2.hbs?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step2.hbs (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step2.hbs Fri Jan 11 23:41:06 2013 @@ -33,6 +33,19 @@

+ {{#if view.parentView.controller.hideBackButton}} + {{#if view.hostsInfo.oldHostNames }} +

+ {{t hosts.add.step2.warning}} +
+ {{{view.hostsInfo.oldHostNames}}} + {{#if view.hostsInfo.showMoreHostsText}} + {{view.hostsInfo.showMoreHostsText}} + {{/if}} +

+ {{/if}} + {{/if}} +
{{view Ember.TextArea class="span6" valueBinding="content.installOptions.hostNames" rows="5" placeholder="host names"}} {{#if hostsError}} @@ -46,38 +59,30 @@
{{t installer.step2.sshKey}}
-
@@ -104,6 +109,7 @@ rel="popover" {{translateAttr title="installer.step2.javaHome.tooltip.title" data-content="installer.step2.javaHome.tooltip.content"}}> {{t installer.step2.javaHome.tooltip.title}} + {{t installer.step2.javaHome.label2}}
{{view App.WizardTextField valueBinding="content.installOptions.javaHome" placeholder="/usr/jdk/jdk1.6.0_31"}} Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step9HostTasksLogPopup.hbs URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step9HostTasksLogPopup.hbs?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step9HostTasksLogPopup.hbs (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/templates/wizard/step9HostTasksLogPopup.hbs Fri Jan 11 23:41:06 2013 @@ -57,8 +57,8 @@
-
Copy
-
Open
+
+
Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/utils/data_table.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/utils/data_table.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/utils/data_table.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/utils/data_table.js Fri Jan 11 23:41:06 2013 @@ -198,7 +198,7 @@ jQuery.extend($.fn.dataTableExt.afnFilte break; case 'ambari-bandwidth': if (cellValue && match) { - bandwidthFilter(cellValue, aData[inputFilters[i].iColumn], inputFilters[i].iColumn); + bandwidthFilter(cellValue, aData[inputFilters[i].iColumn]); } break; case 'star': @@ -220,8 +220,7 @@ jQuery.extend($.fn.dataTableExt.afnFilte match = false; rowValue = (jQuery(rowValue).text()) ? jQuery(rowValue).text() : rowValue; for (var i = 0; i < options.length; i++) { - var str = new RegExp('(\\W|^)' + options[i] + '(\\W|$)'); - if (rowValue.search(str) !== -1) match = true; + if (rowValue.indexOf(options[i]) !== -1) match = true; } } @@ -255,27 +254,17 @@ jQuery.extend($.fn.dataTableExt.afnFilte } } - function bandwidthFilter(rangeExp, rowValue, iColumn) { + function bandwidthFilter(rangeExp, rowValue) { //rowValue = $(rowValue).text(); - var compareChar = isNaN(rangeExp.charAt(0)) ? rangeExp.charAt(0) : false; + var compareChar = rangeExp.charAt(0); var compareScale = rangeExp.charAt(rangeExp.length - 1); - var compareValue = compareChar ? parseFloat(rangeExp.substr(1, rangeExp.length)) : parseFloat(rangeExp.substr(0, rangeExp.length)); + var compareValue = isNaN(parseFloat(compareScale)) ? parseFloat(rangeExp.substr(1, rangeExp.length - 2)) : parseFloat(rangeExp.substr(1, rangeExp.length - 1)); switch (compareScale) { - case 'g': - compareValue *= 1073741824; - break; case 'm': compareValue *= 1048576; break; - case 'k': - compareValue *= 1024; - break; default: - if (iColumn=='4') { - compareValue *= 1073741824; - } else { - compareValue *= 1024; - } + compareValue *= 1024; } rowValue = (jQuery(rowValue).text()) ? jQuery(rowValue).text() : rowValue; @@ -291,9 +280,6 @@ jQuery.extend($.fn.dataTableExt.afnFilte case 'MB': convertedRowValue = parseFloat(rowValue)*1048576; break; - case 'GB': - convertedRowValue = parseFloat(rowValue)*1073741824; - break; } } match = false; @@ -304,10 +290,11 @@ jQuery.extend($.fn.dataTableExt.afnFilte case '>': if (compareValue < convertedRowValue) match = true; break; - case false: case '=': if (compareValue == convertedRowValue) match = true; break; + default: + match = false; } } Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/utils/validator.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/utils/validator.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/utils/validator.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/utils/validator.js Fri Jan 11 23:41:06 2013 @@ -35,21 +35,6 @@ module.exports = { var floatRegex = /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/; return floatRegex.test(value); }, - /** - * validate directory with slash at the start - * @param value - * @return {Boolean} - */ - isValidDir: function(value){ - var floatRegex = /^\/[0-9a-z]*/; - var dirs = value.replace(/,/g,' ').trim().split(new RegExp("\\s+", "g")); - for(var i = 0; i < dirs.length; i++){ - if(!floatRegex.test(dirs[i])){ - return false; - } - } - return true; - }, /** * validate ip address with port Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views.js Fri Jan 11 23:41:06 2013 @@ -22,6 +22,7 @@ require('views/application'); require('views/common/chart'); +require('views/common/combobox'); require('views/common/chart/pie'); require('views/common/chart/linear'); require('views/common/chart/linear_time'); @@ -30,8 +31,10 @@ require('views/common/metric'); require('views/common/time_range'); require('views/common/form/field'); require('views/common/quick_view_link_view'); +require('views/common/empty_view'); require('views/login'); require('views/main'); +require('views/main/test'); require('views/main/menu'); require('views/main/charts'); require('views/main/host'); @@ -39,6 +42,7 @@ require('views/main/host/details'); require('views/main/host/menu'); require('views/main/host/summary'); require('views/main/host/metrics'); +require('views/main/host/audit'); require('views/main/host/add_view'); require('views/main/host/metrics/cpu'); require('views/main/host/metrics/disk'); @@ -52,6 +56,7 @@ require('views/main/admin/advanced/passw require('views/main/admin/audit'); require('views/main/admin/authentication'); require('views/main/admin/menu'); +require('views/main/admin/security'); require('views/main/admin/user'); require('views/main/admin/user/create'); require('views/main/admin/user/edit'); @@ -73,7 +78,9 @@ require('views/main/service/menu'); require('views/main/service/item'); require('views/main/service/info/menu'); require('views/main/service/info/summary'); +require('views/main/service/info/metrics'); require('views/main/service/info/configs'); +require('views/main/service/info/audit'); require('views/main/service/info/metrics/hdfs/jvm_threads'); require('views/main/service/info/metrics/hdfs/jvm_heap'); require('views/main/service/info/metrics/hdfs/io'); @@ -99,6 +106,8 @@ require('views/main/service/info/metrics require('views/main/service/add_view'); require('views/main/charts/menu'); require('views/main/charts/heatmap'); +require('views/main/charts/horizon'); +require('views/main/charts/horizon/chart'); require('views/main/charts/heatmap/heatmap_rack'); require('views/main/charts/heatmap/heatmap_host'); require('views/main/charts/heatmap/heatmap_host_detail'); Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/combobox.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/combobox.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/combobox.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/combobox.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,80 @@ +/** + * 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.Combobox = Em.Select.extend({ + classNames:['combobox'], + placeholderText:false, + disabled:false, + + input:function () { + return this.get('combobox').$element; + }.property('combobox'), + + button:function () { + return this.get('combobox').$button; + }.property('combobox'), + + toggleDisabling:function () { + var disabled = this.get('disabled') ? 'disabled' : false; + + this.get('input').attr('disabled', disabled); + this.get('button').attr('disabled', disabled); + + }.observes('disabled'), + + content:function () { + // convert DS.RecordsArray to array; + var content = [ + {} + ]; + var racks = this.get('recordArray'); + + racks.forEach(function (cluster, index) { + content.push(cluster); + }); + + return content; + }.property('recordArray'), + clearTextFieldValue:function () { + var options = []; + + this.get('combobox').$element.val(''); + this.get('combobox').clearTarget(); + + }, + + test:function () { + console.warn("qwerty"); + }, + + didInsertElement:function () { + this._super(); + + this.set('combobox', this.$().combobox({ + template:'
' + }).data('combobox')); + + this.clearTextFieldValue(); // fix of script tags in + + if (this.get('placeholderText')) { + this.get('combobox').$element.attr('placeholder', this.get('placeholderText')); + } + } +}); \ No newline at end of file Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/empty_view.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/empty_view.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/empty_view.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/empty_view.js Fri Jan 11 23:41:06 2013 @@ -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.EmptyView = Em.View.extend({ + tagName : '' +}); + Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/quick_view_link_view.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/quick_view_link_view.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/quick_view_link_view.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/common/quick_view_link_view.js Fri Jan 11 23:41:06 2013 @@ -25,15 +25,15 @@ App.QuickViewLinks = Em.View.extend({ */ quickLinks:function () { var serviceName = this.get('content.serviceName'); - var components = this.get('content.hostComponents'); + var components = this.get('content.components'); var host; if (serviceName === 'HDFS') { - host = components.findProperty('componentName', 'NAMENODE').get('host.publicHostName'); + host = components.filterProperty('id', 'NAMENODE').objectAt(0).get('host.publicHostName'); } else if (serviceName === 'MAPREDUCE') { - host = components.findProperty('componentName', 'JOBTRACKER').get('host.publicHostName'); + host = components.filterProperty('id', 'JOBTRACKER').objectAt(0).get('host.publicHostName'); } else if (serviceName === 'HBASE') { - host = components.findProperty('componentName', 'HBASE_MASTER').get('host.publicHostName'); + host = components.filterProperty('id', 'HBASE_MASTER').objectAt(0).get('host.publicHostName'); } if (!host) { return []; Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/admin/security.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/admin/security.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/admin/security.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/admin/security.js Fri Jan 11 23:41:06 2013 @@ -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.MainAdminSecurityView = Em.View.extend({ + templateName: require('templates/main/admin/security') +}); \ No newline at end of file Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/item/dag_view.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/item/dag_view.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/item/dag_view.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/item/dag_view.js Fri Jan 11 23:41:06 2013 @@ -62,29 +62,6 @@ App.MainAppsItemDagView = Em.View.extend }.observes('controller.content.loadAllJobs'), - resizeModal: function () { - var modal = $('.modal'); - var body = $('body'); - modal.find('.modal-body').first().css('max-height', 'none'); - var modalHeight = modal.height() + 300; - var bodyHeight = body.height(); - if (modalHeight > bodyHeight) { - modal.css('top', '20px'); - $('.modal-body').height(bodyHeight - 180); - } else { - modal.css('top', (bodyHeight - modalHeight) / 2 + 'px'); - } - - var modalWidth = modal.width(); - var bodyWidth = body.width(); - if (modalWidth > bodyWidth) { - modal.css('left', '10px'); - modal.width(bodyWidth - 20); - } else { - modal.css('left', (bodyWidth - modalWidth) / 2 + 'px'); - } - }, - didInsertElement: function(){ this.onLoad(); }, @@ -124,7 +101,6 @@ App.MainAppsItemDagView = Em.View.extend innerTable.fnSettings().oFeatures.bFilter = false; var dagSchema = this.get('controller.content.workflowContext'); var jobs = this.get('jobs'); - this.resizeModal(); var graph = new DagViewer(false, 'dag_viewer') .setPhysicalParametrs(this.$().width(), 300, -800, 0.01) .setData(dagSchema, jobs) Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/runs_view.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/runs_view.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/runs_view.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps/runs_view.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,17 @@ +/** + * 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. + */ Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps_view.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps_view.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps_view.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/apps_view.js Fri Jan 11 23:41:06 2013 @@ -206,16 +206,10 @@ App.MainAppsView = Em.View.extend({ /** * Click on big star on the avg block */ - avgStarClick: function () { - $('a.icon-star.a').toggleClass('active'); + avgStarClick: function() { + if (this.get('viewType') === 'starred') return; this.set('whatAvgShow', !this.get('whatAvgShow')); - if (!$('a.icon-star.a').hasClass('active')) { - if (this.get('viewType') === 'starred') { - this.set('viewType', 'filtered'); - } - } else { - this.set('viewType', 'starred'); - } + $('a.icon-star.a').toggleClass('active'); }, /** * @@ -325,7 +319,6 @@ App.MainAppsView = Em.View.extend({ this.showStared(); break; case 'filtered': - this.get('starFilterViewInstance').set('value', ''); table.fnSettings().oFeatures.bFilter = true; table.fnDraw(); break; @@ -338,7 +331,6 @@ App.MainAppsView = Em.View.extend({ * jQuery dataTable init */ createDataTable: function () { - $("[rel=popover]").popover({'placement': 'left', 'trigger': 'hover'}); var smallStars = $('#dataTable .icon-star'); var self = this; this.set('smallStarsIcons', smallStars); Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,25 @@ +/** + * 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.MainChartsHorizonView = Em.View.extend({ + templateName:require('templates/main/charts/horizon'), + classNames: ['horizon', 'charts'], + hosts: App.Host.find() +}); \ No newline at end of file Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon/chart.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon/chart.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon/chart.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/charts/horizon/chart.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,101 @@ +/** + * 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.MainChartsHorizonChartView = App.ChartView.extend({ + containerIdPrefix:'chartHistoricalMetrick', + classNames:['chart'], + chartOpened:0, + chartDrawn:false, + data:[], + healthStatusClass:function () { + return this.get('host.healthStatus') + ' ' + 'health'; + }.property('host.healthStatus'), + + templateName:require('templates/main/charts/horizon/chart'), + + chartClass:function () { + return this.get('chartOpened') ? "display" : "noDisplay"; + }.property('chartOpened'), + + showChartText:function () { + return this.t("charts.horizon.chart." + (this.get('chartOpened') ? "hideText" : "showText")); + }.property('chartOpened'), + + chartContainerSelector:function () { + return "#" + this.get('chartContainerId'); + }.property('chartContainerId'), + + chartContainerId:function () { + return this.get('containerIdPrefix') + this.get('host.id'); + }.property('host.id'), + + getNodeChartBlock:function () { + return $('#' + this.get('elementId') + ' div.chartBlock'); + }, + + drawChart:function () { + this._super(); + }.observes('dataLoaded'), + + loadHorizonInfo:function () { + var hostInfo = App.HostInfo.create({}); + var data = hostInfo.get('horizonData'); + this.set('data', data); + this.set('dataLoaded', Math.random()*10); + }, + + usedMetrics: function(){ + var thisW = this; + var attributes = []; + $.each(this.get('nodeAttributes'), function(){ + attributes.push(thisW.t('metric.'+this)); + }); + + return attributes; + + }.property('nodeAttributes'), + + nodeAttributes: function(){ + + console.warn("node attributes:", App.router.get('mainChartsController.metricWidget.chosenMetrics')); + + return App.router.get('mainChartsController.metricWidget.chosenMetrics'); + }.property('App.router.mainChartsController.metricWidget.chosenMetrics'), + + toggleChart:function () { + var thisChart = this; + var host = this.get('host'); + if (!this.get('chartOpened')) { // if chart will be opened + if (!this.get('chartDrawn')) { + this.drawPlot(); // parent method + this.set('chartDrawn', 1); + } + + this.loadHorizonInfo(); + this.addObserver('nodeAttributes', thisChart, 'drawPlot'); + this.addObserver('nodeAttributes', thisChart, 'loadHorizonInfo'); + } else { // if chart will be closed + this.removeObserver('nodeAttributes', thisChart, 'drawPlot'); + this.removeObserver('nodeAttributes', thisChart, 'loadHorizonInfo'); + } + + this.set('chartOpened', 1 - this.get('chartOpened')); + } +}); \ No newline at end of file Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service.js Fri Jan 11 23:41:06 2013 @@ -22,7 +22,7 @@ require('models/alert'); App.MainDashboardServiceHealthView = Em.View.extend({ classNameBindings: ["healthStatus"], - //template: Em.Handlebars.compile(""), + template: Em.Handlebars.compile(""), blink: false, tagName: 'span', @@ -71,7 +71,7 @@ App.MainDashboardServiceHealthView = Em. break; } - return 'health-status-' + status; + return 'health-status-' + status + " span"; }.property('service.healthStatus'), didInsertElement: function () { @@ -86,10 +86,6 @@ App.MainDashboardServiceView = Em.View.e return this.get('controller.data.' + this.get('serviceName')); }.property('controller.data'), - formatUnavailable: function(value){ - return (value || value == 0) ? value : this.t('services.service.summary.notAvailable'); - }, - criticalAlertsCount: function () { var alerts = App.router.get('clusterController.alerts'); return alerts.filterProperty('serviceType', this.get('service.id')).filterProperty('isOk', false).length; Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hbase.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hbase.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hbase.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hbase.js Fri Jan 11 23:41:06 2013 @@ -31,10 +31,6 @@ App.MainDashboardServiceHbaseView = App. return this.t('dashboard.services.hbase.masterServerHeap.summary').format(heapString, heapMaxString, percent.toFixed(1)); }.property('service.heapMemoryUsed', 'service.heapMemoryMax'), - version: function(){ - return this.formatUnavailable(this.get('service.version')); - }.property('service.version'), - summaryHeader: function () { var avgLoad = this.get('service.averageLoad'); if (avgLoad == null) { @@ -50,7 +46,7 @@ App.MainDashboardServiceHbaseView = App. averageLoad: function () { var avgLoad = this.get('service.averageLoad'); if (avgLoad == null) { - avgLoad = this.t('services.service.summary.notAvailable'); + avgLoad = this.t('services.service.summary.unknown'); } return this.t('dashboard.services.hbase.averageLoadPerServer').format(avgLoad); }.property("service.averageLoad"), @@ -65,7 +61,7 @@ App.MainDashboardServiceHbaseView = App. var formatted = date.timingFormat(diff); return this.t('dashboard.services.uptime').format(formatted); } - return this.t('services.service.summary.notRunning'); + return this.t('services.service.summary.unknown'); }.property("service.masterStartTime"), masterActivatedTime: function () { @@ -78,11 +74,11 @@ App.MainDashboardServiceHbaseView = App. var formatted = date.timingFormat(diff); return this.t('dashboard.services.uptime').format(formatted); } - return this.t('services.service.summary.notRunning'); + return this.t('services.service.summary.unknown'); }.property("service.masterActiveTime"), regionServerComponent: function () { - return App.HostComponent.find().findProperty('componentName', 'HBASE_REGIONSERVER'); + return App.Component.find().findProperty('componentName', 'HBASE_REGIONSERVER'); }.property('components'), isCollapsed: false, Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hdfs.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hdfs.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hdfs.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/hdfs.js Fri Jan 11 23:41:06 2013 @@ -31,36 +31,14 @@ App.MainDashboardServiceHdfsView = App.M }.property('service.capacityUsed', 'service.capacityTotal') }), - version: function(){ - return this.formatUnavailable(this.get('service.version')); - }.property('service.version'), - dfsTotalBlocks: function(){ - return this.formatUnavailable(this.get('service.dfsTotalBlocks')); - }.property('service.dfsTotalBlocks'), - dfsTotalFiles: function(){ - return this.formatUnavailable(this.get('service.dfsTotalFiles')); - }.property('service.dfsTotalFiles'), - dfsCorruptBlocks: function(){ - return this.formatUnavailable(this.get('service.dfsCorruptBlocks')); - }.property('service.dfsCorruptBlocks'), - dfsMissingBlocks: function(){ - return this.formatUnavailable(this.get('service.dfsMissingBlocks')); - }.property('service.dfsMissingBlocks'), - dfsUnderReplicatedBlocks: function(){ - return this.formatUnavailable(this.get('service.dfsUnderReplicatedBlocks')); - }.property('service.dfsUnderReplicatedBlocks'), - nodeUptime: function () { var uptime = this.get('service').get('nameNodeStartTime'); - if (uptime && uptime > 0){ - var diff = (new Date()).getTime() - uptime; - if (diff < 0) { - diff = 0; - } - var formatted = date.timingFormat(diff); - return this.t('dashboard.services.uptime').format(formatted); + var diff = (new Date()).getTime() - uptime; + if (diff < 0) { + diff = 0; } - return this.t('services.service.summary.notRunning'); + var formatted = date.timingFormat(diff); + return this.t('dashboard.services.uptime').format(formatted); }.property("service.nameNodeStartTime"), nodeWebUrl: function () { @@ -109,7 +87,7 @@ App.MainDashboardServiceHdfsView = App.M }.property('service.capacityUsed', 'service.capacityTotal'), dataNodeComponent: function () { - return App.HostComponent.find().findProperty('componentName', 'DATANODE'); + return App.Component.find().findProperty('componentName', 'DATANODE'); }.property('+'), isCollapsed: false, Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/mapreduce.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/mapreduce.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/mapreduce.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/dashboard/service/mapreduce.js Fri Jan 11 23:41:06 2013 @@ -31,22 +31,14 @@ App.MainDashboardServiceMapreduceView = }.property('_parentView.data.chart') }), - version: function(){ - return this.formatUnavailable(this.get('service.version')); - }.property('service.version'), - jobTrackerUptime: function () { var uptime = this.get('service').get('jobTrackerStartTime'); - if (uptime && uptime > 0){ - var diff = (new Date()).getTime() - uptime; - if (diff < 0) { - diff = 0; - } - var formatted = date.timingFormat(diff); - return this.t('dashboard.services.uptime').format(formatted); - + var diff = (new Date()).getTime() - uptime; + if (diff < 0) { + diff = 0; } - return this.t('services.service.summary.notRunning'); + var formatted = date.timingFormat(diff); + return this.t('dashboard.services.uptime').format(formatted); }.property("service.jobTrackerStartTime"), summaryHeader: function () { @@ -68,8 +60,8 @@ App.MainDashboardServiceMapreduceView = }.property('service.aliveTrackers', 'service.taskTrackers'), trackersHeapSummary: function () { - var heapUsed = this.get('service').get('jobTrackerHeapUsed') || 0; - var heapMax = this.get('service').get('jobTrackerHeapMax') || 0; + var heapUsed = this.get('service').get('jobTrackerHeapUsed') || 90; + var heapMax = this.get('service').get('jobTrackerHeapMax') || 90; var percent = heapMax > 0 ? 100 * heapUsed / heapMax : 0; return this.t('dashboard.services.mapreduce.jobTrackerHeapSummary').format(heapUsed.bytesToSize(1, "parseFloat"), heapMax.bytesToSize(1, "parseFloat"), percent.toFixed(1)); }.property('service.jobTrackerHeapUsed', 'service.jobTrackerHeapMax'), @@ -77,31 +69,31 @@ App.MainDashboardServiceMapreduceView = jobsSummary: function () { var svc = this.get('service'); var template = this.t('dashboard.services.mapreduce.jobsSummary'); - return template.format(this.formatUnavailable(svc.get('jobsSubmitted')), this.formatUnavailable(svc.get('jobsCompleted'))); + return template.format(svc.get('jobsSubmitted'), svc.get('jobsCompleted')); }.property('service.jobsSubmitted', 'service.jobsCompleted'), mapSlotsSummary: function () { var svc = this.get('service'); var template = this.t('dashboard.services.mapreduce.mapSlotsSummary'); - return template.format(this.formatUnavailable(svc.get('mapSlotsOccupied')), this.formatUnavailable(svc.get('mapSlotsReserved'))); + return template.format(svc.get('mapSlotsOccupied'), svc.get('mapSlotsReserved')); }.property('service.mapSlotsOccupied', 'service.mapSlotsReserved'), reduceSlotsSummary: function () { var svc = this.get('service'); var template = this.t('dashboard.services.mapreduce.reduceSlotsSummary'); - return template.format(this.formatUnavailable(svc.get('reduceSlotsOccupied')), this.formatUnavailable(svc.get('reduceSlotsReserved'))); + return template.format(svc.get('reduceSlotsOccupied'), svc.get('reduceSlotsReserved')); }.property('service.reduceSlotsOccupied', 'service.reduceSlotsReserved'), mapTasksSummary: function () { var svc = this.get('service'); var template = this.t('dashboard.services.mapreduce.tasksSummary'); - return template.format(this.formatUnavailable(svc.get('mapsRunning')), this.formatUnavailable(svc.get('mapsWaiting'))); + return template.format(svc.get('mapsRunning'), svc.get('mapsWaiting')); }.property('service.mapsRunning', 'service.mapsWaiting'), reduceTasksSummary: function () { var svc = this.get('service'); var template = this.t('dashboard.services.mapreduce.tasksSummary'); - return template.format(this.formatUnavailable(svc.get('reducesRunning')), this.formatUnavailable(svc.get('reducesWaiting'))); + return template.format(svc.get('reducesRunning'), svc.get('reducesWaiting')); }.property('service.reducesRunning', 'service.reducesWaiting'), slotsCapacitySummary: function () { @@ -117,7 +109,7 @@ App.MainDashboardServiceMapreduceView = }.property('service.mapSlots', 'service.reduceSlots', 'service.aliveTrackers'), taskTrackerComponent: function () { - return App.HostComponent.find().findProperty('componentName', 'TASKTRACKER'); + return App.Component.find().findProperty('componentName', 'TASKTRACKER'); }.property('components'), isCollapsed: false, Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host.js Fri Jan 11 23:41:06 2013 @@ -46,7 +46,6 @@ App.MainHostView = Em.View.extend({ "bSortCellsTop": true, "iDisplayLength": 10, "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], - "oSearch": {"bSmart":false}, "aoColumns":[ { "bSortable": false }, { "sType":"html" }, @@ -68,7 +67,8 @@ App.MainHostView = Em.View.extend({ content:null, shortLabels: function() { - var labels = this.get('content.hostComponents').getEach('displayName'); + var components = this.get('labels'); + var labels = this.get('content.components').getEach('displayName'); var shortLabels = ''; var c = 0; labels.forEach(function(label) { @@ -87,8 +87,8 @@ App.MainHostView = Em.View.extend({ }.property('labels'), labels: function(){ - return this.get('content.hostComponents').getEach('displayName').join('\n'); - }.property('content.hostComponents.@each'), + return this.get('content.components').getEach('displayName').join('\n'); + }.property('content.components.@each'), usageStyle:function () { return "width:" + this.get('content.diskUsage') + "%"; @@ -197,37 +197,57 @@ App.MainHostView = Em.View.extend({ allComponentsChecked:false, toggleAllComponents:function () { - var checked = this.get('allComponentsChecked'); - this.set('masterComponentsChecked', checked); - this.set('slaveComponentsChecked', checked); - this.set('clientComponentsChecked', checked); + this.set('masterComponentsChecked', this.get('allComponentsChecked')); + this.set('slaveComponentsChecked', this.get('allComponentsChecked')); + this.set('clientComponentsChecked', this.get('allComponentsChecked')); }.observes('allComponentsChecked'), masterComponentsChecked:false, toggleMasterComponents:function () { - this.get('masterComponents').setEach('checkedForHostFilter', this.get('masterComponentsChecked')); + var checked = this.get('masterComponentsChecked'); + this.get('masterComponents').forEach(function (comp) { + comp.set('checkedForHostFilter', checked); + }); }.observes('masterComponentsChecked'), slaveComponentsChecked:false, toggleSlaveComponents:function () { - this.get('slaveComponents').setEach('checkedForHostFilter', this.get('slaveComponentsChecked')); + var checked = this.get('slaveComponentsChecked'); + this.get('slaveComponents').forEach(function (comp) { + comp.set('checkedForHostFilter', checked); + }); }.observes('slaveComponentsChecked'), clientComponentsChecked: false, toggleClientComponents: function() { - this.get('clientComponents').setEach('checkedForHostFilter', this.get('clientComponentsChecked')); + var checked = this.get('clientComponentsChecked'); + this.get('clientComponents').forEach(function(comp) { + comp.set('checkedForHostFilter', checked); + }); }.observes('clientComponentsChecked'), masterComponents:function(){ - return this.get('parentView.controller.masterComponents'); + var masterComponents = []; + for(var i = 0; i < this.get('parentView').get('controller.masterComponents').length; i++) { + masterComponents.push(this.get('parentView').get('controller.masterComponents')[i]); + } + return masterComponents; }.property('parentView.controller.masterComponents'), slaveComponents:function(){ - return this.get('parentView.controller.slaveComponents'); + var slaveComponents = []; + for(var i = 0; i < this.get('parentView').get('controller.slaveComponents').length; i++) { + slaveComponents.push(this.get('parentView').get('controller.slaveComponents')[i]); + } + return slaveComponents; }.property('parentView.controller.slaveComponents'), clientComponents: function() { - return this.get('parentView.controller.clientComponents'); + 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('
'+ @@ -314,6 +334,12 @@ App.MainHostView = Em.View.extend({ var self = this; this.set('isFilterOpen', !this.get('isFilterOpen')); if (this.get('isFilterOpen')) { + var filters = App.router.get('mainHostController.filters.components'); + $('.filter-component').each(function() { + var componentId = parseInt($(this).attr('id').replace('component-', '')); + var index = filters.indexOf(componentId); + $(this).attr('checked', index == -1); + }); var dropDown = $('#filter-dropdown'); var firstClick = true; @@ -331,9 +357,6 @@ App.MainHostView = Em.View.extend({ if (this.get('controller.comeWithFilter')) { this.applyFilter(); this.closeFilters(); - this.set('controller.comeWithFilter', false); - } else { - this.clearFilter(this); } }, Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/audit.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/audit.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/audit.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/audit.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,26 @@ +/** + * 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.MainHostAuditView = Em.View.extend({ + templateName: require('templates/main/host/audit'), + content:function(){ + return App.router.get('mainHostDetailsController.content'); + }.property('App.router.mainHostDetailsController.content') +}); \ No newline at end of file Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/summary.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/summary.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/summary.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/host/summary.js Fri Jan 11 23:41:06 2013 @@ -93,7 +93,7 @@ App.MainHostSummaryView = Em.View.extend sortedComponents: function() { var slaveComponents = []; var masterComponents = []; - this.get('content.hostComponents').forEach(function(component){ + this.get('content.components').forEach(function(component){ if(component.get('isMaster')){ masterComponents.push(component); } else if(component.get('isSlave')) { @@ -104,7 +104,7 @@ App.MainHostSummaryView = Em.View.extend }.property('content'), clients: function(){ var clients = []; - this.get('content.hostComponents').forEach(function(component){ + this.get('content.components').forEach(function(component){ if(!component.get('componentName')){ //temporary fix because of different data in hostComponents and serviceComponents return; @@ -122,11 +122,6 @@ App.MainHostSummaryView = Em.View.extend ComponentView: Em.View.extend({ content: null, - didInsertElement: function () { - if (this.get('isInProgress')) { - this.doBlinking(); - } - }, hostComponent: function(){ var hostComponent = null; var serviceComponent = this.get('content'); @@ -143,7 +138,7 @@ App.MainHostSummaryView = Em.View.extend workStatus = hostComponent.get('workStatus'); } return workStatus; - }.property('content.workStatus','hostComponent.workStatus'), + }.property('content.workStatus', 'hostComponent.workStatus'), statusClass: function(){ var statusClass = null; if(this.get('isDataNode')){ @@ -152,14 +147,14 @@ App.MainHostSummaryView = Em.View.extend return 'health-status-DEAD-ORANGE'; } } - return 'health-status-' + App.HostComponentStatus.getKeyName(this.get('workStatus')); - }.property('workStatus', 'isDataNodeRecommissionAvailable'), + return 'health-status-' + App.Component.Status.getKeyName(this.get('workStatus')); + }.property('workStatus'), /** * Disable element while component is starting/stopping */ disabledClass:function(){ var workStatus = this.get('workStatus'); - if([App.HostComponentStatus.starting, App.HostComponentStatus.stopping].contains(workStatus) ){ + if([App.Component.Status.starting, App.Component.Status.stopping].contains(workStatus) ){ return 'disabled'; } else { return ''; @@ -171,7 +166,7 @@ App.MainHostSummaryView = Em.View.extend doBlinking : function(){ var workStatus = this.get('workStatus'); var self = this; - var pulsate = [ App.HostComponentStatus.starting, App.HostComponentStatus.stopping ].contains(workStatus); + var pulsate = [ App.Component.Status.starting, App.Component.Status.stopping ].contains(workStatus); if (!pulsate && this.get('isDataNode')) { var dataNodeComponent = this.get('content'); if (dataNodeComponent) @@ -187,17 +182,11 @@ App.MainHostSummaryView = Em.View.extend * Start blinking when host component is starting/stopping */ startBlinking:function(){ - this.$('.components-health').stop(true, true); - this.$('.components-health').css({opacity: 1.0}); this.doBlinking(); }.observes('workStatus'), isStart : function() { - return (this.get('workStatus') === App.HostComponentStatus.started || this.get('workStatus') === App.HostComponentStatus.starting); - }.property('workStatus'), - - isInProgress : function() { - return (this.get('workStatus') === App.HostComponentStatus.stopping || this.get('workStatus') === App.HostComponentStatus.starting); + return (this.get('workStatus') === App.Component.Status.started || this.get('workStatus') === App.Component.Status.starting); }.property('workStatus'), /** * Shows whether we need to show Decommision/Recomission buttons Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/hosts.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/hosts.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/hosts.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/hosts.js Fri Jan 11 23:41:06 2013 @@ -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.MainHostsView = Em.View.extend({ + templateName: require('templates/main/hosts') +}); \ No newline at end of file Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/audit.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/audit.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/audit.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/audit.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,72 @@ +/** + * 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'); + +require('views/common/grid'); + +App.MainServiceInfoAuditView = App.Grid.extend({ +// audits: function() { +// return App.router.get('mainServiceInfoAuditController.content').get('serviceAudit'); +// }.property('App.router.mainServiceInfoAuditController.content'), + + prepareCollection:function () { + var audits = App.router.get('mainServiceInfoAuditController.content').get('serviceAudit'); + console.warn(" AUDITS: ", audits); + this.set('collection', audits); + }, + + addFilters: function(field, values){ + var filters = this.get('appliedFilters'); + filters[field] = values; + var collection = App.router.get('mainServiceInfoAuditController.content').get('serviceAudit'); + arrayCollection = collection.filter(function(data) { + var oneFilterFail = false; + $.each(filters, function(fieldname, values){ + if(values.indexOf(data.get(fieldname)) == -1) { + return oneFilterFail = true; + } + }); + return !oneFilterFail; + }); + + this.set('filteredArray', arrayCollection); + }, + + _collection: {className: App.ServiceAudit}, + prepareColumns:function () { + this._super(); + + this.addColumn({ + name:"date", + label:Em.I18n.t("admin.audit.grid.date") + }); + this.addColumn({ + name:"service.label", + label:Em.I18n.t("admin.audit.grid.service") + }); + this.addColumn({ + name:"operationName", + label:Em.I18n.t("admin.audit.grid.operationName") + }); + this.addColumn({ + name:"user.userName", + label:Em.I18n.t("admin.audit.grid.performedBy") + }); + } +}); \ No newline at end of file Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/metrics.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/metrics.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/metrics.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/metrics.js Fri Jan 11 23:41:06 2013 @@ -0,0 +1,26 @@ +/** + * 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.MainServiceInfoMetricsView = Em.View.extend({ + templateName: require('templates/main/service/info/metrics'), + alerts: function(){ + return App.router.get('mainAlertController.content'); + }.property('App.router.mainAlertController.content') +}); \ No newline at end of file Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/summary.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/summary.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/summary.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/service/info/summary.js Fri Jan 11 23:41:06 2013 @@ -142,7 +142,7 @@ App.MainServiceInfoSummaryView = Em.View monitorsObj: function(){ var service = this.get('controller.content'); if (service.get("id") == "GANGLIA") { - var monitors = service.get('hostComponents').filterProperty('isMaster', false); + var monitors = service.get('components').filterProperty('isMaster', false); if (monitors.length) { return monitors[0]; } @@ -157,7 +157,7 @@ App.MainServiceInfoSummaryView = Em.View serversHost: function() { var service = this.get('controller.content'); if (service.get("id") == "ZOOKEEPER") { - var servers = service.get('hostComponents').filterProperty('isMaster'); + var servers = service.get('components').filterProperty('isMaster'); if (servers.length > 0) { return servers[0]; } @@ -172,7 +172,7 @@ App.MainServiceInfoSummaryView = Em.View clientObj: function() { var service = this.get('controller.content'); if (service.get("id") == "OOZIE" || service.get("id") == "ZOOKEEPER") { - var clients = service.get('hostComponents').filterProperty('isMaster', false); + var clients = service.get('components').filterProperty('isMaster', false); if (clients.length > 0) { return clients[0]; } @@ -190,7 +190,7 @@ App.MainServiceInfoSummaryView = Em.View gangliaServer:function(){ var service=this.get('controller.content'); if(service.get("id") == "GANGLIA"){ - return service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName"); + return service.get("components").findProperty('isMaster', true).get("host").get("publicHostName"); }else{ return ""; } @@ -198,7 +198,7 @@ App.MainServiceInfoSummaryView = Em.View nagiosServer:function(){ var service=this.get('controller.content'); if(service.get("id") == "NAGIOS"){ - return service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName"); + return service.get("components").findProperty('isMaster', true).get("host").get("publicHostName"); }else{ return ""; } @@ -206,7 +206,7 @@ App.MainServiceInfoSummaryView = Em.View oozieServer:function(){ var service=this.get('controller.content'); if(service.get("id") == "OOZIE"){ - return service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName"); + return service.get("components").findProperty('isMaster', true).get("host").get("publicHostName"); }else{ return ""; } @@ -224,7 +224,7 @@ App.MainServiceInfoSummaryView = Em.View var service=this.get('controller.content'); if(service.get("id") == "HIVE"){ var self = this; - var components = service.get("hostComponents"); + var components = service.get("components"); if(components){ components.forEach(function(component){ var ci = { Added: incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/test.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/test.js?rev=1432332&view=auto ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/test.js (added) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/main/test.js Fri Jan 11 23:41:06 2013 @@ -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.MainTestView = Em.View.extend({ + templateName: require('templates/main/test'), + services: App.Service.find() +}); Modified: incubator/ambari/branches/branch-1.2/ambari-web/app/views/wizard/step2_view.js URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/ambari-web/app/views/wizard/step2_view.js?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/ambari-web/app/views/wizard/step2_view.js (original) +++ incubator/ambari/branches/branch-1.2/ambari-web/app/views/wizard/step2_view.js Fri Jan 11 23:41:06 2013 @@ -20,8 +20,7 @@ var App = require('app'); App.SshKeyFileUploader = Ember.View.extend({ - template:Ember.Handlebars.compile(''), - classNames: ['ssh-key-input-indentation'], + template:Ember.Handlebars.compile(''), change: function (e) { var self=this; @@ -62,9 +61,62 @@ App.WizardStep2View = Em.View.extend({ this.set('controller.sshKeyError',null); this.loadHostsInfo(); }, - + /** + * Config for displaying more hosts + * if oldHosts.length more than config.count that configuration will be applied + */ + hostDisplayConfig: [ + { + count: 0, + delimitery: '
', + popupDelimitery: '
' + }, + { + count: 10, + delimitery: ', ', + popupDelimitery: '
' + }, + { + count: 50, + delimitery: ', ', + popupDelimitery: ', ' + } + ], + showMoreHosts: function () { + var self = this; + App.ModalPopup.show({ + header: "Hosts are already part of the cluster and will be ignored", + body: self.get('hostsInfo.oldHostNamesMore'), + encodeBody: false, + onPrimary: function () { + this.hide(); + }, + secondary: null + }); + }, loadHostsInfo: function(){ + var hostsInfo = Em.Object.create(); + + var oldHostNames = App.Host.find().getEach('id'); + var k = 10; + + var usedConfig = false; + this.get('hostDisplayConfig').forEach(function (config) { + if (oldHostNames.length > config.count) { + usedConfig = config; + } + }); + + k = usedConfig.count ? usedConfig.count : oldHostNames.length; + var displayedHostNames = oldHostNames.slice(0, k); + hostsInfo.set('oldHostNames', displayedHostNames.join(usedConfig.delimitery)); + if (usedConfig.count) { + var moreHostNames = oldHostNames.slice(k + 1); + hostsInfo.set('oldHostNamesMore', moreHostNames.join(usedConfig.popupDelimitery)); + hostsInfo.set('showMoreHostsText', "...and %@ more".fmt(moreHostNames.length)); + } + this.set('hostsInfo', hostsInfo); }, @@ -80,10 +132,26 @@ App.WizardStep2View = Em.View.extend({ return this.get("controller.content.installOptions.manualInstall"); }.property("controller.content.installOptions.manualInstall"), + sshKeyClass:function() { + return (this.get("isFileApi")) ? "hide" : "" ; + }.property("isFileApi"), + isFileApi: function () { return (window.File && window.FileReader && window.FileList) ? true : false ; }.property(), + sshKeyPreviewClass: function() { + if (this.get('controller.content.installOptions.sshKey').trim() != '') { + if (this.get('controller.content.installOptions.manualInstall')) { + return 'sshKey-file-view disabled'; + } else { + return 'sshKey-file-view'; + } + } else { + return 'hidden'; + } + }.property('controller.content.installOptions.sshKey', 'controller.content.installOptions.manualInstall'), + manualInstallPopup: function(){ if(!this.get('controller.content.installOptions.useSsh')){ App.ModalPopup.show({ @@ -97,35 +165,8 @@ App.WizardStep2View = Em.View.extend({ }); } this.set('controller.content.installOptions.manualInstall', !this.get('controller.content.installOptions.useSsh')); - }.observes('controller.content.installOptions.useSsh'), + }.observes('controller.content.installOptions.useSsh') - providingSSHKeyRadioButton: Ember.Checkbox.extend({ - tagName: 'input', - attributeBindings: ['type', 'checked'], - checked: function () { - return this.get('controller.content.installOptions.useSsh'); - }.property('controller.content.installOptions.useSsh'), - type: 'radio', - - click: function () { - this.set('controller.content.installOptions.useSsh', true); - this.set('controller.content.installOptions.manualInstall', false); - } - }), - - manualRegistrationRadioButton: Ember.Checkbox.extend({ - tagName: 'input', - attributeBindings: ['type', 'checked'], - checked: function () { - return this.get('controller.content.installOptions.manualInstall'); - }.property('controller.content.installOptions.manualInstall'), - type: 'radio', - - click: function () { - this.set('controller.content.installOptions.manualInstall', true); - this.set('controller.content.installOptions.useSsh', false); - } - }) }); Modified: incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/main/java/org/apache/ambari/log4j/hadoop/mapreduce/jobhistory/MapReduceJobHistoryUpdater.java URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/main/java/org/apache/ambari/log4j/hadoop/mapreduce/jobhistory/MapReduceJobHistoryUpdater.java?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/main/java/org/apache/ambari/log4j/hadoop/mapreduce/jobhistory/MapReduceJobHistoryUpdater.java (original) +++ incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/main/java/org/apache/ambari/log4j/hadoop/mapreduce/jobhistory/MapReduceJobHistoryUpdater.java Fri Jan 11 23:41:06 2013 @@ -23,12 +23,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -132,7 +127,7 @@ public class MapReduceJobHistoryUpdater workflowSelectPS = connection.prepareStatement( - "SELECT workflowContext FROM " + WORKFLOW_TABLE + " where workflowId = ?" + "SELECT workflowId FROM " + WORKFLOW_TABLE + " where workflowId = ?" ); workflowPS = @@ -159,8 +154,6 @@ public class MapReduceJobHistoryUpdater "UPDATE " + WORKFLOW_TABLE + " SET " + - "workflowContext = ?, " + - "numJobsTotal = ?, " + "lastUpdateTime = ?, " + "duration = ? - (SELECT startTime FROM " + WORKFLOW_TABLE + @@ -604,57 +597,6 @@ public class MapReduceJobHistoryUpdater return context; } - public static void mergeEntries(Map> edges, List entries) { - if (entries == null) - return; - for (WorkflowDagEntry entry : entries) { - if (!edges.containsKey(entry.getSource())) - edges.put(entry.getSource(), new TreeSet()); - Set targets = edges.get(entry.getSource()); - targets.addAll(entry.getTargets()); - } - } - - public static WorkflowDag constructMergedDag(WorkflowContext workflowContext, WorkflowContext existingWorkflowContext) { - Map> edges = new TreeMap>(); - if (existingWorkflowContext.getWorkflowDag() != null) - mergeEntries(edges, existingWorkflowContext.getWorkflowDag().getEntries()); - if (workflowContext.getWorkflowDag() != null) - mergeEntries(edges, workflowContext.getWorkflowDag().getEntries()); - WorkflowDag mergedDag = new WorkflowDag(); - for (Entry> edge : edges.entrySet()) { - WorkflowDagEntry entry = new WorkflowDagEntry(); - entry.setSource(edge.getKey()); - entry.getTargets().addAll(edge.getValue()); - mergedDag.addEntry(entry); - } - return mergedDag; - } - - private static WorkflowContext getSanitizedWorkflow(WorkflowContext workflowContext, WorkflowContext existingWorkflowContext) { - WorkflowContext sanitizedWC = new WorkflowContext(); - if (existingWorkflowContext == null) { - sanitizedWC.setWorkflowDag(workflowContext.getWorkflowDag()); - sanitizedWC.setParentWorkflowContext(workflowContext.getParentWorkflowContext()); - } else { - sanitizedWC.setWorkflowDag(constructMergedDag(existingWorkflowContext, workflowContext)); - sanitizedWC.setParentWorkflowContext(existingWorkflowContext.getParentWorkflowContext()); - } - return sanitizedWC; - } - - private static String getWorkflowString(WorkflowContext sanitizedWC) { - String sanitizedWCString = null; - try { - ObjectMapper om = new ObjectMapper(); - sanitizedWCString = om.writeValueAsString(sanitizedWC); - } catch (IOException e) { - e.printStackTrace(); - sanitizedWCString = ""; - } - return sanitizedWCString; - } - private void processJobSubmittedEvent( PreparedStatement jobPS, PreparedStatement workflowSelectPS, PreparedStatement workflowPS, @@ -674,35 +616,35 @@ public class MapReduceJobHistoryUpdater // Get workflow information boolean insertWorkflow = false; - String existingContextString = null; - ResultSet rs = null; try { workflowSelectPS.setString(1, workflowContext.getWorkflowId()); workflowSelectPS.execute(); - rs = workflowSelectPS.getResultSet(); - if (rs.next()) { - existingContextString = rs.getString(1); - } else { - insertWorkflow = true; - } + ResultSet rs = workflowSelectPS.getResultSet(); + insertWorkflow = !rs.next(); } catch (SQLException sqle) { LOG.warn("workflow select failed with: ", sqle); insertWorkflow = false; - } finally { - try { - if (rs != null) - rs.close(); - } catch (SQLException e) { - LOG.error("Exception while closing ResultSet", e); - } } // Insert workflow if (insertWorkflow) { + WorkflowContext sanitizedWC = new WorkflowContext(); + sanitizedWC.setWorkflowDag(workflowContext.getWorkflowDag()); + sanitizedWC.setParentWorkflowContext(workflowContext.getParentWorkflowContext()); + + String sanitizedWCString = null; + try { + ObjectMapper om = new ObjectMapper(); + sanitizedWCString = om.writeValueAsString(sanitizedWC); + } catch (IOException e) { + e.printStackTrace(); + sanitizedWCString = ""; + } + workflowPS.setString(1, workflowContext.getWorkflowId()); workflowPS.setString(2, workflowContext.getWorkflowName()); - workflowPS.setString(3, getWorkflowString(getSanitizedWorkflow(workflowContext, null))); + workflowPS.setString(3, sanitizedWCString); workflowPS.setString(4, historyEvent.getUserName()); workflowPS.setLong(5, historyEvent.getSubmitTime()); workflowPS.setLong(6, historyEvent.getSubmitTime()); @@ -711,22 +653,10 @@ public class MapReduceJobHistoryUpdater LOG.debug("Successfully inserted workflowId = " + workflowContext.getWorkflowId()); } else { - ObjectMapper om = new ObjectMapper(); - WorkflowContext existingWorkflowContext = null; - try { - if (existingContextString != null) - existingWorkflowContext = om.readValue(existingContextString.getBytes(), WorkflowContext.class); - } catch (IOException e) { - LOG.warn("Couldn't read existing workflow context for " + workflowContext.getWorkflowId(), e); - } - - WorkflowContext sanitizedWC = getSanitizedWorkflow(workflowContext, existingWorkflowContext); - workflowUpdateTimePS.setString(1, getWorkflowString(sanitizedWC)); - workflowUpdateTimePS.setLong(2, sanitizedWC.getWorkflowDag().size()); - workflowUpdateTimePS.setLong(3, historyEvent.getSubmitTime()); - workflowUpdateTimePS.setLong(4, historyEvent.getSubmitTime()); - workflowUpdateTimePS.setString(5, workflowContext.getWorkflowId()); - workflowUpdateTimePS.setString(6, workflowContext.getWorkflowId()); + workflowUpdateTimePS.setLong(1, historyEvent.getSubmitTime()); + workflowUpdateTimePS.setLong(2, historyEvent.getSubmitTime()); + workflowUpdateTimePS.setString(3, workflowContext.getWorkflowId()); + workflowUpdateTimePS.setString(4, workflowContext.getWorkflowId()); workflowUpdateTimePS.executeUpdate(); LOG.debug("Successfully updated workflowId = " + workflowContext.getWorkflowId()); Modified: incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/test/java/org/apache/ambari/TestJobHistoryParsing.java URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/test/java/org/apache/ambari/TestJobHistoryParsing.java?rev=1432332&r1=1432331&r2=1432332&view=diff ============================================================================== --- incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/test/java/org/apache/ambari/TestJobHistoryParsing.java (original) +++ incubator/ambari/branches/branch-1.2/contrib/ambari-log4j/src/test/java/org/apache/ambari/TestJobHistoryParsing.java Fri Jan 11 23:41:06 2013 @@ -30,7 +30,6 @@ import org.apache.ambari.eventdb.model.W import org.apache.ambari.log4j.hadoop.mapreduce.jobhistory.MapReduceJobHistoryUpdater; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapred.JobHistory; -import org.apache.hadoop.mapreduce.JobID; import org.apache.hadoop.tools.rumen.JobSubmittedEvent; import org.apache.hadoop.util.StringUtils; @@ -66,42 +65,20 @@ public class TestJobHistoryParsing exten test("id_= 0-1", "something.name", "1=0", adj); } - public void test3() { - String s = "`~!@#$%^&*()-_=+[]{}|,.<>/?;:'\""; - test(s, s, s, new HashMap()); - } - - public void test4() { - Map adj = new HashMap(); - adj.put("X", new String[] {}); - test("", "jobName", "X", adj); - } - public void test(String workflowId, String workflowName, String workflowNodeName, Map adjacencies) { Configuration conf = new Configuration(); setProperties(conf, workflowId, workflowName, workflowNodeName, adjacencies); String log = log("JOB", new String[] {ID, NAME, NODE, ADJ}, new String[] {conf.get(ID_PROP), conf.get(NAME_PROP), conf.get(NODE_PROP), JobHistory.JobInfo.getWorkflowAdjacencies(conf)}); ParsedLine line = new ParsedLine(log); - JobID jobid = new JobID("id", 1); - JobSubmittedEvent event = new JobSubmittedEvent(jobid, workflowName, "", 0l, "", null, "", line.get(ID), line.get(NAME), line.get(NODE), line.get(ADJ)); + JobSubmittedEvent event = new JobSubmittedEvent(null, "", "", 0l, "", null, "", line.get(ID), line.get(NAME), line.get(NODE), line.get(ADJ)); WorkflowContext context = MapReduceJobHistoryUpdater.buildWorkflowContext(event); - - String resultingWorkflowId = workflowId; - if (workflowId.isEmpty()) - resultingWorkflowId = jobid.toString().replace("job_", "mr_"); - assertEquals("Didn't recover workflowId", resultingWorkflowId, context.getWorkflowId()); + assertEquals("Didn't recover workflowId", workflowId, context.getWorkflowId()); assertEquals("Didn't recover workflowName", workflowName, context.getWorkflowName()); assertEquals("Didn't recover workflowNodeName", workflowNodeName, context.getWorkflowEntityName()); - - Map resultingAdjacencies = adjacencies; - if (resultingAdjacencies.size() == 0) { - resultingAdjacencies = new HashMap(); - resultingAdjacencies.put(workflowNodeName, new String[] {}); - } - assertEquals("Got incorrect number of adjacencies", resultingAdjacencies.size(), context.getWorkflowDag().getEntries().size()); + assertEquals("Got incorrect number of adjacencies", adjacencies.size(), context.getWorkflowDag().getEntries().size()); for (WorkflowDagEntry entry : context.getWorkflowDag().getEntries()) { - String[] sTargets = resultingAdjacencies.get(entry.getSource()); + String[] sTargets = adjacencies.get(entry.getSource()); assertNotNull("No original targets for " + entry.getSource(), sTargets); List dTargets = entry.getTargets(); assertEquals("Got incorrect number of targets for " + entry.getSource(), sTargets.length, dTargets.size());