You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2015/11/24 21:39:24 UTC
ambari git commit: AMBARI-14048. Save as with highlighted text
deletes unhighlighted text un-recoverably. (Pallav Kulshreshtha via Jaimin)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 f1b5f6aff -> 63d7b305e
AMBARI-14048. Save as with highlighted text deletes unhighlighted text un-recoverably. (Pallav Kulshreshtha via Jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/63d7b305
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/63d7b305
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/63d7b305
Branch: refs/heads/branch-2.1
Commit: 63d7b305e17e224db74238a97531c7c0bd8ca93a
Parents: f1b5f6a
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Tue Nov 24 12:38:21 2015 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Tue Nov 24 12:38:21 2015 -0800
----------------------------------------------------------------------
.../ui/hive-web/app/components/query-editor.js | 25 +++++++++++++++++++-
.../tests/unit/components/query-editor-test.js | 15 ++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/63d7b305/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
index 814262a..10c6bb3 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
@@ -108,5 +108,28 @@ export default Ember.Component.extend({
}).find('.ui-resizable-s').addClass('grip fa fa-reorder');
this.tablesChanged();
- }.on('didInsertElement')
+ }.on('didInsertElement'),
+
+ updateValue: function () {
+ var query = this.get('query');
+ var editor = this.get('editor');
+
+ var isEditorExplainQuery = (editor.getValue().toUpperCase().trim().indexOf('EXPLAIN') === 0);
+ var isFinalExplainQuery = (query.toUpperCase().trim().indexOf('EXPLAIN') === 0);
+
+ if (editor.getValue() !== query) {
+
+ if(!isEditorExplainQuery && !isFinalExplainQuery){
+ editor.setValue(query || '');
+ } else if(!isEditorExplainQuery && isFinalExplainQuery){
+ editor.setValue(editor.getValue() || '');
+ } else if(isEditorExplainQuery && isFinalExplainQuery){
+ editor.setValue(editor.getValue() || '');
+ } else{
+ editor.setValue(query || '');
+ }
+
+ }
+
+ }.observes('query')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/63d7b305/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
index 91dc96f..e70b5ee 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
@@ -35,3 +35,18 @@ test('initEditor sets the editor on didInsertElement', function () {
ok(component.get('editor'), 'element rendered. Editor set.');
});
+test('updateValue sets the query value on the editor.', function () {
+ expect(1);
+
+ var component = this.subject();
+
+ var query = 'select something';
+
+ this.$();
+
+ Ember.run(function () {
+ component.set(('query'), query);
+ });
+
+ equal(component.get('editor').getValue(), query, 'set query property. Updated editor value property.');
+});