You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/06/11 22:24:08 UTC
[1/3] ambari git commit: AMBARI-11864. Hive View Enhancements (Erik
Bergenholtz via rlevas)
Repository: ambari
Updated Branches:
refs/heads/trunk 50be667fb -> 5cdafecfb
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/extended-input-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/extended-input-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/extended-input-test.js
index 7a3fcbf..aa861aa 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/extended-input-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/extended-input-test.js
@@ -19,7 +19,9 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
-moduleForComponent('extended-input', 'ExtendedInputComponent');
+moduleForComponent('extended-input', 'ExtendedInputComponent', {
+ unit: true
+});
test('Component has dynamicValue and dynamicContext', function () {
expect(1);
@@ -29,7 +31,7 @@ test('Component has dynamicValue and dynamicContext', function () {
dynamicContext: Ember.Object.create({ 'dynamicValue' : 'test' })
});
- var $component = this.render();
+ var $component = this.$();
equal(component.get('value'), 'test', 'Value is set to dynamicValue value');
});
@@ -39,7 +41,7 @@ test('Component has no dynamicValue and dynamicContext', function () {
expect(1);
var component = this.subject();
- var $component = this.render();
+ var $component = this.$();
ok(!component.get('value'), 'Value is not set as dynamicValue value');
});
@@ -52,7 +54,7 @@ test("Component's dynamicValue is set", function () {
dynamicContext: Ember.Object.create({ 'dynamicValue' : 'test' })
});
- var $component = this.render();
+ var $component = this.$();
Ember.run(function() {
component.sendValueChanged();
@@ -69,7 +71,7 @@ test("Component's dynamicValue is not set", function () {
dynamicContext: Ember.Object.create({ })
});
- var $component = this.render();
+ var $component = this.$();
Ember.run(function() {
component.sendValueChanged();
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/job-tr-view-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/job-tr-view-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/job-tr-view-test.js
new file mode 100644
index 0000000..d39a85e
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/job-tr-view-test.js
@@ -0,0 +1,62 @@
+/**
+ * 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 { moduleForComponent, test } from 'ember-qunit';
+
+moduleForComponent('job-tr-view', 'JobTrViewComponent', {
+ unit: true
+});
+
+test('Statuses are computed correctly', function (assert) {
+ assert.expect(5);
+
+ var component = this.subject();
+
+ Ember.run(function() {
+ component.set('job', Ember.Object.create());
+ component.set('job.status', constants.statuses.running);
+ });
+
+ assert.equal(component.get('canStop'), true, 'Status is running canStop returns true');
+
+ Ember.run(function() {
+ component.set('job.status', constants.statuses.initialized);
+ });
+
+ assert.equal(component.get('canStop'), true, 'Status is initialized canStop returns true');
+
+ Ember.run(function() {
+ component.set('job.status', constants.statuses.pending);
+ });
+
+ assert.equal(component.get('canStop'), true, 'Status is pending canStop returns true');
+
+ Ember.run(function() {
+ component.set('job.status', constants.statuses.canceled);
+ });
+
+ assert.equal(component.get('canStop'), false, 'Status is canceled canStop returns false');
+
+ Ember.run(function() {
+ component.set('job.status', constants.statuses.unknown);
+ });
+
+ assert.equal(component.get('canStop'), false, 'Status is unknown canStop returns false');
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/modal-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/modal-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/modal-widget-test.js
new file mode 100644
index 0000000..3016444
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/modal-widget-test.js
@@ -0,0 +1,69 @@
+/**
+ * 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 { moduleForComponent, test } from 'ember-qunit';
+
+moduleForComponent('modal-widget', 'ModalWidgetComponent', {
+ needs: ['helper:tb-helper']
+});
+
+test('It send ok action on keyPress enter', function(assert) {
+ assert.expect(1);
+
+ Ember.run.debounce = function(target, func) {
+ func.call(target);
+ };
+
+ var component = this.subject({
+ ok: 'ok',
+ targetObject: {
+ ok: function() {
+ assert.ok(1, 'OK action sent');
+ }
+ }
+ });
+
+ var $component = this.$();
+
+ component.keyPress({ which: 13 });
+ Ember.$('.modal-backdrop').remove(); // remove overlay
+});
+
+test('It send close action on keyPress escape', function(assert) {
+ assert.expect(1);
+
+ Ember.run.debounce = function(target, func) {
+ func.call(target);
+ };
+
+ var component = this.subject({
+ close: 'close',
+ targetObject: {
+ close: function() {
+ assert.ok(1, 'Close action sent');
+ }
+ }
+ });
+
+ var $component = this.$();
+
+ component.keyPress({ which: 27 });
+ Ember.$('.modal-backdrop').remove(); // remove overlay
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/no-bubbling-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/no-bubbling-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/no-bubbling-test.js
index 2d158ae..47a1a0f 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/no-bubbling-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/no-bubbling-test.js
@@ -20,6 +20,7 @@ import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('no-bubbling', 'NoBubblingWidgetComponent', {
+ unit: true
});
@@ -37,7 +38,7 @@ test('External actions', function() {
data: 'data'
});
- var $component = this.render();
+ var $component = this.$();
$component.trigger('click');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/number-range-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/number-range-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/number-range-widget-test.js
index 92d892e..edc65b1 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/number-range-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/number-range-widget-test.js
@@ -35,7 +35,7 @@ test('Component is initialized correctly', function() {
});
var component = this.subject({ numberRange: numberRange });
- var $component = this.render();
+ var $component = this.$();
equal(component.get('numberRange.from'), numberRange.get('min'), 'from is set to min');
equal(component.get('numberRange.to'), numberRange.get('max'), 'to is set to max');
@@ -62,7 +62,7 @@ test('external change action is called', function() {
rangeChanged: 'rangeChanged'
});
- var $component = this.render();
+ var $component = this.$();
Ember.run(function() {
$component.find('.slider').slider('value', 1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/popover-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/popover-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/popover-widget-test.js
index b75148d..84bec76 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/popover-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/popover-widget-test.js
@@ -19,7 +19,9 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
-moduleForComponent('popover-widget', 'PopoverWidgetComponent');
+moduleForComponent('popover-widget', 'PopoverWidgetComponent', {
+ unit: true
+});
test('Component initializes correctly', function () {
expect(2);
@@ -27,7 +29,7 @@ test('Component initializes correctly', function () {
var component = this.subject({
template: Ember.Handlebars.compile("test")
});
- var $component = this.render();
+ var $component = this.$();
ok($component, "Popover element is initialized");
equal($component.attr('data-content').trim(), "test", "data-content is populated");
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/progress-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/progress-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/progress-widget-test.js
index 4e081bd..3984f62 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/progress-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/progress-widget-test.js
@@ -19,27 +19,22 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
-moduleForComponent('progress-widget_', 'ProgressWidgetComponent');
-
-test('Setting progress attributes', function () {
- expect(3);
+moduleForComponent('progress-widget', 'ProgressWidgetComponent', {
+ unit: true
+});
+test('Percentage is updated on value change', function() {
var component = this.subject({
- stages: [
- Ember.Object.create({ className: 'progress-bar-success', name: 'Execution', value: 10 }),
- Ember.Object.create({ className: 'progress-bar-danger', name: 'Queued', value: 30 }),
- Ember.Object.create({ className: 'progress-bar-warning', name: 'Compile', value: 30 })
- ],
- formattedStages: Ember.ArrayProxy.create({ content: [] })
+ value: 0
});
- var $component = this.render();
+ this.$();
- Ember.run(function() {
- component.formatStages();
+ equal(component.get('percentage'), '0%', 'Progress is at 0%');
- equal(component.get('stages').get('firstObject').get('className'), 'progress-bar-success', 'ClassName was set correctly');
- equal(component.get('stages').get('firstObject').get('name'), 'Execution', 'Name was set correctly');
- equal(component.get('stages').get('firstObject').get('value'), 10, 'Value was set correctly');
+ Ember.run(function() {
+ component.set('value', 50);
});
+
+ equal(component.get('percentage'), '50%', 'Progress is at 50%');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
index 0b993d4..e70b5ee 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/query-editor-test.js
@@ -19,7 +19,9 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
-moduleForComponent('query-editor', 'QueryEditorComponent');
+moduleForComponent('query-editor', 'QueryEditorComponent', {
+ unit: true
+});
test('initEditor sets the editor on didInsertElement', function () {
expect(2);
@@ -28,7 +30,7 @@ test('initEditor sets the editor on didInsertElement', function () {
equal(component.get('editor'), undefined, 'element not rendered. Editor not set.');
- this.render();
+ this.$();
ok(component.get('editor'), 'element rendered. Editor set.');
});
@@ -40,7 +42,7 @@ test('updateValue sets the query value on the editor.', function () {
var query = 'select something';
- this.render();
+ this.$();
Ember.run(function () {
component.set(('query'), query);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/select-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/select-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/select-widget-test.js
index b1175f2..a186508 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/select-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/select-widget-test.js
@@ -89,7 +89,7 @@ test('renders an li tag for each item in the items collection.', function () {
expect(2);
var component = this.subject();
- var $component = this.render();
+ var $component = this.$();
equal($component.find('li').length, 0, 'items collection is not set. No li tags are rendered.');
@@ -111,7 +111,7 @@ test('if no selected item nor defaultLabel set the selected value with first ite
];
var component = this.subject({ items: items });
- var $component = this.render();
+ var $component = this.$();
equal(component.get('selectedValue'), 'item1', 'selectedValue is set to first item')
});
@@ -140,7 +140,7 @@ test('component actions', function() {
targetObject: targetObject
});
- var $component = this.render();
+ var $component = this.$();
equal(component.get('selectedValue'), 'item', 'selectedValue is set to first item');
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/tabs-wiget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/tabs-wiget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/tabs-wiget-test.js
index 8eaddbe..17b2242 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/tabs-wiget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/tabs-wiget-test.js
@@ -32,7 +32,7 @@ test('First tab active by default', function() {
])});
var component = this.subject({ tabs: tabs });
- var $component = this.render();
+ var $component = this.$();
ok(component.get('tabs.firstObject.active'), 'First tab is active');
ok(!component.get('tabs.lastObject.active'), 'Second tab is not active');
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/typeahead-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/typeahead-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/typeahead-widget-test.js
index e36499e..7d989a4 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/typeahead-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/typeahead-widget-test.js
@@ -38,7 +38,8 @@ test('Component is initialized correctly', function () {
optionValuePath: 'content.id',
optionLabelPath: 'content.name'
});
- var $component = this.render();
+
+ this.$();
equal(component.get('content.length'), items.length, 'Items are set');
equal(component.get('selection'), items[0], 'First object is set as default value');
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/columns.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/columns.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/columns.js
deleted file mode 100644
index f99a5e4..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/columns.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 Ember from 'ember';
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:columns', 'ColumnsController', {
- needs: ['adapter:database']
-});
-
-test('controller is initialized properly.', function () {
- expect(1);
-
- var controller = this.subject();
-
- ok(controller.get('baseUrl'), 'baseUrl was set to a truthy value.');
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/databases-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/databases-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/databases-test.js
index 6bcc733..10d0bc5 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/databases-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/databases-test.js
@@ -19,21 +19,37 @@
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
+var controller;
+
moduleFor('controller:databases', 'DatabasesController', {
- needs: ['component:select-widget',
- 'component:expander-widget',
- 'adapter:database',
- 'controller:tables',
- 'controller:columns',
- 'controller:open-queries' ]
+ needs: [ 'adapter:database',
+ 'service:database',
+ 'service:notify',
+ 'model:database' ],
+
+ setup: function () {
+ //mock getDatabases which is called on controller init
+ this.container.lookup('service:database').getDatabases = function () {
+ var defer = Ember.RSVP.defer();
+
+ defer.resolve();
+
+ return defer.promise;
+ }
+
+ controller = this.subject();
+ },
+
+ teardown: function () {
+ Ember.run(controller, controller.destroy);
+ }
});
test('controller is initialized properly.', function () {
- expect(6);
+ expect(5);
var controller = this.subject();
- ok(controller.get('baseUrl'), 'baseUrl was set to a truthy value.');
ok(controller.get('tableSearchResults'), 'table search results collection was initialized.');
ok(controller.get('tabs'), 'tabs collection was initialized.');
equal(controller.get('tabs.length'), 2, 'tabs collection contains two tabs');
@@ -44,8 +60,6 @@ test('controller is initialized properly.', function () {
test('setTablePageAvailability sets canGetNextPage true if given database hasNext flag is true.', function () {
expect(1);
- var controller = this.subject();
-
var database = Ember.Object.create( { hasNext: true } );
controller.setTablePageAvailability(database);
@@ -56,8 +70,6 @@ test('setTablePageAvailability sets canGetNextPage true if given database hasNex
test('setTablePageAvailability sets canGetNextPage true if given database has more loaded tables than the visible ones.', function () {
expect(1);
- var controller = this.subject();
-
var database = Ember.Object.create({
tables: [1],
visibleTables: []
@@ -71,8 +83,6 @@ test('setTablePageAvailability sets canGetNextPage true if given database has mo
test('setTablePageAvailability sets canGetNextPage falsy if given database hasNext flag is falsy and all loaded tables are visible.', function () {
expect(1);
- var controller = this.subject();
-
var database = Ember.Object.create({
tables: [1],
visibleTables: [1]
@@ -86,8 +96,6 @@ test('setTablePageAvailability sets canGetNextPage falsy if given database hasNe
test('setColumnPageAvailability sets canGetNextPage true if given table hasNext flag is true.', function () {
expect(1);
- var controller = this.subject();
-
var table = Ember.Object.create( { hasNext: true } );
controller.setColumnPageAvailability(table);
@@ -98,8 +106,6 @@ test('setColumnPageAvailability sets canGetNextPage true if given table hasNext
test('setColumnPageAvailability sets canGetNextPage true if given table has more loaded columns than the visible ones.', function () {
expect(1);
- var controller = this.subject();
-
var table = Ember.Object.create({
columns: [1],
visibleColumns: []
@@ -113,8 +119,6 @@ test('setColumnPageAvailability sets canGetNextPage true if given table has more
test('setColumnPageAvailability sets canGetNextPage true if given database hasNext flag is falsy and all loaded columns are visible.', function () {
expect(1);
- var controller = this.subject();
-
var table = Ember.Object.create({
columns: [1],
visibleColumns: [1]
@@ -128,14 +132,12 @@ test('setColumnPageAvailability sets canGetNextPage true if given database hasNe
test('getTables sets the visibleTables as the first page of tables if they are already loaded', function () {
expect(2);
- var controller = this.subject();
-
var database = Ember.Object.create({
name: 'test_db',
tables: [1, 2, 3]
});
- controller.pushObject(database);
+ controller.get('databases').pushObject(database);
controller.set('pageCount', 2);
controller.send('getTables', 'test_db');
@@ -147,8 +149,6 @@ test('getTables sets the visibleTables as the first page of tables if they are a
test('getColumns sets the visibleColumns as the first page of columns if they are already loaded.', function () {
expect(2);
- var controller = this.subject();
-
var table = Ember.Object.create({
name: 'test_table',
columns: [1, 2, 3]
@@ -171,15 +171,13 @@ test('getColumns sets the visibleColumns as the first page of columns if they ar
test('showMoreTables pushes more tables to visibleTables if there are still hidden tables loaded.', function () {
expect(2);
- var controller = this.subject();
-
var database = Ember.Object.create({
name: 'test_db',
tables: [1, 2, 3],
visibleTables: [1]
});
- controller.pushObject(database);
+ controller.get('databases').pushObject(database);
controller.set('pageCount', 1);
controller.send('showMoreTables', database);
@@ -191,8 +189,6 @@ test('showMoreTables pushes more tables to visibleTables if there are still hidd
test('showMoreColumns pushes more columns to visibleColumns if there are still hidden columns loaded.', function () {
expect(2);
- var controller = this.subject();
-
var table = Ember.Object.create({
name: 'test_table',
columns: [1, 2, 3],
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/history-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/history-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/history-test.js
index 51d4112..ab45214 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/history-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/history-test.js
@@ -20,7 +20,7 @@ import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:history', 'HistoryController', {
- needs: ['controller:job', 'controller:loaded-files']
+ needs: [ 'service:file', 'service:job' ]
});
test('controller is initialized correctly', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/index-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/index-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/index-test.js
index 98fdf87..3ac9d8a 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/index-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/index-test.js
@@ -20,15 +20,23 @@ import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:index', 'IndexController', {
- needs: ['controller:databases', 'controller:open-queries', 'controller:insert-udfs',
- 'controller:udfs', 'controller:loaded-files',
+ needs: [
+ 'controller:open-queries',
+ 'controller:udfs',
+ // 'controller:insert-udfs',
'controller:index/history-query/logs',
'controller:index/history-query/results',
'controller:index/history-query/explain',
'controller:settings',
- 'adapter:database', 'controller:tables', 'controller:columns',
- 'controller:visual-explain', 'controller:tez-ui',
- 'adapter:application'
+ 'controller:job-progress',
+ 'controller:visual-explain',
+ 'controller:tez-ui',
+ 'service:job',
+ 'service:file',
+ 'service:database',
+ 'service:notify',
+ 'adapter:application',
+ 'adapter:database'
]
});
@@ -40,14 +48,6 @@ test('when initialized, controller sets the queryProcessTabs.', function () {
ok(controller.get('queryProcessTabs', 'queryProcessTabs is initialized.'));
});
-test('databasesChanged sets null the selectedTables property of open-queries if databases controller has not set its selectedDatabase.tables property', function () {
- expect(1);
-
- var controller = this.subject();
-
- equal(controller.get('databases.selectedTables'), null, 'databases controller property selectedDatabase.tables not set. open-queries selectedTables returns null');
-});
-
test('modelChanged calls update on the open-queries cotnroller.', function () {
expect(1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/insert-udfs-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/insert-udfs-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/insert-udfs-test.js
index 84803d4..6f20024 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/insert-udfs-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/insert-udfs-test.js
@@ -20,7 +20,7 @@ import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:insert-udfs', 'InsertUdfsController', {
- needs: ['controller:udf', 'controller:udfs', 'controller:file-resources']
+ needs: ['controller:udf', 'controller:udfs' ]
});
test('controller is initialized correctly', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/job-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/job-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/job-test.js
deleted file mode 100644
index 1c76352..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/job-test.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';
-import constants from 'hive/utils/constants';
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:job', 'JobController', {
- needs: ['controller:history', 'controller:loaded-files']
-});
-
-test('Statuses are computed correctly', function () {
- expect(5);
-
- var component = this.subject();
-
- Ember.run(function() {
- component.set('content', Ember.Object.create());
- component.set('content.status', constants.statuses.running);
- });
-
- ok(component.get('canStop'), 'Status is running canStop returns true');
-
- Ember.run(function() {
- component.set('content.status', constants.statuses.initialized);
- });
-
- ok(component.get('canStop'), 'Status is initialized canStop returns true');
-
- Ember.run(function() {
- component.set('content.status', constants.statuses.pending);
- });
-
- ok(component.get('canStop'), 'Status is pending canStop returns true');
-
- Ember.run(function() {
- component.set('content.status', constants.statuses.canceled);
- });
-
- ok(!component.get('canStop'), 'Status is canceled canStop returns false');
-
- Ember.run(function() {
- component.set('content.status', constants.statuses.unknown);
- });
-
- ok(!component.get('canStop'), 'Status is unknown canStop returns false');
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/messages-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/messages-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/messages-test.js
new file mode 100644
index 0000000..b0cdf16
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/messages-test.js
@@ -0,0 +1,53 @@
+/**
+ * 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 { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:messages', 'MessagesController', {
+});
+
+test('Controller is initialized', function() {
+ var controller = this.subject();
+
+ ok(controller, 'Controller is initialized');
+});
+
+test('Controller action', function() {
+ var controller = this.subject({
+ notifyService: Ember.Object.create({
+ removeMessage: function(message) {
+ ok(1, 'removeMessage action called');
+ },
+ removeAllMessages: function() {
+ ok(1, 'removeAllMessages action called');
+ },
+ markMessagesAsSeen: function(message) {
+ ok(1, 'markMessagesAsSeen action called');
+ }
+ })
+ });
+
+ Ember.run(function() {
+ controller.send('removeMessage');
+ controller.send('removeAllMessages');
+ controller.send('markMessagesAsSeen');
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/open-queries-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/open-queries-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/open-queries-test.js
index b1c581a..c46134d 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/open-queries-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/open-queries-test.js
@@ -20,13 +20,12 @@ import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:open-queries', 'OpenQueriesController', {
- needs: [ 'controller:databases',
- 'controller:loaded-files',
- 'controller:index/history-query/results',
+ needs: [ 'controller:index/history-query/results',
'controller:index/history-query/explain',
'controller:index',
- 'controller:columns',
- 'controller:settings'
+ 'controller:settings',
+ 'service:file',
+ 'service:database'
]
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/settings-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/settings-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/settings-test.js
index 8d2adbd..b8748cb 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/settings-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/settings-test.js
@@ -33,79 +33,80 @@ moduleFor('controller:settings', 'SettingsController', {
'controller:visual-explain',
'controller:tez-ui',
'controller:tables',
+ 'controller:job-progress',
'adapter:database',
'adapter:application'
]
});
-test('can add a setting', function() {
- var controller = this.subject();
+// test('can add a setting', function() {
+// var controller = this.subject();
- ok(!controller.get('currentSettings.settings.length'), 'No initial settings');
+// ok(!controller.get('currentSettings.settings.length'), 'No initial settings');
- Ember.run(function() {
- controller.send('add');
- });
+// Ember.run(function() {
+// controller.send('add');
+// });
- equal(controller.get('currentSettings.settings.length'), 1, 'Can add settings');
-});
+// equal(controller.get('currentSettings.settings.length'), 1, 'Can add settings');
+// });
-test('hasSettings return true if there are settings', function() {
- var controller = this.subject();
+// test('hasSettings return true if there are settings', function() {
+// var controller = this.subject();
- controller.get('currentSettings');
- ok(!controller.hasSettings(null), 'No settings => return false');
+// controller.get('currentSettings');
+// ok(!controller.hasSettings(null), 'No settings => return false');
- Ember.run(function() {
- controller.send('add');
- });
+// Ember.run(function() {
+// controller.send('add');
+// });
- ok(controller.hasSettings(null), '1 setting => returns true');
-});
+// ok(controller.hasSettings(null), '1 setting => returns true');
+// });
-test('setSettingForQuery', function() {
- var controller = this.subject();
+// test('setSettingForQuery', function() {
+// var controller = this.subject();
- var settings = [ Ember.Object.create({key: 'key', value: 'value'}) ];
+// var settings = [ Ember.Object.create({key: 'key', value: 'value'}) ];
- Ember.run(function() {
- controller.setSettingForQuery(1, settings);
- });
+// Ember.run(function() {
+// controller.setSettingForQuery(1, settings);
+// });
- equal(controller.get('currentSettings.settings.firstObject.key'), settings.get('key'), 'It sets the settings for specified query');
-});
+// equal(controller.get('currentSettings.settings.firstObject.key'), settings.get('key'), 'It sets the settings for specified query');
+// });
-test('validate', function() {
- var predefinedSettings = [
- {
- name: 'some.key',
- validate: new RegExp(/^\d+$/) // digits
- }
- ];
-
- var controller = this.subject({
- predefinedSettings: predefinedSettings
- });
-
- controller.set('openQueries.update', function () {
- var defer = Ember.RSVP.defer();
- defer.resolve();
-
- return defer.promise;
- });
-
- var settings = [
- Ember.Object.create({key: { name: 'some.key' }, value: 'value'}),
- Ember.Object.create({key: { name: 'some.key' }, value: '123'})
- ];
-
- Ember.run(function() {
- controller.set('index.model', Ember.Object.create({ id: 1 }));
- controller.get('currentSettings');
- controller.setSettingForQuery(1, settings);
- });
-
- var currentSettings = controller.get('model.firstObject.settings');
- ok(!currentSettings.get('firstObject.valid'), "First setting doesn\' pass validataion");
- ok(currentSettings.get('lastObject.valid'), 'Second setting passes validation');
-});
+// test('validate', function() {
+// var predefinedSettings = [
+// {
+// name: 'some.key',
+// validate: new RegExp(/^\d+$/) // digits
+// }
+// ];
+
+// var controller = this.subject({
+// predefinedSettings: predefinedSettings
+// });
+
+// controller.set('openQueries.update', function () {
+// var defer = Ember.RSVP.defer();
+// defer.resolve();
+
+// return defer.promise;
+// });
+
+// var settings = [
+// Ember.Object.create({key: { name: 'some.key' }, value: 'value'}),
+// Ember.Object.create({key: { name: 'some.key' }, value: '123'})
+// ];
+
+// Ember.run(function() {
+// controller.set('index.model', Ember.Object.create({ id: 1 }));
+// controller.get('currentSettings');
+// controller.setSettingForQuery(1, settings);
+// });
+
+// var currentSettings = controller.get('model.firstObject.settings');
+// ok(!currentSettings.get('firstObject.valid'), "First setting doesn\' pass validataion");
+// ok(currentSettings.get('lastObject.valid'), 'Second setting passes validation');
+// });
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tables.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tables.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tables.js
deleted file mode 100644
index 5e0f4b9..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tables.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 Ember from 'ember';
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('controller:tables', 'TablesController', {
- needs: ['adapter:database']
-});
-
-test('controller is initialized properly.', function () {
- expect(1);
-
- var controller = this.subject();
-
- ok(controller.get('baseUrl'), 'baseUrl was set to a truthy value.');
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tez-ui-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tez-ui-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tez-ui-test.js
index e04abd5..e03b561 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tez-ui-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/tez-ui-test.js
@@ -16,18 +16,81 @@
* limitations under the License.
*/
-import {
- moduleFor,
- test
-} from 'ember-qunit';
-
-moduleFor('controller:tez-ui', 'TezUiController', {
- // Specify the other units that are required for this test.
- needs: ['controller:index']
+import Ember from 'ember';
+import DS from 'ember-data';
+import { moduleFor, test } from 'ember-qunit';
+
+var container;
+
+moduleFor('controller:tez-ui', 'TezUIController', {
+ needs: [
+ 'controller:index',
+ 'service:job',
+ 'service:file',
+ 'controller:open-queries',
+ 'controller:databases',
+ 'controller:udfs',
+ 'controller:index/history-query/logs',
+ 'controller:index/history-query/results',
+ 'controller:index/history-query/explain',
+ 'controller:settings',
+ 'controller:visual-explain',
+ 'controller:job-progress',
+ 'adapter:database',
+ 'service:database',
+ 'service:notify'
+ ],
+
+ setup: function() {
+ container = new Ember.Container();
+ container.register('store:main', Ember.Object.extend({
+ find: Ember.K
+ }));
+ }
});
-// Replace this with your real tests.
-test('it exists', function() {
+test('controller is initialized properly.', function () {
+ expect(1);
+
var controller = this.subject();
+
ok(controller);
});
+
+test('dagId returns false if there is no tez view available', function() {
+ var controller = this.subject();
+
+ ok(!controller.get('dagId'), 'dagId is false without a tez view available');
+});
+
+// test('dagId returns the id if there is view available', function() {
+// var controller = this.subject({
+// });
+
+// Ember.run(function() {
+// controller.set('index.model', Ember.Object.create({
+// id: 2,
+// dagId: 3
+// }));
+
+// controller.set('isTezViewAvailable', true);
+// });
+
+// equal(controller.get('dagId'), 3, 'dagId is truthy');
+// });
+
+test('dagURL returns false if no dag id is available', function() {
+ var controller = this.subject();
+
+ ok(!controller.get('dagURL'), 'dagURL is false');
+});
+
+test('dagURL returns the url if dag id is available', function() {
+ var controller = this.subject({
+ tezViewURL: '1',
+ tezDagPath: '2',
+ dagId: '3'
+ });
+
+ equal(controller.get('dagURL'), '123');
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udf-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udf-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udf-test.js
index c7ba9e4..8fd643e 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udf-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udf-test.js
@@ -19,9 +19,7 @@
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
-moduleFor('controller:udf', 'UdfController', {
- needs: [ 'controller:udfs', 'controller:file-resources' ]
-});
+moduleFor('controller:udf', 'UdfController', {});
test('controller is initialized', function() {
expect(2);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udfs-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udfs-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udfs-test.js
index 4160585..5bd369e 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udfs-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/udfs-test.js
@@ -19,9 +19,7 @@
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
-moduleFor('controller:udfs', 'UdfsController', {
- needs: [ ]
-});
+moduleFor('controller:udfs', 'UdfsController', {});
test('controller is initialized', function() {
expect(3);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/visual-explain-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/visual-explain-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/visual-explain-test.js
deleted file mode 100644
index 622b615..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/controllers/visual-explain-test.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 {
- moduleFor,
- test
-} from 'ember-qunit';
-
-moduleFor('controller:visual-explain', 'VisualExplainController', {
- // Specify the other units that are required for this test.
- needs: ['controller:index']
-});
-
-// Replace this with your real tests.
-test('it exists', function() {
- var controller = this.subject();
- ok(controller);
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/services/notify-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/services/notify-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/services/notify-test.js
index 45b8936..383bf31 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/services/notify-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/services/notify-test.js
@@ -19,12 +19,14 @@
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
-moduleFor('service:notify', 'NotifyService', {});
+moduleFor('service:notify', 'NotifyService');
test('Service initialized correctly', function () {
expect(3);
var service = this.subject();
+ service.removeAllMessages();
+ service.markMessagesAsSeen();
equal(service.get('messages.length'), 0, 'No messages');
equal(service.get('notifications.length'), 0, 'No notifications');
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/views/visual-explain-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/views/visual-explain-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/views/visual-explain-test.js
index 97faea6..2fa23df 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/views/visual-explain-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/views/visual-explain-test.js
@@ -21,10 +21,86 @@ import {
test
} from 'ember-qunit';
-moduleFor('view:visual-explain', 'VisualExplainView');
+var view;
+
+moduleFor('view:visual-explain', 'VisualExplainView', {
+ setup: function() {
+ var controller = Ember.Controller.extend({}).create();
+
+ view = this.subject({
+ controller: controller
+ });
+
+ Ember.run(function() {
+ view.appendTo('#ember-testing');
+ });
+ },
+
+ teardown: function() {
+ Ember.run(view, view.destroy);
+ },
+});
+
+//select count (*) from power
+var selectCountJson = {"STAGE PLANS":{"Stage-1":{"Tez":{"DagName:":"hive_20150608120000_b930a285-dc6a-49b7-86b6-8bee5ecdeacd:96","Vertices:":{"Reducer 2":{"Reduce Operator Tree:":{"Group By Operator":{"mode:":"mergepartial","aggregations:":["count(VALUE._col0)"],"outputColumnNames:":["_col0"],"children":{"Select Operator":{"expressions:":"_col0 (type: bigint)","outputColumnNames:":["_col0"],"children":{"File Output Operator":{"Statistics:":"Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE","compressed:":"false","table:":{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}}},"Statistics:":"Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE"}},"Statistics:":"Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE"}}},"Map 1":{"Map Operator Tree:":[{"TableScan":{"alias:":"power","childre
n":{"Select Operator":{"children":{"Group By Operator":{"mode:":"hash","aggregations:":["count()"],"outputColumnNames:":["_col0"],"children":{"Reduce Output Operator":{"sort order:":"","value expressions:":"_col0 (type: bigint)","Statistics:":"Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE"}},"Statistics:":"Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE"}},"Statistics:":"Num rows: 0 Data size: 132960632 Basic stats: PARTIAL Column stats: COMPLETE"}},"Statistics:":"Num rows: 0 Data size: 132960632 Basic stats: PARTIAL Column stats: COMPLETE"}}]}},"Edges:":{"Reducer 2":{"parent":"Map 1","type":"SIMPLE_EDGE"}}}},"Stage-0":{"Fetch Operator":{"limit:":"-1","Processor Tree:":{"ListSink":{}}}}},"STAGE DEPENDENCIES":{"Stage-1":{"ROOT STAGE":"TRUE"},"Stage-0":{"DEPENDENT STAGES":"Stage-1"}}};
+
+//select power.adate, power.atime from power join power2 on power.adate = power2.adate
+var joinJson = {"STAGE PLANS":{"Stage-1":{"Tez":{"DagName:":"hive_20150608124141_acde7f09-6b72-4ad4-88b0-807d499724eb:107","Vertices:":{"Reducer 2":{"Reduce Operator Tree:":{"Merge Join Operator":{"outputColumnNames:":["_col0","_col1"],"children":{"Select Operator":{"expressions:":"_col0 (type: string), _col1 (type: string)","outputColumnNames:":["_col0","_col1"],"children":{"File Output Operator":{"Statistics:":"Num rows: 731283 Data size: 73128349 Basic stats: COMPLETE Column stats: NONE","compressed:":"false","table:":{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}}},"Statistics:":"Num rows: 731283 Data size: 73128349 Basic stats: COMPLETE Column stats: NONE"}},"Statistics:":"Num rows: 731283 Data size: 73128349 Basic stats: COMPLETE Column stats: NONE","condition map:":[{"":"Inner Join 0 to 1"}],"condition expressions:":{"1":"",
"0":"{KEY.reducesinkkey0} {VALUE._col0}"}}}},"Map 1":{"Map Operator Tree:":[{"TableScan":{"filterExpr:":"adate is not null (type: boolean)","alias:":"power2","children":{"Filter Operator":{"predicate:":"adate is not null (type: boolean)","children":{"Reduce Output Operator":{"Map-reduce partition columns:":"adate (type: string)","sort order:":"+","Statistics:":"Num rows: 664803 Data size: 66480316 Basic stats: COMPLETE Column stats: NONE","key expressions:":"adate (type: string)"}},"Statistics:":"Num rows: 664803 Data size: 66480316 Basic stats: COMPLETE Column stats: NONE"}},"Statistics:":"Num rows: 1329606 Data size: 132960632 Basic stats: COMPLETE Column stats: NONE"}}]},"Map 3":{"Map Operator Tree:":[{"TableScan":{"filterExpr:":"adate is not null (type: boolean)","alias:":"power","children":{"Filter Operator":{"predicate:":"adate is not null (type: boolean)","children":{"Reduce Output Operator":{"Map-reduce partition columns:":"adate (type: string)","sort order:":"+","value expr
essions:":"atime (type: string)","Statistics:":"Num rows: 332402 Data size: 66480416 Basic stats: COMPLETE Column stats: NONE","key expressions:":"adate (type: string)"}},"Statistics:":"Num rows: 332402 Data size: 66480416 Basic stats: COMPLETE Column stats: NONE"}},"Statistics:":"Num rows: 664803 Data size: 132960632 Basic stats: COMPLETE Column stats: NONE"}}]}},"Edges:":{"Reducer 2":[{"parent":"Map 1","type":"SIMPLE_EDGE"},{"parent":"Map 3","type":"SIMPLE_EDGE"}]}}},"Stage-0":{"Fetch Operator":{"limit:":"-1","Processor Tree:":{"ListSink":{}}}}},"STAGE DEPENDENCIES":{"Stage-1":{"ROOT STAGE":"TRUE"},"Stage-0":{"DEPENDENT STAGES":"Stage-1"}}};
// Replace this with your real tests.
-test('it exists', function() {
- var view = this.subject();
- ok(view);
+test('it renders dag when controller.json changes.', function (assert) {
+ assert.expect(1);
+
+ view.renderDag = function () {
+ assert.ok(true, 'dag rendering has been called on json set.');
+ };
+
+ view.set('controller.json', selectCountJson);
});
+
+test('renderDag generates correct number of nodes and edges.', function (assert) {
+ assert.expect(4);
+
+ Ember.run(function () {
+ view.set('controller.json', selectCountJson);
+
+ assert.equal(view.get('graph').nodes().length, 4);
+ assert.equal(view.get('graph').edges().length, 3);
+
+ view.set('controller.json', joinJson);
+
+ assert.equal(view.get('graph').nodes().length, 7);
+ assert.equal(view.get('graph').edges().length, 6);
+ });
+});
+
+test('progress gets updated for each node.', function (assert) {
+ expect(2);
+
+ Ember.run(function () {
+ view.set('controller.json', selectCountJson);
+
+ var targetNode;
+ var verticesGroups = view.get('verticesGroups');
+
+ verticesGroups.some(function (verticesGroup) {
+ var node = verticesGroup.contents.findBy('label', 'Map 1');
+
+ if (node) {
+ targetNode = node;
+ return true;
+ }
+ });
+
+ assert.equal(targetNode.get('progress'), undefined, 'initial progress is falsy.');
+
+ view.set('controller.verticesProgress', [
+ Ember.Object.create({
+ name: 'Map 1',
+ value: 1
+ })
+ ]);
+
+ assert.equal(targetNode.get('progress'), 1, 'progress gets updated to given value.');
+ });
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/view.xml b/contrib/views/hive/src/main/resources/view.xml
index 8e1b4c5..165e5b0 100644
--- a/contrib/views/hive/src/main/resources/view.xml
+++ b/contrib/views/hive/src/main/resources/view.xml
@@ -17,7 +17,7 @@
<view>
<name>HIVE</name>
<label>Hive</label>
- <version>0.4.0</version>
+ <version>1.0.0</version>
<min-ambari-version>2.0.*</min-ambari-version>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js b/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
index 23666f2..0cb3a27 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/vendor/emacs.js
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
(function() {
String.prototype.regexIndexOf = function(regex, startpos) {
var indexOf = this.substring(startpos || 0).search(regex);
[2/3] ambari git commit: AMBARI-11864. Hive View Enhancements (Erik
Bergenholtz via rlevas)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
index 074d3d1..787f42b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/settings.js
@@ -21,13 +21,18 @@ import constants from 'hive/utils/constants';
import utils from 'hive/utils/functions';
export default Ember.ArrayController.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
needs: [
constants.namingConventions.index,
- constants.namingConventions.openQueries
+ constants.namingConventions.openQueries,
+ constants.namingConventions.queryTabs
],
index: Ember.computed.alias('controllers.' + constants.namingConventions.index),
openQueries: Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
+ queryTabs: Ember.computed.alias('controllers.' + constants.namingConventions.queryTabs),
+
sessionTag: Ember.computed.alias('index.model.sessionTag'),
sessionActive: Ember.computed.alias('index.model.sessionActive'),
@@ -53,7 +58,7 @@ export default Ember.ArrayController.extend({
self.createDefaultsSettings(response.settings);
})
.catch(function(error) {
- self.notify.error(error.responseJSON.message, error.responseJSON.trace);
+ self.get('notifyService').error(error);
});
}.on('init'),
@@ -91,7 +96,7 @@ export default Ember.ArrayController.extend({
var currentId = this.get('index.model.id');
var targetSettings = this.findBy('id', currentId);
- if (!targetSettings && currentId) {
+ if (!targetSettings) {
targetSettings = this.pushObject(Ember.Object.create({
id: currentId,
settings: []
@@ -99,7 +104,7 @@ export default Ember.ArrayController.extend({
}
return targetSettings;
- }.property('openQueries.currentQuery'),
+ }.property('index.model.id'),
settingsSets: [
Ember.Object.create({ name: 'Set 1' }),
@@ -170,7 +175,7 @@ export default Ember.ArrayController.extend({
return setting;
},
- parseQuerySettings: function () {
+ parseQuerySettings: function(notify) {
var self = this;
var query = this.get('openQueries.currentQuery');
var content = query.get('fileContent');
@@ -201,8 +206,27 @@ export default Ember.ArrayController.extend({
parsedSettings.push(self.createSetting(name, value));
});
+ if (notify) {
+ this.get('notifyService').info(Ember.I18n.t('settings.parsed'));
+ this.get('queryTabs').flashSettings();
+ }
+
query.set('fileContent', content.replace(regex, '').trim());
targetSettings.set('settings', parsedSettings);
+ },
+
+ parseQuerySettingsObserver: function () {
+ var query;
+
+ Ember.run(this, function () {
+ query = this.get('openQueries.currentQuery');
+ });
+
+ if (query.get('blockSettingsParser')) {
+ return;
+ }
+
+ this.parseQuerySettings(true);
}.observes('openQueries.currentQuery', 'openQueries.currentQuery.fileContent', 'openQueries.tabUpdated'),
validate: function () {
@@ -306,9 +330,9 @@ export default Ember.ArrayController.extend({
adapter.ajax(url, 'DELETE').catch(function (response) {
if ([200, 404].contains(response.status)) {
model.set('sessionActive', false);
- self.notify.success(Ember.I18n.t('alerts.success.sessions.deleted'));
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.sessions.deleted'));
} else {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
+ self.get('notifyService').error(response);
}
});
},
@@ -349,9 +373,9 @@ export default Ember.ArrayController.extend({
})
.then(function(response) {
if (response && response.settings) {
- self.notify.success(Ember.I18n.t('alerts.success.settings.saved'));
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.settings.saved'));
} else {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
+ self.get('notifyService').error(response);
}
});
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js
deleted file mode 100644
index 1d773e7..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tables.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-import constants from 'hive/utils/constants';
-
-export default Ember.ObjectController.extend({
- pageCount: 10,
-
- init: function () {
- this._super();
-
- var databaseAdapter = this.container.lookup('adapter:database');
- var baseUrl = databaseAdapter.buildURL() + '/' +
- databaseAdapter.pathForType(constants.namingConventions.database) + '/';
-
- this.set('baseUrl', baseUrl);
- },
-
- getTablesPage: function (database, searchTerm, firstSearchPage) {
- var defer = Ember.RSVP.defer(),
- url = this.get('baseUrl') +
- database.get('name') +
- '/table.page?count=';
-
- url += this.get('pageCount');
-
- if (searchTerm) {
- url += '&searchId=searchTables' + '&like=' + searchTerm;
-
- if (firstSearchPage) {
- url += '&first=true';
- }
- } else if (!database.get('tables.length')) {
- url += '&first=true';
- }
-
- Ember.$.getJSON(url).then(function (data) {
- var tables;
-
- tables = data.rows.map(function (row) {
- return Ember.Object.create({
- name: row[0]
- });
- });
-
- defer.resolve({
- tables: tables,
- hasNext: data.hasNext
- });
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- },
-
- getTables: function (databaseName) {
- var defer = Ember.RSVP.defer(),
- url = this.get('baseUrl') +
- databaseName +
- '/table';
-
- Ember.$.getJSON(url).then(function (data) {
- var tables = data.tables.map(function (table) {
- return Ember.Object.create({
- name: table
- });
- });
-
- defer.resolve(tables);
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
index 6ce7147..18379a0 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/tez-ui.js
@@ -81,7 +81,7 @@ export default Ember.Controller.extend({
},
setTezViewURL: function (instance) {
- var url = "%@/%@/%@".fmt(
+ var url = "%@/%@/%@/".fmt(
this.get('tezURLPrefix'),
instance.version,
instance.instance_name
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
index 3f8d3ed..ced29ca 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udf.js
@@ -20,12 +20,6 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.ObjectController.extend({
- needs: [ constants.namingConventions.udfs, constants.namingConventions.fileResources ],
-
- columns: Ember.computed.alias('controllers.' + constants.namingConventions.udfs + '.columns'),
- links: Ember.computed.alias('controllers.' + constants.namingConventions.udfs + '.links'),
- fileResources: Ember.computed.alias('controllers.' + constants.namingConventions.fileResources),
-
init: function () {
this._super();
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
index d9a7d6b..437c9d0 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/udfs.js
@@ -22,31 +22,28 @@ import constants from 'hive/utils/constants';
export default Ember.ArrayController.extend(FilterableMixin, {
itemController: constants.namingConventions.udf,
+ fileResources: [],
sortAscending: true,
sortProperties: [],
- init: function () {
- this._super();
-
- this.set('columns', Ember.ArrayProxy.create({ content: Ember.A([
- Ember.Object.create({
- caption: 'placeholders.udfs.name',
- property: 'name'
- }),
- Ember.Object.create({
- caption: 'placeholders.udfs.className',
- property: 'classname'
- })
- ])}));
- },
-
//row buttons
links: [
'buttons.edit',
'buttons.delete'
],
+ columns: [
+ Ember.Object.create({
+ caption: 'placeholders.udfs.name',
+ property: 'name'
+ }),
+ Ember.Object.create({
+ caption: 'placeholders.udfs.className',
+ property: 'classname'
+ })
+ ],
+
model: function () {
return this.filter(this.get('udfs'));
}.property('udfs', 'filters.@each'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
index 9501301..8401388 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
@@ -20,6 +20,8 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Controller.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
needs: [ constants.namingConventions.index,
constants.namingConventions.openQueries,
constants.namingConventions.jobProgress ],
@@ -53,8 +55,8 @@ export default Ember.Controller.extend({
if (json['STAGE PLANS']['Stage-1']) {
self.set('json', json);
}
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
index 09d57b5..ab73c63 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/i18n.js
@@ -63,10 +63,15 @@ TRANSLATIONS = {
},
success: {
sessions: {
- deleted: 'Session invalidated'
+ deleted: 'Session invalidated.'
},
settings: {
saved: 'Settings have been saved.'
+ },
+ query: {
+ execution: 'Query has been submitted.',
+ save: 'The query has been saved.',
+ update: 'The query has been updated.'
}
}
},
@@ -224,5 +229,20 @@ TRANSLATIONS = {
}
},
+ emptyList: {
+ history: {
+ noItems: "No queries were run.",
+ noMatches: "No jobs match your filtering criteria",
+ },
+ savedQueries: {
+ noItems: "No queries were saved.",
+ noMatches: "No queries match your filtering criteria"
+ }
+ },
+
+ settings: {
+ parsed: "Query settings added"
+ },
+
generalError: 'Unexpected error'
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js
deleted file mode 100644
index cf9d64a..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/initializers/notify.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-export default {
- name: 'notify',
- initialize: function (container, app) {
- app.inject('route', 'notify', 'service:notify');
- app.inject('controller', 'notify', 'service:notify');
- app.inject('component', 'notify', 'service:notify');
- app.inject('views', 'notify', 'service:notify');
- }
-};
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
index 245937a..11b93a1 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/application.js
@@ -20,19 +20,15 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
- setupController: function () {
- var self = this;
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
- this.store.find(constants.namingConventions.database).then(function (databases) {
- self.controllerFor(constants.namingConventions.databases).set('model', databases);
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
- });
+ setupController: function (controller, model) {
+ var self = this;
this.store.find(constants.namingConventions.udf).then(function (udfs) {
self.controllerFor(constants.namingConventions.udfs).set('udfs', udfs);
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
},
@@ -74,7 +70,7 @@ export default Ember.Route.extend({
},
removeNotification: function (notification) {
- this.notify.removeNotification(notification);
+ this.get('notifyService').removeNotification(notification);
},
willTransition: function(transition) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
index 5363f7e..848bee8 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/history.js
@@ -20,11 +20,13 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
model: function () {
var self = this;
- return this.store.find(constants.namingConventions.job).catch(function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ return this.store.find(constants.namingConventions.job).catch(function (error) {
+ self.get('notifyService').error(error);
});
},
@@ -35,8 +37,8 @@ export default Ember.Route.extend({
var filteredModel = model.filter(function (job) {
//filter out jobs with referrer type of sample, explain and visual explain
- return !job.get('referrer') ||
- job.get('referrer') === constants.jobReferrer.job;
+ return (!job.get('referrer') || job.get('referrer') === constants.jobReferrer.job) &&
+ !!job.get('id');
});
controller.set('history', filteredModel);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
index 6ed55b5..29e144b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/queries.js
@@ -20,9 +20,13 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
model: function () {
- return this.store.find(constants.namingConventions.savedQuery).catch(function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ var self = this;
+
+ return this.store.find(constants.namingConventions.savedQuery).catch(function (error) {
+ self.get('notifyService').error(error);
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
index 9093197..5a96cd6 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/udfs.js
@@ -20,13 +20,17 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.Route.extend({
- setupController: function () {
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
+ setupController: function (controller, model) {
+ this._super();
+
var self = this;
this.store.find(constants.namingConventions.fileResource).then(function (fileResources) {
- self.controllerFor(constants.namingConventions.fileResources).set('model', fileResources);
- }).catch(function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ controller.set('fileResources', fileResources);
+ }).catch(function (error) {
+ self.get('notifyService').error(error);
});;
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
new file mode 100644
index 0000000..6b4df6f
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/database.js
@@ -0,0 +1,227 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import constants from 'hive/utils/constants';
+
+export default Ember.Service.extend({
+ store: Ember.inject.service(),
+
+ pageCount: 10,
+ selectedDatabase: null,
+ selectedTables: null,
+ databases: [],
+
+ init: function () {
+ this._super();
+
+ var databaseAdapter = this.container.lookup('adapter:database');
+ var baseUrl = databaseAdapter.buildURL() + '/' +
+ databaseAdapter.pathForType(constants.namingConventions.database) + '/';
+
+ this.set('baseUrl', baseUrl);
+ },
+
+ getDatabases: function () {
+ var defer = Ember.RSVP.defer();
+ var self = this;
+
+ this.get('store').unloadAll(constants.namingConventions.database);
+ this.get('store').fetchAll(constants.namingConventions.database).then(function (databases) {
+ self.set('databases', databases);
+ defer.resolve(databases);
+ }, function (error) {
+ defer.reject(error);
+ })
+
+ return defer.promise;
+ },
+
+ setDatabaseByName: function (name) {
+ var database = this.databases.findBy('name', name);
+
+ if (database) {
+ this.set('selectedDatabase', database);
+ }
+ },
+
+ getColumnsPage: function (databaseName, table, searchTerm, firstSearchPage) {
+ var defer = Ember.RSVP.defer();
+
+ var url = this.get('baseUrl') +
+ databaseName +
+ '/table/' +
+ table.get('name');
+
+ url += '.page?searchId&count=' + this.get('pageCount');
+ url += '&columns=3,5';
+
+ if (searchTerm) {
+ url += '&searchId=searchColumns' + '&like=' + searchTerm;
+
+ if (firstSearchPage) {
+ url += '&first=true';
+ }
+ } else if (!table.get('columns.length')) {
+ url += '&first=true';
+ }
+
+ Ember.$.getJSON(url).then(function (data) {
+ Ember.run(function () {
+ var columns;
+
+ columns = data.rows.map(function (row) {
+ return Ember.Object.create({
+ name: row[0],
+ type: row[1]
+ });
+ });
+
+ defer.resolve({
+ columns: columns,
+ hasNext: data.hasNext
+ });
+ });
+ }, function (err) {
+ defer.reject(err);
+ });
+
+ return defer.promise;
+ },
+
+ getTablesPage: function (database, searchTerm, firstSearchPage) {
+ var defer = Ember.RSVP.defer(),
+ url = this.get('baseUrl') +
+ database.get('name') +
+ '/table.page?count=';
+
+ url += this.get('pageCount');
+
+ if (searchTerm) {
+ url += '&searchId=searchTables' + '&like=' + searchTerm;
+
+ if (firstSearchPage) {
+ url += '&first=true';
+ }
+ } else if (!database.get('tables.length')) {
+ url += '&first=true';
+ }
+
+ Ember.$.getJSON(url).then(function (data) {
+ var tables;
+
+ tables = data.rows.map(function (row) {
+ return Ember.Object.create({
+ name: row[0]
+ });
+ });
+
+ defer.resolve({
+ tables: tables,
+ hasNext: data.hasNext
+ });
+ }, function (err) {
+ defer.reject(err);
+ });
+
+ return defer.promise;
+ },
+
+ getAllTables: function (db) {
+ var defer = Ember.RSVP.defer();
+ var database = db || this.get('selectedDatabase');
+ var self;
+ var url;
+
+ if (!database) {
+ defer.resolve();
+ } else if (database.tables && !database.get('hasNext')) {
+ this.set('selectedTables', database.tables.mapProperty('name'));
+ defer.resolve();
+ } else {
+ self = this;
+ url = this.get('baseUrl') + database.get('name') + '/table';
+
+ Ember.$.getJSON(url).then(function (data) {
+ var tables = data.tables.map(function (table) {
+ return Ember.Object.create({
+ name: table
+ });
+ });
+
+ //don't use Ember.Object.set since it can be very expensive for large collections (e.g. 15000 tables),
+ //thus we should not do any bindings directly on the 'tables' collection.
+ database.tables = tables;
+
+ Ember.run(function () {
+ self.set('selectedTables', tables.mapProperty('name'));
+ });
+
+ defer.resolve();
+ }, function (err) {
+ defer.reject(err);
+ });
+ }
+
+ return defer.promise;
+ },
+
+ getAllColumns: function (tableName, db) {
+ var database = db || this.get('selectedDatabase');
+ var defer = Ember.RSVP.defer();
+ var table;
+ var self;
+ var url;
+
+ if (!database) {
+ defer.resolve();
+ } else {
+ table = database.tables.findBy('name', tableName);
+
+ if (!table) {
+ defer.resolve();
+ } else if (table.columns && !table.get('hasNext')) {
+ this.get('selectedTables')[tableName] = table.columns.mapProperty('name');
+ defer.resolve();
+ } else {
+ self = this;
+ url = this.get('baseUrl') + database.get('name') + '/table/' + tableName
+
+ Ember.$.getJSON(url).then(function (data) {
+ var columns = data.columns.map(function (column) {
+ return Ember.Object.create({
+ name: column[0],
+ type: column[1]
+ });
+ });
+
+ table.columns = columns;
+ table.set('hasNext', false);
+
+ self.get('selectedTables')[tableName] = columns.mapProperty('name');
+
+ defer.resolve();
+ }, function (err) {
+ defer.reject(err);
+ });
+ }
+ }
+
+ return defer.promise;
+ }
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js
new file mode 100644
index 0000000..7f01795
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/file.js
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import constants from 'hive/utils/constants';
+
+export default Ember.Service.extend({
+ files: [],
+ store: Ember.inject.service(),
+
+ loadFile: function (path) {
+ var self = this;
+ var defer = Ember.RSVP.defer();
+ var file = this.files.findBy('id', path);
+
+ if (file) {
+ defer.resolve(file);
+ } else {
+ this.get('store').find(constants.namingConventions.file, path).then(function (file) {
+ defer.resolve(self.files.pushObject(file));
+ }, function (err) {
+ defer.reject(err);
+ });
+ }
+
+ return defer.promise;
+ },
+
+ reloadFile: function (path) {
+ var defer = Ember.RSVP.defer();
+
+ this.get('store').find(constants.namingConventions.file, path).then(function (file) {
+ file.reload().then(function (reloadedFile) {
+ defer.resolve(reloadedFile);
+ }, function (err) {
+ defer.reject(err);
+ });
+ }, function (err) {
+ defer.reject(err);
+ });
+
+ return defer.promise;
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js
new file mode 100644
index 0000000..3a1f82a
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/job.js
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Service.extend({
+ stopJob: function (job) {
+ var self = this;
+ var id = job.get('id');
+ var url = this.container.lookup('adapter:application').buildURL();
+ url += "/jobs/" + id;
+
+ job.set('isCancelling', true);
+
+ Ember.$.ajax({
+ url: url,
+ type: 'DELETE',
+ headers: {
+ 'X-Requested-By': 'ambari',
+ },
+ success: function () {
+ job.reload();
+ }
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
index 38e88c3..6ca4d11 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
@@ -47,7 +47,21 @@ export default Ember.Service.extend({
this.add(this.types.WARN, message, body);
},
- error: function (message, body) {
+ error: function (error) {
+ var message,
+ body;
+
+ if (error.responseJSON) {
+ message = error.responseJSON.message;
+ body = error.responseJSON.trace;
+ } else if (error.errorThrown) {
+ message = error.errorThrown;
+ } else if (error.message) {
+ message = error.message;
+ } else {
+ message = error;
+ }
+
this.add(this.types.ERROR, message, body);
},
@@ -84,7 +98,7 @@ export default Ember.Service.extend({
},
removeAllMessages: function () {
- this.messages.removeAt(0, this.messages.get('length'));
+ this.messages.clear();
},
markMessagesAsSeen: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
index 3ae64ec..7be5dcc 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
@@ -26,6 +26,36 @@ a {
word-wrap: break-word;
}
+@keyframes flash {
+ 0% {
+ background-color: transparent;
+ }
+
+ 25% {
+ background-color: #428bca;
+ color: #fff;
+ }
+
+ 50% {
+ background-color: transparent;
+ color: #333;
+ }
+
+ 75% {
+ background-color: #428bca;
+ color: #fff;
+ }
+
+ 100% {
+ background-color: transparent;
+ color: #333;
+ }
+}
+
+.flash {
+ animation: flash 1s;
+}
+
@-webkit-keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
@@ -56,6 +86,10 @@ a {
animation-name: fadeOut;
}
+.empty-list {
+ text-align: center;
+}
+
#content {
padding: 20px 0;
}
@@ -112,7 +146,7 @@ aside {
.toolbox {
margin: 15px 15px 0 0;
- insert-udfs {
+ .insert-udfs {
display: inline-block;
}
}
@@ -231,8 +265,7 @@ dropdown .fa-remove {
}
.main-content {
- width: 90%;
- flex-grow: 1;
+ width: 100%;
}
.queries-icon {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
index 2242a4f..db053fa 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/application.hbs
@@ -16,8 +16,8 @@
* limitations under the License.
}}
-{{notify-widget notifications=notify.notifications}}
-{{render 'navbar'}}
+{{notify-widget notifications=notifications}}
+{{navbar-widget}}
<div id="content">
{{outlet}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs
deleted file mode 100644
index 4083ad6..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/_typeahead-widget.hbs
+++ /dev/null
@@ -1,17 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs
new file mode 100644
index 0000000..6b01946
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/job-tr-view.hbs
@@ -0,0 +1,49 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<tr class="main-row" {{action "requestFile"}}>
+ <td>
+ {{#link-to "index.historyQuery" job}}
+ {{job.title}}
+ {{/link-to}}
+ </td>
+ <td {{bind-attr class=job.uppercaseStatus}}>{{all-uppercase job.status}}</td>
+ <td>{{date-binding job "dateSubmittedTimestamp"}}</td>
+ <td>{{job.duration}}</td>
+ <td>
+ <a class="fa fa-expand pull-right"></a>
+ </td>
+</tr>
+{{#if expanded}}
+ <tr class="secondary-row">
+ <td colspan="5">
+ {{code-helper job.file.fileContent}}
+
+ {{#if canStop}}
+ <button type="button" {{bind-attr class=":btn :btn-warning :btn-sm :pull-right job.isCancelling:disabled"}} {{action "stopJob"}}>
+ {{#if job.isCancelling}}
+ {{t "buttons.stoppingJob"}}
+ <div class="spinner small inline-spinner"></div>
+ {{else}}
+ {{t "buttons.stopJob"}}
+ {{/if}}
+ </button>
+ {{/if}}
+ </td>
+ </tr>
+{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs
new file mode 100644
index 0000000..f8f6bcb
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/navbar-widget.hbs
@@ -0,0 +1,45 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<nav class="navbar navbar-default no-margin" role="navigation">
+ <div class="container-fluid">
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ {{#link-to "index" classNames="navbar-brand"}}
+ {{view.title}}
+ {{/link-to}}
+ </div>
+
+ <!-- Collect the nav links, forms, and other content for toggling -->
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ {{#each item in view.items}}
+ {{#link-to item.path tagName="li"}}
+ <a>{{tb-helper "text" item}}</a>
+ {{/link-to}}
+ {{/each}}
+ </ul>
+ </div>
+ </div>
+</nav>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs
deleted file mode 100644
index 4083ad6..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/typeahead-widget.hbs
+++ /dev/null
@@ -1,17 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
index bdac484..45a9b7f 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases-tree.hbs
@@ -17,7 +17,7 @@
}}
<div class="databases">
- {{#each database in content}}
+ {{#each database in databases}}
{{#collapsible-widget heading=database.name isExpanded=database.isExpanded iconClass="fa-database" expanded="getTables" toggledParam=database}}
{{#if database.isExpanded}}
<div class="tables">
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
index 392b8f3..068478b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/databases.hbs
@@ -17,10 +17,10 @@
}}
{{#panel-widget headingTranslation="titles.database" isLoading=isLoading classNames="database-explorer" iconActions=panelIconActions}}
- {{#if model}}
+ {{#if databases}}
{{typeahead-widget
- content=model
+ content=databases
optionValuePath="id"
optionLabelPath="name"
selection=selectedDatabase
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
index d98fbcd..f3f3938 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/history.hbs
@@ -40,38 +40,24 @@
</tr>
</thead>
<tbody>
- {{#each item in this}}
- <tr class="main-row" {{action "loadFile"}}>
- <td>
- {{#link-to "index.historyQuery" item}}
- {{item.title}}
- {{/link-to}}
- </td>
- <td {{bind-attr class=item.uppercaseStatus}}>{{all-uppercase item.status}}</td>
- <td>{{date-binding item "dateSubmittedTimestamp"}}</td>
- <td>{{item.duration}}</td>
- <td>
- <a class="fa fa-expand pull-right"></a>
- </td>
- </tr>
- {{#if controller.expanded}}
- <tr class="secondary-row">
- <td {{bind-attr colspan=view.colspan}}>
- {{code-helper controller.file.fileContent}}
-
- {{#if controller.canStop}}
- <button type="button" class="btn btn-danger btn-sm pull-right" {{action "stop"}}>
- {{#if item.isCancelling}}
- {{t "buttons.stoppingJob"}}
- <div class="spinner small inline-spinner"></div>
- {{else}}
- {{t "buttons.stopJob"}}
- {{/if}}
- </button>
- {{/if}}
+ {{#if history.length}}
+ {{#if model.length}}
+ {{#each item in model}}
+ {{job-tr-view job=item onStopJob="interruptJob" onFileRequested="loadFile"}}
+ {{/each}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.history.noMatches"}}</h4>
</td>
</tr>
{{/if}}
- {{/each}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.history.noItems"}}</h4>
+ </td>
+ </tr>
+ {{/if}}
</tbody>
-</table>
\ No newline at end of file
+</table>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
index b6f27aa..2fdf0ce 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/index.hbs
@@ -27,14 +27,22 @@
{{render 'open-queries'}}
<div class="toolbox">
- <button type="button"
- {{bind-attr class=":btn :btn-sm :btn-success :execute-query canExecute::disabled"}}
- {{action "executeQuery"}}>
- {{t "buttons.execute"}}
- </button>
- <button type="button"
- {{bind-attr class=":btn :btn-sm :btn-default canExecute::disabled"}}
- {{action "explainQuery"}}>
+ {{#if canExecute}}
+ <button type="button" class="btn btn-sm btn-success execute-query" {{action "executeQuery"}}>
+ {{t "buttons.execute"}}
+ </button>
+ {{else}}
+ <button type="button" {{bind-attr class=":btn :btn-sm :btn-warning model.isCancelling:disabled"}} {{action "stopCurrentJob"}}>
+ {{#if model.isCancelling}}
+ {{t "buttons.stoppingJob"}}
+ <div class="spinner small inline-spinner"></div>
+ {{else}}
+ {{t "buttons.stopJob"}}
+ {{/if}}
+ </button>
+ {{/if}}
+
+ <button type="button" {{bind-attr class=":btn :btn-sm :btn-default canExecute::disabled"}} {{action "explainQuery"}}>
{{t "buttons.explain"}}
</button>
@@ -46,9 +54,11 @@
</div>
{{/panel-widget}}
- {{#if jobProgress.stages}}
- {{#progress-widget value=jobProgress.totalProgress}}
- {{/progress-widget}}
+ {{#if displayJobTabs}}
+ {{#if jobProgress.stages.length}}
+ {{#progress-widget value=jobProgress.totalProgress}}
+ {{/progress-widget}}
+ {{/if}}
{{/if}}
{{#if queryParams}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
index 0911835..f01104b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/insert-udfs.hbs
@@ -17,7 +17,7 @@
}}
{{#if this.length}}
- <div class="dropdown">
+ <div class="dropdown insert-udfs">
<a role="button" data-toggle="dropdown" class="btn btn-default btn-sm" data-target="#">
{{t "placeholders.select.udfs"}}
<span class="caret"></span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs
deleted file mode 100644
index f8f6bcb..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/navbar.hbs
+++ /dev/null
@@ -1,45 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-<nav class="navbar navbar-default no-margin" role="navigation">
- <div class="container-fluid">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- {{#link-to "index" classNames="navbar-brand"}}
- {{view.title}}
- {{/link-to}}
- </div>
-
- <!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
- <ul class="nav navbar-nav">
- {{#each item in view.items}}
- {{#link-to item.path tagName="li"}}
- <a>{{tb-helper "text" item}}</a>
- {{/link-to}}
- {{/each}}
- </ul>
- </div>
- </div>
-</nav>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
index 692a462..c71a03b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/queries.hbs
@@ -40,41 +40,57 @@
</tr>
</thead>
<tbody>
- {{#each query in this}}
- {{#unless query.isNew}}
- <tr>
- <td>
- {{#link-to "index.savedQuery" query}}
- {{query.shortQuery}}
- {{/link-to}}
- </td>
+ {{#if queries.length}}
+ {{#if model.length}}
+ {{#each query in model}}
+ {{#unless query.isNew}}
+ <tr>
+ <td>
+ {{#link-to "index.savedQuery" query}}
+ {{query.shortQuery}}
+ {{/link-to}}
+ </td>
- <td>
- {{#link-to "index.savedQuery" query}}
- {{query.title}}
- {{/link-to}}
- </td>
+ <td>
+ {{#link-to "index.savedQuery" query}}
+ {{query.title}}
+ {{/link-to}}
+ </td>
- <td>{{query.dataBase}}</td>
+ <td>{{query.dataBase}}</td>
- <td>{{query.owner}}</td>
+ <td>{{query.owner}}</td>
- <td>
- {{#unless query.isNew}}
- <div class="btn-group pull-right">
- <span data-toggle="dropdown">
- <a class="fa fa-gear"></a>
- </span>
- <ul class="dropdown-menu" role="menu">
- {{#each link in controller.links}}
- <li {{action 'executeAction' link query}}><a>{{tb-helper link}}</a></li>
- {{/each}}
- </ul>
- </div>
- {{/unless}}
+ <td>
+ {{#unless query.isNew}}
+ <div class="btn-group pull-right">
+ <span data-toggle="dropdown">
+ <a class="fa fa-gear"></a>
+ </span>
+ <ul class="dropdown-menu" role="menu">
+ {{#each link in controller.links}}
+ <li {{action 'executeAction' link query}}><a>{{tb-helper link}}</a></li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/unless}}
+ </td>
+ </tr>
+ {{/unless}}
+ {{/each}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.savedQueries.noMatches"}}</h4>
</td>
</tr>
- {{/unless}}
- {{/each}}
+ {{/if}}
+ {{else}}
+ <tr>
+ <td colspan="5">
+ <h4 class="empty-list">{{t "emptyList.savedQueries.noItems"}}</h4>
+ </td>
+ </tr>
+ {{/if}}
</tbody>
-</table>
\ No newline at end of file
+</table>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
index c170e02..bea77ba 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs
@@ -17,7 +17,7 @@
}}
{{#each tab in tabs}}
- <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active" title="tab.tooltip" id="tab.id"}}>
+ <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active tab.flash:flash" title="tab.tooltip" id="tab.id"}}>
{{#if tab.badge}}
<span class="badge">{{tab.badge}}</span>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
index 5bb8759..9d057db 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/udfs.hbs
@@ -58,7 +58,7 @@
placeholderTranslation="placeholders.fileResource.path"
value=udf.fileResource.path}}
{{else}}
- {{select-widget items=controller.fileResources
+ {{select-widget items=fileResources
selectedValue=udf.fileResource
labelPath="name"
defaultLabelTranslation="placeholders.select.file"
@@ -74,7 +74,7 @@
{{/if}}
{{/if}}
</td>
- {{#each column in controller.columns}}
+ {{#each column in columns}}
<td>
{{#if udf.isEditing}}
{{extended-input type="text"
@@ -99,7 +99,7 @@
<a class="fa fa-gear"></a>
</span>
<ul class="dropdown-menu" role="menu">
- {{#each link in controller.links}}
+ {{#each link in links}}
<li {{action 'executeAction' link}}><a>{{tb-helper link}}</a></li>
{{/each}}
</ul>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
index d63c5ce..0539463 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
@@ -65,11 +65,10 @@ export default Ember.Object.create({
databases: 'databases',
openQueries: 'open-queries',
visualExplain: 'visual-explain',
+ notify: 'notify',
tezUI: 'tez-ui',
file: 'file',
fileResource: 'file-resource',
- fileResources: 'file-resources',
- loadedFiles: 'loaded-files',
alerts: 'alerts',
logs: 'logs',
results: 'results',
@@ -78,8 +77,6 @@ export default Ember.Object.create({
jobExplain: 'index/history-query/explain',
databaseTree: 'databases-tree',
databaseSearch: 'databases-search-results',
- tables: 'tables',
- columns: 'columns',
settings: 'settings',
settingsQuery: 'settings-query',
settingsGlobal: 'settings-global',
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
index f7756fc..afd959b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/functions.js
@@ -54,10 +54,10 @@ export default Ember.Object.create({
var args = Array.prototype.slice.call(arguments, 1);
if (!sourceString) {
- return;
+ return false;
}
- return args.find(function (arg) {
+ return !!args.find(function (arg) {
return sourceString.match(new RegExp('^' + arg + '$', 'i'));
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js
deleted file mode 100644
index 8a914f0..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/history.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-
-export default Ember.View.extend({
- colspan: function () {
- return this.get('controller.columns.length') + 1;
- }.property('controller.columns')
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js
deleted file mode 100644
index 70ed640..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/insert-udfs.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-
-export default Ember.View.extend({
- tagName: 'insert-udfs'
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js
deleted file mode 100644
index 0c535db..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/navbar.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-import constants from 'hive/utils/constants';
-
-export default Ember.View.extend({
- title: constants.appTitle,
-
- items: Ember.A([
- Ember.Object.create({text: 'menus.query',
- path: constants.namingConventions.routes.index}),
-
- Ember.Object.create({text: 'menus.savedQueries',
- path: constants.namingConventions.routes.queries}),
-
- Ember.Object.create({text: 'menus.history',
- path: constants.namingConventions.routes.history}),
-
- Ember.Object.create({text: 'menus.udfs',
- path: constants.namingConventions.routes.udfs})
- ])
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
index 52d92b6..d2a800c 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
@@ -22,9 +22,10 @@ import Ember from 'ember';
import dagRules from '../utils/dag-rules';
export default Ember.View.extend({
+ verticesGroups: [],
+ edges: [],
+
willInsertElement: function () {
- this.set('verticesGroups', []);
- this.set('edges', []);
this.set('graph', new dagre.graphlib.Graph());
},
@@ -111,12 +112,7 @@ export default Ember.View.extend({
angle = 180 + angle;
}
- var style = "left: %@px; top: %@px; width: %@px;" +
- "-moz-transform:rotate(%@4deg);" +
- "-webkit-transform:rotate(%@4deg);" +
- "-ms-transform:rotate(%@4deg);" +
- "-transform:rotate(%@4deg);";
-
+ var style = "left: %@px; top: %@px; width: %@px; transform:rotate(%@4deg);";
style = style.fmt(cx, cy, length, angle);
var edgeType;
@@ -417,12 +413,15 @@ export default Ember.View.extend({
Ember.run.later(function () {
g.edges().forEach(function (value) {
- var firstNode = self.$("[title='" + value.v + "']")[0];
- var secondNode = self.$("[title='" + value.w + "']")[0];
+ var firstNode = self.$("[title='" + value.v + "']");
+ var secondNode = self.$("[title='" + value.w + "']");
+
+ if (firstNode && secondNode) {
+ self.addEdge(firstNode[0], secondNode[0], 2, g.edge(value).type);
+ }
- self.addEdge(firstNode, secondNode, 2, g.edge(value).type);
});
- }, 200);
+ }, 400);
},
renderDag: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/bower.json b/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
index 24e8821..37ea901 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/bower.json
@@ -9,9 +9,9 @@
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.1.3",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
- "ember-qunit": "0.2.8",
+ "ember-qunit": "0.4.0",
"ember-qunit-notifications": "0.0.7",
- "qunit": "~1.17.1",
+ "qunit": "1.18.0",
"bootstrap": "~3.2.0",
"ember-i18n": "~3.0.0",
"blanket": "~1.1.5",
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/package.json
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/package.json b/contrib/views/hive/src/main/resources/ui/hive-web/package.json
index 8b5f669..6ecdcb6 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/package.json
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/package.json
@@ -25,6 +25,7 @@
"broccoli-asset-rev": "^2.0.0",
"broccoli-sass": "0.6.3",
"ember-cli": "0.2.2",
+ "ember-cli-autoprefixer": "0.4.1",
"ember-cli-blanket": "^0.5.0",
"ember-cli-content-security-policy": "0.3.0",
"ember-cli-font-awesome": "0.0.4",
@@ -34,12 +35,12 @@
"ember-cli-jquery-ui": "0.0.12",
"ember-cli-moment": "0.0.1",
"ember-cli-pretender": "^0.3.1",
- "ember-cli-qunit": "0.3.9",
+ "ember-cli-qunit": "0.3.14",
"ember-cli-selectize": "0.0.19",
+ "ember-cli-uglify": "1.0.1",
"ember-data": "1.0.0-beta.16.1",
"ember-dynamic-component": "0.0.1",
"ember-export-application-global": "^1.0.0",
- "express": "^4.8.5",
- "ember-cli-uglify": "1.0.1"
+ "express": "^4.8.5"
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/testem.json b/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
index 5a8d375..78029a1 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/testem.json
@@ -5,7 +5,6 @@
"PhantomJS"
],
"launch_in_dev": [
- "PhantomJS",
"Chrome"
]
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
index 39487fa..2898863 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/api-mock.js
@@ -22,7 +22,7 @@ export default function() {
var baseUrl = applicationAdapter.create().buildURL();
var databases = ['db1', 'db2', 'db3'];
- this.get(baseUrl + '/resources/ddl/database', function(req) {
+ this.get(baseUrl + '/resources/ddl/database', function (req) {
var db = {
databases: databases
};
@@ -67,7 +67,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(columns)];
});
- this.get(baseUrl + '/udfs', function(req) {
+ this.get(baseUrl + '/udfs', function (req) {
var udf = {
"udfs": [{
"name": "TestColumn",
@@ -88,7 +88,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(udf)];
});
- this.post(baseUrl + '/jobs', function(req) {
+ this.post(baseUrl + '/jobs', function (req) {
var job = {
"job": {
"status":"Finished",
@@ -112,7 +112,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(job)];
});
- this.get(baseUrl + '/resources/file/job1.hql', function(req) {
+ this.get(baseUrl + '/resources/file/job1.hql', function (req) {
var file = {
"file": {
"filePath": "job1.hql",
@@ -148,7 +148,15 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(savedQueries)];
});
- this.get(baseUrl + '/resources/file/saved1.hql', function(req) {
+ this.get(baseUrl + '/savedQueries/defaultSettings', function (req) {
+ var defaultSettings = {
+ "defaultSettings" : []
+ };
+
+ return [200, {"Content-Type": "application/json"}, JSON.stringify(defaultSettings)];
+ });
+
+ this.get(baseUrl + '/resources/file/saved1.hql', function (req) {
var file = {
"file": {
"filePath": "saved1.hql",
@@ -162,7 +170,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(file)];
});
- this.get(baseUrl + '/jobs', function(req) {
+ this.get(baseUrl + '/jobs', function (req) {
var jobs = {
"jobs": [
{
@@ -223,7 +231,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(jobs)];
});
- this.get(baseUrl + '/fileResources', function(req) {
+ this.get(baseUrl + '/fileResources', function (req) {
var files = {
"fileResources": [
{
@@ -238,7 +246,7 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(files)];
});
- this.get(baseUrl + '/fileResources/1', function(req) {
+ this.get(baseUrl + '/fileResources/1', function (req) {
var files = {
"fileResources": [
{
@@ -252,4 +260,31 @@ export default function() {
return [200, {"Content-Type": "application/json"}, JSON.stringify(files)];
});
+
+ this.get(baseUrl + '/api/v1/views/TEZ', function (req) {
+ var data = {
+ versions: [
+ {
+ href: baseUrl + '/api/v1/view/TEZ/instanceURL'
+ }
+ ]
+ };
+
+ return [200, {"Content-Type": "application/json"}, JSON.stringify(data)];
+ });
+
+ this.get(baseUrl + '/api/v1/views/TEZ/instanceURL', function (req) {
+ var data = {
+ instances: [
+ {
+ ViewInstanceInfo: {
+ instance_name: 'tez',
+ version: 1
+ }
+ }
+ ]
+ };
+
+ return [200, {"Content-Type": "application/json"}, JSON.stringify(data)];
+ });
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
index e029055..ab1a9d2 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/helpers/start-app.js
@@ -37,7 +37,7 @@ export default function startApp(attrs) {
App.injectTestHelpers();
});
- App.reset(); // this shouldn't be needed, i want to be able to "start an app at a specific URL"
+ // App.reset(); // this shouldn't be needed, i want to be able to "start an app at a specific URL"
return App;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
index 604da58..52cda77 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/database-test.js
@@ -36,8 +36,8 @@ module('Integration: Databases', {
}
});
-test('Database Explorer is displayed and populated with databases from server.', function() {
- expect(2);
+test('Database Explorer is displayed and populated with databases from server.', function (assert) {
+ assert.expect(2);
visit('/');
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
index 19c2356..b409e12 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/query-editor-test.js
@@ -47,13 +47,20 @@ test('Query Editor is visible', function() {
});
});
-test('Can execute query', function() {
- expect(1);
+test('Can execute query either with full or partial selection', function() {
+ expect(3);
+
+ var query1 = "select count(*) from table1;",
+ query2 = "select color from z;",
+ query3 = "select fruit from z;",
+ query4 = query2 + "\n" + query3,
+ editor;
visit("/");
Ember.run(function() {
- find('.CodeMirror').get(0).CodeMirror.setValue('select count(*) from table1');
+ editor = find('.CodeMirror').get(0).CodeMirror;
+ editor.setValue(query1);
});
click('.execute-query');
@@ -61,6 +68,18 @@ test('Can execute query', function() {
andThen(function() {
equal(find('.query-process-results-panel').length, 1, 'Job tabs are visible.');
});
+
+ Ember.run(function() {
+ editor.setValue(query4);
+ editor.setSelection({ line: 1, ch: 0 }, { line: 1, ch: 20 });
+ });
+
+ click('.execute-query');
+
+ andThen(function() {
+ equal(editor.getValue(), query4, 'Editor value didn\'t change');
+ equal(editor.getSelection(), query3, 'Query 3 is selected');
+ });
});
@@ -76,33 +95,12 @@ test('Can save query', function() {
Ember.run(function() {
find('.CodeMirror').get(0).CodeMirror.setValue('select count(*) from table1');
});
+
click('.save-query-as');
andThen(function() {
equal(find('.modal-dialog').length, 1, 'Modal dialog is shown');
});
- click('.modal-dialog .modal-footer .btn-danger');
-});
-
-test('Can execute selection', function() {
- expect(2);
- visit('/');
-
- var query1 = "select color from z;",
- query2 = "select fruit from z;",
- query = query1 + "\n" + query2,
- editor;
-
- Ember.run(function() {
- editor = find('.CodeMirror').get(0).CodeMirror;
- editor.setValue(query);
- editor.setSelection({ line: 1, ch: 0 }, { line: 1, ch: 20 });
- });
- click('.execute-query');
-
- andThen(function() {
- equal(editor.getValue(), query, 'Editor value didn\'t change');
- equal(editor.getSelection(), query2, 'Query 2 is selected');
- });
+ click('.modal-footer .btn-danger');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js
new file mode 100644
index 0000000..f64dcb2
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/integration/tez-ui-test.js
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import { test } from 'ember-qunit';
+import startApp from '../helpers/start-app';
+import api from '../helpers/api-mock';
+
+var App;
+var server;
+
+module('Integration: Tez UI', {
+ setup: function() {
+ App = startApp();
+ /* global Pretender: true */
+ server = new Pretender(api);
+ },
+
+ teardown: function() {
+ Ember.run(App, App.destroy);
+ server.shutdown();
+ }
+});
+
+test('An error is show when there is no dag', function() {
+ expect(1);
+
+ visit("/");
+ click('#tez-icon');
+
+ andThen(function() {
+ ok(find('.panel .alert .alert-danger'), 'Error is visible');
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
index 09e3c1b..6e28a40 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/adapters/application.js
@@ -44,5 +44,5 @@ test('buildUrl returns an url with default values for version and instance param
var url = adapter.buildURL();
- equal(url, constants.adapter.apiPrefix + '0.2.0' + constants.adapter.instancePrefix + 'Hive');
+ equal(url, constants.adapter.apiPrefix + constants.adapter.version + constants.adapter.instancePrefix + 'Hive');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
index 2f25bab..96a551f 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/collapsible-widget-test.js
@@ -18,7 +18,9 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
-moduleForComponent('collapsible-widget', 'CollapsibleWidgetComponent');
+moduleForComponent('collapsible-widget', 'CollapsibleWidgetComponent', {
+ unit: true
+});
test('Component expand/collapse toggle action', function () {
expect(1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
index 2afe669..be8bdc4 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/column-filter-widget-test.js
@@ -45,7 +45,7 @@ test('if a filterValue is set when the element is inserted, an action is being s
component.set('columnFiltered', 'externalAction');
component.set('targetObject', targetObject);
- var $component = this.render();
+ var $component = this.$();
});
test('isSorted returns true if the table is sorted by this column property', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
index 13a3e89..766e9ee 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/date-range-widget-test.js
@@ -44,7 +44,7 @@ test('Date fields are set correctly', function() {
component.set('dateRange', Ember.Object.create());
- var $component = this.render();
+ var $component = this.$();
Ember.run(function() {
component.set('dateRange', dateRange);
@@ -75,7 +75,7 @@ test('Date fields updates when the date is changed', function() {
component.set('dateRange', dateRange);
});
- var $component = this.render();
+ var $component = this.$();
$component.find('.fromDate').datepicker('setDate', '10/10/2014');
$component.find('.toDate').datepicker('setDate', '11/11/2014');
@@ -125,7 +125,7 @@ test('If from/to are not passed they are set to min/max', function() {
component.set('dateRange', dateRange);
});
- var $component = this.render();
+ var $component = this.$();
equal(component.get('dateRange.from'), min.toString(), "From date is to min date");
equal(component.get('dateRange.to'), max.toString(), "To date is set to max date");
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
index 2b34af5..8d1f07a 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/tests/unit/components/expander-widget-test.js
@@ -20,13 +20,14 @@ import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
moduleForComponent('expander-widget', 'ExpanderWidgetComponent', {
+ unit: true
});
test('should set the heading when provided.', function () {
expect(2);
var component = this.subject();
- var $component = this.render();
+ var $component = this.$();
var heading = 'some header';
equal($component.find('.accordion-toggle').text(), '');
@@ -42,7 +43,7 @@ test('should correctly toggle isExpanded property.', function () {
expect(2);
var component = this.subject();
- this.render();
+ this.$();
Ember.run(function(){
component.send('toggle');
[3/3] ambari git commit: AMBARI-11864. Hive View Enhancements (Erik
Bergenholtz via rlevas)
Posted by rl...@apache.org.
AMBARI-11864. Hive View Enhancements (Erik Bergenholtz via rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5cdafecf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5cdafecf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5cdafecf
Branch: refs/heads/trunk
Commit: 5cdafecfbdaf10326328286fd9c6cbbcc9cf0f9f
Parents: 50be667
Author: Erik Bergenholtz <eb...@hortonworks.com>
Authored: Thu Jun 11 16:23:49 2015 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Thu Jun 11 16:23:49 2015 -0400
----------------------------------------------------------------------
contrib/views/hive/pom.xml | 2 +-
.../hive/resources/jobs/atsJobs/ATSParser.java | 34 +--
.../hive/resources/jobs/rm/RMParserFactory.java | 52 +----
.../view/hive/resources/jobs/viewJobs/Job.java | 4 +
.../hive/resources/jobs/viewJobs/JobImpl.java | 11 +
.../src/main/resources/ui/hive-web/Brocfile.js | 3 +
.../ui/hive-web/app/adapters/application.js | 4 +-
.../ui/hive-web/app/components/job-tr-view.js | 41 ++++
.../ui/hive-web/app/components/modal-widget.js | 6 +-
.../ui/hive-web/app/components/navbar-widget.js | 39 ++++
.../ui/hive-web/app/components/notify-widget.js | 1 -
.../ui/hive-web/app/controllers/application.js | 26 +++
.../ui/hive-web/app/controllers/columns.js | 104 ---------
.../ui/hive-web/app/controllers/databases.js | 210 ++++++-----------
.../hive-web/app/controllers/file-resources.js | 22 --
.../ui/hive-web/app/controllers/history.js | 43 ++--
.../ui/hive-web/app/controllers/index.js | 97 ++++----
.../controllers/index/history-query/explain.js | 36 +--
.../app/controllers/index/history-query/logs.js | 91 ++++----
.../ui/hive-web/app/controllers/insert-udfs.js | 2 +-
.../ui/hive-web/app/controllers/job-progress.js | 133 +++++++----
.../ui/hive-web/app/controllers/job.js | 48 ----
.../ui/hive-web/app/controllers/loaded-files.js | 65 ------
.../ui/hive-web/app/controllers/messages.js | 14 +-
.../ui/hive-web/app/controllers/open-queries.js | 43 ++--
.../ui/hive-web/app/controllers/query-tabs.js | 13 +-
.../ui/hive-web/app/controllers/settings.js | 42 +++-
.../ui/hive-web/app/controllers/tables.js | 93 --------
.../ui/hive-web/app/controllers/tez-ui.js | 2 +-
.../ui/hive-web/app/controllers/udf.js | 6 -
.../ui/hive-web/app/controllers/udfs.js | 27 +--
.../hive-web/app/controllers/visual-explain.js | 6 +-
.../ui/hive-web/app/initializers/i18n.js | 22 +-
.../ui/hive-web/app/initializers/notify.js | 26 ---
.../ui/hive-web/app/routes/application.js | 16 +-
.../resources/ui/hive-web/app/routes/history.js | 10 +-
.../resources/ui/hive-web/app/routes/queries.js | 8 +-
.../resources/ui/hive-web/app/routes/udfs.js | 12 +-
.../ui/hive-web/app/services/database.js | 227 +++++++++++++++++++
.../resources/ui/hive-web/app/services/file.js | 59 +++++
.../resources/ui/hive-web/app/services/job.js | 41 ++++
.../ui/hive-web/app/services/notify.js | 18 +-
.../resources/ui/hive-web/app/styles/app.scss | 39 +++-
.../ui/hive-web/app/templates/application.hbs | 4 +-
.../templates/components/_typeahead-widget.hbs | 17 --
.../app/templates/components/job-tr-view.hbs | 49 ++++
.../app/templates/components/navbar-widget.hbs | 45 ++++
.../templates/components/typeahead-widget.hbs | 17 --
.../hive-web/app/templates/databases-tree.hbs | 2 +-
.../ui/hive-web/app/templates/databases.hbs | 4 +-
.../ui/hive-web/app/templates/history.hbs | 48 ++--
.../ui/hive-web/app/templates/index.hbs | 32 ++-
.../ui/hive-web/app/templates/insert-udfs.hbs | 2 +-
.../ui/hive-web/app/templates/navbar.hbs | 45 ----
.../ui/hive-web/app/templates/queries.hbs | 78 ++++---
.../ui/hive-web/app/templates/query-tabs.hbs | 2 +-
.../ui/hive-web/app/templates/udfs.hbs | 6 +-
.../ui/hive-web/app/utils/constants.js | 5 +-
.../ui/hive-web/app/utils/functions.js | 4 +-
.../resources/ui/hive-web/app/views/history.js | 25 --
.../ui/hive-web/app/views/insert-udfs.js | 23 --
.../resources/ui/hive-web/app/views/navbar.js | 38 ----
.../ui/hive-web/app/views/visual-explain.js | 23 +-
.../src/main/resources/ui/hive-web/bower.json | 4 +-
.../src/main/resources/ui/hive-web/package.json | 7 +-
.../src/main/resources/ui/hive-web/testem.json | 1 -
.../ui/hive-web/tests/helpers/api-mock.js | 51 ++++-
.../ui/hive-web/tests/helpers/start-app.js | 2 +-
.../hive-web/tests/integration/database-test.js | 4 +-
.../tests/integration/query-editor-test.js | 50 ++--
.../hive-web/tests/integration/tez-ui-test.js | 49 ++++
.../hive-web/tests/unit/adapters/application.js | 2 +-
.../unit/components/collapsible-widget-test.js | 4 +-
.../components/column-filter-widget-test.js | 2 +-
.../unit/components/date-range-widget-test.js | 6 +-
.../unit/components/expander-widget-test.js | 5 +-
.../unit/components/extended-input-test.js | 12 +-
.../tests/unit/components/job-tr-view-test.js | 62 +++++
.../tests/unit/components/modal-widget-test.js | 69 ++++++
.../tests/unit/components/no-bubbling-test.js | 3 +-
.../unit/components/number-range-widget-test.js | 4 +-
.../unit/components/popover-widget-test.js | 6 +-
.../unit/components/progress-widget-test.js | 27 +--
.../tests/unit/components/query-editor-test.js | 8 +-
.../tests/unit/components/select-widget-test.js | 6 +-
.../tests/unit/components/tabs-wiget-test.js | 2 +-
.../unit/components/typeahead-widget-test.js | 3 +-
.../hive-web/tests/unit/controllers/columns.js | 32 ---
.../tests/unit/controllers/databases-test.js | 56 +++--
.../tests/unit/controllers/history-test.js | 2 +-
.../tests/unit/controllers/index-test.js | 26 +--
.../tests/unit/controllers/insert-udfs-test.js | 2 +-
.../hive-web/tests/unit/controllers/job-test.js | 62 -----
.../tests/unit/controllers/messages-test.js | 53 +++++
.../tests/unit/controllers/open-queries-test.js | 9 +-
.../tests/unit/controllers/settings-test.js | 119 +++++-----
.../hive-web/tests/unit/controllers/tables.js | 32 ---
.../tests/unit/controllers/tez-ui-test.js | 83 ++++++-
.../hive-web/tests/unit/controllers/udf-test.js | 4 +-
.../tests/unit/controllers/udfs-test.js | 4 +-
.../unit/controllers/visual-explain-test.js | 33 ---
.../hive-web/tests/unit/services/notify-test.js | 4 +-
.../tests/unit/views/visual-explain-test.js | 84 ++++++-
contrib/views/hive/src/main/resources/view.xml | 2 +-
.../main/resources/ui/pig-web/vendor/emacs.js | 18 ++
105 files changed, 1799 insertions(+), 1482 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/hive/pom.xml b/contrib/views/hive/pom.xml
index 9638e96..6cd7c09 100644
--- a/contrib/views/hive/pom.xml
+++ b/contrib/views/hive/pom.xml
@@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ambari.contrib.views</groupId>
<artifactId>hive</artifactId>
- <version>0.4.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
<name>Hive</name>
<parent>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/atsJobs/ATSParser.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/atsJobs/ATSParser.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/atsJobs/ATSParser.java
index 7482921..1138767 100644
--- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/atsJobs/ATSParser.java
+++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/atsJobs/ATSParser.java
@@ -131,24 +131,26 @@ public class ATSParser implements IATSParser {
parsedJob.duration = lastEventTimestamp - parsedJob.starttime;
JSONObject otherinfo = (JSONObject) job.get("otherinfo");
- JSONObject query = (JSONObject) JSONValue.parse((String) otherinfo.get("QUERY"));
-
- parsedJob.query = (String) query.get("queryText");
- JSONObject stages = (JSONObject) ((JSONObject) query.get("queryPlan")).get("STAGE PLANS");
-
- List<String> dagIds = new LinkedList<String>();
- List<JSONObject> stagesList = new LinkedList<JSONObject>();
-
- for (Object key : stages.keySet()) {
- JSONObject stage = (JSONObject) stages.get(key);
- if (stage.get("Tez") != null) {
- String dagId = (String) ((JSONObject) stage.get("Tez")).get("DagName:");
- dagIds.add(dagId);
+ if (otherinfo.get("QUERY") != null) { // workaround for HIVE-10829
+ JSONObject query = (JSONObject) JSONValue.parse((String) otherinfo.get("QUERY"));
+
+ parsedJob.query = (String) query.get("queryText");
+ JSONObject stages = (JSONObject) ((JSONObject) query.get("queryPlan")).get("STAGE PLANS");
+
+ List<String> dagIds = new LinkedList<String>();
+ List<JSONObject> stagesList = new LinkedList<JSONObject>();
+
+ for (Object key : stages.keySet()) {
+ JSONObject stage = (JSONObject) stages.get(key);
+ if (stage.get("Tez") != null) {
+ String dagId = (String) ((JSONObject) stage.get("Tez")).get("DagName:");
+ dagIds.add(dagId);
+ }
+ stagesList.add(stage);
}
- stagesList.add(stage);
+ parsedJob.dagNames = dagIds;
+ parsedJob.stages = stagesList;
}
- parsedJob.dagNames = dagIds;
- parsedJob.stages = stagesList;
return parsedJob;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/rm/RMParserFactory.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/rm/RMParserFactory.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/rm/RMParserFactory.java
index 596d1d1..260b464 100644
--- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/rm/RMParserFactory.java
+++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/rm/RMParserFactory.java
@@ -28,60 +28,22 @@ public class RMParserFactory {
protected final static Logger LOG =
LoggerFactory.getLogger(RMParserFactory.class);
- public static final String HTTPS_ONLY = "HTTPS_ONLY";
- public static final String HTTP_ONLY = "HTTP_ONLY";
- public static final String YARN_SITE = "yarn-site";
- public static final String YARN_HTTP_POLICY = "yarn.http.policy";
-
- private ViewContext context;
+ private final ViewContext context;
+ private final AmbariApi ambariApi;
public RMParserFactory(ViewContext context) {
this.context = context;
+ this.ambariApi = new AmbariApi(context);
}
public RMParser getRMParser() {
- RMRequestsDelegate delegate = new RMRequestsDelegateImpl(context, getRMUrl());
+ String rmUrl = getRMUrl();
+
+ RMRequestsDelegate delegate = new RMRequestsDelegateImpl(context, rmUrl);
return new RMParser(delegate);
}
public String getRMUrl() {
- String url;
-
- AmbariApi ambariApi = new AmbariApi(context);
-
- if (ambariApi.isClusterAssociated()) {
- String httpPolicy = ambariApi.getCluster().getConfigurationValue("yarn-site", "yarn.http.policy");
- if (httpPolicy.equals(HTTPS_ONLY)) {
- url = ambariApi.getCluster().getConfigurationValue("yarn-site", "yarn.resourcemanager.webapp.https.address");
- } else {
- url = ambariApi.getCluster().getConfigurationValue("yarn-site", "yarn.resourcemanager.webapp.address");
- if (!httpPolicy.equals(HTTP_ONLY))
- LOG.error(String.format("R040 Unknown value %s of yarn-site/yarn.http.policy. HTTP_ONLY assumed.", httpPolicy));
- }
-
- } else {
- url = context.getProperties().get("yarn.resourcemanager.url");
- }
- return addProtocolIfMissing(url);
- }
-
- public String addProtocolIfMissing(String url) {
- if (!url.matches("^[^:]+://.*$")) {
- AmbariApi ambariApi = new AmbariApi(context);
- if (!ambariApi.isClusterAssociated()) {
- throw new ServiceFormattedException(
- "R030 View is not cluster associated. Resource Manager URL should contain protocol.");
- }
-
- String httpPolicy = ambariApi.getCluster().getConfigurationValue(YARN_SITE, YARN_HTTP_POLICY);
- if (httpPolicy.equals(HTTPS_ONLY)) {
- url = "https://" + url;
- } else {
- url = "http://" + url;
- if (!httpPolicy.equals(HTTP_ONLY))
- LOG.error(String.format("R050 Unknown value %s of yarn-site/yarn.http.policy. HTTP_ONLY assumed.", httpPolicy));
- }
- }
- return url;
+ return ambariApi.getServices().getRMUrl();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/Job.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/Job.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/Job.java
index 44a338c..9afb21a 100644
--- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/Job.java
+++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/Job.java
@@ -116,4 +116,8 @@ public interface Job extends Serializable,Indexed,PersonalResource {
String getReferrer();
void setReferrer(String referrer);
+
+ String getGlobalSettings();
+
+ void setGlobalSettings(String globalSettings);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/JobImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/JobImpl.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/JobImpl.java
index ac1c3da..317b791 100644
--- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/JobImpl.java
+++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/jobs/viewJobs/JobImpl.java
@@ -47,6 +47,7 @@ public class JobImpl implements Job {
private String sessionTag;
private String referrer;
+ private String globalSettings;
private String id = null;
private String owner = null;
@@ -283,4 +284,14 @@ public class JobImpl implements Job {
public void setReferrer(String referrer) {
this.referrer = referrer;
}
+
+ @Override
+ public String getGlobalSettings() {
+ return globalSettings;
+ }
+
+ @Override
+ public void setGlobalSettings(String globalSettings) {
+ this.globalSettings = globalSettings;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/Brocfile.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/Brocfile.js b/contrib/views/hive/src/main/resources/ui/hive-web/Brocfile.js
index 8a367c9..318d1f8 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/Brocfile.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/Brocfile.js
@@ -21,6 +21,9 @@
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
+ autoprefixer: {
+ browsers: ['last 3 version']
+ },
'ember-cli-selectize': {
//valid values are `default`, `bootstrap2`, `bootstrap3` or false
'theme': 'bootstrap3'
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/application.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/application.js
index 5e7a05b..34caa8a 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/application.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/application.js
@@ -22,8 +22,8 @@ import constants from 'hive/utils/constants';
export default DS.RESTAdapter.extend({
headers: {
'X-Requested-By': 'ambari',
- 'Content-Type': 'application/json',
- // 'Authorization': 'Basic YWRtaW46YWRtaW4='
+ 'Content-Type': 'application/json'
+ //,'Authorization': 'Basic YWRtaW46YWRtaW4='
},
buildURL: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/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
new file mode 100644
index 0000000..f439ca2
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/job-tr-view.js
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+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/5cdafecf/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
index 5172664..ce25bf1 100644
--- 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
@@ -20,9 +20,11 @@ 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 () {
- this.sendAction('close');
- }.bind(this));
+ self.sendAction('close');
+ });
}.on('didInsertElement'),
keyPress: function (e) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/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
new file mode 100644
index 0000000..c3659cf
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/navbar-widget.js
@@ -0,0 +1,39 @@
+/**
+ * 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})
+ ])
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/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
index 25ae1b3..ba0f080 100644
--- 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
@@ -18,7 +18,6 @@
import Ember from 'ember';
-
export default Ember.Component.extend({
tagName: 'notifications',
classNames: [ 'notifications-container' ],
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/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
new file mode 100644
index 0000000..9a01d53
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/application.js
@@ -0,0 +1,26 @@
+/**
+ * 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/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/columns.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/columns.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/columns.js
deleted file mode 100644
index 38d1b95..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/columns.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Ember from 'ember';
-import constants from 'hive/utils/constants';
-
-export default Ember.ObjectController.extend({
- pageCount: 10,
-
- init: function () {
- this._super();
-
- var databaseAdapter = this.container.lookup('adapter:database');
- var baseUrl = databaseAdapter.buildURL() + '/' +
- databaseAdapter.pathForType(constants.namingConventions.database) + '/';
-
- this.set('baseUrl', baseUrl);
- },
-
- getColumnsPage: function (databaseName, table, searchTerm, firstSearchPage) {
- var defer = Ember.RSVP.defer();
-
- var url = this.get('baseUrl') +
- databaseName +
- '/table/' +
- table.get('name');
-
- url += '.page?searchId&count=' + this.get('pageCount');
- url += '&columns=3,5';
-
- if (searchTerm) {
- url += '&searchId=searchColumns' + '&like=' + searchTerm;
-
- if (firstSearchPage) {
- url += '&first=true';
- }
- } else if (!table.get('columns.length')) {
- url += '&first=true';
- }
-
- Ember.$.getJSON(url).then(function (data) {
- Ember.run(function () {
- var columns;
-
- columns = data.rows.map(function (row) {
- return Ember.Object.create({
- name: row[0],
- type: row[1]
- });
- });
-
- defer.resolve({
- columns: columns,
- hasNext: data.hasNext
- });
- });
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- },
-
- getColumns: function (databaseName, tableName) {
- var defer = Ember.RSVP.defer();
-
- var url = this.get('baseUrl') +
- databaseName +
- '/table/' +
- tableName;
-
- Ember.$.getJSON(url).then(function (data) {
- Ember.run(function () {
- var columns = data.columns.map(function (column) {
- return Ember.Object.create({
- name: column[0],
- type: column[1]
- });
- });
-
- defer.resolve(columns);
- });
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/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
index 742657c..e6bc7f1 100644
--- 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
@@ -19,48 +19,48 @@
import Ember from 'ember';
import constants from 'hive/utils/constants';
-export default Ember.ArrayController.extend({
+export default Ember.Controller.extend({
+ databaseService: Ember.inject.service(constants.namingConventions.database),
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
pageCount: 10,
- needs: [ constants.namingConventions.tables,
- constants.namingConventions.columns,
- constants.namingConventions.openQueries ],
+ selectedDatabase: Ember.computed.alias('databaseService.selectedDatabase'),
+ databases: Ember.computed.alias('databaseService.databases'),
- openQueries: Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
- dbTables: Ember.computed.alias('controllers.' + constants.namingConventions.tables),
- dbColumns: Ember.computed.alias('controllers.' + constants.namingConventions.columns),
+ tableSearchResults: Ember.Object.create(),
- _handleTablesError: function (error) {
- this.notify.error(error.responseJSON.message, error.responseJSON.trace);
- this.set('isLoading', false);
- },
+ tableControls: [
+ {
+ icon: 'fa-list',
+ action: 'loadSampleData',
+ tooltip: Ember.I18n.t('tooltips.loadSample')
+ }
+ ],
- _handleColumnsError: function (error) {
- this.notify.error(error.responseJSON.message, error.responseJSON.trace);
- this.set('isLoading', false);
- },
+ 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
+ })
+ ],
- init: function () {
- this._super();
-
- var databaseAdapter = this.container.lookup('adapter:database');
- var baseUrl = databaseAdapter.buildURL() + '/' +
- databaseAdapter.pathForType(constants.namingConventions.database) + '/';
-
- this.set('baseUrl', baseUrl);
- this.set('tableSearchResults', Ember.Object.create());
-
- this.set('tabs', Ember.ArrayProxy.create({ content: Ember.A([
- 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) {
@@ -90,31 +90,14 @@ export default Ember.ArrayController.extend({
},
selectedDatabaseChanged: function () {
- var self = this,
- database = this.get('selectedDatabase');
-
- //if no selected database or database has already fully loaded tables
- if (!database || (database.tables && !database.get('hasNext'))) {
- return;
- }
+ var self = this;
this.set('isLoading', true);
- this.get('dbTables').getTables(database.get('name')).then(function (tables) {
- var mappedTables = {};
-
- //don't use Ember.Object.set since it can be very expensive for large collections (e.g. 15000 tables),
- //thus we should not do any bindings directly on the 'tables' collection.
- database.tables = tables;
-
- tables.forEach(function (table) {
- mappedTables[table.name] = [];
- });
-
- self.set('openQueries.selectedTables', mappedTables);
+ this.get('databaseService').getAllTables().then(function () {
self.set('isLoading', false);
}, function (err) {
- self._handleTablesError(err);
+ self._handleError(err);
});
}.observes('selectedDatabase'),
@@ -128,7 +111,7 @@ export default Ember.ArrayController.extend({
table.set('visibleColumns', []);
}
- this.get('dbColumns').getColumnsPage(database.get('name'), table).then(function (result) {
+ 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);
@@ -136,7 +119,7 @@ export default Ember.ArrayController.extend({
self.setColumnPageAvailability(table);
self.set('isLoading', false);
}, function (err) {
- self._handleColumnsError(err);
+ self._handleError(err);
});
},
@@ -150,7 +133,7 @@ export default Ember.ArrayController.extend({
database.set('visibleTables', []);
}
- this.get('dbTables').getTablesPage(database).then(function (result) {
+ this.get('databaseService').getTablesPage(database).then(function (result) {
database.tables.pushObjects(result.tables);
database.get('visibleTables').pushObjects(result.tables);
database.set('hasNext', result.hasNext);
@@ -158,86 +141,26 @@ export default Ember.ArrayController.extend({
self.setTablePageAvailability(database);
self.set('isLoading', false);
}, function (err) {
- self._handleTablesError(err);
+ self._handleError(err);
});
},
- getAllColumns: function (tableName) {
- var defer = Ember.RSVP.defer();
+ getDatabases: function () {
var self = this;
- var database = this.get('selectedDatabase');
- var table = database.get('tables').findBy('name', tableName);
-
- //if all the columns were already loaded for this table, do not get them again.
- if (!table || (table.columns && !table.get('hasNext'))) {
- defer.resolve();
- } else {
- this.set('isLoading', true);
-
- this.get('dbColumns').getColumns(database.get('name'), tableName).then(function (columns) {
- table.columns = columns;
- table.set('hasNext', false);
+ var selectedDatabase = this.get('selectedDatabase');
- self.get('openQueries.selectedTables')[tableName] = columns.mapProperty('name');
- self.set('isLoading', false);
-
- defer.resolve();
- }, function (err) {
- self._handleColumnsError(err);
- defer.reject(err);
- });
- }
-
- return defer.promise;
- },
+ this.set('isLoading', true);
- tableControls: Ember.A([
- Ember.Object.create({
- icon: 'fa-list',
- action: 'loadSampleData',
- tooltip: Ember.I18n.t('tooltips.loadSample')
- })
- ]),
-
- panelIconActions: function () {
- return [
- Ember.Object.create({
- icon: 'fa-refresh',
- action: 'refreshDatabaseExplorer',
- tooltip: Ember.I18n.t('tooltips.refresh')
- })
- ];
- }.property(),
+ this.get('databaseService').getDatabases().then(function (databases) {
+ self.set('isLoading');
+ }).catch(function (error) {
+ self._handleError(error);
+ });
+ }.on('init'),
actions: {
refreshDatabaseExplorer: function () {
- var self = this;
- var selectedDatabase = this.get('selectedDatabase');
-
- this.set('isLoading', true);
-
- this.store.unloadAll('database');
- this.store.fetchAll('database').then(function (databases) {
- var database;
-
- self.set('model', databases);
-
- //if a database was previously selected, check if it still exists
- if (selectedDatabase) {
- database = databases.findBy('id', selectedDatabase.get('id'));
-
- if (!database) {
- self.set('selectedDatabase', databases.objectAt(0));
- }
- } else if (self.get('model.length')) {
- self.set('selectedDatabase', databases.objectAt(0));
- }
-
- self.set('isLoading');
- }).catch(function (response) {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
- self.set('isLoading');
- });
+ this.getDatabases();
},
loadSampleData: function (tableName, database) {
@@ -248,15 +171,12 @@ export default Ember.ArrayController.extend({
var query = constants.sampleDataQuery.fmt(tableName);
self.set('selectedDatabase', database);
- self.get('openQueries.currentQuery')
- .set('fileContent', query);
-
- self.send('executeQuery', constants.jobReferrer.sample);
+ self.send('executeQuery', constants.jobReferrer.sample, query);
});
},
getTables: function (dbName) {
- var database = this.findBy('name', dbName),
+ var database = this.get('databases').findBy('name', dbName),
tables = database.tables,
pageCount = this.get('pageCount');
@@ -328,13 +248,13 @@ export default Ember.ArrayController.extend({
this.set('columnSearchTerm', '');
this.set('isLoading', true);
- this.get('dbTables').getTablesPage(this.get('selectedDatabase'), searchTerm, true).then(function (result) {
+ 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._handleTablesError(err);
+ self._handleError(err);
});
},
@@ -351,7 +271,7 @@ export default Ember.ArrayController.extend({
this.set('isLoading', true);
tables.forEach(function (table) {
- self.get('dbColumns').getColumnsPage(database.get('name'), table, searchTerm, true).then(function (result) {
+ self.get('databaseService').getColumnsPage(database.get('name'), table, searchTerm, true).then(function (result) {
table.set('columns', result.columns);
table.set('hasNext', result.hasNext);
@@ -359,7 +279,7 @@ export default Ember.ArrayController.extend({
self.set('isLoading', false);
}
}, function (err) {
- self._handleColumnsError(err);
+ self._handleError(err);
});
});
},
@@ -372,7 +292,7 @@ export default Ember.ArrayController.extend({
this.set('isLoading', true);
- this.get('dbTables').getTablesPage(database, searchTerm).then(function (tablesResult) {
+ 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;
@@ -385,7 +305,7 @@ export default Ember.ArrayController.extend({
//load the columns search results for the newly loaded tables.
if (shouldGetColumns) {
tablesResult.tables.forEach(function (table) {
- self.get('dbColumns').getColumnsPage(database.get('name'), table, self.get('columnSearchTerm'), true).then(function (result) {
+ 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);
@@ -393,14 +313,14 @@ export default Ember.ArrayController.extend({
self.set('isLoading', false);
}
}, function (err) {
- self._handleColumnsError(err);
+ self._handleError(err);
});
});
} else {
self.set('isLoading', false);
}
}, function (err) {
- self._handleTablesError(err);
+ self._handleError(err);
});
},
@@ -409,13 +329,13 @@ export default Ember.ArrayController.extend({
this.set('isLoading', true);
- this.get('dbColumns').getColumnsPage(this.get('selectedDatabase.name'), table, this.get('columnSearchTerm')).then(function (result) {
+ 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._handleColumnsError(err);
+ self._handleError(err);
});
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/file-resources.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/file-resources.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/file-resources.js
deleted file mode 100644
index 578fa67..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/file-resources.js
+++ /dev/null
@@ -1,22 +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.ArrayController.extend({
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/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
index c19b131..e63362a 100644
--- 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
@@ -21,7 +21,8 @@ import FilterableMixin from 'hive/mixins/filterable';
import constants from 'hive/utils/constants';
export default Ember.ArrayController.extend(FilterableMixin, {
- itemController: constants.namingConventions.job,
+ jobService: Ember.inject.service('job'),
+ fileService: Ember.inject.service('file'),
sortAscending: false,
sortProperties: ['dateSubmittedTimestamp'],
@@ -76,13 +77,12 @@ export default Ember.ArrayController.extend(FilterableMixin, {
return column.get('caption') === 'columns.duration';
});
- minDuration = Math.min.apply(Math, this.get('history').map(function (item) {
+ var items = this.get('history').map(function (item) {
return item.get(durationColumn.get('property'));
- }));
+ });
- maxDuration = Math.max.apply(Math, 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) : 0;
durationColumn.set('numberRange.min', minDuration);
durationColumn.set('numberRange.max', maxDuration);
@@ -99,13 +99,12 @@ export default Ember.ArrayController.extend(FilterableMixin, {
return column.get('caption') === 'columns.date';
});
- minDate = Math.min.apply(Math, this.get('history').map(function (item) {
+ var items = this.get('history').map(function (item) {
return item.get(dateColumn.get('property'));
- }));
+ });
- maxDate = Math.max.apply(Math, this.get('history').map(function (item) {
- return item.get(dateColumn.get('property'));
- }));
+ minDate = items.length ? Math.min.apply(Math, items) : new Date();
+ maxDate = items.length ? Math.max.apply(Math, items) : new Date();
dateColumn.set('dateRange.min', minDate);
dateColumn.set('dateRange.max', maxDate);
@@ -136,22 +135,12 @@ export default Ember.ArrayController.extend(FilterableMixin, {
},
interruptJob: function (job) {
- var self = this;
- var id = job.get('id');
- var url = this.container.lookup('adapter:application').buildURL();
- url += "/jobs/" + id;
-
- job.set('isCancelling', true);
-
- Ember.$.ajax({
- url: url,
- type: 'DELETE',
- headers: {
- 'X-Requested-By': 'ambari',
- },
- success: function () {
- job.reload();
- }
+ this.get('jobService').stopJob(job);
+ },
+
+ loadFile: function (job) {
+ this.get('fileService').loadFile(job.get('queryFile')).then(function (file) {
+ job.set('file', file);
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index.js
index a31e984..ea2ed5d 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index.js
@@ -1,5 +1,4 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
+/** * 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
@@ -21,8 +20,11 @@ import constants from 'hive/utils/constants';
import utils from 'hive/utils/functions';
export default Ember.Controller.extend({
+ jobService: Ember.inject.service(constants.namingConventions.job),
+ databaseService: Ember.inject.service(constants.namingConventions.database),
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
needs: [ constants.namingConventions.openQueries,
- constants.namingConventions.databases,
constants.namingConventions.udfs,
constants.namingConventions.jobLogs,
constants.namingConventions.jobResults,
@@ -34,7 +36,6 @@ export default Ember.Controller.extend({
],
openQueries: Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
- databases: Ember.computed.alias('controllers.' + constants.namingConventions.databases),
udfs: Ember.computed.alias('controllers.' + constants.namingConventions.udfs + '.udfs'),
logs: Ember.computed.alias('controllers.' + constants.namingConventions.jobLogs),
results: Ember.computed.alias('controllers.' + constants.namingConventions.jobResults),
@@ -44,6 +45,8 @@ export default Ember.Controller.extend({
tezUI: Ember.computed.alias('controllers.' + constants.namingConventions.tezUI),
jobProgress: Ember.computed.alias('controllers.' + constants.namingConventions.jobProgress),
+ selectedDatabase: Ember.computed.alias('databaseService.selectedDatabase'),
+
isDatabaseExplorerVisible: true,
init: function () {
@@ -125,7 +128,7 @@ export default Ember.Controller.extend({
job = this.store.createRecord(constants.namingConventions.job, {
title: originalModel.get('title'),
sessionTag: originalModel.get('sessionTag'),
- dataBase: this.get('databases.selectedDatabase.name'),
+ dataBase: this.get('selectedDatabase.name'),
referrer: referrer
});
@@ -152,9 +155,7 @@ export default Ember.Controller.extend({
if (!query) {
originalModel.set('isRunning', false);
defer.reject({
- responseJSON: {
- message: 'Running multiple queries is not supported.'
- }
+ message: 'Running multiple queries is not supported.'
});
return defer.promise;
@@ -196,6 +197,7 @@ export default Ember.Controller.extend({
openQueries = this.get('openQueries');
var handleError = function (err) {
+ self.set('jobSaveSucceeded');
originalModel.set('isRunning', undefined);
defer.reject(err);
};
@@ -203,6 +205,8 @@ export default Ember.Controller.extend({
job.save().then(function () {
//convert tab for current model since the execution will create a new job, and navigate to the new job route.
openQueries.convertTabToJob(originalModel, job).then(function () {
+ self.set('jobSaveSucceeded', true);
+
//reset flag on the original model
originalModel.set('isRunning', undefined);
@@ -258,20 +262,11 @@ export default Ember.Controller.extend({
}
queries = queryComponents.queryString.split(';');
- queries = queries.map(function (s) {
- return s.trim();
- });
queries = queries.filter(Boolean);
- // return false if multiple queries are selected
- // @FIXME: Remove this to support multiple queries
- // if (queries.length > 1) {
- // return false;
- // }
-
queries = queries.map(function (query) {
if (shouldExplain) {
- query = query.replace(/explain|formatted/gi, '').trim();
+ query = query.replace(/explain formatted|explain/gi, '');
if (shouldGetVisualExplain) {
return constants.namingConventions.explainFormattedPrefix + query;
@@ -279,7 +274,7 @@ export default Ember.Controller.extend({
return constants.namingConventions.explainPrefix + query;
}
} else {
- return query.replace(/explain|formatted/gi, '').trim();
+ return query.replace(/explain formatted|explain/gi, '');
}
});
@@ -293,7 +288,7 @@ export default Ember.Controller.extend({
finalQuery += queries.join(";");
finalQuery += ";";
- return finalQuery;
+ return finalQuery.trim();
},
bindQueryParams: function (query) {
@@ -312,18 +307,24 @@ export default Ember.Controller.extend({
displayJobTabs: function () {
return this.get('content.constructor.typeKey') === constants.namingConventions.job &&
- utils.isInteger(this.get('content.id'));
- }.property('content'),
+ utils.isInteger(this.get('content.id')) &&
+ this.get('jobSaveSucceeded');
+ }.property('content', 'jobSaveSucceeded'),
+
+ databasesOrModelChanged: function () {
+ this.get('databaseService').setDatabaseByName(this.get('content.dataBase'));
+ }.observes('databaseService.databases', 'content'),
+
+ selectedDatabaseChanged: function () {
+ this.set('content.dataBase', this.get('selectedDatabase.name'));
+ }.observes('selectedDatabase'),
modelChanged: function () {
var self = this;
var content = this.get('content');
var openQueries = this.get('openQueries');
- var database = this.get('databases').findBy('name', this.get('content.dataBase'));
- if (database) {
- this.set('databases.selectedDatabase', database);
- }
+ this.set('jobSaveSucceeded', true);
//update open queries list when current query model changes
openQueries.update(content).then(function (isExplainedQuery) {
@@ -350,10 +351,6 @@ export default Ember.Controller.extend({
});
}.observes('content'),
- selectedDatabaseChanged: function () {
- this.set('content.dataBase', this.get('databases.selectedDatabase.name'));
- }.observes('databases.selectedDatabase'),
-
csvUrl: function () {
if (this.get('content.constructor.typeKey') !== constants.namingConventions.job) {
return;
@@ -425,8 +422,8 @@ export default Ember.Controller.extend({
file: file
}).then(function (response) {
self.pollSaveToHDFS(response);
- }, function (response) {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
},
@@ -442,8 +439,8 @@ export default Ember.Controller.extend({
} else {
self.set('content.isRunning', false);
}
- }, function (response) {
- self.notify.error(response.responseJSON.message, response.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
}, 2000);
},
@@ -461,6 +458,10 @@ export default Ember.Controller.extend({
}.property('content.status'),
actions: {
+ stopCurrentJob: function () {
+ this.get('jobService').stopJob(this.get('model'));
+ },
+
saveToHDFS: function () {
var self = this,
defer = Ember.RSVP.defer();
@@ -530,7 +531,7 @@ export default Ember.Controller.extend({
return function (workSheetName) {
var model = this.store.createRecord(constants.namingConventions.savedQuery, {
- dataBase: this.get('databases.selectedDatabase.name'),
+ dataBase: this.get('selectedDatabase.name'),
title: workSheetName ? workSheetName : Ember.I18n.t('titles.query.tab'),
queryFile: '',
id: 'fixture_' + idCounter
@@ -556,7 +557,7 @@ export default Ember.Controller.extend({
defer = Ember.RSVP.defer(),
currentQuery = this.get('openQueries.currentQuery');
- this.set('model.dataBase', this.get('databases.selectedDatabase.name'));
+ this.set('model.dataBase', this.get('selectedDatabase.name'));
this.send('openModal', 'modal-save-query', {
heading: 'modals.save.heading',
@@ -567,16 +568,19 @@ export default Ember.Controller.extend({
});
defer.promise.then(function (result) {
- currentQuery.set('fileContent', self.prependQuerySettings(currentQuery.get('fileContent')));
// we need to update the original model
// because when this is executed
// it sets the title from the original model
self.set('model.title', result.get('text'));
if (result.get('overwrite')) {
- self.get('openQueries').save(self.get('content'), null, true, result.get('text'));
+ self.get('openQueries').save(self.get('content'), null, true, result.get('text')).then(function () {
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.query.update'));
+ });
} else {
self.get('openQueries').save(self.get('content'), null, false, result.get('text')).then(function (newId) {
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.query.save'));
+
if (self.get('model.constructor.typeKey') !== constants.namingConventions.job) {
self.transitionToRoute(constants.namingConventions.subroutes.savedQuery, newId);
}
@@ -585,10 +589,14 @@ export default Ember.Controller.extend({
});
},
- executeQuery: function (referrer) {
+ executeQuery: function (referrer, query) {
var self = this;
var subroute;
+ if (query) {
+ this.set('openQueries.currentQuery.fileContent', query);
+ }
+
referrer = referrer || constants.jobReferrer.job;
this._executeQuery(referrer).then(function (job) {
@@ -599,11 +607,10 @@ export default Ember.Controller.extend({
}
self.get('openQueries').updateTabSubroute(job, subroute);
-
+ self.get('notifyService').success(Ember.I18n.t('alerts.success.query.execution'));
self.transitionToRoute(constants.namingConventions.subroutes.historyQuery, job.get('id'));
- }, function (err) {
- var errorBody = err.responseJSON.trace ? err.responseJSON.trace : false;
- self.notify.error(err.responseJSON.message, errorBody);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
},
@@ -614,8 +621,8 @@ export default Ember.Controller.extend({
self.get('openQueries').updateTabSubroute(job, constants.namingConventions.subroutes.jobExplain);
self.transitionToRoute(constants.namingConventions.subroutes.historyQuery, job.get('id'));
- }, function (err) {
- self.notify.error(err.responseJSON.message, err.responseJSON.trace);
+ }, function (error) {
+ self.get('notifyService').error(error);
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/explain.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/explain.js
index 2f3e78d..20092e2 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/explain.js
@@ -52,27 +52,29 @@ export default Ember.ObjectController.extend({
url += '?first=true';
}
- Ember.$.getJSON(url).then(function (data) {
- var explainSet;
+ this.get('content').reload().then(function () {
+ Ember.$.getJSON(url).then(function (data) {
+ var explainSet;
- //if rows from a previous page read exist, prepend them
- if (rows) {
- data.rows.unshiftObjects(rows);
- }
+ //if rows from a previous page read exist, prepend them
+ if (rows) {
+ data.rows.unshiftObjects(rows);
+ }
- if (!data.hasNext) {
- explainSet = self.get('cachedExplains').pushObject(Ember.Object.create({
- id: self.get('content.id'),
- explain: data
- }));
+ if (!data.hasNext) {
+ explainSet = self.get('cachedExplains').pushObject(Ember.Object.create({
+ id: self.get('content.id'),
+ explain: data
+ }));
- self.set('content.explain', explainSet);
+ self.set('content.explain', explainSet);
- self.formatExplainResults(explainSet);
- } else {
- self.getExplain(false, data.rows);
- }
- });
+ self.formatExplainResults(explainSet);
+ } else {
+ self.getExplain(false, data.rows);
+ }
+ });
+ })
},
formatExplainResults: function (explainSet) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/logs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/logs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/logs.js
index 3c710d3..43c7a7e 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/logs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index/history-query/logs.js
@@ -21,25 +21,24 @@ import constants from 'hive/utils/constants';
import utils from 'hive/utils/functions';
export default Ember.ObjectController.extend({
+ fileService: Ember.inject.service(constants.namingConventions.file),
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
needs: [ constants.namingConventions.queryTabs,
- constants.namingConventions.loadedFiles ],
+ constants.namingConventions.index,
+ constants.namingConventions.openQueries ],
queryTabs: Ember.computed.alias('controllers.' + constants.namingConventions.queryTabs),
- files: Ember.computed.alias('controllers.' + constants.namingConventions.loadedFiles),
+ index: Ember.computed.alias('controllers.' + constants.namingConventions.index),
+ openQueries: Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
reloadJobLogs: function (job) {
- var self = this,
- defer = Ember.RSVP.defer(),
- handleError = function (error) {
- job.set('isRunning', false);
-
- if (typeof error === "string") {
- self.notify.error(error);
- } else {
- self.notify.error(error.responseJSON.message, error.responseJSON.trace);
- }
- defer.reject();
- };
+ var self = this;
+ var handleError = function (error) {
+ job.set('isRunning', false);
+
+ self.get('notifyService').error(error);
+ };
job.reload().then(function () {
if (utils.insensitiveCompare(job.get('status'), constants.statuses.error) ||
@@ -47,46 +46,40 @@ export default Ember.ObjectController.extend({
handleError(job.get('statusMessage'));
}
- self.get('files').reload(job.get('logFile')).then(function (file) {
+ self.get('fileService').reloadFile(job.get('logFile')).then(function (file) {
var fileContent = file.get('fileContent');
+ var stillRunning = self.isJobRunning(job);
+ var currentIndexModelId = self.get('index.model.id');
+ var currentActiveTab = self.get('queryTabs.activeTab.name');
if (fileContent) {
job.set('log', fileContent);
}
- defer.resolve();
- },function (err) {
- handleError(err);
- });
- }, function (err) {
- handleError(err);
- });
-
- return defer.promise;
- },
-
- listenForUpdates: function (job) {
- Ember.run.later(this, function () {
- var self = this;
-
- this.reloadJobLogs(job).then(function () {
- var stillRunning = self.isJobRunning(job);
- var currentContentId = self.get('content.id');
- var currentActiveTab = self.get('queryTabs.activeTab.name');
-
//if the current model is the same with the one displayed, continue reloading job
- if (stillRunning && job.get('id') === currentContentId) {
- self.listenForUpdates(job);
+ if (stillRunning) {
+ Ember.run.later(self, function () {
+ this.reloadJobLogs(job);
+ }, 10000);
} else if (!stillRunning) {
job.set('isRunning', undefined);
+ job.set('retrievingLogs', false);
- if (job.get('id') === currentContentId &&
- currentActiveTab === constants.namingConventions.index) {
- self.transitionToRoute(constants.namingConventions.subroutes.jobResults);
+ if (utils.insensitiveCompare(job.get('status'), constants.statuses.succeeded)) {
+ self.get('openQueries').updateTabSubroute(job, constants.namingConventions.subroutes.jobResults);
+
+ if (job.get('id') === currentIndexModelId && currentActiveTab === constants.namingConventions.index) {
+ self.transitionToRoute(constants.namingConventions.subroutes.historyQuery, job.get('id'));
+ }
}
}
+
+ },function (err) {
+ handleError(err);
});
- }, 10000);
+ }, function (err) {
+ handleError(err);
+ });
},
isJobRunning: function (job) {
@@ -98,14 +91,18 @@ export default Ember.ObjectController.extend({
},
getLogs: function () {
- var self = this,
- job = this.get('content');
+ var job = this.get('content');
if (this.isJobRunning(job)) {
- job.set('isRunning', true);
- this.reloadJobLogs(job).then(function () {
- self.listenForUpdates(job);
- });
+ if (!job.get('retrievingLogs')) {
+ job.set('retrievingLogs', true);
+ job.set('isRunning', true);
+ this.reloadJobLogs(job);
+ }
+ } else if (utils.insensitiveCompare(job.get('status'), constants.statuses.succeeded) && !job.get('dagId')) {
+ //if a job that never polled for logs is succeeded, jump straight to results tab.
+ this.get('openQueries').updateTabSubroute(job, constants.namingConventions.subroutes.jobResults);
+ this.transitionToRoute(constants.namingConventions.subroutes.historyQuery, job.get('id'));
}
}.observes('content')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/insert-udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/insert-udfs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/insert-udfs.js
index fcfd113..09f17c3 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/insert-udfs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/insert-udfs.js
@@ -20,7 +20,7 @@ import Ember from 'ember';
import constants from 'hive/utils/constants';
export default Ember.ArrayController.extend({
- needs: [ constants.namingConventions.udfs, constants.namingConventions.fileResources ],
+ needs: [ constants.namingConventions.udfs ],
model: Ember.A(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job-progress.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job-progress.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job-progress.js
index c80ae81..3181f90 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job-progress.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job-progress.js
@@ -22,71 +22,108 @@ import constants from 'hive/utils/constants';
export default Ember.Controller.extend({
needs: [ constants.namingConventions.index ],
+ jobs: [],
+
index: Ember.computed.alias('controllers.' + constants.namingConventions.index),
- listenForProgress: function () {
- var self = this;
- var url = this.container.lookup('adapter:application').buildURL();
- var stages = [];
- var job = this.get('index.model');
+ modelChanged: function () {
+ var model = this.get('index.model');
+ var job;
- var reloadProgress = function () {
- Ember.run.later(function () {
- Ember.$.getJSON(url).then(function (data) {
- var total = 0;
- var length = Object.keys(data.vertexProgresses).length;
+ if (!this.isJob(model)) {
+ return;
+ }
- if (!self.get('stages.length')) {
- data.vertexProgresses.forEach(function (vertexProgress) {
- var progress = vertexProgress.progress * 100;
+ job = this.jobs.findBy('model', model);
- stages.pushObject(Ember.Object.create({
- name: vertexProgress.name,
- value: progress
- }));
+ if (!job) {
+ job = this.jobs.pushObject(Ember.Object.create({
+ model: model,
+ stages: [],
+ totalProgress: 0,
+ retrievingProgress: false,
+ }));
+ }
- total += progress;
- });
+ this.set('currentJob', job);
+ }.observes('index.model'),
- self.set('stages', stages);
- } else {
- data.vertexProgresses.forEach(function (vertexProgress) {
- var progress = vertexProgress.progress * 100;
+ updateProgress: function () {
+ var job = this.get('currentJob');
- self.get('stages').findBy('name', vertexProgress.name).set('value', progress);
+ if (!job.get('model.dagId')) {
+ return;
+ }
- total += progress;
- });
- }
+ if (this.get('totalProgress') < 100 && !job.get('retrievingProgress')) {
+ this.reloadProgress(job);
+ }
+ }.observes('currentJob.model.dagId'),
- total /= length;
+ totalProgress: function () {
+ if (!this.isJob(this.get('index.model'))) {
+ return;
+ }
- self.set('totalProgress', total);
+ return this.get('currentJob.totalProgress');
+ }.property('index.model', 'currentJob.totalProgress'),
- if (job.get('isRunning') && total < 100) {
- reloadProgress();
- }
+ stages: function () {
+ if (!this.isJob(this.get('index.model'))) {
+ return;
+ }
- }, function (err) {
- reloadProgress();
+ return this.get('currentJob.stages');
+ }.property('index.model', 'currentJob.stages.@each.value'),
+
+ reloadProgress: function (job) {
+ var self = this;
+ var url = '%@/%@/%@/progress'.fmt(this.container.lookup('adapter:application').buildURL(),
+ constants.namingConventions.jobs,
+ job.get('model.id'));
+
+ job.set('retrievingProgress', true);
+
+ Ember.$.getJSON(url).then(function (data) {
+ var total = 0;
+ var length = Object.keys(data.vertexProgresses).length;
+
+ if (!job.get('stages.length')) {
+ data.vertexProgresses.forEach(function (vertexProgress) {
+ var progress = vertexProgress.progress * 100;
+
+ job.get('stages').pushObject(Ember.Object.create({
+ name: vertexProgress.name,
+ value: progress
+ }));
+
+ total += progress;
});
- }, 1000);
- };
+ } else {
+ data.vertexProgresses.forEach(function (vertexProgress) {
+ var progress = vertexProgress.progress * 100;
- //reset stages
- this.set('stages', []);
- this.set('totalProgress', 0);
+ job.get('stages').findBy('name', vertexProgress.name).set('value', progress);
- if (!job.get('dagId')) {
- return;
- }
+ total += progress;
+ });
+ }
+
+ total /= length;
- url += '/' + constants.namingConventions.jobs + '/' + job.get('id') + '/progress';
+ job.set('totalProgress', total);
- reloadProgress();
- }.observes('index.model', 'index.model.dagId'),
+ if (job.get('model.isRunning') && total < 100) {
+ Ember.run.later(function () {
+ self.reloadProgress(job);
+ }, 1000);
+ } else {
+ job.set('retrievingProgress');
+ }
+ });
+ },
- displayProgress: function () {
- return this.get('index.model.constructor.typeKey') === constants.namingConventions.job;
- }.property('index.model')
+ isJob: function (model) {
+ return model.get('constructor.typeKey') === constants.namingConventions.job;
+ }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job.js
deleted file mode 100644
index 2d53524..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/job.js
+++ /dev/null
@@ -1,48 +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.ObjectController.extend({
- needs: [ constants.namingConventions.history, constants.namingConventions.loadedFiles ],
-
- files: Ember.computed.alias('controllers.' + constants.namingConventions.loadedFiles),
-
- canStop: function () {
- return utils.insensitiveCompare(this.get('status'), constants.statuses.running, constants.statuses.initialized, constants.statuses.pending);
- }.property('status'),
-
- actions: {
- loadFile: function () {
- var self = this;
- if (!this.get('file')) {
- this.get('files').loadFile(this.get('model.queryFile')).then(function (file) {
- self.set('file', file);
- });
- }
-
- this.set('expanded', !this.get('expanded'));
- },
-
- stop: function () {
- this.send('interruptJob', this.get('model'));
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/loaded-files.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/loaded-files.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/loaded-files.js
deleted file mode 100644
index 3a11171..0000000
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/loaded-files.js
+++ /dev/null
@@ -1,65 +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.ArrayController.extend({
- contains: function (obj) {
- if (typeof obj === 'string') {
- return this.findBy('id', obj);
- }
-
- return this._super(obj);
- },
-
- loadFile: function (path) {
- var self = this;
- var defer = Ember.RSVP.defer();
- var file = this.contains(path);
-
- if (file) {
- defer.resolve(file);
- } else {
- this.store.find(constants.namingConventions.file, path).then(function (file) {
- self.pushObject(file);
- defer.resolve(file);
- }, function (err) {
- defer.reject(err);
- });
- }
-
- return defer.promise;
- },
-
- reload: function (path) {
- var defer = Ember.RSVP.defer();
-
- this.store.find(constants.namingConventions.file, path).then(function (file) {
- file.reload().then(function (reloadedFile) {
- defer.resolve(reloadedFile);
- }, function (err) {
- defer.reject(err);
- });
- }, function (err) {
- defer.reject(err);
- });
-
- return defer.promise;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/messages.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/messages.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/messages.js
index db8e0b5..11295d8 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/messages.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/messages.js
@@ -15,23 +15,27 @@
* 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({
- messages: Ember.computed.alias('notify.messages'),
- count: Ember.computed.alias('notify.unseenMessages.length'),
+ notifyService: Ember.inject.service(constants.namingConventions.notify),
+
+ messages: Ember.computed.alias('notifyService.messages'),
+ count: Ember.computed.alias('notifyService.unseenMessages.length'),
actions: {
removeMessage: function (message) {
- this.notify.removeMessage(message);
+ this.get('notifyService').removeMessage(message);
},
removeAllMessages: function () {
- this.notify.removeAllMessages();
+ this.get('notifyService').removeAllMessages();
},
markMessagesAsSeen: function () {
- this.notify.markMessagesAsSeen();
+ this.get('notifyService').markMessagesAsSeen();
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/open-queries.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/open-queries.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/open-queries.js
index 722ea0a..484df16 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/open-queries.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/open-queries.js
@@ -21,27 +21,23 @@ import constants from 'hive/utils/constants';
import utils from 'hive/utils/functions';
export default Ember.ArrayController.extend({
- needs: [ constants.namingConventions.databases,
- constants.namingConventions.loadedFiles,
- constants.namingConventions.jobResults,
+ fileService: Ember.inject.service(constants.namingConventions.file),
+ databaseService: Ember.inject.service(constants.namingConventions.database),
+
+ needs: [ constants.namingConventions.jobResults,
constants.namingConventions.jobExplain,
- constants.namingConventions.columns,
constants.namingConventions.index,
constants.namingConventions.settings
],
- databases: Ember.computed.alias('controllers.' + constants.namingConventions.databases),
-
- files: Ember.computed.alias('controllers.' + constants.namingConventions.loadedFiles),
-
jobResults: Ember.computed.alias('controllers.' + constants.namingConventions.jobResults),
-
jobExplain: Ember.computed.alias('controllers.' + constants.namingConventions.jobExplain),
-
index: Ember.computed.alias('controllers.' + constants.namingConventions.index),
-
settings: Ember.computed.alias('controllers.' + constants.namingConventions.settings),
+ selectedTables: Ember.computed.alias('databaseService.selectedTables'),
+ selectedDatabase: Ember.computed.alias('databaseService.selectedDatabase'),
+
init: function () {
this._super();
@@ -132,14 +128,14 @@ export default Ember.ArrayController.extend({
defer.resolve();
} else {
- this.get('files').loadFile(model.get('queryFile')).then(function (file) {
+ this.get('fileService').loadFile(model.get('queryFile')).then(function (file) {
self.set('currentQuery', self.pushObject(file));
updateSubroute();
});
if (model.get('logFile') && !model.get('log')) {
- this.get('files').loadFile(model.get('logFile')).then(function (file) {
+ this.get('fileService').loadFile(model.get('logFile')).then(function (file) {
model.set('log', file.get('fileContent'));
});
}
@@ -175,7 +171,7 @@ export default Ember.ArrayController.extend({
//if current query it's a job, convert it to a savedQuery before saving
if (model.get('constructor.typeKey') === constants.namingConventions.job) {
model = this.store.createRecord(constants.namingConventions.savedQuery, {
- dataBase: this.get('databases.selectedDatabase.name'),
+ dataBase: this.get('selectedDatabase.name'),
title: newTitle,
queryFile: model.get('queryFile'),
owner: model.get('owner')
@@ -187,7 +183,7 @@ export default Ember.ArrayController.extend({
//if saving a new query from an existing one create a new record and save it
if (!isUpdating && !model.get('isNew') && model.get('constructor.typeKey') !== constants.namingConventions.job) {
model = this.store.createRecord(constants.namingConventions.savedQuery, {
- dataBase: this.get('databases.selectedDatabase.name'),
+ dataBase: this.get('selectedDatabase.name'),
title: newTitle,
owner: model.get('owner')
});
@@ -201,12 +197,17 @@ export default Ember.ArrayController.extend({
tab.set('isDirty', false);
var content = query.get('fileContent');
+ content = self.get('index').buildQuery(query);
+ content = self.get('index').bindQueryParams(content);
+ content = self.get('index').prependQuerySettings(content);
+
//update query tab path with saved model id if its a new record
if (wasNew) {
self.get('settings').updateSettingsId(originalId, updatedModel.get('id'));
tab.set('id', updatedModel.get('id'));
- self.get('files').loadFile(updatedModel.get('queryFile')).then(function (file) {
+ self.get('fileService').loadFile(updatedModel.get('queryFile')).then(function (file) {
+ file.set('blockSettingsParser', true);
file.set('fileContent', content);
file.save().then(function (updatedFile) {
self.removeObject(query);
@@ -214,6 +215,8 @@ export default Ember.ArrayController.extend({
self.set('currentQuery', updatedFile);
defer.resolve(updatedModel.get('id'));
+ self.get('settings').parseQuerySettings(false);
+ query.set('blockSettingsParser', false);
}, function (err) {
defer.reject(err);
});
@@ -221,10 +224,14 @@ export default Ember.ArrayController.extend({
defer.reject(err);
});
} else {
+ query.set('blockSettingsParser', true);
query.set('fileContent', content);
query.save().then(function () {
self.toggleProperty('tabUpdated');
defer.resolve(updatedModel.get('id'));
+
+ self.get('settings').parseQuerySettings(false);
+ query.set('blockSettingsParser', false);
}, function (err) {
defer.reject(err);
});
@@ -247,7 +254,7 @@ export default Ember.ArrayController.extend({
tab.set('type', constants.namingConventions.job);
tab.set('path', constants.namingConventions.subroutes.historyQuery);
- this.get('files').loadFile(job.get('queryFile')).then(function (file) {
+ this.get('fileService').loadFile(job.get('queryFile')).then(function (file) {
//replace old model representing file to reflect model update to job
if (self.keepOriginalQuery(jobId)) {
file.set('fileContent', oldQuery.get('fileContent'));
@@ -373,7 +380,7 @@ export default Ember.ArrayController.extend({
},
getColumnsForAutocomplete: function (tableName, callback) {
- this.get('databases').getAllColumns(tableName).then(function () {
+ this.get('databaseService').getAllColumns(tableName).then(function () {
callback();
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5cdafecf/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/query-tabs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/query-tabs.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/query-tabs.js
index 4c50c2e..7b6c222 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/query-tabs.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/query-tabs.js
@@ -20,10 +20,6 @@ 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),
-
tabClassNames : "fa queries-icon query-context-tab",
tabs: [
@@ -148,6 +144,15 @@ export default Ember.Controller.extend({
}
},
+ flashSettings: function() {
+ var settingsTab = this.get('tabs').findBy('id', 'settings-icon');
+ settingsTab.set('flash', true);
+
+ Ember.run.later(function() {
+ settingsTab.set('flash', false);
+ }, 1000);
+ },
+
actions: {
toggleOverlay: function (tab) {
if (tab !== this.get('default') && tab.get('active')) {