You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by pa...@apache.org on 2017/02/08 09:22:10 UTC
ambari git commit: AMBARI-19883. Hive2 view UDF tab is blank always
(pallavkul)
Repository: ambari
Updated Branches:
refs/heads/trunk 1e583a8f4 -> 2720b5c1f
AMBARI-19883. Hive2 view UDF tab is blank always (pallavkul)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2720b5c1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2720b5c1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2720b5c1
Branch: refs/heads/trunk
Commit: 2720b5c1f0deed57e294dbf06140eb40fdcf31b8
Parents: 1e583a8
Author: pallavkul <pa...@gmail.com>
Authored: Wed Feb 8 14:51:25 2017 +0530
Committer: pallavkul <pa...@gmail.com>
Committed: Wed Feb 8 14:51:25 2017 +0530
----------------------------------------------------------------------
.../resources/ui/app/adapters/file-resource.js | 26 +++
.../src/main/resources/ui/app/adapters/udf.js | 39 +++++
.../ui/app/components/fileresource-item.js | 73 +++++++++
.../resources/ui/app/components/udf-edit.js | 40 +++++
.../resources/ui/app/components/udf-item.js | 154 ++++++++++++++++++
.../main/resources/ui/app/components/udf-new.js | 41 +++++
.../resources/ui/app/controllers/udfs/new.js | 23 +++
.../resources/ui/app/models/file-resource.js | 25 +++
.../src/main/resources/ui/app/models/udf.js | 26 +++
.../hive20/src/main/resources/ui/app/router.js | 7 +-
.../resources/ui/app/routes/queries/query.js | 27 +++-
.../src/main/resources/ui/app/routes/udfs.js | 50 ++++++
.../main/resources/ui/app/routes/udfs/new.js | 161 +++++++++++++++++++
.../resources/ui/app/services/file-resource.js | 33 ++++
.../src/main/resources/ui/app/services/udf.js | 76 +++++++++
.../src/main/resources/ui/app/styles/app.scss | 65 ++++++++
.../templates/components/fileresource-item.hbs | 32 ++++
.../ui/app/templates/components/udf-edit.hbs | 67 ++++++++
.../ui/app/templates/components/udf-item.hbs | 76 +++++++++
.../ui/app/templates/components/udf-new.hbs | 61 +++++++
.../ui/app/templates/queries/query.hbs | 16 ++
.../main/resources/ui/app/templates/udfs.hbs | 28 ++++
.../resources/ui/app/templates/udfs/new.hbs | 30 ++++
23 files changed, 1174 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/adapters/file-resource.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/adapters/file-resource.js b/contrib/views/hive20/src/main/resources/ui/app/adapters/file-resource.js
new file mode 100644
index 0000000..a25adc7
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/adapters/file-resource.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import ApplicationAdapter from './application';
+
+export default ApplicationAdapter.extend({
+ buildURL(){
+ return this._super(...arguments).replace('/resources','');
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/adapters/udf.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/adapters/udf.js b/contrib/views/hive20/src/main/resources/ui/app/adapters/udf.js
new file mode 100644
index 0000000..c929de7
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/adapters/udf.js
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import ApplicationAdapter from './application';
+
+export default ApplicationAdapter.extend({
+ namespace: Ember.computed(function() {
+ return this._super(...arguments).replace('/resources','');
+ }),
+
+ buildURL(){
+ return this._super(...arguments).replace('/resources','');
+ },
+
+ fileResourceURL(){
+ this.buildURL()+ '/fileResources';
+ },
+
+ udfURL(){
+ this.buildURL()+ '/udfs';
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/components/fileresource-item.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/fileresource-item.js b/contrib/views/hive20/src/main/resources/ui/app/components/fileresource-item.js
new file mode 100644
index 0000000..12cfb5b
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/fileresource-item.js
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+
+ tagName: '',
+ expanded: false,
+ fileResourceId: null,
+ selectedUdfList:[],
+
+ store: Ember.inject.service(),
+
+ actions: {
+ expandFileResource(fileResourceId) {
+
+ console.log('fileResourceId', fileResourceId);
+
+ this.set('fileResourceId', fileResourceId);
+
+ var self = this;
+ if(this.get('expanded')) {
+ this.set('expanded', false);
+ } else {
+ this.set('expanded', true);
+
+ let allUdfs = this.get('store').findAll('udf').then((data) => {
+ let selectedUdfList = [];
+ data.forEach(x => {
+ let localFileResource = {
+ 'id': x.get('id'),
+ 'name': x.get('name'),
+ 'classname': x.get('classname'),
+ 'fileResource': x.get('fileResource'),
+ 'owner': x.get('owner')
+ };
+ selectedUdfList.push(localFileResource);
+ });
+
+ let selectedUdfs = selectedUdfList.filterBy('fileResource', fileResourceId);
+
+ this.set('selectedUdfList', selectedUdfs);
+ });
+ }
+
+
+
+ },
+
+ createQuery(udfName, udfClassname, fileResourceName, fileResourcePath){
+ this.sendAction('createQuery', udfName, udfClassname, fileResourceName, fileResourcePath);
+ }
+
+
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/components/udf-edit.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/udf-edit.js b/contrib/views/hive20/src/main/resources/ui/app/components/udf-edit.js
new file mode 100644
index 0000000..8fac561
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/udf-edit.js
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+
+
+ tagName: 'tr',
+ actions:{
+ handleResourceChange(filter){
+ this.sendAction('handleResourceChange', filter);
+ },
+
+ saveUDf(name, classname, udfid, udfFileResourceName, udfFileResourcePath){
+ this.sendAction('saveUDf', name, classname, udfid, udfFileResourceName, udfFileResourcePath);
+ },
+
+ cancelEditUdf(){
+ this.sendAction('cancelEditUdf');
+ }
+
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/components/udf-item.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/udf-item.js b/contrib/views/hive20/src/main/resources/ui/app/components/udf-item.js
new file mode 100644
index 0000000..9e11550
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/udf-item.js
@@ -0,0 +1,154 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+
+ store: Ember.inject.service(),
+
+ udfService: Ember.inject.service('udf'),
+
+ tagName: '',
+ expanded: false,
+ expandedEdit: false,
+ showDeleteUdfModal: false,
+ expandedValue: null,
+ udfId: null,
+ fileResourceList:[],
+ selectedFileResource: null,
+ isAddingNewFileResource: false,
+
+ actions: {
+ toggleExpandUdf(fileResourceId) {
+
+ var self = this;
+ if(this.get('expanded')) {
+ this.set('expanded', false);
+ } else {
+ this.set('expanded', true);
+ this.set('valueLoading', true);
+
+ this.get('store').find('fileResource', fileResourceId).then((data) => {
+ this.set('udfFileResourceName', data.get('name'));
+ this.set('udfFileResourcePath', data.get('path'));
+ });
+ }
+ },
+
+
+ showEditUdf(udfId, fileResourceId){
+
+ if(this.get('expandedEdit')) {
+ this.set('expandedEdit', false);
+ } else {
+ this.set('expandedEdit', true);
+ this.set('valueLoading', true);
+
+ this.get('store').find('fileResource', fileResourceId).then((data) => {
+ this.set('udfFileResourceName', data.get('name'));
+ this.set('udfFileResourcePath', data.get('path'));
+ });
+
+
+ this.send('setFileResource', fileResourceId);
+
+ }
+ },
+
+ cancelEditUdf(){
+ this.set('expandedEdit', false);
+ },
+
+ saveUDf(name, classname, udfid, udfFileResourceName, udfFileResourcePath){
+
+ let self = this;
+
+ if(!Ember.isEmpty(this.get('selectedFileResource'))){
+ this.get('store').findRecord('udf', udfid).then(function(resultUdf) {
+ resultUdf.set('name', name);
+ resultUdf.set('classname', classname);
+ resultUdf.set('fileResource', self.get('selectedFileResource').id);
+ resultUdf.save();
+ self.set('expandedEdit', false);
+ });
+ } else {
+
+ let resourcePayload = {"name":udfFileResourceName,"path":udfFileResourcePath};
+
+ this.get('udfService').savefileResource(resourcePayload)
+ .then((data) => {
+ console.log('fileResource is', data.fileResource.id);
+ self.get('store').findRecord('udf', udfid).then(function(resultUdf) {
+
+ resultUdf.set('name', name);
+ resultUdf.set('classname', classname);
+ resultUdf.set('fileResource', data.fileResource.id);
+ resultUdf.save();
+ self.set('expandedEdit', false);
+ });
+ }, (error) => {
+ console.log("Error encountered", error);
+ });
+ }
+
+ this.set('isAddingNewFileResource', false);
+
+ },
+
+ showRemoveUdfModal(udfId){
+ console.log('udfId',udfId);
+ this.set('showDeleteUdfModal', true);
+ this.set('udfId', udfId);
+ },
+
+ removeUdf(){
+ let self = this;
+ this.get('store').find('udf', this.get('udfId')).then(function(resultUdf) {
+ resultUdf.destroyRecord().then(function(data) {
+ self.send('cancelUdf');
+ self.sendAction('refreshUdfList');
+ }, function(response) {
+ console.log('UDF NOT deleted');
+ });
+ return false;
+ });
+ },
+
+ cancelUdf(){
+ this.set('showDeleteUdfModal', false);
+ },
+
+ handleResourceChange(filter){
+ if(filter.action == "addNewFileResource"){
+ this.get('controller').set('isAddingNewFileResource', true);
+ this.set('selectedFileResource',null);
+ }else {
+ this.set('selectedFileResource',filter);
+ this.get('controller').set('isAddingNewFileResource', false);
+ }
+ },
+
+ setFileResource(fileResourceId){
+ let localSelectedFileResource = this.get('fileResourceList').filterBy('id', fileResourceId);
+ this.set('selectedFileResource',localSelectedFileResource[0]);
+ }
+
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/components/udf-new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/udf-new.js b/contrib/views/hive20/src/main/resources/ui/app/components/udf-new.js
new file mode 100644
index 0000000..285ef07
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/udf-new.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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+
+ selectedFileResource:null,
+ isAddingNewFileResource:false,
+
+ actions:{
+ handleFileResourceChange(filter){
+ this.sendAction('handleFileResourceChange', filter)
+ },
+
+ cancelSaveUDf(){
+ this.sendAction('cancelSaveUDf');
+ },
+
+ saveUDf(){
+ this.sendAction('saveUDf', this.get('resourceName'),this.get('resourcePath'), this.get('udfName'),this.get('udfClassName') );
+ }
+
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/controllers/udfs/new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/udfs/new.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/udfs/new.js
new file mode 100644
index 0000000..32d05d1
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/udfs/new.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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Controller.extend({
+});
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/models/file-resource.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/file-resource.js b/contrib/views/hive20/src/main/resources/ui/app/models/file-resource.js
new file mode 100644
index 0000000..47f4911
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/file-resource.js
@@ -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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr(),
+ path: DS.attr(),
+ owner: DS.attr()
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/models/udf.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/udf.js b/contrib/views/hive20/src/main/resources/ui/app/models/udf.js
new file mode 100644
index 0000000..b9f7713
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/udf.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ classname: DS.attr('string'),
+ fileResource: DS.attr('string'),
+ owner: DS.attr('string')
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/router.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/router.js b/contrib/views/hive20/src/main/resources/ui/app/router.js
index 52361ff..c781a34 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/router.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/router.js
@@ -28,7 +28,12 @@ Router.map(function() {
this.route('service-check');
this.route('jobs');
- this.route('udfs');
+ this.route('udfs', function() {
+ this.route('new');
+ this.route('udf', {path: '/:udfId'}, function() {
+ });
+ });
+
this.route('settings');
this.route('savedqueries');
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
index b6434c0..7d9a7c3 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
@@ -34,6 +34,24 @@ export default Ember.Route.extend({
if (dbmodel.get('length') > 0) {
this.selectDatabase(dbmodel);
}
+
+ this.store.findAll('file-resource').then((data) => {
+ let fileResourceList = [];
+ data.forEach(x => {
+ let localFileResource = {'id': x.get('id'),
+ 'name': x.get('name'),
+ 'path': x.get('path'),
+ 'owner': x.get('owner')
+ };
+ fileResourceList.push(localFileResource);
+ });
+
+ this.controller.set('fileResourceList', fileResourceList);
+
+ });
+
+
+
},
model(params) {
@@ -98,6 +116,11 @@ export default Ember.Route.extend({
actions: {
+ createQuery(udfName, udfClassname, fileResourceName, fileResourcePath){
+ let query = "add jar "+ fileResourcePath + ";\ncreate temporary function " + udfName + " as '"+ udfClassname+ "';";
+ this.get('controller').set('currentQuery', query);
+ this.get('controller.model').set('currentQuery', query );
+ },
changeDbHandler(selectedDBs){
@@ -479,6 +502,8 @@ export default Ember.Route.extend({
showQueryResultContainer(){
this.get('controller.model').set('isQueryResultContainer', true);
- }
+ },
+
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js b/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js
index 8719170..fdb2cad 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js
@@ -19,4 +19,54 @@
import Ember from 'ember';
export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('udf').then(udfs => udfs.toArray());
+ },
+ store: Ember.inject.service(),
+
+ setupController(controller, model) {
+ this._super(...arguments);
+
+ controller.set('udflist', model);
+
+ this.store.findAll('file-resource').then((data) => {
+ let fileResourceList = [];
+ data.forEach(x => {
+ let localFileResource = {
+ 'id': x.get('id'),
+ 'name': x.get('name'),
+ 'path': x.get('path'),
+ 'owner': x.get('owner')
+ };
+ fileResourceList.push(localFileResource);
+ });
+ fileResourceList.push({'name':'Add New File Resource', 'action':'addNewFileResource'});
+ controller.set('fileResourceList', fileResourceList);
+ });
+ },
+
+ actions:{
+
+ refreshUdfList(){
+
+ this.get('store').findAll('udf').then((data) => {
+ let udfList = [];
+ data.forEach(x => {
+ let localUdf = {
+ 'id': x.get('id'),
+ 'name': x.get('name'),
+ 'classname': x.get('classname'),
+ 'fileResource': x.get('fileResource'),
+ 'owner': x.get('owner')
+ };
+ udfList.pushObject(localUdf);
+ });
+
+ this.controllerFor('udfs').set('udflist',udfList);
+ this.transitionTo('udfs');
+ })
+
+ }
+
+ }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/routes/udfs/new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/udfs/new.js b/contrib/views/hive20/src/main/resources/ui/app/routes/udfs/new.js
new file mode 100644
index 0000000..cdccbb3
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/udfs/new.js
@@ -0,0 +1,161 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+
+ beforeModel(){
+
+ },
+
+ udf: Ember.inject.service(),
+ store: Ember.inject.service(),
+
+ setupController(controller, model) {
+ this._super(...arguments);
+
+ this.store.findAll('file-resource').then((data) => {
+ let fileResourceList = [];
+ data.forEach(x => {
+ let localFileResource = {'id': x.get('id'),
+ 'name': x.get('name'),
+ 'path': x.get('path'),
+ 'owner': x.get('owner')
+ };
+ fileResourceList.push(localFileResource);
+ });
+ fileResourceList.push({'name':'Add New File Resource', 'action':'addNewFileResource'})
+ controller.set('fileResourceList', fileResourceList);
+
+ });
+
+ controller.set('isAddingNewFileResource', false);
+ controller.set('selectedFileResource',null);
+
+ },
+
+ actions: {
+
+ saveUDf(resourceName, resourcePath, udfName, udfClassName){
+
+ this.get('controller').set('resourceName',resourceName);
+ this.get('controller').set('resourcePath', resourcePath);
+ this.get('controller').set('udfName', udfName);
+ this.get('controller').set('udfClassName', udfClassName);
+
+ if(!Ember.isEmpty( this.get('controller').get('resourceId'))){
+
+ let newUDF = this.get('store').createRecord('udf',
+ {name:udfName,
+ classname:udfClassName,
+ fileResource: this.get('controller').get('resourceId')
+ });
+
+
+ newUDF.save().then((data) => {
+ console.log('udf saved');
+
+ this.get('store').findAll('udf').then((data) => {
+ let udfList = [];
+ data.forEach(x => {
+ let localUdf = {
+ 'id': x.get('id'),
+ 'name': x.get('name'),
+ 'classname': x.get('classname'),
+ 'fileResource': x.get('fileResource'),
+ 'owner': x.get('owner')
+ };
+ udfList.pushObject(localUdf);
+ });
+
+ this.controllerFor('udfs').set('udflist',udfList);
+ this.transitionTo('udfs');
+ })
+
+ });
+
+ } else {
+
+ let resourcePayload = {"name":resourceName,"path":resourcePath};
+
+ this.get('udf').savefileResource(resourcePayload)
+ .then((data) => {
+
+ console.log('fileResource is', data.fileResource.id);
+
+ let newUDF = this.get('store').createRecord('udf',
+ {name:udfName,
+ classname:udfClassName,
+ fileResource: data.fileResource.id
+ });
+
+ newUDF.save().then((data) => {
+ console.log('udf saved');
+
+ this.get('store').findAll('udf').then((data) => {
+ let udfList = [];
+ data.forEach(x => {
+ let localUdf = {
+ 'id': x.get('id'),
+ 'name': x.get('name'),
+ 'classname': x.get('classname'),
+ 'fileResource': x.get('fileResource'),
+ 'owner': x.get('owner')
+ };
+ udfList.pushObject(localUdf);
+ });
+
+ this.controllerFor('udfs').set('udflist',udfList);
+ this.transitionTo('udfs');
+ })
+
+ });
+
+ }, (error) => {
+ console.log("Error encountered", error);
+ });
+ }
+ },
+
+ cancelSaveUDf(){
+ this.get('controller').set('resourceName','');
+ this.get('controller').set('resourcePath','');
+ this.get('controller').set('udfName','');
+ this.get('controller').set('udfClassName','');
+
+ this.transitionTo('udfs');
+ },
+
+ handleFileResourceChange(filter){
+ console.log('filter', filter);
+ if(filter.action == "addNewFileResource"){
+ this.get('controller').set('isAddingNewFileResource', true);
+ this.get('controller').set('resourceName','');
+ this.get('controller').set('resourcePath','');
+ this.get('controller').set('selectedFileResource',null);
+
+ }else {
+ this.get('controller').set('resourceId',filter.id);
+ this.get('controller').set('selectedFileResource',filter);
+ this.get('controller').set('isAddingNewFileResource', false);
+ }
+ }
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/services/file-resource.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/file-resource.js b/contrib/views/hive20/src/main/resources/ui/app/services/file-resource.js
new file mode 100644
index 0000000..83a4cff
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/services/file-resource.js
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Service.extend({
+
+ store: Ember.inject.service(),
+
+ getAllFileResource(){
+ //return $.ajax('/udfs', 'GET');
+ },
+
+ getFileResource(fileResourceId){
+ return this.get('store').findRecord('file-resource',fileResourceId);
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/services/udf.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/udf.js b/contrib/views/hive20/src/main/resources/ui/app/services/udf.js
new file mode 100644
index 0000000..915e3d0
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/services/udf.js
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Service.extend({
+
+ store: Ember.inject.service(),
+
+ getAllUdfs(){
+ return $.ajax('/udfs', 'GET');
+ },
+
+ getFileResource(fileResourceId){
+
+
+
+ return this.get('store').findRecord('file-resource',fileResourceId);
+ //return this.get('store').queryRecord('file-resource', { 'fileResource': fileResourceId })
+
+ //let url = '/fileResources/' + fileResourceId;
+ //return $.ajax( url , 'GET');
+
+
+ },
+
+ savefileResource(payload){
+ return $.ajax({
+ type: "POST",
+ //url: this.get('store').adapterFor('udf').fileResourceURL(),
+ url: '/fileResources',
+ data: JSON.stringify({fileResource: payload}) ,
+ contentType:"application/json; charset=utf-8",
+ headers: {'X-Requested-By': 'ambari'}
+ })
+ },
+
+ saveUdf(payload){
+ return $.ajax({
+ type: "POST",
+ //url: this.get('store').adapterFor('udf').udfURL(),
+ url: '/udfs',
+ data: JSON.stringify({udf: payload}) ,
+ contentType:"application/json; charset=utf-8",
+ headers: {'X-Requested-By': 'ambari'}
+ })
+ },
+
+ deleteUdf(udfId){
+ let deletURL = '/udfs/' + udfId;
+
+ return $.ajax({
+ type: "DELETE",
+ url: deletURL,
+ contentType:"application/json; charset=utf-8",
+ dataType:"json",
+ headers: {'X-Requested-By': 'ambari'}
+ })
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
index 2f63854..0b92d28 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
+++ b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
@@ -820,6 +820,71 @@ pre {
padding-top: 10px;
}
+.dropdown-item {
+ display: block;
+ width: 100%;
+ padding: 3px 1.5rem;
+ clear: both;
+ font-weight: 400;
+ color: #292b2c;
+ text-align: inherit;
+ white-space: nowrap;
+ background: 0 0;
+ border: 0;
+}
+
+.dropdown-submenu {
+ position: relative;
+}
+
+.dropdown-submenu .dropdown-menu {
+ top: 0;
+ left: 100%;
+ margin-top: -1px;
+}
+
+.hand {
+ cursor: pointer;
+}
+
+.udf-container {
+ background-color: #d9edf7; padding: 10px;
+}
+
+.center{
+ text-align: center;
+}
+
+ul.sub-menu {
+ margin: 0; padding: 0;
+ li.dropdown{
+ list-style: none;
+ a {
+ display: block;
+ padding: 2px 25px;
+ text-decoration:none;
+ border-bottom: 1px solid #DDD;
+ background-color: #000;
+ color:#FFF;
+ margin: 0 10px;
+ &:hover {
+ background-color: #d9edf7;
+ color:#000;
+ }
+ }
+ }
+}
+
+ul.dropdown-menu {
+ li.dropdown{
+ list-style: none;
+ a {
+ border-bottom: 1px solid #DDD;
+ }
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/components/fileresource-item.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/fileresource-item.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/fileresource-item.hbs
new file mode 100644
index 0000000..cb90311
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/fileresource-item.hbs
@@ -0,0 +1,32 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<li class="dropdown">
+ <a tabindex="-1" {{action 'expandFileResource' fileResource.id bubbles=false }} href="javascript:void(0)">{{fileResource.name}}</a>
+ {{#if expanded}}
+ <ul class="sub-menu">
+ {{#each selectedUdfList as |udf|}}
+ <li class="dropdown" >
+ <a tabindex="-1" href="javascript:void(0)" {{action 'createQuery' udf.name udf.classname fileResource.name fileResource.path }} >{{udf.name}}</a>
+ </li>
+ {{/each}}
+ </ul>
+ {{/if}}
+</li>
+
+{{yield}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-edit.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-edit.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-edit.hbs
new file mode 100644
index 0000000..24cb495
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-edit.hbs
@@ -0,0 +1,67 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<td colspan="4" style="padding: 0;">
+ <div class="udf-container">
+ <form class="form-inline">
+ <table class="table" style="background-color: transparent">
+ <tr>
+ <td width="20%" >
+ <label>UDF Name</label><br />
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="UDF Name" value=name }}
+ </td>
+ <td width="20%">
+ <label >UDF Class Name</label><br />
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="UDF Class Name" value=classname }}
+ </td>
+ <td width="40%">
+ <label >File Resource</label><br />
+ {{#unless isAddingNewFileResource}}
+ {{#power-select
+ options=fileResourceList
+ placeholder="File Resource"
+ searchField="name"
+ selected=selectedFileResource
+ searchPlaceholder="Type the paramter"
+ onchange=(action "handleResourceChange" ) as |filter| }}
+ {{filter.name}}
+ {{/power-select}}
+ {{/unless}}
+ {{#if isAddingNewFileResource}}
+ <label class="sr-only">Resource name</label>
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="File Resource Name" value=udfFileResourceName }}
+
+ <label class="sr-only">Resource Path</label>
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="File Resource path" value=udfFileResourcePath }}
+ {{/if}}
+ </td>
+
+ <td width="20%" align="center">
+ <br />
+ <button class="btn btn-success" type="button" {{action 'saveUDf' name classname udfid udfFileResourceName udfFileResourcePath}}>Save UDF</button>
+ <button class="btn btn-warning" type="button" {{action 'cancelEditUdf'}}>Cancel</button>
+ </td>
+
+ </tr>
+ </table>
+ </form>
+ </div>
+</td>
+
+
+{{yield}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-item.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-item.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-item.hbs
new file mode 100644
index 0000000..fec48fb
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-item.hbs
@@ -0,0 +1,76 @@
+{{!
+* 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.
+}}
+
+<tr>
+ <td> {{udf.name}}</td>
+ <td>{{udf.classname}} </td>
+ <td>{{udf.owner}}</td>
+ <td class="center">
+ <a class="hand" {{action "toggleExpandUdf" udf.fileResource }}>{{fa-icon "expand"}}</a>
+ <a class="hand" {{action "showEditUdf" udf.id udf.fileResource }}>{{fa-icon "edit"}}</a>
+ <a class="hand" {{action "showRemoveUdfModal" udf.id }}>{{fa-icon "remove"}}</a>
+ </td>
+</tr>
+
+{{#if expanded}}
+ <tr>
+ <td colspan="5">
+ <label>File Resource Name: </label>{{udfFileResourceName}}
+ <br />
+ <label>File Resource Path: </label> {{udfFileResourcePath}}
+ </td>
+ </tr>
+{{/if}}
+
+{{#if expandedEdit}}
+ {{udf-edit
+ udfid=udf.id
+ name=udf.name
+ classname=udf.classname
+ owner=udf.owner
+ fileResource=udf.fileResource
+ udfFileResourceName=udfFileResourceName
+ udfFileResourcePath=udfFileResourcePath
+ fileResourceList=fileResourceList
+ selectedFileResource=selectedFileResource
+ isAddingNewFileResource=isAddingNewFileResource
+ handleResourceChange='handleResourceChange'
+ cancelEditUdf='cancelEditUdf'
+ saveUDf='saveUDf'
+ }}
+{{/if}}
+
+
+{{#if showDeleteUdfModal}}
+ {{confirm-dialog
+ title="Confirm"
+ label="Do You want to delete the UDF?"
+ titleIcon="minus"
+ labelIcon="save"
+ rejectIcon="times"
+ confirmIcon="check"
+ closable=false
+ confirmClass="success"
+ confirm="removeUdf"
+ reject="cancelUdf"
+ }}
+{{/if}}
+
+
+
+{{yield}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-new.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-new.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-new.hbs
new file mode 100644
index 0000000..ddf34d7
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/udf-new.hbs
@@ -0,0 +1,61 @@
+{{!
+* 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.
+}}
+
+<form class="form-inline">
+ <table class="table">
+ <tr>
+ <td width="20%" >
+ <label>UDF Name</label><br />
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="UDF Name" value=udfName }}
+ </td>
+ <td width="20%">
+ <label >UDF Class Name</label><br />
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="UDF Class Name" value=udfClassName }}
+ </td>
+ <td width="40%">
+ <label >File Resource</label><br />
+ {{#unless isAddingNewFileResource}}
+ {{#power-select
+ options=fileResourceList
+ placeholder="File Resource"
+ searchField="name"
+ selected=selectedFileResource
+ searchPlaceholder="Type the paramter"
+ onchange=(action "handleFileResourceChange" ) as |filter| }}
+ <b>{{filter.name}}</b>
+ {{/power-select}}
+ {{/unless}}
+ {{#if isAddingNewFileResource}}
+ <label class="sr-only">Resource name</label>
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="File Resource Name" value=resourceName }}
+
+ <label class="sr-only">Resource Path</label>
+ {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="File Resource path" value=resourcePath }}
+ {{/if}}
+ </td>
+
+ <td width="20%" align="center">
+ <br />
+ <button class="btn btn-success" type="button" {{action 'saveUDf'}}>Add UDF</button>
+ <button class="btn btn-warning" type="button" {{action 'cancelSaveUDf'}}>Cancel</button>
+ </td>
+ </tr>
+ </table>
+</form>
+
+{{yield}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
index 62c97a2..e33e002 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
@@ -30,6 +30,22 @@
<div class="row query-editor-controls">
<button class="btn btn-success" {{action "executeQuery" }}>{{fa-icon "check"}} Execute</button>
<button class="btn btn-default" {{action "openWorksheetModal" }}>{{fa-icon "save"}} Save As</button>
+
+
+ <div class="btn-group">
+ <button class="btn btn-default" type="button" data-toggle="dropdown">Insert UDF
+ <span class="caret"></span></button>
+
+
+ <ul class="dropdown-menu">
+ {{#each fileResourceList as |fileResource|}}
+ {{fileresource-item fileResource=fileResource createQuery='createQuery'}}
+ {{/each}}
+ </ul>
+
+ </div>
+
+
{{#if worksheet.isQueryRunning}}
{{fa-icon "spinner fa-1-5" spin=true}}
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/udfs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/udfs.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/udfs.hbs
index b776fd2..ef6a01c 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/udfs.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/udfs.hbs
@@ -16,4 +16,32 @@
* limitations under the License.
}}
+<div class="pull-right">
+ {{#link-to 'udfs.new' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW UDF{{/link-to}}
+</div>
+<div class="row jobs-table">
+ <div class="col-md-12">
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th width="20%">UDF Name</th>
+ <th width="20%">UDF Class Name</th>
+ <th width="40%">Owner</th>
+ <th width="20%" class="center">Action</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each udflist as |udf| }}
+ {{udf-item
+ udf=udf
+ fileResourceList=fileResourceList
+ refreshUdfList='refreshUdfList'
+ }}
+ {{/each}}
+ </tbody>
+ </table>
+ </div>
+</div>
+
+
{{outlet}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2720b5c1/contrib/views/hive20/src/main/resources/ui/app/templates/udfs/new.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/udfs/new.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/udfs/new.hbs
new file mode 100644
index 0000000..0f739a3
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/udfs/new.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.
+}}
+
+<div class="udf-container">
+ {{udf-new
+ handleFileResourceChange="handleFileResourceChange"
+ fileResourceList=fileResourceList
+ selectedFileResource=selectedFileResource
+ isAddingNewFileResource=isAddingNewFileResource
+ cancelSaveUDf="cancelSaveUDf"
+ saveUDf="saveUDf"
+ }}
+</div>
+
+{{outlet}}