You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ni...@apache.org on 2017/01/03 11:43:12 UTC
[07/20] ambari git commit: AMBARI-19321 : Hive View 2.0 - Minimal
view for Hive which includes new UI changes. Also made changes in poms as
required (nitirajrathore)
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/helpers/to-json.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/helpers/to-json.js b/contrib/views/hive20/src/main/resources/ui/app/helpers/to-json.js
new file mode 100644
index 0000000..a5de322
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/helpers/to-json.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 Ember from 'ember';
+
+export function toJson([param, ...rest]/*, hash*/) {
+ return JSON.stringify(param, null, ' ');
+}
+
+export default Ember.Helper.helper(toJson);
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/index.html
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/index.html b/contrib/views/hive20/src/main/resources/ui/app/index.html
new file mode 100644
index 0000000..cc9141f
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/index.html
@@ -0,0 +1,43 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>Ui</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ {{content-for "head"}}
+
+ <link rel="stylesheet" href="assets/vendor.css">
+ <link rel="stylesheet" href="assets/ui.css">
+
+ {{content-for "head-footer"}}
+ </head>
+ <body>
+ {{content-for "body"}}
+
+ <script src="assets/vendor.js"></script>
+ <script src="assets/ui.js"></script>
+
+ {{content-for "body-footer"}}
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/initializers/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/initializers/.gitkeep b/contrib/views/hive20/src/main/resources/ui/app/initializers/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/initializers/responsive.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/initializers/responsive.js b/contrib/views/hive20/src/main/resources/ui/app/initializers/responsive.js
new file mode 100644
index 0000000..6e15f15
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/initializers/responsive.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 { initialize } from 'ember-responsive/initializers/responsive';
+
+/**
+ * Ember responsive initializer
+ *
+ * Supports auto injecting media service app-wide.
+ *
+ * Generated by the ember-responsive addon. Customize initialize to change
+ * injection.
+ */
+
+export default {
+ name: 'responsive',
+ initialize
+};
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/mixins/table-common.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/mixins/table-common.js b/contrib/views/hive20/src/main/resources/ui/app/mixins/table-common.js
new file mode 100644
index 0000000..4a2f517
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/mixins/table-common.js
@@ -0,0 +1,86 @@
+/**
+ * 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 Table from 'ember-light-table';
+
+const {
+ inject,
+ isEmpty
+ } = Ember;
+
+export default Ember.Mixin.create({
+ store: inject.service(),
+
+ page: 0,
+ limit: 10,
+ dir: 'asc',
+ sort: 'firstName',
+
+ isLoading: false,
+ canLoadMore: true,
+
+ model: null,
+ columns: null,
+ table: null,
+
+ init() {
+ this._super(...arguments);
+
+ let table = new Table(this.get('columns'), this.get('model'), { enableSync: true });
+ let sortColumn = table.get('allColumns').findBy('valuePath', this.get('sort'));
+
+ // Setup initial sort column
+ if (sortColumn) {
+ sortColumn.set('sorted', true);
+ }
+
+ this.set('table', table);
+ },
+
+ fetchRecords() {
+ this.set('isLoading', true);
+ this.get('store').query('user', this.getProperties(['page', 'limit', 'sort', 'dir'])).then((records) => {
+ this.get('model').pushObjects(records.toArray());
+ this.set('canLoadMore', !isEmpty(records));
+ }).finally(() => {
+ this.set('isLoading', false);
+ });
+ },
+
+ actions: {
+ onScrolledToBottom() {
+ if (this.get('canLoadMore')) {
+ this.incrementProperty('page');
+ this.fetchRecords();
+ }
+ },
+
+ onColumnClick(column) {
+ if (column.sorted) {
+ this.setProperties({
+ dir: column.ascending ? 'asc' : 'desc',
+ sort: column.get('valuePath'),
+ canLoadMore: true,
+ page: 0
+ });
+ this.get('model').clear();
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/.gitkeep b/contrib/views/hive20/src/main/resources/ui/app/models/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/alert.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/alert.js b/contrib/views/hive20/src/main/resources/ui/app/models/alert.js
new file mode 100644
index 0000000..f7d30a3
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/alert.js
@@ -0,0 +1,28 @@
+/**
+ * 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';
+
+export default DS.Model.extend({
+ type: DS.attr('string'),
+ message: DS.attr('string'),
+ responseMessage: DS.attr('string'),
+ status: DS.attr('number'),
+ trace: DS.attr('string'),
+ read: DS.attr('string', {defaultValue: false})
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/column.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/column.js b/contrib/views/hive20/src/main/resources/ui/app/models/column.js
new file mode 100644
index 0000000..b1fa99c
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/column.js
@@ -0,0 +1,107 @@
+/**
+ * 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 datatypes from '../configs/datatypes';
+import Helper from '../configs/helpers';
+
+export default Ember.Object.extend({
+ name: '',
+ type: datatypes[0],
+ precision: null,
+ scale: null,
+ isPartitioned: false,
+ isClustered: false,
+ comment: '',
+
+
+ hasError: Ember.computed('errors.@each', function() { return this.get('errors.length') !== 0; }),
+ errors: [],
+
+ nameError: Ember.computed('errors.@each', function() {
+ return this.get('errors').findBy('type', 'name');
+ }),
+
+ typeError: Ember.computed('errors.@each', function() {
+ return this.get('errors').findBy('type', 'type');
+ }),
+
+
+ precisionError: Ember.computed('errors.@each', function() {
+ return this.get('errors').findBy('type', 'precision');
+ }),
+
+ scaleError: Ember.computed('errors.@each', function() {
+ return this.get('errors').findBy('type', 'scale');
+ }),
+
+ partitionObserver: Ember.observer('isPartitioned', function() {
+ if(this.get('isPartitioned')) {
+ this.set('isClustered', false);
+ }
+ }),
+
+ clusteredObserver: Ember.observer('isClustered', function() {
+ if(this.get('isClustered')) {
+ this.set('isPartitioned', false);
+ }
+ }),
+
+
+ // Control the UI
+ editing: false,
+
+ clearError() {
+ this.set('errors', []);
+ },
+
+
+ validate() {
+ this.clearError();
+ if (Ember.isEmpty(this.get('name'))) {
+ this.get('errors').pushObject({type: 'name', error: "name cannot be empty"});
+ }
+
+ if(Ember.isEmpty(this.get('type'))) {
+ this.get('errors').pushObject({type: 'type', error: "Type cannot be empty"});
+ }
+
+ if(this.get('type.hasPrecision')) {
+ if(Ember.isEmpty(this.get('precision'))) {
+ this.get('errors').pushObject({type: 'precision', error: "Precision cannot be empty"});
+ } else if(!Helper.isInteger(this.get('precision'))) {
+ this.get('errors').pushObject({type: 'precision', error: "Precision can only be a number"});
+ } else if(this.get('precision') <= 0) {
+ this.get('errors').pushObject({type: 'precision', error: "Precision can only be greater than zero"});
+ }
+
+ }
+
+ if(this.get('type.hasScale')) {
+ if(Ember.isEmpty(this.get('scale'))) {
+ this.get('errors').pushObject({type: 'scale', error: "Scale cannot be empty"});
+ } else if(!Helper.isInteger(this.get('scale'))) {
+ this.get('errors').pushObject({type: 'scale', error: "Scale can only be a number"});
+ } else if(this.get('scale') <= 0) {
+ this.get('errors').pushObject({type: 'scale', error: "Scale can only be greater than zero"});
+ }
+
+ }
+ return this.get('errors.length') === 0;
+ }
+})
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/database.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/database.js b/contrib/views/hive20/src/main/resources/ui/app/models/database.js
new file mode 100644
index 0000000..b9e603a
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/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 DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ tables: DS.hasMany('table'),
+ selected: DS.attr('boolean', {transient: true, defaultValue: false})
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/file.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/file.js b/contrib/views/hive20/src/main/resources/ui/app/models/file.js
new file mode 100644
index 0000000..c13d4e1
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/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 DS from 'ember-data';
+
+export default DS.Model.extend({
+ fileContent: DS.attr(),
+ hasNext: DS.attr(),
+ page: DS.attr('number'),
+ pageCount: DS.attr()
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/job.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/job.js b/contrib/views/hive20/src/main/resources/ui/app/models/job.js
new file mode 100644
index 0000000..76132d1
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/job.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 DS from 'ember-data';
+
+export default DS.Model.extend({
+ title: DS.attr('string'),
+ queryId: DS.attr(),
+ hiveQueryId: DS.attr('string'),
+ queryFile: DS.attr('string'),
+ owner: DS.attr('string'),
+ dataBase: DS.attr('string'),
+ duration: DS.attr(),
+ status: DS.attr('string'),
+ statusMessage: DS.attr('string'),
+ dateSubmitted: DS.attr('date'),
+ forcedContent: DS.attr('string'),
+ logFile: DS.attr('string'),
+ dagName: DS.attr('string'),
+ dagId: DS.attr('string'),
+ sessionTag: DS.attr('string'),
+ page: DS.attr(),
+ statusDir: DS.attr('string'),
+ applicationId: DS.attr(),
+ referrer: DS.attr('string'),
+ confFile: DS.attr('string'),
+ globalSettings: DS.attr('string'),
+
+ dateSubmittedTimestamp: function () {
+ var date = this.get('dateSubmitted');
+
+ return date; // ? date * 1000 : date; now dateSubmitted itself is in miliseconds. so conversion not required.
+ }.property('dateSubmitted'),
+
+ uppercaseStatus: function () {
+ var status = this.get('status');
+
+ return status ? status.toUpperCase() : status;
+ }.property('status')
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/setting.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/setting.js b/contrib/views/hive20/src/main/resources/ui/app/models/setting.js
new file mode 100644
index 0000000..49d2c89
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/setting.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 DS from 'ember-data';
+
+export default DS.Model.extend({
+ key: DS.attr('string'),
+ value: DS.attr('string'),
+ editMode: false
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/table-info.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/table-info.js b/contrib/views/hive20/src/main/resources/ui/app/models/table-info.js
new file mode 100644
index 0000000..85306b6
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/table-info.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 DS from 'ember-data';
+
+export default DS.Model.extend({
+ database: DS.attr('string'),
+ table: DS.attr('string'),
+ columns: DS.attr(),
+ ddl: DS.attr('string'),
+ partitionInfo: DS.attr(),
+ detailedInfo: DS.attr(),
+ storageInfo: DS.attr(),
+ viewInfo: DS.attr()
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/table-property.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/table-property.js b/contrib/views/hive20/src/main/resources/ui/app/models/table-property.js
new file mode 100644
index 0000000..751f55c
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/table-property.js
@@ -0,0 +1,54 @@
+/**
+ * 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.Object.extend({
+ key: '',
+ value: '',
+
+
+ hasError: Ember.computed('errors', function() { return this.get('errors.length') !== 0; }),
+ errors: [],
+
+ keyError: Ember.computed('errors.@each', function() {
+ return this.get('errors').findBy('type', 'key');
+ }),
+
+ valueError: Ember.computed('errors.@each', function() {
+ return this.get('errors').findBy('type', 'value');
+ }),
+
+
+ // Control the UI
+ editing: false,
+
+
+ validate() {
+ this.set('errors', []);
+ if (Ember.isEmpty(this.get('key'))) {
+ this.get('errors').pushObject({type: 'key', error: "Name cannot be empty"});
+ }
+
+ if(Ember.isEmpty(this.get('value'))) {
+ this.get('errors').pushObject({type: 'value', error: "Value cannot be empty"});
+ }
+
+ return this.get('errors.length') === 0;
+ }
+})
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/models/table.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/table.js b/contrib/views/hive20/src/main/resources/ui/app/models/table.js
new file mode 100644
index 0000000..3fdd21a
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/table.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 DS from 'ember-data';
+
+export default DS.Model.extend({
+ name: DS.attr('string'),
+ type: DS.attr('string'),
+ database: DS.belongsTo('database'),
+ selected: false,
+ icon: Ember.computed('type', function() {
+ if(this.get('type').toLowerCase() === 'view') {
+ return "eye";
+ } else {
+ return "table";
+ }
+ })
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/resolver.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/resolver.js b/contrib/views/hive20/src/main/resources/ui/app/resolver.js
new file mode 100644
index 0000000..b9eabe4
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/resolver.js
@@ -0,0 +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.
+ */
+
+import Resolver from 'ember-resolver';
+
+export default Resolver;
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/router.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/router.js b/contrib/views/hive20/src/main/resources/ui/app/router.js
new file mode 100644
index 0000000..46150f4
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/router.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 config from './config/environment';
+
+const Router = Ember.Router.extend({
+ location: config.locationType,
+ rootURL: config.rootURL
+});
+
+Router.map(function() {
+ this.route('jobs');
+ this.route('udfs');
+ this.route('settings');
+ this.route('savedqueries');
+
+ this.route('databases', function() {
+ this.route('database', {path: '/:databaseId'}, function() {
+ this.route('tables', {path: '/tables'}, function() {
+ this.route('new');
+ this.route('table', {path: '/:name'}, function() {
+ this.route('columns');
+ this.route('partitions');
+ this.route('storage');
+ this.route('details');
+ this.route('view');
+ this.route('ddl');
+ this.route('stats');
+ })
+ });
+ });
+ });
+ this.route('messages', function() {
+ this.route('message', {path: '/:message_id'});
+ });
+
+ this.route('query', function() {
+
+ });
+
+});
+
+export default Router;
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/.gitkeep b/contrib/views/hive20/src/main/resources/ui/app/routes/.gitkeep
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/application.js b/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
new file mode 100644
index 0000000..93f5e61
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/application.js
@@ -0,0 +1,32 @@
+/**
+ * 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 tabs from '../configs/top-level-tabs';
+
+export default Ember.Route.extend({
+ keepAlive: Ember.inject.service('keep-alive'),
+ init: function() {
+ this._super(...arguments);
+ this.get('keepAlive').initialize();
+ },
+ setupController: function(controller, model) {
+ this._super(controller, model);
+ controller.set('tabs', tabs);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js
new file mode 100644
index 0000000..6d25abd
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js
@@ -0,0 +1,96 @@
+/**
+ * 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.Route.extend({
+
+ model() {
+ return this.store.findAll('database');
+ },
+
+ afterModel(model) {
+ if (model.get('length') > 0) {
+ this.selectDatabase(model);
+ }
+ },
+
+ setupController(controller, model) {
+ let sortedModel = model.sortBy('name');
+ let selectedModel = sortedModel.filterBy('selected', true).get('firstObject');
+ sortedModel.removeObject(selectedModel);
+ let finalList = [];
+ finalList.pushObject(selectedModel);
+ finalList.pushObjects(sortedModel);
+ controller.set('model', finalList);
+ },
+
+ selectDatabase(model) {
+ // check if default database is present
+ let toSelect = model.findBy('name', 'default');
+ if (Ember.isEmpty(toSelect)) {
+ let sortedModel = model.sortBy('name');
+ toSelect = sortedModel.get('firstObject');
+ }
+ toSelect.set('selected', true);
+ },
+
+ actions: {
+ databaseSelected(database) {
+ this.transitionTo('databases.database.tables', database.get('id'));
+ },
+
+ dropDatabase() {
+ let databases = this.get('controller.model');
+ let selectedModel = databases.filterBy('selected', true).get('firstObject');
+ if (Ember.isEmpty(selectedModel)) {
+ return;
+ }
+
+ this.get('controller').set('databaseName', selectedModel.get('name'));
+
+ if (selectedModel.get('tables.length') > 0) {
+ this.get('controller').set('databaseNotEmpty', true);
+ console.log('database not empty');
+ return;
+ }
+ this.get('controller').set('confirmDropDatabase', true);
+ },
+
+ createTable() {
+ console.log("Table created");
+ },
+
+ notEmptyDialogClosed() {
+ this.get('controller').set('databaseNotEmpty', false);
+ this.get('controller').set('databaseName', undefined);
+ },
+
+ databaseDropConfirmed() {
+ console.log('drop confirmed');
+ this.get('controller').set('confirmDropDatabase', false);
+ this.get('controller').set('databaseName', undefined);
+ },
+
+ databaseDropDeclined() {
+ console.log('drop declined');
+ this.get('controller').set('confirmDropDatabase', false);
+ this.get('controller').set('databaseName', undefined);
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database.js
new file mode 100644
index 0000000..6a4b70b
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ model(params) {
+ return this.store.find('database', params.databaseId);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/index.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/index.js
new file mode 100644
index 0000000..58336df
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/index.js
@@ -0,0 +1,27 @@
+/**
+ * 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.Route.extend({
+ beforeModel() {
+ let selectedDatabase = this.modelFor('databases.database');
+ this.transitionTo('databases.database.tables', selectedDatabase.get('name'));
+
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables.js
new file mode 100644
index 0000000..a121b88
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables.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.Route.extend({
+ model() {
+ let selectedDatabase = this.modelFor('databases.database');
+ return this.store.query('table', {databaseId: selectedDatabase.get('name')});
+ },
+
+ afterModel(model) {
+ if (model.get('length') > 0) {
+ this.selectTable(model);
+ }
+ },
+ selectTable(model) {
+ let sortedModel = model.sortBy('name');
+ let toSelect = sortedModel.get('firstObject');
+ toSelect.set('selected', true);
+ },
+ actions: {
+ tableSelected(table) {
+ let tables = this.controllerFor('databases.database.tables').get('model');
+ tables.forEach((table) => {
+ table.set('selected', false);
+ });
+ table.set('selected', true);
+ this.transitionTo('databases.database.tables.table', table.get('name'));
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/index.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/index.js
new file mode 100644
index 0000000..e5943b1
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/index.js
@@ -0,0 +1,28 @@
+/**
+ * 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.Route.extend({
+ beforeModel() {
+ let selectedTable = this.modelFor('databases.database.tables').filterBy('selected', true).get('firstObject');
+ if (!Ember.isEmpty(selectedTable)) {
+ this.transitionTo('databases.database.tables.table', selectedTable.get('name'));
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js
new file mode 100644
index 0000000..f648ef6
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/new.js
@@ -0,0 +1,71 @@
+/**
+ * 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 tabs from '../../../../configs/create-table-tabs';
+
+export default Ember.Route.extend({
+ createTable: Ember.inject.service(),
+
+ setupController(controller, model) {
+ this._super(controller, model);
+ controller.set('tabs', Ember.copy(tabs));
+ },
+
+ actions: {
+ cancel() {
+ let databaseController = this.controllerFor('databases.database');
+ this.transitionTo('databases.database', databaseController.get('model'));
+ },
+
+ create(settings) {
+ debugger;
+ this.controller.set('showCreateTableModal', true);
+ this.controller.set('createTableMessage', 'Submitting request to create table');
+ let databaseModel = this.controllerFor('databases.database').get('model');
+ this.get('createTable').submitCreateTable(databaseModel.get('name'), settings)
+ .then((job) => {
+ console.log('Created job: ', job.get('id'));
+ this.controller.set('createTableMessage', 'Waiting for the table to be created');
+ this.get('createTable').waitForJobToComplete(job.get('id'), 5 * 1000)
+ .then((status) => {
+ this.controller.set('createTableMessage', "Successfully created table");
+ Ember.run.later(() => {
+ this.controller.set('showCreateTableModal', false);
+ this.controller.set('createTableMessage');
+ this._transitionToCreatedTable(databaseModel.get('name'), settings.name);
+ }, 2 * 1000);
+ }, (error) => {
+ // TODO: handle error
+ Ember.run.later(() => {
+ this.controller.set('showCreateTableModal', false);
+ this.controller.set('createTableMessage');
+ this.transitionTo('databases.database', databaseModel.get('name'));
+ }, 2 * 1000);
+ });
+ }, (error) => {
+ console.log("Error encountered", error);
+ this.controller.set('showCreateTableModal', true);
+ });
+ }
+ },
+
+ _transitionToCreatedTable(database, table) {
+ this.transitionTo('databases.database.tables.table', database, table);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.js
new file mode 100644
index 0000000..5a88bd2
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table.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 Ember from 'ember';
+import tabs from '../../../../configs/table-level-tabs';
+
+export default Ember.Route.extend({
+ model(params) {
+ let database = this.modelFor('databases.database').get('name');
+ let table = params.name;
+ return this.store.queryRecord('tableInfo', {databaseId: database, tableName: table});
+ },
+
+ setupController: function (controller, model) {
+ this._super(controller, model);
+ let newTabs = Ember.copy(tabs);
+ if (Ember.isEmpty(model.get('partitionInfo'))) {
+ newTabs = newTabs.rejectBy('name', 'partitions');
+ }
+
+ console.log(model.get('detailedInfo.tableType').toLowerCase());
+ if (model.get('detailedInfo.tableType').toLowerCase().indexOf('view') === -1) {
+ newTabs = newTabs.rejectBy('name', 'viewInfo');
+ }
+ controller.set('tabs', newTabs);
+ },
+
+ actions: {}
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.js
new file mode 100644
index 0000000..a11a4de
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/columns.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/ddl.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/ddl.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/ddl.js
new file mode 100644
index 0000000..614eeec
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/ddl.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/details.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/details.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/details.js
new file mode 100644
index 0000000..614eeec
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/details.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/index.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/index.js
new file mode 100644
index 0000000..b039a79
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/index.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 Ember from 'ember';
+
+export default Ember.Route.extend({
+ beforeModel() {
+ this.transitionTo('databases.database.tables.table.columns');
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/partitions.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/partitions.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/partitions.js
new file mode 100644
index 0000000..614eeec
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/partitions.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/stats.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/stats.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/stats.js
new file mode 100644
index 0000000..614eeec
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/stats.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/storage.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/storage.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/storage.js
new file mode 100644
index 0000000..614eeec
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/storage.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/table-meta-router.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/table-meta-router.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/table-meta-router.js
new file mode 100644
index 0000000..06b91ae
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/table-meta-router.js
@@ -0,0 +1,27 @@
+/**
+ * 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.Route.extend({
+ setupController: function(controller, model) {
+ this._super(controller, model);
+ let table = this.controllerFor('databases.database.tables.table').get('model');
+ controller.set('table', table);
+ },
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/view.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/view.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/view.js
new file mode 100644
index 0000000..614eeec
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/table/view.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 TableMetaRouter from './table-meta-router';
+
+export default TableMetaRouter.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/databases/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/index.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/index.js
new file mode 100644
index 0000000..493ff10
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/index.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';
+
+export default Ember.Route.extend({
+ beforeModel() {
+ let selectedDatabase = this.modelFor('databases').filterBy('selected', true).get('firstObject');
+ this.transitionTo('databases.database', selectedDatabase.get('id'));
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js b/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js
new file mode 100644
index 0000000..a2ebc25
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.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';
+
+export default Ember.Route.extend({
+ moment: Ember.inject.service(),
+ timeInitializedTo: null,
+ queryParams: {
+ startTime: {
+ refreshModel: true
+ },
+ endTime: {
+ refreshModel: true
+ }
+ },
+
+
+ model(params) {
+ let now = this.get('moment').moment();
+ if(Ember.isEmpty(params.startTime) || Ember.isEmpty(params.endTime)) {
+ let initialValue = now.clone();
+ params.endTime = now.valueOf();
+ params.startTime = now.subtract('7', 'days').valueOf();
+ this.set('timeInitializedTo', initialValue);
+ }
+
+ return this.store.query('job', params);
+ },
+
+ setupController(controller, model) {
+ if(!Ember.isEmpty(this.get('timeInitializedTo'))) {
+
+ controller.set('endTime', this.get('timeInitializedTo').valueOf());
+ controller.set('startTime', this.get('timeInitializedTo').subtract('7', 'days').valueOf());
+ //unset timeInitializedTo
+ this.set('timeInitializedTo');
+ }
+
+ this._super(...arguments);
+
+ },
+
+ actions: {
+ dateFilterChanged(startTime, endTime) {
+ this.controller.set('startTime', this.get('moment').moment(startTime, 'YYYY-MM-DD').valueOf())
+ this.controller.set('endTime', this.get('moment').moment(endTime, 'YYYY-MM-DD').valueOf())
+ this.refresh();
+ }
+ }
+
+
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/messages.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/messages.js b/contrib/views/hive20/src/main/resources/ui/app/routes/messages.js
new file mode 100644
index 0000000..1e413ed
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/messages.js
@@ -0,0 +1,32 @@
+/**
+ * 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.Route.extend({
+ logger: Ember.inject.service('alert-messages'),
+ model: function() {
+ return this.store.peekAll('alert');
+ },
+ setupController: function(controller, model) {
+ this._super(controller, model);
+ this.get('logger').clearMessages();
+ this.get('logger').setUnreadMessagesToRead();
+ controller.set('isExpanded', true);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/messages/message.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/messages/message.js b/contrib/views/hive20/src/main/resources/ui/app/routes/messages/message.js
new file mode 100644
index 0000000..84be53b
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/messages/message.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.Route.extend({
+ model: function(params) {
+ return this.store.peekRecord('alert', params.message_id);
+ },
+
+ setupController: function(controller, model) {
+ this._super(controller, model);
+ var messagesController = this.controllerFor('messages');
+ messagesController.set('isExpanded', false);
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/query.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/query.js b/contrib/views/hive20/src/main/resources/ui/app/routes/query.js
new file mode 100644
index 0000000..699b64c
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/query.js
@@ -0,0 +1,280 @@
+/**
+ * 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.Route.extend({
+
+ model() {
+ return this.store.findAll('database');
+ },
+
+ query: Ember.inject.service(),
+
+ afterModel(model) {
+ if (model.get('length') > 0) {
+ this.selectDatabase(model);
+ }
+ },
+
+ setupController(controller, model) {
+
+ let sortedModel = model.sortBy('name');
+ let selectedModel = sortedModel.filterBy('selected', true).get('firstObject');
+ sortedModel.removeObject(selectedModel);
+ let finalList = [];
+ let selectedDB = [];
+
+ finalList.pushObject(selectedModel);
+ finalList.pushObjects(sortedModel);
+ controller.set('model', finalList);
+
+ selectedDB.pushObject(selectedModel);
+ controller.set('selectedModel',selectedDB);
+
+ let selecteDBName = selectedModel.get('name');
+
+ let self = this;
+ let selectedTablesModels =[];
+
+ selectedTablesModels.pushObject(
+ {
+ 'dbname': selecteDBName ,
+ 'tables': this.store.query('table', {databaseId: selecteDBName})
+ }
+ )
+
+ controller.set('selectedTablesModels',selectedTablesModels );
+ controller.set('currentQuery', '');
+ controller.set('isQueryRunning', false);
+ controller.set('defaultQueryResult', {'schema' :[], 'rows' :[]});
+ controller.set('queryResult', controller.get('defaultQueryResult'));
+ controller.set('showPreviousButton', false);
+
+ //For Pagination
+ localStorage.setItem("jobData", JSON.stringify([]));
+ controller.set('prevPage', -1 );
+ controller.set('currentPage', 0 );
+ controller.set('nextPage', 1 );
+ controller.set('currentJobData', null );
+
+ },
+
+ selectDatabase(model) {
+ // check if default database is present
+ let toSelect = model.findBy('name', 'default');
+ if (Ember.isEmpty(toSelect)) {
+ let sortedModel = model.sortBy('name');
+ toSelect = sortedModel.get('firstObject');
+ }
+ toSelect.set('selected', true);
+ },
+
+ actions: {
+
+ xyz(selectedDBs){
+
+ let self = this;
+ let selectedTablesModels =[];
+
+ selectedDBs.forEach(function(db){
+ selectedTablesModels.pushObject(
+ {
+ 'dbname': db ,
+ 'tables':self.store.query('table', {databaseId: db})
+ }
+ )
+ });
+
+ this.get('controller').set('selectedTablesModels', selectedTablesModels );
+
+ },
+
+ tableSelected(){
+ console.log('I am in tableSelected');
+ },
+
+ showTables(db){
+ //should we do this by writing a seperate component.
+ $('.collapse').hide();
+ $('#' + db).toggle();
+ },
+
+ notEmptyDialogClosed() {
+ this.get('controller').set('databaseNotEmpty', false);
+ this.get('controller').set('databaseName', undefined);
+ },
+
+ executeQuery(isFirstCall){
+
+ let self = this;
+ let queryInput = this.get('controller').get('currentQuery');
+ let dbid = this.get('controller').get('selectedTablesModels')[0]['dbname']
+
+ self.get('controller').set('isQueryRunning', true);
+ self.get('controller').set('queryResult', self.get('controller').get('defaultQueryResult'));
+
+ let payload ={
+ "title":"Worksheet",
+ "hiveQueryId":null,
+ "queryFile":null,
+ "owner":null,
+ "dataBase":dbid,
+ "status":null,
+ "statusMessage":null,
+ "dateSubmitted":null,
+ "forcedContent":queryInput,
+ "logFile":null,
+ "dagName":null,
+ "dagId":null,
+ "sessionTag":null,
+ "statusDir":null,
+ "referrer":"job",
+ "confFile":null,
+ "globalSettings":""};
+
+
+ this.get('query').createJob(payload).then(function(data) {
+ // applying a timeout otherwise it goes for status code 409, although that condition is also handled in the code.
+ setTimeout(function(){
+ self.get('controller').set('currentJobData', data);
+ self.send('getJob', data);
+ }, 2000);
+ }, function(reason) {
+ console.log(reason);
+ });
+
+ },
+ getJob(data){
+
+ var self = this;
+ var data = data;
+
+ let jobId = data.job.id;
+ let dateSubmitted = data.job.dateSubmitted;
+
+ this.get('query').getJob(jobId, dateSubmitted, true).then(function(data) {
+ // on fulfillment
+ console.log('getJob route', data );
+ self.get('controller').set('queryResult', data);
+ self.get('controller').set('isQueryRunning', false);
+
+ let localArr = JSON.parse(localStorage.getItem("jobData"));
+ localArr.push(data);
+ localStorage.setItem("jobData", JSON.stringify(localArr));
+
+ self.get('controller').set('currentPage', localArr.length);
+ self.get('controller').set('prevPage', localArr.length-1);
+
+
+ }, function(reason) {
+ // on rejection
+ console.log('reason' , reason);
+
+ if( reason.errors[0].status == 409 ){
+ setTimeout(function(){
+ self.send('getJob',data);
+ }, 2000);
+ }
+ });
+
+ },
+ goNextPage(){
+
+ let nextPage = this.get('controller').get('nextPage');
+ let totalPages = JSON.parse(localStorage.getItem("jobData")).length;
+
+ if(nextPage >= totalPages){
+ var self = this;
+ var data = this.get('controller').get('currentJobData');
+
+ let jobId = data.job.id;
+ let dateSubmitted = data.job.dateSubmitted;
+
+
+ this.get('query').getJob(jobId, dateSubmitted, false).then(function(data) {
+ // on fulfillment
+ console.log('getJob route', data );
+ self.get('controller').set('queryResult', data);
+ self.get('controller').set('isQueryRunning', false);
+ self.get('controller').set('showPreviousButton', true);
+
+ let localArr = JSON.parse(localStorage.getItem("jobData"));
+ localArr.push(data);
+
+
+ localStorage.setItem("jobData", JSON.stringify(localArr));
+
+
+ self.get('controller').set('currentPage', localArr.length);
+ self.get('controller').set('prevPage', localArr.length-1);
+
+ self.get('controller').set('nextPage', localArr.length+1);
+
+ }, function(reason) {
+ // on rejection
+ console.log('reason' , reason);
+
+ if( reason.errors[0].status == 409 ){
+ setTimeout(function(){
+ self.send('getJob',data);
+ }, 2000);
+ }
+ });
+ } else {
+
+ let currentPage = this.get('controller').get('currentPage');
+ let prevPage = this.get('controller').get('prevPage');
+ let nextPage = this.get('controller').get('nextPage');
+ let totalPages = JSON.parse(localStorage.getItem("jobData")).length;
+
+ if(nextPage < totalPages ){
+ this.get('controller').set('currentPage', currentPage+1 );
+ this.get('controller').set('prevPage', prevPage + 1 );
+ this.get('controller').set('nextPage', nextPage + 1);
+
+ this.get('controller').set('showPreviousButton', true);
+
+ this.get('controller').set('queryResult', JSON.parse(localStorage.getItem("jobData"))[this.get('controller').get('currentPage')] );
+ } else {
+
+ console.log('upper limit exceed');
+ this.send('goNextPage');
+ }
+ }
+ },
+ goPrevPage(){
+
+ let currentPage = this.get('controller').get('currentPage');
+ let prevPage = this.get('controller').get('prevPage');
+ let nextPage = this.get('controller').get('nextPage');
+ let totalPages = JSON.parse(localStorage.getItem("jobData")).length;
+
+ if(prevPage > -1){
+ this.get('controller').set('currentPage', currentPage-1 );
+ this.get('controller').set('prevPage', prevPage - 1 );
+ this.get('controller').set('nextPage', this.get('controller').get('currentPage')+1);
+
+ this.get('controller').set('queryResult', JSON.parse(localStorage.getItem("jobData"))[this.get('controller').get('currentPage')] );
+ } else {
+ //console.log('previous limit over');
+ this.get('controller').set('showPreviousButton', false);
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/savedqueries.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/savedqueries.js b/contrib/views/hive20/src/main/resources/ui/app/routes/savedqueries.js
new file mode 100644
index 0000000..8719170
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/savedqueries.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.Route.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js b/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js
new file mode 100644
index 0000000..1ce5116
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/settings.js
@@ -0,0 +1,93 @@
+/**
+ * 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 hiveParams from '../configs/hive-parameters'
+
+export default Ember.Route.extend({
+ model() {
+ return this.store.findAll('setting').then(settings => settings.toArray());
+ },
+ setupController(controller, model) {
+ this._super(...arguments);
+ const appendedHiveParams = this.prepareExhaustiveParameters(hiveParams, model);
+ controller.set('hiveParameters', appendedHiveParams);
+ },
+
+ prepareExhaustiveParameters(hiveParams, model) {
+ let newHiveParams = [];
+ newHiveParams.pushObjects(hiveParams);
+ model.forEach(x => {
+ let param = hiveParams.findBy('name', x.get('key'));
+
+ if(Ember.isEmpty(param)) {
+ newHiveParams.pushObject(
+ Ember.Object.create({name: x.get('key'), disabled: true})
+ );
+ } else {
+ param.set('disabled', true);
+ }
+ });
+ return newHiveParams;
+ },
+
+ actions: {
+ addNewSettings() {
+ let model = this.get('controller.model');
+ model.forEach(x => x.rollbackAttributes());
+ let newItem = this.store.createRecord('setting', {editMode: true});
+ model.pushObject(newItem);
+ },
+
+ editAction(setting) {
+ setting.set('editMode', true);
+ },
+
+ deleteAction(setting) {
+ return setting.destroyRecord().then(data => {
+ let model = this.get('controller.model');
+ model.removeObject(data);
+ }, err => {
+ console.log('error in deletion');
+ })
+ },
+
+ updateAction(newSetting) {
+ newSetting.save().then(data => {
+ console.log('saved', data);
+ data.set('editMode', false);
+ }, error => {
+ console.log('error', err);
+ })
+ },
+
+ cancelAction(newSetting) {
+ if (newSetting.get('isNew')) {
+ let model = this.get('controller.model');
+ model.removeObject(newSetting);
+ } else {
+ newSetting.set('editMode', false);
+ }
+ },
+
+ willTransition(transition) {
+ let unsavedModels = this.get('controller.model').filterBy('isNew', true);
+ unsavedModels.forEach(x => this.store.unloadRecord(x));
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js b/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.js
new file mode 100644
index 0000000..8719170
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/udfs.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.Route.extend({
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/853a1ce7/contrib/views/hive20/src/main/resources/ui/app/serializers/file.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/serializers/file.js b/contrib/views/hive20/src/main/resources/ui/app/serializers/file.js
new file mode 100644
index 0000000..416db0c
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/serializers/file.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 DS from 'ember-data';
+
+export default DS.RESTSerializer.extend({
+ primaryKey: 'filePath'
+});