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/03/08 00:53:06 UTC
svn commit: r1454175 - in /incubator/ambari/trunk: ./ ambari-web/app/
ambari-web/app/styles/ ambari-web/app/templates/common/ ambari-web/app/utils/
Author: yusaku
Date: Thu Mar 7 23:53:05 2013
New Revision: 1454175
URL: http://svn.apache.org/r1454175
Log:
AMBARI-1581. Host progress popup - generic component for showing progress on async operations. (yusaku)
Added:
incubator/ambari/trunk/ambari-web/app/templates/common/host_progress_popup.hbs
incubator/ambari/trunk/ambari-web/app/utils/host_progress_popup.js
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/initialize.js
incubator/ambari/trunk/ambari-web/app/messages.js
incubator/ambari/trunk/ambari-web/app/styles/application.less
incubator/ambari/trunk/ambari-web/app/utils/polling.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1454175&r1=1454174&r2=1454175&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Mar 7 23:53:05 2013
@@ -105,6 +105,9 @@ Trunk (unreleased changes):
IMPROVEMENTS
+ AMBARI-1581. Host progress popup - generic component for showing progress
+ on async operations. (yusaku)
+
AMBARI-1542. Provide remove, restore default, and cancel actions for
service config properties. (srimanth via yusaku)
Modified: incubator/ambari/trunk/ambari-web/app/initialize.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/initialize.js?rev=1454175&r1=1454174&r2=1454175&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/initialize.js (original)
+++ incubator/ambari/trunk/ambari-web/app/initialize.js Thu Mar 7 23:53:05 2013
@@ -46,6 +46,7 @@ require('mappers/users_mapper');
require('mappers/service_mapper');
require('utils/http_client');
+require('utils/host_progress_popup');
App.initialize();
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1454175&r1=1454174&r2=1454175&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Thu Mar 7 23:53:05 2013
@@ -46,6 +46,7 @@ Em.I18n.translations = {
'common.prev':'Prev',
'common.next':'Next',
'common.host':'Host',
+ 'common.hosts':'Hosts',
'common.group':'Group',
'common.progress':'Progress',
'common.status':'Status',
@@ -112,6 +113,9 @@ Em.I18n.translations = {
'common.security':'Security',
'common.cluster':'Cluster',
+ 'hostPopup.noHostsToShow':'No hosts to show',
+ 'hostPopup.noTasksToShow':'No tasks to show',
+
'question.sure':'Are you sure {0}?',
'popup.highlight':'click to highlight',
Modified: incubator/ambari/trunk/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/application.less?rev=1454175&r1=1454174&r2=1454175&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/application.less Thu Mar 7 23:53:05 2013
@@ -415,6 +415,14 @@ h1 {
.btn-area {
margin-top: 30px;
}
+ .service {
+ .info {
+ line-height: 30px;
+ }
+ .row {
+ margin-left: 0;
+ }
+ }
}
#host-log {
@@ -718,6 +726,51 @@ a:focus {
/*60% width modal window end*/
+/*****start styles for host component popup*****/
+.host-component-popup-wrap
+{
+
+
+
+ #host-info{
+ .task-list-line-cursor{
+ width: 100%;
+ height: 20px;
+ }
+ .span2{
+ width:20%;
+ float: left;
+ }
+ .host-progress-num{
+ float: left;
+ padding-left: 8px;
+ }
+ .host-name-icon-wrap{
+ float: left;
+ width: 50%;
+ }
+ .log-list-wrap {
+ padding: 10px 10px 10px 20px;
+ border-top: 1px solid #CCC;
+ border-bottom: 1px solid #CCC;
+
+ .show-details {
+ float: right;
+ cursor: pointer;
+ font-size: 16px;
+
+ i {
+ color: #333;
+ }
+ }
+ }
+ }
+
+}
+/*****end styles for host component popup*****/
+
+
+
/*****start styles for install tasks logs*****/
.task-list-main-warp, .task-detail-info {
i {
@@ -758,6 +811,10 @@ a:focus {
font-size: 15px;
padding: 0 0 10px 0;
+ .task-detail-back-to-hosts {
+ float: left;
+ }
+
.select-wrap {
float: right;
margin-top: -8px;
@@ -765,6 +822,10 @@ a:focus {
width: 140px;
}
}
+
+ .tasks-list-select{
+ margin-top: -28px;
+ }
}
#host-log, {
@@ -782,7 +843,6 @@ a:focus {
color: #333;
}
}
-
}
}
}
Added: incubator/ambari/trunk/ambari-web/app/templates/common/host_progress_popup.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/common/host_progress_popup.hbs?rev=1454175&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/common/host_progress_popup.hbs (added)
+++ incubator/ambari/trunk/ambari-web/app/templates/common/host_progress_popup.hbs Thu Mar 7 23:53:05 2013
@@ -0,0 +1,126 @@
+{{!
+* 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.
+}}
+
+<div class="host-component-popup-wrap">
+
+ <!-- HOSTS --->
+
+ <div {{bindAttr class="view.isHostListHidden:hidden :task-list-main-warp"}}>
+ <div class="task-top-wrap">
+ {{t common.hosts}}
+ <div class="select-wrap">
+ {{t common.show}}:
+ {{view Ember.Select
+ contentBinding="view.categories"
+ optionValuePath="content.value"
+ optionLabelPath="content.label"
+ selectionBinding="view.hostCategory"
+ }}
+ </div>
+ </div>
+ <div id="host-info">
+ {{#each hostInfo in view.hosts}}
+ <div {{bindAttr class="hostInfo.isVisible::hidden :log-list-wrap"}}>
+ <div {{action gotoTasks hostInfo}} class="task-list-line-cursor">
+ <div class="host-name-icon-wrap">
+ <i {{bindAttr class="hostInfo.status hostInfo.icon"}}></i>
+ <a href="#">
+ {{hostInfo.name}}
+ </a>
+ </div>
+ <div class="progress-bar span2">
+ <div {{bindAttr class="progress-striped active hostInfo.barColor :progress"}}>
+ <div class="bar" {{bindAttr style="hostInfo.barWidth"}}></div>
+ </div>
+ </div>
+ <div class="host-progress-num">{{hostInfo.progress}}%</div>
+ <div class="show-details"><i class="icon-caret-right"></i></div>
+ </div>
+ </div>
+ {{/each}}
+ {{#if view.isHostEmptyList}}
+ <div class="log-list-wrap">{{t hostPopup.noHostsToShow}}</div>
+ {{/if}}
+ </div>
+ </div>
+
+
+ <!-- TASKS --->
+
+ <div {{bindAttr class="view.isTaskListHidden:hidden :task-list-main-warp"}}>
+ <div class="task-top-wrap">
+ <a class="task-detail-back-to-hosts" href="javascript:void(null)" {{action backToHostList}} ><i class="icon-arrow-left"></i> {{t common.hosts}}</a>
+ <div>
+ <span class="task-detail-log-rolename" >{{t common.tasks}}</span>
+ </div>
+ <div class="select-wrap tasks-list-select">
+ {{t common.show}}:
+ {{view Ember.Select
+ contentBinding="view.categories"
+ optionValuePath="content.value"
+ optionLabelPath="content.label"
+ selectionBinding="view.taskCategory"
+ }}
+ </div>
+ </div>
+ <div id="host-log">
+ {{#each taskInfo in view.tasks}}
+ <div {{bindAttr class="taskInfo.isVisible::hidden :log-list-wrap"}}>
+ <div {{action toggleTaskLog taskInfo}} class="task-list-line-cursor">
+ <i {{bindAttr class="taskInfo.status taskInfo.icon"}}></i>
+ <a href="#">
+ {{{taskInfo.role}} {{taskInfo.command}}
+ </a>
+ <div class="show-details"><i class="icon-caret-right"></i></div>
+ </div>
+ </div>
+ {{/each}}
+ {{#if view.isTasksEmptyList}}
+ <div class="log-list-wrap">{{t hostPopup.noTasksToShow}}</div>
+ {{/if}}
+ </div>
+ </div>
+
+
+ <!-- TASKS DETAILS --->
+
+ <div {{bindAttr class="view.isLogWrapHidden:hidden :task-detail-info"}}>
+ <div class="task-top-wrap">
+ <a class="task-detail-back" href="javascript:void(null)" {{action backToTaskList}} ><i class="icon-arrow-left"></i> {{t common.tasks}}</a>
+ <div>
+ <i {{bindAttr class="view.openedTask.status :task-detail-status-ico view.openedTask.icon"}} class="task-detail-status-ico"></i>
+ <span class="task-detail-log-rolename" >{{{view.openedTask.role}} {{view.openedTask.command}}</span>
+ </div>
+ <div class="task-detail-ico-wrap">
+ <div title="Click to Copy" {{action "textTrigger" taskInfo target="view"}} class="task-detail-copy"><i class="icon-copy"></i> {{t common.copy}}</div>
+ <div title="Open in New Window" {{action openTaskLogInDialog}} class="task-detail-open-dialog"><i class="icon-external-link"></i> {{t common.open}}</div>
+ </div>
+ </div>
+ <div class="task-detail-log-info">
+ <div class="content-area" >
+ <div class="task-detail-log-clipboard-wrap" ></div>
+ <div class="task-detail-log-maintext">
+ <h5>stderr:</h5>
+ <pre class="stderr">{{view.openedTask.stderr}}</pre>
+ <h5>stdout:</h5>
+ <pre class="stdout">{{view.openedTask.stdout}}</pre>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
Added: incubator/ambari/trunk/ambari-web/app/utils/host_progress_popup.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/host_progress_popup.js?rev=1454175&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/host_progress_popup.js (added)
+++ incubator/ambari/trunk/ambari-web/app/utils/host_progress_popup.js Thu Mar 7 23:53:05 2013
@@ -0,0 +1,384 @@
+/**
+ * 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.HostPopup is for the popup that shows up upon clicking already-performed or currently-in-progress operations
+ */
+App.HostPopup = Em.Object.create({
+
+ hosts: null,
+ inputData:null,
+ serviceName:"",
+ popupHeaderName:"",
+ serviceController:null,
+ updateTimeOut:100,
+
+ initPopup: function (serviceName,controller) {
+ this.set("serviceName", serviceName);
+ this.set("serviceController", controller);
+ this.set("inputData", null);
+ this.set("inputData", this.get("serviceController.services"));
+ this.set("popupHeaderName",serviceName);
+ this.createPopup();
+ },
+
+ getHostStatus:function(tasks){
+ if (tasks.everyProperty('Tasks.status', 'COMPLETED')) {
+ return ['SUCCESS','icon-ok','progress-info'];
+ }
+ if (tasks.someProperty('Tasks.status', 'FAILED')) {
+ return ['FAILED','icon-exclamation-sign','progress-danger'];
+ }
+ if (tasks.someProperty('Tasks.status', 'ABORTED')) {
+ return ['CANCELLED','icon-minus','progress-warning'];
+ }
+ if (tasks.someProperty('Tasks.status', 'TIMEDOUT')) {
+ return ['TIMEDOUT','icon-time','progress-warning'];
+ }
+ if (tasks.someProperty('Tasks.status', 'IN_PROGRESS') || tasks.someProperty('Tasks.status', 'UPGRADING')) {
+ return ['IN_PROGRESS','icon-cogs','progress-info'];
+ }
+ return ['PENDING','icon-cog','progress-info'];
+ },
+
+ getHostProgress:function(tasks){
+
+ var progress = 0;
+ var actionsNumber = tasks.length;
+ var completedActions = tasks.filterProperty('Tasks.status', 'COMPLETED').length
+ + tasks.filterProperty('Tasks.status', 'FAILED').length
+ + tasks.filterProperty('Tasks.status', 'ABORTED').length
+ + tasks.filterProperty('Tasks.status', 'TIMEDOUT').length;
+ var queuedActions = tasks.filterProperty('Tasks.status', 'QUEUED').length;
+ var inProgressActions = tasks.filterProperty('Tasks.status', 'UPGRADING').length;
+ progress = Math.ceil(((queuedActions * 0.09) + (inProgressActions * 0.35) + completedActions ) / actionsNumber * 100);
+ console.log('--------INFO: progressPerHost is: ' + progress);
+ return progress;
+ },
+
+ onHostUpdate: function () {
+ var self=this;
+ if(this.get("inputData")){
+ var hostsArr = [];
+ var hostsData = this.get("inputData").filterProperty("name" , this.get("serviceName")).objectAt(0);
+ var hosts = hostsData.hosts;
+ }
+ if (hosts) {
+ hosts.forEach(function (_host) {
+ var tasks = _host.logTasks;
+ var hostInfo = Ember.Object.create({});
+ hostInfo.set('name', _host.name);
+ hostInfo.set('publicName', _host.publicName);
+ hostInfo.set('progress', 0);
+ hostInfo.set('status', App.format.taskStatus("PENDING"));
+ hostInfo.set('serviceName', hostsData.name);
+ hostInfo.set('isVisible', true);
+ hostInfo.set('icon', "icon-cog");
+ hostInfo.set('barColor', "progress-info");
+ hostInfo.set('barWidth', "width:0%;");
+
+ tasks = self.sortTasksById(tasks);
+ tasks = self.groupTasksByRole(tasks);
+ var tasksArr = [];
+
+ if (tasks.length) {
+
+ var hostStatus = self.getHostStatus(tasks);
+ var hostProgress= self.getHostProgress(tasks);
+ hostInfo.set('status', App.format.taskStatus(hostStatus[0]));
+ hostInfo.set('icon', hostStatus[1]);
+ hostInfo.set('barColor', hostStatus[2]);
+ hostInfo.set('progress', hostProgress);
+ hostInfo.set('barWidth', "width:"+hostProgress+"%;");
+
+ tasks.forEach(function (_task) {
+ var taskInfo = Ember.Object.create({});
+ taskInfo.set('id', _task.Tasks.id);
+ taskInfo.set('hostName', _host.name);
+ taskInfo.set('command', _task.Tasks.command.toLowerCase());
+ taskInfo.set('status', App.format.taskStatus(_task.Tasks.status));
+ taskInfo.set('role', App.format.role(_task.Tasks.role));
+ taskInfo.set('stderr', _task.Tasks.stderr);
+ taskInfo.set('stdout', _task.Tasks.stdout);
+ taskInfo.set('isVisible', true);
+ taskInfo.set('icon', 'icon-cogs');
+ if (taskInfo.get('status') == 'pending' || taskInfo.get('status') == 'queued') {
+ taskInfo.set('icon', 'icon-cog');
+ } else if (taskInfo.get('status') == 'in_progress') {
+ taskInfo.set('icon', 'icon-cogs');
+ } else if (taskInfo.get('status') == 'completed') {
+ taskInfo.set('icon', ' icon-ok');
+ } else if (taskInfo.get('status') == 'failed') {
+ taskInfo.set('icon', 'icon-exclamation-sign');
+ } else if (taskInfo.get('status') == 'aborted') {
+ taskInfo.set('icon', 'icon-minus');
+ } else if (taskInfo.get('status') == 'timedout') {
+ taskInfo.set('icon', 'icon-time');
+ }
+ tasksArr.push(taskInfo);
+ }, this);
+ }
+
+ hostInfo.set('tasks', tasksArr);
+ hostsArr.push(hostInfo);
+ }, this);
+ }
+
+ self.set("hosts",hostsArr);
+ }.observes("this.inputData"),
+
+ sortTasksById: function(tasks){
+ var result = [];
+ var id = 1;
+ for(var i = 0; i < tasks.length; i++){
+ id = (tasks[i].Tasks.id > id) ? tasks[i].Tasks.id : id;
+ }
+ while(id >= 1){
+ for(var j = 0; j < tasks.length; j++){
+ if(id == tasks[j].Tasks.id){
+ result.push(tasks[j]);
+ }
+ }
+ id--;
+ }
+ result.reverse();
+ return result;
+ },
+
+ groupTasksByRole: function (tasks) {
+ var sortedTasks = [];
+ var taskRoles = tasks.mapProperty('Tasks.role').uniq();
+ for (var i = 0; i < taskRoles.length; i++) {
+ sortedTasks = sortedTasks.concat(tasks.filterProperty('Tasks.role', taskRoles[i]))
+ }
+ return sortedTasks;
+ },
+
+
+ createPopup: function () {
+ var self = this;
+ var hostsInfo = this.get("hosts");
+ return App.ModalPopup.show({
+ headerClass: Ember.View.extend({
+ controller: this,
+ template:Ember.Handlebars.compile('{{popupHeaderName}}')
+ }),
+ classNames: ['sixty-percent-width-modal'],
+ autoHeight: false,
+ onPrimary: function () {
+ this.hide();
+ },
+ secondary: null,
+
+ bodyClass: Ember.View.extend({
+ templateName: require('templates/common/host_progress_popup'),
+ isLogWrapHidden: true,
+ isTaskListHidden: true,
+ isHostListHidden: false,
+ showTextArea: false,
+ isHostEmptyList: true,
+ isTasksEmptyList: true,
+ controller:this,
+ hosts:hostsInfo,
+
+ tasks:null,
+
+ didInsertElement:function(){
+ this.setSelectCount(this.get("hosts"));
+ },
+
+ updateHostInfo:function(){
+ this.get("controller").set("inputData", null);
+ this.get("controller").set("inputData", this.get("controller.serviceController.services"));
+ this.set("hosts", this.get("controller.hosts"));
+ }.observes("this.controller.serviceController.serviceTimestamp"),
+
+ visibleHosts: function () {
+ this.set("isHostEmptyList", true);
+ if (this.get('hostCategory.value')) {
+ var filter = this.get('hostCategory.value');
+ var hosts = this.get('hosts');
+ hosts.setEach("isVisible", false);
+ this.setVisability(filter,hosts);
+ if (hosts.filterProperty("isVisible", true).length > 0) {
+ this.set("isHostEmptyList", false);
+ }
+ }
+ }.observes('hostCategory', 'hosts'),
+
+ visibleTasks: function () {
+ this.set("isTasksEmptyList", true);
+ if (this.get('taskCategory.value')&&this.get('tasks')) {
+ var filter = this.get('taskCategory.value');
+ var tasks = this.get('tasks');
+ this.setVisability(filter,tasks);
+ if (tasks.filterProperty("isVisible", true).length > 0) {
+ this.set("isTasksEmptyList", false);
+ }
+ }
+ }.observes('taskCategory', 'tasks'),
+
+ setVisability: function(filter,obj){
+ obj.setEach("isVisible", false);
+ if (filter == "all") {
+ obj.setEach("isVisible", true);
+ }
+ else if (filter == "pending") {
+ obj.filterProperty("status", "pending").setEach("isVisible", true);
+ obj.filterProperty("status", "queued").setEach("isVisible", true);
+ }
+ else if (filter == "in_progress") {
+ obj.filterProperty("status", "in_progress").setEach("isVisible", true);
+ obj.filterProperty("status", "upgrading").setEach("isVisible", true);
+ }
+ else if (filter == "failed") {
+ obj.filterProperty("status", "failed").setEach("isVisible", true);
+ }
+ else if (filter == "completed") {
+ obj.filterProperty("status", "completed").setEach("isVisible", true);
+ obj.filterProperty("status", "success").setEach("isVisible", true);
+ }
+ else if (filter == "aborted") {
+ obj.filterProperty("status", "aborted").setEach("isVisible", true);
+ }
+ else if (filter == "timedout") {
+ obj.filterProperty("status", "timedout").setEach("isVisible", true);
+ }
+ },
+
+ categories: [
+ Ember.Object.create({value: 'all', label: Em.I18n.t('installer.step9.hostLog.popup.categories.all') }),
+ Ember.Object.create({value: 'pending', label: Em.I18n.t('installer.step9.hostLog.popup.categories.pending')}),
+ Ember.Object.create({value: 'in_progress', label: Em.I18n.t('installer.step9.hostLog.popup.categories.in_progress')}),
+ Ember.Object.create({value: 'failed', label: Em.I18n.t('installer.step9.hostLog.popup.categories.failed') }),
+ Ember.Object.create({value: 'completed', label: Em.I18n.t('installer.step9.hostLog.popup.categories.completed') }),
+ Ember.Object.create({value: 'aborted', label: Em.I18n.t('installer.step9.hostLog.popup.categories.aborted') }),
+ Ember.Object.create({value: 'timedout', label: Em.I18n.t('installer.step9.hostLog.popup.categories.timedout') })
+ ],
+
+ hostCategory: null,
+ taskCategory: null,
+
+ setSelectCount:function(obj){
+ if(!obj) return;
+ var countAll = obj.length;
+ var countPending = obj.filterProperty("status",'pending').length;
+ var countInProgress = obj.filterProperty("status",'in_progress').length;
+ var countFailed = obj.filterProperty("status",'failed').length;
+ var countCompleted = obj.filterProperty("status",'success').length + obj.filterProperty("status",'completed').length;
+ var countAborted = obj.filterProperty("status",'aborted').length;
+ var countTimedout = obj.filterProperty("status",'timedout').length;
+
+ this.categories.filterProperty("value",'all').objectAt(0).set("label","All ("+countAll+")");
+ this.categories.filterProperty("value",'pending').objectAt(0).set("label","Pending ("+countPending+")");
+ this.categories.filterProperty("value",'in_progress').objectAt(0).set("label","In Progress ("+countInProgress+")");
+ this.categories.filterProperty("value",'failed').objectAt(0).set("label","Failed ("+countFailed+")");
+ this.categories.filterProperty("value",'completed').objectAt(0).set("label","Success ("+countCompleted+")");
+ this.categories.filterProperty("value",'aborted').objectAt(0).set("label","Aborted ("+countAborted+")");
+ this.categories.filterProperty("value",'timedout').objectAt(0).set("label","Timedout ("+countTimedout+")");
+ },
+
+ updateSelectView:function(){
+ if(!this.get('isHostListHidden')){
+ this.setSelectCount(this.get("hosts"))
+ }else if(!this.get('isTaskListHidden')){
+ this.setSelectCount(this.get("tasks"))
+ }
+ }.observes('hosts','isTaskListHidden','isHostListHidden'),
+
+ backToTaskList: function (event, context) {
+ this.destroyClipBoard();
+ this.set("openedTaskId",0);
+ this.set("isLogWrapHidden", true);
+ this.set("isTaskListHidden", false);
+ },
+
+ backToHostList: function (event, context) {
+ this.set("isHostListHidden", false);
+ this.set("isTaskListHidden", true);
+ this.set("tasks", null);
+ this.get("controller").set("popupHeaderName",this.get("controller.serviceName"));
+ },
+
+ gotoTasks: function(event, context){
+ var taskInfo = event.context.tasks;
+ if(taskInfo.length){
+ this.get("controller").set("popupHeaderName", taskInfo.objectAt(0).hostName);
+ }
+ this.set('tasks', taskInfo);
+ this.set("isHostListHidden", true);
+ this.set("isTaskListHidden", false);
+ $(".modal").scrollTop(0);
+ $(".modal-body").scrollTop(0);
+ },
+
+ openTaskLogInDialog: function () {
+ newwindow = window.open();
+ newdocument = newwindow.document;
+ newdocument.write($(".task-detail-log-info").html());
+ newdocument.close();
+ },
+
+ openedTaskId: 0,
+
+ openedTask: function () {
+ if (!this.get('openedTaskId')) {
+ return Ember.Object.create();
+ }
+ return this.get('tasks').findProperty('id', this.get('openedTaskId'));
+ }.property('tasks', 'openedTaskId'),
+
+ toggleTaskLog: function (event, context) {
+ var taskInfo = event.context;
+ this.set("isLogWrapHidden", false);
+ this.set("isHostListHidden", true);
+ this.set("isTaskListHidden", true);
+ this.set('openedTaskId', taskInfo.id);
+ $(".modal").scrollTop(0);
+ $(".modal-body").scrollTop(0);
+ },
+
+ textTrigger: function (event) {
+ if ($(".task-detail-log-clipboard").length > 0) {
+ this.destroyClipBoard();
+ } else {
+ this.createClipBoard();
+ }
+ },
+ createClipBoard: function () {
+ $(".task-detail-log-clipboard-wrap").html('<textarea class="task-detail-log-clipboard"></textarea>');
+ $(".task-detail-log-clipboard")
+ .html("stderr: \n" + $(".stderr").html() + "\n stdout:\n" + $(".stdout").html())
+ .css("display", "block")
+ .width($(".task-detail-log-maintext").width())
+ .height($(".task-detail-log-maintext").height())
+ .select();
+ $(".task-detail-log-maintext").css("display", "none")
+ },
+ destroyClipBoard: function () {
+ $(".task-detail-log-clipboard").remove();
+ $(".task-detail-log-maintext").css("display", "block");
+ }
+ })
+ });
+ }
+
+});
+
Modified: incubator/ambari/trunk/ambari-web/app/utils/polling.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/polling.js?rev=1454175&r1=1454174&r2=1454175&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/polling.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/polling.js Thu Mar 7 23:53:05 2013
@@ -103,7 +103,6 @@ App.Poll = Em.Object.extend({
this.set('POLL_INTERVAL', 1);
this.numPolls++;
url = this.get('mockDataPrefix') + '/poll_' + this.get('numPolls') + '.json';
- debugger;
}
$.ajax({