Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F3C42200C31 for ; Tue, 21 Feb 2017 17:39:34 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id EFD96160B4F; Tue, 21 Feb 2017 16:39:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1E5B2160B77 for ; Tue, 21 Feb 2017 17:39:33 +0100 (CET) Received: (qmail 82262 invoked by uid 500); 21 Feb 2017 16:39:33 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 82037 invoked by uid 99); 21 Feb 2017 16:39:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Feb 2017 16:39:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 038E6E0B22; Tue, 21 Feb 2017 16:39:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ncole@apache.org To: commits@ambari.apache.org Date: Tue, 21 Feb 2017 16:39:35 -0000 Message-Id: <37d1e1d463cf47b1b0bfaff075968b2b@git.apache.org> In-Reply-To: <5988ef8dfd754e1099732eb565b72677@git.apache.org> References: <5988ef8dfd754e1099732eb565b72677@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/25] ambari git commit: AMBARI-20064 : hive20 view : added notification on error of preview or upload of table (nitirajrathore) archived-at: Tue, 21 Feb 2017 16:39:35 -0000 AMBARI-20064 : hive20 view : added notification on error of preview or upload of table (nitirajrathore) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fad8f274 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fad8f274 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fad8f274 Branch: refs/heads/branch-feature-AMBARI-12556 Commit: fad8f2745b8e39c51800fede563e170d30ddf9f3 Parents: c7bd689 Author: Nitiraj Singh Rathore Authored: Mon Feb 20 14:21:18 2017 +0530 Committer: Nitiraj Singh Rathore Committed: Mon Feb 20 14:21:18 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/upload-table.js | 2 +- .../main/resources/ui/app/mixins/ui-logger.js | 9 +++++ .../databases/database/tables/upload-table.js | 41 ++++---------------- .../resources/ui/app/services/alert-messages.js | 7 +++- .../app/templates/components/upload-table.hbs | 4 +- 5 files changed, 27 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fad8f274/contrib/views/hive20/src/main/resources/ui/app/components/upload-table.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/upload-table.js b/contrib/views/hive20/src/main/resources/ui/app/components/upload-table.js index 8df03e5..3da3056 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/components/upload-table.js +++ b/contrib/views/hive20/src/main/resources/ui/app/components/upload-table.js @@ -28,7 +28,7 @@ export default Ember.Component.extend({ fileInfo: Ember.Object.create({ files: Ember.A(), hdfsPath: null, - uploadSource: null, + uploadSource: "local", }), tableMeta: Ember.Object.create(), actions: { http://git-wip-us.apache.org/repos/asf/ambari/blob/fad8f274/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 index 277f69c..b01c4d4 100644 --- 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 @@ -29,5 +29,14 @@ export default Ember.Mixin.create({ } else { return error; } + }, + extractMessage(error) { + if (Ember.isArray(error.errors) && (error.errors.length >= 0)) { + return error.errors[0].message; + } else if(!Ember.isEmpty(error.errors)) { + return error.errors.message; + } else{ + return error.message; + } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fad8f274/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js index a9bf9ea..e4c543b 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js +++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js @@ -22,8 +22,9 @@ import constants from '../../../../utils/constants'; import Column from '../../../../models/column'; import datatypes from '../../../../configs/datatypes'; import Helpers from '../../../../configs/helpers'; +import UILoggerMixin from '../../../../mixins/ui-logger'; -export default NewTable.extend({ +export default NewTable.extend(UILoggerMixin, { COLUMN_NAME_REGEX: "^[a-zA-Z]{1}[a-zA-Z0-9_]*$", TABLE_NAME_REGEX: "^[a-zA-Z]{1}[a-zA-Z0-9_]*$", HDFS_PATH_REGEX: "^[/]{1}.+", // unix path allows everything but here we have to mention full path so starts with / @@ -630,26 +631,19 @@ export default NewTable.extend({ if(error){ console.log(" error : ", error); this.set('error', JSON.stringify(error)); - // this.get('notifyService').warn(error); - // TODO : add notifyService warn message. - console.log("TODO : add notifyService warn message."); + this.get('notifyService').error( this.extractMessage(error), this.extractError(error)); }else{ this.set("error"); } }, - previewError: function (error) { - this.setError(error); - }, uploadTableFromHdfs : function(tableData){ console.log("uploadTableFromHdfs called."); - // if(!(this.get("inputFileTypeCSV") == true && this.get("isFirstRowHeader") == false) ){ - this.pushUploadProgressInfos(this.formatMessage('uploadingFromHdfs')); - // } + this.pushUploadProgressInfos(this.formatMessage('uploadingFromHdfs')); var csvParams = tableData.get("fileFormatInfo.csvParams"); - let columns = tableData.get("tableMeta").columns.map(function(column){ + let columns = tableData.get("tableMeta").columns.map(function (column) { return {"name": column.get("name"), "type": column.get("type.label")}; }); - let header = columns; //JSON.stringify(columns); + let header = columns; return this.getUploader().uploadFromHDFS({ "databaseName": tableData.get("database"), @@ -687,24 +681,11 @@ export default NewTable.extend({ console.log("onUploadSuccessfull : ", data); this._transitionToCreatedTable(this.get("tableData").get('database'), this.get("tableData").get('tableMeta').name); - // this.get('notifyService').success(this.translate('hive.messages.successfullyUploadedTableHeader'), - // this.translate('hive.messages.successfullyUploadedTableMessage' ,{tableName:this.get("tableData").get("tableMeta").name ,databaseName:this.get("tableData").get("database")})); + this.get('notifyService').success(this.translate('hive.messages.successfullyUploadedTableHeader'), + this.translate('hive.messages.successfullyUploadedTableMessage' ,{tableName:this.get("tableData").get("tableMeta").name ,databaseName:this.get("tableData").get("database")})); this.clearFields(); }, - onUploadError: function (error) { - console.log("onUploadError : ", error); - this.setError(error); - }, - showOrHide: function () { - if (this.get('show') == false) { - this.set("displayOption", "display:none"); - this.set("showMoreOrLess", "Show More"); - } else { - this.set("displayOption", "display:table-row"); - this.set("showMoreOrLess", "Show Less"); - } - }, validateInputs: function(tableData){ let tableMeta = tableData.get("tableMeta"); let containsEndlines = tableData.get("fileFormatInfo.containsEndlines"); @@ -722,9 +703,6 @@ export default NewTable.extend({ this.set('previewObject', previewObject); return this.generatePreview(previewObject) }, - previewFromHdfs: function () { - return this.generatePreview(); - }, uploadTable: function (tableData) { console.log("tableData", tableData); try { @@ -736,8 +714,5 @@ export default NewTable.extend({ this.hideUploadModal(); } }, - uploadFromHDFS: function () { - this.set("isLocalUpload", false); - } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fad8f274/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 a05fc7a..5280db2 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 @@ -112,7 +112,12 @@ export default Ember.Service.extend({ data.id = this._getNextAlertId(); data.type = type; data.status = options.status || -1; - data.trace = this._getDetailedError(options.trace); + if(options.trace){ + data.trace = this._getDetailedError(options.trace); + } + else{ + data.trace = this._getDetailedError(options.stack); + } delete options.status; delete options.error; http://git-wip-us.apache.org/repos/asf/ambari/blob/fad8f274/contrib/views/hive20/src/main/resources/ui/app/templates/components/upload-table.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/upload-table.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/upload-table.hbs index e4388f0..0ee6b81 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/upload-table.hbs +++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/upload-table.hbs @@ -41,10 +41,12 @@    Table Preview +
{{#if showPreview}} - {{simple-table header=columns rows=rows }} + {{simple-table header=columns rows=rows }} {{/if}}
+