http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/input-header.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/input-header.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/input-header.js deleted file mode 100644 index 7ff5bf7..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/input-header.js +++ /dev/null @@ -1,61 +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.Component.extend({ - tagName: '', - dataTypes: null, - column: null, - precisionChanged: Ember.observer('column.precision', function () { - var col = this.get('column'); - if( typeof col.precision !== 'number') { - Ember.set(col, 'precision', Number(col.precision)); - } - }), - - scaleChanged: Ember.observer('column.scale', function () { - var col = this.get('column'); - if( typeof col.scale !== 'number'){ - Ember.set(col,'scale',Number(col.scale)); - } - }), - - typeChanged: Ember.observer('column.type', function () { - var col = this.get('column'); - - var type = col.type; - if( type != "DECIMAL" ){ - Ember.set(col,'scale'); - } - - if(type != "VARCHAR" && type != "CHAR" && type != "DECIMAL" ){ - Ember.set(col,'precision'); - } - }), - - noPrecision: Ember.computed('column.type', function () { - var type = this.get('column').type; - return (type == "VARCHAR" || type == "CHAR" || type == "DECIMAL" ) ? false : true; - }), - - noScale: Ember.computed('column.type', function () { - return this.get('column').type == "DECIMAL" ? false : true; - }) - -});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/job-tr-view.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/job-tr-view.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/job-tr-view.js deleted file mode 100644 index f439ca2..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/job-tr-view.js +++ /dev/null @@ -1,41 +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'; -import utils from 'hive/utils/functions'; - -export default Ember.Component.extend({ - tagName: '', - - canStop: function () { - return utils.insensitiveCompare(this.get('job.status'), constants.statuses.running, constants.statuses.initialized, constants.statuses.pending); - }.property('job.status'), - - actions: { - requestFile: function () { - this.toggleProperty('expanded'); - - this.sendAction('onFileRequested', this.get('job')); - }, - - stopJob: function () { - this.sendAction('onStopJob', this.get('job')); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/modal-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/modal-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/modal-widget.js deleted file mode 100644 index ce25bf1..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/modal-widget.js +++ /dev/null @@ -1,58 +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.Component.extend(Ember.I18n.TranslateableProperties, { - show: function () { - var self = this; - - this.$('.modal').modal().on('hidden.bs.modal', function () { - self.sendAction('close'); - }); - }.on('didInsertElement'), - - keyPress: function (e) { - Ember.run.debounce(this, function () { - if (e.which === 13) { - this.send('ok'); - } else if (e.which === 27) { - this.send('close'); - } - }, 200); - }, - - setupEvents: function () { - this.$(document).on('keyup', Ember.$.proxy(this.keyPress, this)); - }.on('didInsertElement'), - - destroyEvents: function () { - this.$(document).off('keyup', Ember.$.proxy(this.keyPress, this)); - }.on('willDestroyElement'), - - actions: { - ok: function () { - this.$('.modal').modal('hide'); - this.sendAction('ok'); - }, - close: function () { - this.$('.modal').modal('hide'); - this.sendAction('close'); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/navbar-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/navbar-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/navbar-widget.js deleted file mode 100644 index 11333d0..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/navbar-widget.js +++ /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. - */ - -import Ember from 'ember'; -import constants from 'hive/utils/constants'; - -export default Ember.Component.extend({ - tagName: 'navigation-bar', - title: constants.appTitle, - - items: Ember.A([ - Ember.Object.create({text: 'menus.query', - path: constants.namingConventions.routes.index}), - - Ember.Object.create({text: 'menus.savedQueries', - path: constants.namingConventions.routes.queries}), - - Ember.Object.create({text: 'menus.history', - path: constants.namingConventions.routes.history}), - - Ember.Object.create({text: 'menus.udfs', - path: constants.namingConventions.routes.udfs}), - - Ember.Object.create({text: 'menus.uploadTable', - path: constants.namingConventions.routes.uploadTable}) - ]) -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js deleted file mode 100644 index 4b723b1..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.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.Component.extend({ - didInsertElement: function () { - var self = this; - - this.$().click(function (e) { - e.stopPropagation(); - - self.sendAction('click', self.get('data')); - }); - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/notify-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/notify-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/notify-widget.js deleted file mode 100644 index ba0f080..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/notify-widget.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.Component.extend({ - tagName: 'notifications', - classNames: [ 'notifications-container' ], - removeNotificationAction: 'removeNotification', - - actions: { - removeNotification: function (notification) { - this.sendAction('removeNotificationAction', notification); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js deleted file mode 100644 index 3b340ad..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js +++ /dev/null @@ -1,79 +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.Component.extend({ - didInsertElement: function () { - var self = this; - var numberRange = this.get('numberRange'); - - if (!numberRange.get('from') && !numberRange.get('to')) { - numberRange.set('from', numberRange.get('min')); - numberRange.set('to', numberRange.get('max')); - } - - this.$('.slider').slider({ - range: true, - min: numberRange.get('min'), - max: numberRange.get('max'), - units: numberRange.get('units'), - values: [numberRange.get('from'), numberRange.get('to')], - - slide: function (event, ui) { - numberRange.set('from', ui.values[0]); - numberRange.set('to', ui.values[1]); - self.updateRangeLables(); - }, - - change: function () { - self.sendAction('rangeChanged', numberRange); - } - }); - this.updateRangeLables(); - this.set('rendered', true); - }, - updateRangeLables: function () { - var numberRange = this.get('numberRange'); - numberRange.set('fromDuration', utils.secondsToHHMMSS(numberRange.get('from'))); - numberRange.set('toDuration', utils.secondsToHHMMSS(numberRange.get('to'))); - }, - updateFrom: function () { - if (this.get('rendered')) { - this.$('.slider').slider('values', 0, this.get('numberRange.from')); - this.updateRangeLables(); - } - }.observes('numberRange.from'), - - updateTo: function () { - if (this.get('rendered')) { - this.$('.slider').slider('values', 1, this.get('numberRange.to')); - this.updateRangeLables(); - } - }.observes('numberRange.to'), - - updateMin: function(){ - this.$( ".slider" ).slider( "option", "min", this.get('numberRange.min') ); - }.observes('numberRange.min'), - - updateMax: function(){ - this.$( ".slider" ).slider( "option", "max", this.get('numberRange.max') ); - }.observes('numberRange.max') - -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js deleted file mode 100644 index e2b4ae8..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js +++ /dev/null @@ -1,30 +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.Component.extend(Ember.I18n.TranslateableProperties, { - tagName: 'panel', - - actions: { - sendMenuItemAction: function (action) { - this.set('menuItemAction', action); - this.sendAction('menuItemAction'); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js deleted file mode 100644 index cfb0c31..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js +++ /dev/null @@ -1,34 +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.Component.extend(Ember.I18n.TranslateableProperties, { - tagName: 'popover', - attributeBindings: [ 'title', 'content:data-content' ], - - didInsertElement: function () { - this.$().popover({ - html: true, - placement: 'left', - trigger: 'hover' - }); - - this.$().attr('data-content', this.$('.hide').html()); - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js deleted file mode 100644 index 9a459c3..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js +++ /dev/null @@ -1,30 +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.Component.extend({ - tagName: 'progress-bar', - - updateValue: function () { - var progress = this.get('value') ? this.get('value').toFixed() : 0; - - this.set('style', 'width: %@%'.fmt(progress)); - this.set('percentage', '%@%'.fmt(progress)); - }.observes('value').on('didInsertElement') -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js deleted file mode 100644 index 34b293c..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js +++ /dev/null @@ -1,129 +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. - */ - -/* global CodeMirror */ - -/** -/* Copyright (C) 2014 by Marijn Haverbeke <mari...@gmail.com> and others - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - - * The above copyright notice and this permission notice shal l be included in - * all copies or substantial portions of the Software. -*/ - -import Ember from 'ember'; - -export default Ember.Component.extend({ - tagName: 'query-editor', - - tablesChanged: function () { - //Format hintOptions object as needed by the CodeMirror - //http://stackoverflow.com/questions/20023381/codemirror-how-add-tables-to-sql-hint - this.set('editor.options.hintOptions', { tables: this.get('tables') }); - }.observes('tables'), - - getColumnsHint: function (cm, tableName) { - var callback = function () { - CodeMirror.showHint(cm); - }; - - this.sendAction('columnsNeeded', tableName, callback); - }, - - initEditor: function () { - var editor, - updateSize, - self = this; - - updateSize = function () { - editor.setSize(self.$(this).width(), self.$(this).height()); - editor.refresh(); - }; - - this.set('editor', CodeMirror.fromTextArea(document.getElementById('code-mirror'), { - mode: 'text/x-hive', - hint: CodeMirror.hint.sql, - indentWithTabs: true, - smartIndent: true, - lineNumbers: true, - matchBrackets : true, - autofocus: true, - extraKeys: {'Ctrl-Space': 'autocomplete'} - })); - - CodeMirror.commands.autocomplete = function (cm) { - var lastWord = cm.getValue().split(' ').pop(); - - //if user wants to fill in a column - if (lastWord.indexOf('.') > -1) { - lastWord = lastWord.split('.')[0]; - - self.getColumnsHint(cm, lastWord); - } else { - CodeMirror.showHint(cm); - } - }; - - editor = this.get('editor'); - - editor.on('cursorActivity', function () { - self.set('highlightedText', editor.getSelections()); - }); - - editor.setValue(this.get('query') || ''); - - editor.on('change', function (instance) { - Ember.run(function () { - self.set('query', instance.getValue()); - }); - }); - - this.$('.CodeMirror').resizable({ - handles: 's', - - resize: function () { - Ember.run.debounce(this, updateSize, 150); - } - }).find('.ui-resizable-s').addClass('grip fa fa-reorder'); - - this.tablesChanged(); - }.on('didInsertElement'), - - updateValue: function () { - var query = this.get('query'); - var editor = this.get('editor'); - - var isFinalExplainQuery = (query.toUpperCase().trim().indexOf('EXPLAIN') > -1); - var editorQuery = editor.getValue(); - - if (editor.getValue() !== query) { - if(isFinalExplainQuery){ - editor.setValue(editorQuery || '') - }else { - editor.setValue(query || ''); - } - } - - }.observes('query') -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/radio-button.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/radio-button.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/radio-button.js deleted file mode 100644 index a07caaf..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/radio-button.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. - */ - -import Ember from 'ember'; - -export default Ember.Component.extend({ - tagName: 'input', - type: 'radio', - attributeBindings: ['type', 'htmlChecked:checked', 'value', 'name', 'disabled'], - - htmlChecked: function() { - return this.get('value') === this.get('checked'); - }.property('value', 'checked'), - - change: function() { - this.set('checked', this.get('value')); - }, - - _updateElementValue: function() { - Ember.run.next(this, function() { - this.$().prop('checked', this.get('htmlChecked')); - }); - }.observes('htmlChecked') -}); \ 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/components/select-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js deleted file mode 100644 index 8bd7a22..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js +++ /dev/null @@ -1,66 +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.Component.extend(Ember.I18n.TranslateableProperties, { - tagName: 'dropdown', - - selectedLabel: function () { - var value; - - //if there's an item selected, retrieve the property to be displayed as a label - if (this.get('selectedValue') && this.get('labelPath')) { - value = this.get('selectedValue').get(this.get('labelPath')); - - if (value) { - return value; - } - } - - //else if a default label has been provided, use it as the selected label. - if (this.get('defaultLabel')) { - return this.get('defaultLabel'); - } - }.property('selectedValue'), - - didInsertElement: function () { - //if no selected item nor defaultLabel, set the selected value - if (!this.get('selectedValue') && !this.get('defaultLabel') && this.get('items')) { - this.set('selectedValue', this.get('items').objectAt(0)); - } - }, - - actions: { - select: function (item){ - this.set('selectedValue', item); - }, - - add: function () { - this.sendAction('itemAdded'); - }, - - edit: function (item) { - this.sendAction('itemEdited', item); - }, - - remove: function (item) { - this.sendAction('itemRemoved', item); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js deleted file mode 100644 index abb1337..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js +++ /dev/null @@ -1,68 +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.Component.extend({ - tagName: 'tabs', - - didInsertElement: function () { - var tabToActivate, - tabs = this.get('tabs'); - - if (tabs.get('length')) { - tabToActivate = tabs.find(function (tab) { - return tab.get('active'); - }); - - if (tabToActivate) { - this.set('selectedTab', tabToActivate); - } else { - this.set('selectedTab', tabs.objectAt(0)); - } - } - }, - - activateTab: function () { - var selectedTab = this.get('selectedTab'); - - selectedTab.set('active', true); - - this.get('tabs').without(selectedTab).forEach(function (tab) { - tab.set('active', false); - }); - }.observes('selectedTab'), - - removeEnabled: function () { - return this.get('canRemove') && this.get('tabs.length') > 1; - }.property('tabs.@each'), - - actions: { - remove: function (tab) { - this.sendAction('removeClicked', tab); - }, - - selectTab: function (tab) { - this.set('selectedTab', tab); - }, - - titleClick: function(tab) { - this.sendAction('onActiveTitleClick', tab); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js deleted file mode 100644 index cd63f52..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Ember from 'ember'; - -export default Ember.Component.extend({ - tagName: 'tree-view' -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js deleted file mode 100644 index 5bc0bda..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js +++ /dev/null @@ -1,108 +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 Typeahead from 'ember-cli-selectize/components/ember-selectize'; -import Ember from 'ember'; - -export default Typeahead.extend(Ember.I18n.TranslateableProperties, { - didInsertElement: function () { - this._super(); - - if (!this.get('selection') && this.get('content.firstObject')) { - this.set('selection', this.get('content.firstObject')); - } - - this.selectize.on('dropdown_close', Ember.$.proxy(this.onClose, this)); - - if($('.selectize-input')) {$('.selectize-input').addClass( "mozBoxSizeFix" );} - - var currentKeyName = this.get('safeValue'); - var currentTypehead = $('*[keyname="' + currentKeyName +'"]'); - - if (currentTypehead.find($('.selectize-input')).has('.item').length == 0) { - currentTypehead.find($('.selectize-input')).addClass("has-options has-items "); - - currentTypehead.find($('.selectized option:selected')).val(currentKeyName); - currentTypehead.find($('.selectized option:selected')).text(currentKeyName); - - currentTypehead.find($('.selectize-input input')).css({'opacity': 0 , 'position': 'absolute' , 'left': '-10000px'}); - - var itemHtml = '<div data-value=' + currentKeyName + ' class=item >' + currentKeyName + '</div>'; - currentTypehead.find($('.selectize-input')).append( itemHtml ); - - } - }, - - removeExcludedObserver: function () { - var options = this.get('content'); - - if (!options) { - options = this.removeExcluded(true); - this.set('content', options); - } else { - this.removeExcluded(); - } - }.observes('exclud...@each.key').on('init'), - - removeExcluded: function (shouldReturn) { - var excluded = this.get('excluded') || []; - var options = this.get('options'); - var selection = this.get('selection'); - var objectToModify = this.get('content'); - var objectsToRemove = []; - var objectsToAdd = []; - - if (!options) { - return; - } - - if (shouldReturn) { - objectToModify = Ember.copy(options); - } - - var valuePath = this.get('optionValuePath'); - var selectionName = selection ? selection[valuePath] : selection; - - if (options) { - options.forEach(function (option) { - if (excluded.contains(option) && option.name !== selectionName) { - objectsToRemove.push(option); - } else if (!objectToModify.contains(option)) { - objectsToAdd.push(option); - } - }); - } - - objectToModify.removeObjects(objectsToRemove); - objectToModify.pushObjects(objectsToAdd); - - return objectToModify; - }, - - onClose: function () { - if (!this.get('selection') && this.get('prevSelection')) { - this.set('selection', this.get('prevSelection')); - } - }, - - _onItemAdd: function (value) { - this._super(value); - - this.set('prevSelection', this.get('selection')); - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/udf-tr-view.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/udf-tr-view.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/udf-tr-view.js deleted file mode 100644 index f019578..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/udf-tr-view.js +++ /dev/null @@ -1,81 +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.Component.extend({ - tagName: 'tr', - - didInsertElement: function () { - this._super(); - - if (this.get('udf.isNew')) { - this.set('udf.isEditing', true); - } - }, - - setfileBackup: function () { - if (!this.get('udf.isDirty')) { - this.set('fileBackup', this.get('udf.fileResource')); - } - }.observes('udf.isDirty').on('didInsertElement'), - - actions: { - editUdf: function () { - this.set('udf.isEditing', true); - }, - - deleteUdf: function () { - this.sendAction('onDeleteUdf', this.get('udf')); - }, - - addFileResource: function () { - this.sendAction('onAddFileResource', this.get('udf')); - }, - - editFileResource: function (file) { - this.set('udf.fileResource', file); - this.set('udf.isEditingResource', true); - }, - - deleteFileResource: function (file) { - this.sendAction('onDeleteFileResource', file); - }, - - save: function () { - this.sendAction('onSaveUdf', this.get('udf')); - }, - - cancel: function () { - var self = this; - - this.set('udf.isEditing', false); - this.set('udf.isEditingResource', false); - - this.udf.get('fileResource').then(function (file) { - if (file) { - file.rollback(); - } - - self.udf.rollback(); - self.udf.set('fileResource', self.get('fileBackup')); - }); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/upload-query.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/upload-query.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/upload-query.js deleted file mode 100644 index e9a7ffa..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/upload-query.js +++ /dev/null @@ -1,32 +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 EmberUploader from 'ember-uploader'; - -export default EmberUploader.FileField.extend({ - - attributeBindings: ['id', 'style'], - id: 'upload', - style: 'display:none', - initialize: function() { - this.$().on('change', function(e) { - this.sendAction('filesUploaded', e.currentTarget.files); - }.bind(this)); - }.on('didInsertElement') - }); - http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/validated-text-field.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/validated-text-field.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/validated-text-field.js deleted file mode 100644 index 2379a15..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/validated-text-field.js +++ /dev/null @@ -1,62 +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'; - -/** Example : - * {{#validated-text-field - * inputValue=bindedTextValue invalidClass='form-control red-border' validClass='form-control' regex="^[a-z]+$" - * allowEmpty=false tooltip="Enter valid word" errorMessage="Please enter valid word" placeholder="Enter Word"}} - * {{/validated-text-field}} - */ -export default Ember.Component.extend({ - classNameBindings: ['tagClassName'], - tagClassName : false, // set it to non false value if you want a specific class to be assigned - allowEmpty: true, - valid: true, - setValid: function () { - this.set("valid", true); - this.set("inputClass", this.get("validClass")); - this.set("message", this.get("tooltip")); - }, - setInvalid: function () { - this.set("valid", false); - this.set("inputClass", this.get("invalidClass")); - this.set("message", this.get("errorMessage")); - }, - onChangeInputValue: function () { - var regStr = this.get("regex"); - var regExp = new RegExp(regStr, "g"); - if (this.get("inputValue")) { - var arr = this.get("inputValue").match(regExp); - if (arr != null && arr.length == 1) { - this.setValid(); - } - else { - this.setInvalid(); - } - } else { - if (this.get("allowEmpty")) { - this.setValid(); - } else { - this.setInvalid(); - } - } - }.observes("inputValue").on('init') -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/components/visualization-tabs-widget.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/visualization-tabs-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/visualization-tabs-widget.js deleted file mode 100644 index 4980b7a..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/visualization-tabs-widget.js +++ /dev/null @@ -1,56 +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.Component.extend({ - tagName: 'tabs', - - didInsertElement: function () { - var tabToActivate, - tabs = this.get('tabs'); - - if (tabs.get('length')) { - tabToActivate = tabs.find(function (tab) { - return tab.get('active'); - }); - - if (tabToActivate) { - this.set('selectedTab', tabToActivate); - } else { - this.set('selectedTab', tabs.objectAt(0)); - } - } - }, - - activateTab: function () { - var selectedTab = this.get('selectedTab'); - - selectedTab.set('active', true); - - this.get('tabs').without(selectedTab).forEach(function (tab) { - tab.set('active', false); - }); - }.observes('selectedTab'), - - actions: { - selectTab: function (tab) { - this.set('selectedTab', tab); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/.gitkeep ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/.gitkeep b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/.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/controllers/application.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/application.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/application.js deleted file mode 100644 index 9a01d53..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/application.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Ember from 'ember'; -import constants from 'hive/utils/constants'; - -export default Ember.Controller.extend({ - notifyService: Ember.inject.service(constants.namingConventions.notify), - - notifications: Ember.computed.alias('notifyService.notifications'), -}); \ 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/controllers/databases.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js deleted file mode 100644 index fbd726c..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js +++ /dev/null @@ -1,465 +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'; -import ENV from '../config/environment'; - -export default Ember.Controller.extend({ - databaseService: Ember.inject.service(constants.namingConventions.database), - notifyService: Ember.inject.service(constants.namingConventions.notify), - ldapAuthenticationService: Ember.inject.service(constants.namingConventions.ldapAuthentication), - - pageCount: 10, - - previousSelectedDatabaseName : "" , - selectedDatabase: Ember.computed.alias('databaseService.selectedDatabase'), - databases: Ember.computed.alias('databaseService.databases'), - - tableSearchResults: Ember.Object.create(), - - isDatabaseRefreshInProgress: false, - showColumnsResultAlert: false, - textColumnSearchTerm:'', - - tableControls: [ - { - icon: 'fa-list', - action: 'loadSampleData', - tooltip: Ember.I18n.t('tooltips.loadSample') - } - ], - - panelIconActions: [ - { - icon: 'fa-refresh', - action: 'refreshDatabaseExplorer', - tooltip: Ember.I18n.t('tooltips.refresh') - } - ], - - tabs: [ - Ember.Object.create({ - name: Ember.I18n.t('titles.explorer'), - visible: true, - view: constants.namingConventions.databaseTree - }), - Ember.Object.create({ - name: Ember.I18n.t('titles.results'), - view: constants.namingConventions.databaseSearch - }) - ], - - _handleError: function (error) { - this.get('notifyService').error(error); - this.set('isLoading', false); - }, - - setTablePageAvailability: function (database) { - var result; - - if (database.get('hasNext')) { - result = true; - } else if (database.tables.length > database.get('visibleTables.length')) { - //if there are hidden tables - result = true; - } - - database.set('canGetNextPage', result); - }, - - setColumnPageAvailability: function (table) { - var result; - - if (table.get('hasNext')) { - result = true; - } else if (table.columns.length > table.get('visibleColumns.length')) { - //if there are hidden columns - result = true; - } - - table.set('canGetNextPage', result); - }, - - selectedDatabaseChanged: function () { - var self = this; - - this.resetSearch(); - - this.set('isLoading', true); - - this.get('databaseService').getAllTables().then(function () { - self.set('isLoading', false); - self.set('previousSelectedDatabaseName',self.get('selectedDatabase').get('name')); - self.get('notifyService').info("Selected database : "+self.get('selectedDatabase').get('name')); - }, function (error) { - self.get('notifyService').pushError("Error while selecting database : "+self.get('selectedDatabase').get('name'),error.responseJSON.message+"\n"+error.responseJSON.trace); - self.get('databaseService').setDatabaseByName(self.get('previousSelectedDatabaseName')); - self.set('isLoading', false); - }); - }.observes('selectedDatabase'), - - getNextColumnPage: function (database, table) { - var self = this; - - this.set('isLoading', true); - - if (!table.columns) { - table.columns = []; - table.set('visibleColumns', []); - } - - this.get('databaseService').getColumnsPage(database.get('name'), table).then(function (result) { - table.columns.pushObjects(result.columns); - table.get('visibleColumns').pushObjects(result.columns); - table.set('hasNext', result.hasNext); - - self.setColumnPageAvailability(table); - self.set('isLoading', false); - }, function (err) { - self._handleError(err); - }); - }, - - getNextTablePage: function (database) { - var self = this; - - this.set('isLoading', true); - - if (!database.tables) { - database.tables = []; - database.set('visibleTables', []); - } - - this.get('databaseService').getTablesPage(database).then(function (result) { - database.tables.pushObjects(result.tables); - database.get('visibleTables').pushObjects(result.tables); - database.set('hasNext', result.hasNext); - - self.setTablePageAvailability(database); - self.set('isLoading', false); - }, function (err) { - self._handleError(err); - }); - }, - - getDatabases: function () { - var self = this; - var selectedDatabase = this.get('selectedDatabase.name') || 'default'; - - this.set('isDatabaseRefreshInProgress', true); - - this.set('isLoading', true); - - this.get('databaseService').getDatabases().then(function (databases) { - self.set('isLoading'); - self.get('databaseService').setDatabaseByName(selectedDatabase); - }).catch(function (error) { - self._handleError(error); - - if(error.status == 401) { - self.send('openLdapPasswordModal'); - } - }).finally(function() { - self.set('isDatabaseRefreshInProgress', false); - }); - }.on('init'), - - syncDatabases: function() { - this.set('isDatabaseRefreshInProgress', true); - var oldDatabaseNames = this.store.all('database').mapBy('name'); - var self = this; - return this.get('databaseService').getDatabasesFromServer().then(function(data) { - // Remove the databases from store which are not in server - data.forEach(function(dbName) { - if(!oldDatabaseNames.contains(dbName)) { - self.store.createRecord('database', { - id: dbName, - name: dbName - }); - } - }); - // Add the databases in store which are new in server - oldDatabaseNames.forEach(function(dbName) { - if(!data.contains(dbName)) { - self.store.find('database', dbName).then(function(db) { - self.store.unloadRecord(db); - }); - } - }); - }).finally(function() { - self.set('isDatabaseRefreshInProgress', false); - }); - }, - - initiateDatabaseSync: function() { - // This was required so that the unit test would not stall - if(ENV.environment !== "test") { - Ember.run.later(this, function() { - if (this.get('isDatabaseRefreshInProgress') === false) { - this.syncDatabases(); - this.initiateDatabaseSync(); - } - }, 15000); - } - }.on('init'), - - resetSearch: function() { - var resultsTab = this.get('tabs').findBy('view', constants.namingConventions.databaseSearch); - var databaseExplorerTab = this.get('tabs').findBy('view', constants.namingConventions.databaseTree); - var tableSearchResults = this.get('tableSearchResults'); - resultsTab.set('visible', false); - this.set('selectedTab', databaseExplorerTab); - this.set('tableSearchTerm', ''); - this.set('columnSearchTerm', ''); - tableSearchResults.set('tables', undefined); - tableSearchResults.set('hasNext', undefined); - }, - - - actions: { - refreshDatabaseExplorer: function () { - if (this.get('isDatabaseRefreshInProgress') === false) { - this.getDatabases(); - this.resetSearch(); - } else { - console.log("Databases refresh is in progress. Skipping this request."); - } - }, - - openLdapPasswordModal: function(){ - - var self = this, - defer = Ember.RSVP.defer(); - - this.send('openModal', 'modal-save', { - heading: "modals.authenticationLDAP.heading", - text:"", - type: "password", - defer: defer - }); - - defer.promise.then(function (text) { - var ldapAuthPromise = self.get('ldapAuthenticationService').authenticateLdapPassword(text); - - ldapAuthPromise.then(function (data) { - console.log( "LDAP done: " + data ); - self.getDatabases(); - self.syncDatabases(); - }, function (error) { - console.log( "LDAP fail: " + error ); - self.get('notifyService').error( "Wrong Credentials." ); - }) - }); - - }, - - loadSampleData: function (tableName, database) { - var self = this; - this.send('addQuery', Ember.I18n.t('titles.tableSample', { tableName: tableName })); - - Ember.run.later(function () { - var query = constants.sampleDataQuery.fmt(tableName); - - self.set('selectedDatabase', database); - self.send('executeQuery', constants.jobReferrer.sample, query); - }); - }, - - getTables: function (dbName) { - var database = this.get('databases').findBy('name', dbName), - tables = database.tables, - pageCount = this.get('pageCount'); - - if (!tables) { - this.getNextTablePage(database); - } else { - database.set('visibleTables', tables.slice(0, pageCount)); - this.setTablePageAvailability(database); - } - }, - - getColumns: function (tableName, database) { - var table = database.get('visibleTables').findBy('name', tableName), - pageCount = this.get('pageCount'), - columns = table.columns; - - if (!columns) { - this.getNextColumnPage(database, table); - } else { - table.set('visibleColumns', columns.slice(0, pageCount)); - this.setColumnPageAvailability(table); - } - }, - - showMoreTables: function (database) { - var tables = database.tables, - visibleTables = database.get('visibleTables'), - visibleCount = visibleTables.length; - - if (!tables) { - this.getNextTablePage(database); - } else { - if (tables.length > visibleCount) { - visibleTables.pushObjects(tables.slice(visibleCount, visibleCount + this.get('pageCount'))); - this.setTablePageAvailability(database); - } else { - this.getNextTablePage(database); - } - } - }, - - showMoreColumns: function (table, database) { - var columns = table.columns, - visibleColumns = table.get('visibleColumns'), - visibleCount = visibleColumns.length; - - if (!columns) { - this.getNextColumnPage(database, table); - } else { - if (columns.length > visibleCount) { - visibleColumns.pushObjects(columns.slice(visibleCount, visibleCount + this.get('pageCount'))); - this.setColumnPageAvailability(table); - } else { - this.getNextColumnPage(database, table); - } - } - }, - - searchTables: function (searchTerm) { - var self = this, - resultsTab = this.get('tabs').findBy('view', constants.namingConventions.databaseSearch), - tableSearchResults = this.get('tableSearchResults'); - - searchTerm = searchTerm ? searchTerm.toLowerCase() : ''; - - this.set('showColumnsResultAlert', false); - - this.set('tablesSearchTerm', searchTerm); - resultsTab.set('visible', true); - this.set('selectedTab', resultsTab); - this.set('columnSearchTerm', ''); - this.set('isLoading', true); - - this.get('databaseService').getTablesPage(this.get('selectedDatabase'), searchTerm, true).then(function (result) { - tableSearchResults.set('tables', result.tables); - tableSearchResults.set('hasNext', result.hasNext); - - self.set('isLoading', false); - }, function (err) { - self._handleError(err); - }); - }, - - searchColumns: function (searchTerm) { - var self = this, - database = this.get('selectedDatabase'), - resultsTab = this.get('tabs').findBy('view', constants.namingConventions.databaseSearch), - tables = this.get('tableSearchResults.tables'); - - searchTerm = searchTerm ? searchTerm.toLowerCase() : ''; - - this.set('columnSearchTerm', searchTerm); - this.set('textColumnSearchTerm', searchTerm); - - this.set('selectedTab', resultsTab); - this.set('isLoading', true); - this.set('showColumnsResultAlert', false); - - var tableCount = tables.length || 0; - var noColumnMatchTableCount = 0; - - tables.forEach(function (table) { - self.get('databaseService').getColumnsPage(database.get('name'), table, searchTerm, true).then(function (result) { - - if(Ember.isEmpty(result.columns)){ - noColumnMatchTableCount = noColumnMatchTableCount + 1; - } - table.set('columns', result.columns); - table.set('hasNext', result.hasNext); - - if (tables.indexOf(table) === tables.get('length') -1) { - self.set('isLoading', false); - } - - // This will execute only in the last interation - if(noColumnMatchTableCount === tableCount) { - self.set('showColumnsResultAlert', true); - } - }, function (err) { - self._handleError(err); - }); - }); - }, - - showMoreResultTables: function () { - var self = this, - database = this.get('selectedDatabase'), - tableSearchResults = this.get('tableSearchResults'), - searchTerm = this.get('tableSearchTerm'); - - this.set('isLoading', true); - - this.get('databaseService').getTablesPage(database, searchTerm).then(function (tablesResult) { - var tables = tableSearchResults.get('tables'); - var shouldGetColumns = tables.any(function (table) { - return table.get('columns.length') > 0; - }); - - tables.pushObjects(tablesResult.tables); - tableSearchResults.set('hasNext', tablesResult.hasNext); - - //if user has already searched for columns for the previously loaded tables, - //load the columns search results for the newly loaded tables. - if (shouldGetColumns) { - tablesResult.tables.forEach(function (table) { - self.get('databaseService').getColumnsPage(database.get('name'), table, self.get('columnSearchTerm'), true).then(function (result) { - table.set('columns', result.columns); - table.set('hasNext', result.hasNext); - - if (tablesResult.tables.indexOf(table) === tablesResult.tables.get('length') -1) { - self.set('isLoading', false); - } - }, function (err) { - self._handleError(err); - }); - }); - } else { - self.set('isLoading', false); - } - }, function (err) { - self._handleError(err); - }); - }, - - showMoreResultColumns: function (table) { - var self = this; - - this.set('isLoading', true); - - this.get('databaseService').getColumnsPage(this.get('selectedDatabase.name'), table, this.get('columnSearchTerm')).then(function (result) { - table.get('columns').pushObjects(result.columns); - table.set('hasNext', result.hasNext); - - self.set('isLoading', false); - }, function (err) { - self._handleError(err); - }); - } - } -}); http://git-wip-us.apache.org/repos/asf/ambari/blob/c0f9621f/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js deleted file mode 100644 index fa12e3f..0000000 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js +++ /dev/null @@ -1,257 +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, { - jobService: Ember.inject.service('job'), - fileService: Ember.inject.service('file'), - historyService: Ember.inject.service('history'), - NUM_OF_DAYS: 5, - REFRESH_INTERVAL_SEC: 30000, - sortAscending: false, - sortProperties: ['dateSubmittedTimestamp'], - - refresher: function () { - var self = this; - Ember.run.later(function () { - if (self.get('isShowing')) { - self.refresh(); - } - self.refresher(); - }, self.get('REFRESH_INTERVAL_SEC')); - }, - onLoadRoute: function () { - this.set('isShowing', true); - }, - onUnloadRoute: function () { - this.set('isShowing', false); - }, - init: function () { - this._super(); - var self = this; - var fromTime = moment().subtract(this.get('NUM_OF_DAYS'), 'days').startOf('day'); - var time = moment(); - var toTime = moment({ - years: time.year(), - months: time.month(), - date: time.date(), - hours: 23, - minutes: 59, - seconds: 59, - milliseconds: 999 - }); // next 12AM - - this.set('columns', Ember.ArrayProxy.create({ - content: Ember.A([ - Ember.Object.create({ - caption: 'columns.title', - property: 'title', - link: constants.namingConventions.subroutes.historyQuery - }), - Ember.Object.create({ - caption: 'columns.status', - property: 'status' - }), - Ember.Object.create({ - caption: 'columns.date', - property: 'dateSubmittedTimestamp', - dateRange: Ember.Object.create({ - min: fromTime.toDate(), - max: toTime.toDate() - }) - }), - Ember.Object.create({ - caption: 'columns.duration', - property: 'duration', - numberRange: Ember.Object.create({ - min: 0, - max: 10, - units: 'sec' - }) - }) - ]) - })); - - return this.updateJobs(fromTime, toTime).then(function (data) { - self.applyDurationFilter(); - self.refresher(); - }); - }, - applyDurationFilter: function () { - var self = this; - var durationColumn = this.get('columns').find(function (column) { - return column.get('caption') === 'columns.duration'; - }); - var from = durationColumn.get('numberRange.from'); - var to = durationColumn.get('numberRange.to'); - self.filterBy("duration", {min: from, max: to}); - }, - updateIntervals: function () { - var durationColumn; - var maxDuration; - var minDuration; - - if (this.get('columns')) { - durationColumn = this.get('columns').find(function (column) { - return column.get('caption') === 'columns.duration'; - }); - - var items = this.get('history').map(function (item) { - return item.get(durationColumn.get('property')); - }); - - minDuration = items.length ? Math.min.apply(Math, items) : 0; - maxDuration = items.length ? Math.max.apply(Math, items) : 60; //Default 1 min - - durationColumn.set('numberRange.min', minDuration); - durationColumn.set('numberRange.max', maxDuration); - var from = durationColumn.get('numberRange.from'); - var to = durationColumn.get('numberRange.to'); - if (from > maxDuration) { - durationColumn.set("numberRange.from", maxDuration); - } - if (to < minDuration) { - durationColumn.set("numberRange.to", minDuration); - } - } - }.observes('history'), - - model: function () { - return this.filter(this.get('history')); - }.property('history', 'filters.@each'), - - updateJobs: function (fromDate, toDate) { - var self = this; - var fromTime = moment(fromDate).startOf('day').toDate().getTime(); - var time = moment(toDate); - var toTime = moment({ - years: time.year(), - months: time.month(), - date: time.date(), - hours: 23, - minutes: 59, - seconds: 59, - milliseconds: 999 - }).toDate().getTime(); // next 12AM - this.set("fromTime", fromTime); - this.set("toTime", toTime); - return this.get("historyService").getJobs(fromTime, toTime).then(function (data) { - self.set('history', data); - }); - }, - - filterBy: function (filterProperty, filterValue, exactMatch) { - var column = this.get('columns').find(function (column) { - return column.get('property') === filterProperty; - }); - - if (column) { - var isDateColumn = column.get('caption') === 'columns.date'; - column.set('filterValue', filterValue, exactMatch); - if (isDateColumn) { - return this.updateJobs(filterValue.min, filterValue.max); - } else { - this.updateFilters(filterProperty, filterValue, exactMatch); - } - } else { - this.updateFilters(filterProperty, filterValue, exactMatch); - } - }, - - refresh: function () { - var self = this; - this.get('historyService').getUpdatedJobList(this.get('toTime')).then(function (data) { - self.set('history', data); - }); - }, - - actions: { - - refreshJobs: function () { - this.refresh(); - }, - - filterUpdated: function (filterProperty, filterValue) { - var self = this; - var column = this.get('columns').find(function (column) { - return column.get('property') === filterProperty; - }); - - var isDateColumn = (column.get('caption') === 'columns.date'); - - if (column) { - column.set('filterValue', filterValue); - if (isDateColumn) { - return this.updateJobs(filterValue.min, filterValue.max).then(function (data) { - self.updateFilters(filterProperty, filterValue); - }); - } else { - self.updateFilters(filterProperty, filterValue); - } - } - }, - - 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]); - } - }, - - interruptJob: function (job) { - this.get('jobService').stopJob(job); - }, - - loadFile: function (job) { - this.get('fileService').loadFile(job.get('queryFile')).then(function (file) { - job.set('file', file); - }); - }, - - clearFilters: function () { - var columns = this.get('columns'); - - if (columns) { - columns.forEach(function (column) { - var filterValue = column.get('filterValue'); - var rangeFilter; - - if (filterValue) { - if (typeof filterValue === 'string') { - column.set('filterValue'); - } else { - rangeFilter = column.get('numberRange') || column.get('dateRange'); - - rangeFilter.set('from', rangeFilter.get('min')); - rangeFilter.set('to', rangeFilter.get('max')); - } - } - }); - } - - //call clear filters from Filterable mixin - this.clearFilters(); - } - } -});