[IMP] Implemented Drop DB feature.
bzr revid: noz@tinyerp.com-20110701122222-kph026dlps1tkgzq
This commit is contained in:
parent
1f44208fd7
commit
dc2cdac7e0
|
@ -119,7 +119,19 @@ class Session(openerpweb.Controller):
|
|||
except Exception, e:
|
||||
pass
|
||||
return {"lang_list": lang_list}
|
||||
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def drop_db(self, req, **kw):
|
||||
|
||||
db = kw.get('db')
|
||||
password = kw.get('password')
|
||||
try:
|
||||
res = req.session.proxy("db").drop(password, db)
|
||||
if res:
|
||||
return res
|
||||
except TypeError:
|
||||
return {'error': e}
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def modules(self, req):
|
||||
return {"modules": [name
|
||||
|
|
|
@ -189,7 +189,7 @@ ul.db_options li {
|
|||
-moz-border-radius: 10px;
|
||||
}
|
||||
|
||||
.db_option_table input[type="text"], input[type="password"], select, textarea {
|
||||
.db_option_table input[type="text"], input[type="password"], select {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
|
|
|
@ -938,6 +938,20 @@ openerp.base.Database = openerp.base.Controller.extend({
|
|||
self.$element.find('#db-drop').click(function() {
|
||||
self.db_string = "DROP DATABASE";
|
||||
self.$option_id.html(QWeb.render("DropDB", self));
|
||||
|
||||
self.$option_id.find('#drop_db_btn').click(function() {
|
||||
var db = self.$option_id.find("select[name=drop_db]").val();
|
||||
var password = self.$option_id.find("input[name=drop_password]").val();
|
||||
|
||||
if (confirm("Do you really want to delete the database: " + db + " ?")) {
|
||||
self.rpc("/base/session/drop_db", {'db': db, 'password': password},
|
||||
function(result) {
|
||||
self.$option_id.find("select[name=drop_db] :selected").remove();
|
||||
self.notification.notify("Dropping database", "The database '" + db + "' has been dropped");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
self.$element.find('#db-backup').click(function() {
|
||||
self.db_string = "BACKUP DATABASE";
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
<td><input type="text" name="confirm_pwd"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button type="button">Submit</button></td>
|
||||
<td colspan="2" align="right"><button type="button">Create</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
|
@ -127,9 +127,9 @@
|
|||
</table>
|
||||
<table align="center" class="db_option_table">
|
||||
<tr>
|
||||
<td><label for="db_name">Database:</label></td>
|
||||
<td><label for="drop_db">Database:</label></td>
|
||||
<t t-if="db_list">
|
||||
<select name="db">
|
||||
<select name="drop_db">
|
||||
<t t-foreach="db_list" t-as="db">
|
||||
<option t-att-value="db"><t t-esc="db"/></option>
|
||||
</t>
|
||||
|
@ -137,11 +137,11 @@
|
|||
</t>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="pwd">Password:</label></td>
|
||||
<td><input type="password" name="pwd"/></td>
|
||||
<td><label for="droppassword">Password:</label></td>
|
||||
<td><input type="password" name="drop_password" value=""/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button type="button">Submit</button></td>
|
||||
<td colspan="2" align="right"><button type="button" id="drop_db_btn">Drop</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
|
@ -171,7 +171,7 @@
|
|||
<td><input type="password" name="pwd"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button type="button">Submit</button></td>
|
||||
<td colspan="2" align="right"><button type="button">Backup</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
|
@ -197,7 +197,7 @@
|
|||
<td><input type="text" name="new_db"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button type="button">Submit</button></td>
|
||||
<td colspan="2" align="right"><button type="button">Restore</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<td><input type="password" name="confirm_pwd"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button type="button">Submit</button></td>
|
||||
<td colspan="2" align="right"><button type="button">Change Password</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
|
|
Loading…
Reference in New Issue