ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-9399. Views: Pig, arguments are not stored when you save the script, error handling fixes. (alexantonenko)
Date Fri, 30 Jan 2015 09:26:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 72dcffc31 -> 876b1969c


AMBARI-9399. Views: Pig, arguments are not stored when you save the script, error handling
fixes. (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 876b1969c126e49f37e0163490bd5f6def3c3fe4
Parents: 72dcffc
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Jan 29 16:21:55 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Jan 30 11:24:30 2015 +0200

----------------------------------------------------------------------
 .../ui/pig-web/app/components/scriptListRow.js  |  3 ++
 .../resources/ui/pig-web/app/controllers/pig.js | 31 +++++++---------
 .../ui/pig-web/app/controllers/script.js        | 14 ++++---
 .../ui/pig-web/app/controllers/scriptEdit.js    | 20 ++++------
 .../main/resources/ui/pig-web/app/initialize.js |  1 +
 .../ui/pig-web/app/mixins/routeError.js         | 30 +++++++++++++++
 .../resources/ui/pig-web/app/models/pig_job.js  | 29 ++-------------
 .../ui/pig-web/app/models/pig_script.js         | 10 ++---
 .../main/resources/ui/pig-web/app/routes/pig.js | 28 ++++++++++----
 .../ui/pig-web/app/routes/pigHistory.js         | 10 +----
 .../ui/pig-web/app/routes/pigScripts.js         |  5 ++-
 .../resources/ui/pig-web/app/routes/pigUdfs.js  |  3 +-
 .../resources/ui/pig-web/app/routes/script.js   | 13 +++++++
 .../ui/pig-web/app/routes/scriptEdit.js         | 14 +------
 .../ui/pig-web/app/routes/scriptJob.js          |  2 +-
 .../app/templates/components/scriptListRow.hbs  | 29 ++++++++++-----
 .../ui/pig-web/app/templates/pig/scripts.hbs    | 39 +-------------------
 .../ui/pig-web/app/templates/script/job.hbs     |  4 +-
 .../resources/ui/pig-web/app/translations.js    |  4 ++
 .../resources/ui/pig-web/app/views/pig/alert.js | 20 ++++------
 20 files changed, 147 insertions(+), 162 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
index 2f5d9e6..3dc67ca 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
@@ -19,6 +19,9 @@
 var App = require('app');
 
 App.ScriptListRowComponent = Em.Component.extend({
+  layoutName:'components/scriptListRow',
+  jobs:[],
+  script:null,
   tagName:'tr',
   scriptJobs:function () {
     var scriptId = this.get('script.id');

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/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 8cde338..1741a07 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
@@ -60,24 +60,19 @@ App.PigController = Em.ArrayController.extend({
       return script.save().then(onSuccess,onFail);
     },
     copyScript:function (script) {
-      script.get('pigScript').then(function (file) {
-
-        var newScript = this.store.createRecord('script',{
-          title:script.get('title')+' (copy)',
-          templetonArguments:script.get('templetonArguments')
-        });
-
-        newScript.save().then(function (savedScript) {
-          savedScript.get('pigScript').then(function (newFile) {
-            newFile.set('fileContent',file.get('fileContent'));
-            newFile.save().then(function () {
-              this.send('showAlert', {'message':script.get('title') + ' is copied.',status:'success'});
-              if (this.get('activeScript')) {
-                this.send('openModal','gotoCopy',savedScript);
-              }
-            }.bind(this));
-          }.bind(this));
-        }.bind(this));
+      var newScript = this.store.createRecord('script',{
+        title:script.get('title')+' (copy)',
+        templetonArguments:script.get('templetonArguments')
+      });
+      newScript.save().then(function (savedScript) {
+        return Em.RSVP.all([savedScript.get('pigScript'),script.get('pigScript.fileContent')]);
+      }).then(function (data) {
+        return data.objectAt(0).set('fileContent',data.objectAt(1)).save();
+      }).then(function () {
+        this.send('showAlert', {'message':script.get('title') + ' is copied.',status:'success'});
+        if (this.get('activeScript')) {
+          this.send('openModal','gotoCopy',newScript);
+        }
       }.bind(this));
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js
index 6b0707f..d2a4891 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/script.js
@@ -54,13 +54,15 @@ App.ScriptController = Em.ObjectController.extend({
 
   activeJobs:Em.A(),
   activeJobsIds:Em.computed.mapBy('activeJobs','id'),
+  activeScriptId:Em.computed.alias('controllers.pig.activeScript.id'),
 
   staticTabs:function () {
     return [
-      {label:'Script',name:'script',url:'script.edit',target:this.get('controllers.pig.activeScript.id')},
-      {label:'History',name:'history',url:'script.history',target:this.get('controllers.pig.activeScript.id')}
+      {label:'Script',name:'script',url:'script.edit',target:this.get('activeScriptId')},
+      {label:'History',name:'history',url:'script.history',target:this.get('activeScriptId')}
     ];
-  }.property('controllers.pig.activeScript.id'),
+  }.property('activeScriptId'),
+
 
   jobTabs:function () {
     var jobTabs = [];
@@ -90,7 +92,7 @@ App.ScriptController = Em.ObjectController.extend({
     },
     onPoll: function() {
       this.get('jobs').forEach(function (job) {
-        if (job.get('needsPing')) {
+        if (job.get('jobInProgress')) {
           job.reload();
         } else {
           this.jobs.removeObject(job);
@@ -115,8 +117,8 @@ App.ScriptController = Em.ObjectController.extend({
   }.observes('activeJobs.@each'),
 
   activeJobsWatcher:function () {
-    if (this.get('activeJobs.firstObject.scriptId') != this.get('controllers.pig.activeScript.id'))
{
+    if (this.get('activeJobs.firstObject.scriptId') != this.get('controllers.pig.activeScriptId'))
{
       this.set('activeJobs',[]);
     }
-  }.observes('controllers.pig.activeScript.id')
+  }.observes('controllers.pig.activeScriptId')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
index 5ef95ad..e59f093 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
@@ -35,7 +35,7 @@ App.ScriptEditController = Em.ObjectController.extend({
   }.observes('content.title','isRenaming'),
 
   pigParamsMatch:function (controller) {
-    editorContent = this.get('content.pigScript.fileContent');
+    var editorContent = this.get('content.pigScript.fileContent');
     if (editorContent) {
       var match_var = editorContent.match(/\%\w+\%/g);
       if (match_var) {
@@ -64,14 +64,11 @@ App.ScriptEditController = Em.ObjectController.extend({
       var changedAttributes = this.get('content').changedAttributes();
 
       if (opt === 'ask') {
-        this.set('oldTitle',this.get('content.title'));
-        this.set('isRenaming',true);
+        this.setProperties({'oldTitle':this.get('content.title'),'isRenaming':true});
       }
 
       if (opt === 'cancel') {
-        this.set('content.title',this.get('oldTitle'));
-        this.set('oldTitle','');
-        this.set('isRenaming',false);
+        this.setProperties({'content.title':this.get('oldTitle'),'isRenaming':false,'oldTitle':''});
       }
 
       if (opt === this.get('content.title') && !Em.isBlank(this.get('content.title')))
{
@@ -80,8 +77,7 @@ App.ScriptEditController = Em.ObjectController.extend({
             this.send('showAlert', {message:Em.I18n.t('editor.title_updated'),status:'success'});
           }.bind(this));
         }
-        this.set('oldTitle','');
-        this.set('isRenaming',false);
+        this.setProperties({'oldTitle':'','isRenaming':false});
       }
     },
     addArgument:function (arg) {
@@ -90,15 +86,13 @@ App.ScriptEditController = Em.ObjectController.extend({
         return false;
       }
       if (!settled.contains(arg)) {
-        settled.pushObject(arg);
-        this.set('tmpArgument','');
+        this.setProperties({'content.argumentsArray': settled.pushObject(arg) &&
settled,'tmpArgument':''});
       } else {
         this.send('showAlert', {'message': Em.I18n.t('scripts.alert.arg_present'), status:'info'});
       }
     },
     removeArgument:function (arg) {
-      var removed = this.get('content.argumentsArray').removeObject(arg);
-      this.set('content.argumentsArray',removed);
+      this.set('content.argumentsArray',this.get('content.argumentsArray').removeObject(arg));
     },
     execute: function (script, operation) {
       this.set('isExec',true);
@@ -157,7 +151,7 @@ App.ScriptEditController = Em.ObjectController.extend({
       scriptId:script.get('id'),
 
       /**
-       * Add '-check' argument for syntax check and remove all for explain.
+       * Add '-check' argument for syntax check and remove all arguments for explain.
        * @type {String}
        */
       templetonArguments:(exc)?args:(chk)?(!args.match(/-check/g))?args+(args?"\t":"")+'-check':args:'',

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/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 f38b05e..91b335b 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
@@ -93,6 +93,7 @@ require('router');
 // mixins
 require("mixins/fileHandler");
 require("mixins/pagination");
+require("mixins/routeError");
 
 //routes
 require("routes/pig");

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/routeError.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/routeError.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/routeError.js
new file mode 100644
index 0000000..f6cd06a
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/routeError.js
@@ -0,0 +1,30 @@
+/**
+ * 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.RouteError = Ember.Mixin.create({
+  errorMassage:'',
+  actions:{
+    error:function (error) {
+      this.controllerFor('pig').set('category','');
+      var trace = (error.hasOwnProperty('responseJSON'))?error.responseJSON.trace:null;
+      this.send('showAlert', {message:this.get('errorMassage'), status:'error', trace:trace});
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js
index 6bf40c1..441c5ad 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_job.js
@@ -69,29 +69,6 @@ App.Job = DS.Model.extend({
     }).then(success,error);
   },
 
-  isExplainJob: function(){
-    return this.jobType == "explain";
-  },
-  isSyntaxCheckJob: function(){
-      return this.jobType == "syntax_check";
-  },
-  isUtilityJob:  function(){
-      return this.isExplainJob() || this.isSyntaxCheckJob();
-  },
-
-  pingStatusMap:{
-    'SUBMITTING':true,
-    'SUBMITTED':true,
-    'RUNNING':true,
-    'COMPLETED':false,
-    'SUBMIT_FAILED':false,
-    'KILLED':false,
-    'FAILED':false
-  },
-  needsPing:function () {
-    return this.pingStatusMap[this.get('status')];
-  }.property('status'),
-
   jobSuccess:function () {
     return this.get('status') == 'COMPLETED';
   }.property('status'),
@@ -104,11 +81,11 @@ App.Job = DS.Model.extend({
     return this.get('status') == 'SUBMITTING' || this.get('status') == 'SUBMITTED' || this.get('status')
== 'RUNNING';
   }.property('status'),
 
-  argumentsArray:function (q,w) {
+  argumentsArray:function (key,val) {
     if (arguments.length >1) {
       var oldargs = (this.get('templetonArguments'))?this.get('templetonArguments').w():[];
-      if (w.length != oldargs.length) {
-        this.set('templetonArguments',w.join('\t'));
+      if (val.length != oldargs.length) {
+        this.set('templetonArguments',val.join('\t'));
       }
     }
     var args = this.get('templetonArguments');

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js
index 2af788e..641180f 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/models/pig_script.js
@@ -27,18 +27,18 @@ App.Script = DS.Model.extend({
   owner:DS.attr('string'),
   opened:DS.attr('string'),
   // nav item identifier
-  name:function (q){
-    return this.get('title')+this.get('id');
+  name:function (){
+    return this.get('title') + this.get('id');
   }.property('title'),
   label:function (){
     return this.get('title');
   }.property('title'),
 
-  argumentsArray:function (q,w) {
+  argumentsArray:function (key,val) {
     if (arguments.length >1) {
       var oldargs = (this.get('templetonArguments'))?this.get('templetonArguments').w():[];
-      if (w.length != oldargs.length) {
-        this.set('templetonArguments',w.join('\t'));
+      if (val.length != oldargs.length) {
+        this.set('templetonArguments',val.join('\t'));
       }
     }
     var args = this.get('templetonArguments');

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js
index 479f57a..08bc5cb 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js
@@ -31,19 +31,31 @@ App.PigRoute = Em.Route.extend({
   },
   actions: {
     gotoSection: function(nav) {
-      var location = (nav.hasOwnProperty('url'))?nav.url:this.routeName;
-      this.transitionTo(location);
+      this.transitionTo((nav.hasOwnProperty('url'))?nav.url:this.routeName);
     },
+    /**
+     * Show alert
+     *
+     *  Alert object example:
+     *
+     *  {
+     *    message: alert message,
+     *    status: alert status (success||error||info),
+     *    trace: alert trace
+     *  }
+     *
+     * @param  {Object} alert
+     * @return {Object}
+     */
     showAlert:function (alert) {
-      var pigAlert = this.controllerFor('pigAlert');
-      return pigAlert.get('content').pushObject(Em.Object.create(alert));
+      return this.controllerFor('pigAlert').get('content').pushObject(Em.Object.create(alert));
     },
-    openModal: function(modal,content) {
-      this.controllerFor(modal).set('model', content);
-      return this.render(['modal',modal].join('/'), {
+    openModal: function(modalName, content) {
+      this.controllerFor(modalName).set('model', content);
+      return this.render(['modal',modalName].join('/'), {
         into: 'pig',
         outlet: 'modal',
-        controller:modal
+        controller: modalName
       });
     },
     removeModal: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigHistory.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigHistory.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigHistory.js
index 9efa1c5..2d1484e 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigHistory.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigHistory.js
@@ -18,14 +18,8 @@
 
 var App = require('app');
 
-App.PigHistoryRoute = Em.Route.extend({
-  actions:{
-    error:function (error) {
-      this.controllerFor('pig').set('category',"");
-      var trace = (error.responseJSON)?error.responseJSON.trace:null;
-      this.send('showAlert', {message:Em.I18n.t('history.load_error'),status:'error',trace:trace});
-    }
-  },
+App.PigHistoryRoute = Em.Route.extend(App.RouteError, {
+  errorMassage:Em.I18n.t('history.load_error'),
   enter: function() {
     this.controllerFor('pig').set('category',"history");
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScripts.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScripts.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScripts.js
index edf3676..26c877f 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScripts.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScripts.js
@@ -18,11 +18,12 @@
 
 var App = require('app');
 
-App.PigScriptsRoute = Em.Route.extend({
+App.PigScriptsRoute = Em.Route.extend(App.RouteError, {
+  errorMassage:Em.I18n.t('scripts.load_error'),
   enter: function() {
     this.controllerFor('pig').set('category','scripts');
   },
   model: function(object,transition) {
-    return this.modelFor('pig');
+    return this.store.find('script');
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigUdfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigUdfs.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigUdfs.js
index d6077ec..855022b 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigUdfs.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigUdfs.js
@@ -18,7 +18,8 @@
 
 var App = require('app');
 
-App.PigUdfsRoute = Em.Route.extend({
+App.PigUdfsRoute = Em.Route.extend(App.RouteError, {
+  errorMassage:Em.I18n.t('udfs.load_error'),
   enter: function() {
     this.controllerFor('pig').set('category',"udfs");
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js
index 3161e10..7cfbd8d 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js
@@ -34,6 +34,19 @@ App.ScriptRoute = Em.Route.extend({
         transition.abort();
         this.send('openModal','confirmAway',transition);
       }
+    },
+    error:function (error) {
+      var msg, trace = (error && error.responseJSON.trace)?error.responseJSON.trace:null;
+      if (error.status = 404) {
+        this.store.all('script').filterBy('isLoaded',false).forEach(function (notLoaded)
{
+          notLoaded.unloadRecord();
+        });
+        msg = Em.I18n.t('scripts.not_found');
+      } else {
+        msg = Em.I18n.t('scripts.load_error_single');
+      }
+      this.send('showAlert', {'message': msg, status:'error', trace:trace});
+      this.transitionTo('pig');
     }
   },
   enter:function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptEdit.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptEdit.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptEdit.js
index 04b430d..cd14584 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptEdit.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptEdit.js
@@ -24,21 +24,9 @@ App.ScriptEditRoute = Em.Route.extend({
   },
   isExec:false,
   model: function(params) {
-    var record;
-    var isExist = this.store.all('script').some(function(script) {
-      return script.get('id') === params.script_id;
-    });
-    if (isExist) {
-      record = this.store.find('script',params.script_id);
-    } else {
-      record = this.store.createRecord('script');
-    }
-    return record;
+    return this.store.find('script',params.script_id);
   },
   afterModel:function  (model) {
-    if (model.get('length') == 0) {
-      this.transitionTo('pig');
-    }
     this.controllerFor('pig').set('activeScriptId', model.get('id'));
   },
   renderTemplate: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js
index e0059aa..a5396b3 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js
@@ -26,7 +26,7 @@ App.ScriptJobRoute = Em.Route.extend({
         if (error && error.responseJSON.trace)
           trace = error.responseJSON.trace;
         transition.send('showAlert', {'message':Em.I18n.t('job.alert.load_error',{message:error.message}),
status:'error', trace:trace});
-        this.transitionTo('pig.scripts');
+        this.transitionTo('pig');
       },
       navigate:function (argument) {
         return this.transitionTo(argument.route)

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/scriptListRow.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/scriptListRow.hbs
b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/scriptListRow.hbs
index 7f6532f..4b0bddf 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/scriptListRow.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/scriptListRow.hbs
@@ -17,28 +17,39 @@
 }}
 
 <td class="first">
-  {{#link-to 'script.edit' id}}
-    {{#if isNew}}
+  {{#link-to 'script.edit' script.id}}
+    {{#if script.isNew}}
       <div class="spinner-sm"></div>
     {{/if}}
-    {{#unless isNew}}
-      {{title}}
+    {{#unless script.isNew}}
+      {{script.title}}
     {{/unless}}
   {{/link-to}}
 </td>
 <td>
-  {{#if view.currentJob}}
-    <span class="date">{{showDate view.currentJob.dateStarted 'YYYY-MM-DD HH:mm'}}</span>
+  {{#if currentJob}}
+    <span class="date">{{showDate currentJob.dateStarted 'YYYY-MM-DD HH:mm'}}</span>
   {{else}}
     {{t 'scripts.not_run_message'}}
   {{/if}}
 </td>
 <td>
-  {{view.currentJob.status}}
+{{#if currentJob.jobInProgress}}
+  <h4>
+    <span class="label label-warning">{{currentJob.status}}</span>
+  </h4>
+{{/if}}
+{{#if currentJob.jobSuccess}}
+  <i class="fa fa-fw fa-lg fa-check green"></i> {{t 'common.success'}} <small>
({{currentJob.durationTime}})</small>
+{{/if}}
+{{#if currentJob.jobError}}
+  <i class="fa fa-fw fa-lg fa-exclamation red"></i> {{t 'common.error'}}
+{{/if}}
 </td>
 <td>
   {{#unless isNew}}
-    {{#link-to 'script.history' id}}{{t 'common.history'}}{{/link-to}} -
-    <a href="#" {{action "deletescript" this}}>{{t 'common.delete'}}</a>
+    {{#link-to 'script.history' script.id}}<i class="fa fa-clock-o"></i> {{t
'common.history'}}{{/link-to}}
+    <a href="#" {{action "copyScript" script}}><i class="fa fa-copy"></i>
{{t 'common.copy'}}</a>
+    <a href="#" {{action "deletescript" script}}><i class="fa fa-trash-o"></i>
{{t 'common.delete'}}</a>
   {{/unless}}
 </td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/scripts.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/scripts.hbs
b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/scripts.hbs
index fa65171..3fe2765 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/scripts.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/scripts.hbs
@@ -32,44 +32,7 @@
     </thead>
     <tbody>
     {{#each paginatedContent}}
-      {{#script-list-row script=this jobs=controller.jobs}}
-        <td class="first">{{#link-to 'script.edit' id}}
-          {{#if isNew}}
-            <div class="spinner-sm"></div>
-          {{/if}}
-          {{#unless isNew}}
-            {{title}}
-          {{/unless}}
-        {{/link-to}}
-        </td>
-        <td>
-          {{#if view.currentJob}}
-            <span class="date">{{showDate view.currentJob.dateStarted 'YYYY-MM-DD HH:mm'}}</span>
-          {{else}}
-            {{t 'scripts.not_run_message'}}
-          {{/if}}
-        </td>
-        <td>
-        {{#if view.currentJob.jobInProgress}}
-          <h4>
-            <span class="label label-warning">{{view.currentJob.status}}</span>
-          </h4>
-        {{/if}}
-        {{#if view.currentJob.jobSuccess}}
-          <i class="fa fa-fw fa-lg fa-check green"></i> {{t 'common.success'}}
<small> ({{view.currentJob.durationTime}})</small>
-        {{/if}}
-        {{#if view.currentJob.jobError}}
-          <i class="fa fa-fw fa-lg fa-exclamation red"></i> {{t 'common.error'}}
-        {{/if}}
-        </td>
-        <td>
-          {{#unless isNew}}
-            {{#link-to 'script.history' id}}<i class="fa fa-clock-o"></i> {{t
'common.history'}}{{/link-to}}
-            <a href="#" {{action "copyScript" this}}><i class="fa fa-copy"></i>
{{t 'common.copy'}}</a>
-            <a href="#" {{action "deletescript" this}}><i class="fa fa-trash-o"></i>
{{t 'common.delete'}}</a>
-          {{/unless}}
-        </td>
-      {{/script-list-row}}
+      {{script-list-row script=this jobs=controller.jobs}}
     {{/each}}
     </tbody>
   </table>

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/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 b80a7c4..1584648 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
@@ -22,10 +22,10 @@
 
     <div class="row">
 
-      <div {{bind-attr class="needsPing:col-md-10:col-md-12 :progress-wrap" }} >
+      <div {{bind-attr class="jobInProgress:col-md-10:col-md-12 :progress-wrap" }} >
         {{job-progress job=content}}
       </div>
-      {{#if needsPing}}
+      {{#if jobInProgress}}
         <div class="col-md-2">
           {{#unless isKilling}}
             <button {{action "killjob" content}} type="button" class="btn btn-block btn-danger
btn-sm kill-button"><i class="fa fa-times"></i> {{t 'job.kill_job'}}</button>

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js
index 7ed48cf..45abf48 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js
@@ -55,6 +55,9 @@ Ember.I18n.translations = {
     'last_executed':'Last Executed',
     'last_results':'Last Results',
     'no_jobs_message':'This script has not been executed',
+    'load_error':'Error loading scripts',
+    'load_error_single':'Error loading script',
+    'not_found':'Script not found',
     'modal':{
       'create_script':'New Script',
       'unsaved_changes_warning':'You have unsaved changes in script.',
@@ -142,6 +145,7 @@ Ember.I18n.translations = {
   'udfs':{
     'udfs':'UDFs',
     'create':'Create UDF',
+    'load_error':'Error loading UDFs',
     'tooltips':{
       'path':'Path of this script file on HDFS'
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/876b1969/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 84a2c82..542e047 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
@@ -20,9 +20,7 @@ var App = require('app');
 
 App.PigAlertView = Ember.View.extend({
   alertsView : Ember.CollectionView.extend({
-    content: function () {
-      return this.get('controller.content');
-    }.property('controller.content'),
+    content:Em.computed.alias('controller.content'),
     itemViewClass: Ember.View.extend({
       classNames: ['alert fade in'],
       classNameBindings: ['alertClass'],
@@ -30,21 +28,19 @@ App.PigAlertView = Ember.View.extend({
       dismiss:'alert',
       templateName: 'partials/alert-content',
       didInsertElement:function () {
-        var self = this;
-
-        $(self.get('element')).bind('closed.bs.alert', function (e) {
-          return self.clearAlert();
-        });
+        this.$().bind('closed.bs.alert', function () {
+          return this.clearAlert();
+        }.bind(this));
 
         if (this.get('content.status')!='error') {
-          Ember.run.debounce(self, self.close, 3000);
+          Ember.run.debounce(this, this.close, 3000);
         }
       },
-      close : function (argument) {
-        return $(this.get('element')).alert('close');
+      close : function () {
+        return this.$().alert('close');
       },
       clearAlert:function () {
-        return this.get('controller').send('removeAlertObject',this.content);
+        return this.get('controller').send('removeAlertObject',this.get('content'));
       },
       alertClass: function () {
         var classes = {'success':'alert-success','error':'alert-danger','info':'alert-info'};


Mime
View raw message