ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject ambari git commit: AMBARI-13279. Pig view shows completed but does not state if anything went wrong (Nitiraj Rathore via srimanth)
Date Wed, 04 Nov 2015 22:15:42 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 d0c0a5edf -> d9f468ce6


AMBARI-13279. Pig view shows completed but does not state if anything went wrong (Nitiraj
Rathore via srimanth)


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

Branch: refs/heads/branch-2.1
Commit: d9f468ce644c67c0d15a4f53768e81298abd2e93
Parents: d0c0a5e
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Wed Nov 4 14:13:19 2015 -0800
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Wed Nov 4 14:13:19 2015 -0800

----------------------------------------------------------------------
 .../pig-web/app/components/highlightErrors.js   | 45 +++++++++++
 .../resources/ui/pig-web/app/controllers/pig.js | 58 ++++++++-----
 .../ui/pig-web/app/controllers/pigAlert.js      |  4 +-
 .../ui/pig-web/app/controllers/pigScripts.js    | 83 +++++++++++--------
 .../ui/pig-web/app/controllers/scriptJob.js     | 32 ++++++++
 .../main/resources/ui/pig-web/app/initialize.js |  1 +
 .../resources/ui/pig-web/app/styles/style.less  |  7 ++
 .../ui/pig-web/app/templates/script/job.hbs     | 85 +++++++++++---------
 .../resources/ui/pig-web/app/views/pig/alert.js | 12 +--
 .../ui/pig-web/app/views/script/job.js          | 31 ++++---
 10 files changed, 244 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/components/highlightErrors.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/highlightErrors.js
b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/highlightErrors.js
new file mode 100644
index 0000000..15e24c6
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/highlightErrors.js
@@ -0,0 +1,45 @@
+/**
+ * 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.HighlightErrorsComponent = Em.Component.extend({
+  text:'',
+  hasErrors:false,
+  lines: function () {
+    var text = this.get('text')||'',
+        splitted = text.split('\n'),
+        lines = [],
+        foundErrors = false;
+
+    splitted.forEach(function (line) {
+      if (line.match(' ERROR ')) {
+        foundErrors = true;
+        lines.push({error:'error',content:line});
+      } else {
+        lines.push({error:'',content:line});
+      };
+    });
+
+    this.set('hasErrors',foundErrors);
+
+    return lines;
+  }.property('text'),
+  layout:Em.Handlebars.compile('{{#each line in lines}} <pre class="{{unbound line.error}}"
> {{line.content}} </pre>{{/each}}')
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
index 1741a07..2ceb364 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
@@ -31,33 +31,16 @@ App.PigController = Em.ArrayController.extend({
       this.transitionToRoute('pig');
     },
     saveScript: function (script,onSuccessCallback) {
-      var onSuccess = onSuccessCallback || function(model){
-          //this.set('disableScriptControls',false);
-          this.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_saved',{title:
script.get('title')}),status:'success'});
-        }.bind(this),
-        onFail = function(error){
-          var trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
-          this.send('showAlert', {'message':Em.I18n.t('scripts.alert.save_error'),status:'error',trace:trace});
-        }.bind(this);
-
-      return script.get('pigScript').then(function(file){
-        return Ember.RSVP.all([file.save(),script.save()]).then(onSuccess,onFail);
-      },onFail);
+      return script.get('pigScript').then(function (file){
+        return Ember.RSVP.all([file.save(),script.save()]);
+      }).then(onSuccessCallback || Em.run.bind(this,'saveScriptSuccess'), Em.run.bind(this,'saveScriptFailed'));
     },
     deletescript:function (script) {
       return this.send('openModal','confirmDelete',script);
     },
     confirmdelete:function (script) {
-      var onSuccess = function(model){
-            this.transitionToRoute('pig.scripts');
-            this.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_deleted',{title
: model.get('title')}),status:'success'});
-          }.bind(this);
-      var onFail = function(error){
-            var trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
-            this.send('showAlert', {'message':Em.I18n.t('scripts.alert.delete_failed'),status:'error',trace:trace});
-          }.bind(this);
       script.deleteRecord();
-      return script.save().then(onSuccess,onFail);
+      return script.save().then(Em.run.bind(this,'deleteScriptSuccess'),Em.run.bind(this,'deleteScriptFailed'));
     },
     copyScript:function (script) {
       var newScript = this.store.createRecord('script',{
@@ -95,5 +78,36 @@ App.PigController = Em.ArrayController.extend({
 
   saveEnabled:function () {
     return this.get('scriptDirty') && !this.get('disableScriptControls');
-  }.property('scriptDirty','disableScriptControls')
+  }.property('scriptDirty','disableScriptControls'),
+
+  saveScriptSuccess: function (script) {
+    this.send('showAlert', {
+      'message': Em.I18n.t('scripts.alert.script_saved', { 'title' : script.get('title')
} ),
+      'status': 'success'
+    });
+  },
+
+  saveScriptFailed: function (error) {
+    this.send('showAlert', {
+      'message': Em.I18n.t('scripts.alert.save_error'),
+      'status': 'error',
+      'trace': (error && error.responseJSON.trace) ? error.responseJSON.trace : null
+    });
+  },
+
+  deleteScriptSuccess: function (script) {
+    this.transitionToRoute('pig.scripts');
+    this.send('showAlert', {
+      'message': Em.I18n.t('scripts.alert.script_deleted', { 'title': script.get('title')
} ),
+      'status': 'success'
+    });
+  },
+
+  deleteScriptFailed: function (error) {
+    this.send('showAlert', {
+      'message': Em.I18n.t('scripts.alert.delete_failed'),
+      'status': 'error',
+      'trace': (error && error.responseJSON.trace) ? error.responseJSON.trace : null
+    });
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
index 27685f2..5d1a37f 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
@@ -19,15 +19,13 @@
 var App = require('app');
 
 App.PigAlertController = Ember.ArrayController.extend({
-  model:[],
   needs: ['pigErrorLog'],
   actions:{
     removeAlertObject:function (alert) {
       this.get('content').removeObject(alert);
     },
     showErrorLog:function (context) {
-      errorLogController = this.get('controllers.pigErrorLog');
-      errorLogController.set('errorLog', context.trace);
+      this.set('controllers.pigErrorLog.errorLog',context.trace);
       this.transitionToRoute('pig.errorLog');
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js
b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js
index 2c2318b..6dcb3fe 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigScripts.js
@@ -24,37 +24,14 @@ App.PigScriptsController = Em.ArrayController.extend(App.Pagination,{
   needs:['pig'],
   actions:{
     createScript:function () {
-      var newScript = this.store.createRecord('script');
-      return this.send('openModal', 'createScript', newScript);
+      return this.send('openModal', 'createScript', this.store.createRecord('script'));
     },
     confirmcreate:function (script,filePath) {
-      var _this = this;
-      var bnd = Em.run.bind;
-
       if (filePath) {
-        try {
-          var file = this.store.createRecord('file',{
-            id:filePath,
-            fileContent:''
-          });
-        } catch (e) {
-          return this.createScriptError(script,e);
-        }
-        return file.save()
-          .then(function(file){
-              script.set('pigScript',file);
-              script.save().then(bnd(_this,_this.createScriptSuccess),bnd(_this,_this.createScriptError,script));
-            },
-            function () {
-              file.deleteRecord();
-              _this.store.find('file', filePath).then(function(file) {
-                _this.send('showAlert', {message:Em.I18n.t('scripts.alert.file_exist_error'),status:'success'});
-                script.set('pigScript',file);
-                script.save().then(bnd(_this,_this.createScriptSuccess),bnd(_this,_this.createScriptError,script));
-              },bnd(_this,_this.createScriptError,script));
-          });
+        return Em.RSVP.Promise.all([Em.RSVP.resolve(script), this.getOrCreateFile(filePath)])
+          .then(this.setFileAndSave.bind(this), Em.run.bind(this,'createScriptError', script));
       } else {
-          script.save().then(bnd(this,this.createScriptSuccess),bnd(this,this.createScriptError,script));
+        script.save().then(this.createScriptSuccess.bind(this), Em.run.bind(this,'createScriptError',script));
       }
     },
     deletescript:function (script) {
@@ -65,17 +42,55 @@ App.PigScriptsController = Em.ArrayController.extend(App.Pagination,{
     }
   },
 
-  createScriptSuccess:function (script,s) {
-    this.send('showAlert', { message:Em.I18n.t('scripts.alert.script_created',{title:script.get('title')}),
status:'success' });
+  getOrCreateFile: function (path) {
+    var store = this.get('store');
+
+    return new Em.RSVP.Promise(function (resolve, reject) {
+      store.find('file',path).then(function (file) {
+          resolve(file);
+        }, function (error) {
+          if (error.status === 404) {
+            var newFile = store.createRecord('file',{
+              id:path,
+              fileContent:''
+            });
+
+            newFile.save().then(function (file) {
+              resolve(file);
+            }, function (error) {
+              reject(error);
+            });
+          } else {
+            reject(error);
+          }
+        });
+    });
+  },
+
+  setFileAndSave: function (data) {
+    var script = data.objectAt(0),
+        file = data.objectAt(1);
+
+    var pr = script.set('pigScript',file).save();
+
+    return pr.then(this.createScriptSuccess.bind(this),Em.run.bind(this,'createScriptError',script));
+  },
+
+  createScriptSuccess:function (script) {
     this.transitionToRoute('script.edit',script);
+    this.send('showAlert', {
+      'message': Em.I18n.t('scripts.alert.script_created', { 'title' : script.get('title')
} ),
+      'status': 'success'
+    });
   },
-  createScriptError:function (script,error) {
-    var trace = null;
-    trace = (error.responseJSON)?error.responseJSON.trace:error.message;
 
+  createScriptError: function (script, error) {
     script.deleteRecord();
-
-    this.send('showAlert', {message:Em.I18n.t('scripts.alert.create_failed'),status:'error',trace:trace});
+    this.send('showAlert', {
+      'message': Em.I18n.t('scripts.alert.create_failed'),
+      'status': 'error',
+      'trace': (error.responseJSON) ? error.responseJSON.trace : error.message
+    });
   },
 
   jobs:function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js
b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js
index 2d8226b..daa640c 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptJob.js
@@ -42,6 +42,10 @@ App.ScriptJobController = Em.ObjectController.extend(App.FileHandler,{
     });
   }.property('content'),
 
+
+
+  jobResultsHidden:true,
+
   jobResults:function (output) {
     var jobId = this.get('content.id');
     var url = ['jobs', jobId, 'results', 'stdout'].join('/');
@@ -49,6 +53,14 @@ App.ScriptJobController = Em.ObjectController.extend(App.FileHandler,{
     return this.fileProxy(url);
   }.property('content'),
 
+  showJobResults:function () {
+    if (!Em.isEmpty(this.get('jobResults.content.fileContent'))) {
+      this.set('jobResultsHidden',false);
+    }
+  }.observes('jobResults.content.fileContent'),
+
+  jobLogsHidden:true,
+
   jobLogs:function (output) {
     var jobId = this.get('content.id');
     var url = ['jobs', jobId, 'results', 'stderr'].join('/');
@@ -56,10 +68,30 @@ App.ScriptJobController = Em.ObjectController.extend(App.FileHandler,{
     return this.fileProxy(url);
   }.property('content'),
 
+  showJobLogs:function () {
+    if (!Em.isEmpty(this.get('jobLogs.content.fileContent')) && this.get('jobResults.isFulfilled')
&& Em.isEmpty(this.get('jobResults.content.fileContent'))) {
+      this.set('jobLogsHidden',false);
+    }
+  }.observes('jobLogs.content.fileContent','jobResults.isFulfilled','jobResults.content.fileContent'),
+
+  hasErrorInLogs:false,
+
+  resetLogsErrors:function () {
+    if (this.get('jobLogs.isPending')) this.set('hasErrorInLogs',false);
+  }.observes('jobLogs.isPending'),
+
   suggestedFilenamePrefix: function() {
     return this.get("content.jobId").toLowerCase().replace(/\W+/g, "_");
   }.property("content.jobId"),
 
+  reloadOutputs: function(){
+    Em.run.later(this,function () {
+      if (this.get('content.jobInProgress')) {
+        Em.run.debounce(this,'notifyPropertyChange','content',5000);
+      };
+    },10000);
+   }.observes('content'),
+
   actions:{
     download:function (opt) {
       var file = (opt == 'results')?'jobResults.content.fileContent':'jobLogs.content.fileContent';

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
index 91b335b..19f6e31 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/initialize.js
@@ -185,3 +185,4 @@ require("components/pigHelper");
 require("components/scriptListRow");
 require("components/tabControl");
 require("components/pathInput");
+require("components/highlightErrors");

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less b/contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less
index 652cc9b..27ce8aa 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/styles/style.less
@@ -583,6 +583,7 @@
   }
   #scriptResults .panel-body, #scriptLogs .panel-body {
     max-height: 550px;
+    min-height: 55px;
     overflow-x: hidden;
     background-color: #fcfcfc;
     pre {
@@ -591,6 +592,12 @@
       border: 0;
       border-radius: 0;
       background-color: #fcfcfc;
+      &.error {
+        background-color: #f2dede;
+      }
+    }
+    .alert {
+      word-wrap: break-word;
     }
   }
   #sgrip {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
index 1584648..1055e26 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
@@ -18,6 +18,7 @@
 <div class="job-container">
   <h3>
     {{title}} - <span {{bind-attr class=":label jobSuccess:label-success jobError:label-danger
jobInProgress:label-warning "}}>{{status}}</span>
+    {{#if hasErrorInLogs}} <span class="label label-danger"><i class="fa fa-exclamation"></i></span>
{{/if}}
   </h3>
 
     <div class="row">
@@ -35,8 +36,8 @@
           {{/if}}
         </div>
       {{/if}}
-    </div>
-
+    </d
+iv>
   <table class="table job-info">
     <tbody>
       <tr>
@@ -50,20 +51,21 @@
     </tbody>
   </table>
 
-  {{#unless jobInProgress}}
-    <div class="panel panel-default">
+    {{#view view.collapsePanel class="panel panel-default" collapsed=jobResultsHidden}}
       <div class="panel-heading">
         <h4 class="panel-title">
-          <a data-toggle="collapse" href="#scriptResults">
-            <i class="toggle-icon fa fa-fw fa-chevron-right fa-rotate-90"></i>
+          <a {{action 'toggleCollapse' target="view"}} href="#">
+            <i {{bind-attr class=":toggle-icon :fa :fa-fw :fa-chevron-right view.collapsed::fa-rotate-90"}}></i>
             {{t 'job.results'}}
           </a>
-          {{#if jobResults.isFulfilled }}
-          <p class="pull-right" ><a href="#" {{action 'download' 'results'}}><i
class="fa fa-download"></i> {{t 'common.download'}}</a></p>
-          {{/if}}
+          {{#unless jobInProgress}}
+            {{#if jobResults.isFulfilled }}
+              <p class="pull-right" ><a href="#" {{action 'download' 'results'}}><i
class="fa fa-download"></i> {{t 'common.download'}}</a></p>
+            {{/if}}
+          {{/unless}}
         </h4>
       </div>
-      {{#view view.collapsePanel id="scriptResults" class="panel-collapse collapse in" }}
+      <div id="scriptResults" class="panel-collapse collapse">
         <div class="panel-body">
         {{#if jobResults.isPending}}
           <div class="spinner-sm"></div>
@@ -71,53 +73,64 @@
           {{#if jobResults.isFulfilled }}
           <pre>{{jobResults.content.fileContent}}</pre>
           {{/if}}
-          {{#if jobResults.isRejected}}
-            {{jobResults.reason}}
-          {{/if}}
+          {{#unless jobInProgress}}
+            {{#if jobResults.isRejected}}
+              <div class="alert alert-danger" role="alert">
+                {{jobResults.reason}}
+              </div>
+            {{/if}}
+          {{/unless}}
         {{/if}}
         </div>
-      {{/view}}
-    </div>
+      </div>
+    {{/view}}
+
 
-    <div class="panel panel-default">
+    {{#view view.collapsePanel classBinding=":panel :panel-default" collapsed=jobLogsHidden}}
       <div class="panel-heading">
         <h4 class="panel-title">
-          <a data-toggle="collapse" href="#scriptLogs">
-            <i class="toggle-icon fa fa-fw fa-chevron-right"></i>
-            {{t 'job.logs'}}
+          <a  {{action 'toggleCollapse' target="view"}} href="#">
+            <i {{bind-attr class=":toggle-icon :fa :fa-fw :fa-chevron-right view.collapsed::fa-rotate-90"}}
></i>
+            {{t 'job.logs'}} {{#if hasErrorInLogs}} <span class="label label-danger"><i
class="fa fa-exclamation"></i></span> {{/if}}
           </a>
-          {{#if jobLogs.isFulfilled}}
-          <p class="pull-right" ><a href="#" {{action 'download' 'logs'}}><i
class="fa fa-download"></i> {{t 'common.download'}}</a></p>
-          {{/if}}
+          {{#unless jobInProgress}}
+            {{#if jobLogs.isFulfilled}}
+              <p class="pull-right" ><a href="#" {{action 'download' 'logs'}}><i
class="fa fa-download"></i> {{t 'common.download'}}</a></p>
+            {{/if}}
+          {{/unless}}
         </h4>
       </div>
-      {{#view view.collapsePanel id="scriptLogs" class="panel-collapse collapse"}}
+      <div id="scriptLogs" class="panel-collapse collapse">
         <div class="panel-body">
         {{#if jobLogs.isPending}}
           <div class="spinner-sm"></div>
         {{else}}
           {{#if jobLogs.isFulfilled}}
-          <pre>{{jobLogs.content.fileContent}}</pre>
-          {{/if}}
-          {{#if jobLogs.isRejected}}
-            {{jobLogs.reason}}
+            {{highlight-errors text=jobLogs.content.fileContent hasErrors=hasErrorInLogs}}
           {{/if}}
+          {{#unless jobInProgress}}
+            {{#if jobLogs.isRejected}}
+              <div class="alert alert-danger" role="alert">
+                {{jobLogs.reason}}
+              </div>
+            {{/if}}
+          {{/unless}}
         {{/if}}
         </div>
-      {{/view}}
-    </div>
-  {{/unless}}
+      </div>
+    {{/view}}
 
-    <div class="panel panel-default">
+
+    {{#view view.collapsePanel class="panel panel-default" hasEditor=true}}
       <div class="panel-heading">
         <h4 class="panel-title">
-          <a data-toggle="collapse" href="#scriptDetails">
-            <i class="toggle-icon fa fa-fw fa-chevron-right"></i>
+          <a  {{action 'toggleCollapse' target="view"}} href="#">
+            <i {{bind-attr class=":toggle-icon :fa :fa-fw :fa-chevron-right view.collapsed::fa-rotate-90"}}></i>
             {{t 'job.script_details'}}
           </a>
         </h4>
       </div>
-      {{#view view.collapsePanel id="scriptDetails" class="panel-collapse collapse" }}
+      <div id="scriptDetails" class="panel-collapse collapse">
         <div {{bind-attr class=":panel-body :body-title :body-title-contents fullscreen:fullscreen
"}} >
           {{t 'job.script_contents'}}:
           <div class="fullscreen-toggle pull-right" {{action 'fullscreen'}} data-toggle="tooltip"
data-placement="bottom" {{translateAttr title="editor.toggle_fullscreen"}}><i {{bind-attr
class=":fa :fa-lg fullscreen:fa-compress:fa-expand"}} ></i></div>
@@ -154,7 +167,7 @@
             </div>
           {{/if}}
         </div>
-      {{/view}}
-    </div>
+      </div>
+    {{/view}}
 
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/alert.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/alert.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/alert.js
index 542e047..bc773c3 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/alert.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/alert.js
@@ -28,16 +28,16 @@ App.PigAlertView = Ember.View.extend({
       dismiss:'alert',
       templateName: 'partials/alert-content',
       didInsertElement:function () {
-        this.$().bind('closed.bs.alert', function () {
-          return this.clearAlert();
-        }.bind(this));
+        this.$().bind('closed.bs.alert', Ember.run.bind(this, 'clearAlert'));
 
-        if (this.get('content.status')!='error') {
-          Ember.run.debounce(this, this.close, 3000);
+        if (this.get('content.status') != 'error') {
+          Ember.run.debounce(this, 'close', 3000);
         }
       },
       close : function () {
-        return this.$().alert('close');
+        if (Em.isArray(this.$())) {
+          this.$().alert('close');
+        }
       },
       clearAlert:function () {
         return this.get('controller').send('removeAlertObject',this.get('content'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9f468ce/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js
index 6582688..a6f3be0 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/job.js
@@ -20,15 +20,23 @@ var App = require('app');
 
 App.ScriptJobView = Em.View.extend({
   collapsePanel: Em.View.extend({
-    rotateToggle:function () {
-      this.$().on('hide.bs.collapse', function (e) {
-        this.$().parent().find('.toggle-icon').removeClass('fa-rotate-90');
-      }.bind(this));
-      this.$().on('show.bs.collapse', function (e) {
-        this.$().parent().find('.toggle-icon').addClass('fa-rotate-90');
-      }.bind(this));
-      //fix for CodeMirror not rendered properly in hidden container
-      if (this.get('elementId') === "scriptDetails") {
+    actions:{
+      toggleCollapse:function () {
+        this.toggleProperty('collapsed');
+      }
+    },
+    collapsed:true,
+    collapseControl: function () {
+      this.$('.collapse').collapse(this.get('collapsed') ? 'hide' : 'show');
+    }.observes('collapsed'),
+    initCollapse:function () {
+      this.$('.collapse').collapse({
+        toggle: !this.get('collapsed')
+      })
+    }.on('didInsertElement'),
+    hasEditor:false,
+    fixEditor:function () {
+      if (this.get('hasEditor')) {
         this.$().on('shown.bs.collapse', function (e) {
           var cme = this.$('.CodeMirror').get(0);
           if (cme && cme.CodeMirror) {
@@ -36,10 +44,7 @@ App.ScriptJobView = Em.View.extend({
           }
         }.bind(this));
       }
-    }.on('didInsertElement'),
-    unbindToggle:function () {
-      this.$().off('hide.bs.collapse','show.bs.collapse');
-    }.on('willClearRender')
+    }.on('didInsertElement')
   }),
   bindTooltips:function () {
     $('.fullscreen-toggle').tooltip();


Mime
View raw message