You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/01/31 16:01:34 UTC

git commit: AMBARI-4484 Disable load unnecessary parameters of task of background operations. (atkach)

Updated Branches:
  refs/heads/trunk 0a9cd6496 -> fec3da3a2


AMBARI-4484 Disable load unnecessary parameters of task of background operations. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fec3da3a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fec3da3a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fec3da3a

Branch: refs/heads/trunk
Commit: fec3da3a2ef58e30f4239278e326921d406ca585
Parents: 0a9cd64
Author: atkach <at...@hortonworks.com>
Authored: Fri Jan 31 16:59:29 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Fri Jan 31 16:59:29 2014 +0200

----------------------------------------------------------------------
 .../global/background_operations_controller.js  |  6 +-
 .../main/background_operations_popup.hbs        | 53 --------------
 ambari-web/app/utils/ajax.js                    |  2 +-
 ambari-web/app/views/main.js                    | 77 --------------------
 4 files changed, 5 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fec3da3a/ambari-web/app/controllers/global/background_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/background_operations_controller.js b/ambari-web/app/controllers/global/background_operations_controller.js
index 68485fa..85cea61 100644
--- a/ambari-web/app/controllers/global/background_operations_controller.js
+++ b/ambari-web/app/controllers/global/background_operations_controller.js
@@ -108,12 +108,14 @@ App.BackgroundOperationsController = Em.Controller.extend({
    * @param params
    */
   callBackFilteredByRequest: function (data, ajaxQuery, params) {
+    var requestId = data.Requests.id;
+    var request = this.get('services').findProperty('id', requestId);
     var hostsMap = {};
-    var request = this.get('services').findProperty('id', data.Requests.id);
     var previousTaskStatusMap = request.get('previousTaskStatusMap');
     var currentTaskStatusMap = {};
     data.tasks.forEach(function (task) {
       var host = hostsMap[task.Tasks.host_name];
+      task.Tasks.request_id = requestId;
       if (host) {
         host.logTasks.push(task);
         host.isModified = (host.isModified) ? true : previousTaskStatusMap[task.Tasks.id] !== task.Tasks.status;
@@ -174,7 +176,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
           id: request.Requests.id,
           name: requestParams.requestContext,
           displayName: requestParams.requestContext,
-          progress: Math.ceil(request.Requests.progress_percent),
+          progress: Math.floor(request.Requests.progress_percent),
           status: request.Requests.request_status,
           isRunning: isRunning,
           hostsMap: {},

http://git-wip-us.apache.org/repos/asf/ambari/blob/fec3da3a/ambari-web/app/templates/main/background_operations_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/background_operations_popup.hbs b/ambari-web/app/templates/main/background_operations_popup.hbs
deleted file mode 100644
index 1b08e4e..0000000
--- a/ambari-web/app/templates/main/background_operations_popup.hbs
+++ /dev/null
@@ -1,53 +0,0 @@
-{{!
-* 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.
-}}
-
-{{#each operation in allOperations}}
-  {{#view App.MainBackgroundOperation contentBinding="operation"}}
-<div>
-  <a {{action showOperationLog target="view"}} href="#">
-    <i {{bindAttr class="view.iconClass"}}></i>
-    {{#if view.isOpen}}{{t common.hide}}{{else}}{{t common.show}}{{/if}} info about {{operation.command}} {{operation.role}}
-    on {{operation.host_name}}
-  </a>
-  {{#if view.hasProgressBar}}
-  <div {{bindAttr class="view.isInProgress:progress-striped :active view.barColor :progress"}}>
-    <div class="bar"></div>
-  </div>
-  {{/if}}
-  <div class="content-area">
-    <div class="textTrigger">{{t popup.highlight}}</div>
-    {{#if view.isOpen}}
-    {{#if view.isTextArea}}
-    <div>
-      {{view view.textArea contentBinding="operation"}}
-    </div>
-    {{else}}
-    <div>
-      <h5>exitcode:</h5>
-        <pre class="stderr">{{#if operation.display_exit_code}}{{operation.exit_code}}{{/if}}</pre>
-      <h5>stderr:</h5>
-      <pre class="stderr">{{highlight operation.stderr [err;fail]}}</pre>
-      <h5>stdout:</h5>
-      <pre class="stdout">{{highlight operation.stdout [err;fail]}}</pre>
-    </div>
-    {{/if}}
-    {{/if}}
-  </div>
-</div>
-  {{/view}}
-{{/each}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fec3da3a/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 1f016c2..8f2a99e 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -44,7 +44,7 @@ var urls = {
     'testInProduction': true
   },
   'background_operations.get_by_request': {
-    'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/command,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status',
+    'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/command,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
     'mock': '/data/background_operations/task_by_request{requestId}.json',
     'testInProduction': true,
     'format': function (data) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fec3da3a/ambari-web/app/views/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main.js b/ambari-web/app/views/main.js
index 0e0da78..e30d471 100644
--- a/ambari-web/app/views/main.js
+++ b/ambari-web/app/views/main.js
@@ -21,81 +21,4 @@ var App = require('app');
 
 App.MainView = Em.View.extend({
   templateName:require('templates/main')
-});
-
-App.MainBackgroundOperation = Em.View.extend({
-  content: null,
-  classNames: ['background-operations'],
-  classNameBindings: ['isOpen'],
-  isOpen: function () {
-    return this.get('content.isOpen');
-  }.property('content.isOpen'),
-  iconClass: function(){
-    return this.get('isOpen') ? 'icon-minus' : 'icon-plus';
-  }.property('isOpen'),
-  showOperationLog:function(){
-    this.set('content.isOpen', !this.get('content.isOpen'));
-    this.set('isTextArea', false);
-  },
-  hasProgressBar: function () {
-    return this.get('content.command') == 'EXECUTE';
-  }.property('content.command'),
-  isInProgress: function () {
-    var status = this.get('content.status');
-    return status == 'IN_PROGRESS' || status == 'QUEUED' || status == 'PENDING';
-  }.property('content.status'),
-  barColor: function () {
-    if (this.get('isInProgress')) {
-      return 'progress-info';
-    } else {
-      if (this.get('content.status') == 'COMPLETED') return 'progress-success';
-      return 'progress-danger';
-    }
-  }.property('isInProgress'),
-  buttonLabel:function(){
-    var button = $(this.get('element')).find('.textTrigger');
-    if(this.get('isTextArea')){
-      button.text('press CTRL+C');
-    } else {
-      button.text('click to highlight');
-    }
-  }.observes('isTextArea'),
-  didInsertElement: function () {
-    var self = this;
-    var button = $(this.get('element')).find('.textTrigger');
-    button.click(function () {
-      self.set('isTextArea', !self.get('isTextArea'));
-    });
-    $(this.get('element')).find('.content-area').mouseenter(
-      function () {
-        var element = $(this);
-        element.css('border', '1px solid #dcdcdc');
-        button.css('visibility', 'visible');
-      }).mouseleave(
-      function () {
-        var element = $(this);
-        element.css('border', 'none');
-        button.css('visibility', 'hidden');
-      })
-  },
-  isTextArea: false,
-  textArea: Em.TextArea.extend({
-    didInsertElement: function(){
-      var element = $(this.get('element'));
-      element.width($(this.get('parentView').get('element')).width() - 10);
-      element.height($(this.get('parentView').get('element')).height());
-      element.select();
-      element.css('resize', 'none');
-    },
-    readOnly: true,
-    value: function(){
-      var operation = this.get('content');
-      var content = "";
-      content += operation.command + " " + operation.role + " on " + operation.host_name + "\n";
-      content += "exitcode: " + operation.exit_code + "\n";
-      content += "stderr: " + operation.stderr + "\n";
-      content += "stdout: " + operation.stdout + "\n";
-      return content;
-    }.property('content')
-  })
 });
\ No newline at end of file