AMBARI-19981. Hive View 2.0: Enable Notifications. (dipayanb)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6c4cbc4f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6c4cbc4f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6c4cbc4f Branch: refs/heads/branch-feature-AMBARI-12556 Commit: 6c4cbc4f7efddd55e063dbff470fa04eee2e68bf Parents: a6445ac Author: Dipayan Bhowmick <[email protected]> Authored: Mon Feb 13 18:59:11 2017 +0530 Committer: Dipayan Bhowmick <[email protected]> Committed: Mon Feb 13 18:59:54 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/create-table.js | 6 +++- .../resources/ui/app/configs/file-format.js | 4 ++- .../resources/ui/app/controllers/messages.js | 30 ++++++++++++++++ .../ui/app/controllers/messages/message.js | 31 ++++++++++++++++ .../app/helpers/alert-message-context-class.js | 27 ++++++++++++++ .../ui/app/helpers/alert-message-icon-class.js | 37 ++++++++++++++++++++ .../resources/ui/app/helpers/shorten-text.js | 32 +++++++++++++++++ .../main/resources/ui/app/mixins/ui-logger.js | 15 ++++++++ .../main/resources/ui/app/routes/databases.js | 12 ++++--- .../databases/database/tables/new-database.js | 15 ++++---- .../app/routes/databases/database/tables/new.js | 8 +++-- .../routes/databases/database/tables/table.js | 8 +++-- .../databases/database/tables/table/edit.js | 16 ++++----- .../databases/database/tables/table/rename.js | 15 ++++---- .../src/main/resources/ui/app/routes/jobs.js | 3 -- .../main/resources/ui/app/routes/settings.js | 10 +++--- .../resources/ui/app/services/alert-messages.js | 13 ++++--- .../ui/app/templates/databases-loading.hbs | 21 +++++++++++ .../databases/database/tables-loading.hbs | 24 +++++++++++++ .../databases/database/tables/table-loading.hbs | 21 +++++++++++ .../resources/ui/app/templates/jobs-loading.hbs | 20 +++++++++++ .../resources/ui/app/templates/messages.hbs | 14 +++----- .../ui/app/templates/messages/message.hbs | 6 ++-- .../ui/app/templates/savedqueries-loading.hbs | 21 +++++++++++ .../ui/app/templates/settings-loading.hbs | 21 +++++++++++ .../resources/ui/app/templates/udfs-loading.hbs | 21 +++++++++++ .../src/main/resources/ui/config/environment.js | 2 +- 27 files changed, 387 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js b/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js index f31d37f..670ebd7 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js +++ b/contrib/views/hive20/src/main/resources/ui/app/components/create-table.js @@ -18,13 +18,17 @@ import Ember from 'ember'; import Helper from '../configs/helpers'; +import FileFormats from '../configs/file-format'; export default Ember.Component.extend({ init() { this._super(...arguments); + let defaultFileFormat = FileFormats.findBy('default', true); this.set('columns', Ember.A()); this.set('properties', []); - this.set('settings', {}); + this.set('settings', { + fileFormat: { type: defaultFileFormat.name} + }); this.set('shouldAddBuckets', null); this.set('settingErrors', []); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/configs/file-format.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/configs/file-format.js b/contrib/views/hive20/src/main/resources/ui/app/configs/file-format.js index 4042b63..afcba6e 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/configs/file-format.js +++ b/contrib/views/hive20/src/main/resources/ui/app/configs/file-format.js @@ -16,7 +16,7 @@ * limitations under the License. */ -export default [ +let fileFormats = [ {name: "SEQUENCEFILE", default: false, custom: false}, {name: "TEXTFILE", default: false, custom: false}, {name: "RCFILE", default: false, custom: false}, @@ -24,3 +24,5 @@ export default [ {name: "AVRO", default: false, custom: false}, {name: "CUSTOM SerDe", default: false, custom: true}, ]; + +export default fileFormats; http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/controllers/messages.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/messages.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/messages.js new file mode 100644 index 0000000..10aa612 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/messages.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.Controller.extend({ + isExpanded: true, + shortenLength: Ember.computed('isExpanded', function() { + if(this.get('isExpanded') === true) { + return 200; + } else { + return 100; + } + }) +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/controllers/messages/message.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/controllers/messages/message.js b/contrib/views/hive20/src/main/resources/ui/app/controllers/messages/message.js new file mode 100644 index 0000000..d46c1f6 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/controllers/messages/message.js @@ -0,0 +1,31 @@ +/** + * 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({ + + showStatus: Ember.computed('model', function() { + return this.get('model.status') !== -1; + }), + + displayBody: Ember.computed('model', function() { + return !(Ember.isBlank(this.get('model.responseMessage')) + && Ember.isBlank(this.get('model.trace'))); + }) +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-context-class.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-context-class.js b/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-context-class.js new file mode 100644 index 0000000..28a5a8d --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-context-class.js @@ -0,0 +1,27 @@ +/** + * 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 function alertMessageContextClass(params) { + let messageType = params[0]; + let prefix = params[1]; + return `${prefix}${messageType}`; +} + +export default Ember.Helper.helper(alertMessageContextClass); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-icon-class.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-icon-class.js b/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-icon-class.js new file mode 100644 index 0000000..707f2d1 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/helpers/alert-message-icon-class.js @@ -0,0 +1,37 @@ +/** + * 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 function alertMessageIconClass(params) { + let type = params[0]; + switch (type) { + case 'success': + return 'check'; + case 'info': + return 'info'; + case 'warning': + return 'exclamation'; + case 'danger': + return 'times'; + default: + return 'check'; + } +} + +export default Ember.Helper.helper(alertMessageIconClass); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/helpers/shorten-text.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/helpers/shorten-text.js b/contrib/views/hive20/src/main/resources/ui/app/helpers/shorten-text.js new file mode 100644 index 0000000..c50b5ca --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/helpers/shorten-text.js @@ -0,0 +1,32 @@ +/** + * 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 function shortenText(params) { + let text = params[0]; + let length = params[1]; + if (text.length < length) { + return text; + } else { + return text.substring(0, length - 3) + '...'; + } + +} + +export default Ember.Helper.helper(shortenText); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/mixins/ui-logger.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/mixins/ui-logger.js b/contrib/views/hive20/src/main/resources/ui/app/mixins/ui-logger.js new file mode 100644 index 0000000..fb252d2 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/mixins/ui-logger.js @@ -0,0 +1,15 @@ +import Ember from 'ember'; + +export default Ember.Mixin.create({ + logger: Ember.inject.service('alert-messages'), + + extractError(error) { + if (Ember.isArray(error.errors) && (error.errors.length >= 0)) { + return error.errors[0]; + } else if(!Ember.isEmpty(error.errors)) { + return error.errors; + } else { + return error; + } + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js index 123a93f..6b0eab2 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js @@ -17,8 +17,9 @@ */ import Ember from 'ember'; +import UILoggerMixin from '../mixins/ui-logger'; -export default Ember.Route.extend({ +export default Ember.Route.extend(UILoggerMixin, { tableOperations: Ember.inject.service(), model() { @@ -93,7 +94,8 @@ export default Ember.Route.extend({ this.controller.set('deleteDatabaseMessage', 'Waiting for the database to be deleted'); this.get('tableOperations').waitForJobToComplete(job.get('id'), 5 * 1000) .then((status) => { - this.controller.set('deleteDatabaseMessage', "Successfully Deleted table"); + this.controller.set('deleteDatabaseMessage', "Successfully deleted database"); + this.get('logger').success(`Successfully deleted database '${databaseModel.get('name')}'`); Ember.run.later(() => { this.store.unloadRecord(databaseModel); this.controller.set('showDeleteDatabaseModal', false); @@ -102,16 +104,16 @@ export default Ember.Route.extend({ this.refresh(); }, 2 * 1000); }, (error) => { - // TODO: handle error + this.get('logger').danger(`Failed to delete database '${databaseModel.get('name')}'`, this.extractError(error)); Ember.run.later(() => { this.controller.set('showDeleteDatabaseModal', false); this.controller.set('deleteDatabaseMessage'); this.replaceWith('databases'); this.refresh(); - }, 2 * 1000); + }, 1 * 1000); }); }, (error) => { - console.log("Error encountered", error); + this.get('logger').danger(`Failed to delete database '${databaseModel.get('name')}'`, this.extractError(error)); this.controller.set('showDeleteDatabaseModal', false); }); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new-database.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new-database.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new-database.js index b421bdc..ad7fc99 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new-database.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new-database.js @@ -17,8 +17,9 @@ */ import Ember from 'ember'; +import UILoggerMixin from '../../../../mixins/ui-logger'; -export default Ember.Route.extend({ +export default Ember.Route.extend(UILoggerMixin, { tableOperations: Ember.inject.service(), @@ -40,10 +41,10 @@ export default Ember.Route.extend({ }).then((status) => { this._modalStatus(true, 'Successfully created database'); this._transitionToDatabases(newDatabaseName); + this.get('logger').success(`Successfully created database '${newDatabaseName}'`); }).catch((err) => { - this._modalStatus(true, 'Failed to create database'); - this._alertMessage('Failed to create database', err); - this._transitionToDatabases(); + this._modalStatus(false); + this.get('logger').danger(`Failed to create database '${newDatabaseName}'`, this.extractError(err)); }); }, @@ -59,10 +60,6 @@ export default Ember.Route.extend({ this._modalStatus(false); this.transitionTo('databases'); }, 2000); - }, - - _alertMessage(message, err) { - console.log(message, err); - // TODO: user alert message here } + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js index c8ad239..b29d863 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js @@ -18,8 +18,9 @@ import Ember from 'ember'; import tabs from '../../../../configs/create-table-tabs'; +import UILoggerMixin from '../../../../mixins/ui-logger'; -export default Ember.Route.extend({ +export default Ember.Route.extend(UILoggerMixin, { tableOperations: Ember.inject.service(), setupController(controller, model) { @@ -44,6 +45,7 @@ export default Ember.Route.extend({ return this.get('tableOperations').waitForJobToComplete(job.get('id'), 5 * 1000) .then((status) => { this.controller.set('createTableMessage', "Successfully created table"); + this.get('logger').success(`Successfully created table '${settings.name}'`); Ember.run.later(() => { this.controller.set('showCreateTableModal', false); this.controller.set('createTableMessage'); @@ -55,7 +57,7 @@ export default Ember.Route.extend({ }, 2 * 1000); return Ember.RSVP.Promise.resolve(job); }, (error) => { - // TODO: handle error + this.get('logger').danger(`Failed to create table '${settings.name}'`, this.extractError(error)); Ember.run.later(() => { this.controller.set('showCreateTableModal', false); this.controller.set('createTableMessage'); @@ -67,7 +69,7 @@ export default Ember.Route.extend({ return Ember.RSVP.Promise.reject(error); }); }, (error) => { - console.log("Error encountered", error); + this.get('logger').danger(`Failed to create table '${settings.name}'`, this.extractError(error)); this.controller.set('showCreateTableModal', true); throw error; }); http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js index 1066bc1..6ee8100 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js @@ -18,8 +18,9 @@ import Ember from 'ember'; import tabs from '../../../../configs/table-level-tabs'; +import UILoggerMixin from '../../../../mixins/ui-logger'; -export default Ember.Route.extend({ +export default Ember.Route.extend(UILoggerMixin, { tableOperations: Ember.inject.service(), model(params) { let database = this.modelFor('databases.database').get('name'); @@ -65,6 +66,7 @@ export default Ember.Route.extend({ this.get('tableOperations').waitForJobToComplete(job.get('id'), 5 * 1000) .then((status) => { this.controller.set('deleteTableMessage', "Successfully Deleted table"); + this.get('logger').success(`Successfully deleted table '${tableInfo.get('table')}'`); Ember.run.later(() => { this.controller.set('showDeleteTableModal', false); this.controller.set('deleteTableMessage'); @@ -73,7 +75,7 @@ export default Ember.Route.extend({ this.transitionTo('databases.database', databaseModel.get('name')); }, 2 * 1000); }, (error) => { - // TODO: handle error + this.get('logger').danger(`Failed to delete table '${tableInfo.get('table')}'`, this.extractError(error)); Ember.run.later(() => { this.controller.set('showDeleteTableModal', false); this.controller.set('deleteTableMessage'); @@ -81,7 +83,7 @@ export default Ember.Route.extend({ }, 2 * 1000); }); }, (error) => { - console.log("Error encountered", error); + this.get('logger').danger(`Failed to delete table '${tableInfo.get('table')}'`, this.extractError(error)); this.controller.set('showDeleteTableModal', true); }); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/edit.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/edit.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/edit.js index 47340ba..d9f80e1 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/edit.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/edit.js @@ -18,8 +18,9 @@ import TableMetaRouter from './table-meta-router'; import tabs from '../../../../../configs/edit-table-tabs'; +import UILoggerMixin from '../../../../../mixins/ui-logger'; -export default TableMetaRouter.extend({ +export default TableMetaRouter.extend(UILoggerMixin, { tableOperations: Ember.inject.service(), @@ -51,12 +52,12 @@ export default TableMetaRouter.extend({ this._modalStatus(true, 'Waiting for the table edit job to complete'); return this.get('tableOperations').waitForJobToComplete(job.get('id'), 5 * 1000); }).then((status) => { - this._modalStatus(true, 'Successfully edited the table'); + this._modalStatus(true, 'Successfully altered table'); + this.get('logger').success(`Successfully altered table '${settings.table}'`); this._transitionToTables(); }).catch((err) => { - this._modalStatus(true, 'Failed to edit table'); - this._alertMessage('Failed to edit table', err); - this._transitionToTables(); + this._modalStatus(false, 'Failed to edit table'); + this.get('logger').danger(`Failed to altered table '${settings.table}'`, this.extractError(err)); }); } @@ -75,11 +76,6 @@ export default TableMetaRouter.extend({ this.send('refreshTableInfo'); this.transitionTo('databases.database.tables.table'); }, 2000); - }, - - _alertMessage(message, err) { - console.log(message, err); - // TODO: user alert message here } http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/rename.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/rename.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/rename.js index cac471e..30ebfc9 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/rename.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/rename.js @@ -16,9 +16,11 @@ * limitations under the License. */ +import Ember from 'ember'; import TableMetaRouter from './table-meta-router'; +import UILoggerMixin from '../../../../../mixins/ui-logger'; -export default TableMetaRouter.extend({ +export default TableMetaRouter.extend(UILoggerMixin, { tableOperations: Ember.inject.service(), @@ -52,11 +54,11 @@ export default TableMetaRouter.extend({ return this.get('tableOperations').waitForJobToComplete(job.get('id'), 5 * 1000); }).then((status) => { this._modalStatus(true, 'Successfully renamed table'); + this.get('logger').success(`Successfully renamed table '${oldTableName}' to '${newTableName}'`); this._transitionToTables(); }).catch((err) => { - this._modalStatus(true, 'Failed to rename table'); - this._alertMessage('Failed to rename table', err); - this._transitionToTables(); + this._modalStatus(false, 'Failed to rename table'); + this.get('logger').danger(`Failed to rename table '${oldTableName}' to '${newTableName}'`, this.extractError(err)); }); }, @@ -72,11 +74,6 @@ export default TableMetaRouter.extend({ this._modalStatus(false); this.transitionTo('databases'); }, 2000); - }, - - _alertMessage(message, err) { - console.log(message, err); - // TODO: user alert message here } http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js b/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js index 419fd07..c27c74d 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js @@ -63,9 +63,6 @@ export default Ember.Route.extend({ this.controller.set('startTime', this.get('moment').moment(startTime, 'YYYY-MM-DD').startOf('day').valueOf()) this.controller.set('endTime', this.get('moment').moment(endTime, 'YYYY-MM-DD').endOf('day').valueOf()) this.refresh(); - }, - hideDatePicker() { - console.log("Hiddennnnn"); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js b/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js index 1ce5116..affc126 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js @@ -17,9 +17,10 @@ */ import Ember from 'ember'; -import hiveParams from '../configs/hive-parameters' +import hiveParams from '../configs/hive-parameters'; +import UILoggerMixin from '../mixins/ui-logger'; -export default Ember.Route.extend({ +export default Ember.Route.extend(UILoggerMixin, { model() { return this.store.findAll('setting').then(settings => settings.toArray()); }, @@ -63,16 +64,15 @@ export default Ember.Route.extend({ let model = this.get('controller.model'); model.removeObject(data); }, err => { - console.log('error in deletion'); + this.get('logger').danger(`Failed to delete setting with key: '${setting.get('key')}`, this.extractError(err)); }) }, updateAction(newSetting) { newSetting.save().then(data => { - console.log('saved', data); data.set('editMode', false); }, error => { - console.log('error', err); + this.get('logger').danger(`Failed to update setting with key: '${setting.get('key')}`, this.extractError(error)); }) }, http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/services/alert-messages.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/alert-messages.js b/contrib/views/hive20/src/main/resources/ui/app/services/alert-messages.js index ed4cff1..a05fc7a 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/services/alert-messages.js +++ b/contrib/views/hive20/src/main/resources/ui/app/services/alert-messages.js @@ -69,6 +69,10 @@ export default Ember.Service.extend({ this._processMessage('danger', message, options, alertOptions); }, + error: function() { + this.danger(...arguments); + }, + clearMessages: function() { this.get('flashMessages').clearMessages(); }, @@ -82,13 +86,13 @@ export default Ember.Service.extend({ } switch (type) { case 'success': - this.get('flashMessages').success(message, this._getOptions(alertOptions)); + this.get('flashMessages').success(message, this._getOptions(Ember.merge(alertOptions, {sticky: false}))); break; case 'warn': - this.get('flashMessages').warning(message, this._getOptions(alertOptions)); + this.get('flashMessages').warning(message, this._getOptions(Ember.merge(alertOptions, {sticky: false}))); break; case 'info': - this.get('flashMessages').info(message, this._getOptions(alertOptions)); + this.get('flashMessages').info(message, this._getOptions(Ember.merge(alertOptions, {sticky: false}))); break; case 'danger': this.get('flashMessages').danger(message, this._getOptions(alertOptions)); @@ -126,7 +130,8 @@ export default Ember.Service.extend({ var defaultOptions = { priority: 100, showProgress: true, - timeout: 6000 + timeout: 6000, + sticky: true }; return Ember.merge(defaultOptions, options); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/databases-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/databases-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/databases-loading.hbs new file mode 100644 index 0000000..d0592ed --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/databases-loading.hbs @@ -0,0 +1,21 @@ +{{! +* 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. +}} + +<div class="alert alert-info text-center"> + <p class="lead">Loading Databases. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables-loading.hbs new file mode 100644 index 0000000..58c36e9 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables-loading.hbs @@ -0,0 +1,24 @@ +{{! +* 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. +}} + +<div class="alert alert-info text-center"> + <p class="lead">Loading Tables. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table-loading.hbs new file mode 100644 index 0000000..536d025 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/databases/database/tables/table-loading.hbs @@ -0,0 +1,21 @@ +{{! +* 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. +}} + +<div class="alert alert-info text-center"> + <p class="lead">Loading Table Information. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/jobs-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/jobs-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/jobs-loading.hbs new file mode 100644 index 0000000..f679709 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/jobs-loading.hbs @@ -0,0 +1,20 @@ +{{! +* 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. +}} +<div class="alert alert-info text-center"> + <p class="lead">Loading Jobs. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/messages.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/messages.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/messages.hbs index b856c20..52e8d98 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/templates/messages.hbs +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/messages.hbs @@ -17,12 +17,9 @@ }} <div class="row"> - <div class="col-md-12 messages-header"> - <div class="col-md-1"> - {{!--#link-to "files" (query-params path=currentBrowserPath) class="btn btn-primary"}}{{fa-icon "arrow-left"}} Browser{{/link-to--}} - </div> - <div class="col-md-2 col-md-offset-4 text-center"> - <span class="messages-title">{{fa-icon "comment"}} Messages</span> + <div class="col-md-12 messages-header text-center"> + <div class="alert alert-info"> + <p class="lead">{{fa-icon "comment" size="lg" }} Notification Messages</p> </div> </div> </div> @@ -30,7 +27,8 @@ <div class={{if isExpanded "col-md-12" "col-md-4"}}> <div class="list-group"> {{#each model as |message|}} - {{#link-to 'messages.message' message class=(alert-message-context-class message.type "list-group-item list-group-item-")}} + {{#link-to 'messages.message' message + class=(alert-message-context-class message.type "list-group-item list-group-item-")}} <h4 class="list-group-item-heading wrap-message"> {{#fa-stack}} {{fa-icon "circle-thin" stack=2}} @@ -39,8 +37,6 @@ {{{message.message}}}</h4> <p class="list-group-item-text wrap-message">{{shorten-text message.responseMessage shortenLength}}</p> {{/link-to}} - {{else}} - No messages present {{/each}} </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/messages/message.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/messages/message.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/messages/message.hbs index 0c69d58..5b82333 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/templates/messages/message.hbs +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/messages/message.hbs @@ -27,18 +27,18 @@ {{#if displayBody}} <div class="panel-body"> {{#if showStatus}} - <p><strong>Server status:</strong> {{model.status}}</p> + <p><strong>Status:</strong> {{model.status}}</p> <hr/> {{/if}} {{#if model.responseMessage}} - {{alert-message-display title="Server Message:" + {{alert-message-display title="Message:" value=model.responseMessage shorten=true length=200}} <hr/> {{/if}} {{#if model.trace}} - {{alert-message-display title="Error trace:" + {{alert-message-display title="Trace:" value=model.trace shorten=true length=500}} http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/savedqueries-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/savedqueries-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/savedqueries-loading.hbs new file mode 100644 index 0000000..571466b --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/savedqueries-loading.hbs @@ -0,0 +1,21 @@ +{{! +* 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. +}} + +<div class="alert alert-info text-center"> + <p class="lead">Loading Saved Queries. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/settings-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/settings-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/settings-loading.hbs new file mode 100644 index 0000000..253bbb1 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/settings-loading.hbs @@ -0,0 +1,21 @@ +{{! +* 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. +}} + +<div class="alert alert-info text-center"> + <p class="lead">Loading Settings. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/contrib/views/hive20/src/main/resources/ui/app/templates/udfs-loading.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/udfs-loading.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/udfs-loading.hbs new file mode 100644 index 0000000..3b74db8 --- /dev/null +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/udfs-loading.hbs @@ -0,0 +1,21 @@ +{{! +* 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. +}} + +<div class="alert alert-info text-center"> + <p class="lead">Loading Udfs. Please wait. {{fa-icon "refresh" spin=true}}</p> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/6c4cbc4f/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 3714eb9..411ee99 100644 --- a/contrib/views/hive20/src/main/resources/ui/config/environment.js +++ b/contrib/views/hive20/src/main/resources/ui/config/environment.js @@ -48,7 +48,7 @@ module.exports = function(environment) { // Change the value to false to prevent the service checks. This is required in development mode // as service checks take up time and hence increase the overall development time. - ENV.APP.SHOULD_PERFORM_SERVICE_CHECK = true; + ENV.APP.SHOULD_PERFORM_SERVICE_CHECK = false; } if (environment === 'test') {
