ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [22/25] ambari git commit: AMBARI-20089. HiveView2.0: Add new UDF is not working (pallavkul)
Date Tue, 21 Feb 2017 16:39:53 GMT
AMBARI-20089. HiveView2.0: Add new UDF is not working (pallavkul)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 299b05033811d0149f2e474358b70e14d45ee9c3
Parents: 818a640
Author: pallavkul <pallav.kul@gmail.com>
Authored: Tue Feb 21 17:03:24 2017 +0530
Committer: pallavkul <pallav.kul@gmail.com>
Committed: Tue Feb 21 17:04:36 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/routes/udfs/new.js    | 71 +++++++++++---------
 1 file changed, 40 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/299b0503/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
index cdccbb3..84733e8 100644
--- 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
@@ -17,8 +17,9 @@
  */
 
 import Ember from 'ember';
+import UILoggerMixin from '../../mixins/ui-logger';
 
-export default Ember.Route.extend({
+export default Ember.Route.extend(UILoggerMixin, {
 
   beforeModel(){
 
@@ -94,42 +95,50 @@ export default Ember.Route.extend({
 
         let resourcePayload = {"name":resourceName,"path":resourcePath};
 
-        this.get('udf').savefileResource(resourcePayload)
-          .then((data) => {
+        var newFileResource = this.get('store').createRecord('file-resource',
+          {name:resourceName,
+            path:resourcePath
+          });
 
-            console.log('fileResource is', data.fileResource.id);
+        newFileResource.save().then((data) => {
+          console.log('fileResource is', data.get('id'));
+          let newUDF = this.get('store').createRecord('udf',
+            {name:udfName,
+              classname:udfClassName,
+              fileResource: data.get('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);
               });
 
-            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');
-              })
-
-            });
+              this.controllerFor('udfs').set('udflist',udfList);
+              this.transitionTo('udfs');
+            })
+          })
+          .catch((error) => {
+            this.get('logger').danger('Failed to create UDF.', this.extractError(error));
+            this.transitionTo('udfs');
 
-          }, (error) => {
-            console.log("Error encountered", error);
           });
+        })
+        .catch((error) => {
+          this.get('logger').danger('Failed to create File Resource.', this.extractError(error));
+          this.transitionTo('udfs');
+        });
+
       }
     },
 


Mime
View raw message