You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/01/30 15:40:40 UTC
[19/30] ambari git commit: AMBARI-19770. Hive View 2.0: New Job and
New Table button does nothing. (dipayanb)
AMBARI-19770. Hive View 2.0: New Job and New Table button does nothing. (dipayanb)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/985dafff
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/985dafff
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/985dafff
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 985dafff5330b97e4b92f1c4cf67ee201a8e6edd
Parents: ea1fbaa
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Mon Jan 30 14:26:07 2017 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Mon Jan 30 14:28:04 2017 +0530
----------------------------------------------------------------------
.../hive20/src/main/resources/ui/app/app.js | 9 ++++
.../resources/ui/app/controllers/queries.js | 22 +++++++++
.../main/resources/ui/app/models/worksheet.js | 2 +-
.../hive20/src/main/resources/ui/app/router.js | 2 +
.../main/resources/ui/app/routes/application.js | 4 +-
.../ui/app/routes/databases/newtable.js | 30 ++++++++++++
.../src/main/resources/ui/app/routes/queries.js | 49 +-------------------
.../resources/ui/app/routes/queries/index.js | 9 ++--
.../main/resources/ui/app/routes/queries/new.js | 38 +++++++++++++++
.../resources/ui/app/routes/queries/query.js | 17 ++++---
.../src/main/resources/ui/app/services/jobs.js | 6 ++-
.../components/top-application-bar.hbs | 4 +-
.../src/main/resources/ui/config/environment.js | 2 +
13 files changed, 130 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/app.js b/contrib/views/hive20/src/main/resources/ui/app/app.js
index af4fdc4..0f83ee5 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/app.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/app.js
@@ -26,6 +26,15 @@ let App;
Ember.MODEL_FACTORY_INJECTIONS = true;
App = Ember.Application.extend({
+ // Basic logging, e.g. "Transitioned into 'post'"
+ LOG_TRANSITIONS: false,
+
+ // Extremely detailed logging, highlighting every internal
+ // step made while transitioning into a route, including
+ // `beforeModel`, `model`, and `afterModel` hooks, and
+ // information about redirects and aborted transitions
+ LOG_TRANSITIONS_INTERNAL: false,
+
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/controllers/queries.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/queries.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/queries.js
new file mode 100644
index 0000000..dc99fd1
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/queries.js
@@ -0,0 +1,22 @@
+/**
+ * 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/985dafff/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js b/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
index 23f16b0..9021e90 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
@@ -20,7 +20,7 @@ import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
- query: DS.attr('string'),
+ query: DS.attr('string', {defaultValue: ''}),
selectedDb: DS.attr('string'),
owner: DS.attr('string'),
queryResult: DS.attr({defaultValue: {'schema' :[], 'rows' :[]}}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/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 e32dfe8..b9db38d 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/router.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/router.js
@@ -31,6 +31,7 @@ Router.map(function() {
this.route('savedqueries');
this.route('databases', function() {
+ this.route('newtable');
this.route('database', {path: '/:databaseId'}, function() {
this.route('tables', {path: '/tables'}, function() {
this.route('new');
@@ -52,6 +53,7 @@ Router.map(function() {
});
this.route('queries', function() {
+ this.route('new');
this.route('query', {path: '/:worksheetId'}, function() {
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/application.js b/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
index 93f5e61..aa77897 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
@@ -21,11 +21,11 @@ import tabs from '../configs/top-level-tabs';
export default Ember.Route.extend({
keepAlive: Ember.inject.service('keep-alive'),
- init: function() {
+ init: function () {
this._super(...arguments);
this.get('keepAlive').initialize();
},
- setupController: function(controller, model) {
+ setupController: function (controller, model) {
this._super(controller, model);
controller.set('tabs', tabs);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/routes/databases/newtable.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/newtable.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/newtable.js
new file mode 100644
index 0000000..7502183
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/newtable.js
@@ -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.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+
+ setupController(controller, model) {
+ this._super(controller, model);
+ let selectedDatabase = this.modelFor('databases').filterBy('selected', true).get('firstObject');
+ Ember.run.later(() => {
+ this.transitionTo('databases.database.tables.new', selectedDatabase.get('name'));
+ }, 100);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/routes/queries.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries.js
index d9f0360..4ef3834 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries.js
@@ -20,56 +20,9 @@ import Ember from 'ember';
export default Ember.Route.extend({
- model() {
-
- let existingWorksheets = this.store.peekAll('worksheet');
-
- if(existingWorksheets.get('length') === 0) {
- this.store.createRecord('worksheet', {
- id: 'worksheet1',
- title: 'Worksheet1',
- query: 'select 1;',
- selectedDb : 'default',
- owner: 'admin',
- selected: true
- });
- }
-
- return this.store.peekAll('worksheet');
-
- },
- setupController(controller, model) {
- this._super(...arguments);
- controller.set('worksheets', model);
-
- // This is just the initial currentWorksheet, It will be set on correctly on click of worksheet.
- controller.set('currentWorksheet', controller.get('worksheets').get('firstObject'));
-
- },
-
actions: {
-
createNewWorksheet(){
-
- let worksheets = this.controllerFor('queries').get('model');
- worksheets.forEach((worksheet) => {
- worksheet.set('selected', false);
- });
-
- let localWs = {
- id: `worksheet${worksheets.get('length') + 1}`,
- title:`Worksheet${worksheets.get('length') + 1}`,
- query: 'select '+ parseInt(worksheets.get('length') + 1) + ';',
- selectedDb : 'default',
- owner: 'admin',
- selected: true
- };
-
- let newWorksheet = this.store.createRecord('worksheet', localWs );
- this.set('controller.worksheets', this.store.peekAll('worksheet'));
-
- this.transitionTo('queries.query', localWs.title);
+ this.transitionTo('queries.new');
}
-
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/routes/queries/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/index.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/index.js
index 9872583..f2af6bc 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/index.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/index.js
@@ -20,10 +20,13 @@ import Ember from 'ember';
export default Ember.Route.extend({
beforeModel() {
- if(this.modelFor('queries').filterBy('selected', true).length > 0){
- let selectedWorksheet = this.modelFor('queries').filterBy('selected', true).get('firstObject');
- console.log('worksheet-title', selectedWorksheet.get('title'));
+ let existingWorksheets = this.store.peekAll('worksheet');
+ if(existingWorksheets.get('length') > 0) {
+ let selectedWorksheet = existingWorksheets.filterBy('selected', true).get('firstObject');
+ this.controllerFor('queries').set('worksheets', existingWorksheets);
this.transitionTo('queries.query', selectedWorksheet.get('title'));
+ } else {
+ this.transitionTo('queries.new');
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
new file mode 100644
index 0000000..5a869c2
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
@@ -0,0 +1,38 @@
+/**
+ * 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() {
+ let existingWorksheets = this.store.peekAll('worksheet');
+ let newWorksheetName = `worksheet${existingWorksheets.get('length') + 1}`;
+ let newWorksheetTitle = newWorksheetName.capitalize();
+ this.store.createRecord('worksheet', {
+ id: newWorksheetName,
+ title: newWorksheetTitle,
+ //query: 'select 1;',
+ selectedDb : 'default',
+ //owner: 'admin',
+ selected: true
+ });
+ existingWorksheets.setEach('selected', false);
+ this.controllerFor('queries').set('worksheets', this.store.peekAll('worksheet'));
+ this.transitionTo('queries.query', newWorksheetTitle);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/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 2ecf967..7d387f0 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
@@ -26,9 +26,7 @@ export default Ember.Route.extend({
beforeModel(){
let existingWorksheets = this.store.peekAll('worksheet');
- existingWorksheets.forEach((worksheet) => {
- worksheet.set('selected', false);
- });
+ existingWorksheets.setEach('selected', false);
},
afterModel(model) {
@@ -39,9 +37,13 @@ export default Ember.Route.extend({
},
model(params) {
- let selectedWs = this.modelFor('queries').filterBy('title', params.worksheetId).get('firstObject');
- selectedWs.set('selected', true);
- return selectedWs;
+ let selectedWs = this.store.peekAll('worksheet').filterBy('title', params.worksheetId).get('firstObject');
+ if(selectedWs) {
+ selectedWs.set('selected', true);
+ return selectedWs;
+ } else {
+ this.transitionTo('queries');
+ }
},
setupController(controller, model) {
@@ -173,7 +175,7 @@ export default Ember.Route.extend({
self.get('controller.model').set('logFile', data.job.logFile);
self.get('controller').set('currentJobId', data.job.id);
- self.get('jobs').waitForJobToComplete(data.job.id, 5 * 1000)
+ self.get('jobs').waitForJobToComplete(data.job.id, 5 * 1000, false)
.then((status) => {
Ember.run.later(() => {
self.get('controller').set('isJobSuccess', true);
@@ -468,4 +470,5 @@ export default Ember.Route.extend({
$('.editor-result-list').addClass('active');
}
}
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js b/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
index 5d7ce77..ff54152 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js
@@ -60,6 +60,10 @@ export default Ember.Service.extend({
reject(error);
});
});
- }
+ },
+
+ _fetchDummyResult(jobId) {
+ this.get('store').adapterFor('job').fetchResult(jobId);
+ },
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
index f930be9..6f451e9 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
@@ -19,7 +19,7 @@
<h3 class="clearfix">
<strong>HIVE</strong>
<span class="pull-right">
- <button class="btn btn-sm btn-success">{{fa-icon "plus"}} NEW JOB</button>
- <button class="btn btn-sm btn-success">{{fa-icon "plus"}} NEW TABLE</button>
+ {{#link-to 'queries.new' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW JOB{{/link-to}}
+ {{#link-to 'databases.newtable' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW TABLE{{/link-to}}
</span>
</h3>
http://git-wip-us.apache.org/repos/asf/ambari/blob/985dafff/contrib/views/hive20/src/main/resources/ui/config/environment.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/config/environment.js b/contrib/views/hive20/src/main/resources/ui/config/environment.js
index 9efd491..42dde20 100644
--- a/contrib/views/hive20/src/main/resources/ui/config/environment.js
+++ b/contrib/views/hive20/src/main/resources/ui/config/environment.js
@@ -34,6 +34,8 @@ module.exports = function(environment) {
APP: {
// Here you can pass flags/options to your application instance
// when it is created
+ LOG_VIEW_LOOKUPS: false,
+ LOG_ACTIVE_GENERATION: false
}
};