You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by tb...@apache.org on 2014/05/02 18:24:49 UTC

[2/7] AMBARI-5616 - Ambari Views: Pig view (Roman Rader via tbeerbower)

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert-content.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert-content.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert-content.hbs
new file mode 100644
index 0000000..7c2e370
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert-content.hbs
@@ -0,0 +1,22 @@
+{{!
+   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="close" >&times;</button>
+  <p>
+    {{view.content.message}}
+  </p>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert.hbs
new file mode 100644
index 0000000..8ee2dfb
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/alert.hbs
@@ -0,0 +1,21 @@
+{{!
+   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 id="alert-wrap">
+   {{view view.alertsView}}
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/pigHelper.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/pigHelper.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/pigHelper.hbs
new file mode 100644
index 0000000..4840931
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/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 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/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/script-nav.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/script-nav.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/script-nav.hbs
new file mode 100644
index 0000000..767ad5f
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/util/script-nav.hbs
@@ -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.
+}}
+
+<span class='lb' {{action "gotoSection" view.content }}>
+{{view.content.label}}
+
+{{#unless view.content.label}}
+...     
+{{/unless}} 
+	
+</span>
+  
+{{#if view.content.id}} 
+  <button {{action "close" view.content }}type="button" class="close rm" >&times;</button>
+{{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/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
new file mode 100644
index 0000000..6efff8e
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js
@@ -0,0 +1,110 @@
+/**
+ * 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.
+ */
+
+Ember.I18n.translations = {
+  'common':{
+    'create': 'Create',
+    'add':"Add",
+    'edit':"Edit",
+    'name':"Name",
+    'path':"Path",
+    'owner':"Owner",
+    'delete':"Delete",
+    'created':"Created",
+    'created':"Created",
+    'history':"History",
+    'clone':"Clone",
+    'cancel':"Cancel"
+  },
+  'scripts':{
+    'scripts':"Scripts",
+    'newscript': "New Script",
+    'title': "Title",
+    'modal':{
+      'create_script':'Create script',
+      'file_path_placeholder':'Full path to script file',
+      'file_path_hint':'Leave empty to create file automatically.',
+      'file_path_hint':'Leave empty to create file automatically.',
+
+      'confirm_delete':'Confirm Delete',
+      'confirm_delete_massage':'Are you sure you want to delete {{title}} script?'
+    },
+    'alert':{
+      'arg_present':'Argument already present',
+      'file_exist_error':'File already exist',
+      'script_saved':'{{title}} saved!',
+      'script_created':'{{title}} created!',
+      'script_deleted':'{{title}} deleted!',
+      'create_failed':'Failed to create script!',
+      'delete_failed':'Delete failed!',
+      'save_error':'Error while saving script',
+      'save_error_reason':'{{message}}',
+    },
+  },
+  'editor':{
+    'pighelper':'PIG helper',
+    'udfhelper':'UDF helper',
+    'save':'Save',
+    'execute':'Execute',
+    'explain':'Explain',
+    'syntax_check':'Syntax check'
+  },
+  'job':{
+    'title': "Title",
+    'results':'Results',
+    'logs':'Logs',
+    'job_status':'Job status: ',
+    'status':'Status',
+    'started':'Started',
+    'alert':{
+      'job_started' :'Job started!',
+      'job_killed' :'{{title}} job killed!',
+      'job_kill_error' :'Job kill failed!',
+      'start_filed' :'Job failed to start!',
+      'load_error' :'Error loading job. Reason: {{message}}',
+      'stdout_error' :'Error loading STDOUT. \n Status: {{status}} Message: {{message}}',
+      'stderr_error' :'Error loading STDERR. \n Status: {{status}} Message: {{message}}',
+      'exit_error' :'Error loading EXITCODE. \n Status: {{status}} Message: {{message}}',
+    },
+    'job_results':{
+      'stdout':'Stdout',
+      'stderr':'Stderr',
+      'exitcode':'Exit code',
+      'stdout_loading':'Loading stdout...',
+      'stderr_loading':'Loading stderr...',
+      'exitcode_loading':'Loading exitcode...',
+    },
+  },
+  'udfs':{
+    'udfs':'UDFs',
+    'tooltips':{
+      'path':'Path of this script file on HDFS',
+    },
+    'alert':{
+      'udf_created':'{{name}} created!',
+      'udf_deleted':'{{name}} deleted!',
+      'create_failed':'Failed to create UDF!',
+      'delete_failed':'Delete failed!',
+    },
+    'modal':{
+      'create_udf':'Create UDF',
+      'udf_name':'UDF name',
+      'hdfs_path':'HDFS path',
+    }
+  }
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig.js
new file mode 100644
index 0000000..869eecb
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig.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.PigView = Em.View.extend({
+  selectedBinding: 'controller.category',
+  navs: Ember.computed(function() {
+    var items = [ 
+      {name:'scripts',url:'pig.scriptList',label: Em.I18n.t('scripts.scripts')},
+      {name:'udfs',url:'pig.udfs',label:Em.I18n.t('udfs.udfs')},
+      {name:'history',url:'pig.history',label:Em.I18n.t('common.history')}
+    ];
+    this.get('controller.openScripts').forEach(function(scripts){
+      items.push(scripts);
+    });
+    return items;
+  }).property('controller.openScripts'),
+  navItemsView : Ember.CollectionView.extend({
+    classNames: ['list-group'],
+    tagName: 'div',
+    content: function () { 
+      return this.get('parentView.navs')
+    }.property('parentView.navs'),
+    itemViewClass: Ember.View.extend(Ember.ViewTargetActionSupport,{
+      tagName: 'a',
+      templateName: 'pig/util/script-nav',
+      classNames: ['list-group-item pig-nav-item'],
+      classNameBindings: ['isActive:active'],
+      action: 'gotoSection',
+      click: function(e) {
+        if (e.target.type=="button") {
+          return false;
+        };
+        this.triggerAction({
+          actionContext:this.content
+        }); 
+      },
+      isActive: function () {
+        return this.get('content.name') === this.get('parentView.parentView.selected');
+      }.property('content.name', 'parentView.parentView.selected')
+    })
+  })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/jobResults.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/jobResults.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/jobResults.js
new file mode 100644
index 0000000..15bf89b
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/jobResults.js
@@ -0,0 +1,52 @@
+/**
+ * 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.JobResultsView = Em.View.extend({
+    templateName: 'pig/jobResults',
+    outputView: Em.View.extend({
+      classNames: ['panel panel-default panel-results'],
+      templateName: 'pig/jobResultsOutput',
+      didInsertElement:function () {
+          $('#btn-stdout').button({'loadingText':Em.I18n.t('job.job_results.stdout_loading')});
+          $('#btn-stderr').button({'loadingText':Em.I18n.t('job.job_results.stderr_loading')});
+          $('#btn-exitcode').button({'loadingText':Em.I18n.t('job.job_results.exitcode_loading')});
+      },
+      actions:{
+        getOutput:function (item) {
+          var self = this;
+          var controller = this.get('controller');
+          output = controller.get(item); 
+          if (!output) {
+            return;
+          };
+          $(this.get('element')).find('.btn').removeClass('active');
+          $('#btn-'+item).button('loading');
+          this.set('isLoadingOutput',true);
+          output.then(function (result) {
+            $('#btn-'+item).button('reset').addClass('active');
+            self.set('isLoadingOutput',false);
+            self.set('activeOutput',result.fileContent);
+          })
+        }
+      },
+      isLoadingOutput:false,
+      activeOutput:'Select output.'
+    })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/confirmDelete.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/confirmDelete.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/confirmDelete.js
new file mode 100644
index 0000000..f8e59d1
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/confirmDelete.js
@@ -0,0 +1,29 @@
+/**
+ * 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.ConfirmDeleteView = App.PigModalView.extend({
+  templateName:'pig/modal/confirmdelete',
+  actions:{
+    confirm:function(script) {
+      $(this.get('element')).find('.modal').modal('hide');
+      return this.controller.send('confirmdelete',script);
+    }
+  },
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createScript.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createScript.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createScript.js
new file mode 100644
index 0000000..cf4e412
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createScript.js
@@ -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.
+ */
+
+var App = require('app');
+
+App.CreateScriptView = App.PigModalView.extend({
+  templateName: 'pig/modal/createScript',
+  actions:{
+    create: function(script) {
+      var filePath = this.controller.get('filePath');
+      $(this.get('element')).find('.modal').modal('hide');
+      return this.controller.send('confirmcreate',script,filePath);
+    },
+    close:function (script) {
+      script.deleteRecord();
+      return this._super();
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createUdf.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createUdf.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createUdf.js
new file mode 100644
index 0000000..22ed431
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/createUdf.js
@@ -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.
+ */
+
+var App = require('app');
+
+App.CreateUdfView = App.PigModalView.extend({
+  templateName: 'pig/modal/createUdf',
+  actions:{
+    createUdf: function(udf) {
+      $(this.get('element')).find('.modal').modal('hide');
+      return this.controller.send('createUdf',udf);
+    },
+    close:function (udf) {
+      udf.deleteRecord();
+      return this._super();
+    }
+  },
+  udfInvalid:function (argument) {
+    var udf = this.get('controller.content');
+    var invalid = !udf.get('name') || !udf.get('path');
+    return invalid;
+  }.property('controller.content.name','controller.content.path'),
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/pigModal.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/pigModal.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/pigModal.js
new file mode 100644
index 0000000..d86e9fe
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/modal/pigModal.js
@@ -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.
+ */
+
+var App = require('app');
+
+App.PigModalView = Ember.View.extend({
+  actions:{
+    close:function() {
+      return $(this.get('element')).find('.modal').modal('hide');
+    }
+  },
+  didInsertElement: function() {
+    var view = this;
+    $(this.get('element')).find('.modal').modal('show');
+    return this.$('.modal').on("hidden.bs.modal", function(ev) {
+      view.controller.send('closeModal');
+    });
+  },
+  layoutName:'pig/modal/modalLayout'
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigHistory.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigHistory.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigHistory.js
new file mode 100644
index 0000000..1ee56a5
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigHistory.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.PigHistoryView = Em.View.extend({
+  historyTableRow:Ember.View.extend({
+    statuses:{
+      'SUBMITTING':'success',
+      'SUBMITTED':'success',
+      'RUNNING':'warning',
+      'COMPLETED':'success',
+      'SUBMIT_FAILED':'danger',
+      'KILLED':'danger',
+      'FAILED':'danger'
+    },
+    labelClass:function () {
+      return 'label-'+this.statuses[this.get('context.status')];
+    }.property('context.status'),
+  })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigJob.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigJob.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigJob.js
new file mode 100644
index 0000000..09d17dc
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigJob.js
@@ -0,0 +1,41 @@
+/**
+ * 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.PigJobView = Em.View.extend({
+    templateName: 'pig/job',
+    classNames:['job-status-view'],
+    actions:{
+      editJob:function (job) {
+        job.store.createRecord('job',{pigScript: job.get('pigScript'),title:job.get('title')});
+        return 
+      }
+    },
+    progressBar: Em.View.extend({
+      classNames:['progress'],
+      didInsertElement:function () {
+        this.update();
+      },
+      update:function () {
+        var progress = (!this.get('content.isTerminated'))?this.get('content.percentStatus'):100;
+        $(this.get('element')).find('.progress-bar').css('width',progress+'%');
+      }.observes('content.percentStatus'),
+      template:Em.Handlebars.compile('<div {{bind-attr class=":progress-bar content.isTerminated:progress-bar-danger:progress-bar-success" }}role="progressbar"></div>')
+    })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigUdfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigUdfs.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigUdfs.js
new file mode 100644
index 0000000..81bc4f6
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/pigUdfs.js
@@ -0,0 +1,23 @@
+/**
+ * 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.PigUdfsView = Em.View.extend({
+    templateName: 'pig/udfs'
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptEdit.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptEdit.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptEdit.js
new file mode 100644
index 0000000..a352e35
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptEdit.js
@@ -0,0 +1,257 @@
+/**
+ * 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.PigScriptEditView = Em.View.extend({
+  didInsertElement:function () {
+    $('.file-path').tooltip();
+    if (this.get('controller.isJob')) {
+      this.set('isEditConfirmed',false);
+    };
+  },
+  actions:{
+    insertUdf:function (udf) {
+      var cm = this.get('codeMirror');
+      cm.setValue('REGISTER ' + udf.get('path') + '\n'+ cm.getValue());
+    },
+    confirmEdit:function () {
+      this.set('isEditConfirmed', true);
+    }
+  },
+  argumentInput: Ember.TextField.extend({
+    viewName:"argumentInput",
+    actions:{
+      sendArgument:function(){
+        this.get('parentView.controller').send('addArgument',this.get('value'));
+        this.set('value',null);
+      }
+    },
+    classNames:["form-control argadd"],
+    keyPress:function  (event) {
+      if (event.keyCode=="13") {
+        this.send('sendArgument');
+      }
+    }
+  }),
+  showEditor:function () {
+    var wrapper = $('.editor-container');
+    return (this.get('controller.category')=='results')?$(wrapper).hide():$(wrapper).show();;
+  }.observes('controller.category','codeMirror'),
+  codeMirror:null,
+  codeMirrorView: Ember.TextArea.extend({
+    valueBinding:"content.fileContent",
+    updateCM:function (view,trigger) {
+      var cm = this.get('parentView.codeMirror');
+      var cmElement = $(cm.display.wrapper);
+      if (this.get('content.isLoaded')) {
+        if (this.get('parentView.controller.isJob') && !this.get('parentView.isEditConfirmed')) {
+          cm.setOption('readOnly',true);
+          cmElement.addClass('inactive');
+        } else {
+          cm.setOption('readOnly',false);
+          cmElement.removeClass('inactive')
+        }
+        this.get('parentView.codeMirror').setValue(this.get('content.fileContent')||'');
+      } else {
+        cm.setOption('readOnly',true);
+        cmElement.addClass('inactive');
+      };
+
+    }.observes('parentView.codeMirror', 'content.didLoad', 'parentView.isEditConfirmed'),
+    didInsertElement: function() {
+      var self = this;
+      var cm = CodeMirror.fromTextArea(this.get('element'),{
+        lineNumbers: true,
+        matchBrackets: true,
+        indentUnit: 4,
+        keyMap: "emacs"
+      });
+      this.set('parentView.codeMirror',cm);
+      cm.on('change',function (cm) {
+        var pig_script = self.get('content');
+        if (pig_script.get('isLoaded')){
+          pig_script.set('fileContent',cm.getValue());
+        }
+      });                  
+    }
+  }),
+  isEditConfirmed: true,
+  pigHelperView: Em.View.extend({
+    actions:{
+      putToEditor:function (helper) {
+        helper = helper.toString();
+        
+        var editor = this.get('parentView.codeMirror');
+        var cursor = editor.getCursor();
+        var pos = this.findPosition(helper);
+        
+        editor.replaceRange(helper, cursor, cursor);
+        editor.focus();
+
+        if (pos.length>1) {
+          editor.setSelection(
+            {line:cursor.line, ch:cursor.ch + pos[0]},
+            {line:cursor.line, ch:cursor.ch + pos[1]+1}
+          );
+        }
+
+        return false;
+      }
+    },
+    findPosition: function (curLine){
+      var pos= curLine.indexOf("%");
+      var posArr=[];
+      while(pos > -1) {
+        posArr.push(pos);
+        pos = curLine.indexOf("%", pos+1);
+      }
+      return posArr;
+    },
+    templateName:'pig/util/pigHelper',
+    helpers:[
+      {
+        'title':'Eval Functions',
+        'helpers':[
+          'AVG(%VAR%)',
+          'CONCAT(%VAR1%, %VAR2%)',
+          'COUNT(%VAR%)',
+          'COUNT_START(%VAR%)',
+          'IsEmpty(%VAR%)',
+          'DIFF(%VAR1%, %VAR2%)',
+          'MAX(%VAR%)',
+          'MIN(%VAR%)',
+          'SIZE(%VAR%)',
+          'SUM(%VAR%)',
+          'TOKENIZE(%VAR%, %DELIM%)',
+        ]
+      },
+      {
+        'title':'Relational Operators',
+        'helpers':[
+          'COGROUP %VAR% BY %VAR%',
+          'CROSS %VAR1%, %VAR2%;',
+          'DISTINCT %VAR%;',
+          'FILTER %VAR% BY %COND%',
+          'FLATTEN(%VAR%)',
+          'FOREACH %DATA% GENERATE %NEW_DATA%',
+          'FOREACH %DATA% {%NESTED_BLOCK%}',
+          'GROUP %VAR% BY %VAR%',
+          'GROUP %VAR% ALL',
+          'JOIN %VAR% BY ',
+          'LIMIT %VAR% %N%',
+          'ORDER %VAR% BY %FIELD%',
+          'SAMPLE %VAR% %SIZE%',
+          'SPLIT %VAR1% INTO %VAR2% IF %EXPRESSIONS%',
+          'UNION %VAR1%, %VAR2%',
+        ]
+      },
+      {
+        'title':'I/0',
+        'helpers':[
+          "LOAD '%FILE%';",
+          'DUMP %VAR%;',
+          'STORE %VAR% INTO %PATH%;',
+        ]
+      },
+      {
+        'title':'Debug',
+        'helpers':[
+          'EXPLAIN %VAR%;',
+          'ILLUSTRATE %VAR%;',
+          'DESCRIBE %VAR%;',
+        ]
+      },
+      {
+        'title':'HCatalog',
+        'helpers':[
+          "LOAD '%TABLE%' USING org.apache.hcatalog.pig.HCatLoader();",
+        ]
+      },
+      {
+        'title':'Math',
+        'helpers':[
+          'ABS(%VAR%)',
+          'ACOS(%VAR%)',
+          'ASIN(%VAR%)',
+          'ATAN(%VAR%)',
+          'CBRT(%VAR%)',
+          'CEIL(%VAR%)',
+          'COS(%VAR%)',
+          'COSH(%VAR%)',
+          'EXP(%VAR%)',
+          'FLOOR(%VAR%)',
+          'LOG(%VAR%)',
+          'LOG10(%VAR%)',
+          'RANDOM(%VAR%)',
+          'ROUND(%VAR%)',
+          'SIN(%VAR%)',
+          'SINH(%VAR%)',
+          'SQRT(%VAR%)',
+          'TAN(%VAR%)',
+          'TANH(%VAR%)',
+        ]
+      },
+      {
+        'title':'Tuple, Bag, Map Functions',
+        'helpers':[
+          'TOTUPLE(%VAR%)',
+          'TOBAG(%VAR%)',
+          'TOMAP(%KEY%, %VALUE%)',
+          'TOP(%topN%, %COLUMN%, %RELATION%)',
+        ]
+      },
+      {
+        'title':'String Functions',
+        'helpers':[
+          "INDEXOF(%STRING%, '%CHARACTER%', %STARTINDEX%)",
+          "LAST_INDEX_OF(%STRING%, '%CHARACTER%', %STARTINDEX%)",
+          "LOWER(%STRING%)",
+          "REGEX_EXTRACT(%STRING%, %REGEX%, %INDEX%)",
+          "REGEX_EXTRACT_ALL(%STRING%, %REGEX%)",
+          "REPLACE(%STRING%, '%oldChar%', '%newChar%')",
+          "STRSPLIT(%STRING%, %REGEX%, %LIMIT%)",
+          "SUBSTRING(%STRING%, %STARTINDEX%, %STOPINDEX%)",
+          "TRIM(%STRING%)",
+          "UCFIRST(%STRING%)",
+          "UPPER(%STRING%)",
+        ]
+      },
+      {
+        'title':'Macros',
+        'helpers':[
+          "IMPORT '%PATH_TO_MACRO%';",
+        ]
+      },
+      {
+        'title':'HBase',
+        'helpers':[
+          "LOAD 'hbase://%TABLE%' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('%columnList%')",
+          "STORE %VAR% INTO 'hbase://%TABLE%' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('%columnList%')",
+        ]
+      },
+      {
+        'title':'Python UDF',
+        'helpers':[
+          "REGISTER 'python_udf.py' USING jython AS myfuncs;",
+        ]
+      }
+    ]
+  }),
+  pigParamView:Em.TextField.extend({})
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptList.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptList.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptList.js
new file mode 100644
index 0000000..50e5a95
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptList.js
@@ -0,0 +1,22 @@
+/**
+ * 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.PigScriptListView = Em.View.extend({
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResults.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResults.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResults.js
new file mode 100644
index 0000000..cb9f52c
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResults.js
@@ -0,0 +1,23 @@
+/**
+ * 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.PigScriptResultsView = Em.View.extend({
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResultsNav.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResultsNav.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResultsNav.js
new file mode 100644
index 0000000..a9dd420
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/scriptResultsNav.js
@@ -0,0 +1,49 @@
+/**
+ * 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.PigScriptResultsNavView = Em.View.extend({
+  tagName:'span',
+  selectedBinding: 'controller.category',
+  navResultsView : Ember.CollectionView.extend({
+    classNames: ['nav nav-pills nav-results pull-right'],
+    tagName: 'ul',
+    content: function () { 
+      var navs = [ 
+        {name:'edit',route:'job',label:Em.I18n.t('common.edit')},
+        {name:'results',route:'job.results',label:Em.I18n.t('job.results')},
+        //{name:'logs',route:'#',label:Em.I18n.t('job.logs')}
+      ];
+      return navs;
+    }.property(),
+    itemViewClass: Ember.View.extend(Ember.ViewTargetActionSupport,{
+      actions:{
+        switch:function (argument) {
+          return this.send('navigate',argument)
+        }
+      },
+      tagName: 'li',
+      template: Ember.Handlebars.compile('<a href="#" {{action "switch" view.content target="view"}} >{{view.content.label}}</a>'),
+      classNameBindings: ['isActive:active'],
+      isActive: function () {
+        return this.get('content.name') === this.get('parentView.parentView.selected');
+      }.property('content.name', 'parentView.parentView.selected')
+    })
+  })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/util/pigUtilAlert.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/util/pigUtilAlert.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/util/pigUtilAlert.js
new file mode 100644
index 0000000..10e2345
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/pig/util/pigUtilAlert.js
@@ -0,0 +1,55 @@
+/**
+ * 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.PigUtilAlertView = Ember.View.extend({ 
+  alertsView : Ember.CollectionView.extend({
+    content: function () { 
+      return this.get('controller.content');
+    }.property('controller.content'),
+    itemViewClass: Ember.View.extend({
+      classNames: ['alert fade in'],
+      classNameBindings: ['alertClass'],
+      attributeBindings:['dismiss:data-dismiss'],
+      dismiss:'alert',
+      templateName: 'pig/util/alert-content',
+      didInsertElement:function () {
+        var self = this;
+        
+        $(self.get('element')).bind('closed.bs.alert', function (e) {
+          return self.clearAlert();
+        });
+
+        if (this.get('content.status')!='error') {
+          Ember.run.debounce(self, self.close, 3000);
+        };
+      },
+      close : function (argument) {
+        return $(this.get('element')).alert('close');
+      },
+      clearAlert:function () {
+        return this.get('controller').send('removeAlertObject',this.content);
+      },
+      alertClass: function () {
+        var classes = {'success':'alert-success','error':'alert-danger','info':'alert-info'};
+        return classes[this.get('content.status')];
+      }.property('content.status')
+    })
+  })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/bin
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/bin b/contrib/views/pig/src/main/resources/ui/pig-web/bin
new file mode 100644
index 0000000..d9eb09e
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/bin
@@ -0,0 +1 @@
+node_modules/.bin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/bower.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/bower.json b/contrib/views/pig/src/main/resources/ui/pig-web/bower.json
new file mode 100644
index 0000000..44c5247
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/bower.json
@@ -0,0 +1,22 @@
+{
+  "name": "your-app",
+  "version": "0.0.1",
+  "main": "public/app.js",
+  "dependencies": {
+    "ember": "1.4.0",
+    "ember-data": "1.0.0-beta.5",
+    "handlebars": "~1.3.0",
+    "bootstrap": "3.0.x",
+    "codemirror": ">=3.2",
+    "moment": "~2.5.1",
+    "ember-i18n": "~1.6.0"
+  },
+  "overrides": {
+    "cldr":{
+      "main":"plurals.js"
+    },
+    "ember-i18n":{
+      "scripts": []
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/config.coffee
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/config.coffee b/contrib/views/pig/src/main/resources/ui/pig-web/config.coffee
new file mode 100644
index 0000000..867a9ee
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/config.coffee
@@ -0,0 +1,51 @@
+#  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.
+
+exports.config = 
+
+  files: 
+    javascripts: 
+      defaultExtension: 'js'
+      joinTo: 
+        'static/javascripts/app.js': /^app/
+        'static/javascripts/vendor.js': /^bower_components|vendor/
+
+    stylesheets:
+      defaultExtension: 'css'
+      joinTo: 'static/stylesheets/app.css'
+
+    templates:
+      precompile: true
+      root: 'templates'
+      defaultExtension: 'hbs'
+      joinTo: 'static/javascripts/app.js' : /^app/
+      paths:
+        jquery: 'bower_components/jquery/jquery.js'
+        handlebars: 'bower_components/handlebars/handlebars.js'
+        ember: 'bower_components/ember/ember.js'
+
+  modules:
+    addSourceURLs: true
+
+
+  paths:
+    public: '/usr/lib/ambari-server/web/pig'
+
+  overrides:
+    production:
+        paths:
+          public: 'public'
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/collection.js.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/collection.js.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/collection.js.hbs
new file mode 100644
index 0000000..04a95a9
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/collection.js.hbs
@@ -0,0 +1,23 @@
+/**
+ * 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.{{#camelize}}{{pluralName}}{{/camelize}}Controller = Em.ArrayController.extend({
+    content: [] 
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/generator.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/generator.json b/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/generator.json
new file mode 100644
index 0000000..9c40630
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/collection/generator.json
@@ -0,0 +1,9 @@
+{
+  "files": [
+    {
+      "from": "collection.js.hbs",
+      "to": "app/controllers/{{pluralName}}.js"
+    }
+  ],
+  "dependencies": []
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/controller.js.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/controller.js.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/controller.js.hbs
new file mode 100644
index 0000000..66c11bb
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/controller.js.hbs
@@ -0,0 +1,23 @@
+/**
+ * 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.{{#camelize}}{{name}}{{/camelize}}Controller = Em.ObjectController.extend({
+    content: null
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/generator.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/generator.json b/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/generator.json
new file mode 100644
index 0000000..f9ddf55
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/controller/generator.json
@@ -0,0 +1,9 @@
+{
+  "files": [
+    {
+      "from": "controller.js.hbs",
+      "to": "app/controllers/{{name}}.js"
+    }
+  ],
+  "dependencies": []
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/generator.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/generator.json b/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/generator.json
new file mode 100644
index 0000000..f41ac7e
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/generator.json
@@ -0,0 +1,9 @@
+{
+  "files": [
+    {
+      "from": "model.js.hbs",
+      "to": "app/models/{{name}}.js"
+    }
+  ],
+  "dependencies": []
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/model.js.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/model.js.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/model.js.hbs
new file mode 100644
index 0000000..d5f5ece
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/model/model.js.hbs
@@ -0,0 +1,23 @@
+/**
+ * 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.{{#camelize}}{{name}}{{/camelize}} = DS.Model.extend({
+    
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/generator.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/generator.json b/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/generator.json
new file mode 100644
index 0000000..c9123ec
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/generator.json
@@ -0,0 +1,9 @@
+{
+  "files": [
+    {
+      "from": "route.js.hbs",
+      "to": "app/routes/{{name}}.js"
+    }
+  ],
+  "dependencies": []
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/route.js.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/route.js.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/route.js.hbs
new file mode 100644
index 0000000..ec5216a
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/route/route.js.hbs
@@ -0,0 +1,25 @@
+/**
+ * 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.{{#camelize}}{{name}}{{/camelize}}Route = Em.Route.extend({
+    model: function (controller) {
+
+    }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/generator.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/generator.json b/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/generator.json
new file mode 100644
index 0000000..dc51724
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/generator.json
@@ -0,0 +1,9 @@
+{
+  "files": [
+    {
+      "from": "template.hbs.hbs",
+      "to": "app/templates/{{name}}.hbs"
+    }
+  ],
+  "dependencies": []
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/template.hbs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/template.hbs.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/template.hbs.hbs
new file mode 100644
index 0000000..0efb5b2
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/template/template.hbs.hbs
@@ -0,0 +1,18 @@
+{{!
+   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/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/generator.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/generator.json b/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/generator.json
new file mode 100644
index 0000000..7328337
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/generator.json
@@ -0,0 +1,9 @@
+{
+  "files": [
+    {
+      "from": "view.js.hbs",
+      "to": "app/views/{{name}}.js"
+    }
+  ],
+  "dependencies": []
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/view.js.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/view.js.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/view.js.hbs
new file mode 100644
index 0000000..7e35717
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/generators/view/view.js.hbs
@@ -0,0 +1,23 @@
+/**
+ * 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.{{#camelize}}{{name}}{{/camelize}}View = Em.View.extend({
+    templateName: '{{name}}'
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/package.json
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/package.json b/contrib/views/pig/src/main/resources/ui/pig-web/package.json
new file mode 100644
index 0000000..abedb74
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/package.json
@@ -0,0 +1,22 @@
+{
+  "name": "pig-ui",
+  "version": "0.0.1",
+  "engines": {
+    "node": "~0.6.10 || 0.8 || 0.9"
+  },
+  "scripts": {
+    "start": "brunch watch --server",
+    "preinstall": "chmod +x node/npm/bin/node-gyp-bin/node-gyp",
+    "postinstall" : "bash node/with_new_path.sh node node_modules/.bin/bower --allow-root install"
+  },
+  "dependencies": {
+    "brunch": ">= 1.7.1",
+    "javascript-brunch": ">= 1.0 < 1.8",
+    "css-brunch": ">= 1.0 < 1.8",
+    "uglify-js-brunch": ">= 1.0 < 1.8",
+    "bower": ">= 1.2.0",
+    "ember-precompiler-brunch": ">= 1.5.0",
+    "less-brunch": "~1.7.1",
+    "scaffolt": "^0.4.3"
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/test/spec.coffee
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/test/spec.coffee b/contrib/views/pig/src/main/resources/ui/pig-web/test/spec.coffee
new file mode 100644
index 0000000..ecf0374
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/test/spec.coffee
@@ -0,0 +1,17 @@
+# 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.
+
+# Write your [mocha](http://visionmedia.github.com/mocha/) specs here.

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js b/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
new file mode 100644
index 0000000..23666f2
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
@@ -0,0 +1,50 @@
+(function() {
+  String.prototype.regexIndexOf = function(regex, startpos) {
+    var indexOf = this.substring(startpos || 0).search(regex);
+    return (indexOf >= 0) ? (indexOf + (startpos || 0)) : indexOf;
+  }
+
+  function regFindPosition(curLine){
+    var pos= curLine.regexIndexOf(/\%\w*\%/);
+    var posArr=[];
+    while(pos > -1) {
+      posArr.push(pos);
+      pos = curLine.regexIndexOf(/\%\w*\%/,pos+1);
+    }
+    return posArr;
+  }
+
+  CodeMirror.keyMap.emacs = {
+    fallthrough: ["basic", "default"],
+    "Tab": function(cm) {
+      var cursor = cm.getCursor();
+      var curLine = cm.getLine(cursor.line);
+      var vArr = regFindPosition(curLine);
+      var paramRanges = [];
+
+      for (var i = 0; i < vArr.length; i++) {
+        closeparam = curLine.regexIndexOf(/\%/, vArr[i]+1);
+        paramRanges.push({s:vArr[i],e:closeparam});
+      };
+
+      if(vArr.length>1){
+        if (cursor.ch < paramRanges[0].s) {
+          CodeMirror.commands.defaultTab(cm);
+        } else {
+          var thisrange, nextrange;
+          for (var i = 0; i < paramRanges.length; i++) {
+            thisrange = paramRanges[i];
+            nextrange = paramRanges[i+1] || paramRanges[0];
+            if (cursor.ch > thisrange.s && (cursor.ch < nextrange.s || nextrange.s < thisrange.s)){
+              cm.setSelection({line:cursor.line, ch:nextrange.s},{line:cursor.line, ch:nextrange.e+1});
+            } else if (cursor.ch == thisrange.s){
+              cm.setSelection({line:cursor.line, ch:thisrange.s},{line:cursor.line, ch:thisrange.e+1});
+            }
+          }
+        }
+      } else {
+        CodeMirror.commands.defaultTab(cm);
+      }
+    }
+  };
+})();

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/view.xml b/contrib/views/pig/src/main/resources/view.xml
new file mode 100644
index 0000000..257f421
--- /dev/null
+++ b/contrib/views/pig/src/main/resources/view.xml
@@ -0,0 +1,140 @@
+<!--
+   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.
+-->
+<view>
+    <name>PIG</name>
+    <label>Pig</label>
+    <version>1.0.0</version>
+
+    <!-- HDFS parameters -->
+    <parameter>
+        <name>dataworker.defaultFs</name>
+        <description>FileSystem URI</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>dataworker.hdfs_user</name>
+        <description>HDFS user.name and doAs</description>
+        <required>false</required>
+    </parameter>
+
+    <parameter>
+        <name>dataworker.use_current_user</name>
+        <description>If true, get user from Ambari auth</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>dataworker.userScriptsPath</name>
+        <description>Directory to store scripts</description>
+        <required>true</required>
+    </parameter>
+    <parameter>
+        <name>dataworker.pigJobsPath</name>
+        <description>Directory to store jobs (for templeton status dir)</description>
+        <required>true</required>
+    </parameter>
+
+    <!-- Pig parameters -->
+
+    <parameter>
+        <name>dataworker.storagePath</name>
+        <description>Persistent storage path</description>
+        <required>false</required>
+    </parameter>
+
+    <parameter>
+        <name>dataworker.templeton_url</name>
+        <description>Templeton url</description>
+        <required>true</required>
+    </parameter>
+
+    <parameter>
+        <name>dataworker.templeton_user</name>
+        <description>Templeton user.name and doAs</description>
+        <required>true</required>
+    </parameter>
+
+    <resource>
+        <name>script</name>
+        <plural-name>scripts</plural-name>
+        <id-property>id</id-property>
+        <resource-class>org.apache.ambari.view.pig.resources.scripts.models.PigScript</resource-class>
+        <provider-class>org.apache.ambari.view.pig.resources.scripts.ScriptResourceProvider</provider-class>
+        <service-class>org.apache.ambari.view.pig.resources.scripts.ScriptService</service-class>
+    </resource>
+
+    <resource>
+        <name>job</name>
+        <plural-name>jobs</plural-name>
+        <id-property>id</id-property>
+        <resource-class>org.apache.ambari.view.pig.resources.jobs.models.PigJob</resource-class>
+        <provider-class>org.apache.ambari.view.pig.resources.jobs.JobResourceProvider</provider-class>
+        <service-class>org.apache.ambari.view.pig.resources.jobs.JobService</service-class>
+    </resource>
+
+    <resource>
+        <name>udf</name>
+        <plural-name>udfs</plural-name>
+        <id-property>id</id-property>
+        <resource-class>org.apache.ambari.view.pig.resources.udf.models.UDF</resource-class>
+        <provider-class>org.apache.ambari.view.pig.resources.udf.UDFResourceProvider</provider-class>
+        <service-class>org.apache.ambari.view.pig.resources.udf.UDFService</service-class>
+    </resource>
+
+    <resource>
+        <name>file</name>
+        <service-class>org.apache.ambari.view.pig.resources.files.FileService</service-class>
+    </resource>
+
+    <resource>
+        <name>pig</name>
+        <service-class>org.apache.ambari.view.pig.PigServiceRouter</service-class>
+    </resource>
+
+    <instance>
+        <name>PIG_1</name>
+        <!--<property>-->
+            <!--<key>dataworker.storagePath</key>-->
+            <!--<value>/var/lib/ambari-server/pig-view.dat</value>-->
+        <!--</property>-->
+        <property>
+            <key>dataworker.templeton_url</key>
+            <value>http://sandbox.hortonworks.com:50111/templeton/v1</value>
+        </property>
+        <property>
+            <key>dataworker.templeton_user</key>
+            <value>hue</value>
+        </property>
+
+        <property>
+            <key>dataworker.userScriptsPath</key>
+            <value>/tmp/.pigscripts</value>
+        </property>
+        <property>
+            <key>dataworker.pigJobsPath</key>
+            <value>/tmp/.pigjobs</value>
+        </property>
+
+        <property>
+            <key>dataworker.defaultFs</key>
+            <!-- WebHDFS requires 50070 and 50075 ports to be opened -->
+            <value>webhdfs://sandbox.hortonworks.com:50070</value>
+        </property>
+    </instance>
+
+</view>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java
new file mode 100644
index 0000000..7a237d7
--- /dev/null
+++ b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java
@@ -0,0 +1,96 @@
+/**
+ * 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.
+ */
+
+package org.apache.ambari.view.pig;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.ViewResourceHandler;
+import org.apache.hadoop.fs.FileUtil;
+import org.junit.*;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.easymock.EasyMock.*;
+
+public abstract class BasePigTest {
+    protected ViewResourceHandler handler;
+    protected ViewContext context;
+    protected static File pigStorageFile;
+    protected static File baseDir;
+
+    protected static String DATA_DIRECTORY = "./target/PigTest";
+
+    @BeforeClass
+    public static void startUp() throws Exception {
+        File baseDir = new File(DATA_DIRECTORY)
+                .getAbsoluteFile();
+        FileUtil.fullyDelete(baseDir);
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        handler = createNiceMock(ViewResourceHandler.class);
+        context = createNiceMock(ViewContext.class);
+
+        Map<String, String> properties = new HashMap<String, String>();
+        baseDir = new File(DATA_DIRECTORY)
+                .getAbsoluteFile();
+        pigStorageFile = new File("./target/BasePigTest/storage.dat")
+                .getAbsoluteFile();
+
+        properties.put("dataworker.storagePath", pigStorageFile.toString());
+        properties.put("dataworker.templeton_url", "localhost:50111/templeton/v1");
+        properties.put("dataworker.templeton_user", "admin");
+        properties.put("dataworker.userScriptsPath", "/tmp/.pigscripts");
+        properties.put("dataworker.pigJobsPath", "/tmp/.pigjobs");
+
+        setupProperties(properties, baseDir);
+
+        expect(context.getProperties()).andReturn(properties).anyTimes();
+        expect(context.getUsername()).andReturn("ambari-qa").anyTimes();
+
+        replay(handler, context);
+    }
+
+    protected void setupProperties(Map<String, String> properties, File baseDir) throws Exception {
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+
+    }
+
+    protected static <T> T getService(Class<T> clazz,
+                                    final ViewResourceHandler viewResourceHandler,
+                                    final ViewContext viewInstanceContext) {
+        Injector viewInstanceInjector = Guice.createInjector(new AbstractModule() {
+            @Override
+            protected void configure() {
+                bind(ViewResourceHandler.class).toInstance(viewResourceHandler);
+                bind(ViewContext.class).toInstance(viewInstanceContext);
+            }
+        });
+        return viewInstanceInjector.getInstance(clazz);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/HDFSTest.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/HDFSTest.java b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/HDFSTest.java
new file mode 100644
index 0000000..214c6ef
--- /dev/null
+++ b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/HDFSTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+package org.apache.ambari.view.pig;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.util.Map;
+
+public abstract class HDFSTest extends BasePigTest {
+    protected static MiniDFSCluster hdfsCluster;
+    protected static String hdfsURI;
+
+    @BeforeClass
+    public static void startUp() throws Exception {
+        BasePigTest.startUp(); // super
+        File hdfsDir = new File("./target/PigTest/hdfs/")
+                .getAbsoluteFile();
+        FileUtil.fullyDelete(hdfsDir);
+
+        Configuration conf = new Configuration();
+        conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, hdfsDir.getAbsolutePath());
+
+        MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf);
+        hdfsCluster = builder.build();
+        hdfsURI = hdfsCluster.getURI().toString();
+    }
+
+    @AfterClass
+    public static void shutDown() throws Exception {
+        hdfsCluster.shutdown();
+        hdfsCluster = null;
+    }
+
+    @Override
+    protected void setupProperties(Map<String, String> properties, File baseDir) throws Exception {
+        super.setupProperties(properties, baseDir);
+        properties.put("dataworker.defaultFs", hdfsURI);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb22214/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/test/FileTest.java
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/test/FileTest.java b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/test/FileTest.java
new file mode 100644
index 0000000..1e78ee6
--- /dev/null
+++ b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/test/FileTest.java
@@ -0,0 +1,203 @@
+/**
+ * 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.
+ */
+
+package org.apache.ambari.view.pig.test;
+
+import org.apache.ambari.view.pig.HDFSTest;
+import org.apache.ambari.view.pig.resources.files.FileResource;
+import org.apache.ambari.view.pig.resources.files.FileService;
+import org.apache.ambari.view.pig.utils.FilePaginator;
+import org.json.simple.JSONObject;
+import org.junit.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.net.URI;
+import java.util.UUID;
+
+import static org.easymock.EasyMock.*;
+
+public class FileTest extends HDFSTest {
+    private final static int PAGINATOR_PAGE_SIZE = 4;
+    private FileService fileService;
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        fileService = getService(FileService.class, handler, context);
+        FilePaginator.setPageSize(PAGINATOR_PAGE_SIZE);
+    }
+
+    @BeforeClass
+    public static void startUp() throws Exception {
+        HDFSTest.startUp(); // super
+    }
+
+    @AfterClass
+    public static void shutDown() throws Exception {
+        HDFSTest.shutDown(); // super
+        FileService.setHdfsApi(null); //cleanup API connection
+    }
+
+    private Response doCreateFile() throws IOException, InterruptedException {
+        replay(handler, context);
+        return doCreateFile("luke", "i'm your father");
+    }
+
+    private Response doCreateFile(String name, String content) throws IOException, InterruptedException {
+        return doCreateFile(name, content, "/tmp/");
+    }
+
+    private Response doCreateFile(String name, String content, String filePath) throws IOException, InterruptedException {
+        FileService.FileResourceRequest request = new FileService.FileResourceRequest();
+        request.file = new FileResource();
+        request.file.filePath = filePath + name;
+        request.file.fileContent = content;
+
+        HttpServletResponse resp_obj = createNiceMock(HttpServletResponse.class);
+        resp_obj.setHeader(eq("Location"), anyString());
+
+        UriInfo uriInfo = createNiceMock(UriInfo.class);
+        URI uri = UriBuilder.fromUri("http://host/a/b").build();
+        expect(uriInfo.getAbsolutePath()).andReturn(uri);
+
+        replay(resp_obj, uriInfo);
+        return fileService.createFile(request, resp_obj, uriInfo);
+    }
+
+    @Test
+    public void testCreateFile() throws IOException, InterruptedException {
+        String name = UUID.randomUUID().toString().replaceAll("-", "");
+        Response response = doCreateFile(name, "12323");
+        Assert.assertEquals(204, response.getStatus());
+
+        String name2 = UUID.randomUUID().toString().replaceAll("-", "");
+        Response response2 = doCreateFile(name2, "12323");
+        Assert.assertEquals(204, response2.getStatus());
+    }
+
+    @Test
+    public void testCreateFilePathNotExists() throws IOException, InterruptedException {
+        Response response = doCreateFile("Luke", null, "/non/existent/path/");
+        Assert.assertEquals(204, response.getStatus());  // path created automatically
+
+        Response response2 = doCreateFile("Leia", null, "/tmp/");
+        Assert.assertEquals(204, response2.getStatus());
+
+        Response response3 = doCreateFile("Leia", null, "/tmp/"); // file already exists
+        Assert.assertEquals(400, response3.getStatus());
+    }
+
+    @Test
+    public void testUpdateFileContent() throws Exception {
+        String name = UUID.randomUUID().toString().replaceAll("-", "");
+        String filePath = "/tmp/" + name;
+
+        Response createdFile = doCreateFile(name, "some content");
+        FileService.FileResourceRequest request = new FileService.FileResourceRequest();
+        request.file = new FileResource();
+        request.file.filePath = filePath;
+        request.file.fileContent = "1234567890";  // 10 bytes, 3*(4b page)
+
+        Response response = fileService.updateFile(request, filePath);
+        Assert.assertEquals(204, response.getStatus());
+
+        Response response2 = fileService.getFile(filePath, 0L);
+        Assert.assertEquals(200, response2.getStatus());
+
+        JSONObject obj = ((JSONObject) response2.getEntity());
+        Assert.assertTrue(obj.containsKey("file"));
+        Assert.assertEquals("1234", ((FileResource) obj.get("file")).fileContent);
+    }
+
+    @Test
+    public void testPagination() throws Exception {
+        String name = UUID.randomUUID().toString().replaceAll("-", "");
+        String filePath = "/tmp/" + name;
+
+        doCreateFile(name, "1234567890");
+
+        Response response = fileService.getFile(filePath, 0L);
+        Assert.assertEquals(200, response.getStatus());
+
+        JSONObject obj = ((JSONObject) response.getEntity());
+        Assert.assertTrue(obj.containsKey("file"));
+        Assert.assertEquals("1234", ((FileResource) obj.get("file")).fileContent);
+        Assert.assertEquals(3, ((FileResource) obj.get("file")).pageCount);
+        Assert.assertEquals(0, ((FileResource) obj.get("file")).page);
+        Assert.assertTrue(((FileResource) obj.get("file")).hasNext);
+        Assert.assertEquals(filePath, ((FileResource) obj.get("file")).filePath);
+
+        response = fileService.getFile(filePath, 1L);
+        Assert.assertEquals(200, response.getStatus());
+
+        obj = ((JSONObject) response.getEntity());
+        Assert.assertEquals("5678", ((FileResource) obj.get("file")).fileContent);
+        Assert.assertEquals(1, ((FileResource) obj.get("file")).page);
+        Assert.assertTrue(((FileResource) obj.get("file")).hasNext);
+
+        response = fileService.getFile(filePath, 2L);
+        Assert.assertEquals(200, response.getStatus());
+
+        obj = ((JSONObject) response.getEntity());
+        Assert.assertEquals("90", ((FileResource) obj.get("file")).fileContent);
+        Assert.assertEquals(2, ((FileResource) obj.get("file")).page);
+        Assert.assertFalse(((FileResource) obj.get("file")).hasNext);
+
+        response = fileService.getFile(filePath, 3L);
+        Assert.assertEquals(400, response.getStatus()); //page not found
+    }
+
+    @Test
+    public void testZeroLengthFile() throws Exception {
+        String name = UUID.randomUUID().toString().replaceAll("-", "");
+        String filePath = "/tmp/" + name;
+
+        doCreateFile(name, "");
+
+        Response response = fileService.getFile(filePath, 0L);
+        Assert.assertEquals(200, response.getStatus());
+        JSONObject obj = ((JSONObject) response.getEntity());
+        Assert.assertEquals("", ((FileResource) obj.get("file")).fileContent);
+        Assert.assertEquals(0, ((FileResource) obj.get("file")).page);
+        Assert.assertFalse(((FileResource) obj.get("file")).hasNext);
+    }
+
+    @Test
+    public void testFileNotFound() throws IOException, InterruptedException {
+        Response response1 = fileService.getFile("/tmp/notExistentFile", 2L);
+        Assert.assertEquals(404, response1.getStatus());
+    }
+
+    @Test
+    public void testDeleteFile() throws IOException, InterruptedException {
+        String name = UUID.randomUUID().toString().replaceAll("-", "");
+        String filePath = "/tmp/" + name;
+        Response createdFile = doCreateFile(name, "some content");
+
+        Response response = fileService.deleteFile(filePath);
+        Assert.assertEquals(204, response.getStatus());
+
+        Response response2 = fileService.getFile(filePath, 0L);
+        Assert.assertEquals(404, response2.getStatus());
+    }
+}