Rev1232, Db schema reload sidebar button
This commit is contained in:
parent
e481a12647
commit
5f55d8a034
4 changed files with 38 additions and 8 deletions
|
@ -284,16 +284,20 @@ class UiWebsocketPlugin(object):
|
|||
""")
|
||||
|
||||
def sidebarRenderDbOptions(self, body, site):
|
||||
if not site.storage.db:
|
||||
return False
|
||||
if site.storage.db:
|
||||
inner_path = site.storage.getInnerPath(site.storage.db.db_path)
|
||||
size = float(site.storage.getSize(inner_path)) / 1024
|
||||
feeds = len(site.storage.db.schema.get("feeds", {}))
|
||||
else:
|
||||
inner_path = "No database found"
|
||||
size = 0.0
|
||||
feeds = 0
|
||||
|
||||
inner_path = site.storage.getInnerPath(site.storage.db.db_path)
|
||||
size = float(site.storage.getSize(inner_path)) / 1024
|
||||
body.append(u"""
|
||||
<li>
|
||||
<label>Database <small>({size:.2f}kB)</small></label>
|
||||
<label>Database <small>({size:.2f}kB, search feeds: {feeds} query)</small></label>
|
||||
<input type='text' class='text disabled' value="{inner_path}" disabled='disabled'/>
|
||||
<a href='#Reindex' class='button' style='display: none'>Reindex</a>
|
||||
<a href='#Reload' id="button-dbreload" class='button'>Reload</a>
|
||||
</li>
|
||||
""".format(**locals()))
|
||||
|
||||
|
@ -557,3 +561,13 @@ class UiWebsocketPlugin(object):
|
|||
self.site.settings["autodownloadoptional"] = bool(owned)
|
||||
self.site.update()
|
||||
self.site.worker_manager.removeGoodFileTasks()
|
||||
|
||||
def actionDbReload(self, to):
|
||||
permissions = self.getPermissions(to)
|
||||
if "ADMIN" not in permissions:
|
||||
return self.response(to, "You don't have permission to run this command")
|
||||
|
||||
self.site.storage.closeDb()
|
||||
self.site.storage.getDb()
|
||||
|
||||
return self.response(to, "ok")
|
||||
|
|
|
@ -239,6 +239,13 @@ class Sidebar extends Class
|
|||
@updateHtmlTag()
|
||||
return false
|
||||
|
||||
# Database reload
|
||||
@tag.find("#button-dbreload").off("click").on "click", =>
|
||||
wrapper.ws.cmd "dbReload", [], =>
|
||||
wrapper.notifications.add "done-sitelimit", "done", "Database schema reloaded", 5000
|
||||
@updateHtmlTag()
|
||||
return false
|
||||
|
||||
# Update site
|
||||
@tag.find("#button-update").off("click").on "click", =>
|
||||
@tag.find("#button-update").addClass("loading")
|
||||
|
|
|
@ -318,7 +318,7 @@ window.initScrollable = function () {
|
|||
};
|
||||
|
||||
Sidebar.prototype.setSiteInfo = function(site_info) {
|
||||
RateLimit(3000, (function(_this) {
|
||||
RateLimit(1500, (function(_this) {
|
||||
return function() {
|
||||
return _this.updateHtmlTag();
|
||||
};
|
||||
|
@ -459,6 +459,15 @@ window.initScrollable = function () {
|
|||
return false;
|
||||
};
|
||||
})(this));
|
||||
this.tag.find("#button-dbreload").off("click").on("click", (function(_this) {
|
||||
return function() {
|
||||
wrapper.ws.cmd("dbReload", [], function() {
|
||||
wrapper.notifications.add("done-sitelimit", "done", "Database schema reloaded", 5000);
|
||||
return _this.updateHtmlTag();
|
||||
});
|
||||
return false;
|
||||
};
|
||||
})(this));
|
||||
this.tag.find("#button-update").off("click").on("click", (function(_this) {
|
||||
return function() {
|
||||
_this.tag.find("#button-update").addClass("loading");
|
||||
|
|
|
@ -8,7 +8,7 @@ class Config(object):
|
|||
|
||||
def __init__(self, argv):
|
||||
self.version = "0.3.7"
|
||||
self.rev = 1231
|
||||
self.rev = 1232
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.config_file = "zeronet.conf"
|
||||
|
|
Loading…
Reference in a new issue