Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 0b3058d4d -> 0378a6f04


AMBARI-19443. Hive View 2.0: Ability to delete a database from UI. (dipayanb)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0378a6f0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0378a6f0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0378a6f0

Branch: refs/heads/branch-2.5
Commit: 0378a6f04110b864e3a0265b56daecac481fcd51
Parents: 0b3058d
Author: Dipayan Bhowmick <dipayan.bhowm...@gmail.com>
Authored: Thu Jan 12 00:03:06 2017 +0530
Committer: Dipayan Bhowmick <dipayan.bhowm...@gmail.com>
Committed: Thu Jan 12 00:03:06 2017 +0530

----------------------------------------------------------------------
 .../hive20/resources/browser/DDLService.java    |  2 +-
 .../main/resources/ui/app/adapters/database.js  |  4 ++
 .../ui/app/components/confirm-dialog.js         | 46 ++++++++++++++++++++
 .../ui/app/components/database-drop-confirm.js  | 32 --------------
 .../ui/app/components/database-not-empty.js     | 29 ------------
 .../resources/ui/app/components/info-dialog.js  | 38 ++++++++++++++++
 .../main/resources/ui/app/routes/databases.js   | 43 +++++++++++++++---
 .../resources/ui/app/routes/databases/index.js  |  1 +
 .../ui/app/services/table-operations.js         | 11 +++++
 .../app/templates/components/confirm-dialog.hbs | 39 +++++++++++++++++
 .../components/database-drop-confirm.hbs        | 37 ----------------
 .../templates/components/database-not-empty.hbs | 38 ----------------
 .../ui/app/templates/components/info-dialog.hbs | 38 ++++++++++++++++
 .../resources/ui/app/templates/databases.hbs    | 41 +++++++++++++++--
 14 files changed, 253 insertions(+), 146 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLService.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLService.java
 
b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLService.java
index b82dd3f..e142baf 100644
--- 
a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLService.java
+++ 
b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLService.java
@@ -103,7 +103,7 @@ public class DDLService extends BaseService {
       job = proxy.deleteDatabase(databaseId, getResourceManager());
       JSONObject response = new JSONObject();
       response.put("job", job);
-      return Response.status(Response.Status.ACCEPTED).entity(job).build();
+      return 
Response.status(Response.Status.ACCEPTED).entity(response).build();
     } catch (ServiceException e) {
       LOG.error("Exception occurred while delete database {}", databaseId, e);
       throw new ServiceFormattedException(e);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/adapters/database.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/adapters/database.js 
b/contrib/views/hive20/src/main/resources/ui/app/adapters/database.js
index 6594309..6333ae6 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/adapters/database.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/adapters/database.js
@@ -19,4 +19,8 @@
 import DDLAdapter from './ddl';
 
 export default DDLAdapter.extend({
+  deleteDatabase(databaseName) {
+    let deletURL = this.urlForFindRecord(databaseName, 'database');
+    return this.ajax(deletURL, 'DELETE');
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/components/confirm-dialog.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/components/confirm-dialog.js 
b/contrib/views/hive20/src/main/resources/ui/app/components/confirm-dialog.js
new file mode 100644
index 0000000..9935254
--- /dev/null
+++ 
b/contrib/views/hive20/src/main/resources/ui/app/components/confirm-dialog.js
@@ -0,0 +1,46 @@
+/**
+ * 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({
+  title: null,
+  label: null,
+  confirmText: 'Confirm',
+  rejectText: 'Reject',
+
+  titleIcon: null,
+  labelIcon: null,
+  confirmIcon: null,
+  rejectIcon: null,
+
+  closable: true,
+  titleClass: 'primary',
+  confirmClass: 'primary',
+  rejectClass: 'default',
+
+  actions: {
+    confirm() {
+      this.sendAction('confirm');
+    },
+
+    reject() {
+      this.sendAction('reject');
+    }
+  }
+});

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

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

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/components/info-dialog.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/components/info-dialog.js 
b/contrib/views/hive20/src/main/resources/ui/app/components/info-dialog.js
new file mode 100644
index 0000000..0a835f4
--- /dev/null
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/info-dialog.js
@@ -0,0 +1,38 @@
+/**
+ * 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({
+  title: null,
+  label: null,
+  okText: 'Ok',
+  okIcon: 'check',
+  titleIcon: null,
+  labelIcon: null,
+
+  okClass: 'primary',
+  titleClass: 'primary',
+
+  closable: true,
+  actions: {
+    ok() {
+      this.sendAction('ok');
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/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
index 6d25abd..fd19905 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases.js
@@ -19,14 +19,18 @@
 import Ember from 'ember';
 
 export default Ember.Route.extend({
+  tableOperations: Ember.inject.service(),
 
   model() {
-    return this.store.findAll('database');
+    return this.store.findAll('database', {reload: true});
   },
 
   afterModel(model) {
     if (model.get('length') > 0) {
       this.selectDatabase(model);
+      if (this.controller) {
+        this.setupController(this.controller, model);
+      }
     }
   },
 
@@ -62,7 +66,7 @@ export default Ember.Route.extend({
         return;
       }
 
-      this.get('controller').set('databaseName', selectedModel.get('name'));
+      this.get('controller').set('databaseToDelete', selectedModel);
 
       if (selectedModel.get('tables.length') > 0) {
         this.get('controller').set('databaseNotEmpty', true);
@@ -78,19 +82,48 @@ export default Ember.Route.extend({
 
     notEmptyDialogClosed() {
       this.get('controller').set('databaseNotEmpty', false);
-      this.get('controller').set('databaseName', undefined);
+      this.get('controller').set('databaseToDelete', undefined);
     },
 
     databaseDropConfirmed() {
       console.log('drop confirmed');
       this.get('controller').set('confirmDropDatabase', false);
-      this.get('controller').set('databaseName', undefined);
+
+      this.controller.set('showDeleteDatabaseModal', true);
+      this.controller.set('deleteDatabaseMessage', 'Submitting request to 
delete database');
+      let databaseModel = this.controller.get('databaseToDelete');
+      this.get('tableOperations').deleteDatabase(databaseModel)
+        .then((job) => {
+          this.controller.set('deleteDatabaseMessage', 'Waiting for the 
database to be deleted');
+          this.get('tableOperations').waitForJobToComplete(job.get('id'), 5 * 
1000)
+            .then((status) => {
+              this.controller.set('deleteDatabaseMessage', "Successfully 
Deleted table");
+              Ember.run.later(() => {
+                this.store.unloadRecord(databaseModel);
+                this.controller.set('showDeleteDatabaseModal', false);
+                this.controller.set('deleteDatabaseMessage');
+                this.replaceWith('databases');
+                this.refresh();
+              }, 2 * 1000);
+            }, (error) => {
+              // TODO: handle error
+              Ember.run.later(() => {
+                this.controller.set('showDeleteDatabaseModal', false);
+                this.controller.set('deleteDatabaseMessage');
+                this.replaceWith('databases');
+                this.refresh();
+              }, 2 * 1000);
+            });
+        }, (error) => {
+          console.log("Error encountered", error);
+          this.controller.set('showDeleteDatabaseModal', false);
+        });
     },
 
     databaseDropDeclined() {
       console.log('drop declined');
       this.get('controller').set('confirmDropDatabase', false);
-      this.get('controller').set('databaseName', undefined);
+      this.get('controller').set('databaseToDelete', undefined);
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/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
index 493ff10..93ef96e 100644
--- 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
@@ -23,4 +23,5 @@ export default Ember.Route.extend({
    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/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/services/table-operations.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/services/table-operations.js 
b/contrib/views/hive20/src/main/resources/ui/app/services/table-operations.js
index 81b0430..264e617 100644
--- 
a/contrib/views/hive20/src/main/resources/ui/app/services/table-operations.js
+++ 
b/contrib/views/hive20/src/main/resources/ui/app/services/table-operations.js
@@ -56,6 +56,17 @@ export default Ember.Service.extend({
     })
   },
 
+  deleteDatabase(database) {
+    return new Promise((resolve, reject) => {
+      
this.get('store').adapterFor('database').deleteDatabase(database.get('name')).then((data)
 => {
+        this.get('store').pushPayload(data);
+        resolve(this.get('store').peekRecord('job', data.job.id));
+      }, (err) => {
+        reject(err);
+      });
+    })
+  },
+
   waitForJobToComplete(jobId, after) {
     return new Ember.RSVP.Promise((resolve, reject) => {
       Ember.run.later(() => {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/templates/components/confirm-dialog.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/templates/components/confirm-dialog.hbs
 
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/confirm-dialog.hbs
new file mode 100644
index 0000000..d940237
--- /dev/null
+++ 
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/confirm-dialog.hbs
@@ -0,0 +1,39 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+{{#modal-dialog
+  close="reject"
+  translucentOverlay=true
+  clickOutsideToClose=true
+  container-class="modal-dialog"}}
+  <div class="modal-content">
+    <div class="modal-header text-{{titleClass}}">
+      {{#if closable}}
+        <button type="button" class="close" {{action "reject"}}><span 
aria-hidden="true">&times;</span></button>
+      {{/if}}
+      <p class="modal-title">{{#if titleIcon}}{{fa-icon titleIcon 
size="lg"}}{{/if}} {{title}}</p>
+    </div>
+    <div class="modal-body">
+      <p class="lead">{{#if labelIcon}}{{fa-icon labelIcon size="lg"}}{{/if}} 
{{label}}</p>
+    </div>
+    <div class="modal-footer">
+      <button type="button" class="btn btn-{{rejectClass}}" {{action 
"reject"}}>{{#if rejectIcon}}{{fa-icon rejectIcon}} 
{{/if}}{{rejectText}}</button>
+      <button type="button" class="btn btn-{{confirmClass}}" {{action 
"confirm"}}>{{#if confirmIcon}}{{fa-icon confirmIcon}} 
{{/if}}{{confirmText}}</button>
+    </div>
+  </div><!-- /.modal-content -->
+{{/modal-dialog}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-drop-confirm.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-drop-confirm.hbs
 
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-drop-confirm.hbs
deleted file mode 100644
index efb54ac..0000000
--- 
a/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-drop-confirm.hbs
+++ /dev/null
@@ -1,37 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-{{#modal-dialog
-close="cancel"
-translucentOverlay=true
-clickOutsideToClose=true
-container-class="modal-dialog"}}
-  <div class="modal-content">
-    <div class="modal-header text-danger">
-      <button type="button" class="close" {{action "cancel"}}><span 
aria-hidden="true">&times;</span></button>
-      <h4 class="modal-title">{{fa-icon "exclamation-triangle" size="lg"}} 
Confirm</h4>
-    </div>
-    <div class="modal-body text-center">
-      <p class="">Are you sure you want to drop <span 
class="text-uppercase"><strong>'{{name}}'</strong></span> database?</p>
-    </div>
-    <div class="modal-footer">
-      <button type="button" class="btn btn-default" {{action 
"cancel"}}>{{fa-icon "times"}} Cancel</button>
-      <button type="button" class="btn btn-primary" {{action 
"confirm"}}>{{fa-icon "check"}} Confirm</button>
-    </div>
-  </div><!-- /.modal-content -->
-{{/modal-dialog}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-not-empty.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-not-empty.hbs
 
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-not-empty.hbs
deleted file mode 100644
index e11e898..0000000
--- 
a/contrib/views/hive20/src/main/resources/ui/app/templates/components/database-not-empty.hbs
+++ /dev/null
@@ -1,38 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-{{#modal-dialog
-close="close"
-translucentOverlay=true
-clickOutsideToClose=true
-container-class="modal-dialog"}}
-  <div class="modal-content">
-    <div class="modal-header text-danger">
-      <button type="button" class="close" {{action "close"}}><span 
aria-hidden="true">&times;</span></button>
-      <h4 class="modal-title">{{fa-icon "exclamation-triangle" size="lg"}} 
Error</h4>
-    </div>
-    <div class="modal-body text-center">
-      <p class="">Cannot drop database. Database <span 
class="text-uppercase"><strong>'{{name}}'</strong></span> is not empty !</p>
-      <div class="clearfix">
-        <div class="col-md-offset-4 col-md-4">
-          <button type="button" class="btn btn-warning btn-block" {{action 
"close"}}>{{fa-icon "times"}} Ok</button>
-        </div>
-      </div>
-    </div>
-  </div><!-- /.modal-content -->
-{{/modal-dialog}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/templates/components/info-dialog.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/templates/components/info-dialog.hbs
 
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/info-dialog.hbs
new file mode 100644
index 0000000..cf44f7e
--- /dev/null
+++ 
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/info-dialog.hbs
@@ -0,0 +1,38 @@
+{{!
+* 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.
+}}
+
+{{#modal-dialog
+  translucentOverlay=true
+  clickOutsideToClose=false
+  container-class="modal-dialog"}}
+  <div class="modal-content">
+    <div class="modal-header text-{{titleClass}}">
+      {{#if closable}}
+        <button type="button" class="close" {{action "ok"}}><span 
aria-hidden="true">&times;</span></button>
+      {{/if}}
+      <p class="modal-title">{{#if titleIcon}}{{fa-icon titleIcon 
size="lg"}}{{/if}} {{title}}</p>
+    </div>
+    <div class="modal-body">
+      <p class="lead">{{#if labelIcon}}{{fa-icon labelIcon size="lg"}}{{/if}} 
{{label}}</p>
+    </div>
+    <div class="modal-footer">
+      <button type="button" class="btn btn-{{okClass}}" {{action "ok"}}>{{#if 
okIcon}}{{fa-icon okIcon}} {{/if}}{{okText}}</button>
+    </div>
+  </div><!-- /.modal-content -->
+{{/modal-dialog}}
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/0378a6f0/contrib/views/hive20/src/main/resources/ui/app/templates/databases.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/hive20/src/main/resources/ui/app/templates/databases.hbs 
b/contrib/views/hive20/src/main/resources/ui/app/templates/databases.hbs
index 2be061f..9a4a892 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/databases.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/databases.hbs
@@ -19,10 +19,10 @@
 {{database-search-bar databases=model selected="databaseSelected"}}
 <div class="hv-dropdown database-dropdown">
   <div class="dropdown">
-    <button class="btn btn-default dropdown-toggle" type="button" 
id="dropdownMenu1121" data-toggle="dropdown" aria-haspopup="true" 
aria-expanded="true">
+    <button class="btn btn-default dropdown-toggle" type="button" 
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
       {{fa-icon "navicon"}}
     </button>
-    <ul class="dropdown-menu dropdown-menu-right" 
aria-labelledby="dropdownMenu1121">
+    <ul class="dropdown-menu dropdown-menu-right">
       <li><a href="#" {{action "dropDatabase"}} 
class="text-uppercase">{{fa-icon "trash"}} drop database</a></li>
       <li><a href="#" {{action "createTable"}} 
class="text-uppercase">{{fa-icon "plus"}} create table</a></li>
     </ul>
@@ -30,10 +30,43 @@
 </div>
 
 {{#if databaseNotEmpty}}
-  {{database-not-empty name=databaseName close="notEmptyDialogClosed"}}
+  {{info-dialog
+    title="Info"
+    label="Database not empty. Cannot delete the database."
+    titleIcon="exclamation"
+    labelIcon="exclamation-triangle"
+    closable=false
+    ok="notEmptyDialogClosed"
+  }}
 {{/if}}
 
 {{#if confirmDropDatabase}}
-  {{database-drop-confirm name=databaseName yes="databaseDropConfirmed" 
no="databaseDropDeclined"}}
+  {{confirm-dialog
+    title="Confirm"
+    label="Do You want to delete the database?"
+    titleIcon="minus"
+    labelIcon="database"
+    rejectIcon="times"
+    confirmIcon="check"
+    closable=false
+    confirmClass="success"
+    confirm="databaseDropConfirmed"
+    reject="databaseDropDeclined"
+  }}
+{{/if}}
+
+{{#if showDeleteDatabaseModal}}
+  {{#modal-dialog
+    translucentOverlay=true
+    container-class="modal-dialog modal-sm"}}
+    <div class="modal-content">
+      <div class="modal-header text-danger">
+        <p class="modal-title">{{fa-icon "minus"}}&nbsp;&nbsp;&nbsp; Delete 
Database</p>
+      </div>
+      <div class="modal-body text-center text-primary">
+        <p>{{deleteDatabaseMessage}}</p>
+      </div>
+    </div><!-- /.modal-content -->
+  {{/modal-dialog}}
 {{/if}}
 {{outlet}}

Reply via email to