ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: Revert "AMBARI-22089. Hive View 2.0 - Unable to update existing saved queries, view creates new records under saved queries tab (pallavkul)"
Date Mon, 09 Oct 2017 15:53:06 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 4efe389b4 -> ebde32c21


Revert "AMBARI-22089. Hive View 2.0 - Unable to update existing saved queries, view creates
new records under saved queries tab (pallavkul)"

This reverts commit c523eb9719c6c2d05acc54234426e7dd0ed269b7.


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

Branch: refs/heads/branch-2.6
Commit: ebde32c21334a5dcaeecda37a7ea8c1a8fbd93fd
Parents: 4efe389
Author: pallavkul <pallav.kul@gmail.com>
Authored: Mon Oct 9 21:22:26 2017 +0530
Committer: pallavkul <pallav.kul@gmail.com>
Committed: Mon Oct 9 21:22:26 2017 +0530

----------------------------------------------------------------------
 .../savedQueries/SavedQueryResourceManager.java | 17 ++----
 .../resources/ui/app/routes/queries/query.js    | 63 +++++---------------
 .../hive20/src/main/resources/ui/yarn.lock      |  2 +-
 3 files changed, 21 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ebde32c2/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/savedQueries/SavedQueryResourceManager.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/savedQueries/SavedQueryResourceManager.java
b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/savedQueries/SavedQueryResourceManager.java
index fff202c..3690683 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/savedQueries/SavedQueryResourceManager.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/savedQueries/SavedQueryResourceManager.java
@@ -115,17 +115,12 @@ public class SavedQueryResourceManager extends PersonalCRUDResourceManager<Saved
   }
 
   @Override
-  public SavedQuery update(SavedQuery object, String id) throws ItemNotFound {
-    String query = object.getShortQuery();
-    object.setShortQuery(makeShortQuery(query));
-    object = super.update(object, id);
-    try {
-      createDefaultQueryFile(object, query);
-
-    } catch (ServiceFormattedException e) {
-      cleanupAfterErrorAndThrowAgain(object, e);
-    }
-    return object;
+  public SavedQuery update(SavedQuery newObject, String id) throws ItemNotFound {
+    SavedQuery savedQuery = super.update(newObject, id);
+    // Emptying short query so that in next read, this gets updated with proper value
+    // from the queryFile
+    emptyShortQueryField(savedQuery);
+    return savedQuery;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebde32c2/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 3e5adc1..9e8b6db 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
@@ -631,71 +631,36 @@ export default Ember.Route.extend(UILoggerMixin, {
       let owner = this.get('controller.model').get('owner');
       let queryFile = this.get('controller.model').get('queryFile');
       let logFile = this.get('controller.model').get('logFile');
-      let shortQuery = (currentQuery.length > 0) ? currentQuery : ";";
-      let savedQueryId = this.get('controller.model').get('id');
 
-
-      this.store.findAll('savedQuery').then(savedQueries => {
-        return savedQueries.toArray();
-      }).then((existingSavedQueries) =>{
-
-        var queryExist = existingSavedQueries.filterBy('id', savedQueryId).get('firstObject');
-
-        if(queryExist){
-          this.send('updateSavedQuery',  queryExist.get('id'));
-        } else{
-          this.send('addSavedQuery', selectedDb, newTitle, owner, shortQuery );
-        }
-
-
-      });
-
-    },
-
-    addSavedQuery(selectedDb, newTitle, owner, shortQuery){
+      let payload = {"title" : newTitle,
+        "dataBase": selectedDb,
+        "owner" : owner,
+        "shortQuery" : (currentQuery.length > 0) ? currentQuery : ";",
+        "queryFile" : queryFile,
+        "logFile" : logFile};
 
       let newSaveQuery = this.get('store').createRecord('saved-query',
         { dataBase:selectedDb,
           title:newTitle,
+          queryFile: queryFile,
           owner: owner,
-          shortQuery: shortQuery
+          shortQuery: (currentQuery.length > 0) ? currentQuery : ";"
         });
 
+
       newSaveQuery.save().then((data) => {
+        console.log('saved query saved');
+
         this.get('controller.model').set('title', newTitle);
         this.get('controller.model').set('isQueryDirty', false);
         this.get('controller').set('worksheetModalSuccess', true);
+
         Ember.run.later(() => {
           this.get('controller').set('showWorksheetModal', false);
           this.closeWorksheetAfterSave();
         }, 2 * 1000);
-      });
-
-    },
-
-    updateSavedQuery(savedQueryId){
-          let currentQuery = this.get('controller.model').get('query');
-          let selectedDb = this.get('controller.model').get('selectedDb');
-          let owner = this.get('controller.model').get('owner');
-
-          this.get('store').findRecord('saved-query', savedQueryId ).then(savedQuery =>
{
-            savedQuery.set('shortQuery', (currentQuery.length > 0) ? currentQuery : ";");
-            savedQuery.set('dataBase', selectedDb );
-            savedQuery.set('owner', owner );
-
-            savedQuery.save().then(savedQuery => {
-
-                this.get('controller.model').set('isQueryDirty', false);
-                this.get('controller').set('worksheetModalSuccess', true);
-
-                Ember.run.later(() => {
-                  this.get('controller').set('showWorksheetModal', false);
-                  this.closeWorksheetAfterSave();
-                }, 2 * 1000);
-            })
-
-          });
 
+      });
 
     },
 
@@ -703,7 +668,7 @@ export default Ember.Route.extend(UILoggerMixin, {
       this.get('controller').set('showWorksheetModal', false);
       this.closeWorksheetAfterSave();
       this.get('controller.model').set('tabDataToClose', null);
-    },
+  },
 
     expandQueryEdidorPanel(){
       if(!this.get('isQueryEdidorPaneExpanded')){

http://git-wip-us.apache.org/repos/asf/ambari/blob/ebde32c2/contrib/views/hive20/src/main/resources/ui/yarn.lock
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/yarn.lock b/contrib/views/hive20/src/main/resources/ui/yarn.lock
index 607cf81..477a15c 100644
--- a/contrib/views/hive20/src/main/resources/ui/yarn.lock
+++ b/contrib/views/hive20/src/main/resources/ui/yarn.lock
@@ -569,7 +569,7 @@ babel-plugin-transform-es2015-block-scoped-functions@^6.22.0:
   dependencies:
     babel-runtime "^6.22.0"
 
-babel-plugin-transform-es2015-block-scoping@^6.23.0, babel-plugin-transform-es2015-block-scoping@^6.24.1:
+babel-plugin-transform-es2015-block-scoping@^6.23.0:
   version "6.24.1"
   resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz#76c295dc3a4741b1665adfd3167215dcff32a576"
   dependencies:


Mime
View raw message