You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/06/11 22:24:09 UTC
[2/3] ambari git commit: AMBARI-11864. Hive View Enhancements (Erik
Bergenholtz via rlevas)
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
index 074d3d1..787f42b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
@@ -21,13 +21,18 @@ import constants from 'hive/utils/constants';
import utils from 'hive/utils/functions';
export default Ember.ArrayController.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
needs: [
constants.namingConventions.index,
- constants.namingConventions.openQueries
+ constants.namingConventions.openQueries,
+ constants.namingConventions.queryTabs
],
index: Ember.computed.alias('controllers.' + constants.namingConventions.index),
openQueries: Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
+ queryTabs: Ember.computed.alias('controllers.' + constants.namingConventions.queryTabs),
+
sessionTag: Ember.computed.alias('index.model.sessionTag'),
sessionActive: Ember.computed.alias('index.model.sessionActive'),
@@ -53,7 +58,7 @@ export default Ember.ArrayController.extend({
self.createDefaultsSettings(response.settings);
})
.catch(function(error) {
- self.notify.error(error.responseJSON.message, error.responseJSON.trace);
+ self.get('notifyService').error(error);
});
}.on('init'),
@@ -91,7 +96,7 @@ export default Ember.ArrayController.extend({
var currentId = this.get('index.model.id');
var targetSettings = this.findBy('id', currentId);
- if (!targetSettings && currentId) {
+ if (!targetSettings) {
targetSettings = this.pushObject(Ember.Object.create({
id: currentId,
settings: []
@@ -99,7 +104,7 @@ export default Ember.ArrayController.extend({
}
return targetSettings;
- }.property('openQueries.currentQuery'),
+ }.property('index.model.id'),
settingsSets: [
Ember.Object.create({ name: 'Set 1' }),
@@ -170,7 +175,7 @@ export default Ember.ArrayController.extend({
return setting;
},
- parseQuerySettings: function () {
+ parseQuerySettings: function(notify) {
var self = this;
var query = this.get('openQueries.currentQuery');
var content = query.get('fileContent');
@@ -201,8 +206,27 @@ export default Ember.ArrayController.extend({
parsedSettings.push(self.createSetting(name, value));
});
+ if (notify) {
+ this.get('notifyService').info(Ember.I18n.t('settings.parsed'));
+ this.get('queryTabs').flashSettings();
+ }
+
query.set('fileContent', content.replace(regex, '').trim());
targetSettings.set('settings', parsedSettings);
+ },
+
+ parseQuerySettingsObserver: function () {
+ var query;
+
+ Ember.run(this, function () {
+ query = this.get('openQueries.currentQuery');
+ });
+
+ if (query.get('blockSettingsParser')) {
+ return;
+ }
+
+ this.parseQuerySettings(true);
}.observes('openQueries.currentQuery', 'openQueries.currentQuery.fileContent', 'openQueries.tabUpdated'),
validate: function () {
@@ -306,9 +330,9 @@ export default Ember.ArrayController.extend({
adapter.ajax(url, 'DELETE').catch(function (response) {
if ([200, 404].contains(response.status)) {
model.set('sessionActive', false);
- self.notify.success(Ember.I18n.t('alerts.success.sessions.deleted'));
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.sessions.deleted'));
} else {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
+ self.get('notifyService').error(response);
}
});
},
@@ -349,9 +373,9 @@ export default Ember.ArrayController.extend({
})
.then(function(response) {
if (response && response.settings) {
- self.notify.success(Ember.I18n.t('alerts.success.settings.saved'));
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.settings.saved'));
} else {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
+ self.get('notifyService').error(response);
}
});
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js
deleted file mode 100644
index 1d773e7..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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 constants from 'hive/utils/constants';
-
-export default Ember.ObjectController.extend({
- pageCount: 10,
-
- init: function () {
- this._super();
-
- var databaseAdapter = this.container.lookup('adapter:database');
- var baseUrl = databaseAdapter.buildURL() + '/' +
- databaseAdapter.pathForType(constants.namingConventions.database) + '/';
-
- this.set('baseUrl', baseUrl);
- },
-
- getTablesPage: function (database, searchTerm, firstSearchPage) {
- var defer = Ember.RSVP.defer(),
- url = this.get('baseUrl') +
- database.get('name') +
- '/table.page?count=';
-
- url += this.get('pageCount');
-
- if (searchTerm) {
- url += '&searchId=searchTables' + '&like=' + searchTerm;
-
- if (firstSearchPage) {
- url += '&first=true';
- }
- } else if (!database.get('tables.length')) {
- url += '&first=true';
- }
-
- Ember.$.getJSON(url).then(function (data) {
- var tables;
-
- tables = data.rows.map(function (row) {
- return Ember.Object.create({
- name: row[0]
- });
- });
-
- defer.resolve({
- tables: tables,
- hasNext: data.hasNext
- });
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- },
-
- getTables: function (databaseName) {
- var defer = Ember.RSVP.defer(),
- url = this.get('baseUrl') +
- databaseName +
- '/table';
-
- Ember.$.getJSON(url).then(function (data) {
- var tables = data.tables.map(function (table) {
- return Ember.Object.create({
- name: table
- });
- });
-
- defer.resolve(tables);
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
index 6ce7147..18379a0 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
@@ -81,7 +81,7 @@ export default Ember.Controller.extend({
},
setTezViewURL: function (instance) {
- var url = "%@/%@/%@".fmt(
+ var url = "%@/%@/%@/".fmt(
this.get('tezURLPrefix'),
instance.version,
instance.instance_name
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
index 3f8d3ed..ced29ca 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
@@ -20,12 +20,6 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.ObjectController.extend({
- needs: [ constants.namingConventions.udfs, constants.namingConventions.fileResources ],
-
- columns: Ember.computed.alias('controllers.' + constants.namingConventions.udfs + '.columns'),
- links: Ember.computed.alias('controllers.' + constants.namingConventions.udfs + '.links'),
- fileResources: Ember.computed.alias('controllers.' + constants.namingConventions.fileResources),
-
init: function () {
this._super();
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
index d9a7d6b..437c9d0 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
@@ -22,31 +22,28 @@ import constants from 'hive/utils/constants';
export default Ember.ArrayController.extend(FilterableMixin, {
itemController: constants.namingConventions.udf,
+ fileResources: [],
sortAscending: true,
sortProperties: [],
- init: function () {
- this._super();
-
- this.set('columns', Ember.ArrayProxy.create({ content: Ember.A([
- Ember.Object.create({
- caption: 'placeholders.udfs.name',
- property: 'name'
- }),
- Ember.Object.create({
- caption: 'placeholders.udfs.className',
- property: 'classname'
- })
- ])}));
- },
-
//row buttons
links: [
'buttons.edit',
'buttons.delete'
],
+ columns: [
+ Ember.Object.create({
+ caption: 'placeholders.udfs.name',
+ property: 'name'
+ }),
+ Ember.Object.create({
+ caption: 'placeholders.udfs.className',
+ property: 'classname'
+ })
+ ],
+
model: function () {
return this.filter(this.get('udfs'));
}.property('udfs', 'filters.@each'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
index 9501301..8401388 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
@@ -20,6 +20,8 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Controller.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
needs: [ constants.namingConventions.index,
constants.namingConventions.openQueries,
constants.namingConventions.jobProgress ],
@@ -53,8 +55,8 @@ export default Ember.Controller.extend({
if (json['STAGE PLANS']['Stage-1']) {
self.set('json', json);
}
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
index 09d57b5..ab73c63 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
@@ -63,10 +63,15 @@ TRANSLATIONS = {
},
success: {
sessions: {
- deleted: 'Session invalidated'
+ deleted: 'Session invalidated.'
},
settings: {
saved: 'Settings have been saved.'
+ },
+ query: {
+ execution: 'Query has been submitted.',
+ save: 'The query has been saved.',
+ update: 'The query has been updated.'
}
}
},
@@ -224,5 +229,20 @@ TRANSLATIONS = {
}
},
+ emptyList: {
+ history: {
+ noItems: "No queries were run.",
+ noMatches: "No jobs match your filtering criteria",
+ },
+ savedQueries: {
+ noItems: "No queries were saved.",
+ noMatches: "No queries match your filtering criteria"
+ }
+ },
+
+ settings: {
+ parsed: "Query settings added"
+ },
+
generalError: 'Unexpected error'
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js
deleted file mode 100644
index cf9d64a..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
-* 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.
-*/
-export default {
- name: 'notify',
- initialize: function (container, app) {
- app.inject('route', 'notify', 'service:notify');
- app.inject('controller', 'notify', 'service:notify');
- app.inject('component', 'notify', 'service:notify');
- app.inject('views', 'notify', 'service:notify');
- }
-};
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
index 245937a..11b93a1 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
@@ -20,19 +20,15 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
- setupController: function () {
- var self = this;
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
- this.store.find(constants.namingConventions.database).then(function (databases) {
- self.controllerFor(constants.namingConventions.databases).set('model', databases);
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
- });
+ setupController: function (controller, model) {
+ var self = this;
this.store.find(constants.namingConventions.udf).then(function (udfs) {
self.controllerFor(constants.namingConventions.udfs).set('udfs', udfs);
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
},
@@ -74,7 +70,7 @@ export default Ember.Route.extend({
},
removeNotification: function (notification) {
- this.notify.removeNotification(notification);
+ this.get('notifyService').removeNotification(notification);
},
willTransition: function(transition) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
index 5363f7e..848bee8 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
@@ -20,11 +20,13 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
model: function () {
var self = this;
- return this.store.find(constants.namingConventions.job).catch(function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ return this.store.find(constants.namingConventions.job).catch(function (error) {
+ self.get('notifyService').error(error);
});
},
@@ -35,8 +37,8 @@ export default Ember.Route.extend({
var filteredModel = model.filter(function (job) {
//filter out jobs with referrer type of sample, explain and visual explain
- return !job.get('referrer') ||
- job.get('referrer') === constants.jobReferrer.job;
+ return (!job.get('referrer') || job.get('referrer') === constants.jobReferrer.job) &&
+ !!job.get('id');
});
controller.set('history', filteredModel);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
index 6ed55b5..29e144b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
@@ -20,9 +20,13 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
model: function () {
- return this.store.find(constants.namingConventions.savedQuery).catch(function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ var self = this;
+
+ return this.store.find(constants.namingConventions.savedQuery).catch(function (error) {
+ self.get('notifyService').error(error);
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
index 9093197..5a96cd6 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
@@ -20,13 +20,17 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
- setupController: function () {
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
+ setupController: function (controller, model) {
+ this._super();
+
var self = this;
this.store.find(constants.namingConventions.fileResource).then(function (fileResources) {
- self.controllerFor(constants.namingConventions.fileResources).set('model', fileResources);
- }).catch(function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ controller.set('fileResources', fileResources);
+ }).catch(function (error) {
+ self.get('notifyService').error(error);
});;
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
new file mode 100644
index 0000000..6b4df6f
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
@@ -0,0 +1,227 @@
+/**
+ * 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 constants from 'hive/utils/constants';
+
+export default Ember.Service.extend({
+ store: Ember.inject.service(),
+
+ pageCount: 10,
+ selectedDatabase: null,
+ selectedTables: null,
+ databases: [],
+
+ init: function () {
+ this._super();
+
+ var databaseAdapter = this.container.lookup('adapter:database');
+ var baseUrl = databaseAdapter.buildURL() + '/' +
+ databaseAdapter.pathForType(constants.namingConventions.database) + '/';
+
+ this.set('baseUrl', baseUrl);
+ },
+
+ getDatabases: function () {
+ var defer = Ember.RSVP.defer();
+ var self = this;
+
+ this.get('store').unloadAll(constants.namingConventions.database);
+ this.get('store').fetchAll(constants.namingConventions.database).then(function (databases) {
+ self.set('databases', databases);
+ defer.resolve(databases);
+ }, function (error) {
+ defer.reject(error);
+ })
+
+ return defer.promise;
+ },
+
+ setDatabaseByName: function (name) {
+ var database = this.databases.findBy('name', name);
+
+ if (database) {
+ this.set('selectedDatabase', database);
+ }
+ },
+
+ getColumnsPage: function (databaseName, table, searchTerm, firstSearchPage) {
+ var defer = Ember.RSVP.defer();
+
+ var url = this.get('baseUrl') +
+ databaseName +
+ '/table/' +
+ table.get('name');
+
+ url += '.page?searchId&count=' + this.get('pageCount');
+ url += '&columns=3,5';
+
+ if (searchTerm) {
+ url += '&searchId=searchColumns' + '&like=' + searchTerm;
+
+ if (firstSearchPage) {
+ url += '&first=true';
+ }
+ } else if (!table.get('columns.length')) {
+ url += '&first=true';
+ }
+
+ Ember.$.getJSON(url).then(function (data) {
+ Ember.run(function () {
+ var columns;
+
+ columns = data.rows.map(function (row) {
+ return Ember.Object.create({
+ name: row[0],
+ type: row[1]
+ });
+ });
+
+ defer.resolve({
+ columns: columns,
+ hasNext: data.hasNext
+ });
+ });
+ }, function (err) {
+ defer.reject(err);
+ });
+
+ return defer.promise;
+ },
+
+ getTablesPage: function (database, searchTerm, firstSearchPage) {
+ var defer = Ember.RSVP.defer(),
+ url = this.get('baseUrl') +
+ database.get('name') +
+ '/table.page?count=';
+
+ url += this.get('pageCount');
+
+ if (searchTerm) {
+ url += '&searchId=searchTables' + '&like=' + searchTerm;
+
+ if (firstSearchPage) {
+ url += '&first=true';
+ }
+ } else if (!database.get('tables.length')) {
+ url += '&first=true';
+ }
+
+ Ember.$.getJSON(url).then(function (data) {
+ var tables;
+
+ tables = data.rows.map(function (row) {
+ return Ember.Object.create({
+ name: row[0]
+ });
+ });
+
+ defer.resolve({
+ tables: tables,
+ hasNext: data.hasNext
+ });
+ }, function (err) {
+ defer.reject(err);
+ });
+
+ return defer.promise;
+ },
+
+ getAllTables: function (db) {
+ var defer = Ember.RSVP.defer();
+ var database = db || this.get('selectedDatabase');
+ var self;
+ var url;
+
+ if (!database) {
+ defer.resolve();
+ } else if (database.tables && !database.get('hasNext')) {
+ this.set('selectedTables', database.tables.mapProperty('name'));
+ defer.resolve();
+ } else {
+ self = this;
+ url = this.get('baseUrl') + database.get('name') + '/table';
+
+ Ember.$.getJSON(url).then(function (data) {
+ var tables = data.tables.map(function (table) {
+ return Ember.Object.create({
+ name: table
+ });
+ });
+
+ //don't use Ember.Object.set since it can be very expensive for large collections (e.g. 15000 tables),
+ //thus we should not do any bindings directly on the 'tables' collection.
+ database.tables = tables;
+
+ Ember.run(function () {
+ self.set('selectedTables', tables.mapProperty('name'));
+ });
+
+ defer.resolve();
+ }, function (err) {
+ defer.reject(err);
+ });
+ }
+
+ return defer.promise;
+ },
+
+ getAllColumns: function (tableName, db) {
+ var database = db || this.get('selectedDatabase');
+ var defer = Ember.RSVP.defer();
+ var table;
+ var self;
+ var url;
+
+ if (!database) {
+ defer.resolve();
+ } else {
+ table = database.tables.findBy('name', tableName);
+
+ if (!table) {
+ defer.resolve();
+ } else if (table.columns && !table.get('hasNext')) {
+ this.get('selectedTables')[tableName] = table.columns.mapProperty('name');
+ defer.resolve();
+ } else {
+ self = this;
+ url = this.get('baseUrl') + database.get('name') + '/table/' + tableName
+
+ Ember.$.getJSON(url).then(function (data) {
+ var columns = data.columns.map(function (column) {
+ return Ember.Object.create({
+ name: column[0],
+ type: column[1]
+ });
+ });
+
+ table.columns = columns;
+ table.set('hasNext', false);
+
+ self.get('selectedTables')[tableName] = columns.mapProperty('name');
+
+ defer.resolve();
+ }, function (err) {
+ defer.reject(err);
+ });
+ }
+ }
+
+ return defer.promise;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js
new file mode 100644
index 0000000..7f01795
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js
@@ -0,0 +1,59 @@
+/**
+ * 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 constants from 'hive/utils/constants';
+
+export default Ember.Service.extend({
+ files: [],
+ store: Ember.inject.service(),
+
+ loadFile: function (path) {
+ var self = this;
+ var defer = Ember.RSVP.defer();
+ var file = this.files.findBy('id', path);
+
+ if (file) {
+ defer.resolve(file);
+ } else {
+ this.get('store').find(constants.namingConventions.file, path).then(function (file) {
+ defer.resolve(self.files.pushObject(file));
+ }, function (err) {
+ defer.reject(err);
+ });
+ }
+
+ return defer.promise;
+ },
+
+ reloadFile: function (path) {
+ var defer = Ember.RSVP.defer();
+
+ this.get('store').find(constants.namingConventions.file, path).then(function (file) {
+ file.reload().then(function (reloadedFile) {
+ defer.resolve(reloadedFile);
+ }, function (err) {
+ defer.reject(err);
+ });
+ }, function (err) {
+ defer.reject(err);
+ });
+
+ return defer.promise;
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js
new file mode 100644
index 0000000..3a1f82a
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.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.Service.extend({
+ stopJob: function (job) {
+ var self = this;
+ var id = job.get('id');
+ var url = this.container.lookup('adapter:application').buildURL();
+ url += "/jobs/" + id;
+
+ job.set('isCancelling', true);
+
+ Ember.$.ajax({
+ url: url,
+ type: 'DELETE',
+ headers: {
+ 'X-Requested-By': 'ambari',
+ },
+ success: function () {
+ job.reload();
+ }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
index 38e88c3..6ca4d11 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
@@ -47,7 +47,21 @@ export default Ember.Service.extend({
this.add(this.types.WARN, message, body);
},
- error: function (message, body) {
+ error: function (error) {
+ var message,
+ body;
+
+ if (error.responseJSON) {
+ message = error.responseJSON.message;
+ body = error.responseJSON.trace;
+ } else if (error.errorThrown) {
+ message = error.errorThrown;
+ } else if (error.message) {
+ message = error.message;
+ } else {
+ message = error;
+ }
+
this.add(this.types.ERROR, message, body);
},
@@ -84,7 +98,7 @@ export default Ember.Service.extend({
},
removeAllMessages: function () {
- this.messages.removeAt(0, this.messages.get('length'));
+ this.messages.clear();
},
markMessagesAsSeen: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
index 3ae64ec..7be5dcc 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
@@ -26,6 +26,36 @@ a {
word-wrap: break-word;
}
+@keyframes flash {
+ 0% {
+ background-color: transparent;
+ }
+
+ 25% {
+ background-color: #428bca;
+ color: #fff;
+ }
+
+ 50% {
+ background-color: transparent;
+ color: #333;
+ }
+
+ 75% {
+ background-color: #428bca;
+ color: #fff;
+ }
+
+ 100% {
+ background-color: transparent;
+ color: #333;
+ }
+}
+
+.flash {
+ animation: flash 1s;
+}
+
@-webkit-keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
@@ -56,6 +86,10 @@ a {
animation-name: fadeOut;
}
+.empty-list {
+ text-align: center;
+}
+
#content {
padding: 20px 0;
}
@@ -112,7 +146,7 @@ aside {
.toolbox {
margin: 15px 15px 0 0;
- insert-udfs {
+ .insert-udfs {
display: inline-block;
}
}
@@ -231,8 +265,7 @@ dropdown .fa-remove {
}
.main-content {
- width: 90%;
- flex-grow: 1;
+ width: 100%;
}
.queries-icon {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
index 2242a4f..db053fa 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
@@ -16,8 +16,8 @@
* limitations under the License.
}}
-{{notify-widget notifications=notify.notifications}}
-{{render 'navbar'}}
+{{notify-widget notifications=notifications}}
+{{navbar-widget}}
<div id="content">
{{outlet}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs
deleted file mode 100644
index 4083ad6..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs
+++ /dev/null
@@ -1,17 +0,0 @@
-{{!
-* 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.
-}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs
new file mode 100644
index 0000000..6b01946
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs
@@ -0,0 +1,49 @@
+{{!
+* 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 class="main-row" {{action "requestFile"}}>
+ <td>
+ {{#link-to "index.historyQuery" job}}
+ {{job.title}}
+ {{/link-to}}
+ </td>
+ <td {{bind-attr class=job.uppercaseStatus}}>{{all-uppercase job.status}}</td>
+ <td>{{date-binding job "dateSubmittedTimestamp"}}</td>
+ <td>{{job.duration}}</td>
+ <td>
+ <a class="fa fa-expand pull-right"></a>
+ </td>
+</tr>
+{{#if expanded}}
+ <tr class="secondary-row">
+ <td colspan="5">
+ {{code-helper job.file.fileContent}}
+
+ {{#if canStop}}
+ <button type="button" {{bind-attr class=":btn :btn-warning :btn-sm :pull-right job.isCancelling:disabled"}} {{action "stopJob"}}>
+ {{#if job.isCancelling}}
+ {{t "buttons.stoppingJob"}}
+ <div class="spinner small inline-spinner"></div>
+ {{else}}
+ {{t "buttons.stopJob"}}
+ {{/if}}
+ </button>
+ {{/if}}
+ </td>
+ </tr>
+{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs
new file mode 100644
index 0000000..f8f6bcb
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs
@@ -0,0 +1,45 @@
+{{!
+* 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.
+}}
+
+<nav class="navbar navbar-default no-margin" role="navigation">
+ <div class="container-fluid">
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ {{#link-to "index" classNames="navbar-brand"}}
+ {{view.title}}
+ {{/link-to}}
+ </div>
+
+ <!-- Collect the nav links, forms, and other content for toggling -->
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ {{#each item in view.items}}
+ {{#link-to item.path tagName="li"}}
+ <a>{{tb-helper "text" item}}</a>
+ {{/link-to}}
+ {{/each}}
+ </ul>
+ </div>
+ </div>
+</nav>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs
deleted file mode 100644
index 4083ad6..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs
+++ /dev/null
@@ -1,17 +0,0 @@
-{{!
-* 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.
-}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
index bdac484..45a9b7f 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
@@ -17,7 +17,7 @@
}}
<div class="databases">
- {{#each database in content}}
+ {{#each database in databases}}
{{#collapsible-widget heading=database.name isExpanded=database.isExpanded iconClass="fa-database" expanded="getTables" toggledParam=database}}
{{#if database.isExpanded}}
<div class="tables">
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
index 392b8f3..068478b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
@@ -17,10 +17,10 @@
}}
{{#panel-widget headingTranslation="titles.database" isLoading=isLoading classNames="database-explorer" iconActions=panelIconActions}}
- {{#if model}}
+ {{#if databases}}
{{typeahead-widget
- content=model
+ content=databases
optionValuePath="id"
optionLabelPath="name"
selection=selectedDatabase
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
index d98fbcd..f3f3938 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
@@ -40,38 +40,24 @@
</tr>
</thead>
<tbody>
- {{#each item in this}}
- <tr class="main-row" {{action "loadFile"}}>
- <td>
- {{#link-to "index.historyQuery" item}}
- {{item.title}}
- {{/link-to}}
- </td>
- <td {{bind-attr class=item.uppercaseStatus}}>{{all-uppercase item.status}}</td>
- <td>{{date-binding item "dateSubmittedTimestamp"}}</td>
- <td>{{item.duration}}</td>
- <td>
- <a class="fa fa-expand pull-right"></a>
- </td>
- </tr>
- {{#if controller.expanded}}
- <tr class="secondary-row">
- <td {{bind-attr colspan=view.colspan}}>
- {{code-helper controller.file.fileContent}}
-
- {{#if controller.canStop}}
- <button type="button" class="btn btn-danger btn-sm pull-right" {{action "stop"}}>
- {{#if item.isCancelling}}
- {{t "buttons.stoppingJob"}}
- <div class="spinner small inline-spinner"></div>
- {{else}}
- {{t "buttons.stopJob"}}
- {{/if}}
- </button>
- {{/if}}
+ {{#if history.length}}
+ {{#if model.length}}
+ {{#each item in model}}
+ {{job-tr-view job=item onStopJob="interruptJob" onFileRequested="loadFile"}}
+ {{/each}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.history.noMatches"}}</h4>
</td>
</tr>
{{/if}}
- {{/each}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.history.noItems"}}</h4>
+ </td>
+ </tr>
+ {{/if}}
</tbody>
-</table>
\ No newline at end of file
+</table>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
index b6f27aa..2fdf0ce 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
@@ -27,14 +27,22 @@
{{render 'open-queries'}}
<div class="toolbox">
- <button type="button"
- {{bind-attr class=":btn :btn-sm :btn-success :execute-query canExecute::disabled"}}
- {{action "executeQuery"}}>
- {{t "buttons.execute"}}
- </button>
- <button type="button"
- {{bind-attr class=":btn :btn-sm :btn-default canExecute::disabled"}}
- {{action "explainQuery"}}>
+ {{#if canExecute}}
+ <button type="button" class="btn btn-sm btn-success execute-query" {{action "executeQuery"}}>
+ {{t "buttons.execute"}}
+ </button>
+ {{else}}
+ <button type="button" {{bind-attr class=":btn :btn-sm :btn-warning model.isCancelling:disabled"}} {{action "stopCurrentJob"}}>
+ {{#if model.isCancelling}}
+ {{t "buttons.stoppingJob"}}
+ <div class="spinner small inline-spinner"></div>
+ {{else}}
+ {{t "buttons.stopJob"}}
+ {{/if}}
+ </button>
+ {{/if}}
+
+ <button type="button" {{bind-attr class=":btn :btn-sm :btn-default canExecute::disabled"}} {{action "explainQuery"}}>
{{t "buttons.explain"}}
</button>
@@ -46,9 +54,11 @@
</div>
{{/panel-widget}}
- {{#if jobProgress.stages}}
- {{#progress-widget value=jobProgress.totalProgress}}
- {{/progress-widget}}
+ {{#if displayJobTabs}}
+ {{#if jobProgress.stages.length}}
+ {{#progress-widget value=jobProgress.totalProgress}}
+ {{/progress-widget}}
+ {{/if}}
{{/if}}
{{#if queryParams}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
index 0911835..f01104b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
@@ -17,7 +17,7 @@
}}
{{#if this.length}}
- <div class="dropdown">
+ <div class="dropdown insert-udfs">
<a role="button" data-toggle="dropdown" class="btn btn-default btn-sm" data-target="#">
{{t "placeholders.select.udfs"}}
<span class="caret"></span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs
deleted file mode 100644
index f8f6bcb..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs
+++ /dev/null
@@ -1,45 +0,0 @@
-{{!
-* 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.
-}}
-
-<nav class="navbar navbar-default no-margin" role="navigation">
- <div class="container-fluid">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- {{#link-to "index" classNames="navbar-brand"}}
- {{view.title}}
- {{/link-to}}
- </div>
-
- <!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
- <ul class="nav navbar-nav">
- {{#each item in view.items}}
- {{#link-to item.path tagName="li"}}
- <a>{{tb-helper "text" item}}</a>
- {{/link-to}}
- {{/each}}
- </ul>
- </div>
- </div>
-</nav>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
index 692a462..c71a03b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
@@ -40,41 +40,57 @@
</tr>
</thead>
<tbody>
- {{#each query in this}}
- {{#unless query.isNew}}
- <tr>
- <td>
- {{#link-to "index.savedQuery" query}}
- {{query.shortQuery}}
- {{/link-to}}
- </td>
+ {{#if queries.length}}
+ {{#if model.length}}
+ {{#each query in model}}
+ {{#unless query.isNew}}
+ <tr>
+ <td>
+ {{#link-to "index.savedQuery" query}}
+ {{query.shortQuery}}
+ {{/link-to}}
+ </td>
- <td>
- {{#link-to "index.savedQuery" query}}
- {{query.title}}
- {{/link-to}}
- </td>
+ <td>
+ {{#link-to "index.savedQuery" query}}
+ {{query.title}}
+ {{/link-to}}
+ </td>
- <td>{{query.dataBase}}</td>
+ <td>{{query.dataBase}}</td>
- <td>{{query.owner}}</td>
+ <td>{{query.owner}}</td>
- <td>
- {{#unless query.isNew}}
- <div class="btn-group pull-right">
- <span data-toggle="dropdown">
- <a class="fa fa-gear"></a>
- </span>
- <ul class="dropdown-menu" role="menu">
- {{#each link in controller.links}}
- <li {{action 'executeAction' link query}}><a>{{tb-helper link}}</a></li>
- {{/each}}
- </ul>
- </div>
- {{/unless}}
+ <td>
+ {{#unless query.isNew}}
+ <div class="btn-group pull-right">
+ <span data-toggle="dropdown">
+ <a class="fa fa-gear"></a>
+ </span>
+ <ul class="dropdown-menu" role="menu">
+ {{#each link in controller.links}}
+ <li {{action 'executeAction' link query}}><a>{{tb-helper link}}</a></li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/unless}}
+ </td>
+ </tr>
+ {{/unless}}
+ {{/each}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.savedQueries.noMatches"}}</h4>
</td>
</tr>
- {{/unless}}
- {{/each}}
+ {{/if}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.savedQueries.noItems"}}</h4>
+ </td>
+ </tr>
+ {{/if}}
</tbody>
-</table>
\ No newline at end of file
+</table>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
index c170e02..bea77ba 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
@@ -17,7 +17,7 @@
}}
{{#each tab in tabs}}
- <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active" title="tab.tooltip" id="tab.id"}}>
+ <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active tab.flash:flash" title="tab.tooltip" id="tab.id"}}>
{{#if tab.badge}}
<span class="badge">{{tab.badge}}</span>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
index 5bb8759..9d057db 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
@@ -58,7 +58,7 @@
placeholderTranslation="placeholders.fileResource.path"
value=udf.fileResource.path}}
{{else}}
- {{select-widget items=controller.fileResources
+ {{select-widget items=fileResources
selectedValue=udf.fileResource
labelPath="name"
defaultLabelTranslation="placeholders.select.file"
@@ -74,7 +74,7 @@
{{/if}}
{{/if}}
</td>
- {{#each column in controller.columns}}
+ {{#each column in columns}}
<td>
{{#if udf.isEditing}}
{{extended-input type="text"
@@ -99,7 +99,7 @@
<a class="fa fa-gear"></a>
</span>
<ul class="dropdown-menu" role="menu">
- {{#each link in controller.links}}
+ {{#each link in links}}
<li {{action 'executeAction' link}}><a>{{tb-helper link}}</a></li>
{{/each}}
</ul>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
index d63c5ce..0539463 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
@@ -65,11 +65,10 @@ export default Ember.Object.create({
databases: 'databases',
openQueries: 'open-queries',
visualExplain: 'visual-explain',
+ notify: 'notify',
tezUI: 'tez-ui',
file: 'file',
fileResource: 'file-resource',
- fileResources: 'file-resources',
- loadedFiles: 'loaded-files',
alerts: 'alerts',
logs: 'logs',
results: 'results',
@@ -78,8 +77,6 @@ export default Ember.Object.create({
jobExplain: 'index/history-query/explain',
databaseTree: 'databases-tree',
databaseSearch: 'databases-search-results',
- tables: 'tables',
- columns: 'columns',
settings: 'settings',
settingsQuery: 'settings-query',
settingsGlobal: 'settings-global',
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
index f7756fc..afd959b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
@@ -54,10 +54,10 @@ export default Ember.Object.create({
var args = Array.prototype.slice.call(arguments, 1);
if (!sourceString) {
- return;
+ return false;
}
- return args.find(function (arg) {
+ return !!args.find(function (arg) {
return sourceString.match(new RegExp('^' + arg + '$', 'i'));
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js
deleted file mode 100644
index 8a914f0..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.View.extend({
- colspan: function () {
- return this.get('controller.columns.length') + 1;
- }.property('controller.columns')
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js
deleted file mode 100644
index 70ed640..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.View.extend({
- tagName: 'insert-udfs'
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js
deleted file mode 100644
index 0c535db..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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 constants from 'hive/utils/constants';
-
-export default Ember.View.extend({
- title: constants.appTitle,
-
- items: Ember.A([
- Ember.Object.create({text: 'menus.query',
- path: constants.namingConventions.routes.index}),
-
- Ember.Object.create({text: 'menus.savedQueries',
- path: constants.namingConventions.routes.queries}),
-
- Ember.Object.create({text: 'menus.history',
- path: constants.namingConventions.routes.history}),
-
- Ember.Object.create({text: 'menus.udfs',
- path: constants.namingConventions.routes.udfs})
- ])
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
index 52d92b6..d2a800c 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
@@ -22,9 +22,10 @@ import Ember from 'ember';
import dagRules from '../utils/dag-rules';
export default Ember.View.extend({
+ verticesGroups: [],
+ edges: [],
+
willInsertElement: function () {
- this.set('verticesGroups', []);
- this.set('edges', []);
this.set('graph', new dagre.graphlib.Graph());
},
@@ -111,12 +112,7 @@ export default Ember.View.extend({
angle = 180 + angle;
}
- var style = "left: %@px; top: %@px; width: %@px;" +
- "-moz-transform:rotate(%@4deg);" +
- "-webkit-transform:rotate(%@4deg);" +
- "-ms-transform:rotate(%@4deg);" +
- "-transform:rotate(%@4deg);";
-
+ var style = "left: %@px; top: %@px; width: %@px; transform:rotate(%@4deg);";
style = style.fmt(cx, cy, length, angle);
var edgeType;
@@ -417,12 +413,15 @@ export default Ember.View.extend({
Ember.run.later(function () {
g.edges().forEach(function (value) {
- var firstNode = self.$("[title='" + value.v + "']")[0];
- var secondNode = self.$("[title='" + value.w + "']")[0];
+ var firstNode = self.$("[title='" + value.v + "']");
+ var secondNode = self.$("[title='" + value.w + "']");
+
+ if (firstNode && secondNode) {
+ self.addEdge(firstNode[0], secondNode[0], 2, g.edge(value).type);
+ }
- self.addEdge(firstNode, secondNode, 2, g.edge(value).type);
});
- }, 200);
+ }, 400);
},
renderDag: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/bower.json b/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
index 24e8821..37ea901 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
@@ -9,9 +9,9 @@
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.1.3",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
- "ember-qunit": "0.2.8",
+ "ember-qunit": "0.4.0",
"ember-qunit-notifications": "0.0.7",
- "qunit": "~1.17.1",
+ "qunit": "1.18.0",
"bootstrap": "~3.2.0",
"ember-i18n": "~3.0.0",
"blanket": "~1.1.5",
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/package.json
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/package.json b/contrib/views/hive/src/main/resources/ui/hive-web/package.json
index 8b5f669..6ecdcb6 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/package.json
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/package.json
@@ -25,6 +25,7 @@
"broccoli-asset-rev": "^2.0.0",
"broccoli-sass": "0.6.3",
"ember-cli": "0.2.2",
+ "ember-cli-autoprefixer": "0.4.1",
"ember-cli-blanket": "^0.5.0",
"ember-cli-content-security-policy": "0.3.0",
"ember-cli-font-awesome": "0.0.4",
@@ -34,12 +35,12 @@
"ember-cli-jquery-ui": "0.0.12",
"ember-cli-moment": "0.0.1",
"ember-cli-pretender": "^0.3.1",
- "ember-cli-qunit": "0.3.9",
+ "ember-cli-qunit": "0.3.14",
"ember-cli-selectize": "0.0.19",
+ "ember-cli-uglify": "1.0.1",
"ember-data": "1.0.0-beta.16.1",
"ember-dynamic-component": "0.0.1",
"ember-export-application-global": "^1.0.0",
- "express": "^4.8.5",
- "ember-cli-uglify": "1.0.1"
+ "express": "^4.8.5"
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/testem.json b/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
index 5a8d375..78029a1 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
@@ -5,7 +5,6 @@
"PhantomJS"
],
"launch_in_dev": [
- "PhantomJS",
"Chrome"
]
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
index 39487fa..2898863 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
@@ -22,7 +22,7 @@ export default function() {
var baseUrl = applicationAdapter.create().buildURL();
var databases = ['db1', 'db2', 'db3'];
- this.get(baseUrl + '/resources/ddl/database', function(req) {
+ this.get(baseUrl + '/resources/ddl/database', function (req) {
var db = {
databases: databases
};
@@ -67,7 +67,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(columns)];
});
- this.get(baseUrl + '/udfs', function(req) {
+ this.get(baseUrl + '/udfs', function (req) {
var udf = {
"udfs": [{
"name": "TestColumn",
@@ -88,7 +88,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(udf)];
});
- this.post(baseUrl + '/jobs', function(req) {
+ this.post(baseUrl + '/jobs', function (req) {
var job = {
"job": {
"status":"Finished",
@@ -112,7 +112,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(job)];
});
- this.get(baseUrl + '/resources/file/job1.hql', function(req) {
+ this.get(baseUrl + '/resources/file/job1.hql', function (req) {
var file = {
"file": {
"filePath": "job1.hql",
@@ -148,7 +148,15 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(savedQueries)];
});
- this.get(baseUrl + '/resources/file/saved1.hql', function(req) {
+ this.get(baseUrl + '/savedQueries/defaultSettings', function (req) {
+ var defaultSettings = {
+ "defaultSettings" : []
+ };
+
+ return [200, {"Content-Type": "application/json"}, JSON.stringify(defaultSettings)];
+ });
+
+ this.get(baseUrl + '/resources/file/saved1.hql', function (req) {
var file = {
"file": {
"filePath": "saved1.hql",
@@ -162,7 +170,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(file)];
});
- this.get(baseUrl + '/jobs', function(req) {
+ this.get(baseUrl + '/jobs', function (req) {
var jobs = {
"jobs": [
{
@@ -223,7 +231,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(jobs)];
});
- this.get(baseUrl + '/fileResources', function(req) {
+ this.get(baseUrl + '/fileResources', function (req) {
var files = {
"fileResources": [
{
@@ -238,7 +246,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(files)];
});
- this.get(baseUrl + '/fileResources/1', function(req) {
+ this.get(baseUrl + '/fileResources/1', function (req) {
var files = {
"fileResources": [
{
@@ -252,4 +260,31 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(files)];
});
+
+ this.get(baseUrl + '/api/v1/views/TEZ', function (req) {
+ var data = {
+ versions: [
+ {
+ href: baseUrl + '/api/v1/view/TEZ/instanceURL'
+ }
+ ]
+ };
+
+ return [200, {"Content-Type": "application/json"}, JSON.stringify(data)];
+ });
+
+ this.get(baseUrl + '/api/v1/views/TEZ/instanceURL', function (req) {
+ var data = {
+ instances: [
+ {
+ ViewInstanceInfo: {
+ instance_name: 'tez',
+ version: 1
+ }
+ }
+ ]
+ };
+
+ return [200, {"Content-Type": "application/json"}, JSON.stringify(data)];
+ });
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
index e029055..ab1a9d2 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
@@ -37,7 +37,7 @@ export default function startApp(attrs) {
App.injectTestHelpers();
});
- App.reset(); // this shouldn't be needed, i want to be able to "start an app at a specific URL"
+ // App.reset(); // this shouldn't be needed, i want to be able to "start an app at a specific URL"
return App;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
index 604da58..52cda77 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
@@ -36,8 +36,8 @@ module('Integration: Databases', {
}
});
-test('Database Explorer is displayed and populated with databases from server.', function() {
- expect(2);
+test('Database Explorer is displayed and populated with databases from server.', function (assert) {
+ assert.expect(2);
visit('/');
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
index 19c2356..b409e12 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
@@ -47,13 +47,20 @@ test('Query Editor is visible', function() {
});
});
-test('Can execute query', function() {
- expect(1);
+test('Can execute query either with full or partial selection', function() {
+ expect(3);
+
+ var query1 = "select count(*) from table1;",
+ query2 = "select color from z;",
+ query3 = "select fruit from z;",
+ query4 = query2 + "\n" + query3,
+ editor;
visit("/");
Ember.run(function() {
- find('.CodeMirror').get(0).CodeMirror.setValue('select count(*) from table1');
+ editor = find('.CodeMirror').get(0).CodeMirror;
+ editor.setValue(query1);
});
click('.execute-query');
@@ -61,6 +68,18 @@ test('Can execute query', function() {
andThen(function() {
equal(find('.query-process-results-panel').length, 1, 'Job tabs are visible.');
});
+
+ Ember.run(function() {
+ editor.setValue(query4);
+ editor.setSelection({ line: 1, ch: 0 }, { line: 1, ch: 20 });
+ });
+
+ click('.execute-query');
+
+ andThen(function() {
+ equal(editor.getValue(), query4, 'Editor value didn\'t change');
+ equal(editor.getSelection(), query3, 'Query 3 is selected');
+ });
});
@@ -76,33 +95,12 @@ test('Can save query', function() {
Ember.run(function() {
find('.CodeMirror').get(0).CodeMirror.setValue('select count(*) from table1');
});
+
click('.save-query-as');
andThen(function() {
equal(find('.modal-dialog').length, 1, 'Modal dialog is shown');
});
- click('.modal-dialog .modal-footer .btn-danger');
-});
-
-test('Can execute selection', function() {
- expect(2);
- visit('/');
-
- var query1 = "select color from z;",
- query2 = "select fruit from z;",
- query = query1 + "\n" + query2,
- editor;
-
- Ember.run(function() {
- editor = find('.CodeMirror').get(0).CodeMirror;
- editor.setValue(query);
- editor.setSelection({ line: 1, ch: 0 }, { line: 1, ch: 20 });
- });
- click('.execute-query');
-
- andThen(function() {
- equal(editor.getValue(), query, 'Editor value didn\'t change');
- equal(editor.getSelection(), query2, 'Query 2 is selected');
- });
+ click('.modal-footer .btn-danger');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js
new file mode 100644
index 0000000..f64dcb2
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js
@@ -0,0 +1,49 @@
+/**
+ * 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 { test } from 'ember-qunit';
+import startApp from '../helpers/start-app';
+import api from '../helpers/api-mock';
+
+var App;
+var server;
+
+module('Integration: Tez UI', {
+ setup: function() {
+ App = startApp();
+ /* global Pretender: true */
+ server = new Pretender(api);
+ },
+
+ teardown: function() {
+ Ember.run(App, App.destroy);
+ server.shutdown();
+ }
+});
+
+test('An error is show when there is no dag', function() {
+ expect(1);
+
+ visit("/");
+ click('#tez-icon');
+
+ andThen(function() {
+ ok(find('.panel .alert .alert-danger'), 'Error is visible');
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
index 09e3c1b..6e28a40 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
@@ -44,5 +44,5 @@ test('buildUrl returns an url with default values for version and instance param
var url = adapter.buildURL();
- equal(url, constants.adapter.apiPrefix + '0.2.0' + constants.adapter.instancePrefix + 'Hive');
+ equal(url, constants.adapter.apiPrefix + constants.adapter.version + constants.adapter.instancePrefix + 'Hive');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
index 2f25bab..96a551f 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
@@ -18,7 +18,9 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
-moduleForComponent('collapsible-widget', 'CollapsibleWidgetComponent');
+moduleForComponent('collapsible-widget', 'CollapsibleWidgetComponent', {
+ unit: true
+});
test('Component expand/collapse toggle action', function () {
expect(1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
index 2afe669..be8bdc4 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
@@ -45,7 +45,7 @@ test('if a filterValue is set when the element is inserted, an action is being s
component.set('columnFiltered', 'externalAction');
component.set('targetObject', targetObject);
- var $component = this.render();
+ var $component = this.$();
});
test('isSorted returns true if the table is sorted by this column property', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
index 13a3e89..766e9ee 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
@@ -44,7 +44,7 @@ test('Date fields are set correctly', function() {
component.set('dateRange', Ember.Object.create());
- var $component = this.render();
+ var $component = this.$();
Ember.run(function() {
component.set('dateRange', dateRange);
@@ -75,7 +75,7 @@ test('Date fields updates when the date is changed', function() {
component.set('dateRange', dateRange);
});
- var $component = this.render();
+ var $component = this.$();
$component.find('.fromDate').datepicker('setDate', '10/10/2014');
$component.find('.toDate').datepicker('setDate', '11/11/2014');
@@ -125,7 +125,7 @@ test('If from/to are not passed they are set to min/max', function() {
component.set('dateRange', dateRange);
});
- var $component = this.render();
+ var $component = this.$();
equal(component.get('dateRange.from'), min.toString(), "From date is to min date");
equal(component.get('dateRange.to'), max.toString(), "To date is set to max date");
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
index 2b34af5..8d1f07a 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
@@ -20,13 +20,14 @@ import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('expander-widget', 'ExpanderWidgetComponent', {
+ unit: true
});
test('should set the heading when provided.', function () {
expect(2);
var component = this.subject();
- var $component = this.render();
+ var $component = this.$();
var heading = 'some header';
equal($component.find('.accordion-toggle').text(), '');
@@ -42,7 +43,7 @@ test('should correctly toggle isExpanded property.', function () {
expect(2);
var component = this.subject();
- this.render();
+ this.$();
Ember.run(function(){
component.send('toggle');