You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/01/08 18:45:58 UTC
ambari git commit: AMBARI-9043. Views: Pig, update ember.js version,
minor bugfixes (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 2f32fb329 -> a06b07d43
AMBARI-9043. Views: Pig, update ember.js version, minor bugfixes (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a06b07d4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a06b07d4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a06b07d4
Branch: refs/heads/trunk
Commit: a06b07d43087bc897120ac09f1e200d4d2a0cd19
Parents: 2f32fb3
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Jan 8 17:35:56 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Jan 8 19:41:56 2015 +0200
----------------------------------------------------------------------
.../resources/ui/pig-web/app/assets/index.html | 8 ++
.../ui/pig-web/app/components/codeMirror.js | 6 +-
.../app/controllers/modal/confirmAway.js | 17 +++
.../app/controllers/modal/confirmDelete.js | 12 ++
.../app/controllers/modal/createScript.js | 12 ++
.../pig-web/app/controllers/modal/createUdf.js | 12 ++
.../pig-web/app/controllers/modal/deleteJob.js | 12 ++
.../pig-web/app/controllers/modal/deleteUdf.js | 12 ++
.../pig-web/app/controllers/modal/gotoCopy.js | 12 ++
.../app/controllers/modal/logDownload.js | 7 +
.../pig-web/app/controllers/modal/pigModal.js | 21 +++
.../app/controllers/modal/resultsDownload.js | 7 +
.../resources/ui/pig-web/app/controllers/pig.js | 7 +-
.../ui/pig-web/app/controllers/pigAlert.js | 4 +-
.../ui/pig-web/app/controllers/scriptEdit.js | 141 ++++++++++---------
.../main/resources/ui/pig-web/app/initialize.js | 15 +-
.../ui/pig-web/app/models/pig_script.js | 3 +
.../main/resources/ui/pig-web/app/routes/pig.js | 8 +-
.../ui/pig-web/app/routes/scriptHistory.js | 12 +-
.../pig-web/app/templates/modal/confirmAway.hbs | 5 -
.../app/templates/modal/confirmDelete.hbs | 6 +-
.../app/templates/modal/createScript.hbs | 6 +-
.../pig-web/app/templates/modal/createUdf.hbs | 10 +-
.../pig-web/app/templates/modal/deleteJob.hbs | 6 +-
.../pig-web/app/templates/modal/deleteUdf.hbs | 6 +-
.../ui/pig-web/app/templates/modal/gotoCopy.hbs | 6 +-
.../pig-web/app/templates/modal/logDownload.hbs | 5 +-
.../pig-web/app/templates/modal/modalLayout.hbs | 5 +
.../app/templates/modal/resultsDownload.hbs | 5 +-
.../templates/partials/paginationControls.hbs | 2 +-
.../resources/ui/pig-web/app/templates/pig.hbs | 4 +-
.../ui/pig-web/app/templates/pig/history.hbs | 6 +-
.../ui/pig-web/app/templates/script/edit.hbs | 4 +-
.../ui/pig-web/app/templates/script/job.hbs | 10 +-
.../main/resources/ui/pig-web/app/views/pig.js | 63 ++++-----
.../ui/pig-web/app/views/script/edit.js | 15 --
.../src/main/resources/ui/pig-web/bower.json | 9 +-
37 files changed, 299 insertions(+), 202 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/assets/index.html
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/assets/index.html b/contrib/views/pig/src/main/resources/ui/pig-web/app/assets/index.html
index 7f87394..14f7473 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/assets/index.html
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/assets/index.html
@@ -21,6 +21,14 @@
<meta charset="utf-8">
<title>Pig</title>
<link rel="stylesheet" href="static/stylesheets/app.css">
+ <script>
+ ENV = {
+ I18N_COMPILE_WITHOUT_HANDLEBARS: true,
+ FEATURES:{
+ I18N_TRANSLATE_HELPER_SPAN:false
+ }
+ };
+ </script>
<script src="static/javascripts/vendor.js"></script>
<script src="static/javascripts/app.js"></script>
<script>require('initialize');</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js
index a77fcf6..d0af842 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/codeMirror.js
@@ -30,7 +30,7 @@ App.CodeMirrorComponent = Ember.Component.extend({
return cm.setOption('readOnly',true);
}
var cmElement = $(cm.display.wrapper);
- if (this.get('content.isLoaded')) {
+ if (this.get('content.isFulfilled')) {
cm.setOption('readOnly',false);
cmElement.removeClass('inactive');
cm.setValue((this.get('content.fileContent')||''));
@@ -39,7 +39,7 @@ App.CodeMirrorComponent = Ember.Component.extend({
cm.setOption('readOnly',true);
cmElement.addClass('inactive');
}
- }.observes('codeMirror', 'content.didLoad'),
+ }.observes('codeMirror', 'content.isFulfilled'),
toggleFullScreen:function () {
Em.run.next(this,function () {
this.get('codeMirror').setOption("fullScreen", this.get('fullscreen'));
@@ -71,7 +71,7 @@ App.CodeMirrorComponent = Ember.Component.extend({
var addMargin = $('.CodeMirror-vscrollbar').css('display') === "block";
var margin = $('.CodeMirror-vscrollbar').width();
$('.fullscreen-toggle').css('right',((addMargin)?3+margin:3));
- }
+ };
cm.on('viewportChange',updateToggle);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js
index 58a9fa1..c4a0e88 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmAway.js
@@ -20,6 +20,23 @@ var App = require('app');
App.ConfirmAwayController = Ember.ObjectController.extend({
needs:['pig'],
+ buttons: [
+ {
+ title: Em.I18n.t('common.cancel'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('common.discard_changes'),
+ action: "option",
+ classBindings:[':btn',':btn-danger']
+ },
+ {
+ title: Em.I18n.t('common.save'),
+ action: "ok",
+ classBindings:[':btn',':btn-success']
+ }
+ ],
waitingTransition:null,
actions:{
confirm:function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmDelete.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmDelete.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmDelete.js
index a9bc278..ac0c965 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmDelete.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/confirmDelete.js
@@ -20,6 +20,18 @@ var App = require('app');
App.ConfirmDeleteController = Ember.ObjectController.extend({
needs:['pig'],
+ buttons: [
+ {
+ title: Em.I18n.t('common.cancel'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('common.delete'),
+ action: "ok",
+ classBindings:[':btn',':btn-danger']
+ }
+ ],
actions:{
confirm:function () {
this.get('controllers.pig').send('confirmdelete',this.get('content'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js
index 5bb6008..5cbc311 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createScript.js
@@ -21,6 +21,18 @@ var App = require('app');
App.CreateScriptController = Ember.ObjectController.extend({
needs:['pigScripts'],
filePath:'',
+ buttons: [
+ {
+ title: Em.I18n.t('common.cancel'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('common.create'),
+ action: "ok",
+ classBindings:[':btn',':btn-success','isValid::disabled']
+ }
+ ],
clearFilePath:function () {
this.set('filePath','');
this.set('titleErrorMessage','');
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js
index e878a48..c58ed0a 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/createUdf.js
@@ -20,6 +20,18 @@ var App = require('app');
App.CreateUdfController = Ember.ObjectController.extend({
needs:['pigUdfs'],
+ buttons: [
+ {
+ title: Em.I18n.t('common.cancel'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('common.create'),
+ action: "ok",
+ classBindings:[':btn',':btn-success','isValid::disabled']
+ }
+ ],
actions:{
confirm:function () {
this.get('controllers.pigUdfs').send('createUdf',this.get('content'),this.get('filePath'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteJob.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteJob.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteJob.js
index 83cf447..afdb838 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteJob.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteJob.js
@@ -20,6 +20,18 @@ var App = require('app');
App.DeleteJobController = Ember.ObjectController.extend({
needs:['script'],
+ buttons: [
+ {
+ title: Em.I18n.t('common.cancel'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('common.delete'),
+ action: "ok",
+ classBindings:[':btn',':btn-danger']
+ }
+ ],
actions:{
confirm:function () {
this.get('controllers.script').send('deleteJob',this.get('content'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js
index 3cc5a55..c22d1e5 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/deleteUdf.js
@@ -20,6 +20,18 @@ var App = require('app');
App.DeleteUdfController = Ember.ObjectController.extend({
needs:['pigUdfs'],
+ buttons: [
+ {
+ title: Em.I18n.t('common.cancel'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('common.delete'),
+ action: "ok",
+ classBindings:[':btn',':btn-danger']
+ }
+ ],
actions:{
confirm:function () {
this.get('controllers.pigUdfs').send('deleteUdf',this.get('content'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/gotoCopy.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/gotoCopy.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/gotoCopy.js
index a352184..128c9fc 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/gotoCopy.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/gotoCopy.js
@@ -20,6 +20,18 @@ var App = require('app');
App.GotoCopyController = Ember.ObjectController.extend({
needs:['pig'],
+ buttons: [
+ {
+ title: Em.I18n.t('scripts.modal.continue_editing'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ },
+ {
+ title: Em.I18n.t('scripts.modal.go_to_copy'),
+ action: "ok",
+ classBindings:[':btn',':btn-primary']
+ }
+ ],
actions:{
confirm:function () {
this.transitionToRoute('script.edit',this.get('content.id'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/logDownload.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/logDownload.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/logDownload.js
index 2603439..23ff470 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/logDownload.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/logDownload.js
@@ -19,6 +19,13 @@
var App = require('app');
App.LogDownloadController = Ember.ObjectController.extend(App.FileHandler,{
+ buttons: [
+ {
+ title: Em.I18n.t('common.close'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ }
+ ],
jobLogsLoader:function (output) {
var jobId = this.get('content.id');
var url = ['jobs',jobId, 'results','stderr'].join('/');
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js
index f7d19f3..0f76826 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/pigModal.js
@@ -21,6 +21,27 @@ var App = require('app');
App.PigModalComponent = Ember.Component.extend({
didClose:'removeModal',
size:'',
+ buttons:Em.computed.alias('targetObject.buttons'),
+ isValid:Em.computed.alias('targetObject.isValid'),
+ buttonViews:function () {
+ var data = this.get('buttons') || [];
+ var views = [];
+
+ data.forEach(function (btn) {
+ views.push(Em.Component.extend({
+ tagName:'button',
+ title:btn.title,
+ action:btn.action,
+ click:function () {
+ this.sendAction();
+ },
+ classNameBindings: btn.classBindings,
+ layout:Em.Handlebars.compile('{{view.title}}')
+ }));
+ });
+
+ return views;
+ }.property('buttons'),
large:function () {
return this.get('size') =='lg';
}.property('size'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/resultsDownload.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/resultsDownload.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/resultsDownload.js
index 81b4a50..b14570a 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/resultsDownload.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/modal/resultsDownload.js
@@ -19,6 +19,13 @@
var App = require('app');
App.ResultsDownloadController = Ember.ObjectController.extend(App.FileHandler,{
+ buttons: [
+ {
+ title: Em.I18n.t('common.close'),
+ action: "cancel",
+ classBindings:[':btn',':btn-default']
+ }
+ ],
jobResultsLoader:function (output) {
var jobId = this.get('content.id');
var url = ['jobs',jobId, 'results','stdout'].join('/');
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
index 33bfed4..8cde338 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pig.js
@@ -21,9 +21,14 @@ var App = require('app');
App.PigController = Em.ArrayController.extend({
needs:['scriptEdit'],
category: 'scripts',
+ navs: [
+ {name:'scripts',url:'pig',label: Em.I18n.t('scripts.scripts'),icon:'fa-file-code-o'},
+ {name:'udfs',url:'pig.udfs',label:Em.I18n.t('udfs.udfs'),icon:'fa-plug'},
+ {name:'history',url:'pig.history',label:Em.I18n.t('common.history'),icon:'fa-clock-o'}
+ ],
actions:{
closeScript:function () {
- this.transitionToRoute('pig.scripts');
+ this.transitionToRoute('pig');
},
saveScript: function (script,onSuccessCallback) {
var onSuccess = onSuccessCallback || function(model){
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
index c95921c..27685f2 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/pigAlert.js
@@ -19,11 +19,11 @@
var App = require('app');
App.PigAlertController = Ember.ArrayController.extend({
- content:Ember.A(),
+ model:[],
needs: ['pigErrorLog'],
actions:{
removeAlertObject:function (alert) {
- this.content.removeObject(alert);
+ this.get('content').removeObject(alert);
},
showErrorLog:function (context) {
errorLogController = this.get('controllers.pigErrorLog');
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
index 912a46e..5ef95ad 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/scriptEdit.js
@@ -39,7 +39,7 @@ App.ScriptEditController = Em.ObjectController.extend({
if (editorContent) {
var match_var = editorContent.match(/\%\w+\%/g);
if (match_var) {
- var oldParams = controller.pigParams;
+ var oldParams = controller.get('pigParams');
controller.set('pigParams',[]);
match_var.forEach(function (param) {
var suchParams = controller.pigParams.filterProperty('param',param);
@@ -84,15 +84,13 @@ App.ScriptEditController = Em.ObjectController.extend({
this.set('isRenaming',false);
}
},
- addArgument:function () {
- var arg = this.get('tmpArgument');
+ addArgument:function (arg) {
+ var settled = this.get('content.argumentsArray');
if (!arg) {
return false;
}
- var pull = this.get('content.argumentsArray');
- if (Em.$.inArray(arg,pull)<0) {
- pull.pushObject(arg);
- this.set('content.argumentsArray',pull);
+ if (!settled.contains(arg)) {
+ settled.pushObject(arg);
this.set('tmpArgument','');
} else {
this.send('showAlert', {'message': Em.I18n.t('scripts.alert.arg_present'), status:'info'});
@@ -103,19 +101,15 @@ App.ScriptEditController = Em.ObjectController.extend({
this.set('content.argumentsArray',removed);
},
execute: function (script, operation) {
- var executeMethod = {
- 'execute':this.prepareExecute,
- 'explain':this.prepareExplain,
- 'syntax_check':this.prepareSyntaxCheck
- };
-
this.set('isExec',true);
return Ember.RSVP.resolve(script.get('pigScript'))
.then(function (file) {
return Ember.RSVP.all([file.save(),script.save()]);
})
- .then(executeMethod[operation].bind(this))
+ .then(function (data) {
+ return this.prepareJob(operation,data);
+ }.bind(this))
.then(this.executeSuccess.bind(this), this.executeError.bind(this))
.finally(Em.run.bind(this,this.set,'isExec',false));
},
@@ -136,73 +130,84 @@ App.ScriptEditController = Em.ObjectController.extend({
this.send('showAlert', {message:Em.I18n.t('job.alert.start_filed'),status:'error',trace:trace});
},
- prepareExecute:function (data) {
- var file = data[0], script = data[1], pigParams = this.get('pigParams') || [], fileContent = file.get('fileContent');
-
- pigParams.forEach(function (param) {
- var rgParam = new RegExp(param.param,'g');
- fileContent = fileContent.replace(rgParam,param.value);
- });
-
- var job = this.store.createRecord('job',{
- scriptId: script.get('id'),
- templetonArguments: script.get('templetonArguments'),
- title: script.get('title'),
- forcedContent: (pigParams.length > 0)? fileContent:null,
- pigScript: (pigParams.length == 0)?file:null
- });
-
- return job.save();
- },
- prepareExplain:function (data) {
- var file = data[0], script = data[1], pigParams = this.get('pigParams') || [], fileContent = file.get('fileContent');
+ prepareJob:function (type, data) {
+ var job, promise,
+ exc = 'execute' == type,
+ exp = 'explain' == type,
+ chk = 'syntax_check' == type,
+ file = data[0],
+ script = data[1],
+ pigParams = this.get('pigParams') || [],
+ fileContent = file.get('fileContent'),
+ args = script.get('templetonArguments'),
+ title = script.get('title'),
+ hasParams = pigParams.length > 0;
pigParams.forEach(function (param) {
var rgParam = new RegExp(param.param,'g');
fileContent = fileContent.replace(rgParam,param.value);
});
- var job = this.store.createRecord('job',{
- scriptId: script.get('id'),
- templetonArguments: '',
- title: 'Explain: "' + script.get('title') + '"',
- jobType: 'explain',
- sourceFileContent: (pigParams.length > 0)? fileContent:null,
- sourceFile: (pigParams.length == 0)?file.get('id'):null,
- forcedContent: 'explain -script ${sourceFile}'
+ job = this.store.createRecord('job', {
+
+ /**
+ * Link to script.
+ * @type {String}
+ */
+ scriptId:script.get('id'),
+
+ /**
+ * Add '-check' argument for syntax check and remove all for explain.
+ * @type {String}
+ */
+ templetonArguments:(exc)?args:(chk)?(!args.match(/-check/g))?args+(args?"\t":"")+'-check':args:'',
+
+ /**
+ * Modify title for syntax check and operations.
+ * @type {String}
+ */
+ title:(exc)?title:(chk)?'Syntax check: "%@"'.fmt(title):'Explain: "%@"'.fmt(title),
+
+ /**
+ * If the script has parameters, set this value to script with replaced ones.
+ * And if operations is explain, set it to reference to sourceFile.
+ * @type {String}
+ */
+ forcedContent:(exp)?'explain -script ${sourceFile}':(hasParams)?fileContent:null,
+
+ /**
+ * If other, than execute, need to set job type.
+ * @type {String}
+ */
+ jobType:(!exc)?type:null,
+
+ /**
+ * If execute of syntax_check without params, just set App.File instance.
+ * @type {App.File}
+ */
+ pigScript:(!exp && !hasParams)?file:null,
+
+ /**
+ * For explain job type need sourceFile ...
+ * @type {String}
+ */
+ sourceFile:(exp && !hasParams)?file.get('id'):null,
+
+ /**
+ * ... or sourceFileContent if script has parameters.
+ * @type {String}
+ */
+ sourceFileContent:(exp && hasParams)?fileContent:null
});
- return job.save();
- },
- prepareSyntaxCheck:function (data) {
- var file = data[0], script = data[1], pigParams = this.get('pigParams') || [], fileContent = file.get('fileContent'), args = script.get('templetonArguments');
-
- pigParams.forEach(function (param) {
- var rgParam = new RegExp(param.param,'g');
- fileContent = fileContent.replace(rgParam,param.value);
- });
+ promise = job.save();
- var job = this.store.createRecord('job',{
- scriptId: script.get('id'),
- templetonArguments: (!args.match(/-check/g))?args+(args?"\t":"")+'-check':args,
- title: 'Syntax check: "' + script.get('title') + '"',
- jobType: 'syntax_check',
- forcedContent: (pigParams.length > 0)? fileContent:null,
- pigScript: (pigParams.length == 0)?file:null
- });
+ Em.run.next(promise, promise.catch, Em.run.bind(job,job.deleteRecord));
- return job.save();
+ return promise;
},
/**
- * Is script is in error state.
- * @return {boolean}
- */
- scriptError:function () {
- return this.get('content.isError');
- }.property('content.isError'),
-
- /**
* available UDFs
* @return {App.Udf} promise
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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 8adf505..f38b05e 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
@@ -38,11 +38,24 @@ App.JobAdapter = App.ApplicationAdapter.extend({
}
});
+App.JobSerializer = DS.RESTSerializer.extend({
+ normalizeHash: {
+ jobs: function(hash) {
+ delete hash.inProgress;
+ return hash;
+ },
+ job: function(hash) {
+ delete hash.inProgress;
+ return hash;
+ }
+ }
+});
+
App.FileSerializer = DS.RESTSerializer.extend({
primaryKey:'filePath'
});
-App.IsodateTransform = DS.Transform.extend({
+App.IsodateTransform = DS.Transform.extend({
deserialize: function (serialized) {
if (serialized) {
return moment.unix(serialized).toDate();
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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 c779264..2af788e 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
@@ -23,6 +23,9 @@ App.Script = DS.Model.extend({
pigScript:DS.belongsTo('file', { async: true }),
dateCreated:DS.attr('isodate', { defaultValue: moment()}),
templetonArguments:DS.attr('string'),
+ pythonScript:DS.attr('string'),
+ owner:DS.attr('string'),
+ opened:DS.attr('string'),
// nav item identifier
name:function (q){
return this.get('title')+this.get('id');
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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 48fab5a..479f57a 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/pig.js
@@ -31,15 +31,15 @@ App.PigRoute = Em.Route.extend({
},
actions: {
gotoSection: function(nav) {
- var location = (nav.hasOwnProperty('url'))?[nav.url]:['pig.scriptEdit',nav.get('id')];
- this.transitionTo.apply(this,location);
+ var location = (nav.hasOwnProperty('url'))?nav.url:this.routeName;
+ this.transitionTo(location);
},
showAlert:function (alert) {
var pigAlert = this.controllerFor('pigAlert');
- return pigAlert.content.pushObject(Em.Object.create(alert));
+ return pigAlert.get('content').pushObject(Em.Object.create(alert));
},
openModal: function(modal,content) {
- this.controllerFor(modal).set('content', content);
+ this.controllerFor(modal).set('model', content);
return this.render(['modal',modal].join('/'), {
into: 'pig',
outlet: 'modal',
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index 650bfb9..cfaef5c 100644
--- 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
@@ -22,15 +22,11 @@ App.ScriptHistoryRoute = Em.Route.extend({
enter: function() {
this.controllerFor('script').set('activeTab','history');
},
+ beforeModel:function (t) {
+ var asId = t.params[t.targetName].hasOwnProperty('script_id') && t.params[t.targetName]['script_id'];
+ this.controllerFor('pig').set('activeScriptId',asId);
+ },
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/a06b07d4/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
index 3c12506..b587875 100644
--- 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
@@ -24,9 +24,4 @@
<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/a06b07d4/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
index b71854f..b0e1997 100644
--- 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
@@ -22,10 +22,6 @@
<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>
+ <p>{{t 'scripts.modal.confirm_delete_massage' titleBinding="content.title"}}</p>
</div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index b80473e..c14927e 100644
--- 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
@@ -18,7 +18,7 @@
{{#pig-modal ok='confirm' close='cancel'}}
<div class="modal-header">
- <button type="button" class="close" {{action "cancel" target="view"}} aria-hidden="true">×</button>
+ <button type="button" class="close" {{action "cancel"}} data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">{{t 'scripts.modal.create_script'}}</h4>
</div>
<div class="modal-body">
@@ -35,8 +35,4 @@
<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="content.isBlankTitle:disabled :btn :btn-success"}} >{{t 'common.create'}}</button>
- </div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index a72c66a..9fe3aa5 100644
--- 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
@@ -18,7 +18,7 @@
{{#pig-modal ok='confirm' close='cancel'}}
<div class="modal-header">
- <button type="button" class="close" {{action "cancel" target="view"}} aria-hidden="true">×</button>
+ <button type="button" class="close" {{action "cancel"}} data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">{{t 'udfs.modal.create_udf'}}</h4>
</div>
<div class="modal-body">
@@ -26,13 +26,9 @@
<label>{{t 'common.name'}}</label>
{{input class="form-control" placeholderTranslation="udfs.modal.udf_name" valueBinding="content.name"}}
</div>
- <div class="form-group has-feedback">
+ <div class="form-group">
<label>{{t 'common.path'}}</label>
- {{path-input class="form-control isLoading" placeholderTranslation="udfs.modal.hdfs_path" valueBinding="content.path" storeBinding="content.store"}}
+ {{path-input class="form-control" placeholderTranslation="udfs.modal.hdfs_path" valueBinding="content.path" storeBinding="content.store"}}
</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 isValid::disabled"}}>{{t 'common.create'}}</button>
- </div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index 0f4c74f..f0af814 100644
--- 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
@@ -22,10 +22,6 @@
<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>
+ <p>{{t 'job.modal.confirm_delete_massage' titleBinding="content.title"}}</p>
</div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs
index 39f0e68..aa5a157 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/deleteUdf.hbs
@@ -22,10 +22,6 @@
<h4 class="modal-title">{{t 'scripts.modal.confirm_delete'}}</h4>
</div>
<div class="modal-body">
- {{t 'udfs.modal.delete_udf' titleBinding="content.name" 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>
+ <p>{{t 'udfs.modal.delete_udf' titleBinding="content.name"}}</p>
</div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index 1d4fcdb..4072818 100644
--- 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
@@ -22,10 +22,6 @@
<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>
+ <p>{{t 'scripts.modal.copy_created_massage' titleBinding="content.title"}}</p>
</div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/logDownload.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/logDownload.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/logDownload.hbs
index ed47d62..4526137 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/logDownload.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/logDownload.hbs
@@ -26,7 +26,7 @@
</div>
<div class="modal-body">
{{#if jobLogsLoader.isPending}}
- <pre><div class="spinner-sm"></div></pre>
+ <div class="spinner-sm"></div>
{{else}}
{{#if jobLogsLoader.isFulfilled}}
<pre>{{jobLogsLoader.content.fileContent}}</pre>
@@ -36,7 +36,4 @@
{{/if}}
{{/if}}
</div>
- <div class="modal-footer">
- <button type="button" {{action "cancel" target="view"}} class="btn btn-default" data-dismiss="modal">{{t 'common.close'}} </button>
- </div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/modalLayout.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/modalLayout.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/modalLayout.hbs
index 0aca82f..d61b779 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/modalLayout.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/modalLayout.hbs
@@ -20,6 +20,11 @@
<div {{bind-attr class=":modal-dialog large:modal-lg small:modal-sm" }}>
<div class="modal-content">
{{yield}}
+ <div class="modal-footer">
+ {{#each buttonViews}}
+ {{view this isValidBinding='view.isValid'}}
+ {{/each}}
+ </div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/resultsDownload.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/resultsDownload.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/resultsDownload.hbs
index 5de0cfa..6a41072 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/resultsDownload.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/modal/resultsDownload.hbs
@@ -26,7 +26,7 @@
</div>
<div class="modal-body">
{{#if jobResultsLoader.isPending}}
- <pre><div class="spinner-sm"></div></pre>
+ <div class="spinner-sm"></div>
{{else}}
{{#if jobResultsLoader.isFulfilled}}
<pre>{{jobResultsLoader.content.fileContent}}</pre>
@@ -36,7 +36,4 @@
{{/if}}
{{/if}}
</div>
- <div class="modal-footer">
- <button type="button" {{action "cancel" target="view"}} class="btn btn-default" data-dismiss="modal">{{t 'common.close'}}</button>
- </div>
{{/pig-modal}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/partials/paginationControls.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/partials/paginationControls.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/partials/paginationControls.hbs
index 5543b94..4b7df80 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/partials/paginationControls.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/partials/paginationControls.hbs
@@ -19,7 +19,7 @@
<div class="pagination-block">
<div class="items-count">
<label >{{t 'common.show'}}
- {{view Ember.Select content=perPageOptions class="form-control" value=perPage}}
+ {{view "select" content=perPageOptions class="form-control" value=perPage}}
</label>
</div>
<div class="items-info">
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs
index d70ac7e..ad08496 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig.hbs
@@ -21,11 +21,11 @@
<div class="col-md-3 navigation">
<div class="well">
- {{view view.navItemsView}}
+ {{view 'nav-items' content=navs}}
<div class="nav-script-wrap">
<div class=" nav-script" >
<div>
- <button type="button" class="close_script" tabindex="-1" {{action closeScript}}>
+ <button type="button" class="close_script" tabindex="-1" {{action 'closeScript'}}>
<i class="fa fa-times"></i>
</button>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/history.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/history.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/history.hbs
index 7cba9d5..2f3fdbe 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/history.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/pig/history.hbs
@@ -21,7 +21,7 @@
<h3 class="pull-left"> {{t 'common.history'}}</h3>
</div>
<table class="table table-striped ">
- <thead>
+ <thead>
<tr class="label-row">
<th class="first">{{t 'common.date'}}</th>
<th>{{t 'scripts.script'}}</th>
@@ -30,12 +30,12 @@
<th>{{t 'common.actions'}}</th>
</tr>
</thead>
- <tbody>
+ <tbody>
{{#each paginatedContent}}
<tr>
<td>{{#link-to 'script.job' this.id }} {{showDate this.dateStarted 'YYYY-MM-DD HH:mm'}} {{/link-to}}</td>
<td>
- {{#view 'view.scriptLink' scriptId=this.scriptId allIds=controller.scriptIds}}{{this.title}}{{/view}}
+ {{#view view.scriptLink scriptId=this.scriptId allIds=controller.scriptIds}}{{this.title}}{{/view}}
</td>
<td>
<h4>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs
index 767e2bc..854c751 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/edit.hbs
@@ -17,7 +17,7 @@
}}
<div class="edit-script">
- <div {{bind-attr class=":panel :panel-editscript fullscreen:fullscreen scriptError:panel-danger:panel-default"}} >
+ <div {{bind-attr class=":panel :panel-editscript fullscreen:fullscreen content.isError:panel-danger:panel-default"}} >
<div class="panel-heading">
{{outlet nav}}
@@ -137,7 +137,7 @@
<div class="input-group">
{{input action="addArgument" placeholderTranslation="editor.pig_argument" class="form-control" valueBinding='tmpArgument'}}
<span class="input-group-btn">
- <button class="btn btn-default pull-right" {{action 'addArgument'}} ><i class="fa fa-plus"></i> {{t 'common.add'}}</button>
+ <button class="btn btn-default pull-right" {{action 'addArgument' tmpArgument}} ><i class="fa fa-plus"></i> {{t 'common.add'}}</button>
</span>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
index e184e09..b80a7c4 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/script/job.hbs
@@ -63,10 +63,10 @@
{{/if}}
</h4>
</div>
- {{#view "view.collapsePanel" id="scriptResults" class="panel-collapse collapse in" }}
+ {{#view view.collapsePanel id="scriptResults" class="panel-collapse collapse in" }}
<div class="panel-body">
{{#if jobResults.isPending}}
- <pre><div class="spinner-sm"></div></pre>
+ <div class="spinner-sm"></div>
{{else}}
{{#if jobResults.isFulfilled }}
<pre>{{jobResults.content.fileContent}}</pre>
@@ -91,10 +91,10 @@
{{/if}}
</h4>
</div>
- {{#view "view.collapsePanel" id="scriptLogs" class="panel-collapse collapse"}}
+ {{#view view.collapsePanel id="scriptLogs" class="panel-collapse collapse"}}
<div class="panel-body">
{{#if jobLogs.isPending}}
- <pre><div class="spinner-sm"></div></pre>
+ <div class="spinner-sm"></div>
{{else}}
{{#if jobLogs.isFulfilled}}
<pre>{{jobLogs.content.fileContent}}</pre>
@@ -117,7 +117,7 @@
</a>
</h4>
</div>
- {{#view "view.collapsePanel" id="scriptDetails" class="panel-collapse collapse" }}
+ {{#view view.collapsePanel id="scriptDetails" class="panel-collapse collapse" }}
<div {{bind-attr class=":panel-body :body-title :body-title-contents fullscreen:fullscreen "}} >
{{t 'job.script_contents'}}:
<div class="fullscreen-toggle pull-right" {{action 'fullscreen'}} data-toggle="tooltip" data-placement="bottom" {{translateAttr title="editor.toggle_fullscreen"}}><i {{bind-attr class=":fa :fa-lg fullscreen:fa-compress:fa-expand"}} ></i></div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index a23264a..d97cae9 100644
--- 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
@@ -22,7 +22,7 @@ App.PigView = Em.View.extend({
hideScript:true,
selectedBinding: 'controller.category',
navs: [
- {name:'scripts',url:'pig.scripts',label: Em.I18n.t('scripts.scripts'),icon:'fa-file-code-o'},
+ {name:'scripts',url:'pig',label: Em.I18n.t('scripts.scripts'),icon:'fa-file-code-o'},
{name:'udfs',url:'pig.udfs',label:Em.I18n.t('udfs.udfs'),icon:'fa-plug'},
{name:'history',url:'pig.history',label:Em.I18n.t('common.history'),icon:'fa-clock-o'}
],
@@ -35,42 +35,33 @@ App.PigView = Em.View.extend({
Em.run.later(this, function (show) {
this.$('.nav-script-wrap').toggleClass('in',show);
},!!this.get('controller.activeScript'),250);
- }.observes('controller.activeScript'),
+ }.observes('controller.activeScript')
+});
- navItemsView : Ember.CollectionView.extend({
- tagName: 'div',
- classNames:['list-group', 'nav-main'],
- content: function () {
- return this.get('parentView.navs')
- }.property('parentView.navs'),
- mouseEnter:function (argument) {
- this.get('parentView').$('.nav-script-wrap').addClass('reveal');
- },
- mouseLeave:function (argument) {
- this.get('parentView').$('.nav-script-wrap').removeClass('reveal');
+App.NavItemsView = Ember.CollectionView.extend({
+ tagName: 'div',
+ classNames:['list-group', 'nav-main'],
+ content: [],
+ mouseEnter:function (argument) {
+ this.get('parentView').$('.nav-script-wrap').addClass('reveal');
+ },
+ mouseLeave:function (argument) {
+ this.get('parentView').$('.nav-script-wrap').removeClass('reveal');
+ },
+ itemViewClass: Ember.Component.extend({
+ tagName: 'a',
+ layout: Em.Handlebars.compile(
+ '<i class="fa fa-fw fa-2x {{unbound view.content.icon}}"></i> '+
+ '<span>{{view.content.label}}</span>'
+ ),
+ classNames: ['list-group-item pig-nav-item text-left'],
+ classNameBindings: ['isActive:active'],
+ action: 'gotoSection',
+ click: function() {
+ this.sendAction('action',this.get('content'));
},
- itemViewClass: Ember.View.extend(Ember.ViewTargetActionSupport,{
- tagName: 'a',
- template: Em.Handlebars.compile(
- '<i class="fa fa-fw fa-2x {{unbound view.content.icon}}"></i> '+
- '<span>{{view.content.label}}</span>'
- ),
- classNames: ['list-group-item pig-nav-item text-left'],
- 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'),
-
- hideLabel:Em.computed.bool('controller.activeScript')
- })
+ 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/a06b07d4/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js
index 97afe71..a1a9601 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/views/script/edit.js
@@ -41,21 +41,6 @@ App.ScriptEditView = Em.View.extend({
this.set('controller.content.pigScript.fileContent',registered);
}
},
- 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');
- }
- }
- }),
focusInput:Em.TextField.extend({
becomeFocused: function () {
this.$().focus().val(this.$().val());
http://git-wip-us.apache.org/repos/asf/ambari/blob/a06b07d4/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
index 91d8402..03ad4bb 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/bower.json
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/bower.json
@@ -3,13 +3,13 @@
"version": "0.0.1",
"main": "public/app.js",
"dependencies": {
- "ember": "1.6.0",
- "ember-data": "1.0.0-beta.7",
+ "ember": "1.8.1",
+ "ember-data": "1.0.0-beta.12",
"handlebars": "~1.3.0",
"bootstrap": "3.1.x",
"codemirror": ">=3.2",
"moment": "~2.8.1",
- "ember-i18n": "~1.6.0",
+ "ember-i18n": "2.9.x",
"font-awesome": "4.2",
"file-saver": "*",
"bootstrap3-typeahead": "~3.0.3"
@@ -35,9 +35,6 @@
"cldr": {
"main": "plurals.js"
},
- "ember-i18n": {
- "scripts": []
- },
"file-saver": {
"main": "FileSaver.js"
}