You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/02/24 17:32:01 UTC

[08/12] ambari git commit: AMBARI-9676. Initial Hive View Submission to Contrib (alexantonenko)

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/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
new file mode 100644
index 0000000..e838a3d
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/application.js
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import DS from 'ember-data';
+import constants from 'hive/utils/constants';
+
+export default DS.RESTAdapter.extend({
+  headers: {
+    "X-Requested-By": "ambari"
+  },
+
+  buildURL: function () {
+    var version = constants.adapter.version,
+        instanceName = constants.adapter.instance;
+
+    var params = window.location.pathname.split('/').filter(function (param) {
+      return !!param;
+    });
+
+    if (params[params.length - 3] === 'HIVE') {
+      version = params[params.length - 2];
+      instanceName = params[params.length - 1];
+    }
+
+    var prefix = constants.adapter.apiPrefix + version + constants.adapter.instancePrefix + instanceName;
+    var url = this._super.apply(this, arguments);
+    return prefix + url;
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/database.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/database.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/database.js
new file mode 100644
index 0000000..cdbd43b
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/database.js
@@ -0,0 +1,25 @@
+/**
+ * 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 application from './application';
+
+export default application.extend({
+  pathForType: function (type) {
+    return 'resources/ddl/' + type;
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/file.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/file.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/file.js
new file mode 100644
index 0000000..47894c1
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/adapters/file.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 application from './application';
+import constants from 'hive/utils/constants';
+
+export default application.extend({
+  pathForType: function (type) {
+    return constants.adapter.resourcePrefix + type;
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/app.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/app.js
new file mode 100644
index 0000000..f35a5a3
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/app.js
@@ -0,0 +1,34 @@
+/**
+ * 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 Resolver from 'ember/resolver';
+import loadInitializers from 'ember/load-initializers';
+import config from './config/environment';
+
+Ember.MODEL_FACTORY_INJECTIONS = true;
+
+var App = Ember.Application.extend({
+  modulePrefix: config.modulePrefix,
+  podModulePrefix: config.podModulePrefix,
+  Resolver: Resolver
+});
+
+loadInitializers(App, config.modulePrefix);
+
+export default App;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/.gitkeep b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/.gitkeep
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/alert-message-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/alert-message-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/alert-message-widget.js
new file mode 100644
index 0000000..fd8c1d7
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/alert-message-widget.js
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  click: function () {
+    this.toggleProperty('message.isExpanded');
+
+    if (!this.get('message.isExpanded')) {
+      this.sendAction('removeLater', this.get('message'));
+    }
+  },
+
+  actions: {
+    remove: function () {
+      this.sendAction('removeMessage', this.get('message'));
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/collapsible-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/collapsible-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/collapsible-widget.js
new file mode 100644
index 0000000..4425b59
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/collapsible-widget.js
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  tagName: 'collapsible',
+
+  actions: {
+    toggle: function () {
+      this.toggleProperty('isExpanded');
+
+      if (this.get('isExpanded')) {
+        this.sendAction('expanded', this.get('heading'), this.get('toggledParam'));
+      }
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/column-filter-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/column-filter-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/column-filter-widget.js
new file mode 100644
index 0000000..2622d4b
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/column-filter-widget.js
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  tagName: 'column-filter',
+
+  didInsertElement: function () {
+    if (this.get('filterValue')) {
+      this.send('sendFilter');
+    }
+  },
+
+  isSorted: (function() {
+    var sortProperties = this.get('sortProperties');
+
+    if (sortProperties) {
+      return sortProperties[0] === this.get('column.property');
+    } else {
+      return false;
+    }
+  }).property('sortProperties'),
+
+  actions: {
+    sendSort: function () {
+      this.sendAction('columnSorted', this.get('column.property'));
+    },
+
+    sendFilter: function (params) {
+      if (params) {
+        this.set('filterValue', Ember.Object.create({
+          min: params.from,
+          max: params.to
+        }));
+      }
+
+      this.sendAction('columnFiltered', this.get('column.property'), this.get('filterValue'));
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/date-range-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/date-range-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/date-range-widget.js
new file mode 100644
index 0000000..790cb35
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/date-range-widget.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.
+ */
+
+ /* globals moment */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  displayFromDate: function () {
+    return moment(this.get('dateRange.from')).format('MM/DD/YYYY');
+  }.property('dateRange.from'),
+
+  displayToDate: function () {
+    return moment(this.get('dateRange.to')).format('MM/DD/YYYY');
+  }.property('dateRange.to'),
+
+  didInsertElement: function () {
+    var self = this;
+
+    if (!this.get('dateRange.min') && !this.get('dateRange.max')) {
+      this.set('dateRange.max', new Date());
+    }
+
+    if (!this.get('dateRange.from') && !this.get('dateRange.to')) {
+      this.set('dateRange.from', this.get('dateRange.min'));
+      this.set('dateRange.to', this.get('dateRange.max'));
+    }
+
+    this.$(".fromDate").datepicker({
+      defaultDate: this.get("dateRange.from"),
+      onSelect: function (selectedDate) {
+        self.$(".toDate").datepicker("option", "minDate", selectedDate);
+        self.set('dateRange.from', new Date(selectedDate));
+        self.sendAction('rangeChanged', self.get('dateRange'));
+      }
+    });
+
+    this.$(".toDate").datepicker({
+      defaultDate: this.get('dateRange.to'),
+      onSelect: function (selectedDate) {
+        self.$(".fromDate").datepicker("option", "maxDate", selectedDate);
+        self.set('dateRange.to', new Date(selectedDate + " 23:59"));
+        self.sendAction('rangeChanged', self.get('dateRange'));
+      }
+    });
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/expander-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/expander-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/expander-widget.js
new file mode 100644
index 0000000..d46a490
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/expander-widget.js
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  tagName: 'expander',
+
+  actions: {
+    toggle: function () {
+      this.toggleProperty('isExpanded');
+      this.$('.accordion-body').toggle(200);
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/extended-input.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/extended-input.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/extended-input.js
new file mode 100644
index 0000000..ee2161c
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/extended-input.js
@@ -0,0 +1,50 @@
+/**
+ * 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.TextField.extend(Ember.I18n.TranslateableProperties, {
+  didInsertElement: function () {
+    var dynamicValue = this.get('dynamicValue');
+    var dynamicContext = this.get('dynamicContext');
+
+    if (dynamicValue && dynamicContext) {
+      this.set('value', dynamicContext.get(dynamicValue));
+    }
+  },
+
+  sendValueChanged: function () {
+    var dynamicValue = this.get('dynamicValue');
+    var dynamicContext = this.get('dynamicContext');
+
+    if (dynamicValue && dynamicContext) {
+      dynamicContext.set(dynamicValue, this.get('value'));
+    }
+
+    this.sendAction('valueChanged');
+  },
+
+  keyUp: function (e) {
+    //if user has pressed enter
+    if (e.keyCode === 13) {
+      this.sendAction('valueSearched', this.get('value'));
+    } else {
+      Ember.run.debounce(this, this.get('sendValueChanged'), 300);
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/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
new file mode 100644
index 0000000..b9179bb
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/modal-widget.js
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend(Ember.I18n.TranslateableProperties, {
+  show: function() {
+    this.$('.modal').modal().on('hidden.bs.modal', function () {
+      this.sendAction('close');
+    }.bind(this));
+  }.on('didInsertElement'),
+
+  actions: {
+    ok: function () {
+      this.$('.modal').modal('hide');
+      this.sendAction('ok');
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js
new file mode 100644
index 0000000..4b723b1
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/no-bubbling.js
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  didInsertElement: function () {
+    var self = this;
+
+    this.$().click(function (e) {
+      e.stopPropagation();
+
+      self.sendAction('click', self.get('data'));
+    });
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
new file mode 100644
index 0000000..ad98beb
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/number-range-widget.js
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  didInsertElement: function () {
+    var self = this;
+
+    var slider;
+
+    this.$(function() {
+      if (!self.get('numberRange.from') && !self.get('numberRange.to')) {
+        self.get('numberRange').set('from', self.get('numberRange.min'));
+        self.get('numberRange').set('to', self.get('numberRange.max'));
+      }
+
+      slider = self.$( ".slider" ).slider({
+        range: true,
+        min: self.get('numberRange.min'),
+        max: self.get('numberRange.max'),
+        units: self.get('numberRange.units'),
+        values: [ self.get('numberRange.from'), self.get('numberRange.to') ],
+        slide: function (event, ui) {
+          self.set('numberRange.from', ui.values[0]);
+          self.set('numberRange.to', ui.values[1]);
+        },
+
+        change: function () {
+          self.sendAction('rangeChanged', self.get('numberRange'));
+        }
+      });
+    });
+
+    this.set('slider', slider);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js
new file mode 100644
index 0000000..1f41a43
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/panel-widget.js
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend(Ember.I18n.TranslateableProperties, {
+  tagName: 'panel',
+
+  actions: {
+    sendMenuItemAction: function(action) {
+      this.set('menuItemAction', action);
+      this.sendAction('menuItemAction');
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js
new file mode 100644
index 0000000..e1bd4c5
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/popover-widget.js
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend(Ember.I18n.TranslateableProperties, {
+  tagName: 'popover',
+  attributeBindings: ['title', 'content:data-content'],
+  didInsertElement: function() {
+    this.$().popover({
+      html: true,
+      placement: 'left',
+      trigger: 'hover'
+    });
+
+    this.$().attr('data-content', this.$('.hide').html());
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js
new file mode 100644
index 0000000..2a86ee7
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/progress-widget.js
@@ -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.
+ */
+
+// this component is a work in progress
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  formattedStages: Ember.ArrayProxy.create({ content: [] }),
+
+  formatStages: function() {
+    var formattedStages = this.get('formattedStages');
+    var stages = this.get('stages');
+    var currentStage;
+
+    stages.forEach(function(stage) {
+      currentStage = formattedStages.findBy('name', stage.get('name'));
+
+      if(currentStage) {
+        currentStage.set('progress', 'width: %@%'.fmt(stage.get('value')))
+      } else {
+        formattedStages.pushObject(Ember.Object.create({
+          name: stage.get('name'),
+          className: stage.get('className'),
+          progress: 'width: %@%'.fmt(stage.get('value'))
+        }));
+      }
+    });
+  }.observes('stages.@each.value').on('init')
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
new file mode 100644
index 0000000..01ba37e
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/query-editor.js
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* global CodeMirror */
+
+/**
+/* Copyright (C) 2014 by Marijn Haverbeke <ma...@gmail.com> and others
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shal l be included in
+ * all copies or substantial portions of the Software.
+*/
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  tagName: 'query-editor',
+
+  tablesChanged: function () {
+    //Format hintOptions object as needed by the CodeMirror
+    //http://stackoverflow.com/questions/20023381/codemirror-how-add-tables-to-sql-hint
+    this.set('editor.options.hintOptions', { tables: this.get('tables') });
+  }.observes('tables'),
+
+  getColumnsHint: function (cm, tableName) {
+    var callback = function () {
+      CodeMirror.showHint(cm);
+    };
+
+    this.sendAction('columnsNeeded', tableName, callback);
+  },
+
+  initEditor: function () {
+    var editor,
+        updateSize,
+        self = this;
+
+    updateSize = function () {
+      editor.setSize(self.$(this).width(), self.$(this).height());
+      editor.refresh();
+    };
+
+    this.set('editor', CodeMirror.fromTextArea(document.getElementById('code-mirror'), {
+      mode: 'text/x-hive',
+      hint: CodeMirror.hint.sql,
+      indentWithTabs: true,
+      smartIndent: true,
+      lineNumbers: true,
+      matchBrackets : true,
+      autofocus: true,
+      extraKeys: {'Ctrl-Space': 'autocomplete'}
+    }));
+
+    CodeMirror.commands.autocomplete = function (cm) {
+      var lastWord = cm.getValue().split(' ').pop();
+
+      //if user wants to fill in a column
+      if (lastWord.indexOf('.') > -1) {
+        lastWord = lastWord.split('.')[0];
+
+        self.getColumnsHint(cm, lastWord);
+      } else {
+        CodeMirror.showHint(cm);
+      }
+    };
+
+    editor = this.get('editor');
+
+    editor.on('cursorActivity', function() {
+      self.set('highlightedText', editor.getSelections());
+    });
+
+    editor.setValue(this.get('query') || '');
+
+    editor.on('change', function (instance) {
+      Ember.run(function() {
+        self.set('query', instance.getValue());
+      });
+    });
+
+    this.$('.CodeMirror').resizable({
+      handles: 's',
+
+      resize: function () {
+        Ember.run.debounce(this, updateSize, 150);
+      }
+    }).find('.ui-resizable-s').addClass('grip fa fa-reorder');
+
+    this.tablesChanged();
+  }.on('didInsertElement'),
+
+  updateValue: function() {
+    var query = this.get('query');
+    var editor = this.get('editor');
+
+    if (editor.getValue() !== query) {
+      editor.setValue(query || '');
+    }
+  }.observes('query')
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js
new file mode 100644
index 0000000..8bd7a22
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/select-widget.js
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend(Ember.I18n.TranslateableProperties, {
+  tagName: 'dropdown',
+
+  selectedLabel: function () {
+    var value;
+
+    //if there's an item selected, retrieve the property to be displayed as a label
+    if (this.get('selectedValue') && this.get('labelPath')) {
+      value = this.get('selectedValue').get(this.get('labelPath'));
+
+      if (value) {
+        return value;
+      }
+    }
+
+    //else if a default label has been provided, use it as the selected label.
+    if (this.get('defaultLabel')) {
+      return this.get('defaultLabel');
+    }
+  }.property('selectedValue'),
+
+  didInsertElement: function () {
+    //if no selected item nor defaultLabel, set the selected value
+    if (!this.get('selectedValue') && !this.get('defaultLabel') && this.get('items')) {
+      this.set('selectedValue', this.get('items').objectAt(0));
+    }
+  },
+
+  actions: {
+    select: function (item){
+      this.set('selectedValue', item);
+    },
+
+    add: function () {
+      this.sendAction('itemAdded');
+    },
+
+    edit: function (item) {
+      this.sendAction('itemEdited', item);
+    },
+
+    remove: function (item) {
+      this.sendAction('itemRemoved', item);
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js
new file mode 100644
index 0000000..2a898f5
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tabs-widget.js
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  tagName: 'tabs',
+
+  didInsertElement: function () {
+    var tabToActivate,
+        tabs = this.get('tabs');
+
+    if (tabs.get('length')) {
+      tabToActivate = tabs.find(function (tab) {
+        return tab.get('active');
+      });
+
+      if (tabToActivate) {
+        this.set('selectedTab', tabToActivate);
+      } else {
+        this.set('selectedTab', tabs.objectAt(0));
+      }
+    }
+  },
+
+  activateTab: function () {
+    var selectedTab = this.get('selectedTab');
+
+    selectedTab.set('active', true);
+
+    this.get('tabs').without(selectedTab).forEach(function (tab) {
+      tab.set('active', false);
+    });
+  }.observes('selectedTab'),
+
+  removeEnabled: function () {
+    return this.get('canRemove') && this.get('tabs.length') > 1;
+  }.property('tabs.@each'),
+
+  actions: {
+    remove: function (tab) {
+      this.sendAction('removeClicked', tab);
+    },
+
+    selectTab: function (tab) {
+      this.set('selectedTab', tab);
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js
new file mode 100644
index 0000000..cd63f52
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/tree-view.js
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  tagName: 'tree-view'
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js
new file mode 100644
index 0000000..8226c9c
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/components/typeahead-widget.js
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Typeahead from 'ember-cli-selectize/components/ember-selectize';
+import Ember from 'ember';
+
+export default Typeahead.extend({
+  didInsertElement: function() {
+    this._super();
+
+    if(!this.get('selection') && this.get('content.firstObject')) {
+      this.set('selection', this.get('content.firstObject'));
+    }
+
+    this.selectize.on('dropdown_close', Ember.$.proxy(this.onClose, this));
+  },
+
+  onClose: function() {
+    if(!this.get('selection') && this.get('prevSelection')) {
+      this.set('selection', this.get('prevSelection'));
+    }
+  },
+
+  _onItemAdd: function(value) {
+    this._super(value);
+
+    this.set('prevSelection', this.get('selection'));
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/.gitkeep b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/.gitkeep
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/alerts.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/alerts.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/alerts.js
new file mode 100644
index 0000000..be70566
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/alerts.js
@@ -0,0 +1,47 @@
+/**
+ * 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({
+  pushObject: function (object) {
+    object.typeClass = 'alert-' + object.type;
+    this._super(object);
+    this.removeLater(object);
+  },
+
+  removeLater: function (object) {
+    var self = this;
+
+    Ember.run.later(function() {
+      if (!object.isExpanded) {
+        self.removeObject(object);
+      }
+    }, 5000);
+  },
+
+  actions: {
+    remove: function (message) {
+      this.removeObject(message);
+    },
+
+    removeLater: function (message) {
+      this.removeLater(message);
+    }
+  }
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/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
new file mode 100644
index 0000000..38d1b95
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/columns.js
@@ -0,0 +1,104 @@
+/**
+ * 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/f5482d89/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
new file mode 100644
index 0000000..6a259ba
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js
@@ -0,0 +1,354 @@
+/**
+ * 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({
+  pageCount: 10,
+
+  needs: [ constants.namingConventions.tables,
+           constants.namingConventions.columns,
+           constants.namingConventions.openQueries ],
+
+  openQueries: Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
+  dbTables: Ember.computed.alias('controllers.' + constants.namingConventions.tables),
+  dbColumns: Ember.computed.alias('controllers.' + constants.namingConventions.columns),
+
+  _handleTablesError: function (err) {
+    this.send('addAlert', constants.alerts.error, err.responseText, "alerts.errors.get.tables");
+    this.set('isLoading', false);
+  },
+
+  _handleColumnsError: function (err) {
+    this.send('addAlert', constants.alerts.error, err.responseText, "alerts.errors.get.columns");
+    this.set('isLoading', false);
+  },
+
+  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
+      })
+    ])}));
+  },
+
+  setTablePageAvailability: function (database) {
+    var result;
+
+    if (database.get('hasNext')) {
+      result = true;
+    } else if (database.tables.length > database.get('visibleTables.length')) {
+      //if there are hidden tables
+      result = true;
+    }
+
+    database.set('canGetNextPage', result);
+  },
+
+  setColumnPageAvailability: function (table) {
+    var result;
+
+    if (table.get('hasNext')) {
+      result = true;
+    } else if (table.columns.length > table.get('visibleColumns.length')) {
+      //if there are hidden columns
+      result = true;
+    }
+
+    table.set('canGetNextPage', result);
+  },
+
+  selectedDatabaseChanged: function () {
+    var self = this,
+        database = this.get('selectedDatabase');
+
+    //if no selected database or database has already fully loaded tables
+    if (!database || (database.tables && !database.get('hasNext'))) {
+      return;
+    }
+
+    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);
+      self.set('isLoading', false);
+    }, function (err) {
+      self._handleTablesError(err);
+    });
+  }.observes('selectedDatabase'),
+
+  getNextColumnPage: function (database, table) {
+    var self = this;
+
+    this.set('isLoading', true);
+
+    if (!table.columns) {
+      table.columns = [];
+      table.set('visibleColumns', []);
+    }
+
+    this.get('dbColumns').getColumnsPage(database.get('name'), table).then(function (result) {
+      table.columns.pushObjects(result.columns);
+      table.get('visibleColumns').pushObjects(result.columns);
+      table.set('hasNext', result.hasNext);
+
+      self.setColumnPageAvailability(table);
+      self.set('isLoading', false);
+    }, function (err) {
+      self._handleColumnsError(err);
+    });
+  },
+
+  getNextTablePage: function (database) {
+    var self = this;
+
+    this.set('isLoading', true);
+
+    if (!database.tables) {
+      database.tables = [];
+      database.set('visibleTables', []);
+    }
+
+    this.get('dbTables').getTablesPage(database).then(function (result) {
+      database.tables.pushObjects(result.tables);
+      database.get('visibleTables').pushObjects(result.tables);
+      database.set('hasNext', result.hasNext);
+
+      self.setTablePageAvailability(database);
+      self.set('isLoading', false);
+    }, function (err) {
+      self._handleTablesError(err);
+    });
+  },
+
+  getAllColumns: function (tableName) {
+    var defer = Ember.RSVP.defer();
+    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.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);
+
+        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;
+  },
+
+  actions: {
+    getTables: function (dbName) {
+      var database = this.findBy('name', dbName),
+          tables = database.tables,
+          pageCount = this.get('pageCount');
+
+      if (!tables) {
+        this.getNextTablePage(database);
+      } else {
+        database.set('visibleTables', tables.slice(0, pageCount));
+        this.setTablePageAvailability(database);
+      }
+    },
+
+    getColumns: function (tableName, database) {
+      var table = database.get('visibleTables').findBy('name', tableName),
+          pageCount = this.get('pageCount'),
+          columns = table.columns;
+
+      if (!columns) {
+        this.getNextColumnPage(database, table);
+      } else {
+        table.set('visibleColumns', columns.slice(0, pageCount));
+        this.setColumnPageAvailability(table);
+      }
+    },
+
+    showMoreTables: function (database) {
+      var tables = database.tables,
+          visibleTables = database.get('visibleTables'),
+          visibleCount = visibleTables.length;
+
+      if (!tables) {
+        this.getNextTablePage(database);
+      } else {
+        if (tables.length > visibleCount) {
+          visibleTables.pushObjects(tables.slice(visibleCount, visibleCount + this.get('pageCount')));
+          this.setTablePageAvailability(database);
+        } else {
+          this.getNextTablePage(database);
+        }
+      }
+    },
+
+    showMoreColumns: function (table, database) {
+      var columns = table.columns,
+          visibleColumns = table.get('visibleColumns'),
+          visibleCount = visibleColumns.length;
+
+      if (!columns) {
+        this.getNextColumnPage(database, table);
+      } else {
+        if (columns.length > visibleCount) {
+          visibleColumns.pushObjects(columns.slice(visibleCount, visibleCount + this.get('pageCount')));
+          this.setColumnPageAvailability(table);
+        } else {
+          this.getNextColumnPage(database, table);
+        }
+      }
+    },
+
+    searchTables: function (searchTerm) {
+      var self = this,
+          resultsTab = this.get('tabs').findBy('view', constants.namingConventions.databaseSearch),
+          tableSearchResults = this.get('tableSearchResults');
+
+      resultsTab.set('visible', true);
+      this.set('selectedTab', resultsTab);
+      this.set('columnSearchTerm', '');
+      this.set('isLoading', true);
+
+      this.get('dbTables').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);
+      });
+    },
+
+    searchColumns: function (searchTerm) {
+      var self = this,
+          database = this.get('selectedDatabase'),
+          resultsTab = this.get('tabs').findBy('view', constants.namingConventions.databaseSearch),
+          tables = this.get('tableSearchResults.tables');
+
+      this.set('selectedTab', resultsTab);
+
+      this.set('isLoading', true);
+
+      tables.forEach(function (table) {
+        self.get('dbColumns').getColumnsPage(database.get('name'), table, searchTerm, true).then(function (result) {
+          table.set('columns', result.columns);
+          table.set('hasNext', result.hasNext);
+
+          if (tables.indexOf(table) === tables.get('length') -1) {
+            self.set('isLoading', false);
+          }
+        }, function (err) {
+          self._handleColumnsError(err);
+        });
+      });
+    },
+
+    showMoreResultTables: function () {
+      var self = this,
+          database = this.get('selectedDatabase'),
+          tableSearchResults = this.get('tableSearchResults'),
+          searchTerm = this.get('tableSearchTerm');
+
+      this.set('isLoading', true);
+
+      this.get('dbTables').getTablesPage(database, searchTerm).then(function (tablesResult) {
+        var tables = tableSearchResults.get('tables');
+        var shouldGetColumns = tables.any(function (table) {
+          return table.get('columns.length') > 0;
+        });
+
+        tables.pushObjects(tablesResult.tables);
+        tableSearchResults.set('hasNext', tablesResult.hasNext);
+
+        //if user has already searched for columns for the previously loaded tables,
+        //load the columns search results for the newly loaded tables.
+        if (shouldGetColumns) {
+          tablesResult.tables.forEach(function (table) {
+            self.get('dbColumns').getColumnsPage(database.get('name'), table, self.get('columnSearchTerm'), true).then(function (result) {
+              table.set('columns', result.columns);
+              table.set('hasNext', result.hasNext);
+
+              if (tablesResult.tables.indexOf(table) === tablesResult.tables.get('length') -1) {
+                self.set('isLoading', false);
+              }
+            }, function (err) {
+              self._handleColumnsError(err);
+            });
+          });
+        } else {
+          self.set('isLoading', false);
+        }
+      }, function (err) {
+        self._handleTablesError(err);
+      });
+    },
+
+    showMoreResultColumns: function (table) {
+      var self = this;
+
+      this.set('isLoading', true);
+
+      this.get('dbColumns').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);
+      });
+    }
+  }
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/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
new file mode 100644
index 0000000..578fa67
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/file-resources.js
@@ -0,0 +1,22 @@
+/**
+ * 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/f5482d89/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
new file mode 100644
index 0000000..157b917
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/history.js
@@ -0,0 +1,148 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import FilterableMixin from 'hive/mixins/filterable';
+import constants from 'hive/utils/constants';
+
+export default Ember.ArrayController.extend(FilterableMixin, {
+  itemController: constants.namingConventions.job,
+
+  sortAscending: true,
+  sortProperties: ['dateSubmitted'],
+
+  init: function () {
+    var oneMonthAgo = new Date();
+    oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
+
+    this._super();
+
+    this.set('columns', Ember.ArrayProxy.create({ content: Ember.A([
+      Ember.Object.create({
+        caption: 'columns.title',
+        property: 'title',
+        link: constants.namingConventions.subroutes.historyQuery
+      }),
+      Ember.Object.create({
+        caption: 'columns.status',
+        property: 'status',
+        classBinding: 'status'
+      }),
+      Ember.Object.create({
+        caption: 'columns.date',
+        property: 'dateSubmitted',
+        dateRange: Ember.Object.create({
+          min: oneMonthAgo,
+          max: new Date()
+        })
+      }),
+      Ember.Object.create({
+        caption: 'columns.duration',
+        property: 'duration',
+        numberRange: Ember.Object.create({
+          min: 0,
+          max: 10,
+          units: 'sec'
+        })
+      })
+    ])}));
+  },
+
+  model: function () {
+    return this.filter(this.get('history'));
+  }.property('history', 'filters.@each'),
+
+  updateIntervals: function () {
+    var durationColumn;
+    var maxDuration;
+    var minDuration;
+
+    if (this.get('columns')) {
+      durationColumn = this.get('columns').find(function (column) {
+        return column.get('caption') === 'columns.duration';
+      });
+
+      minDuration = Math.min.apply(Math, 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'));
+      }));
+
+      durationColumn.set('numberRange.min', minDuration);
+      durationColumn.set('numberRange.max', maxDuration);
+    }
+  }.observes('history'),
+
+  updateDateRange: function () {
+    var dateColumn;
+    var maxDate;
+    var minDate;
+
+    if (this.get('columns')) {
+      dateColumn = this.get('columns').find(function (column) {
+        return column.get('caption') === 'columns.date';
+      });
+
+      minDate = Math.min.apply(Math, 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'));
+      }));
+
+      dateColumn.set('dateRange.min', minDate);
+      dateColumn.set('dateRange.max', maxDate);
+    }
+  }.observes('history'),
+
+  filterBy: function (filterProperty, filterValue, exactMatch) {
+    var column = this.get('columns').find(function (column) {
+      return column.get('property') === filterProperty;
+    });
+
+    if (column) {
+      column.set('filterValue', filterValue, exactMatch);
+    } else {
+      this.updateFilters(filterProperty, filterValue, exactMatch);
+    }
+  },
+
+  actions: {
+    sort: function (property) {
+      //if same column has been selected, toggle flag, else default it to true
+      if (this.get('sortProperties').objectAt(0) === property) {
+        this.set('sortAscending', !this.get('sortAscending'));
+      } else {
+        this.set('sortAscending', true);
+        this.set('sortProperties', [ property ]);
+      }
+    },
+
+    interruptJob: function (job) {
+      var self = this,
+          id = job.get('id');
+
+      job.destroyRecord().then(function () {
+        self.store.find(constants.namingConventions.job, id);
+      });
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5482d89/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
new file mode 100644
index 0000000..6f93b11
--- /dev/null
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/index.js
@@ -0,0 +1,475 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+import constants from 'hive/utils/constants';
+
+export default Ember.Controller.extend({
+  needs: [ constants.namingConventions.openQueries,
+           constants.namingConventions.databases,
+           constants.namingConventions.udfs,
+           constants.namingConventions.jobLogs,
+           constants.namingConventions.jobResults,
+           constants.namingConventions.jobExplain,
+           constants.namingConventions.settings
+  ],
+
+  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),
+  explain: Ember.computed.alias('controllers.' + constants.namingConventions.jobExplain),
+  settings: Ember.computed.alias('controllers.' + constants.namingConventions.settings),
+
+  canExecute: function () {
+    var isModelRunning = this.get('model.isRunning');
+    var hasParams = this.get('queryParams.length');
+
+    if (isModelRunning) {
+      return false;
+    }
+
+    if (hasParams) {
+      // all param have values?
+      return this.get('queryParams').every(function (param) { return param.value; });
+    }
+
+    return true;
+  }.property('model.isRunning', 'queryParams.@each.value'),
+
+  parseQueryParams: function () {
+    var query = this.get('openQueries.currentQuery.fileContent'),
+        param,
+        updatedParams = [],
+        currentParams = this.get('queryParams'),
+        paramRegExp = /\$\w+/ig,
+        paramNames = query.match(paramRegExp) || [];
+
+    paramNames = paramNames.uniq();
+
+    paramNames.forEach(function (name) {
+      param = currentParams.findBy('name', name);
+      if (param) {
+        updatedParams.push(param);
+      } else {
+        updatedParams.push({ name: name, value: "" });
+      }
+    });
+
+    currentParams.setObjects(updatedParams);
+  }.observes('openQueries.currentQuery.fileContent'),
+
+  _executeQuery: function (shouldExplain) {
+    var queryId,
+        self = this,
+        query,
+        finalQuery,
+        job,
+        originalModel = this.get('model');
+
+    job = this.store.createRecord(constants.namingConventions.job, {
+      title: originalModel.get('title'),
+      dataBase: this.get('databases.selectedDatabase.name')
+    });
+
+    originalModel.set('isRunning', true);
+
+     //if it's a saved query / history entry set the queryId
+    if (!originalModel.get('isNew')) {
+      queryId = originalModel.get('constructor.typeKey') === constants.namingConventions.job ?
+                originalModel.get('queryId') :
+                originalModel.get('id');
+
+      job.set('queryId', queryId);
+    }
+
+    query = this.get('openQueries').getQueryForModel(originalModel);
+
+    finalQuery = this.buildQuery(query, shouldExplain);
+    finalQuery = this.bindQueryParams(finalQuery);
+    finalQuery = this.prependQuerySettings(finalQuery);
+
+    job.set('forcedContent', finalQuery);
+
+    return this.saveQuery(job, originalModel);
+  },
+
+  saveQuery: function (job, originalModel) {
+    var defer = Ember.RSVP.defer(),
+        self = this,
+        openQueries = this.get('openQueries');
+
+    var handleError = function (err) {
+      originalModel.set('isRunning', undefined);
+      defer.reject(err);
+    };
+
+    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 () {
+        //reset flag on the original model
+        originalModel.set('isRunning', undefined);
+
+        defer.resolve(job);
+      }, function (err) {
+        handleError(err);
+      });
+
+      self.get('settings').updateSettingsId(originalModel.get('id'), job.get('id'));
+    }, function (err) {
+      handleError(err);
+    });
+
+    return defer.promise;
+  },
+
+  prependQuerySettings: function (query) {
+    var settings = this.get('settings').getSettingsString();
+
+    if (settings.length) {
+      return settings + "\n\n" + query;
+    }
+
+    return query;
+  },
+
+  buildQuery: function (query, shouldExplain) {
+    var selections = this.get('openQueries.highlightedText'),
+        isQuerySelected = selections && selections[0] !== "",
+        queryComponents = this.extractComponents(query.get('fileContent')),
+        finalQuery = '',
+        queries;
+
+    if (isQuerySelected) {
+      queries = selections.map(function (s) {
+        return s.replace(";", "");
+      });
+    } else {
+      queries = queryComponents.queryString.split(';');
+      queries = queries.filter(Boolean);
+    }
+
+    queries = queries.map(function (query) {
+      var explainIndex = query.indexOf(constants.namingConventions.explainPrefix);
+
+      if (shouldExplain) {
+        if (query.indexOf(constants.namingConventions.explainPrefix) === -1) {
+          return constants.namingConventions.explainPrefix + query;
+        }
+
+        return query;
+      } else {
+        if (query.indexOf(constants.namingConventions.explainPrefix) > -1) {
+          return query.replace(constants.namingConventions.explainPrefix, '');
+        }
+
+        return query;
+      }
+    });
+
+    if (queryComponents.files.length) {
+      finalQuery += queryComponents.files.join("\n") + "\n\n";
+    }
+
+    if (queryComponents.udfs.length) {
+      finalQuery += queryComponents.udfs.join("\n") + "\n\n";
+    }
+
+    finalQuery += queries.join(";");
+    return finalQuery;
+  },
+
+  bindQueryParams: function (query) {
+    var params = this.get('queryParams');
+
+    if (!params.get('length')) {
+      return query;
+    }
+
+    params.forEach(function (param) {
+      query = query.split(param.name).join(param.value);
+    });
+
+    return query;
+  },
+
+  init: function () {
+    this._super();
+
+    // initialize queryParams with an empty array
+    this.set('queryParams', Ember.ArrayProxy.create({ content: Ember.A([]) }))
+
+    this.set('queryProcessTabs', Ember.ArrayProxy.create({ content: Ember.A([
+      Ember.Object.create({
+        name: Ember.I18n.t('menus.logs'),
+        path: constants.namingConventions.subroutes.jobLogs
+      }),
+      Ember.Object.create({
+        name: Ember.I18n.t('menus.results'),
+        path: constants.namingConventions.subroutes.jobResults
+      }),
+      Ember.Object.create({
+        name: Ember.I18n.t('menus.explain'),
+        path: constants.namingConventions.subroutes.jobExplain
+      })
+    ])}));
+  },
+
+  displayJobTabs: function () {
+    return this.get('content.constructor.typeKey') === constants.namingConventions.job;
+  }.property('content'),
+
+  modelChanged: function () {
+    var self = this;
+    var content = this.get('content');
+    var openQueries = this.get('openQueries');
+
+    //update open queries list when current query model changes
+    openQueries.update(content).then(function (isExplainedQuery) {
+      var newId = content.get('id');
+      var tab = openQueries.getTabForModel(content);
+
+      if (content.get('constructor.typeKey') === constants.namingConventions.job) {
+        self.get('queryProcessTabs').forEach(function (queryTab) {
+          queryTab.set('id', newId);
+        });
+
+        if (isExplainedQuery) {
+          self.set('explain.content', content);
+        } else {
+          self.set('logs.content', content);
+          self.set('results.content', content);
+        }
+
+        self.setExplainVisibility(isExplainedQuery);
+
+        self.transitionToRoute(tab.get('subroute'));
+      }
+    });
+  }.observes('content'),
+
+  csvUrl: function () {
+    if (this.get('content.constructor.typeKey') !== constants.namingConventions.job) {
+      return;
+    }
+
+    if (this.get('content.status') !== constants.statuses.finished) {
+      return;
+    }
+
+    var url = this.container.lookup('adapter:application').buildURL();
+    url += '/' + constants.namingConventions.jobs + '/' + this.get('content.id');
+    url += '/results/csv';
+
+    return url;
+  }.property('content'),
+
+  downloadMenu: function () {
+    var items = [];
+    var tabs = this.get('queryProcessTabs');
+    var isResultsTabVisible = tabs.findBy('path', constants.namingConventions.subroutes.jobResults).get('visible');
+
+    if (this.get('content.status') === constants.statuses.finished && isResultsTabVisible) {
+      items.push({
+        title: Ember.I18n.t('buttons.saveHdfs'),
+        action: 'saveToHDFS'
+      });
+
+      if (this.get('csvUrl')) {
+        items.push(
+          Ember.Object.create({
+            title: Ember.I18n.t('buttons.saveCsv'),
+            href: this.get('csvUrl')
+          })
+        );
+      }
+    }
+
+    return items.length ? items : null;
+  }.property('content.status', 'queryProcessTabs.@each.visible'),
+
+  extractComponents: function (queryString) {
+    var components = {};
+
+    var udfRegEx = new RegExp("(" + constants.namingConventions.udfInsertPrefix + ").+", "ig");
+    var fileRegEx = new RegExp("(" + constants.namingConventions.fileInsertPrefix + ").+", "ig");
+
+    components.udfs         = queryString.match(udfRegEx) || [];
+    components.files        = queryString.match(fileRegEx) || [];
+    components.queryString  = queryString.replace(udfRegEx, "").replace(fileRegEx, "").trim();
+
+    return components;
+  },
+
+  saveToHDFS: function () {
+    var job = this.get('content');
+
+    if (job.get('status') !== constants.statuses.finished) {
+      return;
+    }
+
+    var self = this;
+
+    var file = "/tmp/" + job.get('id') + ".csv";
+    var url = this.container.lookup('adapter:application').buildURL();
+    url +=  "/jobs/" + job.get('id') + "/results/csv/saveToHDFS";
+
+    Ember.$.getJSON(url, {
+        commence: true,
+        file: file
+    }).then(function (response) {
+      self.pollSaveToHDFS(response);
+    }, function (response) {
+      self.send('addAlert', constants.alerts.error, response.message, "alerts.errors.save.results");
+    });
+  },
+
+  pollSaveToHDFS: function (data) {
+    var self = this;
+    var url = this.container.lookup('adapter:application').buildURL();
+    url += "/jobs/" + data.jobId + "/results/csv/saveToHDFS";
+
+    Ember.run.later(function () {
+      Ember.$.getJSON(url).then(function (response) {
+        if (response.status !== constants.results.statuses.terminated) {
+          self.pollSaveToHDFS(response);
+        } else {
+          self.set('content.isRunning', false);
+        }
+      }, function (response) {
+        self.send('addAlert', constants.alerts.error, response.message, "alerts.errors.save.results");
+      });
+    }, 2000);
+  },
+
+  setExplainVisibility: function (show) {
+    var tabs = this.get('queryProcessTabs');
+
+    tabs.findBy('path', constants.namingConventions.subroutes.jobExplain).set('visible', show);
+    tabs.findBy('path', constants.namingConventions.subroutes.jobLogs).set('visible', !show);
+    tabs.findBy('path', constants.namingConventions.subroutes.jobResults).set('visible', !show);
+  },
+
+  actions: {
+    saveToHDFS: function () {
+      this.set('content.isRunning', true);
+      this.saveToHDFS();
+    },
+
+    insertUdf: function (item) {
+      var query = this.get('openQueries').getQueryForModel(this.get('model'));
+
+      var queryString = query.get('fileContent');
+
+      var newUdf = constants.namingConventions.udfInsertPrefix + item.get('name') + " as '" + item.get('classname') + "';";
+      var newFileResource = item.get('fileResource.path');
+
+      if (item.get('fileResource.path')) {
+        newFileResource = constants.namingConventions.fileInsertPrefix + item.get('fileResource.path') + ";";
+      }
+
+      var components = this.extractComponents(queryString);
+
+      if (!components.files.contains(newFileResource) && newFileResource) {
+        components.files.push(newFileResource);
+      }
+
+      if (!components.udfs.contains(newUdf)) {
+        components.udfs.push(newUdf);
+      }
+
+      var updatedContent = components.files.join("\n") + "\n\n";
+      updatedContent += components.udfs.join("\n") + "\n\n";
+      updatedContent += components.queryString;
+
+      query.set('fileContent', updatedContent);
+    },
+
+    addQuery: (function () {
+      var idCounter = 0;
+
+      return function () {
+        var model = this.store.createRecord(constants.namingConventions.savedQuery, {
+          dataBase: this.get('databases.selectedDatabase.name'),
+          title: 'New Query',
+          type: constants.namingConventions.savedQuery,
+          queryFile: '',
+          id: 'fixture_' + idCounter
+        });
+
+        idCounter++;
+
+        this.transitionToRoute(constants.namingConventions.subroutes.savedQuery, model);
+      };
+    }()),
+
+    saveQuery: function () {
+      var self = this,
+          wasNew = this.get('model.isNew'),
+          defer = Ember.RSVP.defer();
+
+      this.send('openModal', 'modal-save', {
+        heading: "modals.save.heading",
+        text: this.get('content.title'),
+        defer: defer
+      });
+
+      defer.promise.then(function (text) {
+        self.get('content').set('title', text);
+
+        self.get('openQueries').save(self.get('content')).then(function () {
+          if (wasNew) {
+            self.transitionToRoute(constants.namingConventions.subroutes.savedQuery, self.get('model.id'));
+          }
+        });
+      });
+    },
+
+    executeQuery: function () {
+      var self = this;
+      var subroute;
+
+      this._executeQuery().then(function (job) {
+        if (job.get('status') !== constants.statuses.finished) {
+          subroute = constants.namingConventions.subroutes.jobLogs;
+        } else {
+          subroute = constants.namingConventions.subroutes.jobResults;
+        }
+
+        self.get('openQueries').updateTabSubroute(job, subroute);
+
+        self.transitionToRoute(constants.namingConventions.subroutes.historyQuery, job.get('id'));
+      }, function (err) {
+        self.send('addAlert', constants.alerts.error, err.responseText, "alerts.errors.save.query");
+      });
+    },
+
+    explainQuery: function () {
+      var self = this;
+
+      this._executeQuery(true).then(function (job) {
+        self.get('openQueries').updateTabSubroute(job, constants.namingConventions.subroutes.jobExplain);
+
+        self.transitionToRoute(constants.namingConventions.subroutes.historyQuery, job.get('id'));
+      }, function (err) {
+        self.send('addAlert', constants.alerts.error, err.responseText, "alerts.errors.save.query");
+      });
+    }
+  }
+});