http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/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 deleted file mode 100644 index 43835e0..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js +++ /dev/null @@ -1,106 +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.Controller.extend({ - needs: [ constants.namingConventions.index ], - - index: Ember.computed.alias('controllers.' + constants.namingConventions.index), - - tezViewURL: null, - tezApiURL: '/api/v1/views/TEZ', - tezURLPrefix: '/views/TEZ', - tezDagPath: '?viewPath=/#/dag/', - - isTezViewAvailable: Ember.computed.bool('tezViewURL'), - - dagId: function () { - if (this.get('isTezViewAvailable')) { - return this.get('index.model.dagId'); - } - - return false; - }.property('index.model.dagId', 'isTezViewAvailable'), - - dagURL: function () { - if (this.get('dagId')) { - return "%@%@%@".fmt(this.get('tezViewURL'), this.get('tezDagPath'), this.get('dagId')); - } - - return false; - }.property('dagId'), - - getTezView: function () { - if (this.get('isTezViewAvailable')) { - return; - } - - var self = this; - Ember.$.getJSON(this.get('tezApiURL')) - .then(function (response) { - self.getTezViewInstance(response); - }) - .fail(function (response) { - self.setTezViewError(response); - }); - }.on('init'), - - getTezViewInstance: function (data) { - var self = this; - var url = this.get('tezApiURL') + '/versions/' + data.versions[0].ViewVersionInfo.version; - - Ember.$.getJSON(url) - .then(function (response) { - if (!response.instances.length) { - self.setTezViewError(response); - return; - } - - self.set('isTezViewAvailable', true); - - var instance = response.instances[0].ViewInstanceInfo; - self.setTezViewURL(instance); - }); - }, - - setTezViewURL: function (instance) { - var url = "%@/%@/%@/".fmt( - this.get('tezURLPrefix'), - instance.version, - instance.instance_name - ); - - this.set('tezViewURL', url); - }, - - setTezViewError: function (data) { - // status: 404 => Tev View isn't deployed - if (data.status && data.status === 404) { - this.set('error', 'tez.errors.not.deployed'); - return; - } - - // no instance created - if (data.instances && !data.instances.length) { - this.set('error', 'tez.errors.no.instance'); - return; - } - } -});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/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 deleted file mode 100644 index 3aec378..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js +++ /dev/null @@ -1,143 +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 FilterableMixin from 'hive/mixins/filterable'; -import constants from 'hive/utils/constants'; - -export default Ember.ArrayController.extend(FilterableMixin, { - fileResources: [], - - sortAscending: true, - sortProperties: [], - - 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'), - - actions: { - handleAddFileResource: function (udf) { - var file = this.store.createRecord(constants.namingConventions.fileResource); - udf.set('fileResource', file); - udf.set('isEditingResource', true); - }, - - handleDeleteFileResource: function (file) { - var defer = Ember.RSVP.defer(); - - this.send('openModal', - 'modal-delete', - { - heading: 'modals.delete.heading', - text: 'modals.delete.message', - defer: defer - }); - - defer.promise.then(function () { - file.destroyRecord(); - }); - }, - - handleSaveUdf: function (udf) { - var self = this, - saveUdf = function () { - udf.save().then(function () { - udf.set('isEditing', false); - udf.set('isEditingResource', false); - }); - }; - - //replace with a validation system if needed. - if (!udf.get('name') || !udf.get('classname')) { - return; - } - - udf.get('fileResource').then(function (file) { - if (file) { - if (!file.get('name') || !file.get('path')) { - return; - } - - file.save().then(function () { - saveUdf(); - }); - } else { - saveUdf(); - } - }); - }, - - handleDeleteUdf: function (udf) { - var defer = Ember.RSVP.defer(); - - this.send('openModal', - 'modal-delete', - { - heading: 'modals.delete.heading', - text: 'modals.delete.message', - defer: defer - }); - - defer.promise.then(function () { - udf.destroyRecord(); - }); - }, - - sort: function (property) { - //if same column has been selected, toggle flag, else default it to true - if (this.get('sortProperties').objectAt(0) === property) { - this.set('sortAscending', !this.get('sortAscending')); - } else { - this.set('sortAscending', true); - this.set('sortProperties', [ property ]); - } - }, - - add: function () { - this.store.createRecord(constants.namingConventions.udf); - }, - - clearFilters: function () { - var columns = this.get('columns'); - - if (columns) { - columns.forEach(function (column) { - var filterValue = column.get('filterValue'); - - if (filterValue && typeof filterValue === 'string') { - column.set('filterValue'); - } - }); - } - - //call clear filters from Filterable mixin - this.clearFilters(); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js deleted file mode 100644 index e217e7d..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js +++ /dev/null @@ -1,965 +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 Uploader from 'hive/adapters/upload-table' -import constants from 'hive/utils/constants'; - - -export default Ember.Controller.extend({ - DEFAULT_CSV_DELIMITER: ',', - DEFAULT_CSV_QUOTE: '"', - DEFAULT_CSV_ESCAPE: '\\', - NON_PRINTABLE_CHARS:[{"id":"0", "name":"NUL", "description":"(null)"}, - {"id":"1", "name":"SOH", "description":"(start of heading)"}, - {"id":"2", "name":"STX", "description":"(start of text)"}, - {"id":"3", "name":"ETX", "description":"(end of text)"}, - {"id":"4", "name":"EOT", "description":"(end of transmission)"}, - {"id":"5", "name":"ENQ", "description":"(enquiry)"}, - {"id":"6", "name":"ACK", "description":"(acknowledge)"}, - {"id":"7", "name":"BEL", "description":"(bell)"}, - {"id":"8", "name":"BS", "description":"(backspace)"}, - {"id":"9", "name":"TAB", "description":"(horizontal tab)"}, - {"id":"11", "name":"VT", "description":"(vertical tab)"}, - {"id":"12", "name":"FF", "description":"(NP form feed - new page)"}, - {"id":"14", "name":"SO", "description":"(shift out)"}, - {"id":"15", "name":"SI", "description":"(shift in)"}, - {"id":"16", "name":"DLE", "description":"(data link escape)"}, - {"id":"17", "name":"DC1", "description":"(device control 1)"}, - {"id":"18", "name":"DC2", "description":"(device control 2)"}, - {"id":"19", "name":"DC3", "description":"(device control 3)"}, - {"id":"20", "name":"DC4", "description":"(device control 4)"}, - {"id":"21", "name":"NAK", "description":"(negative ackowledge)"}, - {"id":"22", "name":"SYN", "description":"(synchronous idle)"}, - {"id":"23", "name":"ETB", "description":"(end of trans. block)"}, - {"id":"24", "name":"CAN", "description":"(cancel)"}, - {"id":"25", "name":"EM", "description":"(end of medium)"}, - {"id":"26", "name":"SUB", "description":"(substitute)"}, - {"id":"27", "name":"ESC", "description":"(escape)"}, - {"id":"28", "name":"FS", "description":"(file separator)"}, - {"id":"29", "name":"GS", "description":"(group separator)"}, - {"id":"30", "name":"RS", "description":"(record separator)"}, - {"id":"31", "name":"US", "description":"(unit separator)"}, - {"id":"32", "name":"Space", "description":""}, - {"id":"127", "name":"DEL", "description":""} - ], - 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 / - isLocalUpload: Ember.computed.equal("uploadSource", "local"), - uploadSource: "local", - COLUMN_NAME_PREFIX : "column", - hdfsPath: "", - jobService: Ember.inject.service(constants.namingConventions.job), - notifyService: Ember.inject.service(constants.namingConventions.notify), - databaseService : Ember.inject.service(constants.namingConventions.database), - databases : Ember.computed.alias("databaseService.databases"), - showErrors: false, - uploader: Uploader.create(), - baseUrl: "/resources/upload", - isFirstRowHeader: false, // is first row header - header: null, // header received from server - files: null, // files that need to be uploaded only file[0] is relevant - firstRow: [], // the actual first row of the table. - rows: null, // preview rows received from server - databaseName: null, - selectedDatabase: null, - filePath: null, - tableName: null, - uploadProgressInfos : [], - DEFAULT_DB_NAME : 'default', - showPreview : false, - containsEndlines: false, - inputFileTypes :[ - {id : "CSV", name : "CSV"}, - {id : "JSON", name : "JSON"}, - {id : "XML", name : "XML"} - ], - inputFileType: null, - inputFileTypeCSV : Ember.computed.equal('inputFileType.id',"CSV"), - storedAsTextFile : Ember.computed.equal("selectedFileType","TEXTFILE"), - storedAsNotTextFile : Ember.computed.not("storedAsTextFile"), - csvDelimiter: null, - csvQuote : null, - csvEscape : null, - asciiList:[], - fieldsTerminatedBy: null, - escapedBy: null, - fileTypes:[ - "SEQUENCEFILE", - "TEXTFILE" , - "RCFILE" , - "ORC" , - "PARQUET" , - "AVRO" - ], - selectedFileType: null, - onChangeSelectedFileType: function(){ - if(this.get('selectedFileType') === this.get('fileTypes')[1] && this.get('containsEndlines') === true){ - this.set('containsEndlines', false); - } - }.observes("selectedFileType", "containsEndlines"), - dataTypes: [ - "TINYINT", // - "SMALLINT", // - "INT", // - "BIGINT", // - "BOOLEAN", // - "FLOAT", // - "DOUBLE", // - "STRING", // - "BINARY", // -- (Note: Available in Hive 0.8.0 and later) - "TIMESTAMP", // -- (Note: Available in Hive 0.8.0 and later) - "DECIMAL", // -- (Note: Available in Hive 0.11.0 and later) - "DATE", // -- (Note: Available in Hive 0.12.0 and later) - "VARCHAR", // -- (Note: Available in Hive 0.12.0 and later) - "CHAR" // -- (Note: Available in Hive 0.13.0 and later) - ], - setDefaultDB : function(){ - var self = this; - var defaultDatabase = this.get('databases').find( - function(item,index){ - if(item.id == self.DEFAULT_DB_NAME ) - return true; - } - ); - - console.log("setting the initial database to : " + defaultDatabase); - self.set("selectedDatabase",defaultDatabase); - }, - init: function () { - this.setDefaultDB(); - this.fillAsciiList(); - this.set("selectedFileType", this.get("fileTypes")[3]); - this.set("inputFileType", this.get("inputFileTypes")[0]); - }, - onChangeUploadSource : function(){ - this.clearFields(); - }.observes("uploadSource"), - asciiFormatter: function( option, escape ){ - if( option.data.id != -1 ) - return "<div><span style='font-weight: bold;margin: 5px'>" + option.data.id + "</span><span style='font-style: italic; color: grey; margin: 5px'>" + option.data.name + "</span></div>"; - else - return "<div></div>"; - }, - fillAsciiList: function(){ - var list = this.get('asciiList'); - list.push({"id": -1, "name": ""}); - var nonPrintable = this.get('NON_PRINTABLE_CHARS'); - for( var i = 0 ; i <= 127 ; i++ ){ - if( i == 10 || i == 13 ) continue; - var charInfo = nonPrintable.find(function(item){ - return item.id == i; - }); - if(!charInfo){ - charInfo = {"id": i, "name": String.fromCodePoint(i), "description":"" }; - } - var option = {"id": i, "name": charInfo.name + charInfo.description}; - list.push(option); - if(i === 44){ - this.set("csvDelimiter", option); - } - else if(i === 34){ - this.set("csvQuote", option); - } - else if(i === 92){ - this.set("csvEscape", option); - } - } - }, - uploadProgressInfo : Ember.computed("uploadProgressInfos.[]",function(){ - var info = ""; - for( var i = 0 ; i < this.get('uploadProgressInfos').length ; i++) - info += this.get('uploadProgressInfos').objectAt(i); - - return new Ember.Handlebars.SafeString(info); - }), - _setHeaderElements : function(header,valueArray){ - header.forEach(function (item, index) { - Ember.set(item, 'name', valueArray[index]); - }, this); - }, - isFirstRowHeaderDidChange: function () { - if (this.get('isFirstRowHeader') != null && typeof this.get('isFirstRowHeader') !== 'undefined') { - if (this.get('isFirstRowHeader') == false) { - if (this.get('rows')) { - this.get('rows').unshiftObject({row: this.get('firstRow')}); - this._setHeaderElements(this.get('header'),this.get('defaultColumnNames')); - } - } else if (this.get('header')) { // headers are available - // take first row of - this._setHeaderElements(this.get('header'),this.get('firstRow')); - this.get('rows').removeAt(0); - } - - this.printValues(); - } - }.observes('isFirstRowHeader'), - - popUploadProgressInfos: function () { - var msg = this.get('uploadProgressInfos').popObject(); - }, - - pushUploadProgressInfos : function(info){ - this.get('uploadProgressInfos').pushObject(info); - }, - - clearUploadProgressModal : function(){ - var len = this.get('uploadProgressInfos').length; - for( var i = 0 ; i < len ; i++){ - this.popUploadProgressInfos(); - } - }, - - hideUploadModal : function(){ - this.clearUploadProgressModal(); - Ember.$("#uploadProgressModal").modal("hide"); - }, - - showUploadModal : function(){ - Ember.$("#uploadProgressModal").modal("show"); - }, - - clearFields: function () { - this.set("showPreview",false); - this.set("hdfsPath"); - this.set("header"); - this.set("rows"); - this.set("escapedBy"); - this.set("fieldsTerminatedBy"); - this.set("error"); - this.set('files'); - this.set("firstRow"); - this.set("selectedDatabase",null); - this.set("databaseName"); - this.set("filePath"); - this.set('tableName'); - this.clearUploadProgressModal(); - this.setDefaultDB(); - this.printValues(); - }, - - printValues: function () { - console.log("header : ", this.get('header'), - ". rows : ",this.get('rows'),". error : ", this.get('error'), - " isFirstRowHeader : ", this.get('isFirstRowHeader'), - "firstRow : ", this.get('firstRow')); - }, - - generateTempTableName: function () { - var text = ""; - var possible = "abcdefghijklmnopqrstuvwxyz"; - - for (var i = 0; i < 30; i++) - text += possible.charAt(Math.floor(Math.random() * possible.length)); - - return text; - }, - - waitForJobStatus: function (jobId, resolve, reject) { - console.log("finding status of job: ", jobId); - var self = this; - var fetchJobPromise = this.get('jobService').fetchJob(jobId); - fetchJobPromise.then(function (data) { - console.log("waitForJobStatus : data : ", data); - var job = data.job; - var status = job.status.toUpperCase(); - if (status == constants.statuses.succeeded ) { - console.log("resolving waitForJobStatus with : " , status); - resolve(job); - } else if (status == constants.statuses.canceled || status == constants.statuses.closed || status == constants.statuses.error) { - console.log("rejecting waitForJobStatus with : " + status); - reject(new Error(job.statusMessage)); - } else { - Ember.run.later(function(){ - console.log("retrying waitForJobStatus : ", jobId); - self.waitForJobStatus(jobId, resolve, reject); - },1000); - } - }, function (error) { - console.log("rejecting waitForJobStatus with : " + error); - reject(error); - }) - }, - - uploadForPreview: function (files) { - console.log("uploaderForPreview called."); - var self = this; - var csvParams = this.getCSVParams(); - - return this.get('uploader').uploadFiles('preview', files, { - "isFirstRowHeader": self.get("isFirstRowHeader"), - "inputFileType": self.get("inputFileType").id, - "csvDelimiter": csvParams.csvDelimiter, - "csvEscape": csvParams.csvEscape, - "csvQuote": csvParams.csvQuote - }); - }, - - getAsciiChar : function(key){ - if(!key){ - return null; - } - - var value = this.get(key); - if(value && value.id != -1) { - return String.fromCharCode(value.id); - }else{ - return null; - } - }, - getCSVParams : function(){ - var csvd = this.getAsciiChar('csvDelimiter'); - if(!csvd && csvd != 0) csvd = this.get('DEFAULT_CSV_DELIMITER'); - - var csvq = this.getAsciiChar('csvQuote'); - if(!csvq && csvq != 0) csvq = this.get('DEFAULT_CSV_QUOTE'); - - var csve = this.getAsciiChar('csvEscape'); - if(!csve && csve != 0) csve = this.get('DEFAULT_CSV_ESCAPE'); - - return {"csvDelimiter": csvd, "csvQuote" : csvq, "csvEscape": csve}; - }, - - uploadForPreviewFromHDFS: function () { - console.log("uploadForPreviewFromHDFS called."); - var self = this; - var hdfsPath = this.get("hdfsPath"); - this.validateHDFSPath(hdfsPath); - var csvParams = this.getCSVParams(); - - return this.get('uploader').previewFromHDFS({ - "isFirstRowHeader": this.get("isFirstRowHeader"), - "inputFileType": this.get("inputFileType").id, - "hdfsPath": hdfsPath, - "csvDelimiter": csvParams.csvDelimiter, - "csvEscape": csvParams.csvEscape , - "csvQuote": csvParams.csvQuote - }); - }, - - generatePreview: function (files) { - var self = this; - var promise = null; - try { - this.waitForGeneratingPreview(); - if (this.get('isLocalUpload')) { - promise = this.uploadForPreview(files); - } else { - promise = this.uploadForPreviewFromHDFS(); - } - - return promise.then(function (data) { - self.onGeneratePreviewSuccess(data); - }, function (error) { - self.onGeneratePreviewFailure(error); - }).catch(function (error) { - console.log("inside catch : ", error); - }).finally(function () { - console.log("finally hide the modal always after preview."); - self.hideUploadModal(); - }); - }catch(e){ - // exception before promise will be caught here. - console.log("exception before promise : ", e); - self.setError(e); - }finally{ - console.log("finally hide the modal always after preview."); - self.hideUploadModal(); - } - }, - - waitForGeneratingPreview: function () { - console.log("waitForGeneratingPreview"); - this.showUploadModal(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.generatingPreview')) - }, - - previewTable: function (data) { - console.log('inside previewTable'); - var self = this; - var defaultColumnNames = data.header.map(function(item,index){ - return self.COLUMN_NAME_PREFIX + (index + 1); - }); - this.set("defaultColumnNames",defaultColumnNames); - this.set("header", data.header); - this.set('isFirstRowHeader', data.isFirstRowHeader); - this.set('tableName', data.tableName); - var firstRow = null; - if (data.isFirstRowHeader == true) { - firstRow = data.header.map(function(columnDesc){ - return columnDesc.name; - }); - }else { - if(data.rows.length > 0){ - firstRow = data.rows[0].row; - }else{ - firstRow = []; - } - } - this.set("firstRow", firstRow); - this.set("rows", data.rows); - }, - - onGeneratePreviewSuccess: function (data) { - console.log("onGeneratePreviewSuccess"); - this.set("showPreview",true); - this.hideUploadModal(); - this.previewTable(data); - }, - - onGeneratePreviewFailure: function (error) { - console.log("onGeneratePreviewFailure"); - this.set("showPreview",false); - this.hideUploadModal(); - this.setError(error); - }, - - createActualTable: function () { - console.log("createActualTable"); - var self = this; - this.pushUploadProgressInfos(this.formatMessage('hive.messages.startingToCreateActualTable')); - var headers = this.get('header'); - var selectedDatabase = this.get('selectedDatabase'); - if (!selectedDatabase) { - throw new Error(this.translate('hive.errors.emptyDatabase', {database : this.translate("hive.words.database")})); - } - - this.set('databaseName', this.get('selectedDatabase.id')); - var databaseName = this.get('databaseName'); - var tableName = this.get('tableName'); - var isFirstRowHeader = this.get('isFirstRowHeader'); - var filetype = this.get("selectedFileType"); - - this.validateInput(headers,tableName,databaseName,isFirstRowHeader); - this.showUploadModal(); - var rowFormat = this.getRowFormat(); - return this.get('uploader').createTable({ - "isFirstRowHeader": isFirstRowHeader, - "header": headers, - "tableName": tableName, - "databaseName": databaseName, - "hiveFileType":filetype, - "rowFormat": { "fieldsTerminatedBy" : rowFormat.fieldsTerminatedBy, "escapedBy" : rowFormat.escapedBy} - }); - }, - getRowFormat : function(){ - var fieldsTerminatedBy = this.getAsciiChar('fieldsTerminatedBy'); - var escapedBy = this.getAsciiChar('escapedBy'); - return {"fieldsTerminatedBy": fieldsTerminatedBy, "escapedBy" : escapedBy}; - }, - waitForCreateActualTable: function (jobId) { - console.log("waitForCreateActualTable"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.waitingToCreateActualTable')); - var self = this; - var p = new Ember.RSVP.Promise(function (resolve, reject) { - self.waitForJobStatus(jobId, resolve, reject); - }); - - return p; - }, - onCreateActualTableSuccess: function () { - console.log("onCreateTableSuccess"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.successfullyCreatedActualTable')); - }, - onCreateActualTableFailure: function (error) { - console.log("onCreateActualTableFailure"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.failedToCreateActualTable')); - this.setError(error); - }, - createTempTable: function () { - var self = this; - console.log("createTempTable"); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.startingToCreateTemporaryTable')); - var tempTableName = this.generateTempTableName(); - this.set('tempTableName', tempTableName); - - var headers = this.get("header"); - if(this.get("containsEndlines")){ - headers = this.get("header").map(function(item){ - var header = JSON.parse(JSON.stringify(item)); - header.type = "STRING"; - return header; - }); - } - return this.get('uploader').createTable({ - "isFirstRowHeader": this.get("isFirstRowHeader"), - "header": headers, - "tableName": tempTableName, - "databaseName": this.get('databaseName'), - "hiveFileType":"TEXTFILE", - "rowFormat": { "fieldsTerminatedBy" : parseInt('1', 10), "escapedBy" : null} - }); - }, - - waitForCreateTempTable: function (jobId) { - console.log("waitForCreateTempTable"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.waitingToCreateTemporaryTable')); - var self = this; - var p = new Ember.RSVP.Promise(function (resolve, reject) { - self.waitForJobStatus(jobId, resolve, reject); - }); - - return p; - }, - - onCreateTempTableSuccess: function () { - console.log("onCreateTempTableSuccess"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.successfullyCreatedTemporaryTable')); - }, - - deleteTable : function(databaseName, tableName){ - console.log("deleting table ", databaseName , "." , tableName); - - return this.get('uploader').deleteTable({ - "database": databaseName, - "table": tableName - }); - }, - - deleteTableOnError: function (databaseName, tableName, tableLabel) { - //delete table and wait for delete job - var self = this; - this.pushUploadProgressInfos(this.formatMessage('hive.messages.deletingTable',{table:tableLabel})); - - return this.deleteTable(databaseName, tableName).then(function (job) { - return new Ember.RSVP.Promise(function (resolve, reject) { - self.waitForJobStatus(job.id, resolve, reject); - }); - }).then(function () { - self.popUploadProgressInfos(); - self.pushUploadProgressInfos(this.formatMessage('hive.messages.succesfullyDeletedTable',{table:tableLabel})); - return Ember.RSVP.Promise.resolve(); - }, function (err) { - self.popUploadProgressInfos(); - self.pushUploadProgressInfos(this.formatMessage('hive.messages.failedToDeleteTable',{table:tableLabel})); - self.setError(err); - return Ember.RSVP.Promise.reject(); - }); - }, - - rollBackActualTableCreation : function(){ - return this.deleteTableOnError(this.get("databaseName"),this.get("tableName"),this.translate('hive.words.actual')); - }, - - translate : function(str,vars){ - return Ember.I18n.t(str,vars); - }, - formatMessage : function(messageId, vars){ - return "<li>" + this.translate(messageId,vars) + "</li>"; - }, - onCreateTempTableFailure : function(error){ - console.log("onCreateTempTableFailure"); - this.setError(error); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.failedToCreateTemporaryTable')); - return this.rollBackActualTableCreation().then(function(data){ - return Ember.RSVP.Promise.reject(error); // always reject for the flow to stop - }, function (err) { - return Ember.RSVP.Promise.reject(error); // always reject for the flow to stop - }); - }, - - uploadFile: function () { - console.log("uploadFile"); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.startingToUploadFile')); - if( this.get("isLocalUpload")){ - return this.uploadTable(); - }else{ - return this.uploadTableFromHdfs(); - } - }, - - waitForUploadingFile: function (data) { - console.log("waitForUploadingFile"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.waitingToUploadFile')); - if( data.jobId ){ - var self = this; - var p = new Ember.RSVP.Promise(function (resolve, reject) { - self.waitForJobStatus(data.jobId, resolve, reject); - }); - return p; - }else{ - return Ember.RSVP.Promise.resolve(data); - } - }, - - onUploadingFileSuccess: function () { - console.log("onUploadingFileSuccess"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.successfullyUploadedFile') ); - }, - - rollBackTempTableCreation: function () { - var self = this; - return this.deleteTableOnError(this.get("databaseName"),this.get("tempTableName"),this.translate('hive.words.temporary')).then(function(data){ - return self.rollBackActualTableCreation(); - },function(err){ - return self.rollBackActualTableCreation(); - }) - }, - - onUploadingFileFailure: function (error) { - console.log("onUploadingFileFailure"); - this.setError(error); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.failedToUploadFile')); - return this.rollBackTempTableCreation().then(function(data){ - return Ember.RSVP.Promise.reject(error); // always reject for the flow to stop - },function(err){ - return Ember.RSVP.Promise.reject(error); // always reject for the flow to stop - }); - }, - - rollBackUploadFile : function(){ - return this.rollBackTempTableCreation(); - }, - - insertIntoTable : function(){ - console.log("insertIntoTable"); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.startingToInsertRows')); - - return this.get('uploader').insertIntoTable({ - "fromDatabase": this.get("databaseName"), - "fromTable": this.get("tempTableName"), - "toDatabase": this.get("databaseName"), - "toTable": this.get("tableName"), - "header": this.get("header"), - "unhexInsert": this.get("containsEndlines") - }); - }, - - waitForInsertIntoTable: function (jobId) { - console.log("waitForInsertIntoTable"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.waitingToInsertRows')); - var self = this; - var p = new Ember.RSVP.Promise(function (resolve, reject) { - self.waitForJobStatus(jobId, resolve, reject); - }); - - return p; - }, - - onInsertIntoTableSuccess: function () { - console.log("onInsertIntoTableSuccess"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.successfullyInsertedRows')); - }, - - onInsertIntoTableFailure: function (error) { - console.log("onInsertIntoTableFailure"); - this.setError(error); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.failedToInsertRows')); - return this.rollBackUploadFile().then(function(data){ - return Ember.RSVP.Promise.reject(error); // always reject for the flow to stop - },function(err){ - return Ember.RSVP.Promise.reject(error); // always reject for the flow to stop - }); - }, - - deleteTempTable : function(){ - console.log("deleteTempTable"); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.startingToDeleteTemporaryTable')); - - return this.deleteTable( - this.get("databaseName"), - this.get("tempTableName") - ); - }, - waitForDeleteTempTable: function (jobId) { - console.log("waitForDeleteTempTable"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.waitingToDeleteTemporaryTable')); - var self = this; - var p = new Ember.RSVP.Promise(function (resolve, reject) { - self.waitForJobStatus(jobId, resolve, reject); - }); - - return p; - }, - onDeleteTempTableSuccess: function () { - console.log("onDeleteTempTableSuccess"); - this.popUploadProgressInfos(); - this.pushUploadProgressInfos(this.formatMessage('hive.messages.successfullyDeletedTemporaryTable')); - this.onUploadSuccessfull(); - }, - onDeleteTempTableFailure: function (error) { - console.log("onDeleteTempTableFailure"); - this.setError(error); - this.setError(this.formatMessage('hive.messages.manuallyDeleteTable',{databaseName:this.get('databaseName'), tableName: this.get("tempTableName")})); - }, - validateHDFSPath: function (hdfsPath) { - if (null == hdfsPath || hdfsPath == "") throw new Error(this.translate('hive.errors.emptyHdfsPath')); - var hdfsRegex = new RegExp(this.get("HDFS_PATH_REGEX"), "g"); - var mArr = hdfsPath.match(hdfsRegex); - if (mArr == null || mArr.length != 1) throw new Error(this.translate('hive.errors.illegalHdfPath', {"hdfsPath": hdfsPath} )); - }, - createTableAndUploadFile: function () { - var self = this; - self.setError(); - self.createActualTable() - .then(function(job){ - console.log("1. received job : ", job); - return self.waitForCreateActualTable(job.id); - },function(error){ - console.log("Error occurred: ", error); - self.onCreateActualTableFailure(error); - throw error; - }) - .then(function(data){ - self.onCreateActualTableSuccess(data); - return self.createTempTable(data); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - self.onCreateActualTableFailure(error); - } - throw error; - }) - .then(function(job){ - return self.waitForCreateTempTable(job.id); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - return self.onCreateTempTableFailure(error); - } - throw error; - }) - .then(function(data){ - self.onCreateTempTableSuccess(data); - return self.uploadFile(data); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - return self.onCreateTempTableFailure(error); - } - throw error; - }).then(function(data){ - return self.waitForUploadingFile(data); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - return self.onUploadingFileFailure(error); - } - throw error; - }) - .then(function(data){ - self.onUploadingFileSuccess(data); - return self.insertIntoTable(data); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - return self.onUploadingFileFailure(error); - } - throw error; - }) - .then(function(job){ - return self.waitForInsertIntoTable(job.id); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - return self.onInsertIntoTableFailure(error); - } - throw error; - }) - .then(function(data){ - self.onInsertIntoTableSuccess(data); - return self.deleteTempTable(data); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - return self.onInsertIntoTableFailure(error); - } - throw error; - }) - .then(function(job){ - return self.waitForDeleteTempTable(job.id); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - self.onDeleteTempTableFailure(error); - } - throw error; - }) - .then(function(data){ - self.onDeleteTempTableSuccess(data); - },function(error){ - if(!self.get('error')){ - console.log("Error occurred: ", error); - self.onDeleteTempTableFailure(error); - } - throw error; - }) - .catch(function(error){ - console.log("inside catch : ", error); - }) - .finally(function(){ - console.log("finally hide the modal always"); - self.hideUploadModal(); - }); - }, - validateInput: function (headers,tableName,databaseName,isFirstRowHeader) { - // throw exception if invalid. - if(!headers || headers.length == 0) throw new Error(this.translate('hive.errors.emptyHeaders')); - - var regex = new RegExp(this.get("COLUMN_NAME_REGEX"),"g"); - - headers.forEach(function(column,index){ - if( !column ) throw new Error(this.translate('hive.errors.emptyColumnName')); - var matchArr = column.name.match(regex); - if(matchArr == null || matchArr.length != 1 ) throw new Error(this.translate('hive.errors.illegalColumnName',{ columnName : column.name, index : (index + 1)})); - },this); - - if(!tableName) throw new Error(this.translate('hive.errors.emptyTableName', {tableNameField : this.translate('hive.ui.tableName')})); - var tableRegex = new RegExp(this.get("TABLE_NAME_REGEX"),"g"); - var mArr = tableName.match(tableRegex); - if(mArr == null || mArr.length != 1 ) throw new Error(this.translate('hive.errors.illegalTableName', {tableNameField:this.translate('hive.ui.tableName'),tableName:tableName}) ); - - if(!databaseName) throw new Error(this.translate('hive.errors.emptyDatabase', {database:this.translate('hive.words.database')})); - - if (null == isFirstRowHeader || typeof isFirstRowHeader === 'undefined') { //this can be true or false. so explicitly checking for null/ undefined. - throw new Error(this.translate('hive.errors.emptyIsFirstRow', {isFirstRowHeaderField:this.translate('hive.ui.isFirstRowHeader')})); - } - }, - setError: function (error) { - if(error){ - console.log(" error : ", error); - this.set('error', JSON.stringify(error)); - this.get('notifyService').error(error); - }else{ - this.set("error"); - } - }, - previewError: function (error) { - this.setError(error); - }, - uploadTableFromHdfs : function(){ - console.log("uploadTableFromHdfs called."); - if(!(this.get("inputFileTypeCSV") == true && this.get("isFirstRowHeader") == false) ){ - this.pushUploadProgressInfos(this.formatMessage('uploadingFromHdfs')); - } - var csvParams = this.getCSVParams(); - - return this.get('uploader').uploadFromHDFS({ - "isFirstRowHeader": this.get("isFirstRowHeader"), - "databaseName": this.get('databaseName'), - "tableName": this.get("tempTableName"), - "inputFileType": this.get("inputFileType").id, - "hdfsPath": this.get("hdfsPath"), - "header": this.get("header"), - "containsEndlines": this.get("containsEndlines"), - "csvDelimiter": csvParams.csvDelimiter, - "csvEscape": csvParams.csvEscape, - "csvQuote": csvParams.csvQuote - }); - }, - uploadTable: function () { - this.printValues(); - var csvParams = this.getCSVParams(); - - return this.get('uploader').uploadFiles('upload', this.get('files'), { - "isFirstRowHeader": this.get("isFirstRowHeader"), - "databaseName" : this.get('databaseName'), - "tableName" : this.get("tempTableName"), - "inputFileType" : this.get("inputFileType").id, - "header": JSON.stringify(this.get("header")), - "containsEndlines": this.get("containsEndlines"), - "csvDelimiter": csvParams.csvDelimiter, - "csvEscape": csvParams.csvEscape , - "csvQuote": csvParams.csvQuote - }); - }, - - onUploadSuccessfull: function (data) { - console.log("onUploadSuccessfull : ", data); - this.get('notifyService').success(this.translate('hive.messages.successfullyUploadedTableHeader'), - this.translate('hive.messages.successfullyUploadedTableMessage' ,{tableName:this.get('tableName') ,databaseName:this.get("databaseName")})); - 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"); - } - }, - displayOption: "display:none", - actions: { - hideInputParamModal : function(){ - Ember.$("#inputParamsModal").modal("hide"); - }, - showInputParamModal : function(){ - if(this.get('inputFileTypeCSV')){ - Ember.$("#inputParamsModal").modal("show"); - } - }, - hideRowFormatModal : function(){ - Ember.$("#rowFormatModal").modal("hide"); - }, - showRowFormatModal : function(){ - if(this.get('storedAsTextFile')) { - Ember.$("#rowFormatModal").modal("show"); - } - }, - toggleErrors: function () { - this.toggleProperty('showErrors'); - }, - filesUploaded: function (files) { - console.log("upload-table.js : uploaded new files : ", files); - this.clearFields(); - - this.set('files', files); - var name = files[0].name; - var i = name.indexOf("."); - var tableName = name.substr(0, i); - this.set('tableName', tableName); - var self = this; - return this.generatePreview(files) - }, - previewFromHdfs: function () { - return this.generatePreview(); - }, - uploadTable: function () { - try { - this.createTableAndUploadFile(); - } catch (e) { - console.log("exception occured : ", e); - this.setError(e); - this.hideUploadModal(); - } - }, - uploadFromHDFS: function () { - this.set("isLocalUpload", false); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/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 deleted file mode 100644 index 272aa11..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js +++ /dev/null @@ -1,64 +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.Controller.extend({ - jobProgressService: Ember.inject.service(constants.namingConventions.jobProgress), - openQueries : Ember.inject.controller(constants.namingConventions.openQueries), - notifyService: Ember.inject.service(constants.namingConventions.notify), - - index: Ember.inject.controller(), - verticesProgress: Ember.computed.alias('jobProgressService.currentJob.stages'), - - actions: { - onTabOpen: function () { - var self = this; - - // Empty query - if(this.get('openQueries.currentQuery.fileContent').length == 0){ - this.set('json', undefined); - this.set('noquery', 'hive.errors.no.query'); - return; - } else { - this.set('noquery', undefined); - } - // Introducing a common function - var getVisualExplainJson = function(){ - self.set('showSpinner', undefined); - self.set('rerender'); - self.get('index')._executeQuery(constants.jobReferrer.visualExplain, true, true).then(function (json) { - //this condition should be changed once we change the way of retrieving this json - if (json['STAGE PLANS']['Stage-1']) { - self.set('json', json); - } else { - self.set('json', {}) - } - }, function (error) { - self.set('json', undefined); - self.get('notifyService').error(error); - }); - self.toggleProperty('shouldChangeGraph'); - } - - getVisualExplainJson(); - - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js deleted file mode 100644 index c908afd..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js +++ /dev/null @@ -1,134 +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.Controller.extend({ - selectedRowCount: constants.defaultVisualizationRowCount, - needs: [ constants.namingConventions.index, - constants.namingConventions.openQueries, - constants.namingConventions.jobResults - ], - index : Ember.computed.alias('controllers.' + constants.namingConventions.index), - openQueries : Ember.computed.alias('controllers.' + constants.namingConventions.openQueries), - results : Ember.computed.alias('controllers.' + constants.namingConventions.jobResults), - notifyService: Ember.inject.service(constants.namingConventions.notify), - - polestarUrl: '', - voyagerUrl: '', - polestarPath: 'polestar/#/', - voyagerPath: 'voyager/#/', - - showDataExplorer: true, - showAdvVisulization: false, - - visualizationTabs: function () { - return [ - Ember.Object.create({ - name: 'Data Visualization', - id: 'visualization', - url: this.get('polestarUrl') - }), - Ember.Object.create({ - name: 'Data Explorer', - id: 'data_explorer', - url: this.get('voyagerUrl') - }) - ] - }.property('polestarUrl', 'voyagerUrl'), - - activeTab: function () { - console.log("I am in activeTab function."); - this.get('visualizationTabs')[0].active = this.get("showDataExplorer"); - this.get('visualizationTabs')[1].active = this.get("showAdvVisulization"); - }.observes('polestarUrl', 'voyagerUrl'), - - alterIframe: function () { - Ember.$("#visualization_frame").height(Ember.$("#visualization").height()); - }, - - actions: { - onTabOpen: function () { - var self = this; - var model = this.get('index.model'); - if (model) { - var existingJob = this.get('results').get('cachedResults').findBy('id', model.get('id')); - var url = this.container.lookup('adapter:application').buildURL(); - url += '/' + constants.namingConventions.jobs + '/' + model.get('id') + '/results?&first=true'; - url += '&count='+self.get('selectedRowCount')+'&job_id='+model.get('id') - if (existingJob) { - if(existingJob.results[0].rows.length === 0){ - this.set("error", "Query has insufficient results to visualize the data."); - return; - } - this.set("error", null); - var id = model.get('id'); - this.set("polestarUrl", this.get('polestarPath') + "?url=" + url); - this.set("voyagerUrl", this.get('voyagerPath') + "?url=" + url); - Ember.run.scheduleOnce('afterRender', this, function(){ - self.alterIframe(); - }); - } else { - this.set("error", "No visualization available. Please execute a query and wait for the results to visualize the data."); - } - } - }, - - changeRowCount: function () { - var self = this; - if(isNaN(self.get('selectedRowCount')) || !(self.get('selectedRowCount')%1 === 0) || (self.get('selectedRowCount') <= 0)){ - self.get('notifyService').error("Please enter a posive integer number."); - return; - } - var model = this.get('index.model'); - if (model) { - var existingJob = this.get('results').get('cachedResults').findBy('id', model.get('id')); - var url = this.container.lookup('adapter:application').buildURL(); - url += '/' + constants.namingConventions.jobs + '/' + model.get('id') + '/results?&first=true'; - url += '&count='+self.get('selectedRowCount')+'&job_id='+model.get('id'); - if (existingJob) { - this.set("error", null); - var id = model.get('id'); - - $('.nav-tabs.visualization-tabs li.active').each(function( index ) { - - if($(this)[index].innerText.indexOf("Data Explorer") > -1){ - self.set("showDataExplorer",true); - self.set("showAdvVisulization",false); - self.set("voyagerUrl", self.get('voyagerPath') + "?url=" + url); - self.set("polestarUrl", self.get('polestarPath') + "?url=" + url); - document.getElementById("visualization_frame").src = self.get("voyagerUrl"); - } - if($(this)[index].innerText.indexOf("Advanced Visualization") > -1){ - self.set("showAdvVisulization",true); - self.set("showDataExplorer",false); - self.set("voyagerUrl", self.get('voyagerPath') + "?url=" + url); - self.set("polestarUrl", self.get('polestarPath') + "?url=" + url); - document.getElementById("visualization_frame").src = self.get("polestarUrl"); - } - }) - document.getElementById("visualization_frame").contentWindow.location.reload(); - } else { - this.set("error", "No visualization available. Please execute a query and wait for the results to visualize data."); - } - } - - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/.gitkeep ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/.gitkeep b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/.gitkeep deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/all-uppercase.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/all-uppercase.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/all-uppercase.js deleted file mode 100644 index 92930a9..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/all-uppercase.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 function allUppercase (input) { - return input ? input.toUpperCase() : input; -} - -export default Ember.Handlebars.makeBoundHelper(allUppercase); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/code-helper.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/code-helper.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/code-helper.js deleted file mode 100644 index 8bbd19e..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/code-helper.js +++ /dev/null @@ -1,28 +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 function code (text) { - text = Ember.Handlebars.Utils.escapeExpression(text); - text = text.replace(/(\r\n|\n|\r)/gm, '<br>'); - - return new Ember.Handlebars.SafeString('<code>' + text + '</code>'); -} - -export default Ember.Handlebars.makeBoundHelper(code); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/date-binding.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/date-binding.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/date-binding.js deleted file mode 100644 index 61251f8..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/date-binding.js +++ /dev/null @@ -1,27 +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. - */ - -/* globals moment */ - -import Ember from 'ember'; - -export function pathBinding (data, key) { - return moment(data.get(key)).fromNow(); -} - -export default Ember.Handlebars.makeBoundHelper(pathBinding); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js deleted file mode 100644 index 13528b7..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/format-column-type.js +++ /dev/null @@ -1,39 +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. - */ - -/** - used to format the precision and scale of type in database's table's columns -**/ - -import Ember from "ember"; - -var columnTypeFormatter = function(column) { - var type = column.type; - var ext = type; - if( type === "VARCHAR" || type === "CHAR" || type == "DECIMAL" ) { - ext += '(' + column.precision; - if (type == "DECIMAL") { - ext += "," + column.scale; - } - ext += ")"; - } - - return ext; -}; - -export default Ember.Handlebars.makeBoundHelper(columnTypeFormatter); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/log-helper.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/log-helper.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/log-helper.js deleted file mode 100644 index c29d129..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/log-helper.js +++ /dev/null @@ -1,28 +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 function log (text) { - text = Ember.Handlebars.Utils.escapeExpression(text); - text = text.replace(/(\r\n|\n|\r)/gm, '<br>'); - - return new Ember.Handlebars.SafeString(text); -} - -export default Ember.Handlebars.makeBoundHelper(log); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/path-binding.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/path-binding.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/path-binding.js deleted file mode 100644 index 926aaaa..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/path-binding.js +++ /dev/null @@ -1,29 +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 function pathBinding (data, key) { - if (!data || !key) { - return; - } - - return data.get ? data.get(key) : data[key]; -} - -export default Ember.Handlebars.makeBoundHelper(pathBinding); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/preformatted-string.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/preformatted-string.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/preformatted-string.js deleted file mode 100644 index 4ab6a2e..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/preformatted-string.js +++ /dev/null @@ -1,28 +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 function preformattedString (string) { - string = string.replace(/\\n/g, ' '); // newline - string = string.replace(/\\t/g, '	'); // tabs - string = string.replace(/^\s+|\s+$/g, ''); // trim - - return new Ember.Handlebars.SafeString(string); -} - -export default Ember.Handlebars.makeBoundHelper(preformattedString); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/tb-helper.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/tb-helper.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/tb-helper.js deleted file mode 100644 index 81af5ff..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/helpers/tb-helper.js +++ /dev/null @@ -1,33 +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 function tb (key, data) { - var path = data.get ? data.get(key) : data[key]; - - if (!path && key) { - return Ember.I18n.t(key); - } - - if (path) { - return Ember.I18n.t(path); - } -} - -export default Ember.Handlebars.makeBoundHelper(tb); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/index.html ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/index.html b/contrib/views/hive/src/main/resources/ui/hive-web/app/index.html deleted file mode 100644 index 2cbf9f0..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/index.html +++ /dev/null @@ -1,42 +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. ---> -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Hive</title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - {{content-for 'head'}} - - <link rel="stylesheet" href="assets/vendor.css"> - <link rel="stylesheet" href="assets/hive.css"> - - {{content-for 'head-footer'}} - </head> - <body> - {{content-for 'body'}} - - <script src="assets/vendor.js"></script> - <script src="assets/hive.js"></script> - - {{content-for 'body-footer'}} - </body> -</html> http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/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 deleted file mode 100644 index 3f4812b..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js +++ /dev/null @@ -1,348 +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'; - -var TRANSLATIONS; - -export default { - name: 'i18n', - initialize: function () { - Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS = true; - Ember.FEATURES.I18N_TRANSLATE_HELPER_SPAN = false; - Ember.I18n.translations = TRANSLATIONS; - Ember.TextField.reopen(Ember.I18n.TranslateableAttributes); - } -}; - -TRANSLATIONS = { - tooltips: { - refresh: 'Refresh database', - loadSample: 'Load sample data', - query: 'Query', - settings: 'Settings', - visualExplain: 'Visual Explain', - tez: 'Tez', - visualization: 'Visualization', - notifications: 'Notifications', - expand: 'Expand query panel', - makeSettingGlobal: 'Make setting global', - overwriteGlobalValue: 'Overwrite global setting value' - }, - - alerts: { - errors: { - save: { - query: "Error when trying to execute the query", - results: "Error when trying to save the results." - }, - get: { - tables: 'Error when trying to retrieve the tables for the selected database', - columns: 'Error when trying to retrieve the table columns.' - }, - sessions: { - delete: 'Error invalidating sessions' - }, - job: { - status: "An error occured while processing the job." - } - }, - success: { - sessions: { - 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.' - } - } - }, - - modals: { - delete: { - heading: 'Confirm deletion', - message: 'Are you sure you want to delete this item?', - emptyQueryMessage: "Your query is empty. Do you want to delete this item?" - }, - - save: { - heading: 'Saving item', - saveBeforeCloseHeading: "Save item before closing?", - message: 'Enter name:', - overwrite: 'Saving will overwrite previously saved query' - }, - - download: { - csv: 'Download results as CSV', - hdfs: 'Please enter save path and name' - }, - downloadQuery: { - heading: 'Download Query' - }, - changeTitle: { - heading: 'Rename worksheet' - }, - authenticationLDAP: { - heading: 'Enter the LDAP password' - } - }, - - titles: { - database: 'Database Explorer', - explorer: 'Databases', - results: 'Search Results', - settings: 'Database Settings', - query: { - tab: 'Worksheet', - editor: 'Query Editor', - process: 'Query Process Results', - parameters: 'Parameters', - visualExplain: 'Visual Explain', - tez: 'TEZ', - status: 'Status: ', - messages: 'Messages', - visualization: 'Visualization' - }, - download: 'Save results...', - tableSample: '{{tableName}} sample' - }, - - placeholders: { - search: { - tables: 'Search tables...', - columns: 'Search columns in result tables...', - results: 'Filter columns...' - }, - select: { - database: 'Select Database...', - udfs: 'Insert udfs', - file: 'Select File Resource...', - noFileResource: '(no file)', - value: "Select value..." - }, - fileResource: { - name: "resource name", - path: "resource path" - }, - udfs: { - name: 'udf name', - className: 'udf class name', - path: "resource path", - database: 'Select Database...' - }, - settings: { - key: 'mapred.reduce.tasks', - value: '1' - } - }, - - menus: { - query: 'Query', - savedQueries: 'Saved Queries', - history: 'History', - udfs: 'UDFs', - uploadTable: 'Upload Table', - logs: 'Logs', - results: 'Results', - explain: 'Explain' - }, - - columns: { - id: 'id', - shortQuery: 'preview', - fileResource: 'file resource', - title: 'title', - database: 'database', - owner: 'owner', - user: 'user', - date: 'date submitted', - duration: 'duration', - status: 'status', - expand: '', - actions: '' - }, - - buttons: { - addItem: 'Add new item...', - insert: 'Insert', - delete: 'Delete', - cancel: 'Cancel', - edit: 'Edit', - execute: 'Execute', - explain: 'Explain', - saveAs: 'Save as...', - save: 'Save', - downloadQuery: 'Download', - newQuery: 'New Worksheet', - uploadQuery: 'Upload', - newUdf: 'New UDF', - history: 'History', - ok: 'OK', - stopJob: 'Stop execution', - stoppingJob: 'Stopping...', - close: 'Close', - clearFilters: 'Clear filters', - refresh: 'Refresh', - expand: 'Expand message', - collapse: 'Collapse message', - previousPage: 'previous', - uploadTable: 'Upload Table', - showPreview: 'Preview', - nextPage: 'next', - loadMore: 'Load more...', - saveHdfs: 'Save to HDFS', - saveCsv: 'Download as CSV', - runOnTez: 'Run on Tez', - killSession: 'Kill Session' - }, - - labels: { - noTablesMatch: 'No tables match', - noColumnsMatch: 'No columns match', - table: 'Table ', - hrsShort: "{{hours}} hrs", - minsShort: "{{minutes}} mins", - secsShort: "{{seconds}} secs" - }, - - popover: { - visualExplain: { - statistics: "Statistics" - }, - queryEditorHelp: { - title: "Did you know?", - content: { - line1: "Press CTRL + Space to autocomplete", - line2: "You can execute queries with multiple SQL statements delimited by a semicolon ';'", - line3: "You can highlight and run a fragment of a query" - } - }, - add: 'Add' - }, - - tez: { - errors: { - 'not.deployed': "Tez View isn't deployed.", - 'no.instance': "No instance of Tez View found.", - 'no.dag': "No DAG available" - } - }, - - hive: { - errors: { - 'no.query': "No query to process.", - 'emptyDatabase' : "Please select {{ database }}.", - 'emptyTableName' : "Please enter {{ tableNameField }}.", - 'illegalTableName': "Illegal {{ tableNameField }} : '{{ tableName }}'", - 'emptyIsFirstRow' : "{{isFirstRowHeaderField}} cannot be null.", - 'emptyHeaders': "Headers (containing column names) cannot be null.", - 'emptyColumnName': "Column name cannot be null.", - 'illegalColumnName': "Illegal column name : '{{columnName}}' in column number {{index}}", - 'emptyHdfsPath': "HdfsPath Name cannot be null or empty.", - 'illegalHdfPath': "Illegal hdfs path : {{hdfsPath}}" - }, - messages : { - 'generatingPreview':"Generating Preview.", - 'startingToCreateActualTable' : "Starting to create Actual table", - 'waitingToCreateActualTable' : "Waiting for creation of Actual table", - 'successfullyCreatedActualTable' : "Successfully created Actual table.", - 'failedToCreateActualTable' : "Failed to create Actual table.", - 'startingToCreateTemporaryTable' : "Starting to create Temporary table.", - 'waitingToCreateTemporaryTable' : "Waiting for creation of Temporary table.", - 'successfullyCreatedTemporaryTable' : "Successfully created Temporary table.", - 'failedToCreateTemporaryTable' : " Failed to create temporary table.", - 'deletingTable' : "Deleting {{table}} table.", - 'succesfullyDeletedTable' : "Successfully deleted {{ table}} table.", - 'failedToDeleteTable' : "Failed to delete {{table}} table.", - 'startingToUploadFile' : "Starting to upload the file.", - 'waitingToUploadFile' : "Waiting for uploading file.", - 'successfullyUploadedFile' : "Successfully uploaded file.", - 'failedToUploadFile' : "Failed to upload file.", - 'startingToInsertRows' : "Starting to insert rows from temporary table to actual table.", - 'waitingToInsertRows' : "Waiting for insertion of rows from temporary table to actual table.", - 'successfullyInsertedRows' : "Successfully inserted rows from temporary table to actual table.", - 'failedToInsertRows' : "Failed to insert rows from temporary table to actual table.", - 'startingToDeleteTemporaryTable' : "Starting to delete temporary table.", - 'waitingToDeleteTemporaryTable' : "Waiting for deletion of temporary table.", - 'successfullyDeletedTemporaryTable' : "Successfully deleted temporary table", - 'manuallyDeleteTable' : "You will have to manually delete the table {{databaseName}}.{{tableName}}", - 'uploadingFromHdfs' : "Uploading file from HDFS ", - 'successfullyUploadedTableMessage' : "Table {{tableName}} created in database {{databaseName}}", - 'successfullyUploadedTableHeader' : "Uploaded Successfully" - }, - words :{ - temporary : "Temporary", - actual : "Actual", - database : "Database" - }, - ui : { - 'uploadProgress' : "Upload Progress", - 'uploading': "Uploading..", - 'uploadFromLocal':"Upload from Local", - 'uploadFromHdfs':"Upload from HDFS", - 'selectFileType':"Select File Type", - 'fileType':"File type", - 'selectFromLocal':"Select from local", - 'hdfsPath':"HDFS Path", - 'selectDatabase':"Select a Database", - 'tableName':"Table name", - 'tableNameErrorMessage':"Only alphanumeric and underscore characters are allowed in table name.", - 'tableNameTooltip':"Enter valid (alphanumeric + underscore) table name.", - 'storedAs':"Stored as", - 'isFirstRowHeader':"Is first row header ?", - 'columnNameTooltip':"Enter valid (alphanumeric + underscore) column name.", - 'columnNameErrorMessage':"Only alphanumeric and underscore characters are allowed in column names.", - 'hdfsFieldTooltip':"Enter full HDFS path", - 'hdfsFieldPlaceholder':"Enter full HDFS path", - 'hdfsFieldErrorMessage':"Please enter complete path of hdfs file to upload.", - 'containsEndlines': "Contains endlines?", - 'columnDelimiterTooltip': "Delimiter for the column values. Default is comman (,).", - 'escapeCharacterTooltip': "Escape character. Default is backslash (\).", - 'quoteCharacterTooltip': 'Quote character. Default is double quote (").', - 'quoteCharacterField': "Quote Character", - 'escapeCharacterField': "Escape Character", - 'columnDelimterField': "Field Delimiter", - 'fieldsTerminatedByField': "Fields Terminated By", - 'escapedByField': "Escape By", - 'escapedByTooltip': "Escaped By character for Hive table.", - 'fieldsTerminatedByTooltip': "Fields Terminated By character for Hive table.", - 'isFirstRowHeaderTooltip': "Check if the first row of CSV is a header." - } - }, - - 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/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/filterable.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/filterable.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/filterable.js deleted file mode 100644 index aa1f4cd..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/filterable.js +++ /dev/null @@ -1,106 +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 utils from 'hive/utils/functions'; - -export default Ember.Mixin.create({ - init: function () { - this._super(); - this.clearFilters(); - }, - - filter: function (items) { - var self = this; - - if (items && this.get('filters.length')) { - items = items.filter(function (item) { - return self.get('filters').every(function (filter) { - var propValue = item.get(filter.property); - - if (!!filter.value) { - if (filter.min !== undefined && filter.max !== undefined) { - if (utils.isInteger(propValue)) { - return +propValue >= +filter.min && +propValue <= +filter.max; - } else if (utils.isDate(propValue)) { - return propValue >= filter.min && propValue <= filter.max; - } else { - return false; - } - } else if (filter.exactMatch) { - return propValue == filter.value; - } else { - return propValue && propValue.toLowerCase().indexOf(filter.value.toLowerCase()) > -1; - } - } - - return false; - }); - }); - } - - return items; - }, - - updateFilters: function (property, filterValue, exactMatch) { - var addFilter = function () { - if (!filterValue) { - return; - } - - this.get('filters').pushObject(Ember.Object.create({ - property: property, - exactMatch: exactMatch, - min: filterValue.min, - max: filterValue.max, - value: filterValue - })); - }; - - var existentFilter = this.get('filters').find(function (filter) { - return filter.property === property; - }); - - if (existentFilter) { - if (filterValue) { - //remove and add again for triggering collection change thus avoiding to add observers on individual properties of a filter - this.get('filters').removeObject(existentFilter); - addFilter.apply(this); - } else { - //ensures removal of the filterValue when it's an empty string - this.set('filters', this.get('filters').without(existentFilter)); - } - } else { - addFilter.apply(this); - } - }, - - clearFilters: function () { - var filters = this.get('filters'); - - if (!filters || filters.get('length')) { - this.set('filters', Ember.A()); - } - }, - - actions: { - filter: function (property, filterValue) { - this.updateFilters(property, filterValue); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/sortable.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/sortable.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/sortable.js deleted file mode 100644 index f766032..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/mixins/sortable.js +++ /dev/null @@ -1,31 +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.SortableMixin.reopen({ - sort: function (property) { - //if same column has been selected, toggle flag, else default it to true - if (this.get('sortProperties').objectAt(0) === property) { - this.set('sortAscending', !this.get('sortAscending')); - } else { - this.set('sortAscending', true); - this.set('sortProperties', [ property ]); - } - } -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/models/.gitkeep ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/models/.gitkeep b/contrib/views/hive/src/main/resources/ui/hive-web/app/models/.gitkeep deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/models/database.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/models/database.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/models/database.js deleted file mode 100644 index 11ee144..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/models/database.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 DS from 'ember-data'; - -var Database = DS.Model.extend({ - name: DS.attr() -}); - -export default Database;