You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/06/12 01:56:22 UTC

svn commit: r1492013 [2/2] - in /incubator/ambari/branches/branch-1.4.0: ambari-server/src/main/java/org/apache/ambari/eventdb/db/ ambari-server/src/main/java/org/apache/ambari/eventdb/model/ ambari-server/src/main/java/org/apache/ambari/eventdb/webser...

Added: incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item/app_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item/app_view.js?rev=1492013&view=auto
==============================================================================
--- incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item/app_view.js (added)
+++ incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item/app_view.js Tue Jun 11 23:56:21 2013
@@ -0,0 +1,136 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var sort = require('views/common/sort_view');
+var appGraph = require('utils/app_graph');
+
+App.MainAppsItemAppView = Em.View.extend({
+  templateName: require('templates/main/apps/item/app'),
+  elementId : 'jobs',
+  content:function(){
+    return this.get('controller.content.jobs');
+  }.property('controller.content.jobs'),
+
+  classNames:['table','dataTable'],
+  /**
+   * convert content to special jobs object
+   */
+  jobs: function(){
+    var c = this.get('content');
+    var result = [];
+    c.forEach(function(item, index){
+      result[index] = new Object({
+        'name' : item.get('id'),
+        'type' : item.get('app_type'),
+        'entityName' : item.get('workflow_entity_name'),
+        'status' : item.get('status'),
+        'submitTime' : item.get('submit_time'),
+        'finishTime' : item.get('finish_time'),
+        'elapsedTime' : appGraph.formatDuration(item.get('elapsed_time')),
+        'numStages' : item.get('num_stages'),
+        'stages' : item.get('stages')
+      })
+    });
+    return result;
+  }.property('content'),
+
+  loaded : false,
+
+  hasManyJobs: function(){
+    return (this.get('content') && this.get('content').length > 1);
+  }.property('content'),
+
+  onLoad:function (){
+    if(!this.get('controller.content.loadAllJobs') || this.get('loaded')){
+      return;
+    }
+
+    this.set('loaded', true);
+
+    var self = this;
+
+    Ember.run.next(function(){
+      self.draw();
+    });
+
+  }.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();
+  },
+
+  draw: function(){
+    var dagSchema = this.get('controller.content.workflowContext');
+    var jobs = this.get('jobs');
+    this.resizeModal();
+    appGraph.create('app_graph', dagSchema, jobs, this.$().width(), 300);
+  },
+  sortView: sort.wrapperView,
+  nameSort: sort.fieldView.extend({
+    name:'workflow_entity_name',
+    displayName: Em.I18n.t('apps.item.dag.job')
+  }),
+  idSort: sort.fieldView.extend({
+    name:'id',
+    displayName: Em.I18n.t('apps.item.dag.jobId')
+  }),
+  typeSort: sort.fieldView.extend({
+    name:'app_type',
+    displayName: Em.I18n.t('apps.item.dag.type')
+  }),
+  statusSort: sort.fieldView.extend({
+    name:'status',
+    displayName: Em.I18n.t('apps.item.dag.status')
+  }),
+  numStagesSort: sort.fieldView.extend({
+    name:'num_stages',
+    displayName: Em.I18n.t('apps.item.dag.num_stages')
+  }),
+  stagesSort: sort.fieldView.extend({
+    name:'stages',
+    displayName: Em.I18n.t('apps.item.dag.stages')
+  }),
+  durationSort: sort.fieldView.extend({
+    name:'elapsed_time',
+    displayName: Em.I18n.t('apps.item.dag.duration')
+  })
+});

Propchange: incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item/app_view.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item_view.js?rev=1492013&r1=1492012&r2=1492013&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item_view.js (original)
+++ incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps/item_view.js Tue Jun 11 23:56:21 2013
@@ -17,23 +17,13 @@
  */
 
 var App = require('app');
+var stringUtils = require('utils/string_utils');
 
 App.MainAppsItemView = Em.View.extend({
   tagName: 'tr',
   classNames : ['containerRow'],
   templateName:require('templates/main/apps/item'),
-  menuTabs:[
-    Em.Object.create({
-      label:Em.I18n.t('apps.dagCharts.popup.dag'),
-      active:'active',
-      content:'App.MainAppsItemDagView'
-    }),
-    Em.Object.create({
-      label:Em.I18n.t('apps.dagCharts.popup.tasks'),
-      active:'',
-      content:'App.MainAppsItemBarView'
-    })
-  ],
+  menuTabs:[],
   activeTab:null,
   switchTab:function(event){
     var tabs = this.get('menuTabs');
@@ -48,10 +38,30 @@ App.MainAppsItemView = Em.View.extend({
     this.set('activeTab', event.context);
   },
   didInsertElement: function(){
-    var tabs = this.get('menuTabs');
-    tabs[0].set('active', 'active');
-    tabs[1].set('active', '');
-    this.set('activeTab', tabs[0]);
+    if (!App.testMode && stringUtils.compareVersions(App.get('currentStackVersionNumber'), "2.0") === -1) {
+      var tabs = [
+        Em.Object.create({
+          label:Em.I18n.t('apps.dagCharts.popup.dag'),
+          active:'active',
+          content:'App.MainAppsItemDagView'
+        }),
+        Em.Object.create({
+          label:Em.I18n.t('apps.dagCharts.popup.tasks'),
+          active:'',
+          content:'App.MainAppsItemBarView'
+        })];
+      this.set('menuTabs', tabs);
+      this.set('activeTab', tabs[0]);
+    } else {
+      var tabs = [
+        Em.Object.create({
+          label:Em.I18n.t('apps.dagCharts.popup.dag'),
+          active:'active',
+          content:'App.MainAppsItemAppView'
+        })];
+      this.set('menuTabs', tabs);
+      this.set('activeTab', tabs[0]);
+    }
   },
   containerView: Em.ContainerView.extend({
     onchange:function(){

Modified: incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps_view.js?rev=1492013&r1=1492012&r2=1492013&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps_view.js (original)
+++ incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/apps_view.js Tue Jun 11 23:56:21 2013
@@ -103,7 +103,7 @@ App.MainAppsView = Em.View.extend({
     class: "sorting",
     widthClass: "",
     content: null,
-    defaultColumn: 8,
+    defaultColumn: 9,
 
     didInsertElement: function () {
       this.set("widthClass", "col" + this.content.index);
@@ -161,6 +161,14 @@ App.MainAppsView = Em.View.extend({
     fieldType: 'input-small'
   }),
   /**
+   * Filter-field for tags.
+   * Based on <code>filters</code> library
+   */
+  tagFilterView: filters.createTextView({
+    valueBinding: "controller.filterObject.tagSearch",
+    fieldType: 'input-super-mini'
+  }),
+  /**
    * Filter-field for type.
    * Based on <code>filters</code> library
    */
@@ -346,4 +354,4 @@ App.MainAppsView = Em.View.extend({
 
   })
 
-});
\ No newline at end of file
+});

Modified: incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/menu.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/menu.js?rev=1492013&r1=1492012&r2=1492013&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/menu.js (original)
+++ incubator/ambari/branches/branch-1.4.0/ambari-web/app/views/main/menu.js Tue Jun 11 23:56:21 2013
@@ -31,17 +31,14 @@ App.MainMenuView = Em.CollectionView.ext
       { label:Em.I18n.t('menu.item.dashboard'), routing:'dashboard', active:'active'},
       { label:Em.I18n.t('menu.item.heatmaps'), routing:'charts'},
       { label:Em.I18n.t('menu.item.services'), routing:'services'},
-      { label:Em.I18n.t('menu.item.hosts'), routing:'hosts'}
+      { label:Em.I18n.t('menu.item.hosts'), routing:'hosts'},
+      { label:Em.I18n.t('menu.item.jobs'), routing:'apps'}
     ];
 
     if (App.supports.mirroring) {
       result.push({ label:Em.I18n.t('menu.item.mirroring'), routing:'mirroring'});
     }
 
-    if (stringUtils.compareVersions(App.get('currentStackVersionNumber'), "2.0") === -1) {
-      result.push({ label:Em.I18n.t('menu.item.jobs'), routing:'apps'});
-    }
-
     if (App.get('isAdmin')) {
       result.push({ label:Em.I18n.t('menu.item.admin'), routing:'admin'});
     }
@@ -84,4 +81,4 @@ App.MainMenuView = Em.CollectionView.ext
 
     templateName: require('templates/main/menu_item')
   })
-});
\ No newline at end of file
+});