ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [07/10] ambari git commit: AMBARI-8402. View: Pig ui updates + flow changes (alexantonenko)
Date Tue, 25 Nov 2014 17:14:31 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/util/pigUtilAlert.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/util/pigUtilAlert.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/util/pigUtilAlert.js
deleted file mode 100644
index 3fd3138..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/util/pigUtilAlert.js
+++ /dev/null
@@ -1,34 +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.
- */
-
-var App = require('app');
-
-App.PigUtilAlertController = Ember.ArrayController.extend({
-  content:Ember.A(),
-  needs: ['pigErrorLog'],
-  actions:{
-    removeAlertObject:function (alert) {
-      this.content.removeObject(alert)
-    },
-    showErrorLog:function (content) {
-      errorLogController = this.get('controllers.pigErrorLog');
-      errorLogController.set('errorLog', content[0].trace);
-      this.transitionToRoute('pig.errorLog');
-    },
-  },
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 2431d26..299b4c2 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
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-var App = require('app');
+window.App = require('app');
 
 App.ApplicationAdapter = DS.RESTAdapter.extend({
   namespace: App.getNamespaceUrl(),
@@ -28,11 +28,18 @@ App.ApplicationAdapter = DS.RESTAdapter.extend({
 App.FileAdapter = App.ApplicationAdapter.extend({
   pathForType: function() {
     return 'resources/file';
-  },
+  }
+});
+
+App.JobAdapter = App.ApplicationAdapter.extend({
+  deleteRecord: function (store, type, record)  {
+    var id = record.get('id');
+    return this.ajax(this.buildURL(type.typeKey, id)+ '?remove=true', "DELETE");
+  }
 });
 
 App.FileSerializer = DS.RESTSerializer.extend({
-  primaryKey:'filePath',
+  primaryKey:'filePath'
 });
 
 App.IsodateTransform = DS.Transform.extend({  
@@ -50,114 +57,114 @@ App.IsodateTransform = DS.Transform.extend({
   }
 });
 
+App.FileSaver = Ember.Object.extend({
+  save: function(fileContents, mimeType, filename) {
+    window.saveAs(new Blob([fileContents], {type: mimeType}), filename);
+  }
+});
+
+App.register('lib:fileSaver', App.FileSaver);
+
+
+
 Ember.Handlebars.registerBoundHelper('showDate', function(date,format) {
   return moment(date).format(format)
 });
 
 Em.TextField.reopen(Em.I18n.TranslateableAttributes)
 
-//////////////////////////////////
-// Templates
-//////////////////////////////////
-
 require('translations');
+require('router');
 
-require('templates/application');
-require('templates/index');
-require('templates/pig/loading');
-
-require('templates/pig');
-require('templates/pig/index');
-require('templates/pig/scriptList');
-require('templates/pig/scriptEdit');
-require('templates/pig/scriptEditIndex');
-require('templates/pig/scriptResults');
-require('templates/pig/scriptResultsNav');
-require('templates/pig/job');
-require('templates/pig/jobEdit');
-require('templates/pig/jobStatus');
-require('templates/pig/jobResults');
-require('templates/pig/jobResultsOutput');
-require('templates/pig/history');
-require('templates/pig/udfs');
-require('templates/pig/errorLog');
-
-require('templates/pig/util/script-nav');
-require('templates/pig/util/alert');
-require('templates/pig/util/alert-content');
-require('templates/pig/util/pigHelper');
-require('templates/pig/modal/confirmdelete');
-require('templates/pig/modal/createUdf');
-require('templates/pig/modal/modalLayout');
-require('templates/pig/modal/createScript');
-
-require('templates/splash');
-
-//////////////////////////////////
-// Models
-//////////////////////////////////
-
-require('models/pig_script');
-require('models/pig_job');
-require('models/file');
-require('models/udf');
-
-/////////////////////////////////
-// Controllers
-/////////////////////////////////
-
-require('controllers/pig');
-require('controllers/poll');
-require('controllers/edit');
-require('controllers/pigScriptEdit');
-require('controllers/pigScriptList');
-require('controllers/pigScriptEditResults');
-require('controllers/pigUdfs');
-require('controllers/pigHistory');
-require('controllers/pigJob');
-require('controllers/jobResults');
-require('controllers/splash');
-require('controllers/errorLog');
-require('controllers/util/pigUtilAlert');
-require('controllers/modal/pigModal');
-
-/////////////////////////////////
-// Views
-/////////////////////////////////
-
-require('views/pig');
-require('views/pig/scriptList');
-require('views/pig/scriptEdit');
-require('views/pig/scriptResults');
-require('views/pig/scriptResultsNav');
-require('views/pig/pigHistory');
-require('views/pig/pigUdfs');
-require('views/pig/pigJob');
-require('views/pig/jobResults');
-require('views/pig/modal/pigModal');
-require('views/pig/modal/confirmDelete');
-require('views/pig/modal/createUdf');
-require('views/pig/modal/createScript');
-require('views/pig/util/pigUtilAlert');
-
-/////////////////////////////////
-// Routes
-/////////////////////////////////
-
-require('routes/pig');
-require('routes/pigHistory');
-require('routes/pigIndex');
-require('routes/pigScriptEdit');
-require('routes/pigScriptEditIndex');
-require('routes/pigScriptEditResults');
-require('routes/pigScriptList');
-require('routes/pigUdfs');
-require('routes/pigJob');
-require('routes/jobResults');
-require('routes/splash');
-
-/////////////////////////////////
-// Router
-/////////////////////////////////
 
-require('router');
+// mixins
+require("mixins/fileHandler");
+require("mixins/pagination");
+
+//routes
+require("routes/pig");
+require("routes/pigHistory");
+require("routes/pigScripts");
+require("routes/pigUdfs");
+require("routes/script");
+require("routes/scriptEdit");
+require("routes/scriptHistory");
+require("routes/scriptJob");
+require("routes/splash");
+
+//models
+require("models/file");
+require("models/pig_job");
+require("models/pig_script");
+require("models/udf");
+
+//views
+require("views/pig");
+require("views/pig/alert");
+require("views/pig/history");
+require("views/pig/loading");
+require("views/pig/scripts");
+require("views/pig/udfs");
+require("views/script/edit");
+require("views/script/job");
+
+//controllers
+require("controllers/errorLog");
+require("controllers/modal/confirmAway");
+require("controllers/modal/confirmDelete");
+require("controllers/modal/deleteJob");
+require("controllers/modal/createScript");
+require("controllers/modal/createUdf");
+require("controllers/modal/gotoCopy");
+require("controllers/modal/logDownload");
+require("controllers/modal/pigModal");
+require("controllers/modal/resultsDownload");
+require("controllers/page");
+require("controllers/pig");
+require("controllers/pigAlert");
+require("controllers/pigHistory");
+require("controllers/pigScripts");
+require("controllers/pigUdfs");
+require("controllers/script");
+require("controllers/scriptEdit");
+require("controllers/scriptHistory");
+require("controllers/scriptJob");
+require("controllers/splash");
+
+//templates
+require("templates/application");
+require("templates/components/pigHelper");
+require("templates/components/scriptListRow");
+require("templates/loading");
+require("templates/modal/confirmAway");
+require("templates/modal/confirmDelete");
+require("templates/modal/createScript");
+require("templates/modal/deleteJob");
+require("templates/modal/createUdf");
+require("templates/modal/gotoCopy");
+require("templates/modal/logDownload");
+require("templates/modal/modalLayout");
+require("templates/modal/resultsDownload");
+require("templates/partials/alert-content");
+require("templates/partials/paginationControls");
+require("templates/pig");
+require("templates/pig/alert");
+require("templates/pig/errorLog");
+require("templates/pig/history");
+require("templates/pig/loading");
+require("templates/pig/scripts");
+require("templates/pig/udfs");
+require("templates/script");
+require("templates/script/edit");
+require("templates/script/history");
+require("templates/script/job");
+require("templates/splash");
+require('templates/error');
+
+//components
+require("components/codeMirror");
+require("components/helpers-data");
+require("components/jobProgress");
+require("components/pigHelper");
+require("components/scriptListRow");
+require("components/tabControl");

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/fileHandler.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/fileHandler.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/fileHandler.js
new file mode 100644
index 0000000..0c2c93c
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/fileHandler.js
@@ -0,0 +1,54 @@
+/**
+ * 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 _promise = function (controller, url, output) {
+  return new Ember.RSVP.Promise(function(resolve,reject){
+    return Em.$.getJSON(url).then(function (data) {
+      resolve(data.file);
+    },function (error) {
+      var response = (error.responseJSON)?error.responseJSON:{};
+      reject(response.message);
+      if (error.status != 404) {
+        controller.send('showAlert', {'message': Em.I18n.t('job.alert.promise_error',
+          {status:response.status, message:response.message}), status:'error', trace: response.trace});
+      }
+    })
+  });
+};
+
+App.FileHandler = Ember.Mixin.create({
+  fileProxy:function (url) {
+    var promise,
+        host = this.store.adapterFor('application').get('host');
+        namespace = this.store.adapterFor('application').get('namespace');
+
+    url = [host, namespace, url].join('/');
+    promise = _promise(this, url,'stdout');
+
+    return Ember.ObjectProxy.extend(Ember.PromiseProxyMixin).create({
+      promise: promise
+    });
+  },
+  downloadFile:function (file,saveAs) {
+    return this.fileSaver.save(file, "application/json", saveAs);
+  }
+});
+
+App.inject('controller', 'fileSaver', 'lib:fileSaver');

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/pagination.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/pagination.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/pagination.js
new file mode 100644
index 0000000..587ede9
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/mixins/pagination.js
@@ -0,0 +1,99 @@
+/**
+ * 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.Pagination = Ember.Mixin.create({
+  actions:{
+    selectPage: function(number) {
+      this.set('page', number);
+    },
+
+    toggleOrder: function() {
+      this.toggleProperty('sortAscending');
+    }
+  },
+
+  page: 1,
+
+  perPage: 10,
+
+  perPageOptions:[10,25,50,100],
+
+  pageWatcher:function () {
+    if (this.get('page') > this.get('totalPages')) {
+      this.set('page',this.get('totalPages') || 1);
+    };
+  }.observes('totalPages'),
+
+  totalPages: function() {
+    return Math.ceil(this.get('length') / this.get('perPage'));
+  }.property('length', 'perPage'),
+
+  pages: function() {
+    var collection = Ember.A();
+
+    for(var i = 0; i < this.get('totalPages'); i++) {
+      collection.pushObject(Ember.Object.create({
+        number: i + 1
+      }));
+    }
+
+    return collection;
+  }.property('totalPages'),
+
+  hasPages: function() {
+    return this.get('totalPages') > 1;
+  }.property('totalPages'),
+
+  prevPage: function() {
+    var page = this.get('page');
+    var totalPages = this.get('totalPages');
+
+    if(page > 1 && totalPages > 1) {
+      return page - 1;
+    } else {
+      return null;
+    }
+  }.property('page', 'totalPages'),
+
+  nextPage: function() {
+    var page = this.get('page');
+    var totalPages = this.get('totalPages');
+
+    if(page < totalPages && totalPages > 1) {
+      return page + 1;
+    } else {
+      return null;
+    }
+  }.property('page', 'totalPages'),
+
+
+  paginatedContent: function() {
+    var start = (this.get('page') - 1) * this.get('perPage');
+    var end = start + this.get('perPage');
+
+    return this.get('arrangedContent').slice(start, end);
+  }.property('page', 'totalPages', 'arrangedContent.[]'),
+
+  paginationInfo: function () {
+    var start = (this.get('page') - 1) * this.get('perPage') + 1;
+    var end = start + this.get('paginatedContent.length') - 1;
+    return start + ' - ' + end + ' of ' + this.get('arrangedContent.length')
+  }.property('page', 'arrangedContent.length', 'perPage')
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 e4217ae..b20a0ac 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
@@ -26,6 +26,10 @@ App.Job = DS.Model.extend({
   templetonArguments:DS.attr('string'),
   owner: DS.attr('string'),
   forcedContent:DS.attr('string'),
+  duration: DS.attr('number'),
+  durationTime:function () {
+    return moment.duration(this.get('duration'), "seconds").format("h [hrs], m [min], s [sec]");
+  }.property('duration'),
 
   sourceFile:DS.attr('string'),
   sourceFileContent:DS.attr('string'),
@@ -39,7 +43,7 @@ App.Job = DS.Model.extend({
   percentStatus:function () {
     if (this.get('isTerminated')) {
       return 100;
-    };
+    }
     return (this.get('status')==='COMPLETED')?100:(this.get('percentComplete')||0);
   }.property('status','percentComplete'),
 
@@ -86,5 +90,28 @@ App.Job = DS.Model.extend({
   },
   needsPing:function () {
     return this.pingStatusMap[this.get('status')];
-  }.property('status')
+  }.property('status'),
+
+  jobSuccess:function () {
+    return this.get('status') == 'COMPLETED';
+  }.property('status'),
+
+  jobError:function () {
+    return this.get('status') == 'SUBMIT_FAILED' || this.get('status') == 'KILLED' || this.get('status') == 'FAILED';
+  }.property('status'),
+
+  jobInProgress:function () {
+    return this.get('status') == 'SUBMITTING' || this.get('status') == 'SUBMITTED' || this.get('status') == 'RUNNING';
+  }.property('status'),
+
+  argumentsArray:function (q,w) {
+    if (arguments.length >1) {
+      var oldargs = (this.get('templetonArguments'))?this.get('templetonArguments').w():[];
+      if (w.length != oldargs.length) {
+        this.set('templetonArguments',w.join('\t'));
+      }
+    }
+    var args = this.get('templetonArguments');
+    return (args && args.length > 0)?args.w():[];
+  }.property('templetonArguments')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 74b0d6e..ab06c21 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
@@ -18,18 +18,8 @@
 
 var App = require('app');
 
-App.OpenedScript = Ember.Mixin.create({
-  opened:DS.attr('boolean'),
-  open:function (argument) {
-    return this.set('opened',true);
-  },
-  close:function (argument) {
-    return this.set('opened',false);
-  }
-});
-
-App.Script = DS.Model.extend(App.OpenedScript,{
-  title:DS.attr('string', { defaultValue: 'New script'}),
+App.Script = DS.Model.extend({
+  title:DS.attr('string'),
   pigScript:DS.belongsTo('file', { async: true }),
   dateCreated:DS.attr('isodate', { defaultValue: moment()}),
   templetonArguments:DS.attr('string', { defaultValue: '-useHCatalog'}),
@@ -40,4 +30,19 @@ App.Script = DS.Model.extend(App.OpenedScript,{
   label:function (){
     return this.get('title');
   }.property('title'),
+
+  argumentsArray:function (q,w) {
+    if (arguments.length >1) {
+      var oldargs = (this.get('templetonArguments'))?this.get('templetonArguments').w():[];
+      if (w.length != oldargs.length) {
+        this.set('templetonArguments',w.join('\t'));
+      }
+    }
+    var args = this.get('templetonArguments');
+    return (args && args.length > 0)?args.w():[];
+  }.property('templetonArguments'),
+
+  dateCreatedUnix:function () {
+    return moment(this.get('dateCreated')).unix();
+  }.property('dateCreated')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/router.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/router.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/router.js
index 66f2b6d..34c3be4 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/router.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/router.js
@@ -20,10 +20,11 @@ var App = require('app');
 
 App.Router.map(function () {
   this.resource('pig', { path: "/" }, function() {
-    this.route('scriptList',{ path: "/list" });
-    this.route('scriptEdit',{ path: "/edit/:script_id" });
-    this.resource('job', { path: "/job/:job_id" },function (argument) {
-      this.route('results');
+    this.route('scripts', { path: "/list" });
+    this.resource('script', { path: "/script" }, function () {
+      this.route('edit', { path: "/edit/:script_id" });
+      this.route('history', { path: "/history/:script_id" });
+      this.route('job', { path: "/job/:job_id" });
     });
     this.route('udfs');
     this.route('history');
@@ -31,7 +32,3 @@ App.Router.map(function () {
   });
   this.route('splash');
 });
-
-App.LoadingView = Em.View.extend({
-    templateName: 'pig/loading'
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/jobResults.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/jobResults.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/jobResults.js
deleted file mode 100644
index d01c69a..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/jobResults.js
+++ /dev/null
@@ -1,29 +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.
- */
-
-var App = require('app');
-
-App.JobResultsRoute = Em.Route.extend({
-  enter: function() {
-      this.controllerFor('pig').set('category',"");
-      this.controllerFor('job').set('category',"results");
-    },
-  model: function (controller) {
-    return this.modelFor('job');
-  }
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 e2eecd5..48fab5a 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
@@ -23,7 +23,7 @@ App.PigRoute = Em.Route.extend({
     App.set('previousTransition', transition);
   },
   redirect: function () {
-    testsConducted = App.get("smokeTests");
+    var testsConducted = App.get("smokeTests");
     if (!testsConducted) {
         App.set("smokeTests", true);
         this.transitionTo('splash');
@@ -34,38 +34,19 @@ App.PigRoute = Em.Route.extend({
       var location = (nav.hasOwnProperty('url'))?[nav.url]:['pig.scriptEdit',nav.get('id')];
       this.transitionTo.apply(this,location);
     },
-    close:function (script) {
-      var self = this;
-      script.close().save().then(function() {
-        if (self.get('controller.category') == script.get('name')) {
-          opened = self.get('controller.openScripts');
-          if (opened.length > 0 && opened.filterBy('id',script.get('id')).length == 0){
-            self.transitionTo('pig.scriptEdit',opened.get(0));
-          } else {
-            self.transitionTo('pig.scriptList');
-          }
-        }
-        self.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_saved',{title: script.get('title')}), status:'success'});
-      },function (error) {
-        //script.open();
-        var trace = null;
-        if (error && error.responseJSON.trace)
-          trace = error.responseJSON.trace;
-        self.send('showAlert', {'message': Em.I18n.t('scripts.alert.save_error_reason',{message:error.statusText}) , status:'error', trace:trace});
-      });
-    },
     showAlert:function (alert) {
-      var pigUtilAlert = this.controllerFor('pigUtilAlert');
-      return pigUtilAlert.content.pushObject(Em.Object.create(alert));
+      var pigAlert = this.controllerFor('pigAlert');
+      return pigAlert.content.pushObject(Em.Object.create(alert));
     },
-    openModal: function(modalName,controller) {
-      return this.render(modalName, {
+    openModal: function(modal,content) {
+      this.controllerFor(modal).set('content', content);
+      return this.render(['modal',modal].join('/'), {
         into: 'pig',
         outlet: 'modal',
-        controller:'pigModal'
+        controller:modal
       });
     },
-    closeModal: function() {
+    removeModal: function() {
       return this.disconnectOutlet({
         outlet: 'modal',
         parentView: 'pig'
@@ -77,6 +58,24 @@ App.PigRoute = Em.Route.extend({
   },
   renderTemplate: function() {
     this.render('pig');
-    this.render('pig/util/alert', {into:'pig',outlet:'alert',controller: 'pigUtilAlert' });
+    this.render('pig/alert', {into:'pig',outlet:'alert',controller:'pigAlert'});
+  }
+});
+
+App.PigIndexRoute = Em.Route.extend({
+  redirect:function () {
+    this.transitionTo('pig.scripts');
+  }
+});
+
+App.ErrorRoute = Ember.Route.extend({
+  setupController:function (controller,error) {
+    var data;
+    if(!(error instanceof Error)) {
+      data = JSON.parse(error.responseText);
+    } else {
+      data = error;
+    }
+    controller.set('model',data);
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 cf9e3d5..9efa1c5 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
@@ -19,10 +19,24 @@
 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});
+    }
+  },
   enter: function() {
     this.controllerFor('pig').set('category',"history");
   },
   model: function() {
     return this.store.find('job');
+  },
+  setupController:function (controller,model) {
+    var scripts = this.modelFor('pig');
+    var filtered = model.filter(function(job) {
+      return job.get('status') != 'SUBMIT_FAILED' && scripts.get('content').isAny('id',job.get('scriptId').toString());
+    });
+    controller.set('model',model);
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigIndex.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigIndex.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigIndex.js
deleted file mode 100644
index 04e04dd..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigIndex.js
+++ /dev/null
@@ -1,25 +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.
- */
-
-var App = require('app');
-
-App.PigIndexRoute = Em.Route.extend({
-  beforeModel: function() {
-    this.transitionTo('pig.scriptList');
-  }
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigJob.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigJob.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigJob.js
deleted file mode 100644
index ca9b715..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigJob.js
+++ /dev/null
@@ -1,57 +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.
- */
-
-var App = require('app');
-
-App.JobRoute = Em.Route.extend({
-    actions: {
-      error: function(error, transition) {
-        Em.warn(error.stack);
-        var trace = null;
-        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.scriptList');
-      },
-      navigate:function (argument) {
-        return this.transitionTo(argument.route)
-      }
-    },
-    setupController: function(controller, model) {
-      controller.set('model', model);
-      this.controllerFor('poll').set('model', model);
-    },
-    afterModel:function (job,arg) {
-      this.controllerFor('poll').get('pollster').start(job);
-    },
-    deactivate: function() {
-      this.controllerFor('poll').get('pollster').stop();
-    },
-    renderTemplate: function() {
-      this.render('pig/scriptEdit', {controller: 'job' });
-      this.render('pig/job', {into:'pig/scriptEdit',outlet: 'main', controller: 'poll' });
-      this.render('pig/scriptResultsNav',{into:'pig/scriptEdit',outlet: 'nav'});
-    }
-});
-
-App.JobIndexRoute = Em.Route.extend({
-  enter: function() {
-      this.controllerFor('pig').set('category',"");
-      this.controllerFor('job').set('category',"edit");
-    },
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEdit.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEdit.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEdit.js
deleted file mode 100644
index 2c19077..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEdit.js
+++ /dev/null
@@ -1,74 +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.
- */
-
-var App = require('app');
-
-App.PigScriptEditRoute = Em.Route.extend({
-  actions:{
-    willTransition: function(transition){
-      var model = this.controller.get('model');
-      if (model.get('isDirty') || model.get('pigScript.isDirty')) {
-        return this.send('saveScript',model);
-      };
-    },
-    toresults:function (argument) {
-      // DUMMY TRANSITION
-      this.transitionTo('pigScriptEdit.results',argument);
-    },
-    saveScript: function (script) {
-      var router = this,
-        onSuccess = function(model){
-          router.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_saved',{title: script.get('title')}),status:'success'});
-        },
-        onFail = function(error){
-          var trace = null;
-          if (error && error.responseJSON.trace)
-            trace = error.responseJSON.trace;
-          router.send('showAlert', {'message':Em.I18n.t('scripts.alert.save_error'),status:'error',trace:trace});
-        };
-
-      return script.get('pigScript').then(function(file){
-        return Ember.RSVP.all([file.save(),script.save()]).then(onSuccess,onFail);
-      },onFail);
-    },
-  },
-  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;
-  },
-  afterModel:function  (model) {
-    if (model.get('length') == 0) {
-      this.transitionTo('pig');
-    }
-    this.controllerFor('pig').set('category', model.get('name'));
-    model.open();
-  },
-  renderTemplate: function() {
-    this.render('pig/scriptEdit');
-  }
-});
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditIndex.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditIndex.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditIndex.js
deleted file mode 100644
index 638ebe8..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditIndex.js
+++ /dev/null
@@ -1,27 +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.
- */
-
-var App = require('app');
-
-App.PigScriptEditIndexRoute = Em.Route.extend({
-  renderTemplate: function() {
-    this.render('pig/scriptEditIndex',{
-      outlet: 'main',
-    });
-  }
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditResults.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditResults.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditResults.js
deleted file mode 100644
index 1a77e71..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptEditResults.js
+++ /dev/null
@@ -1,36 +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.
- */
-
-var App = require('app');
-
-App.PigScriptEditResultsRoute = Em.Route.extend({
-  model: function(params) {
-    return this.store.find('job',params.job_id);
-  },
-  afterModel:function (model) {
-    //this.controllerFor('pigScriptEdit').set('activeJob',model);
-  },
-  renderTemplate: function() {
-    this.render('pig/scriptResultsNav',{
-      outlet: 'nav',
-    });
-    this.render('pig/scriptResults',{
-      outlet: 'main',
-    });
-  }
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptList.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptList.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptList.js
deleted file mode 100644
index 28d9e67..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScriptList.js
+++ /dev/null
@@ -1,93 +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.
- */
-
-var App = require('app');
-
-App.PigScriptListRoute = Em.Route.extend({
-  actions:{
-    createScript:function () {
-      var newScript = this.store.createRecord('script');
-      this.controllerFor('pigModal').set('content', newScript);
-      return this.send('openModal','createScript');
-      
-    },
-    deletescript:function (script) {
-      this.controllerFor('pigModal').set('content', script);
-      return this.send('openModal','confirmDelete');
-    },
-    confirmcreate:function (script,filePath) {
-      // /tmp/.pigscripts/admin/39.pig
-      var route = this;
-      var sendAlert = function (status) {
-        var alerts = {
-          success:Em.I18n.t('scripts.alert.script_created',{title:'New script'}), 
-          error: Em.I18n.t('scripts.alert.create_failed')
-        };
-        return function (data) {
-          var trace = null;
-          if (status=='error'){
-            script.deleteRecord();
-            trace = data.responseJSON.trace;
-          }
-          route.send('showAlert', {message:alerts[status],status:status,trace:trace});
-        };
-      };
-      if (filePath) {
-        var file = this.store.createRecord('file',{
-          id:filePath,
-          fileContent:''
-        });
-        return file.save().then(function(file){
-          script.set('pigScript',file);
-          script.save().then(sendAlert('success'),sendAlert('error'));
-        },function () {
-          file.deleteRecord();
-          route.store.find('file', filePath).then(function(file) {
-            route.send('showAlert', {message:Em.I18n.t('scripts.alert.file_exist_error'),status:'success'});
-            script.set('pigScript',file);
-            script.save().then(sendAlert('success'),sendAlert('error'));
-          }, sendAlert('error'));
-        });
-      } else {
-          script.save().then(sendAlert('success'),sendAlert('error'));
-      }
-
-
-    },
-    confirmdelete:function (script) {
-      var router = this;
-      var onSuccess = function(model){
-            router.send('showAlert', {'message':Em.I18n.t('scripts.alert.script_deleted',{title : model.get('title')}),status:'success'});
-          };
-      var onFail = function(error){
-            var trace = null;
-            if (error && error.responseJSON.trace)
-              trace = error.responseJSON.trace;
-            router.send('showAlert', {'message':Em.I18n.t('scripts.alert.delete_failed'),status:'error',trace:trace});
-          };
-      script.deleteRecord();
-      return script.save().then(onSuccess,onFail);
-    }
-  },
-  enter: function() {
-    this.controllerFor('pig').set('category',"scripts");
-  },
-  model: function(object,transition) {
-    return this.modelFor('pig');
-  }
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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
new file mode 100644
index 0000000..edf3676
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pigScripts.js
@@ -0,0 +1,28 @@
+/**
+ * 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.PigScriptsRoute = Em.Route.extend({
+  enter: function() {
+    this.controllerFor('pig').set('category','scripts');
+  },
+  model: function(object,transition) {
+    return this.modelFor('pig');
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 7424bea..d6077ec 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
@@ -19,39 +19,6 @@
 var App = require('app');
 
 App.PigUdfsRoute = Em.Route.extend({
-  actions:{
-    createUdfModal:function () {
-      this.controllerFor('pigModal').set('content', this.store.createRecord('udf'));
-      return this.send('openModal','createUdf');
-    },
-    createUdf:function (udf) {
-      var router = this;
-      var onSuccess = function(model){
-          router.send('showAlert', {'message': Em.I18n.t('udfs.alert.udf_created',{name : model.get('name')}), status:'success'});
-        };
-      var onFail = function(error){
-          var trace = null;
-          if (error && error.responseJSON.trace)
-            trace = error.responseJSON.trace;
-          router.send('showAlert', {'message':Em.I18n.t('udfs.alert.create_failed'),status:'error',trace:trace});
-        };
-      return udf.save().then(onSuccess,onFail);
-    },
-    deleteUdf:function(udf){
-      var router = this;
-      var onSuccess = function(model){
-            router.send('showAlert', {'message': Em.I18n.t('udfs.alert.udf_deleted',{name : model.get('name')}),status:'success'});
-          };
-      var onFail = function(error){
-            var trace = null;
-            if (error && error.responseJSON.trace)
-              trace = error.responseJSON.trace;
-            router.send('showAlert', {'message': Em.I18n.t('udfs.alert.delete_failed'),status:'error',trace:trace});
-          };
-      udf.deleteRecord();
-      return udf.save().then(onSuccess,onFail);
-    }
-  },
   enter: function() {
     this.controllerFor('pig').set('category',"udfs");
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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
new file mode 100644
index 0000000..f3e7fcd
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/script.js
@@ -0,0 +1,59 @@
+/**
+ * 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.ScriptRoute = Em.Route.extend({
+  actions:{
+    willTransition:function (transition) {
+      if (this.controllerFor('script.edit').get('isExec')) {
+        return transition.abort();
+      }
+      if (this.controllerFor('script.edit').get('isRenaming')) {
+        this.controllerFor('script.edit').set('titleWarn',true);
+        return transition.abort();
+      }
+      var isAway = this.isGoingAway(transition);
+      var scriptDirty = this.controllerFor('pig').get('scriptDirty');
+      if (isAway && scriptDirty) {
+        transition.abort();
+        this.send('openModal','confirmAway',transition);
+      }
+    }
+  },
+  enter:function () {
+    this.controllerFor('pig').set('category', '');
+  },
+  deactivate: function() {
+    this.controllerFor('pig').set('activeScriptId', null);
+    this.controllerFor('script').set('activeJobs',[]);
+  },
+  isGoingAway:function (transition) {
+    var isScriptAway = !transition.targetName.match(/^script./);
+    if (!isScriptAway) {
+      var targetParams = transition.params[transition.targetName];
+      if (targetParams['script_id']) {
+        return targetParams['script_id'] != this.controllerFor('pig').get('activeScriptId');
+      };
+      if (targetParams['job_id'] && this.modelFor('script.history')) {
+        return this.modelFor('script.history').get('content').filterBy('id',targetParams['job_id']).length == 0;
+      };
+    };
+    return isScriptAway;
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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
new file mode 100644
index 0000000..04b430d
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptEdit.js
@@ -0,0 +1,47 @@
+/**
+ * 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.ScriptEditRoute = Em.Route.extend({
+  enter:function () {
+    this.controllerFor('script').set('activeTab','script');
+  },
+  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;
+  },
+  afterModel:function  (model) {
+    if (model.get('length') == 0) {
+      this.transitionTo('pig');
+    }
+    this.controllerFor('pig').set('activeScriptId', model.get('id'));
+  },
+  renderTemplate: function() {
+    this.render('script/edit');
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptHistory.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptHistory.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptHistory.js
new file mode 100644
index 0000000..650bfb9
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptHistory.js
@@ -0,0 +1,36 @@
+/*
+ * 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.ScriptHistoryRoute = Em.Route.extend({
+  enter: function() {
+    this.controllerFor('script').set('activeTab','history');
+  },
+  model:function(param) {
+    this.controllerFor('pig').set('activeScriptId', param.script_id);
+    return this.store.find('job', {scriptId: param.script_id});
+  },
+  setupController:function (controller,model) {
+    var script_id = this.controllerFor('pig').get('activeScriptId');
+    model.store.recordArrayManager.registerFilteredRecordArray(model,model.type,function(job) {
+      return job.get('scriptId') == script_id;
+    });
+    controller.set('model',model);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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
new file mode 100644
index 0000000..28ce908
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/scriptJob.js
@@ -0,0 +1,58 @@
+/**
+ * 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.ScriptJobRoute = Em.Route.extend({
+    actions: {
+      error: function(error, transition) {
+        Em.warn(error.stack);
+        var trace = null;
+        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');
+      },
+      navigate:function (argument) {
+        return this.transitionTo(argument.route)
+      },
+      killjob:function (job) {
+        var self = this;
+        job.kill(function () {
+          job.reload();
+          self.send('showAlert', {'message': Em.I18n.t('job.alert.job_killed',{title:self.get('title')}), status:'info'});
+        },function (reason) {
+          var trace = null;
+          if (reason && reason.responseJSON.trace)
+            trace = reason.responseJSON.trace;
+          self.send('showAlert', {'message': Em.I18n.t('job.alert.job_kill_error'), status:'error', trace:trace});
+        });
+      }
+    },
+    model:function (q,w) {
+      return this.store.find('job',q.job_id);
+    },
+    setupController: function(controller, model) {
+      controller.set('model', model);
+    },
+    afterModel:function (job) {
+      this.controllerFor('pig').set('activeScriptId', job.get('scriptId'));
+      this.controllerFor('script').get('activeJobs').addObject(job);
+      this.controllerFor('script').set('activeTab',job.get('id'));
+    }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
index ef7aa4d..5223a5a 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js
@@ -20,13 +20,15 @@ var App = require('app');
 
 App.SplashRoute = Em.Route.extend({
   model: function() {
-    return Ember.Object.create({storageTest: null,
-                                storageTestDone: null,
-                                webhcatTest: null,
-                                webhcatTestDone: null,
-                                hdfsTest: null,
-                                hdfsTestDone: null,
-                                percent: 0});
+    return Ember.Object.create({
+      storageTest: null,
+      storageTestDone: null,
+      webhcatTest: null,
+      webhcatTestDone: null,
+      hdfsTest: null,
+      hdfsTestDone: null,
+      percent: 0
+    });
   },
   renderTemplate: function() {
     this.render('splash');
@@ -41,7 +43,7 @@ App.SplashRoute = Em.Route.extend({
           if (previousTransition) {
             previousTransition.retry();
           } else {
-            self.transitionTo('pig.scriptList');
+            self.transitionTo('pig.scripts');
           }
         }, 1000);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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 75df9c0..c8b8576 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
@@ -16,9 +16,17 @@
  * limitations under the License.
  */
 
+@import './../../bower_components/bootstrap/less/variables.less';
+
+@screen-md:                  900px;
+@modal-backdrop-opacity:      0;
+
+@import './../../bower_components/bootstrap/less/bootstrap.less';
+
 .wrap {
-	padding: 15px;
+  padding: 15px;
 }
+
 .moz-padding (@selector, @pre: ~'', @padding) {
   @-moz-document url-prefix() {
     @{pre}@{selector} {
@@ -51,9 +59,128 @@
 
 // navigation
 .navigation {
-  //position: fixed;
-  a {
-    cursor: pointer;
+  .well {
+    padding: 0;
+    background-color: #f5f5f5;
+    height: 200px;
+    overflow: hidden;
+    .nav-main {
+      &.collapsed {
+        a {
+          border-right: 1px solid transparent;
+        }
+      }
+      float: left;
+      width: 100%;
+      text-align:  center;
+      &.list-group-item:first-child{
+        border-top-left-radius: 4px;
+      }
+      a {
+        &.list-group-item:hover,
+        &.list-group-item:focus {
+          background-color: lighten(#f5f5f5, 3%);
+          border-color: #e9e9e9;
+        }
+        &.list-group-item.active,
+        &.list-group-item.active:hover,
+        &.list-group-item.active:focus {
+          z-index: 60;
+          color: black;
+          background-color: lighten(#f5f5f5, 3%);
+          border-color: #dadada;
+          .common-shadow-inset;
+        }
+        &.list-group-item:first-child{
+          border-radius: 0;
+          border-top: 0;
+        }
+        &.list-group-item:last-child {
+          border-radius: 0;
+        }
+        span {
+          bottom: 4px;
+          position: relative;
+          margin-left: 15px;
+        }
+        cursor: pointer;
+        background-color: transparent;
+        border-top: 1px solid transparent;
+        border-bottom: 1px solid transparent;
+        border-right: 0;
+        border-left:0;
+
+        .base-transition( background-color 200ms linear;);
+      }
+    }
+    .nav-script-wrap {
+      &.in {
+        &.reveal {
+          left: 125px;
+        }
+        left: 65px;
+      }
+      z-index: 70;
+      width: 100%;
+      left: 102%;
+      position: relative;
+      height: 100%;
+      box-shadow: -2px 0px 1px rgba(0, 0, 0, 0.20);
+      .base-transition( left 300ms linear;);
+
+      .nav-script {
+        position: absolute;
+        width: 100%;
+        background-color: @gray-dark;
+        height: 100%;
+
+        & div:first-child {
+          margin-bottom: 25px;
+          button {
+            position: relative;
+            float: right;
+            right: 65px;
+            color: @gray-light;
+            border: 0;
+            background-color: transparent;
+            margin: 1px;
+            &:hover {
+              color: @gray-lighter;
+            }
+          }
+        }
+
+        .script-title {
+          background: #fff;
+          padding: 8px;
+          //border: 1px solid #747474;
+          margin-bottom: 10px;
+        }
+       .script-actions {
+          padding-left: 10px;
+          padding-right: 10px;
+          li {
+              margin: 9px 0;
+            &.divider {
+              height: 1px;
+              margin: 9px 0;
+              overflow: hidden;
+              background-color: #e5e5e5;
+            }
+            a {
+              color: #fff;
+              text-align: left;
+              padding: 0;
+              &:hover {
+                color: darken(#fff, 30%);
+                text-decoration: none;
+              }
+            }
+          }
+       }
+
+      }
+    }
   }
   .pig-nav-item {
     word-break: break-word;
@@ -66,25 +193,101 @@
   }
 }
 
+.nav-tabs-script {
+  margin-bottom: 10px;
+  .job > a {
+    padding: 10px 25px 10px 15px;
+  }
+  .active > .btn {
+    color: #111;
+  }
+  .btn {
+    &:hover {
+      color: @brand-danger;
+    }
+    position: absolute;
+    color: @brand-primary;
+    top: 1px;
+    padding: 0px;
+    background: transparent;
+    right: 3px;
+    padding: 0px 4px;
+  }
+}
+
+.scriptlist, .panel-udfs, .panel-history {
+  .title-row {
+    height: 55px;
+  }
+}
+
 //script list
-.panel-scriptlist {
+.scriptlist {
   .new-script {
-    position: relative;
-    top:-5px;
+    margin-top: 15px;
+    /*position: relative;
+    top:-5px;*/
+  }
+  table {
+    th:last-child {
+      width: 260px;
+    }
+    td > h4 {
+      margin: 0;
+    }
+    td:last-child > a {
+      margin-right: 15px;
+    }
+  }
+}
+
+.pagination-block {
+  color: #7b7b7b;
+  & > div {
+    display: inline-block;
+    margin-left: 15px;
+  }
+  text-align: right;
+  .items-count {
+    vertical-align: top;
+    label {
+      font-weight: normal;
+    }
+    select {
+      display: inline-block;
+      width: auto;
+      padding: 0px 8px;
+      height: 28px;
+    }
+  }
+  .items-info {
+    vertical-align: top;
+    padding: 4px 0;
+  }
+  .items-buttons {
+    .pagination {
+      margin: 0;
+      & > li > a, & > li > span {
+        padding: 3px 12px;
+        border-color: transparent;
+        &:hover {
+          background-color: #fff;
+        }
+      }
+    }
   }
 }
 
 //udfs
 .panel-udfs {
   .upload-udf {
-    position: relative;
-    top:-5px;
+    margin-top: 15px;
   }
 }
 
 .argument-label {
   vertical-align: middle;
-  background-color: #999999;
+  background-color: @gray-light;
   display: inline-block;
   font-size: 75%;
   font-weight: bold;
@@ -103,6 +306,7 @@
 //edit script
 .edit-script {
   .panel-editscript {
+    margin-bottom: 5px;
     textarea {
       width: 100%;
       max-width: 100%;
@@ -116,7 +320,16 @@
     }
     .CodeMirror {
       .common-shadow-inset;
-
+      height:500px;
+      .CodeMirror-hscrollbar {
+        left: 0 !important;
+      }
+    }
+    #sgrip {
+      position: absolute;
+      left: 50%;
+      cursor: s-resize;
+      color: #999999;
     }
     .table-results {
       .argument {
@@ -128,19 +341,24 @@
       background-color: #f5f5f5;
     }
     .panel-heading{
-      .input-title {
-        width: 1%;
-        #title {
-          width: 250px;
-          display: inline-block;
+      .script-title {
+        display: inline-block;
+        h4 {
+          margin-bottom: 5px;
+          .btn-rename {
+            margin-left: 10px;
+          }
         }
+      }
 
-        .btn-rename-ask {
-          background-color: #f5f5f5;
+      .input-title {
+        width: 45%;
+        min-width: 200px;
+        .tooltip-arrow {
+          border-bottom-color: #a94442;
         }
-
-        .btn-rename-ask:hover {
-          background-color: #fff;
+        .tooltip-inner {
+          background-color: #a94442;
         }
 
         .btn-rename-cancel{
@@ -153,8 +371,8 @@
       }
     }
     .panel-body {
-      padding: 5px; 
-      background-color: #f5f5f5; 
+      padding: 5px;
+      background-color: #f5f5f5;
       border-bottom: 1px solid #dddddd;
       .argadd {
         font-size: 13px;
@@ -213,28 +431,173 @@
       }
     }
   }
-  .pigParams {
-    padding-bottom: 10px; 
+  .params-block {
+    .block-title {
+      border-bottom: 2px solid #dddddd;
+      margin-bottom: 10px;
+      padding: 5px 0;
+    }
+    .pigParams {
+      padding-bottom: 10px;
+    }
+  }
+  .arguments-block {
+    .block-title {
+      border-bottom: 2px solid #dddddd;
+      margin-bottom: 10px;
+      padding: 5px 0;
+    }
+    .alert {
+      padding: 6px 15px;
+      margin-bottom: 5px;
+    }
+    .arguments-wrap {
+      .label {
+        padding: 10px ;
+        display: inline-block;
+        font-size: 100%;
+        margin-bottom: 5px;
+        a {
+          margin-left: 5px;
+          font-size: 100%;
+        }
+      }
+    }
+  }
+}
+
+.script_history_container{
+  table {
+    th:last-child {
+      width: 250px;
+    }
+    td > h4 {
+      margin: 0;
+    }
+    td > a {
+      margin-right: 15px;
+    }
+  }
+}
+
+.panel-history {
+  table {
+    th:first-child {
+      width: 140px;
+    }
+    th:last-child {
+      width: 110px;
+    }
+    td > h4 {
+      margin: 0;
+    }
+    td > a {
+      margin-right: 15px;
+    }
+    .scriptLink {
+      &.inactive {
+        text-decoration: none;
+        background-color: transparent;
+        cursor: auto;
+        color: #999999;
+      }
+      cursor: pointer;
+    }
   }
 }
 
-.job-status-view {
-  .progress {
-    margin-bottom: 0;
+.job-container {
+  .progress-wrap {
+    .base-transition( width 200ms linear;);
+  }
+  .panel-title {
+    font-weight: normal;
+    a {
+      text-decoration: none;
+    }
+    .toggle-icon {
+      transition: all 0.3s;
+    }
+  }
+  #scriptResults .panel-body, #scriptLogs .panel-body {
+    max-height: 550px;
+    overflow-x: hidden;
+    background-color: #fcfcfc;
+    pre {
+      margin: 0;
+      padding: 0;
+      border: 0;
+      border-radius: 0;
+      background-color: #fcfcfc;
+    }
+  }
+  .CodeMirror {
+    .common-shadow-inset;
+    height: 215px;
+    border-bottom: 1px solid #dddddd;
+    .CodeMirror-gutters {
+      background-color: #fcfcfc;
+    }
+    .CodeMirror-hscrollbar {
+      left: 0 !important;
+    }
+  }
+  #sgrip {
+      position: absolute;
+      left: 50%;
+      cursor: s-resize;
+      color: #999999;
+    }
+
+  .arguments-wrap {
+    padding: 5px;
+    .label {
+      padding: 5px;
+      display: inline-block;
+      font-size: 100%;
+      margin-bottom: 5px;
+    }
+  }
+
+  #scriptDetails {
+    .body-title {
+      padding: 5px;
+      background-color: #fcfcfc;
+      border-bottom: 1px solid #dddddd;
+    }
+    .alert {
+      border: none;
+      border-radius: 0;
+      margin-bottom: 0;
+    }
   }
-  .kill-button {
-    float: left; 
-    margin-right: 10px;
+
+  .job-info {
+    td {
+     /* textarea {
+        width: 100%;
+        max-width: 100%;
+        height: 300px;
+      }*/
+      border: 0;
+      &:first-child {
+        width: 120px;
+      }
+    }
   }
+
 }
 
 //utils
 #alert-wrap {
-  position: fixed;
-  bottom: 0;
-  width: 16.666666666666664%;
-  padding-right: 30px;
+  //position: fixed;
+  //bottom: 0;
+  //width: 16.666666666666664%;
+  //padding-right: 30px;
   font-size: 0.9em;
+width: 100%;
+z-index: 3;
+opacity: 0.89;
   
   .alert {
     .common-shadow;
@@ -350,15 +713,6 @@
   border-radius:6px 0 6px 6px;
 }
 
-
-a.list-group-item.active{
-  z-index: 2;
-  color: #ffffff;
-  background-color: #428bca;
-  border-color: #428bca;
-  .base-transition(border-color 200ms linear, background-color 200ms linear;);
-}
-
 .empty-table-footer {
   text-align: center;
   font-size: 13pt;
@@ -373,6 +727,27 @@ a.list-group-item.active{
 .green {
     color: green;
 }
+
 .red {
     color: red;
-}
\ No newline at end of file
+}
+
+.resultsModal, .logModal {
+  .modal-header p {
+    width: 55%;
+  }
+  .modal-body {
+    height: 550px;
+    overflow-y: scroll;
+    background-color: #f5f5f5;
+    pre {
+      margin: 0;
+      padding: 0;
+      border: 0;
+      border-radius: 0;
+    }
+  }
+  .modal-footer {
+    margin-top: 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/pigHelper.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/pigHelper.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/pigHelper.hbs
new file mode 100644
index 0000000..4c1596d
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/pigHelper.hbs
@@ -0,0 +1,34 @@
+{{!
+   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.
+}}
+
+<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
+  {{t 'editor.pighelper'}}
+  <span class="caret"></span>
+</button>
+<ul class="dropdown-menu" id="pig_helper">
+  {{#each view.helpers}}
+    <li class="dropdown-submenu">
+      <a>{{this.title}}</a>
+      <ul class="dropdown-menu">
+        {{#each this.helpers }}
+          <li><a href="#" {{action 'putToEditor' this target="view" }} >{{this}}</a></li>
+        {{/each}}
+      </ul>
+    </li>
+  {{/each}}
+</ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/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
new file mode 100644
index 0000000..7f6532f
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/components/scriptListRow.hbs
@@ -0,0 +1,44 @@
+{{!
+   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.
+}}
+
+<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>
+  {{view.currentJob.status}}
+</td>
+<td>
+  {{#unless isNew}}
+    {{#link-to 'script.history' id}}{{t 'common.history'}}{{/link-to}} -
+    <a href="#" {{action "deletescript" this}}>{{t 'common.delete'}}</a>
+  {{/unless}}
+</td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/error.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/error.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/error.hbs
new file mode 100644
index 0000000..b3e6033
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/error.hbs
@@ -0,0 +1,35 @@
+{{!
+* 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="panel panel-danger">
+  <div class="panel-heading">
+    <div class="text-center">
+      <strong>{{content.status}}</strong>  {{content.message}}
+      {{#if content.trace}}
+        <a data-toggle="collapse" class="btn btn-danger btn-xs" href="#collapseTrace">Trace <span class="caret"></span></a>
+      {{/if}}
+    </div>
+  </div>
+  <div id="collapseTrace" class="panel-collapse collapse">
+    <div class="panel-body">
+      <pre>
+        {{content.trace}}
+      </pre>
+    </div>
+  </div>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/index.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/index.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/index.hbs
deleted file mode 100644
index 0efb5b2..0000000
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/index.hbs
+++ /dev/null
@@ -1,18 +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.
-}}
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmAway.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmAway.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmAway.hbs
new file mode 100644
index 0000000..3c12506
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmAway.hbs
@@ -0,0 +1,32 @@
+{{!
+   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.
+}}
+
+{{#pig-modal ok='confirm' option="discard" }}
+  <div class="modal-header">
+    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'common.warning'}}</h4>
+  </div>
+  <div class="modal-body">
+    {{t 'scripts.modal.unsaved_changes_warning'}}
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" target="view"}} class="btn btn-default" >{{t 'common.cancel'}}</button>
+    <button type="button" {{action "option" target="view" }} {{bind-attr class=":btn :btn-danger"}}>{{t 'common.discard_changes'}}</button>
+    <button type="button" {{action "ok" target="view"}} {{bind-attr class=":btn :btn-success"}}>{{t 'common.save'}}</button>
+  </div>
+{{/pig-modal}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmDelete.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmDelete.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmDelete.hbs
new file mode 100644
index 0000000..b71854f
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/confirmDelete.hbs
@@ -0,0 +1,31 @@
+{{!
+   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.
+}}
+
+{{#pig-modal ok='confirm'}}
+  <div class="modal-header">
+    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'scripts.modal.confirm_delete'}}</h4>
+  </div>
+  <div class="modal-body">
+  {{t 'scripts.modal.confirm_delete_massage' titleBinding="content.title" tagName="p"}}
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" target="view"}} class="btn btn-default" data-dismiss="modal">{{t 'common.cancel'}}</button>
+    <button type="button" {{action "ok" content target="view"}} class="btn btn-danger">{{t 'common.delete'}}</button>
+  </div>
+{{/pig-modal}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createScript.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createScript.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createScript.hbs
new file mode 100644
index 0000000..cfe3f58
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createScript.hbs
@@ -0,0 +1,42 @@
+{{!
+   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.
+}}
+
+{{#pig-modal ok='confirm' close='cancel' escape-press='cancel'}}
+  <div class="modal-header">
+    <button type="button" class="close" {{action "cancel" target="view"}} aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'scripts.modal.create_script'}}</h4>
+  </div>
+  <div class="modal-body">
+  <div class="form-group">
+      <label>{{t 'scripts.title'}}</label>
+      {{input class="form-control" placeholderTranslation="scripts.modal.script_title_placeholder" valueBinding="content.title"}}
+    </div>
+    {{#if titleError}}
+      <div class="alert alert-danger">{{titleError}}</div>
+    {{/if}}
+    <div class="form-group">
+      <label for="exampleInputPassword1">{{t 'scripts.path'}}</label>
+      {{input class="form-control" placeholderTranslation="scripts.modal.file_path_placeholder" valueBinding="filePath"}}
+      <small class="pull-right help-block">{{t 'scripts.modal.file_path_hint'}}</small>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" target="view"}} class="btn btn-default" >{{t 'common.cancel'}}</button>
+    <button type="button" {{action "ok" target="view"}} {{bind-attr class="titleError:disabled :btn :btn-success"}} >{{t 'common.create'}}</button>
+  </div>
+{{/pig-modal}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createUdf.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createUdf.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createUdf.hbs
new file mode 100644
index 0000000..6f1ffb2
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/createUdf.hbs
@@ -0,0 +1,38 @@
+{{!
+   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.
+}}
+
+{{#pig-modal ok='confirm' close='cancel'}}
+  <div class="modal-header">
+    <button type="button" class="close" {{action "cancel" target="view"}} aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'udfs.modal.create_udf'}}</h4>
+  </div>
+  <div class="modal-body">
+  <div class="form-group">
+      <label for="exampleInputEmail1">{{t 'common.name'}}</label>
+      {{input class="form-control" placeholderTranslation="udfs.modal.udf_name" valueBinding="content.name"}}
+    </div>
+    <div class="form-group">
+      <label for="exampleInputPassword1">{{t 'common.path'}}</label>
+      {{input class="form-control" placeholderTranslation="udfs.modal.hdfs_path" valueBinding="content.path"}}
+    </div>
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" content target="view"}} class="btn btn-default" >{{t 'common.cancel'}}</button>
+    <button type="button" {{action "ok" target="view"}} {{bind-attr class=":btn :btn-success udfInvalid:disabled"}}>{{t 'common.create'}}</button>
+  </div>
+{{/pig-modal}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteJob.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteJob.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteJob.hbs
new file mode 100644
index 0000000..0f4c74f
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteJob.hbs
@@ -0,0 +1,31 @@
+{{!
+   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.
+}}
+
+{{#pig-modal ok='confirm'}}
+  <div class="modal-header">
+    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'scripts.modal.confirm_delete'}}</h4>
+  </div>
+  <div class="modal-body">
+  {{t 'job.modal.confirm_delete_massage' titleBinding="content.title" tagName="p"}}
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" target="view"}} class="btn btn-default" data-dismiss="modal">{{t 'common.cancel'}}</button>
+    <button type="button" {{action "ok" content target="view"}} class="btn btn-danger">{{t 'common.delete'}}</button>
+  </div>
+{{/pig-modal}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/82e72e51/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/gotoCopy.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/gotoCopy.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/gotoCopy.hbs
new file mode 100644
index 0000000..1d4fcdb
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/gotoCopy.hbs
@@ -0,0 +1,31 @@
+{{!
+   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.
+}}
+
+{{#pig-modal ok='confirm'}}
+  <div class="modal-header">
+    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">{{t 'scripts.modal.copy_created'}}</h4>
+  </div>
+  <div class="modal-body">
+    {{t 'scripts.modal.copy_created_massage' titleBinding="content.title" tagName="p"}}
+  </div>
+  <div class="modal-footer">
+    <button type="button" {{action "cancel" target="view"}} class="btn btn-default" data-dismiss="modal">{{t 'scripts.modal.continue_editing'}}</button>
+    <button type="button" {{action "ok" content target="view"}} class="btn btn-primary">{{t 'scripts.modal.go_to_copy'}}</button>
+  </div>
+{{/pig-modal}}


Mime
View raw message